@realtimex/email-automator 2.23.11 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,217 @@
1
+ function JE(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function Yl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zh={exports:{}},ll={};var P0;function QE(){if(P0)return ll;P0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:e,type:r,key:u,ref:i!==void 0?i:null,props:l}}return ll.Fragment=t,ll.jsx=n,ll.jsxs=n,ll}var z0;function ZE(){return z0||(z0=1,Zh.exports=QE()),Zh.exports}var o=ZE(),em={exports:{}},ze={};var L0;function eC(){if(L0)return ze;L0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function b(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function N(I,z,A){this.props=I,this.context=z,this.refs=S,this.updater=A||j}N.prototype.isReactComponent={},N.prototype.setState=function(I,z){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,z,"setState")},N.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function C(){}C.prototype=N.prototype;function T(I,z,A){this.props=I,this.context=z,this.refs=S,this.updater=A||j}var D=T.prototype=new C;D.constructor=T,_(D,N.prototype),D.isPureReactComponent=!0;var L=Array.isArray;function O(){}var B={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function q(I,z,A){var ee=A.ref;return{$$typeof:e,type:I,key:z,ref:ee!==void 0?ee:null,props:A}}function R(I,z){return q(I.type,z,I.props)}function J(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function K(I){var z={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(A){return z[A]})}var he=/\/+/g;function se(I,z){return typeof I=="object"&&I!==null&&I.key!=null?K(""+I.key):z.toString(36)}function ie(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(O,O):(I.status="pending",I.then(function(z){I.status==="pending"&&(I.status="fulfilled",I.value=z)},function(z){I.status==="pending"&&(I.status="rejected",I.reason=z)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function $(I,z,A,ee,ge){var ye=typeof I;(ye==="undefined"||ye==="boolean")&&(I=null);var ue=!1;if(I===null)ue=!0;else switch(ye){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(I.$$typeof){case e:case t:ue=!0;break;case p:return ue=I._init,$(ue(I._payload),z,A,ee,ge)}}if(ue)return ge=ge(I),ue=ee===""?"."+se(I,0):ee,L(ge)?(A="",ue!=null&&(A=ue.replace(he,"$&/")+"/"),$(ge,z,A,"",function(Ie){return Ie})):ge!=null&&(J(ge)&&(ge=R(ge,A+(ge.key==null||I&&I.key===ge.key?"":(""+ge.key).replace(he,"$&/")+"/")+ue)),z.push(ge)),1;ue=0;var ke=ee===""?".":ee+":";if(L(I))for(var Ne=0;Ne<I.length;Ne++)ee=I[Ne],ye=ke+se(ee,Ne),ue+=$(ee,z,A,ye,ge);else if(Ne=b(I),typeof Ne=="function")for(I=Ne.call(I),Ne=0;!(ee=I.next()).done;)ee=ee.value,ye=ke+se(ee,Ne++),ue+=$(ee,z,A,ye,ge);else if(ye==="object"){if(typeof I.then=="function")return $(ie(I),z,A,ee,ge);throw z=String(I),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return ue}function V(I,z,A){if(I==null)return I;var ee=[],ge=0;return $(I,ee,"","",function(ye){return z.call(A,ye,ge++)}),ee}function G(I){if(I._status===-1){var z=I._result;z=z(),z.then(function(A){(I._status===0||I._status===-1)&&(I._status=1,I._result=A)},function(A){(I._status===0||I._status===-1)&&(I._status=2,I._result=A)}),I._status===-1&&(I._status=0,I._result=z)}if(I._status===1)return I._result.default;throw I._result}var fe=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},P={map:V,forEach:function(I,z,A){V(I,function(){z.apply(this,arguments)},A)},count:function(I){var z=0;return V(I,function(){z++}),z},toArray:function(I){return V(I,function(z){return z})||[]},only:function(I){if(!J(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ze.Activity=g,ze.Children=P,ze.Component=N,ze.Fragment=n,ze.Profiler=i,ze.PureComponent=T,ze.StrictMode=r,ze.Suspense=h,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,ze.__COMPILER_RUNTIME={__proto__:null,c:function(I){return B.H.useMemoCache(I)}},ze.cache=function(I){return function(){return I.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(I,z,A){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ee=_({},I.props),ge=I.key;if(z!=null)for(ye in z.key!==void 0&&(ge=""+z.key),z)!M.call(z,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&z.ref===void 0||(ee[ye]=z[ye]);var ye=arguments.length-2;if(ye===1)ee.children=A;else if(1<ye){for(var ue=Array(ye),ke=0;ke<ye;ke++)ue[ke]=arguments[ke+2];ee.children=ue}return q(I.type,ge,ee)},ze.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:l,_context:I},I},ze.createElement=function(I,z,A){var ee,ge={},ye=null;if(z!=null)for(ee in z.key!==void 0&&(ye=""+z.key),z)M.call(z,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(ge[ee]=z[ee]);var ue=arguments.length-2;if(ue===1)ge.children=A;else if(1<ue){for(var ke=Array(ue),Ne=0;Ne<ue;Ne++)ke[Ne]=arguments[Ne+2];ge.children=ke}if(I&&I.defaultProps)for(ee in ue=I.defaultProps,ue)ge[ee]===void 0&&(ge[ee]=ue[ee]);return q(I,ye,ge)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(I){return{$$typeof:d,render:I}},ze.isValidElement=J,ze.lazy=function(I){return{$$typeof:p,_payload:{_status:-1,_result:I},_init:G}},ze.memo=function(I,z){return{$$typeof:m,type:I,compare:z===void 0?null:z}},ze.startTransition=function(I){var z=B.T,A={};B.T=A;try{var ee=I(),ge=B.S;ge!==null&&ge(A,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(O,fe)}catch(ye){fe(ye)}finally{z!==null&&A.types!==null&&(z.types=A.types),B.T=z}},ze.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},ze.use=function(I){return B.H.use(I)},ze.useActionState=function(I,z,A){return B.H.useActionState(I,z,A)},ze.useCallback=function(I,z){return B.H.useCallback(I,z)},ze.useContext=function(I){return B.H.useContext(I)},ze.useDebugValue=function(){},ze.useDeferredValue=function(I,z){return B.H.useDeferredValue(I,z)},ze.useEffect=function(I,z){return B.H.useEffect(I,z)},ze.useEffectEvent=function(I){return B.H.useEffectEvent(I)},ze.useId=function(){return B.H.useId()},ze.useImperativeHandle=function(I,z,A){return B.H.useImperativeHandle(I,z,A)},ze.useInsertionEffect=function(I,z){return B.H.useInsertionEffect(I,z)},ze.useLayoutEffect=function(I,z){return B.H.useLayoutEffect(I,z)},ze.useMemo=function(I,z){return B.H.useMemo(I,z)},ze.useOptimistic=function(I,z){return B.H.useOptimistic(I,z)},ze.useReducer=function(I,z,A){return B.H.useReducer(I,z,A)},ze.useRef=function(I){return B.H.useRef(I)},ze.useState=function(I){return B.H.useState(I)},ze.useSyncExternalStore=function(I,z,A){return B.H.useSyncExternalStore(I,z,A)},ze.useTransition=function(){return B.H.useTransition()},ze.version="19.2.3",ze}var I0;function mg(){return I0||(I0=1,em.exports=eC()),em.exports}var w=mg();const ej=Yl(w),pg=JE({__proto__:null,default:ej},[w]);var tm={exports:{}},cl={},nm={exports:{}},sm={};var U0;function tC(){return U0||(U0=1,(function(e){function t($,V){var G=$.length;$.push(V);e:for(;0<G;){var fe=G-1>>>1,P=$[fe];if(0<i(P,V))$[fe]=V,$[G]=P,G=fe;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var V=$[0],G=$.pop();if(G!==V){$[0]=G;e:for(var fe=0,P=$.length,I=P>>>1;fe<I;){var z=2*(fe+1)-1,A=$[z],ee=z+1,ge=$[ee];if(0>i(A,G))ee<P&&0>i(ge,A)?($[fe]=ge,$[ee]=G,fe=ee):($[fe]=A,$[z]=G,fe=z);else if(ee<P&&0>i(ge,G))$[fe]=ge,$[ee]=G,fe=ee;else break e}}return V}function i($,V){var G=$.sortIndex-V.sortIndex;return G!==0?G:$.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],m=[],p=1,g=null,v=3,b=!1,j=!1,_=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function D($){for(var V=n(m);V!==null;){if(V.callback===null)r(m);else if(V.startTime<=$)r(m),V.sortIndex=V.expirationTime,t(h,V);else break;V=n(m)}}function L($){if(_=!1,D($),!j)if(n(h)!==null)j=!0,O||(O=!0,K());else{var V=n(m);V!==null&&ie(L,V.startTime-$)}}var O=!1,B=-1,M=5,q=-1;function R(){return S?!0:!(e.unstable_now()-q<M)}function J(){if(S=!1,O){var $=e.unstable_now();q=$;var V=!0;try{e:{j=!1,_&&(_=!1,C(B),B=-1),b=!0;var G=v;try{t:{for(D($),g=n(h);g!==null&&!(g.expirationTime>$&&R());){var fe=g.callback;if(typeof fe=="function"){g.callback=null,v=g.priorityLevel;var P=fe(g.expirationTime<=$);if($=e.unstable_now(),typeof P=="function"){g.callback=P,D($),V=!0;break t}g===n(h)&&r(h),D($)}else r(h);g=n(h)}if(g!==null)V=!0;else{var I=n(m);I!==null&&ie(L,I.startTime-$),V=!1}}break e}finally{g=null,v=G,b=!1}V=void 0}}finally{V?K():O=!1}}}var K;if(typeof T=="function")K=function(){T(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,se=he.port2;he.port1.onmessage=J,K=function(){se.postMessage(null)}}else K=function(){N(J,0)};function ie($,V){B=N(function(){$(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function($){switch(v){case 1:case 2:case 3:var V=3;break;default:V=v}var G=v;v=V;try{return $()}finally{v=G}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function($,V){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var G=v;v=$;try{return V()}finally{v=G}},e.unstable_scheduleCallback=function($,V,G){var fe=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?fe+G:fe):G=fe,$){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=G+P,$={id:p++,callback:V,priorityLevel:$,startTime:G,expirationTime:P,sortIndex:-1},G>fe?($.sortIndex=G,t(m,$),n(h)===null&&$===n(m)&&(_?(C(B),B=-1):_=!0,ie(L,G-fe))):($.sortIndex=P,t(h,$),j||b||(j=!0,O||(O=!0,K()))),$},e.unstable_shouldYield=R,e.unstable_wrapCallback=function($){var V=v;return function(){var G=v;v=V;try{return $.apply(this,arguments)}finally{v=G}}}})(sm)),sm}var B0;function nC(){return B0||(B0=1,nm.exports=tC()),nm.exports}var rm={exports:{}},cn={};var V0;function sC(){if(V0)return cn;V0=1;var e=mg();function t(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)m+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(h,m,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:h,containerInfo:m,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,cn.createPortal=function(h,m){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(h,m,null,p)},cn.flushSync=function(h){var m=u.T,p=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=m,r.p=p,r.d.f()}},cn.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(h,m))},cn.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},cn.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var p=m.as,g=d(p,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,b=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;p==="style"?r.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:b}):p==="script"&&r.d.X(h,{crossOrigin:g,integrity:v,fetchPriority:b,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},cn.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var p=d(m.as,m.crossOrigin);r.d.M(h,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(h)},cn.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var p=m.as,g=d(p,m.crossOrigin);r.d.L(h,p,{crossOrigin:g,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})}},cn.preloadModule=function(h,m){if(typeof h=="string")if(m){var p=d(m.as,m.crossOrigin);r.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(h)},cn.requestFormReset=function(h){r.d.r(h)},cn.unstable_batchedUpdates=function(h,m){return h(m)},cn.useFormState=function(h,m,p){return u.H.useFormState(h,m,p)},cn.useFormStatus=function(){return u.H.useHostTransitionStatus()},cn.version="19.2.3",cn}var F0;function tj(){if(F0)return rm.exports;F0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),rm.exports=sC(),rm.exports}var $0;function rC(){if($0)return cl;$0=1;var e=nC(),t=mg(),n=tj();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var a=s,c=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(c=a.return),s=a.return;while(s)}return a.tag===3?c:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(l(s)!==s)throw Error(r(188))}function m(s){var a=s.alternate;if(!a){if(a=l(s),a===null)throw Error(r(188));return a!==s?null:s}for(var c=s,f=a;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(f=y.return,f!==null){c=f;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return h(y),s;if(x===f)return h(y),a;x=x.sibling}throw Error(r(188))}if(c.return!==f.return)c=y,f=x;else{for(var k=!1,E=y.child;E;){if(E===c){k=!0,c=y,f=x;break}if(E===f){k=!0,f=y,c=x;break}E=E.sibling}if(!k){for(E=x.child;E;){if(E===c){k=!0,c=x,f=y;break}if(E===f){k=!0,f=x,c=y;break}E=E.sibling}if(!k)throw Error(r(189))}}if(c.alternate!==f)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:a}function p(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=p(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),T=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function K(s){return s===null||typeof s!="object"?null:(s=J&&s[J]||s["@@iterator"],typeof s=="function"?s:null)}var he=Symbol.for("react.client.reference");function se(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===he?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case _:return"Fragment";case N:return"Profiler";case S:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case q:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case j:return"Portal";case T:return s.displayName||"Context";case C:return(s._context.displayName||"Context")+".Consumer";case D:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case B:return a=s.displayName||null,a!==null?a:se(s.type)||"Memo";case M:a=s._payload,s=s._init;try{return se(s(a))}catch{}}return null}var ie=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},fe=[],P=-1;function I(s){return{current:s}}function z(s){0>P||(s.current=fe[P],fe[P]=null,P--)}function A(s,a){P++,fe[P]=s.current,s.current=a}var ee=I(null),ge=I(null),ye=I(null),ue=I(null);function ke(s,a){switch(A(ye,a),A(ge,s),A(ee,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?r0(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=r0(a),s=a0(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}z(ee),A(ee,s)}function Ne(){z(ee),z(ge),z(ye)}function Ie(s){s.memoizedState!==null&&A(ue,s);var a=ee.current,c=a0(a,s.type);a!==c&&(A(ge,s),A(ee,c))}function rt(s){ge.current===s&&(z(ee),z(ge)),ue.current===s&&(z(ue),rl._currentValue=G)}var Pt,Ee;function Ct(s){if(Pt===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Pt=a&&a[1]||"",Ee=-1<c.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Pt+s+Ee}var Yt=!1;function Cn(s,a){if(!s||Yt)return"";Yt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Q){var X=Q}Reflect.construct(s,[],oe)}else{try{oe.call()}catch(Q){X=Q}s.call(oe.prototype)}}else{try{throw Error()}catch(Q){X=Q}(oe=s())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Q){if(Q&&X&&typeof Q.stack=="string")return[Q.stack,X.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),k=x[0],E=x[1];if(k&&E){var U=k.split(`
4
+ `),W=E.split(`
5
+ `);for(y=f=0;f<U.length&&!U[f].includes("DetermineComponentFrameRoot");)f++;for(;y<W.length&&!W[y].includes("DetermineComponentFrameRoot");)y++;if(f===U.length||y===W.length)for(f=U.length-1,y=W.length-1;1<=f&&0<=y&&U[f]!==W[y];)y--;for(;1<=f&&0<=y;f--,y--)if(U[f]!==W[y]){if(f!==1||y!==1)do if(f--,y--,0>y||U[f]!==W[y]){var ne=`
6
+ `+U[f].replace(" at new "," at ");return s.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",s.displayName)),ne}while(1<=f&&0<=y);break}}}finally{Yt=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?Ct(c):""}function An(s,a){switch(s.tag){case 26:case 27:case 5:return Ct(s.type);case 16:return Ct("Lazy");case 13:return s.child!==a&&a!==null?Ct("Suspense Fallback"):Ct("Suspense");case 19:return Ct("SuspenseList");case 0:case 15:return Cn(s.type,!1);case 11:return Cn(s.type.render,!1);case 1:return Cn(s.type,!0);case 31:return Ct("Activity");default:return""}}function Ss(s){try{var a="",c=null;do a+=An(s,c),c=s,s=s.return;while(s);return a}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var js=Object.prototype.hasOwnProperty,yr=e.unstable_scheduleCallback,$a=e.unstable_cancelCallback,Us=e.unstable_shouldYield,ic=e.unstable_requestPaint,At=e.unstable_now,qa=e.unstable_getCurrentPriorityLevel,re=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,Fe=e.unstable_LowPriority,Ze=e.unstable_IdlePriority,mn=e.log,cs=e.unstable_setDisableYieldValue,Qt=null,Rt=null;function ln(s){if(typeof mn=="function"&&cs(s),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(Qt,s)}catch{}}var at=Math.clz32?Math.clz32:Ud,ks=Math.log,Rn=Math.LN2;function Ud(s){return s>>>=0,s===0?32:31-(ks(s)/Rn|0)|0}var Ha=256,xr=262144,Ga=4194304;function te(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ve(s,a,c){var f=s.pendingLanes;if(f===0)return 0;var y=0,x=s.suspendedLanes,k=s.pingedLanes;s=s.warmLanes;var E=f&134217727;return E!==0?(f=E&~x,f!==0?y=te(f):(k&=E,k!==0?y=te(k):c||(c=E&~s,c!==0&&(y=te(c))))):(E=f&~x,E!==0?y=te(E):k!==0?y=te(k):c||(c=f&~s,c!==0&&(y=te(c)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:y}function Ue(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function aa(s,a){switch(s){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 Uy(){var s=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),s}function Bd(s){for(var a=[],c=0;31>c;c++)a.push(s);return a}function xo(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function U2(s,a,c,f,y,x){var k=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var E=s.entanglements,U=s.expirationTimes,W=s.hiddenUpdates;for(c=k&~c;0<c;){var ne=31-at(c),oe=1<<ne;E[ne]=0,U[ne]=-1;var X=W[ne];if(X!==null)for(W[ne]=null,ne=0;ne<X.length;ne++){var Q=X[ne];Q!==null&&(Q.lane&=-536870913)}c&=~oe}f!==0&&By(s,f,0),x!==0&&y===0&&s.tag!==0&&(s.suspendedLanes|=x&~(k&~a))}function By(s,a,c){s.pendingLanes|=a,s.suspendedLanes&=~a;var f=31-at(a);s.entangledLanes|=a,s.entanglements[f]=s.entanglements[f]|1073741824|c&261930}function Vy(s,a){var c=s.entangledLanes|=a;for(s=s.entanglements;c;){var f=31-at(c),y=1<<f;y&a|s[f]&a&&(s[f]|=a),c&=~y}}function Fy(s,a){var c=a&-a;return c=(c&42)!==0?1:Vd(c),(c&(s.suspendedLanes|a))!==0?0:c}function Vd(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Fd(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function $y(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:E0(s.type))}function qy(s,a){var c=V.p;try{return V.p=s,a()}finally{V.p=c}}var vr=Math.random().toString(36).slice(2),Zt="__reactFiber$"+vr,vn="__reactProps$"+vr,Ka="__reactContainer$"+vr,$d="__reactEvents$"+vr,B2="__reactListeners$"+vr,V2="__reactHandles$"+vr,Hy="__reactResources$"+vr,vo="__reactMarker$"+vr;function qd(s){delete s[Zt],delete s[vn],delete s[$d],delete s[B2],delete s[V2]}function Ya(s){var a=s[Zt];if(a)return a;for(var c=s.parentNode;c;){if(a=c[Ka]||c[Zt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(s=f0(s);s!==null;){if(c=s[Zt])return c;s=f0(s)}return a}s=c,c=s.parentNode}return null}function Wa(s){if(s=s[Zt]||s[Ka]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function bo(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function Xa(s){var a=s[Hy];return a||(a=s[Hy]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wt(s){s[vo]=!0}var Gy=new Set,Ky={};function ia(s,a){Ja(s,a),Ja(s+"Capture",a)}function Ja(s,a){for(Ky[s]=a,s=0;s<a.length;s++)Gy.add(a[s])}var F2=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]*$"),Yy={},Wy={};function $2(s){return js.call(Wy,s)?!0:js.call(Yy,s)?!1:F2.test(s)?Wy[s]=!0:(Yy[s]=!0,!1)}function oc(s,a,c){if($2(a))if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+c)}}function lc(s,a,c){if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+c)}}function Bs(s,a,c,f){if(f===null)s.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(a,c,""+f)}}function Hn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Xy(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function q2(s,a,c){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,x=f.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return y.call(this)},set:function(k){c=""+k,x.call(this,k)}}),Object.defineProperty(s,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(k){c=""+k},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Hd(s){if(!s._valueTracker){var a=Xy(s)?"checked":"value";s._valueTracker=q2(s,a,""+s[a])}}function Jy(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return s&&(f=Xy(s)?s.checked?"true":"false":s.value),s=f,s!==c?(a.setValue(s),!0):!1}function cc(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var H2=/[\n"\\]/g;function Gn(s){return s.replace(H2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Gd(s,a,c,f,y,x,k,E){s.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.type=k:s.removeAttribute("type"),a!=null?k==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Hn(a)):s.value!==""+Hn(a)&&(s.value=""+Hn(a)):k!=="submit"&&k!=="reset"||s.removeAttribute("value"),a!=null?Kd(s,k,Hn(a)):c!=null?Kd(s,k,Hn(c)):f!=null&&s.removeAttribute("value"),y==null&&x!=null&&(s.defaultChecked=!!x),y!=null&&(s.checked=y&&typeof y!="function"&&typeof y!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?s.name=""+Hn(E):s.removeAttribute("name")}function Qy(s,a,c,f,y,x,k,E){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Hd(s);return}c=c!=null?""+Hn(c):"",a=a!=null?""+Hn(a):c,E||a===s.value||(s.value=a),s.defaultValue=a}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=E?s.checked:!!f,s.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.name=k),Hd(s)}function Kd(s,a,c){a==="number"&&cc(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function Qa(s,a,c,f){if(s=s.options,a){a={};for(var y=0;y<c.length;y++)a["$"+c[y]]=!0;for(c=0;c<s.length;c++)y=a.hasOwnProperty("$"+s[c].value),s[c].selected!==y&&(s[c].selected=y),y&&f&&(s[c].defaultSelected=!0)}else{for(c=""+Hn(c),a=null,y=0;y<s.length;y++){if(s[y].value===c){s[y].selected=!0,f&&(s[y].defaultSelected=!0);return}a!==null||s[y].disabled||(a=s[y])}a!==null&&(a.selected=!0)}}function Zy(s,a,c){if(a!=null&&(a=""+Hn(a),a!==s.value&&(s.value=a),c==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=c!=null?""+Hn(c):""}function ex(s,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(r(92));if(ie(f)){if(1<f.length)throw Error(r(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Hn(a),s.defaultValue=c,f=s.textContent,f===c&&f!==""&&f!==null&&(s.value=f),Hd(s)}function Za(s,a){if(a){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=a;return}}s.textContent=a}var G2=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 tx(s,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":f?s.setProperty(a,c):typeof c!="number"||c===0||G2.has(a)?a==="float"?s.cssFloat=c:s[a]=(""+c).trim():s[a]=c+"px"}function nx(s,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var y in a)f=a[y],a.hasOwnProperty(y)&&c[y]!==f&&tx(s,y,f)}else for(var x in a)a.hasOwnProperty(x)&&tx(s,x,a[x])}function Yd(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var K2=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"]]),Y2=/^[\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 uc(s){return Y2.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Vs(){}var Wd=null;function Xd(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ei=null,ti=null;function sx(s){var a=Wa(s);if(a&&(s=a.stateNode)){var c=s[vn]||null;e:switch(s=a.stateNode,a.type){case"input":if(Gd(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Gn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==s&&f.form===s.form){var y=f[vn]||null;if(!y)throw Error(r(90));Gd(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===s.form&&Jy(f)}break e;case"textarea":Zy(s,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Qa(s,!!c.multiple,a,!1)}}}var Jd=!1;function rx(s,a,c){if(Jd)return s(a,c);Jd=!0;try{var f=s(a);return f}finally{if(Jd=!1,(ei!==null||ti!==null)&&(Jc(),ei&&(a=ei,s=ti,ti=ei=null,sx(a),s)))for(a=0;a<s.length;a++)sx(s[a])}}function wo(s,a){var c=s.stateNode;if(c===null)return null;var f=c[vn]||null;if(f===null)return null;c=f[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":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var Fs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qd=!1;if(Fs)try{var So={};Object.defineProperty(So,"passive",{get:function(){Qd=!0}}),window.addEventListener("test",So,So),window.removeEventListener("test",So,So)}catch{Qd=!1}var br=null,Zd=null,dc=null;function ax(){if(dc)return dc;var s,a=Zd,c=a.length,f,y="value"in br?br.value:br.textContent,x=y.length;for(s=0;s<c&&a[s]===y[s];s++);var k=c-s;for(f=1;f<=k&&a[c-f]===y[x-f];f++);return dc=y.slice(s,1<f?1-f:void 0)}function fc(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function hc(){return!0}function ix(){return!1}function bn(s){function a(c,f,y,x,k){this._reactName=c,this._targetInst=y,this.type=f,this.nativeEvent=x,this.target=k,this.currentTarget=null;for(var E in s)s.hasOwnProperty(E)&&(c=s[E],this[E]=c?c(x):x[E]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?hc:ix,this.isPropagationStopped=ix,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=hc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=hc)},persist:function(){},isPersistent:hc}),a}var oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=bn(oa),jo=g({},oa,{view:0,detail:0}),W2=bn(jo),ef,tf,ko,pc=g({},jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sf,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ko&&(ko&&s.type==="mousemove"?(ef=s.screenX-ko.screenX,tf=s.screenY-ko.screenY):tf=ef=0,ko=s),ef)},movementY:function(s){return"movementY"in s?s.movementY:tf}}),ox=bn(pc),X2=g({},pc,{dataTransfer:0}),J2=bn(X2),Q2=g({},jo,{relatedTarget:0}),nf=bn(Q2),Z2=g({},oa,{animationName:0,elapsedTime:0,pseudoElement:0}),eT=bn(Z2),tT=g({},oa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),nT=bn(tT),sT=g({},oa,{data:0}),lx=bn(sT),rT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aT={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"},iT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oT(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=iT[s])?!!a[s]:!1}function sf(){return oT}var lT=g({},jo,{key:function(s){if(s.key){var a=rT[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=fc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?aT[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sf,charCode:function(s){return s.type==="keypress"?fc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?fc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),cT=bn(lT),uT=g({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cx=bn(uT),dT=g({},jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sf}),fT=bn(dT),hT=g({},oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),mT=bn(hT),pT=g({},pc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),gT=bn(pT),yT=g({},oa,{newState:0,oldState:0}),xT=bn(yT),vT=[9,13,27,32],rf=Fs&&"CompositionEvent"in window,_o=null;Fs&&"documentMode"in document&&(_o=document.documentMode);var bT=Fs&&"TextEvent"in window&&!_o,ux=Fs&&(!rf||_o&&8<_o&&11>=_o),dx=" ",fx=!1;function hx(s,a){switch(s){case"keyup":return vT.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ni=!1;function wT(s,a){switch(s){case"compositionend":return mx(a);case"keypress":return a.which!==32?null:(fx=!0,dx);case"textInput":return s=a.data,s===dx&&fx?null:s;default:return null}}function ST(s,a){if(ni)return s==="compositionend"||!rf&&hx(s,a)?(s=ax(),dc=Zd=br=null,ni=!1,s):null;switch(s){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 ux&&a.locale!=="ko"?null:a.data;default:return null}}var jT={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 px(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!jT[s.type]:a==="textarea"}function gx(s,a,c,f){ei?ti?ti.push(f):ti=[f]:ei=f,a=ru(a,"onChange"),0<a.length&&(c=new mc("onChange","change",null,c,f),s.push({event:c,listeners:a}))}var No=null,To=null;function kT(s){Qb(s,0)}function gc(s){var a=bo(s);if(Jy(a))return s}function yx(s,a){if(s==="change")return a}var xx=!1;if(Fs){var af;if(Fs){var of="oninput"in document;if(!of){var vx=document.createElement("div");vx.setAttribute("oninput","return;"),of=typeof vx.oninput=="function"}af=of}else af=!1;xx=af&&(!document.documentMode||9<document.documentMode)}function bx(){No&&(No.detachEvent("onpropertychange",wx),To=No=null)}function wx(s){if(s.propertyName==="value"&&gc(To)){var a=[];gx(a,To,s,Xd(s)),rx(kT,a)}}function _T(s,a,c){s==="focusin"?(bx(),No=a,To=c,No.attachEvent("onpropertychange",wx)):s==="focusout"&&bx()}function NT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return gc(To)}function TT(s,a){if(s==="click")return gc(a)}function ET(s,a){if(s==="input"||s==="change")return gc(a)}function CT(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var Dn=typeof Object.is=="function"?Object.is:CT;function Eo(s,a){if(Dn(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var c=Object.keys(s),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var y=c[f];if(!js.call(a,y)||!Dn(s[y],a[y]))return!1}return!0}function Sx(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function jx(s,a){var c=Sx(s);s=0;for(var f;c;){if(c.nodeType===3){if(f=s+c.textContent.length,s<=a&&f>=a)return{node:c,offset:a-s};s=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Sx(c)}}function kx(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?kx(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function _x(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=cc(s.document);a instanceof s.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)s=a.contentWindow;else break;a=cc(s.document)}return a}function lf(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var AT=Fs&&"documentMode"in document&&11>=document.documentMode,si=null,cf=null,Co=null,uf=!1;function Nx(s,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;uf||si==null||si!==cc(f)||(f=si,"selectionStart"in f&&lf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Co&&Eo(Co,f)||(Co=f,f=ru(cf,"onSelect"),0<f.length&&(a=new mc("onSelect","select",null,a,c),s.push({event:a,listeners:f}),a.target=si)))}function la(s,a){var c={};return c[s.toLowerCase()]=a.toLowerCase(),c["Webkit"+s]="webkit"+a,c["Moz"+s]="moz"+a,c}var ri={animationend:la("Animation","AnimationEnd"),animationiteration:la("Animation","AnimationIteration"),animationstart:la("Animation","AnimationStart"),transitionrun:la("Transition","TransitionRun"),transitionstart:la("Transition","TransitionStart"),transitioncancel:la("Transition","TransitionCancel"),transitionend:la("Transition","TransitionEnd")},df={},Tx={};Fs&&(Tx=document.createElement("div").style,"AnimationEvent"in window||(delete ri.animationend.animation,delete ri.animationiteration.animation,delete ri.animationstart.animation),"TransitionEvent"in window||delete ri.transitionend.transition);function ca(s){if(df[s])return df[s];if(!ri[s])return s;var a=ri[s],c;for(c in a)if(a.hasOwnProperty(c)&&c in Tx)return df[s]=a[c];return s}var Ex=ca("animationend"),Cx=ca("animationiteration"),Ax=ca("animationstart"),RT=ca("transitionrun"),DT=ca("transitionstart"),OT=ca("transitioncancel"),Rx=ca("transitionend"),Dx=new Map,ff="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(" ");ff.push("scrollEnd");function us(s,a){Dx.set(s,a),ia(a,[s])}var yc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Kn=[],ai=0,hf=0;function xc(){for(var s=ai,a=hf=ai=0;a<s;){var c=Kn[a];Kn[a++]=null;var f=Kn[a];Kn[a++]=null;var y=Kn[a];Kn[a++]=null;var x=Kn[a];if(Kn[a++]=null,f!==null&&y!==null){var k=f.pending;k===null?y.next=y:(y.next=k.next,k.next=y),f.pending=y}x!==0&&Ox(c,y,x)}}function vc(s,a,c,f){Kn[ai++]=s,Kn[ai++]=a,Kn[ai++]=c,Kn[ai++]=f,hf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function mf(s,a,c,f){return vc(s,a,c,f),bc(s)}function ua(s,a){return vc(s,null,null,a),bc(s)}function Ox(s,a,c){s.lanes|=c;var f=s.alternate;f!==null&&(f.lanes|=c);for(var y=!1,x=s.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(y=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,y&&a!==null&&(y=31-at(c),s=x.hiddenUpdates,f=s[y],f===null?s[y]=[a]:f.push(a),a.lane=c|536870912),x):null}function bc(s){if(50<Jo)throw Jo=0,jh=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var ii={};function MT(s,a,c,f){this.tag=s,this.key=c,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=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(s,a,c,f){return new MT(s,a,c,f)}function pf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function $s(s,a){var c=s.alternate;return c===null?(c=On(s.tag,a,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=a,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,a=s.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Mx(s,a){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,a=c.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function wc(s,a,c,f,y,x){var k=0;if(f=s,typeof s=="function")pf(s)&&(k=1);else if(typeof s=="string")k=UE(s,c,ee.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case q:return s=On(31,c,a,y),s.elementType=q,s.lanes=x,s;case _:return da(c.children,y,x,a);case S:k=8,y|=24;break;case N:return s=On(12,c,a,y|2),s.elementType=N,s.lanes=x,s;case L:return s=On(13,c,a,y),s.elementType=L,s.lanes=x,s;case O:return s=On(19,c,a,y),s.elementType=O,s.lanes=x,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case T:k=10;break e;case C:k=9;break e;case D:k=11;break e;case B:k=14;break e;case M:k=16,f=null;break e}k=29,c=Error(r(130,s===null?"null":typeof s,"")),f=null}return a=On(k,c,a,y),a.elementType=s,a.type=f,a.lanes=x,a}function da(s,a,c,f){return s=On(7,s,f,a),s.lanes=c,s}function gf(s,a,c){return s=On(6,s,null,a),s.lanes=c,s}function Px(s){var a=On(18,null,null,0);return a.stateNode=s,a}function yf(s,a,c){return a=On(4,s.children!==null?s.children:[],s.key,a),a.lanes=c,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var zx=new WeakMap;function Yn(s,a){if(typeof s=="object"&&s!==null){var c=zx.get(s);return c!==void 0?c:(a={value:s,source:a,stack:Ss(a)},zx.set(s,a),a)}return{value:s,source:a,stack:Ss(a)}}var oi=[],li=0,Sc=null,Ao=0,Wn=[],Xn=0,wr=null,_s=1,Ns="";function qs(s,a){oi[li++]=Ao,oi[li++]=Sc,Sc=s,Ao=a}function Lx(s,a,c){Wn[Xn++]=_s,Wn[Xn++]=Ns,Wn[Xn++]=wr,wr=s;var f=_s;s=Ns;var y=32-at(f)-1;f&=~(1<<y),c+=1;var x=32-at(a)+y;if(30<x){var k=y-y%5;x=(f&(1<<k)-1).toString(32),f>>=k,y-=k,_s=1<<32-at(a)+y|c<<y|f,Ns=x+s}else _s=1<<x|c<<y|f,Ns=s}function xf(s){s.return!==null&&(qs(s,1),Lx(s,1,0))}function vf(s){for(;s===Sc;)Sc=oi[--li],oi[li]=null,Ao=oi[--li],oi[li]=null;for(;s===wr;)wr=Wn[--Xn],Wn[Xn]=null,Ns=Wn[--Xn],Wn[Xn]=null,_s=Wn[--Xn],Wn[Xn]=null}function Ix(s,a){Wn[Xn++]=_s,Wn[Xn++]=Ns,Wn[Xn++]=wr,_s=a.id,Ns=a.overflow,wr=s}var en=null,pt=null,Je=!1,Sr=null,Jn=!1,bf=Error(r(519));function jr(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ro(Yn(a,s)),bf}function Ux(s){var a=s.stateNode,c=s.type,f=s.memoizedProps;switch(a[Zt]=s,a[vn]=f,c){case"dialog":He("cancel",a),He("close",a);break;case"iframe":case"object":case"embed":He("load",a);break;case"video":case"audio":for(c=0;c<Zo.length;c++)He(Zo[c],a);break;case"source":He("error",a);break;case"img":case"image":case"link":He("error",a),He("load",a);break;case"details":He("toggle",a);break;case"input":He("invalid",a),Qy(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":He("invalid",a);break;case"textarea":He("invalid",a),ex(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||n0(a.textContent,c)?(f.popover!=null&&(He("beforetoggle",a),He("toggle",a)),f.onScroll!=null&&He("scroll",a),f.onScrollEnd!=null&&He("scrollend",a),f.onClick!=null&&(a.onclick=Vs),a=!0):a=!1,a||jr(s,!0)}function Bx(s){for(en=s.return;en;)switch(en.tag){case 5:case 31:case 13:Jn=!1;return;case 27:case 3:Jn=!0;return;default:en=en.return}}function ci(s){if(s!==en)return!1;if(!Je)return Bx(s),Je=!0,!1;var a=s.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Ih(s.type,s.memoizedProps)),c=!c),c&&pt&&jr(s),Bx(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));pt=d0(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));pt=d0(s)}else a===27?(a=pt,Lr(s.type)?(s=$h,$h=null,pt=s):pt=a):pt=en?Zn(s.stateNode.nextSibling):null;return!0}function fa(){pt=en=null,Je=!1}function wf(){var s=Sr;return s!==null&&(kn===null?kn=s:kn.push.apply(kn,s),Sr=null),s}function Ro(s){Sr===null?Sr=[s]:Sr.push(s)}var Sf=I(null),ha=null,Hs=null;function kr(s,a,c){A(Sf,a._currentValue),a._currentValue=c}function Gs(s){s._currentValue=Sf.current,z(Sf)}function jf(s,a,c){for(;s!==null;){var f=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),s===c)break;s=s.return}}function kf(s,a,c,f){var y=s.child;for(y!==null&&(y.return=s);y!==null;){var x=y.dependencies;if(x!==null){var k=y.child;x=x.firstContext;e:for(;x!==null;){var E=x;x=y;for(var U=0;U<a.length;U++)if(E.context===a[U]){x.lanes|=c,E=x.alternate,E!==null&&(E.lanes|=c),jf(x.return,c,s),f||(k=null);break e}x=E.next}}else if(y.tag===18){if(k=y.return,k===null)throw Error(r(341));k.lanes|=c,x=k.alternate,x!==null&&(x.lanes|=c),jf(k,c,s),k=null}else k=y.child;if(k!==null)k.return=y;else for(k=y;k!==null;){if(k===s){k=null;break}if(y=k.sibling,y!==null){y.return=k.return,k=y;break}k=k.return}y=k}}function ui(s,a,c,f){s=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var k=y.alternate;if(k===null)throw Error(r(387));if(k=k.memoizedProps,k!==null){var E=y.type;Dn(y.pendingProps.value,k.value)||(s!==null?s.push(E):s=[E])}}else if(y===ue.current){if(k=y.alternate,k===null)throw Error(r(387));k.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(s!==null?s.push(rl):s=[rl])}y=y.return}s!==null&&kf(a,s,c,f),a.flags|=262144}function jc(s){for(s=s.firstContext;s!==null;){if(!Dn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ma(s){ha=s,Hs=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function tn(s){return Vx(ha,s)}function kc(s,a){return ha===null&&ma(s),Vx(s,a)}function Vx(s,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Hs===null){if(s===null)throw Error(r(308));Hs=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Hs=Hs.next=a;return c}var PT=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(c,f){s.push(f)}};this.abort=function(){a.aborted=!0,s.forEach(function(c){return c()})}},zT=e.unstable_scheduleCallback,LT=e.unstable_NormalPriority,zt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _f(){return{controller:new PT,data:new Map,refCount:0}}function Do(s){s.refCount--,s.refCount===0&&zT(LT,function(){s.controller.abort()})}var Oo=null,Nf=0,di=0,fi=null;function IT(s,a){if(Oo===null){var c=Oo=[];Nf=0,di=Ch(),fi={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Nf++,a.then(Fx,Fx),a}function Fx(){if(--Nf===0&&Oo!==null){fi!==null&&(fi.status="fulfilled");var s=Oo;Oo=null,di=0,fi=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function UT(s,a){var c=[],f={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return s.then(function(){f.status="fulfilled",f.value=a;for(var y=0;y<c.length;y++)(0,c[y])(a)},function(y){for(f.status="rejected",f.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),f}var $x=$.S;$.S=function(s,a){Nb=At(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&IT(s,a),$x!==null&&$x(s,a)};var pa=I(null);function Tf(){var s=pa.current;return s!==null?s:dt.pooledCache}function _c(s,a){a===null?A(pa,pa.current):A(pa,a.pool)}function qx(){var s=Tf();return s===null?null:{parent:zt._currentValue,pool:s}}var hi=Error(r(460)),Ef=Error(r(474)),Nc=Error(r(542)),Tc={then:function(){}};function Hx(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Gx(s,a,c){switch(c=s[c],c===void 0?s.push(a):c!==a&&(a.then(Vs,Vs),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Yx(s),s;default:if(typeof a.status=="string")a.then(Vs,Vs);else{if(s=dt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(f){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=f}},function(f){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Yx(s),s}throw ya=a,hi}}function ga(s){try{var a=s._init;return a(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ya=c,hi):c}}var ya=null;function Kx(){if(ya===null)throw Error(r(459));var s=ya;return ya=null,s}function Yx(s){if(s===hi||s===Nc)throw Error(r(483))}var mi=null,Mo=0;function Ec(s){var a=Mo;return Mo+=1,mi===null&&(mi=[]),Gx(mi,s,a)}function Po(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Cc(s,a){throw a.$$typeof===v?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function Wx(s){function a(H,F){if(s){var Y=H.deletions;Y===null?(H.deletions=[F],H.flags|=16):Y.push(F)}}function c(H,F){if(!s)return null;for(;F!==null;)a(H,F),F=F.sibling;return null}function f(H){for(var F=new Map;H!==null;)H.key!==null?F.set(H.key,H):F.set(H.index,H),H=H.sibling;return F}function y(H,F){return H=$s(H,F),H.index=0,H.sibling=null,H}function x(H,F,Y){return H.index=Y,s?(Y=H.alternate,Y!==null?(Y=Y.index,Y<F?(H.flags|=67108866,F):Y):(H.flags|=67108866,F)):(H.flags|=1048576,F)}function k(H){return s&&H.alternate===null&&(H.flags|=67108866),H}function E(H,F,Y,ae){return F===null||F.tag!==6?(F=gf(Y,H.mode,ae),F.return=H,F):(F=y(F,Y),F.return=H,F)}function U(H,F,Y,ae){var Te=Y.type;return Te===_?ne(H,F,Y.props.children,ae,Y.key):F!==null&&(F.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===M&&ga(Te)===F.type)?(F=y(F,Y.props),Po(F,Y),F.return=H,F):(F=wc(Y.type,Y.key,Y.props,null,H.mode,ae),Po(F,Y),F.return=H,F)}function W(H,F,Y,ae){return F===null||F.tag!==4||F.stateNode.containerInfo!==Y.containerInfo||F.stateNode.implementation!==Y.implementation?(F=yf(Y,H.mode,ae),F.return=H,F):(F=y(F,Y.children||[]),F.return=H,F)}function ne(H,F,Y,ae,Te){return F===null||F.tag!==7?(F=da(Y,H.mode,ae,Te),F.return=H,F):(F=y(F,Y),F.return=H,F)}function oe(H,F,Y){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=gf(""+F,H.mode,Y),F.return=H,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case b:return Y=wc(F.type,F.key,F.props,null,H.mode,Y),Po(Y,F),Y.return=H,Y;case j:return F=yf(F,H.mode,Y),F.return=H,F;case M:return F=ga(F),oe(H,F,Y)}if(ie(F)||K(F))return F=da(F,H.mode,Y,null),F.return=H,F;if(typeof F.then=="function")return oe(H,Ec(F),Y);if(F.$$typeof===T)return oe(H,kc(H,F),Y);Cc(H,F)}return null}function X(H,F,Y,ae){var Te=F!==null?F.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Te!==null?null:E(H,F,""+Y,ae);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:return Y.key===Te?U(H,F,Y,ae):null;case j:return Y.key===Te?W(H,F,Y,ae):null;case M:return Y=ga(Y),X(H,F,Y,ae)}if(ie(Y)||K(Y))return Te!==null?null:ne(H,F,Y,ae,null);if(typeof Y.then=="function")return X(H,F,Ec(Y),ae);if(Y.$$typeof===T)return X(H,F,kc(H,Y),ae);Cc(H,Y)}return null}function Q(H,F,Y,ae,Te){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return H=H.get(Y)||null,E(F,H,""+ae,Te);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return H=H.get(ae.key===null?Y:ae.key)||null,U(F,H,ae,Te);case j:return H=H.get(ae.key===null?Y:ae.key)||null,W(F,H,ae,Te);case M:return ae=ga(ae),Q(H,F,Y,ae,Te)}if(ie(ae)||K(ae))return H=H.get(Y)||null,ne(F,H,ae,Te,null);if(typeof ae.then=="function")return Q(H,F,Y,Ec(ae),Te);if(ae.$$typeof===T)return Q(H,F,Y,kc(F,ae),Te);Cc(F,ae)}return null}function xe(H,F,Y,ae){for(var Te=null,et=null,je=F,Be=F=0,Xe=null;je!==null&&Be<Y.length;Be++){je.index>Be?(Xe=je,je=null):Xe=je.sibling;var tt=X(H,je,Y[Be],ae);if(tt===null){je===null&&(je=Xe);break}s&&je&&tt.alternate===null&&a(H,je),F=x(tt,F,Be),et===null?Te=tt:et.sibling=tt,et=tt,je=Xe}if(Be===Y.length)return c(H,je),Je&&qs(H,Be),Te;if(je===null){for(;Be<Y.length;Be++)je=oe(H,Y[Be],ae),je!==null&&(F=x(je,F,Be),et===null?Te=je:et.sibling=je,et=je);return Je&&qs(H,Be),Te}for(je=f(je);Be<Y.length;Be++)Xe=Q(je,H,Be,Y[Be],ae),Xe!==null&&(s&&Xe.alternate!==null&&je.delete(Xe.key===null?Be:Xe.key),F=x(Xe,F,Be),et===null?Te=Xe:et.sibling=Xe,et=Xe);return s&&je.forEach(function(Fr){return a(H,Fr)}),Je&&qs(H,Be),Te}function Ae(H,F,Y,ae){if(Y==null)throw Error(r(151));for(var Te=null,et=null,je=F,Be=F=0,Xe=null,tt=Y.next();je!==null&&!tt.done;Be++,tt=Y.next()){je.index>Be?(Xe=je,je=null):Xe=je.sibling;var Fr=X(H,je,tt.value,ae);if(Fr===null){je===null&&(je=Xe);break}s&&je&&Fr.alternate===null&&a(H,je),F=x(Fr,F,Be),et===null?Te=Fr:et.sibling=Fr,et=Fr,je=Xe}if(tt.done)return c(H,je),Je&&qs(H,Be),Te;if(je===null){for(;!tt.done;Be++,tt=Y.next())tt=oe(H,tt.value,ae),tt!==null&&(F=x(tt,F,Be),et===null?Te=tt:et.sibling=tt,et=tt);return Je&&qs(H,Be),Te}for(je=f(je);!tt.done;Be++,tt=Y.next())tt=Q(je,H,Be,tt.value,ae),tt!==null&&(s&&tt.alternate!==null&&je.delete(tt.key===null?Be:tt.key),F=x(tt,F,Be),et===null?Te=tt:et.sibling=tt,et=tt);return s&&je.forEach(function(XE){return a(H,XE)}),Je&&qs(H,Be),Te}function ut(H,F,Y,ae){if(typeof Y=="object"&&Y!==null&&Y.type===_&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:e:{for(var Te=Y.key;F!==null;){if(F.key===Te){if(Te=Y.type,Te===_){if(F.tag===7){c(H,F.sibling),ae=y(F,Y.props.children),ae.return=H,H=ae;break e}}else if(F.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===M&&ga(Te)===F.type){c(H,F.sibling),ae=y(F,Y.props),Po(ae,Y),ae.return=H,H=ae;break e}c(H,F);break}else a(H,F);F=F.sibling}Y.type===_?(ae=da(Y.props.children,H.mode,ae,Y.key),ae.return=H,H=ae):(ae=wc(Y.type,Y.key,Y.props,null,H.mode,ae),Po(ae,Y),ae.return=H,H=ae)}return k(H);case j:e:{for(Te=Y.key;F!==null;){if(F.key===Te)if(F.tag===4&&F.stateNode.containerInfo===Y.containerInfo&&F.stateNode.implementation===Y.implementation){c(H,F.sibling),ae=y(F,Y.children||[]),ae.return=H,H=ae;break e}else{c(H,F);break}else a(H,F);F=F.sibling}ae=yf(Y,H.mode,ae),ae.return=H,H=ae}return k(H);case M:return Y=ga(Y),ut(H,F,Y,ae)}if(ie(Y))return xe(H,F,Y,ae);if(K(Y)){if(Te=K(Y),typeof Te!="function")throw Error(r(150));return Y=Te.call(Y),Ae(H,F,Y,ae)}if(typeof Y.then=="function")return ut(H,F,Ec(Y),ae);if(Y.$$typeof===T)return ut(H,F,kc(H,Y),ae);Cc(H,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,F!==null&&F.tag===6?(c(H,F.sibling),ae=y(F,Y),ae.return=H,H=ae):(c(H,F),ae=gf(Y,H.mode,ae),ae.return=H,H=ae),k(H)):c(H,F)}return function(H,F,Y,ae){try{Mo=0;var Te=ut(H,F,Y,ae);return mi=null,Te}catch(je){if(je===hi||je===Nc)throw je;var et=On(29,je,null,H.mode);return et.lanes=ae,et.return=H,et}}}var xa=Wx(!0),Xx=Wx(!1),_r=!1;function Cf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Af(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Nr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Tr(s,a,c){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(st&2)!==0){var y=f.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),f.pending=a,a=bc(s),Ox(s,null,c),a}return vc(s,f,a,c),bc(s)}function zo(s,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,Vy(s,c)}}function Rf(s,a){var c=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?y=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?y=x=a:x=x.next=a}else y=x=a;c={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=a}var Df=!1;function Lo(){if(Df){var s=fi;if(s!==null)throw s}}function Io(s,a,c,f){Df=!1;var y=s.updateQueue;_r=!1;var x=y.firstBaseUpdate,k=y.lastBaseUpdate,E=y.shared.pending;if(E!==null){y.shared.pending=null;var U=E,W=U.next;U.next=null,k===null?x=W:k.next=W,k=U;var ne=s.alternate;ne!==null&&(ne=ne.updateQueue,E=ne.lastBaseUpdate,E!==k&&(E===null?ne.firstBaseUpdate=W:E.next=W,ne.lastBaseUpdate=U))}if(x!==null){var oe=y.baseState;k=0,ne=W=U=null,E=x;do{var X=E.lane&-536870913,Q=X!==E.lane;if(Q?(We&X)===X:(f&X)===X){X!==0&&X===di&&(Df=!0),ne!==null&&(ne=ne.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var xe=s,Ae=E;X=a;var ut=c;switch(Ae.tag){case 1:if(xe=Ae.payload,typeof xe=="function"){oe=xe.call(ut,oe,X);break e}oe=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ae.payload,X=typeof xe=="function"?xe.call(ut,oe,X):xe,X==null)break e;oe=g({},oe,X);break e;case 2:_r=!0}}X=E.callback,X!==null&&(s.flags|=64,Q&&(s.flags|=8192),Q=y.callbacks,Q===null?y.callbacks=[X]:Q.push(X))}else Q={lane:X,tag:E.tag,payload:E.payload,callback:E.callback,next:null},ne===null?(W=ne=Q,U=oe):ne=ne.next=Q,k|=X;if(E=E.next,E===null){if(E=y.shared.pending,E===null)break;Q=E,E=Q.next,Q.next=null,y.lastBaseUpdate=Q,y.shared.pending=null}}while(!0);ne===null&&(U=oe),y.baseState=U,y.firstBaseUpdate=W,y.lastBaseUpdate=ne,x===null&&(y.shared.lanes=0),Dr|=k,s.lanes=k,s.memoizedState=oe}}function Jx(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function Qx(s,a){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Jx(c[s],a)}var pi=I(null),Ac=I(0);function Zx(s,a){s=tr,A(Ac,s),A(pi,a),tr=s|a.baseLanes}function Of(){A(Ac,tr),A(pi,pi.current)}function Mf(){tr=Ac.current,z(pi),z(Ac)}var Mn=I(null),Qn=null;function Er(s){var a=s.alternate;A(Dt,Dt.current&1),A(Mn,s),Qn===null&&(a===null||pi.current!==null||a.memoizedState!==null)&&(Qn=s)}function Pf(s){A(Dt,Dt.current),A(Mn,s),Qn===null&&(Qn=s)}function ev(s){s.tag===22?(A(Dt,Dt.current),A(Mn,s),Qn===null&&(Qn=s)):Cr()}function Cr(){A(Dt,Dt.current),A(Mn,Mn.current)}function Pn(s){z(Mn),Qn===s&&(Qn=null),z(Dt)}var Dt=I(0);function Rc(s){for(var a=s;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Vh(c)||Fh(c)))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===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ks=0,Le=null,lt=null,Lt=null,Dc=!1,gi=!1,va=!1,Oc=0,Uo=0,yi=null,BT=0;function _t(){throw Error(r(321))}function zf(s,a){if(a===null)return!1;for(var c=0;c<a.length&&c<s.length;c++)if(!Dn(s[c],a[c]))return!1;return!0}function Lf(s,a,c,f,y,x){return Ks=x,Le=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,$.H=s===null||s.memoizedState===null?Lv:Qf,va=!1,x=c(f,y),va=!1,gi&&(x=nv(a,c,f,y)),tv(s),x}function tv(s){$.H=Fo;var a=lt!==null&&lt.next!==null;if(Ks=0,Lt=lt=Le=null,Dc=!1,Uo=0,yi=null,a)throw Error(r(300));s===null||It||(s=s.dependencies,s!==null&&jc(s)&&(It=!0))}function nv(s,a,c,f){Le=s;var y=0;do{if(gi&&(yi=null),Uo=0,gi=!1,25<=y)throw Error(r(301));if(y+=1,Lt=lt=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}$.H=Iv,x=a(c,f)}while(gi);return x}function VT(){var s=$.H,a=s.useState()[0];return a=typeof a.then=="function"?Bo(a):a,s=s.useState()[0],(lt!==null?lt.memoizedState:null)!==s&&(Le.flags|=1024),a}function If(){var s=Oc!==0;return Oc=0,s}function Uf(s,a,c){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~c}function Bf(s){if(Dc){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Dc=!1}Ks=0,Lt=lt=Le=null,gi=!1,Uo=Oc=0,yi=null}function pn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?Le.memoizedState=Lt=s:Lt=Lt.next=s,Lt}function Ot(){if(lt===null){var s=Le.alternate;s=s!==null?s.memoizedState:null}else s=lt.next;var a=Lt===null?Le.memoizedState:Lt.next;if(a!==null)Lt=a,lt=s;else{if(s===null)throw Le.alternate===null?Error(r(467)):Error(r(310));lt=s,s={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},Lt===null?Le.memoizedState=Lt=s:Lt=Lt.next=s}return Lt}function Mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bo(s){var a=Uo;return Uo+=1,yi===null&&(yi=[]),s=Gx(yi,s,a),a=Le,(Lt===null?a.memoizedState:Lt.next)===null&&(a=a.alternate,$.H=a===null||a.memoizedState===null?Lv:Qf),s}function Pc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Bo(s);if(s.$$typeof===T)return tn(s)}throw Error(r(438,String(s)))}function Vf(s){var a=null,c=Le.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Le.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Mc(),Le.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(s),f=0;f<s;f++)c[f]=R;return a.index++,c}function Ys(s,a){return typeof a=="function"?a(s):a}function zc(s){var a=Ot();return Ff(a,lt,s)}function Ff(s,a,c){var f=s.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=c;var y=s.baseQueue,x=f.pending;if(x!==null){if(y!==null){var k=y.next;y.next=x.next,x.next=k}a.baseQueue=y=x,f.pending=null}if(x=s.baseState,y===null)s.memoizedState=x;else{a=y.next;var E=k=null,U=null,W=a,ne=!1;do{var oe=W.lane&-536870913;if(oe!==W.lane?(We&oe)===oe:(Ks&oe)===oe){var X=W.revertLane;if(X===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),oe===di&&(ne=!0);else if((Ks&X)===X){W=W.next,X===di&&(ne=!0);continue}else oe={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},U===null?(E=U=oe,k=x):U=U.next=oe,Le.lanes|=X,Dr|=X;oe=W.action,va&&c(x,oe),x=W.hasEagerState?W.eagerState:c(x,oe)}else X={lane:oe,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},U===null?(E=U=X,k=x):U=U.next=X,Le.lanes|=oe,Dr|=oe;W=W.next}while(W!==null&&W!==a);if(U===null?k=x:U.next=E,!Dn(x,s.memoizedState)&&(It=!0,ne&&(c=fi,c!==null)))throw c;s.memoizedState=x,s.baseState=k,s.baseQueue=U,f.lastRenderedState=x}return y===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function $f(s){var a=Ot(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var f=c.dispatch,y=c.pending,x=a.memoizedState;if(y!==null){c.pending=null;var k=y=y.next;do x=s(x,k.action),k=k.next;while(k!==y);Dn(x,a.memoizedState)||(It=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,f]}function sv(s,a,c){var f=Le,y=Ot(),x=Je;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=a();var k=!Dn((lt||y).memoizedState,c);if(k&&(y.memoizedState=c,It=!0),y=y.queue,Gf(iv.bind(null,f,y,s),[s]),y.getSnapshot!==a||k||Lt!==null&&Lt.memoizedState.tag&1){if(f.flags|=2048,xi(9,{destroy:void 0},av.bind(null,f,y,c,a),null),dt===null)throw Error(r(349));x||(Ks&127)!==0||rv(f,a,c)}return c}function rv(s,a,c){s.flags|=16384,s={getSnapshot:a,value:c},a=Le.updateQueue,a===null?(a=Mc(),Le.updateQueue=a,a.stores=[s]):(c=a.stores,c===null?a.stores=[s]:c.push(s))}function av(s,a,c,f){a.value=c,a.getSnapshot=f,ov(a)&&lv(s)}function iv(s,a,c){return c(function(){ov(a)&&lv(s)})}function ov(s){var a=s.getSnapshot;s=s.value;try{var c=a();return!Dn(s,c)}catch{return!0}}function lv(s){var a=ua(s,2);a!==null&&_n(a,s,2)}function qf(s){var a=pn();if(typeof s=="function"){var c=s;if(s=c(),va){ln(!0);try{c()}finally{ln(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:s},a}function cv(s,a,c,f){return s.baseState=c,Ff(s,lt,typeof f=="function"?f:Ys)}function FT(s,a,c,f,y){if(Uc(s))throw Error(r(485));if(s=a.action,s!==null){var x={payload:y,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){x.listeners.push(k)}};$.T!==null?c(!0):x.isTransition=!1,f(x),c=a.pending,c===null?(x.next=a.pending=x,uv(a,x)):(x.next=c.next,a.pending=c.next=x)}}function uv(s,a){var c=a.action,f=a.payload,y=s.state;if(a.isTransition){var x=$.T,k={};$.T=k;try{var E=c(y,f),U=$.S;U!==null&&U(k,E),dv(s,a,E)}catch(W){Hf(s,a,W)}finally{x!==null&&k.types!==null&&(x.types=k.types),$.T=x}}else try{x=c(y,f),dv(s,a,x)}catch(W){Hf(s,a,W)}}function dv(s,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){fv(s,a,f)},function(f){return Hf(s,a,f)}):fv(s,a,c)}function fv(s,a,c){a.status="fulfilled",a.value=c,hv(a),s.state=c,a=s.pending,a!==null&&(c=a.next,c===a?s.pending=null:(c=c.next,a.next=c,uv(s,c)))}function Hf(s,a,c){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,hv(a),a=a.next;while(a!==f)}s.action=null}function hv(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function mv(s,a){return a}function pv(s,a){if(Je){var c=dt.formState;if(c!==null){e:{var f=Le;if(Je){if(pt){t:{for(var y=pt,x=Jn;y.nodeType!==8;){if(!x){y=null;break t}if(y=Zn(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){pt=Zn(y.nextSibling),f=y.data==="F!";break e}}jr(f)}f=!1}f&&(a=c[0])}}return c=pn(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mv,lastRenderedState:a},c.queue=f,c=Mv.bind(null,Le,f),f.dispatch=c,f=qf(!1),x=Jf.bind(null,Le,!1,f.queue),f=pn(),y={state:a,dispatch:null,action:s,pending:null},f.queue=y,c=FT.bind(null,Le,y,x,c),y.dispatch=c,f.memoizedState=s,[a,c,!1]}function gv(s){var a=Ot();return yv(a,lt,s)}function yv(s,a,c){if(a=Ff(s,a,mv)[0],s=zc(Ys)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Bo(a)}catch(k){throw k===hi?Nc:k}else f=a;a=Ot();var y=a.queue,x=y.dispatch;return c!==a.memoizedState&&(Le.flags|=2048,xi(9,{destroy:void 0},$T.bind(null,y,c),null)),[f,x,s]}function $T(s,a){s.action=a}function xv(s){var a=Ot(),c=lt;if(c!==null)return yv(a,c,s);Ot(),a=a.memoizedState,c=Ot();var f=c.queue.dispatch;return c.memoizedState=s,[a,f,!1]}function xi(s,a,c,f){return s={tag:s,create:c,deps:f,inst:a,next:null},a=Le.updateQueue,a===null&&(a=Mc(),Le.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=s.next=s:(f=c.next,c.next=s,s.next=f,a.lastEffect=s),s}function vv(){return Ot().memoizedState}function Lc(s,a,c,f){var y=pn();Le.flags|=s,y.memoizedState=xi(1|a,{destroy:void 0},c,f===void 0?null:f)}function Ic(s,a,c,f){var y=Ot();f=f===void 0?null:f;var x=y.memoizedState.inst;lt!==null&&f!==null&&zf(f,lt.memoizedState.deps)?y.memoizedState=xi(a,x,c,f):(Le.flags|=s,y.memoizedState=xi(1|a,x,c,f))}function bv(s,a){Lc(8390656,8,s,a)}function Gf(s,a){Ic(2048,8,s,a)}function qT(s){Le.flags|=4;var a=Le.updateQueue;if(a===null)a=Mc(),Le.updateQueue=a,a.events=[s];else{var c=a.events;c===null?a.events=[s]:c.push(s)}}function wv(s){var a=Ot().memoizedState;return qT({ref:a,nextImpl:s}),function(){if((st&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Sv(s,a){return Ic(4,2,s,a)}function jv(s,a){return Ic(4,4,s,a)}function kv(s,a){if(typeof a=="function"){s=s();var c=a(s);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function _v(s,a,c){c=c!=null?c.concat([s]):null,Ic(4,4,kv.bind(null,a,s),c)}function Kf(){}function Nv(s,a){var c=Ot();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&zf(a,f[1])?f[0]:(c.memoizedState=[s,a],s)}function Tv(s,a){var c=Ot();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&zf(a,f[1]))return f[0];if(f=s(),va){ln(!0);try{s()}finally{ln(!1)}}return c.memoizedState=[f,a],f}function Yf(s,a,c){return c===void 0||(Ks&1073741824)!==0&&(We&261930)===0?s.memoizedState=a:(s.memoizedState=c,s=Eb(),Le.lanes|=s,Dr|=s,c)}function Ev(s,a,c,f){return Dn(c,a)?c:pi.current!==null?(s=Yf(s,c,f),Dn(s,a)||(It=!0),s):(Ks&42)===0||(Ks&1073741824)!==0&&(We&261930)===0?(It=!0,s.memoizedState=c):(s=Eb(),Le.lanes|=s,Dr|=s,a)}function Cv(s,a,c,f,y){var x=V.p;V.p=x!==0&&8>x?x:8;var k=$.T,E={};$.T=E,Jf(s,!1,a,c);try{var U=y(),W=$.S;if(W!==null&&W(E,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ne=UT(U,f);Vo(s,a,ne,In(s))}else Vo(s,a,f,In(s))}catch(oe){Vo(s,a,{then:function(){},status:"rejected",reason:oe},In())}finally{V.p=x,k!==null&&E.types!==null&&(k.types=E.types),$.T=k}}function HT(){}function Wf(s,a,c,f){if(s.tag!==5)throw Error(r(476));var y=Av(s).queue;Cv(s,y,a,G,c===null?HT:function(){return Rv(s),c(f)})}function Av(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:G},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:c},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function Rv(s){var a=Av(s);a.next===null&&(a=s.alternate.memoizedState),Vo(s,a.next.queue,{},In())}function Xf(){return tn(rl)}function Dv(){return Ot().memoizedState}function Ov(){return Ot().memoizedState}function GT(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var c=In();s=Nr(c);var f=Tr(a,s,c);f!==null&&(_n(f,a,c),zo(f,a,c)),a={cache:_f()},s.payload=a;return}a=a.return}}function KT(s,a,c){var f=In();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uc(s)?Pv(a,c):(c=mf(s,a,c,f),c!==null&&(_n(c,s,f),zv(c,a,f)))}function Mv(s,a,c){var f=In();Vo(s,a,c,f)}function Vo(s,a,c,f){var y={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Uc(s))Pv(a,y);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var k=a.lastRenderedState,E=x(k,c);if(y.hasEagerState=!0,y.eagerState=E,Dn(E,k))return vc(s,a,y,0),dt===null&&xc(),!1}catch{}if(c=mf(s,a,y,f),c!==null)return _n(c,s,f),zv(c,a,f),!0}return!1}function Jf(s,a,c,f){if(f={lane:2,revertLane:Ch(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Uc(s)){if(a)throw Error(r(479))}else a=mf(s,c,f,2),a!==null&&_n(a,s,2)}function Uc(s){var a=s.alternate;return s===Le||a!==null&&a===Le}function Pv(s,a){gi=Dc=!0;var c=s.pending;c===null?a.next=a:(a.next=c.next,c.next=a),s.pending=a}function zv(s,a,c){if((c&4194048)!==0){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,Vy(s,c)}}var Fo={readContext:tn,use:Pc,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useLayoutEffect:_t,useInsertionEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useSyncExternalStore:_t,useId:_t,useHostTransitionStatus:_t,useFormState:_t,useActionState:_t,useOptimistic:_t,useMemoCache:_t,useCacheRefresh:_t};Fo.useEffectEvent=_t;var Lv={readContext:tn,use:Pc,useCallback:function(s,a){return pn().memoizedState=[s,a===void 0?null:a],s},useContext:tn,useEffect:bv,useImperativeHandle:function(s,a,c){c=c!=null?c.concat([s]):null,Lc(4194308,4,kv.bind(null,a,s),c)},useLayoutEffect:function(s,a){return Lc(4194308,4,s,a)},useInsertionEffect:function(s,a){Lc(4,2,s,a)},useMemo:function(s,a){var c=pn();a=a===void 0?null:a;var f=s();if(va){ln(!0);try{s()}finally{ln(!1)}}return c.memoizedState=[f,a],f},useReducer:function(s,a,c){var f=pn();if(c!==void 0){var y=c(a);if(va){ln(!0);try{c(a)}finally{ln(!1)}}}else y=a;return f.memoizedState=f.baseState=y,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:y},f.queue=s,s=s.dispatch=KT.bind(null,Le,s),[f.memoizedState,s]},useRef:function(s){var a=pn();return s={current:s},a.memoizedState=s},useState:function(s){s=qf(s);var a=s.queue,c=Mv.bind(null,Le,a);return a.dispatch=c,[s.memoizedState,c]},useDebugValue:Kf,useDeferredValue:function(s,a){var c=pn();return Yf(c,s,a)},useTransition:function(){var s=qf(!1);return s=Cv.bind(null,Le,s.queue,!0,!1),pn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,c){var f=Le,y=pn();if(Je){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),dt===null)throw Error(r(349));(We&127)!==0||rv(f,a,c)}y.memoizedState=c;var x={value:c,getSnapshot:a};return y.queue=x,bv(iv.bind(null,f,x,s),[s]),f.flags|=2048,xi(9,{destroy:void 0},av.bind(null,f,x,c,a),null),c},useId:function(){var s=pn(),a=dt.identifierPrefix;if(Je){var c=Ns,f=_s;c=(f&~(1<<32-at(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Oc++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=BT++,a="_"+a+"r_"+c.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Xf,useFormState:pv,useActionState:pv,useOptimistic:function(s){var a=pn();a.memoizedState=a.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Jf.bind(null,Le,!0,c),c.dispatch=a,[s,a]},useMemoCache:Vf,useCacheRefresh:function(){return pn().memoizedState=GT.bind(null,Le)},useEffectEvent:function(s){var a=pn(),c={impl:s};return a.memoizedState=c,function(){if((st&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Qf={readContext:tn,use:Pc,useCallback:Nv,useContext:tn,useEffect:Gf,useImperativeHandle:_v,useInsertionEffect:Sv,useLayoutEffect:jv,useMemo:Tv,useReducer:zc,useRef:vv,useState:function(){return zc(Ys)},useDebugValue:Kf,useDeferredValue:function(s,a){var c=Ot();return Ev(c,lt.memoizedState,s,a)},useTransition:function(){var s=zc(Ys)[0],a=Ot().memoizedState;return[typeof s=="boolean"?s:Bo(s),a]},useSyncExternalStore:sv,useId:Dv,useHostTransitionStatus:Xf,useFormState:gv,useActionState:gv,useOptimistic:function(s,a){var c=Ot();return cv(c,lt,s,a)},useMemoCache:Vf,useCacheRefresh:Ov};Qf.useEffectEvent=wv;var Iv={readContext:tn,use:Pc,useCallback:Nv,useContext:tn,useEffect:Gf,useImperativeHandle:_v,useInsertionEffect:Sv,useLayoutEffect:jv,useMemo:Tv,useReducer:$f,useRef:vv,useState:function(){return $f(Ys)},useDebugValue:Kf,useDeferredValue:function(s,a){var c=Ot();return lt===null?Yf(c,s,a):Ev(c,lt.memoizedState,s,a)},useTransition:function(){var s=$f(Ys)[0],a=Ot().memoizedState;return[typeof s=="boolean"?s:Bo(s),a]},useSyncExternalStore:sv,useId:Dv,useHostTransitionStatus:Xf,useFormState:xv,useActionState:xv,useOptimistic:function(s,a){var c=Ot();return lt!==null?cv(c,lt,s,a):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Vf,useCacheRefresh:Ov};Iv.useEffectEvent=wv;function Zf(s,a,c,f){a=s.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var eh={enqueueSetState:function(s,a,c){s=s._reactInternals;var f=In(),y=Nr(f);y.payload=a,c!=null&&(y.callback=c),a=Tr(s,y,f),a!==null&&(_n(a,s,f),zo(a,s,f))},enqueueReplaceState:function(s,a,c){s=s._reactInternals;var f=In(),y=Nr(f);y.tag=1,y.payload=a,c!=null&&(y.callback=c),a=Tr(s,y,f),a!==null&&(_n(a,s,f),zo(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var c=In(),f=Nr(c);f.tag=2,a!=null&&(f.callback=a),a=Tr(s,f,c),a!==null&&(_n(a,s,c),zo(a,s,c))}};function Uv(s,a,c,f,y,x,k){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,x,k):a.prototype&&a.prototype.isPureReactComponent?!Eo(c,f)||!Eo(y,x):!0}function Bv(s,a,c,f){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==s&&eh.enqueueReplaceState(a,a.state,null)}function ba(s,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(s=s.defaultProps){c===a&&(c=g({},c));for(var y in s)c[y]===void 0&&(c[y]=s[y])}return c}function Vv(s){yc(s)}function Fv(s){console.error(s)}function $v(s){yc(s)}function Bc(s,a){try{var c=s.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function qv(s,a,c){try{var f=s.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function th(s,a,c){return c=Nr(c),c.tag=3,c.payload={element:null},c.callback=function(){Bc(s,a)},c}function Hv(s){return s=Nr(s),s.tag=3,s}function Gv(s,a,c,f){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var x=f.value;s.payload=function(){return y(x)},s.callback=function(){qv(a,c,f)}}var k=c.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(s.callback=function(){qv(a,c,f),typeof y!="function"&&(Or===null?Or=new Set([this]):Or.add(this));var E=f.stack;this.componentDidCatch(f.value,{componentStack:E!==null?E:""})})}function YT(s,a,c,f,y){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&ui(a,c,y,!0),c=Mn.current,c!==null){switch(c.tag){case 31:case 13:return Qn===null?Qc():c.alternate===null&&Nt===0&&(Nt=3),c.flags&=-257,c.flags|=65536,c.lanes=y,f===Tc?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),Nh(s,f,y)),!1;case 22:return c.flags|=65536,f===Tc?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),Nh(s,f,y)),!1}throw Error(r(435,c.tag))}return Nh(s,f,y),Qc(),!1}if(Je)return a=Mn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,f!==bf&&(s=Error(r(422),{cause:f}),Ro(Yn(s,c)))):(f!==bf&&(a=Error(r(423),{cause:f}),Ro(Yn(a,c))),s=s.current.alternate,s.flags|=65536,y&=-y,s.lanes|=y,f=Yn(f,c),y=th(s.stateNode,f,y),Rf(s,y),Nt!==4&&(Nt=2)),!1;var x=Error(r(520),{cause:f});if(x=Yn(x,c),Xo===null?Xo=[x]:Xo.push(x),Nt!==4&&(Nt=2),a===null)return!0;f=Yn(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,s=y&-y,c.lanes|=s,s=th(c.stateNode,f,s),Rf(c,s),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Or===null||!Or.has(x))))return c.flags|=65536,y&=-y,c.lanes|=y,y=Hv(y),Gv(y,s,c,f),Rf(c,y),!1}c=c.return}while(c!==null);return!1}var nh=Error(r(461)),It=!1;function nn(s,a,c,f){a.child=s===null?Xx(a,null,c,f):xa(a,s.child,c,f)}function Kv(s,a,c,f,y){c=c.render;var x=a.ref;if("ref"in f){var k={};for(var E in f)E!=="ref"&&(k[E]=f[E])}else k=f;return ma(a),f=Lf(s,a,c,k,x,y),E=If(),s!==null&&!It?(Uf(s,a,y),Ws(s,a,y)):(Je&&E&&xf(a),a.flags|=1,nn(s,a,f,y),a.child)}function Yv(s,a,c,f,y){if(s===null){var x=c.type;return typeof x=="function"&&!pf(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,Wv(s,a,x,f,y)):(s=wc(c.type,null,f,a,a.mode,y),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,!uh(s,y)){var k=x.memoizedProps;if(c=c.compare,c=c!==null?c:Eo,c(k,f)&&s.ref===a.ref)return Ws(s,a,y)}return a.flags|=1,s=$s(x,f),s.ref=a.ref,s.return=a,a.child=s}function Wv(s,a,c,f,y){if(s!==null){var x=s.memoizedProps;if(Eo(x,f)&&s.ref===a.ref)if(It=!1,a.pendingProps=f=x,uh(s,y))(s.flags&131072)!==0&&(It=!0);else return a.lanes=s.lanes,Ws(s,a,y)}return sh(s,a,c,f,y)}function Xv(s,a,c,f){var y=f.children,x=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(f=a.child=s.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~x}else f=0,a.child=null;return Jv(s,a,x,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&_c(a,x!==null?x.cachePool:null),x!==null?Zx(a,x):Of(),ev(a);else return f=a.lanes=536870912,Jv(s,a,x!==null?x.baseLanes|c:c,c,f)}else x!==null?(_c(a,x.cachePool),Zx(a,x),Cr(),a.memoizedState=null):(s!==null&&_c(a,null),Of(),Cr());return nn(s,a,y,c),a.child}function $o(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Jv(s,a,c,f,y){var x=Tf();return x=x===null?null:{parent:zt._currentValue,pool:x},a.memoizedState={baseLanes:c,cachePool:x},s!==null&&_c(a,null),Of(),ev(a),s!==null&&ui(s,a,f,!0),a.childLanes=y,null}function Vc(s,a){return a=$c({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function Qv(s,a,c){return xa(a,s.child,null,c),s=Vc(a,a.pendingProps),s.flags|=2,Pn(a),a.memoizedState=null,s}function WT(s,a,c){var f=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Je){if(f.mode==="hidden")return s=Vc(a,f),a.lanes=536870912,$o(null,s);if(Pf(a),(s=pt)?(s=u0(s,Jn),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:wr!==null?{id:_s,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},c=Px(s),c.return=a,a.child=c,en=a,pt=null)):s=null,s===null)throw jr(a);return a.lanes=536870912,null}return Vc(a,f)}var x=s.memoizedState;if(x!==null){var k=x.dehydrated;if(Pf(a),y)if(a.flags&256)a.flags&=-257,a=Qv(s,a,c);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(It||ui(s,a,c,!1),y=(c&s.childLanes)!==0,It||y){if(f=dt,f!==null&&(k=Fy(f,c),k!==0&&k!==x.retryLane))throw x.retryLane=k,ua(s,k),_n(f,s,k),nh;Qc(),a=Qv(s,a,c)}else s=x.treeContext,pt=Zn(k.nextSibling),en=a,Je=!0,Sr=null,Jn=!1,s!==null&&Ix(a,s),a=Vc(a,f),a.flags|=4096;return a}return s=$s(s.child,{mode:f.mode,children:f.children}),s.ref=a.ref,a.child=s,s.return=a,s}function Fc(s,a){var c=a.ref;if(c===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(a.flags|=4194816)}}function sh(s,a,c,f,y){return ma(a),c=Lf(s,a,c,f,void 0,y),f=If(),s!==null&&!It?(Uf(s,a,y),Ws(s,a,y)):(Je&&f&&xf(a),a.flags|=1,nn(s,a,c,y),a.child)}function Zv(s,a,c,f,y,x){return ma(a),a.updateQueue=null,c=nv(a,f,c,y),tv(s),f=If(),s!==null&&!It?(Uf(s,a,x),Ws(s,a,x)):(Je&&f&&xf(a),a.flags|=1,nn(s,a,c,x),a.child)}function eb(s,a,c,f,y){if(ma(a),a.stateNode===null){var x=ii,k=c.contextType;typeof k=="object"&&k!==null&&(x=tn(k)),x=new c(f,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=eh,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=f,x.state=a.memoizedState,x.refs={},Cf(a),k=c.contextType,x.context=typeof k=="object"&&k!==null?tn(k):ii,x.state=a.memoizedState,k=c.getDerivedStateFromProps,typeof k=="function"&&(Zf(a,c,k,f),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(k=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),k!==x.state&&eh.enqueueReplaceState(x,x.state,null),Io(a,f,x,y),Lo(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(s===null){x=a.stateNode;var E=a.memoizedProps,U=ba(c,E);x.props=U;var W=x.context,ne=c.contextType;k=ii,typeof ne=="object"&&ne!==null&&(k=tn(ne));var oe=c.getDerivedStateFromProps;ne=typeof oe=="function"||typeof x.getSnapshotBeforeUpdate=="function",E=a.pendingProps!==E,ne||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E||W!==k)&&Bv(a,x,f,k),_r=!1;var X=a.memoizedState;x.state=X,Io(a,f,x,y),Lo(),W=a.memoizedState,E||X!==W||_r?(typeof oe=="function"&&(Zf(a,c,oe,f),W=a.memoizedState),(U=_r||Uv(a,c,U,f,X,W,k))?(ne||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=W),x.props=f,x.state=W,x.context=k,f=U):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{x=a.stateNode,Af(s,a),k=a.memoizedProps,ne=ba(c,k),x.props=ne,oe=a.pendingProps,X=x.context,W=c.contextType,U=ii,typeof W=="object"&&W!==null&&(U=tn(W)),E=c.getDerivedStateFromProps,(W=typeof E=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(k!==oe||X!==U)&&Bv(a,x,f,U),_r=!1,X=a.memoizedState,x.state=X,Io(a,f,x,y),Lo();var Q=a.memoizedState;k!==oe||X!==Q||_r||s!==null&&s.dependencies!==null&&jc(s.dependencies)?(typeof E=="function"&&(Zf(a,c,E,f),Q=a.memoizedState),(ne=_r||Uv(a,c,ne,f,X,Q,U)||s!==null&&s.dependencies!==null&&jc(s.dependencies))?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,Q,U),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,Q,U)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||k===s.memoizedProps&&X===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&X===s.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=Q),x.props=f,x.state=Q,x.context=U,f=ne):(typeof x.componentDidUpdate!="function"||k===s.memoizedProps&&X===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&X===s.memoizedState||(a.flags|=1024),f=!1)}return x=f,Fc(s,a),f=(a.flags&128)!==0,x||f?(x=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,s!==null&&f?(a.child=xa(a,s.child,null,y),a.child=xa(a,null,c,y)):nn(s,a,c,y),a.memoizedState=x.state,s=a.child):s=Ws(s,a,y),s}function tb(s,a,c,f){return fa(),a.flags|=256,nn(s,a,c,f),a.child}var rh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ah(s){return{baseLanes:s,cachePool:qx()}}function ih(s,a,c){return s=s!==null?s.childLanes&~c:0,a&&(s|=Ln),s}function nb(s,a,c){var f=a.pendingProps,y=!1,x=(a.flags&128)!==0,k;if((k=x)||(k=s!==null&&s.memoizedState===null?!1:(Dt.current&2)!==0),k&&(y=!0,a.flags&=-129),k=(a.flags&32)!==0,a.flags&=-33,s===null){if(Je){if(y?Er(a):Cr(),(s=pt)?(s=u0(s,Jn),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:wr!==null?{id:_s,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},c=Px(s),c.return=a,a.child=c,en=a,pt=null)):s=null,s===null)throw jr(a);return Fh(s)?a.lanes=32:a.lanes=536870912,null}var E=f.children;return f=f.fallback,y?(Cr(),y=a.mode,E=$c({mode:"hidden",children:E},y),f=da(f,y,c,null),E.return=a,f.return=a,E.sibling=f,a.child=E,f=a.child,f.memoizedState=ah(c),f.childLanes=ih(s,k,c),a.memoizedState=rh,$o(null,f)):(Er(a),oh(a,E))}var U=s.memoizedState;if(U!==null&&(E=U.dehydrated,E!==null)){if(x)a.flags&256?(Er(a),a.flags&=-257,a=lh(s,a,c)):a.memoizedState!==null?(Cr(),a.child=s.child,a.flags|=128,a=null):(Cr(),E=f.fallback,y=a.mode,f=$c({mode:"visible",children:f.children},y),E=da(E,y,c,null),E.flags|=2,f.return=a,E.return=a,f.sibling=E,a.child=f,xa(a,s.child,null,c),f=a.child,f.memoizedState=ah(c),f.childLanes=ih(s,k,c),a.memoizedState=rh,a=$o(null,f));else if(Er(a),Fh(E)){if(k=E.nextSibling&&E.nextSibling.dataset,k)var W=k.dgst;k=W,f=Error(r(419)),f.stack="",f.digest=k,Ro({value:f,source:null,stack:null}),a=lh(s,a,c)}else if(It||ui(s,a,c,!1),k=(c&s.childLanes)!==0,It||k){if(k=dt,k!==null&&(f=Fy(k,c),f!==0&&f!==U.retryLane))throw U.retryLane=f,ua(s,f),_n(k,s,f),nh;Vh(E)||Qc(),a=lh(s,a,c)}else Vh(E)?(a.flags|=192,a.child=s.child,a=null):(s=U.treeContext,pt=Zn(E.nextSibling),en=a,Je=!0,Sr=null,Jn=!1,s!==null&&Ix(a,s),a=oh(a,f.children),a.flags|=4096);return a}return y?(Cr(),E=f.fallback,y=a.mode,U=s.child,W=U.sibling,f=$s(U,{mode:"hidden",children:f.children}),f.subtreeFlags=U.subtreeFlags&65011712,W!==null?E=$s(W,E):(E=da(E,y,c,null),E.flags|=2),E.return=a,f.return=a,f.sibling=E,a.child=f,$o(null,f),f=a.child,E=s.child.memoizedState,E===null?E=ah(c):(y=E.cachePool,y!==null?(U=zt._currentValue,y=y.parent!==U?{parent:U,pool:U}:y):y=qx(),E={baseLanes:E.baseLanes|c,cachePool:y}),f.memoizedState=E,f.childLanes=ih(s,k,c),a.memoizedState=rh,$o(s.child,f)):(Er(a),c=s.child,s=c.sibling,c=$s(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,s!==null&&(k=a.deletions,k===null?(a.deletions=[s],a.flags|=16):k.push(s)),a.child=c,a.memoizedState=null,c)}function oh(s,a){return a=$c({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function $c(s,a){return s=On(22,s,null,a),s.lanes=0,s}function lh(s,a,c){return xa(a,s.child,null,c),s=oh(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function sb(s,a,c){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a),jf(s.return,a,c)}function ch(s,a,c,f,y,x){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:y,treeForkCount:x}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=c,k.tailMode=y,k.treeForkCount=x)}function rb(s,a,c){var f=a.pendingProps,y=f.revealOrder,x=f.tail;f=f.children;var k=Dt.current,E=(k&2)!==0;if(E?(k=k&1|2,a.flags|=128):k&=1,A(Dt,k),nn(s,a,f,c),f=Je?Ao:0,!E&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&sb(s,c,a);else if(s.tag===19)sb(s,c,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(y){case"forwards":for(c=a.child,y=null;c!==null;)s=c.alternate,s!==null&&Rc(s)===null&&(y=c),c=c.sibling;c=y,c===null?(y=a.child,a.child=null):(y=c.sibling,c.sibling=null),ch(a,!1,y,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,y=a.child,a.child=null;y!==null;){if(s=y.alternate,s!==null&&Rc(s)===null){a.child=y;break}s=y.sibling,y.sibling=c,c=y,y=s}ch(a,!0,c,null,x,f);break;case"together":ch(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function Ws(s,a,c){if(s!==null&&(a.dependencies=s.dependencies),Dr|=a.lanes,(c&a.childLanes)===0)if(s!==null){if(ui(s,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,c=$s(s,s.pendingProps),a.child=c,c.return=a;s.sibling!==null;)s=s.sibling,c=c.sibling=$s(s,s.pendingProps),c.return=a;c.sibling=null}return a.child}function uh(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&jc(s)))}function XT(s,a,c){switch(a.tag){case 3:ke(a,a.stateNode.containerInfo),kr(a,zt,s.memoizedState.cache),fa();break;case 27:case 5:Ie(a);break;case 4:ke(a,a.stateNode.containerInfo);break;case 10:kr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Pf(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Er(a),a.flags|=128,null):(c&a.child.childLanes)!==0?nb(s,a,c):(Er(a),s=Ws(s,a,c),s!==null?s.sibling:null);Er(a);break;case 19:var y=(s.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(ui(s,a,c,!1),f=(c&a.childLanes)!==0),y){if(f)return rb(s,a,c);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),A(Dt,Dt.current),f)break;return null;case 22:return a.lanes=0,Xv(s,a,c,a.pendingProps);case 24:kr(a,zt,s.memoizedState.cache)}return Ws(s,a,c)}function ab(s,a,c){if(s!==null)if(s.memoizedProps!==a.pendingProps)It=!0;else{if(!uh(s,c)&&(a.flags&128)===0)return It=!1,XT(s,a,c);It=(s.flags&131072)!==0}else It=!1,Je&&(a.flags&1048576)!==0&&Lx(a,Ao,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(s=ga(a.elementType),a.type=s,typeof s=="function")pf(s)?(f=ba(s,f),a.tag=1,a=eb(null,a,s,f,c)):(a.tag=0,a=sh(null,a,s,f,c));else{if(s!=null){var y=s.$$typeof;if(y===D){a.tag=11,a=Kv(null,a,s,f,c);break e}else if(y===B){a.tag=14,a=Yv(null,a,s,f,c);break e}}throw a=se(s)||s,Error(r(306,a,""))}}return a;case 0:return sh(s,a,a.type,a.pendingProps,c);case 1:return f=a.type,y=ba(f,a.pendingProps),eb(s,a,f,y,c);case 3:e:{if(ke(a,a.stateNode.containerInfo),s===null)throw Error(r(387));f=a.pendingProps;var x=a.memoizedState;y=x.element,Af(s,a),Io(a,f,null,c);var k=a.memoizedState;if(f=k.cache,kr(a,zt,f),f!==x.cache&&kf(a,[zt],c,!0),Lo(),f=k.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:k.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=tb(s,a,f,c);break e}else if(f!==y){y=Yn(Error(r(424)),a),Ro(y),a=tb(s,a,f,c);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,pt=Zn(s.firstChild),en=a,Je=!0,Sr=null,Jn=!0,c=Xx(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(fa(),f===y){a=Ws(s,a,c);break e}nn(s,a,f,c)}a=a.child}return a;case 26:return Fc(s,a),s===null?(c=g0(a.type,null,a.pendingProps,null))?a.memoizedState=c:Je||(c=a.type,s=a.pendingProps,f=au(ye.current).createElement(c),f[Zt]=a,f[vn]=s,sn(f,c,s),Wt(f),a.stateNode=f):a.memoizedState=g0(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return Ie(a),s===null&&Je&&(f=a.stateNode=h0(a.type,a.pendingProps,ye.current),en=a,Jn=!0,y=pt,Lr(a.type)?($h=y,pt=Zn(f.firstChild)):pt=y),nn(s,a,a.pendingProps.children,c),Fc(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Je&&((y=f=pt)&&(f=NE(f,a.type,a.pendingProps,Jn),f!==null?(a.stateNode=f,en=a,pt=Zn(f.firstChild),Jn=!1,y=!0):y=!1),y||jr(a)),Ie(a),y=a.type,x=a.pendingProps,k=s!==null?s.memoizedProps:null,f=x.children,Ih(y,x)?f=null:k!==null&&Ih(y,k)&&(a.flags|=32),a.memoizedState!==null&&(y=Lf(s,a,VT,null,null,c),rl._currentValue=y),Fc(s,a),nn(s,a,f,c),a.child;case 6:return s===null&&Je&&((s=c=pt)&&(c=TE(c,a.pendingProps,Jn),c!==null?(a.stateNode=c,en=a,pt=null,s=!0):s=!1),s||jr(a)),null;case 13:return nb(s,a,c);case 4:return ke(a,a.stateNode.containerInfo),f=a.pendingProps,s===null?a.child=xa(a,null,f,c):nn(s,a,f,c),a.child;case 11:return Kv(s,a,a.type,a.pendingProps,c);case 7:return nn(s,a,a.pendingProps,c),a.child;case 8:return nn(s,a,a.pendingProps.children,c),a.child;case 12:return nn(s,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,kr(a,a.type,f.value),nn(s,a,f.children,c),a.child;case 9:return y=a.type._context,f=a.pendingProps.children,ma(a),y=tn(y),f=f(y),a.flags|=1,nn(s,a,f,c),a.child;case 14:return Yv(s,a,a.type,a.pendingProps,c);case 15:return Wv(s,a,a.type,a.pendingProps,c);case 19:return rb(s,a,c);case 31:return WT(s,a,c);case 22:return Xv(s,a,c,a.pendingProps);case 24:return ma(a),f=tn(zt),s===null?(y=Tf(),y===null&&(y=dt,x=_f(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=c),y=x),a.memoizedState={parent:f,cache:y},Cf(a),kr(a,zt,y)):((s.lanes&c)!==0&&(Af(s,a),Io(a,null,null,c),Lo()),y=s.memoizedState,x=a.memoizedState,y.parent!==f?(y={parent:f,cache:f},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),kr(a,zt,f)):(f=x.cache,kr(a,zt,f),f!==y.cache&&kf(a,[zt],c,!0))),nn(s,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Xs(s){s.flags|=4}function dh(s,a,c,f,y){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(y&335544128)===y)if(s.stateNode.complete)s.flags|=8192;else if(Db())s.flags|=8192;else throw ya=Tc,Ef}else s.flags&=-16777217}function ib(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!w0(a))if(Db())s.flags|=8192;else throw ya=Tc,Ef}function qc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Uy():536870912,s.lanes|=a,Si|=a)}function qo(s,a){if(!Je)switch(s.tailMode){case"hidden":a=s.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function gt(s){var a=s.alternate!==null&&s.alternate.child===s.child,c=0,f=0;if(a)for(var y=s.child;y!==null;)c|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=s,y=y.sibling;else for(y=s.child;y!==null;)c|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=s,y=y.sibling;return s.subtreeFlags|=f,s.childLanes=c,a}function JT(s,a,c){var f=a.pendingProps;switch(vf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(a),null;case 1:return gt(a),null;case 3:return c=a.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),Gs(zt),Ne(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(ci(a)?Xs(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,wf())),gt(a),null;case 26:var y=a.type,x=a.memoizedState;return s===null?(Xs(a),x!==null?(gt(a),ib(a,x)):(gt(a),dh(a,y,null,f,c))):x?x!==s.memoizedState?(Xs(a),gt(a),ib(a,x)):(gt(a),a.flags&=-16777217):(s=s.memoizedProps,s!==f&&Xs(a),gt(a),dh(a,y,s,f,c)),null;case 27:if(rt(a),c=ye.current,y=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&Xs(a);else{if(!f){if(a.stateNode===null)throw Error(r(166));return gt(a),null}s=ee.current,ci(a)?Ux(a):(s=h0(y,f,c),a.stateNode=s,Xs(a))}return gt(a),null;case 5:if(rt(a),y=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&Xs(a);else{if(!f){if(a.stateNode===null)throw Error(r(166));return gt(a),null}if(x=ee.current,ci(a))Ux(a);else{var k=au(ye.current);switch(x){case 1:x=k.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=k.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=k.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?k.createElement("select",{is:f.is}):k.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?k.createElement(y,{is:f.is}):k.createElement(y)}}x[Zt]=a,x[vn]=f;e:for(k=a.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===a)break e;for(;k.sibling===null;){if(k.return===null||k.return===a)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}a.stateNode=x;e:switch(sn(x,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Xs(a)}}return gt(a),dh(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,c),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==f&&Xs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(r(166));if(s=ye.current,ci(a)){if(s=a.stateNode,c=a.memoizedProps,f=null,y=en,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}s[Zt]=a,s=!!(s.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||n0(s.nodeValue,c)),s||jr(a,!0)}else s=au(s).createTextNode(f),s[Zt]=a,a.stateNode=s}return gt(a),null;case 31:if(c=a.memoizedState,s===null||s.memoizedState!==null){if(f=ci(a),c!==null){if(s===null){if(!f)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Zt]=a}else fa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;gt(a),s=!1}else c=wf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return a.flags&256?(Pn(a),a):(Pn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return gt(a),null;case 13:if(f=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(y=ci(a),f!==null&&f.dehydrated!==null){if(s===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Zt]=a}else fa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;gt(a),y=!1}else y=wf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(Pn(a),a):(Pn(a),null)}return Pn(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,s=s!==null&&s.memoizedState!==null,c&&(f=a.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==y&&(f.flags|=2048)),c!==s&&c&&(a.child.flags|=8192),qc(a,a.updateQueue),gt(a),null);case 4:return Ne(),s===null&&Oh(a.stateNode.containerInfo),gt(a),null;case 10:return Gs(a.type),gt(a),null;case 19:if(z(Dt),f=a.memoizedState,f===null)return gt(a),null;if(y=(a.flags&128)!==0,x=f.rendering,x===null)if(y)qo(f,!1);else{if(Nt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(x=Rc(s),x!==null){for(a.flags|=128,qo(f,!1),s=x.updateQueue,a.updateQueue=s,qc(a,s),a.subtreeFlags=0,s=c,c=a.child;c!==null;)Mx(c,s),c=c.sibling;return A(Dt,Dt.current&1|2),Je&&qs(a,f.treeForkCount),a.child}s=s.sibling}f.tail!==null&&At()>Wc&&(a.flags|=128,y=!0,qo(f,!1),a.lanes=4194304)}else{if(!y)if(s=Rc(x),s!==null){if(a.flags|=128,y=!0,s=s.updateQueue,a.updateQueue=s,qc(a,s),qo(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!Je)return gt(a),null}else 2*At()-f.renderingStartTime>Wc&&c!==536870912&&(a.flags|=128,y=!0,qo(f,!1),a.lanes=4194304);f.isBackwards?(x.sibling=a.child,a.child=x):(s=f.last,s!==null?s.sibling=x:a.child=x,f.last=x)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=At(),s.sibling=null,c=Dt.current,A(Dt,y?c&1|2:c&1),Je&&qs(a,f.treeForkCount),s):(gt(a),null);case 22:case 23:return Pn(a),Mf(),f=a.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(gt(a),a.subtreeFlags&6&&(a.flags|=8192)):gt(a),c=a.updateQueue,c!==null&&qc(a,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),s!==null&&z(pa),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Gs(zt),gt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function QT(s,a){switch(vf(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Gs(zt),Ne(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return rt(a),null;case 31:if(a.memoizedState!==null){if(Pn(a),a.alternate===null)throw Error(r(340));fa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Pn(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));fa()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return z(Dt),null;case 4:return Ne(),null;case 10:return Gs(a.type),null;case 22:case 23:return Pn(a),Mf(),s!==null&&z(pa),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Gs(zt),null;case 25:return null;default:return null}}function ob(s,a){switch(vf(a),a.tag){case 3:Gs(zt),Ne();break;case 26:case 27:case 5:rt(a);break;case 4:Ne();break;case 31:a.memoizedState!==null&&Pn(a);break;case 13:Pn(a);break;case 19:z(Dt);break;case 10:Gs(a.type);break;case 22:case 23:Pn(a),Mf(),s!==null&&z(pa);break;case 24:Gs(zt)}}function Ho(s,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var y=f.next;c=y;do{if((c.tag&s)===s){f=void 0;var x=c.create,k=c.inst;f=x(),k.destroy=f}c=c.next}while(c!==y)}}catch(E){ot(a,a.return,E)}}function Ar(s,a,c){try{var f=a.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var x=y.next;f=x;do{if((f.tag&s)===s){var k=f.inst,E=k.destroy;if(E!==void 0){k.destroy=void 0,y=a;var U=c,W=E;try{W()}catch(ne){ot(y,U,ne)}}}f=f.next}while(f!==x)}}catch(ne){ot(a,a.return,ne)}}function lb(s){var a=s.updateQueue;if(a!==null){var c=s.stateNode;try{Qx(a,c)}catch(f){ot(s,s.return,f)}}}function cb(s,a,c){c.props=ba(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(f){ot(s,a,f)}}function Go(s,a){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof c=="function"?s.refCleanup=c(f):c.current=f}}catch(y){ot(s,a,y)}}function Ts(s,a){var c=s.ref,f=s.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(y){ot(s,a,y)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){ot(s,a,y)}else c.current=null}function ub(s){var a=s.type,c=s.memoizedProps,f=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(y){ot(s,s.return,y)}}function fh(s,a,c){try{var f=s.stateNode;bE(f,s.type,c,a),f[vn]=a}catch(y){ot(s,s.return,y)}}function db(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Lr(s.type)||s.tag===4}function hh(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||db(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Lr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function mh(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(s),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Vs));else if(f!==4&&(f===27&&Lr(s.type)&&(c=s.stateNode,a=null),s=s.child,s!==null))for(mh(s,a,c),s=s.sibling;s!==null;)mh(s,a,c),s=s.sibling}function Hc(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?c.insertBefore(s,a):c.appendChild(s);else if(f!==4&&(f===27&&Lr(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Hc(s,a,c),s=s.sibling;s!==null;)Hc(s,a,c),s=s.sibling}function fb(s){var a=s.stateNode,c=s.memoizedProps;try{for(var f=s.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);sn(a,f,c),a[Zt]=s,a[vn]=c}catch(x){ot(s,s.return,x)}}var Js=!1,Ut=!1,ph=!1,hb=typeof WeakSet=="function"?WeakSet:Set,Xt=null;function ZT(s,a){if(s=s.containerInfo,zh=fu,s=_x(s),lf(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var y=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var k=0,E=-1,U=-1,W=0,ne=0,oe=s,X=null;t:for(;;){for(var Q;oe!==c||y!==0&&oe.nodeType!==3||(E=k+y),oe!==x||f!==0&&oe.nodeType!==3||(U=k+f),oe.nodeType===3&&(k+=oe.nodeValue.length),(Q=oe.firstChild)!==null;)X=oe,oe=Q;for(;;){if(oe===s)break t;if(X===c&&++W===y&&(E=k),X===x&&++ne===f&&(U=k),(Q=oe.nextSibling)!==null)break;oe=X,X=oe.parentNode}oe=Q}c=E===-1||U===-1?null:{start:E,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(Lh={focusedElem:s,selectionRange:c},fu=!1,Xt=a;Xt!==null;)if(a=Xt,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Xt=s;else for(;Xt!==null;){switch(a=Xt,x=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)y=s[c],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&x!==null){s=void 0,c=a,y=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var xe=ba(c.type,y);s=f.getSnapshotBeforeUpdate(xe,x),f.__reactInternalSnapshotBeforeUpdate=s}catch(Ae){ot(c,c.return,Ae)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,c=s.nodeType,c===9)Bh(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Bh(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,Xt=s;break}Xt=a.return}}function mb(s,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Zs(s,c),f&4&&Ho(5,c);break;case 1:if(Zs(s,c),f&4)if(s=c.stateNode,a===null)try{s.componentDidMount()}catch(k){ot(c,c.return,k)}else{var y=ba(c.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(y,a,s.__reactInternalSnapshotBeforeUpdate)}catch(k){ot(c,c.return,k)}}f&64&&lb(c),f&512&&Go(c,c.return);break;case 3:if(Zs(s,c),f&64&&(s=c.updateQueue,s!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{Qx(s,a)}catch(k){ot(c,c.return,k)}}break;case 27:a===null&&f&4&&fb(c);case 26:case 5:Zs(s,c),a===null&&f&4&&ub(c),f&512&&Go(c,c.return);break;case 12:Zs(s,c);break;case 31:Zs(s,c),f&4&&yb(s,c);break;case 13:Zs(s,c),f&4&&xb(s,c),f&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=lE.bind(null,c),EE(s,c))));break;case 22:if(f=c.memoizedState!==null||Js,!f){a=a!==null&&a.memoizedState!==null||Ut,y=Js;var x=Ut;Js=f,(Ut=a)&&!x?er(s,c,(c.subtreeFlags&8772)!==0):Zs(s,c),Js=y,Ut=x}break;case 30:break;default:Zs(s,c)}}function pb(s){var a=s.alternate;a!==null&&(s.alternate=null,pb(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&qd(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var bt=null,wn=!1;function Qs(s,a,c){for(c=c.child;c!==null;)gb(s,a,c),c=c.sibling}function gb(s,a,c){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(Qt,c)}catch{}switch(c.tag){case 26:Ut||Ts(c,a),Qs(s,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ut||Ts(c,a);var f=bt,y=wn;Lr(c.type)&&(bt=c.stateNode,wn=!1),Qs(s,a,c),tl(c.stateNode),bt=f,wn=y;break;case 5:Ut||Ts(c,a);case 6:if(f=bt,y=wn,bt=null,Qs(s,a,c),bt=f,wn=y,bt!==null)if(wn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(c.stateNode)}catch(x){ot(c,a,x)}else try{bt.removeChild(c.stateNode)}catch(x){ot(c,a,x)}break;case 18:bt!==null&&(wn?(s=bt,l0(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Ai(s)):l0(bt,c.stateNode));break;case 4:f=bt,y=wn,bt=c.stateNode.containerInfo,wn=!0,Qs(s,a,c),bt=f,wn=y;break;case 0:case 11:case 14:case 15:Ar(2,c,a),Ut||Ar(4,c,a),Qs(s,a,c);break;case 1:Ut||(Ts(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&cb(c,a,f)),Qs(s,a,c);break;case 21:Qs(s,a,c);break;case 22:Ut=(f=Ut)||c.memoizedState!==null,Qs(s,a,c),Ut=f;break;default:Qs(s,a,c)}}function yb(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ai(s)}catch(c){ot(a,a.return,c)}}}function xb(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ai(s)}catch(c){ot(a,a.return,c)}}function eE(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new hb),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new hb),a;default:throw Error(r(435,s.tag))}}function Gc(s,a){var c=eE(s);a.forEach(function(f){if(!c.has(f)){c.add(f);var y=cE.bind(null,s,f);f.then(y,y)}})}function Sn(s,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var y=c[f],x=s,k=a,E=k;e:for(;E!==null;){switch(E.tag){case 27:if(Lr(E.type)){bt=E.stateNode,wn=!1;break e}break;case 5:bt=E.stateNode,wn=!1;break e;case 3:case 4:bt=E.stateNode.containerInfo,wn=!0;break e}E=E.return}if(bt===null)throw Error(r(160));gb(x,k,y),bt=null,wn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)vb(a,s),a=a.sibling}var ds=null;function vb(s,a){var c=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Sn(a,s),jn(s),f&4&&(Ar(3,s,s.return),Ho(3,s),Ar(5,s,s.return));break;case 1:Sn(a,s),jn(s),f&512&&(Ut||c===null||Ts(c,c.return)),f&64&&Js&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var y=ds;if(Sn(a,s),jn(s),f&512&&(Ut||c===null||Ts(c,c.return)),f&4){var x=c!==null?c.memoizedState:null;if(f=s.memoizedState,c===null)if(f===null)if(s.stateNode===null){e:{f=s.type,c=s.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":x=y.getElementsByTagName("title")[0],(!x||x[vo]||x[Zt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(f),y.head.insertBefore(x,y.querySelector("head > title"))),sn(x,f,c),x[Zt]=s,Wt(x),f=x;break e;case"link":var k=v0("link","href",y).get(f+(c.href||""));if(k){for(var E=0;E<k.length;E++)if(x=k[E],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){k.splice(E,1);break t}}x=y.createElement(f),sn(x,f,c),y.head.appendChild(x);break;case"meta":if(k=v0("meta","content",y).get(f+(c.content||""))){for(E=0;E<k.length;E++)if(x=k[E],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){k.splice(E,1);break t}}x=y.createElement(f),sn(x,f,c),y.head.appendChild(x);break;default:throw Error(r(468,f))}x[Zt]=s,Wt(x),f=x}s.stateNode=f}else b0(y,s.type,s.stateNode);else s.stateNode=x0(y,f,s.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?b0(y,s.type,s.stateNode):x0(y,f,s.memoizedProps)):f===null&&s.stateNode!==null&&fh(s,s.memoizedProps,c.memoizedProps)}break;case 27:Sn(a,s),jn(s),f&512&&(Ut||c===null||Ts(c,c.return)),c!==null&&f&4&&fh(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Sn(a,s),jn(s),f&512&&(Ut||c===null||Ts(c,c.return)),s.flags&32){y=s.stateNode;try{Za(y,"")}catch(xe){ot(s,s.return,xe)}}f&4&&s.stateNode!=null&&(y=s.memoizedProps,fh(s,y,c!==null?c.memoizedProps:y)),f&1024&&(ph=!0);break;case 6:if(Sn(a,s),jn(s),f&4){if(s.stateNode===null)throw Error(r(162));f=s.memoizedProps,c=s.stateNode;try{c.nodeValue=f}catch(xe){ot(s,s.return,xe)}}break;case 3:if(lu=null,y=ds,ds=iu(a.containerInfo),Sn(a,s),ds=y,jn(s),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Ai(a.containerInfo)}catch(xe){ot(s,s.return,xe)}ph&&(ph=!1,bb(s));break;case 4:f=ds,ds=iu(s.stateNode.containerInfo),Sn(a,s),jn(s),ds=f;break;case 12:Sn(a,s),jn(s);break;case 31:Sn(a,s),jn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Gc(s,f)));break;case 13:Sn(a,s),jn(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Yc=At()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Gc(s,f)));break;case 22:y=s.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,W=Js,ne=Ut;if(Js=W||y,Ut=ne||U,Sn(a,s),Ut=ne,Js=W,jn(s),f&8192)e:for(a=s.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(c===null||U||Js||Ut||wa(s)),c=null,a=s;;){if(a.tag===5||a.tag===26){if(c===null){U=c=a;try{if(x=U.stateNode,y)k=x.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{E=U.stateNode;var oe=U.memoizedProps.style,X=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;E.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(xe){ot(U,U.return,xe)}}}else if(a.tag===6){if(c===null){U=a;try{U.stateNode.nodeValue=y?"":U.memoizedProps}catch(xe){ot(U,U.return,xe)}}}else if(a.tag===18){if(c===null){U=a;try{var Q=U.stateNode;y?c0(Q,!0):c0(U.stateNode,!1)}catch(xe){ot(U,U.return,xe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=s.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Gc(s,c))));break;case 19:Sn(a,s),jn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Gc(s,f)));break;case 30:break;case 21:break;default:Sn(a,s),jn(s)}}function jn(s){var a=s.flags;if(a&2){try{for(var c,f=s.return;f!==null;){if(db(f)){c=f;break}f=f.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var y=c.stateNode,x=hh(s);Hc(s,x,y);break;case 5:var k=c.stateNode;c.flags&32&&(Za(k,""),c.flags&=-33);var E=hh(s);Hc(s,E,k);break;case 3:case 4:var U=c.stateNode.containerInfo,W=hh(s);mh(s,W,U);break;default:throw Error(r(161))}}catch(ne){ot(s,s.return,ne)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function bb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;bb(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Zs(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)mb(s,a.alternate,a),a=a.sibling}function wa(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:Ar(4,a,a.return),wa(a);break;case 1:Ts(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&cb(a,a.return,c),wa(a);break;case 27:tl(a.stateNode);case 26:case 5:Ts(a,a.return),wa(a);break;case 22:a.memoizedState===null&&wa(a);break;case 30:wa(a);break;default:wa(a)}s=s.sibling}}function er(s,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,y=s,x=a,k=x.flags;switch(x.tag){case 0:case 11:case 15:er(y,x,c),Ho(4,x);break;case 1:if(er(y,x,c),f=x,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(W){ot(f,f.return,W)}if(f=x,y=f.updateQueue,y!==null){var E=f.stateNode;try{var U=y.shared.hiddenCallbacks;if(U!==null)for(y.shared.hiddenCallbacks=null,y=0;y<U.length;y++)Jx(U[y],E)}catch(W){ot(f,f.return,W)}}c&&k&64&&lb(x),Go(x,x.return);break;case 27:fb(x);case 26:case 5:er(y,x,c),c&&f===null&&k&4&&ub(x),Go(x,x.return);break;case 12:er(y,x,c);break;case 31:er(y,x,c),c&&k&4&&yb(y,x);break;case 13:er(y,x,c),c&&k&4&&xb(y,x);break;case 22:x.memoizedState===null&&er(y,x,c),Go(x,x.return);break;case 30:break;default:er(y,x,c)}a=a.sibling}}function gh(s,a){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Do(c))}function yh(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Do(s))}function fs(s,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)wb(s,a,c,f),a=a.sibling}function wb(s,a,c,f){var y=a.flags;switch(a.tag){case 0:case 11:case 15:fs(s,a,c,f),y&2048&&Ho(9,a);break;case 1:fs(s,a,c,f);break;case 3:fs(s,a,c,f),y&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Do(s)));break;case 12:if(y&2048){fs(s,a,c,f),s=a.stateNode;try{var x=a.memoizedProps,k=x.id,E=x.onPostCommit;typeof E=="function"&&E(k,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(U){ot(a,a.return,U)}}else fs(s,a,c,f);break;case 31:fs(s,a,c,f);break;case 13:fs(s,a,c,f);break;case 23:break;case 22:x=a.stateNode,k=a.alternate,a.memoizedState!==null?x._visibility&2?fs(s,a,c,f):Ko(s,a):x._visibility&2?fs(s,a,c,f):(x._visibility|=2,vi(s,a,c,f,(a.subtreeFlags&10256)!==0||!1)),y&2048&&gh(k,a);break;case 24:fs(s,a,c,f),y&2048&&yh(a.alternate,a);break;default:fs(s,a,c,f)}}function vi(s,a,c,f,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=s,k=a,E=c,U=f,W=k.flags;switch(k.tag){case 0:case 11:case 15:vi(x,k,E,U,y),Ho(8,k);break;case 23:break;case 22:var ne=k.stateNode;k.memoizedState!==null?ne._visibility&2?vi(x,k,E,U,y):Ko(x,k):(ne._visibility|=2,vi(x,k,E,U,y)),y&&W&2048&&gh(k.alternate,k);break;case 24:vi(x,k,E,U,y),y&&W&2048&&yh(k.alternate,k);break;default:vi(x,k,E,U,y)}a=a.sibling}}function Ko(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=s,f=a,y=f.flags;switch(f.tag){case 22:Ko(c,f),y&2048&&gh(f.alternate,f);break;case 24:Ko(c,f),y&2048&&yh(f.alternate,f);break;default:Ko(c,f)}a=a.sibling}}var Yo=8192;function bi(s,a,c){if(s.subtreeFlags&Yo)for(s=s.child;s!==null;)Sb(s,a,c),s=s.sibling}function Sb(s,a,c){switch(s.tag){case 26:bi(s,a,c),s.flags&Yo&&s.memoizedState!==null&&BE(c,ds,s.memoizedState,s.memoizedProps);break;case 5:bi(s,a,c);break;case 3:case 4:var f=ds;ds=iu(s.stateNode.containerInfo),bi(s,a,c),ds=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Yo,Yo=16777216,bi(s,a,c),Yo=f):bi(s,a,c));break;default:bi(s,a,c)}}function jb(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Wo(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Xt=f,_b(f,s)}jb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)kb(s),s=s.sibling}function kb(s){switch(s.tag){case 0:case 11:case 15:Wo(s),s.flags&2048&&Ar(9,s,s.return);break;case 3:Wo(s);break;case 12:Wo(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Kc(s)):Wo(s);break;default:Wo(s)}}function Kc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Xt=f,_b(f,s)}jb(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:Ar(8,a,a.return),Kc(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Kc(a));break;default:Kc(a)}s=s.sibling}}function _b(s,a){for(;Xt!==null;){var c=Xt;switch(c.tag){case 0:case 11:case 15:Ar(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Do(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Xt=f;else e:for(c=s;Xt!==null;){f=Xt;var y=f.sibling,x=f.return;if(pb(f),f===c){Xt=null;break e}if(y!==null){y.return=x,Xt=y;break e}Xt=x}}}var tE={getCacheForType:function(s){var a=tn(zt),c=a.data.get(s);return c===void 0&&(c=s(),a.data.set(s,c)),c},cacheSignal:function(){return tn(zt).controller.signal}},nE=typeof WeakMap=="function"?WeakMap:Map,st=0,dt=null,qe=null,We=0,it=0,zn=null,Rr=!1,wi=!1,xh=!1,tr=0,Nt=0,Dr=0,Sa=0,vh=0,Ln=0,Si=0,Xo=null,kn=null,bh=!1,Yc=0,Nb=0,Wc=1/0,Xc=null,Or=null,qt=0,Mr=null,ji=null,nr=0,wh=0,Sh=null,Tb=null,Jo=0,jh=null;function In(){return(st&2)!==0&&We!==0?We&-We:$.T!==null?Ch():$y()}function Eb(){if(Ln===0)if((We&536870912)===0||Je){var s=xr;xr<<=1,(xr&3932160)===0&&(xr=262144),Ln=s}else Ln=536870912;return s=Mn.current,s!==null&&(s.flags|=32),Ln}function _n(s,a,c){(s===dt&&(it===2||it===9)||s.cancelPendingCommit!==null)&&(ki(s,0),Pr(s,We,Ln,!1)),xo(s,c),((st&2)===0||s!==dt)&&(s===dt&&((st&2)===0&&(Sa|=c),Nt===4&&Pr(s,We,Ln,!1)),Es(s))}function Cb(s,a,c){if((st&6)!==0)throw Error(r(327));var f=!c&&(a&127)===0&&(a&s.expiredLanes)===0||Ue(s,a),y=f?aE(s,a):_h(s,a,!0),x=f;do{if(y===0){wi&&!f&&Pr(s,a,0,!1);break}else{if(c=s.current.alternate,x&&!sE(c)){y=_h(s,a,!1),x=!1;continue}if(y===2){if(x=a,s.errorRecoveryDisabledLanes&x)var k=0;else k=s.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){a=k;e:{var E=s;y=Xo;var U=E.current.memoizedState.isDehydrated;if(U&&(ki(E,k).flags|=256),k=_h(E,k,!1),k!==2){if(xh&&!U){E.errorRecoveryDisabledLanes|=x,Sa|=x,y=4;break e}x=kn,kn=y,x!==null&&(kn===null?kn=x:kn.push.apply(kn,x))}y=k}if(x=!1,y!==2)continue}}if(y===1){ki(s,0),Pr(s,a,0,!0);break}e:{switch(f=s,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Pr(f,a,Ln,!Rr);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=Yc+300-At(),10<y)){if(Pr(f,a,Ln,!Rr),ve(f,0,!0)!==0)break e;nr=a,f.timeoutHandle=i0(Ab.bind(null,f,c,kn,Xc,bh,a,Ln,Sa,Si,Rr,x,"Throttled",-0,0),y);break e}Ab(f,c,kn,Xc,bh,a,Ln,Sa,Si,Rr,x,null,-0,0)}}break}while(!0);Es(s)}function Ab(s,a,c,f,y,x,k,E,U,W,ne,oe,X,Q){if(s.timeoutHandle=-1,oe=a.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vs},Sb(a,x,oe);var xe=(x&62914560)===x?Yc-At():(x&4194048)===x?Nb-At():0;if(xe=VE(oe,xe),xe!==null){nr=x,s.cancelPendingCommit=xe(Ib.bind(null,s,a,x,c,f,y,k,E,U,ne,oe,null,X,Q)),Pr(s,x,k,!W);return}}Ib(s,a,x,c,f,y,k,E,U)}function sE(s){for(var a=s;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var y=c[f],x=y.getSnapshot;y=y.value;try{if(!Dn(x(),y))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Pr(s,a,c,f){a&=~vh,a&=~Sa,s.suspendedLanes|=a,s.pingedLanes&=~a,f&&(s.warmLanes|=a),f=s.expirationTimes;for(var y=a;0<y;){var x=31-at(y),k=1<<x;f[x]=-1,y&=~k}c!==0&&By(s,c,a)}function Jc(){return(st&6)===0?(Qo(0),!1):!0}function kh(){if(qe!==null){if(it===0)var s=qe.return;else s=qe,Hs=ha=null,Bf(s),mi=null,Mo=0,s=qe;for(;s!==null;)ob(s.alternate,s),s=s.return;qe=null}}function ki(s,a){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,jE(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),nr=0,kh(),dt=s,qe=c=$s(s.current,null),We=a,it=0,zn=null,Rr=!1,wi=Ue(s,a),xh=!1,Si=Ln=vh=Sa=Dr=Nt=0,kn=Xo=null,bh=!1,(a&8)!==0&&(a|=a&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=a;0<f;){var y=31-at(f),x=1<<y;a|=s[y],f&=~x}return tr=a,xc(),c}function Rb(s,a){Le=null,$.H=Fo,a===hi||a===Nc?(a=Kx(),it=3):a===Ef?(a=Kx(),it=4):it=a===nh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,zn=a,qe===null&&(Nt=1,Bc(s,Yn(a,s.current)))}function Db(){var s=Mn.current;return s===null?!0:(We&4194048)===We?Qn===null:(We&62914560)===We||(We&536870912)!==0?s===Qn:!1}function Ob(){var s=$.H;return $.H=Fo,s===null?Fo:s}function Mb(){var s=$.A;return $.A=tE,s}function Qc(){Nt=4,Rr||(We&4194048)!==We&&Mn.current!==null||(wi=!0),(Dr&134217727)===0&&(Sa&134217727)===0||dt===null||Pr(dt,We,Ln,!1)}function _h(s,a,c){var f=st;st|=2;var y=Ob(),x=Mb();(dt!==s||We!==a)&&(Xc=null,ki(s,a)),a=!1;var k=Nt;e:do try{if(it!==0&&qe!==null){var E=qe,U=zn;switch(it){case 8:kh(),k=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(a=!0);var W=it;if(it=0,zn=null,_i(s,E,U,W),c&&wi){k=0;break e}break;default:W=it,it=0,zn=null,_i(s,E,U,W)}}rE(),k=Nt;break}catch(ne){Rb(s,ne)}while(!0);return a&&s.shellSuspendCounter++,Hs=ha=null,st=f,$.H=y,$.A=x,qe===null&&(dt=null,We=0,xc()),k}function rE(){for(;qe!==null;)Pb(qe)}function aE(s,a){var c=st;st|=2;var f=Ob(),y=Mb();dt!==s||We!==a?(Xc=null,Wc=At()+500,ki(s,a)):wi=Ue(s,a);e:do try{if(it!==0&&qe!==null){a=qe;var x=zn;t:switch(it){case 1:it=0,zn=null,_i(s,a,x,1);break;case 2:case 9:if(Hx(x)){it=0,zn=null,zb(a);break}a=function(){it!==2&&it!==9||dt!==s||(it=7),Es(s)},x.then(a,a);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:Hx(x)?(it=0,zn=null,zb(a)):(it=0,zn=null,_i(s,a,x,7));break;case 5:var k=null;switch(qe.tag){case 26:k=qe.memoizedState;case 5:case 27:var E=qe;if(k?w0(k):E.stateNode.complete){it=0,zn=null;var U=E.sibling;if(U!==null)qe=U;else{var W=E.return;W!==null?(qe=W,Zc(W)):qe=null}break t}}it=0,zn=null,_i(s,a,x,5);break;case 6:it=0,zn=null,_i(s,a,x,6);break;case 8:kh(),Nt=6;break e;default:throw Error(r(462))}}iE();break}catch(ne){Rb(s,ne)}while(!0);return Hs=ha=null,$.H=f,$.A=y,st=c,qe!==null?0:(dt=null,We=0,xc(),Nt)}function iE(){for(;qe!==null&&!Us();)Pb(qe)}function Pb(s){var a=ab(s.alternate,s,tr);s.memoizedProps=s.pendingProps,a===null?Zc(s):qe=a}function zb(s){var a=s,c=a.alternate;switch(a.tag){case 15:case 0:a=Zv(c,a,a.pendingProps,a.type,void 0,We);break;case 11:a=Zv(c,a,a.pendingProps,a.type.render,a.ref,We);break;case 5:Bf(a);default:ob(c,a),a=qe=Mx(a,tr),a=ab(c,a,tr)}s.memoizedProps=s.pendingProps,a===null?Zc(s):qe=a}function _i(s,a,c,f){Hs=ha=null,Bf(a),mi=null,Mo=0;var y=a.return;try{if(YT(s,y,a,c,We)){Nt=1,Bc(s,Yn(c,s.current)),qe=null;return}}catch(x){if(y!==null)throw qe=y,x;Nt=1,Bc(s,Yn(c,s.current)),qe=null;return}a.flags&32768?(Je||f===1?s=!0:wi||(We&536870912)!==0?s=!1:(Rr=s=!0,(f===2||f===9||f===3||f===6)&&(f=Mn.current,f!==null&&f.tag===13&&(f.flags|=16384))),Lb(a,s)):Zc(a)}function Zc(s){var a=s;do{if((a.flags&32768)!==0){Lb(a,Rr);return}s=a.return;var c=JT(a.alternate,a,tr);if(c!==null){qe=c;return}if(a=a.sibling,a!==null){qe=a;return}qe=a=s}while(a!==null);Nt===0&&(Nt=5)}function Lb(s,a){do{var c=QT(s.alternate,s);if(c!==null){c.flags&=32767,qe=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(s=s.sibling,s!==null)){qe=s;return}qe=s=c}while(s!==null);Nt=6,qe=null}function Ib(s,a,c,f,y,x,k,E,U){s.cancelPendingCommit=null;do eu();while(qt!==0);if((st&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=hf,U2(s,c,x,k,E,U),s===dt&&(qe=dt=null,We=0),ji=a,Mr=s,nr=c,wh=x,Sh=y,Tb=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,uE(Oe,function(){return $b(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=$.T,$.T=null,y=V.p,V.p=2,k=st,st|=4;try{ZT(s,a,c)}finally{st=k,V.p=y,$.T=f}}qt=1,Ub(),Bb(),Vb()}}function Ub(){if(qt===1){qt=0;var s=Mr,a=ji,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=$.T,$.T=null;var f=V.p;V.p=2;var y=st;st|=4;try{vb(a,s);var x=Lh,k=_x(s.containerInfo),E=x.focusedElem,U=x.selectionRange;if(k!==E&&E&&E.ownerDocument&&kx(E.ownerDocument.documentElement,E)){if(U!==null&&lf(E)){var W=U.start,ne=U.end;if(ne===void 0&&(ne=W),"selectionStart"in E)E.selectionStart=W,E.selectionEnd=Math.min(ne,E.value.length);else{var oe=E.ownerDocument||document,X=oe&&oe.defaultView||window;if(X.getSelection){var Q=X.getSelection(),xe=E.textContent.length,Ae=Math.min(U.start,xe),ut=U.end===void 0?Ae:Math.min(U.end,xe);!Q.extend&&Ae>ut&&(k=ut,ut=Ae,Ae=k);var H=jx(E,Ae),F=jx(E,ut);if(H&&F&&(Q.rangeCount!==1||Q.anchorNode!==H.node||Q.anchorOffset!==H.offset||Q.focusNode!==F.node||Q.focusOffset!==F.offset)){var Y=oe.createRange();Y.setStart(H.node,H.offset),Q.removeAllRanges(),Ae>ut?(Q.addRange(Y),Q.extend(F.node,F.offset)):(Y.setEnd(F.node,F.offset),Q.addRange(Y))}}}}for(oe=[],Q=E;Q=Q.parentNode;)Q.nodeType===1&&oe.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<oe.length;E++){var ae=oe[E];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}fu=!!zh,Lh=zh=null}finally{st=y,V.p=f,$.T=c}}s.current=a,qt=2}}function Bb(){if(qt===2){qt=0;var s=Mr,a=ji,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=$.T,$.T=null;var f=V.p;V.p=2;var y=st;st|=4;try{mb(s,a.alternate,a)}finally{st=y,V.p=f,$.T=c}}qt=3}}function Vb(){if(qt===4||qt===3){qt=0,ic();var s=Mr,a=ji,c=nr,f=Tb;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?qt=5:(qt=0,ji=Mr=null,Fb(s,s.pendingLanes));var y=s.pendingLanes;if(y===0&&(Or=null),Fd(c),a=a.stateNode,Rt&&typeof Rt.onCommitFiberRoot=="function")try{Rt.onCommitFiberRoot(Qt,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=$.T,y=V.p,V.p=2,$.T=null;try{for(var x=s.onRecoverableError,k=0;k<f.length;k++){var E=f[k];x(E.value,{componentStack:E.stack})}}finally{$.T=a,V.p=y}}(nr&3)!==0&&eu(),Es(s),y=s.pendingLanes,(c&261930)!==0&&(y&42)!==0?s===jh?Jo++:(Jo=0,jh=s):Jo=0,Qo(0)}}function Fb(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Do(a)))}function eu(){return Ub(),Bb(),Vb(),$b()}function $b(){if(qt!==5)return!1;var s=Mr,a=wh;wh=0;var c=Fd(nr),f=$.T,y=V.p;try{V.p=32>c?32:c,$.T=null,c=Sh,Sh=null;var x=Mr,k=nr;if(qt=0,ji=Mr=null,nr=0,(st&6)!==0)throw Error(r(331));var E=st;if(st|=4,kb(x.current),wb(x,x.current,k,c),st=E,Qo(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(Qt,x)}catch{}return!0}finally{V.p=y,$.T=f,Fb(s,a)}}function qb(s,a,c){a=Yn(c,a),a=th(s.stateNode,a,2),s=Tr(s,a,2),s!==null&&(xo(s,2),Es(s))}function ot(s,a,c){if(s.tag===3)qb(s,s,c);else for(;a!==null;){if(a.tag===3){qb(a,s,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Or===null||!Or.has(f))){s=Yn(c,s),c=Hv(2),f=Tr(a,c,2),f!==null&&(Gv(c,f,a,s),xo(f,2),Es(f));break}}a=a.return}}function Nh(s,a,c){var f=s.pingCache;if(f===null){f=s.pingCache=new nE;var y=new Set;f.set(a,y)}else y=f.get(a),y===void 0&&(y=new Set,f.set(a,y));y.has(c)||(xh=!0,y.add(c),s=oE.bind(null,s,a,c),a.then(s,s))}function oE(s,a,c){var f=s.pingCache;f!==null&&f.delete(a),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,dt===s&&(We&c)===c&&(Nt===4||Nt===3&&(We&62914560)===We&&300>At()-Yc?(st&2)===0&&ki(s,0):vh|=c,Si===We&&(Si=0)),Es(s)}function Hb(s,a){a===0&&(a=Uy()),s=ua(s,a),s!==null&&(xo(s,a),Es(s))}function lE(s){var a=s.memoizedState,c=0;a!==null&&(c=a.retryLane),Hb(s,c)}function cE(s,a){var c=0;switch(s.tag){case 31:case 13:var f=s.stateNode,y=s.memoizedState;y!==null&&(c=y.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(a),Hb(s,c)}function uE(s,a){return yr(s,a)}var tu=null,Ni=null,Th=!1,nu=!1,Eh=!1,zr=0;function Es(s){s!==Ni&&s.next===null&&(Ni===null?tu=Ni=s:Ni=Ni.next=s),nu=!0,Th||(Th=!0,fE())}function Qo(s,a){if(!Eh&&nu){Eh=!0;do for(var c=!1,f=tu;f!==null;){if(s!==0){var y=f.pendingLanes;if(y===0)var x=0;else{var k=f.suspendedLanes,E=f.pingedLanes;x=(1<<31-at(42|s)+1)-1,x&=y&~(k&~E),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Wb(f,x))}else x=We,x=ve(f,f===dt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||Ue(f,x)||(c=!0,Wb(f,x));f=f.next}while(c);Eh=!1}}function dE(){Gb()}function Gb(){nu=Th=!1;var s=0;zr!==0&&SE()&&(s=zr);for(var a=At(),c=null,f=tu;f!==null;){var y=f.next,x=Kb(f,a);x===0?(f.next=null,c===null?tu=y:c.next=y,y===null&&(Ni=c)):(c=f,(s!==0||(x&3)!==0)&&(nu=!0)),f=y}qt!==0&&qt!==5||Qo(s),zr!==0&&(zr=0)}function Kb(s,a){for(var c=s.suspendedLanes,f=s.pingedLanes,y=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var k=31-at(x),E=1<<k,U=y[k];U===-1?((E&c)===0||(E&f)!==0)&&(y[k]=aa(E,a)):U<=a&&(s.expiredLanes|=E),x&=~E}if(a=dt,c=We,c=ve(s,s===a?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,c===0||s===a&&(it===2||it===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&$a(f),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Ue(s,c)){if(a=c&-c,a===s.callbackPriority)return a;switch(f!==null&&$a(f),Fd(c)){case 2:case 8:c=me;break;case 32:c=Oe;break;case 268435456:c=Ze;break;default:c=Oe}return f=Yb.bind(null,s),c=yr(c,f),s.callbackPriority=a,s.callbackNode=c,a}return f!==null&&f!==null&&$a(f),s.callbackPriority=2,s.callbackNode=null,2}function Yb(s,a){if(qt!==0&&qt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(eu()&&s.callbackNode!==c)return null;var f=We;return f=ve(s,s===dt?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(Cb(s,f,a),Kb(s,At()),s.callbackNode!=null&&s.callbackNode===c?Yb.bind(null,s):null)}function Wb(s,a){if(eu())return null;Cb(s,a,!0)}function fE(){kE(function(){(st&6)!==0?yr(re,dE):Gb()})}function Ch(){if(zr===0){var s=di;s===0&&(s=Ha,Ha<<=1,(Ha&261888)===0&&(Ha=256)),zr=s}return zr}function Xb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:uc(""+s)}function Jb(s,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,s.id&&c.setAttribute("form",s.id),a.parentNode.insertBefore(c,a),s=new FormData(s),c.parentNode.removeChild(c),s}function hE(s,a,c,f,y){if(a==="submit"&&c&&c.stateNode===y){var x=Xb((y[vn]||null).action),k=f.submitter;k&&(a=(a=k[vn]||null)?Xb(a.formAction):k.getAttribute("formAction"),a!==null&&(x=a,k=null));var E=new mc("action","action",null,f,y);s.push({event:E,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(zr!==0){var U=k?Jb(y,k):new FormData(y);Wf(c,{pending:!0,data:U,method:y.method,action:x},null,U)}}else typeof x=="function"&&(E.preventDefault(),U=k?Jb(y,k):new FormData(y),Wf(c,{pending:!0,data:U,method:y.method,action:x},x,U))},currentTarget:y}]})}}for(var Ah=0;Ah<ff.length;Ah++){var Rh=ff[Ah],mE=Rh.toLowerCase(),pE=Rh[0].toUpperCase()+Rh.slice(1);us(mE,"on"+pE)}us(Ex,"onAnimationEnd"),us(Cx,"onAnimationIteration"),us(Ax,"onAnimationStart"),us("dblclick","onDoubleClick"),us("focusin","onFocus"),us("focusout","onBlur"),us(RT,"onTransitionRun"),us(DT,"onTransitionStart"),us(OT,"onTransitionCancel"),us(Rx,"onTransitionEnd"),Ja("onMouseEnter",["mouseout","mouseover"]),Ja("onMouseLeave",["mouseout","mouseover"]),Ja("onPointerEnter",["pointerout","pointerover"]),Ja("onPointerLeave",["pointerout","pointerover"]),ia("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ia("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ia("onBeforeInput",["compositionend","keypress","textInput","paste"]),ia("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ia("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ia("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zo="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(" "),gE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zo));function Qb(s,a){a=(a&4)!==0;for(var c=0;c<s.length;c++){var f=s[c],y=f.event;f=f.listeners;e:{var x=void 0;if(a)for(var k=f.length-1;0<=k;k--){var E=f[k],U=E.instance,W=E.currentTarget;if(E=E.listener,U!==x&&y.isPropagationStopped())break e;x=E,y.currentTarget=W;try{x(y)}catch(ne){yc(ne)}y.currentTarget=null,x=U}else for(k=0;k<f.length;k++){if(E=f[k],U=E.instance,W=E.currentTarget,E=E.listener,U!==x&&y.isPropagationStopped())break e;x=E,y.currentTarget=W;try{x(y)}catch(ne){yc(ne)}y.currentTarget=null,x=U}}}}function He(s,a){var c=a[$d];c===void 0&&(c=a[$d]=new Set);var f=s+"__bubble";c.has(f)||(Zb(a,s,2,!1),c.add(f))}function Dh(s,a,c){var f=0;a&&(f|=4),Zb(c,s,f,a)}var su="_reactListening"+Math.random().toString(36).slice(2);function Oh(s){if(!s[su]){s[su]=!0,Gy.forEach(function(c){c!=="selectionchange"&&(gE.has(c)||Dh(c,!1,s),Dh(c,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[su]||(a[su]=!0,Dh("selectionchange",!1,a))}}function Zb(s,a,c,f){switch(E0(a)){case 2:var y=qE;break;case 8:y=HE;break;default:y=Yh}c=y.bind(null,a,c,s),y=void 0,!Qd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),f?y!==void 0?s.addEventListener(a,c,{capture:!0,passive:y}):s.addEventListener(a,c,!0):y!==void 0?s.addEventListener(a,c,{passive:y}):s.addEventListener(a,c,!1)}function Mh(s,a,c,f,y){var x=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var k=f.tag;if(k===3||k===4){var E=f.stateNode.containerInfo;if(E===y)break;if(k===4)for(k=f.return;k!==null;){var U=k.tag;if((U===3||U===4)&&k.stateNode.containerInfo===y)return;k=k.return}for(;E!==null;){if(k=Ya(E),k===null)return;if(U=k.tag,U===5||U===6||U===26||U===27){f=x=k;continue e}E=E.parentNode}}f=f.return}rx(function(){var W=x,ne=Xd(c),oe=[];e:{var X=Dx.get(s);if(X!==void 0){var Q=mc,xe=s;switch(s){case"keypress":if(fc(c)===0)break e;case"keydown":case"keyup":Q=cT;break;case"focusin":xe="focus",Q=nf;break;case"focusout":xe="blur",Q=nf;break;case"beforeblur":case"afterblur":Q=nf;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=ox;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=J2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=fT;break;case Ex:case Cx:case Ax:Q=eT;break;case Rx:Q=mT;break;case"scroll":case"scrollend":Q=W2;break;case"wheel":Q=gT;break;case"copy":case"cut":case"paste":Q=nT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=cx;break;case"toggle":case"beforetoggle":Q=xT}var Ae=(a&4)!==0,ut=!Ae&&(s==="scroll"||s==="scrollend"),H=Ae?X!==null?X+"Capture":null:X;Ae=[];for(var F=W,Y;F!==null;){var ae=F;if(Y=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||Y===null||H===null||(ae=wo(F,H),ae!=null&&Ae.push(el(F,ae,Y))),ut)break;F=F.return}0<Ae.length&&(X=new Q(X,xe,null,c,ne),oe.push({event:X,listeners:Ae}))}}if((a&7)===0){e:{if(X=s==="mouseover"||s==="pointerover",Q=s==="mouseout"||s==="pointerout",X&&c!==Wd&&(xe=c.relatedTarget||c.fromElement)&&(Ya(xe)||xe[Ka]))break e;if((Q||X)&&(X=ne.window===ne?ne:(X=ne.ownerDocument)?X.defaultView||X.parentWindow:window,Q?(xe=c.relatedTarget||c.toElement,Q=W,xe=xe?Ya(xe):null,xe!==null&&(ut=l(xe),Ae=xe.tag,xe!==ut||Ae!==5&&Ae!==27&&Ae!==6)&&(xe=null)):(Q=null,xe=W),Q!==xe)){if(Ae=ox,ae="onMouseLeave",H="onMouseEnter",F="mouse",(s==="pointerout"||s==="pointerover")&&(Ae=cx,ae="onPointerLeave",H="onPointerEnter",F="pointer"),ut=Q==null?X:bo(Q),Y=xe==null?X:bo(xe),X=new Ae(ae,F+"leave",Q,c,ne),X.target=ut,X.relatedTarget=Y,ae=null,Ya(ne)===W&&(Ae=new Ae(H,F+"enter",xe,c,ne),Ae.target=Y,Ae.relatedTarget=ut,ae=Ae),ut=ae,Q&&xe)t:{for(Ae=yE,H=Q,F=xe,Y=0,ae=H;ae;ae=Ae(ae))Y++;ae=0;for(var Te=F;Te;Te=Ae(Te))ae++;for(;0<Y-ae;)H=Ae(H),Y--;for(;0<ae-Y;)F=Ae(F),ae--;for(;Y--;){if(H===F||F!==null&&H===F.alternate){Ae=H;break t}H=Ae(H),F=Ae(F)}Ae=null}else Ae=null;Q!==null&&e0(oe,X,Q,Ae,!1),xe!==null&&ut!==null&&e0(oe,ut,xe,Ae,!0)}}e:{if(X=W?bo(W):window,Q=X.nodeName&&X.nodeName.toLowerCase(),Q==="select"||Q==="input"&&X.type==="file")var et=yx;else if(px(X))if(xx)et=ET;else{et=NT;var je=_T}else Q=X.nodeName,!Q||Q.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?W&&Yd(W.elementType)&&(et=yx):et=TT;if(et&&(et=et(s,W))){gx(oe,et,c,ne);break e}je&&je(s,X,W),s==="focusout"&&W&&X.type==="number"&&W.memoizedProps.value!=null&&Kd(X,"number",X.value)}switch(je=W?bo(W):window,s){case"focusin":(px(je)||je.contentEditable==="true")&&(si=je,cf=W,Co=null);break;case"focusout":Co=cf=si=null;break;case"mousedown":uf=!0;break;case"contextmenu":case"mouseup":case"dragend":uf=!1,Nx(oe,c,ne);break;case"selectionchange":if(AT)break;case"keydown":case"keyup":Nx(oe,c,ne)}var Be;if(rf)e:{switch(s){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else ni?hx(s,c)&&(Xe="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(Xe="onCompositionStart");Xe&&(ux&&c.locale!=="ko"&&(ni||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&ni&&(Be=ax()):(br=ne,Zd="value"in br?br.value:br.textContent,ni=!0)),je=ru(W,Xe),0<je.length&&(Xe=new lx(Xe,s,null,c,ne),oe.push({event:Xe,listeners:je}),Be?Xe.data=Be:(Be=mx(c),Be!==null&&(Xe.data=Be)))),(Be=bT?wT(s,c):ST(s,c))&&(Xe=ru(W,"onBeforeInput"),0<Xe.length&&(je=new lx("onBeforeInput","beforeinput",null,c,ne),oe.push({event:je,listeners:Xe}),je.data=Be)),hE(oe,s,W,c,ne)}Qb(oe,a)})}function el(s,a,c){return{instance:s,listener:a,currentTarget:c}}function ru(s,a){for(var c=a+"Capture",f=[];s!==null;){var y=s,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=wo(s,c),y!=null&&f.unshift(el(s,y,x)),y=wo(s,a),y!=null&&f.push(el(s,y,x))),s.tag===3)return f;s=s.return}return[]}function yE(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function e0(s,a,c,f,y){for(var x=a._reactName,k=[];c!==null&&c!==f;){var E=c,U=E.alternate,W=E.stateNode;if(E=E.tag,U!==null&&U===f)break;E!==5&&E!==26&&E!==27||W===null||(U=W,y?(W=wo(c,x),W!=null&&k.unshift(el(c,W,U))):y||(W=wo(c,x),W!=null&&k.push(el(c,W,U)))),c=c.return}k.length!==0&&s.push({event:a,listeners:k})}var xE=/\r\n?/g,vE=/\u0000|\uFFFD/g;function t0(s){return(typeof s=="string"?s:""+s).replace(xE,`
9
+ `).replace(vE,"")}function n0(s,a){return a=t0(a),t0(s)===a}function ct(s,a,c,f,y,x){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Za(s,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Za(s,""+f);break;case"className":lc(s,"class",f);break;case"tabIndex":lc(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(s,c,f);break;case"style":nx(s,f,x);break;case"data":if(a!=="object"){lc(s,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){s.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=uc(""+f),s.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(c,"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 x=="function"&&(c==="formAction"?(a!=="input"&&ct(s,a,"name",y.name,y,null),ct(s,a,"formEncType",y.formEncType,y,null),ct(s,a,"formMethod",y.formMethod,y,null),ct(s,a,"formTarget",y.formTarget,y,null)):(ct(s,a,"encType",y.encType,y,null),ct(s,a,"method",y.method,y,null),ct(s,a,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=uc(""+f),s.setAttribute(c,f);break;case"onClick":f!=null&&(s.onclick=Vs);break;case"onScroll":f!=null&&He("scroll",s);break;case"onScrollEnd":f!=null&&He("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(y.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}c=uc(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""+f):s.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":f===!0?s.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,f):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(c,f):s.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(c):s.setAttribute(c,f);break;case"popover":He("beforetoggle",s),He("toggle",s),oc(s,"popover",f);break;case"xlinkActuate":Bs(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Bs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Bs(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Bs(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Bs(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Bs(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Bs(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Bs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Bs(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":oc(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=K2.get(c)||c,oc(s,c,f))}}function Ph(s,a,c,f,y,x){switch(c){case"style":nx(s,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(y.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof f=="string"?Za(s,f):(typeof f=="number"||typeof f=="bigint")&&Za(s,""+f);break;case"onScroll":f!=null&&He("scroll",s);break;case"onScrollEnd":f!=null&&He("scrollend",s);break;case"onClick":f!=null&&(s.onclick=Vs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ky.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(y=c.endsWith("Capture"),a=c.slice(2,y?c.length-7:void 0),x=s[vn]||null,x=x!=null?x[c]:null,typeof x=="function"&&s.removeEventListener(a,x,y),typeof f=="function")){typeof x!="function"&&x!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(a,f,y);break e}c in s?s[c]=f:f===!0?s.setAttribute(c,""):oc(s,c,f)}}}function sn(s,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",s),He("load",s);var f=!1,y=!1,x;for(x in c)if(c.hasOwnProperty(x)){var k=c[x];if(k!=null)switch(x){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ct(s,a,x,k,c,null)}}y&&ct(s,a,"srcSet",c.srcSet,c,null),f&&ct(s,a,"src",c.src,c,null);return;case"input":He("invalid",s);var E=x=k=y=null,U=null,W=null;for(f in c)if(c.hasOwnProperty(f)){var ne=c[f];if(ne!=null)switch(f){case"name":y=ne;break;case"type":k=ne;break;case"checked":U=ne;break;case"defaultChecked":W=ne;break;case"value":x=ne;break;case"defaultValue":E=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,a));break;default:ct(s,a,f,ne,c,null)}}Qy(s,x,E,U,W,k,y,!1);return;case"select":He("invalid",s),f=k=x=null;for(y in c)if(c.hasOwnProperty(y)&&(E=c[y],E!=null))switch(y){case"value":x=E;break;case"defaultValue":k=E;break;case"multiple":f=E;default:ct(s,a,y,E,c,null)}a=x,c=k,s.multiple=!!f,a!=null?Qa(s,!!f,a,!1):c!=null&&Qa(s,!!f,c,!0);return;case"textarea":He("invalid",s),x=y=f=null;for(k in c)if(c.hasOwnProperty(k)&&(E=c[k],E!=null))switch(k){case"value":f=E;break;case"defaultValue":y=E;break;case"children":x=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:ct(s,a,k,E,c,null)}ex(s,f,y,x);return;case"option":for(U in c)c.hasOwnProperty(U)&&(f=c[U],f!=null)&&(U==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":ct(s,a,U,f,c,null));return;case"dialog":He("beforetoggle",s),He("toggle",s),He("cancel",s),He("close",s);break;case"iframe":case"object":He("load",s);break;case"video":case"audio":for(f=0;f<Zo.length;f++)He(Zo[f],s);break;case"image":He("error",s),He("load",s);break;case"details":He("toggle",s);break;case"embed":case"source":case"link":He("error",s),He("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in c)if(c.hasOwnProperty(W)&&(f=c[W],f!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ct(s,a,W,f,c,null)}return;default:if(Yd(a)){for(ne in c)c.hasOwnProperty(ne)&&(f=c[ne],f!==void 0&&Ph(s,a,ne,f,c,void 0));return}}for(E in c)c.hasOwnProperty(E)&&(f=c[E],f!=null&&ct(s,a,E,f,c,null))}function bE(s,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,k=null,E=null,U=null,W=null,ne=null;for(Q in c){var oe=c[Q];if(c.hasOwnProperty(Q)&&oe!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":U=oe;default:f.hasOwnProperty(Q)||ct(s,a,Q,null,f,oe)}}for(var X in f){var Q=f[X];if(oe=c[X],f.hasOwnProperty(X)&&(Q!=null||oe!=null))switch(X){case"type":x=Q;break;case"name":y=Q;break;case"checked":W=Q;break;case"defaultChecked":ne=Q;break;case"value":k=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,a));break;default:Q!==oe&&ct(s,a,X,Q,f,oe)}}Gd(s,k,E,U,W,ne,x,y);return;case"select":Q=k=E=X=null;for(x in c)if(U=c[x],c.hasOwnProperty(x)&&U!=null)switch(x){case"value":break;case"multiple":Q=U;default:f.hasOwnProperty(x)||ct(s,a,x,null,f,U)}for(y in f)if(x=f[y],U=c[y],f.hasOwnProperty(y)&&(x!=null||U!=null))switch(y){case"value":X=x;break;case"defaultValue":E=x;break;case"multiple":k=x;default:x!==U&&ct(s,a,y,x,f,U)}a=E,c=k,f=Q,X!=null?Qa(s,!!c,X,!1):!!f!=!!c&&(a!=null?Qa(s,!!c,a,!0):Qa(s,!!c,c?[]:"",!1));return;case"textarea":Q=X=null;for(E in c)if(y=c[E],c.hasOwnProperty(E)&&y!=null&&!f.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:ct(s,a,E,null,f,y)}for(k in f)if(y=f[k],x=c[k],f.hasOwnProperty(k)&&(y!=null||x!=null))switch(k){case"value":X=y;break;case"defaultValue":Q=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&ct(s,a,k,y,f,x)}Zy(s,X,Q);return;case"option":for(var xe in c)X=c[xe],c.hasOwnProperty(xe)&&X!=null&&!f.hasOwnProperty(xe)&&(xe==="selected"?s.selected=!1:ct(s,a,xe,null,f,X));for(U in f)X=f[U],Q=c[U],f.hasOwnProperty(U)&&X!==Q&&(X!=null||Q!=null)&&(U==="selected"?s.selected=X&&typeof X!="function"&&typeof X!="symbol":ct(s,a,U,X,f,Q));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 Ae in c)X=c[Ae],c.hasOwnProperty(Ae)&&X!=null&&!f.hasOwnProperty(Ae)&&ct(s,a,Ae,null,f,X);for(W in f)if(X=f[W],Q=c[W],f.hasOwnProperty(W)&&X!==Q&&(X!=null||Q!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,a));break;default:ct(s,a,W,X,f,Q)}return;default:if(Yd(a)){for(var ut in c)X=c[ut],c.hasOwnProperty(ut)&&X!==void 0&&!f.hasOwnProperty(ut)&&Ph(s,a,ut,void 0,f,X);for(ne in f)X=f[ne],Q=c[ne],!f.hasOwnProperty(ne)||X===Q||X===void 0&&Q===void 0||Ph(s,a,ne,X,f,Q);return}}for(var H in c)X=c[H],c.hasOwnProperty(H)&&X!=null&&!f.hasOwnProperty(H)&&ct(s,a,H,null,f,X);for(oe in f)X=f[oe],Q=c[oe],!f.hasOwnProperty(oe)||X===Q||X==null&&Q==null||ct(s,a,oe,X,f,Q)}function s0(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wE(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var y=c[f],x=y.transferSize,k=y.initiatorType,E=y.duration;if(x&&E&&s0(k)){for(k=0,E=y.responseEnd,f+=1;f<c.length;f++){var U=c[f],W=U.startTime;if(W>E)break;var ne=U.transferSize,oe=U.initiatorType;ne&&s0(oe)&&(U=U.responseEnd,k+=ne*(U<E?1:(E-W)/(U-W)))}if(--f,a+=8*(x+k)/(y.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var zh=null,Lh=null;function au(s){return s.nodeType===9?s:s.ownerDocument}function r0(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function a0(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Ih(s,a){return s==="textarea"||s==="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 Uh=null;function SE(){var s=window.event;return s&&s.type==="popstate"?s===Uh?!1:(Uh=s,!0):(Uh=null,!1)}var i0=typeof setTimeout=="function"?setTimeout:void 0,jE=typeof clearTimeout=="function"?clearTimeout:void 0,o0=typeof Promise=="function"?Promise:void 0,kE=typeof queueMicrotask=="function"?queueMicrotask:typeof o0<"u"?function(s){return o0.resolve(null).then(s).catch(_E)}:i0;function _E(s){setTimeout(function(){throw s})}function Lr(s){return s==="head"}function l0(s,a){var c=a,f=0;do{var y=c.nextSibling;if(s.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"||c==="/&"){if(f===0){s.removeChild(y),Ai(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")tl(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,tl(c);for(var x=c.firstChild;x;){var k=x.nextSibling,E=x.nodeName;x[vo]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=k}}else c==="body"&&tl(s.ownerDocument.body);c=y}while(c);Ai(a)}function c0(s,a){var c=s;s=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=f}while(c)}function Bh(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Bh(c),qd(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function NE(s,a,c,f){for(;s.nodeType===1;){var y=c;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[vo])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==y.rel||s.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||s.getAttribute("title")!==(y.title==null?null:y.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(y.src==null?null:y.src)||s.getAttribute("type")!==(y.type==null?null:y.type)||s.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=Zn(s.nextSibling),s===null)break}return null}function TE(s,a,c){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Zn(s.nextSibling),s===null))return null;return s}function u0(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Zn(s.nextSibling),s===null))return null;return s}function Vh(s){return s.data==="$?"||s.data==="$~"}function Fh(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function EE(s,a){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function Zn(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var $h=null;function d0(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(a===0)return Zn(s.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}s=s.nextSibling}return null}function f0(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return s;a--}else c!=="/$"&&c!=="/&"||a++}s=s.previousSibling}return null}function h0(s,a,c){switch(a=au(c),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function tl(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);qd(s)}var es=new Map,m0=new Set;function iu(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var sr=V.d;V.d={f:CE,r:AE,D:RE,C:DE,L:OE,m:ME,X:zE,S:PE,M:LE};function CE(){var s=sr.f(),a=Jc();return s||a}function AE(s){var a=Wa(s);a!==null&&a.tag===5&&a.type==="form"?Rv(a):sr.r(s)}var Ti=typeof document>"u"?null:document;function p0(s,a,c){var f=Ti;if(f&&typeof a=="string"&&a){var y=Gn(a);y='link[rel="'+s+'"][href="'+y+'"]',typeof c=="string"&&(y+='[crossorigin="'+c+'"]'),m0.has(y)||(m0.add(y),s={rel:s,crossOrigin:c,href:a},f.querySelector(y)===null&&(a=f.createElement("link"),sn(a,"link",s),Wt(a),f.head.appendChild(a)))}}function RE(s){sr.D(s),p0("dns-prefetch",s,null)}function DE(s,a){sr.C(s,a),p0("preconnect",s,a)}function OE(s,a,c){sr.L(s,a,c);var f=Ti;if(f&&s&&a){var y='link[rel="preload"][as="'+Gn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(y+='[imagesrcset="'+Gn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(y+='[imagesizes="'+Gn(c.imageSizes)+'"]')):y+='[href="'+Gn(s)+'"]';var x=y;switch(a){case"style":x=Ei(s);break;case"script":x=Ci(s)}es.has(x)||(s=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:s,as:a},c),es.set(x,s),f.querySelector(y)!==null||a==="style"&&f.querySelector(nl(x))||a==="script"&&f.querySelector(sl(x))||(a=f.createElement("link"),sn(a,"link",s),Wt(a),f.head.appendChild(a)))}}function ME(s,a){sr.m(s,a);var c=Ti;if(c&&s){var f=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Gn(f)+'"][href="'+Gn(s)+'"]',x=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ci(s)}if(!es.has(x)&&(s=g({rel:"modulepreload",href:s},a),es.set(x,s),c.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(sl(x)))return}f=c.createElement("link"),sn(f,"link",s),Wt(f),c.head.appendChild(f)}}}function PE(s,a,c){sr.S(s,a,c);var f=Ti;if(f&&s){var y=Xa(f).hoistableStyles,x=Ei(s);a=a||"default";var k=y.get(x);if(!k){var E={loading:0,preload:null};if(k=f.querySelector(nl(x)))E.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},c),(c=es.get(x))&&qh(s,c);var U=k=f.createElement("link");Wt(U),sn(U,"link",s),U._p=new Promise(function(W,ne){U.onload=W,U.onerror=ne}),U.addEventListener("load",function(){E.loading|=1}),U.addEventListener("error",function(){E.loading|=2}),E.loading|=4,ou(k,a,f)}k={type:"stylesheet",instance:k,count:1,state:E},y.set(x,k)}}}function zE(s,a){sr.X(s,a);var c=Ti;if(c&&s){var f=Xa(c).hoistableScripts,y=Ci(s),x=f.get(y);x||(x=c.querySelector(sl(y)),x||(s=g({src:s,async:!0},a),(a=es.get(y))&&Hh(s,a),x=c.createElement("script"),Wt(x),sn(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(y,x))}}function LE(s,a){sr.M(s,a);var c=Ti;if(c&&s){var f=Xa(c).hoistableScripts,y=Ci(s),x=f.get(y);x||(x=c.querySelector(sl(y)),x||(s=g({src:s,async:!0,type:"module"},a),(a=es.get(y))&&Hh(s,a),x=c.createElement("script"),Wt(x),sn(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(y,x))}}function g0(s,a,c,f){var y=(y=ye.current)?iu(y):null;if(!y)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Ei(c.href),c=Xa(y).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Ei(c.href);var x=Xa(y).hoistableStyles,k=x.get(s);if(k||(y=y.ownerDocument||y,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,k),(x=y.querySelector(nl(s)))&&!x._p&&(k.instance=x,k.state.loading=5),es.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},es.set(s,c),x||IE(y,s,c,k.state))),a&&f===null)throw Error(r(528,""));return k}if(a&&f!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ci(c),c=Xa(y).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Ei(s){return'href="'+Gn(s)+'"'}function nl(s){return'link[rel="stylesheet"]['+s+"]"}function y0(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function IE(s,a,c,f){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=s.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),sn(a,"link",c),Wt(a),s.head.appendChild(a))}function Ci(s){return'[src="'+Gn(s)+'"]'}function sl(s){return"script[async]"+s}function x0(s,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=s.querySelector('style[data-href~="'+Gn(c.href)+'"]');if(f)return a.instance=f,Wt(f),f;var y=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),Wt(f),sn(f,"style",y),ou(f,c.precedence,s),a.instance=f;case"stylesheet":y=Ei(c.href);var x=s.querySelector(nl(y));if(x)return a.state.loading|=4,a.instance=x,Wt(x),x;f=y0(c),(y=es.get(y))&&qh(f,y),x=(s.ownerDocument||s).createElement("link"),Wt(x);var k=x;return k._p=new Promise(function(E,U){k.onload=E,k.onerror=U}),sn(x,"link",f),a.state.loading|=4,ou(x,c.precedence,s),a.instance=x;case"script":return x=Ci(c.src),(y=s.querySelector(sl(x)))?(a.instance=y,Wt(y),y):(f=c,(y=es.get(x))&&(f=g({},c),Hh(f,y)),s=s.ownerDocument||s,y=s.createElement("script"),Wt(y),sn(y,"link",f),s.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,ou(f,c.precedence,s));return a.instance}function ou(s,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,x=y,k=0;k<f.length;k++){var E=f[k];if(E.dataset.precedence===a)x=E;else if(x!==y)break}x?x.parentNode.insertBefore(s,x.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(s,a.firstChild))}function qh(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Hh(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var lu=null;function v0(s,a,c){if(lu===null){var f=new Map,y=lu=new Map;y.set(c,f)}else y=lu,f=y.get(c),f||(f=new Map,y.set(c,f));if(f.has(s))return f;for(f.set(s,null),c=c.getElementsByTagName(s),y=0;y<c.length;y++){var x=c[y];if(!(x[vo]||x[Zt]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var k=x.getAttribute(a)||"";k=s+k;var E=f.get(k);E?E.push(x):f.set(k,[x])}}return f}function b0(s,a,c){s=s.ownerDocument||s,s.head.insertBefore(c,a==="title"?s.querySelector("head > title"):null)}function UE(s,a,c){if(c===1||a.itemProp!=null)return!1;switch(s){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"?(s=a.disabled,typeof a.precedence=="string"&&s==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 w0(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function BE(s,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var y=Ei(f.href),x=a.querySelector(nl(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=cu.bind(s),a.then(s,s)),c.state.loading|=4,c.instance=x,Wt(x);return}x=a.ownerDocument||a,f=y0(f),(y=es.get(y))&&qh(f,y),x=x.createElement("link"),Wt(x);var k=x;k._p=new Promise(function(E,U){k.onload=E,k.onerror=U}),sn(x,"link",f),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=cu.bind(s),a.addEventListener("load",c),a.addEventListener("error",c))}}var Gh=0;function VE(s,a){return s.stylesheets&&s.count===0&&du(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var f=setTimeout(function(){if(s.stylesheets&&du(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+a);0<s.imgBytes&&Gh===0&&(Gh=62500*wE());var y=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&du(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>Gh?50:800)+a);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var uu=null;function du(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,uu=new Map,a.forEach(FE,s),uu=null,cu.call(s))}function FE(s,a){if(!(a.state.loading&4)){var c=uu.get(s);if(c)var f=c.get(null);else{c=new Map,uu.set(s,c);for(var y=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var k=y[x];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(c.set(k.dataset.precedence,k),f=k)}f&&c.set(null,f)}y=a.instance,k=y.getAttribute("data-precedence"),x=c.get(k)||f,x===f&&c.set(null,y),c.set(k,y),this.count++,f=cu.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),x?x.parentNode.insertBefore(y,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(y,s.firstChild)),a.state.loading|=4}}var rl={$$typeof:T,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function $E(s,a,c,f,y,x,k,E,U){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Bd(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bd(0),this.hiddenUpdates=Bd(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function S0(s,a,c,f,y,x,k,E,U,W,ne,oe){return s=new $E(s,a,c,k,U,W,ne,oe,E),a=1,x===!0&&(a|=24),x=On(3,null,null,a),s.current=x,x.stateNode=s,a=_f(),a.refCount++,s.pooledCache=a,a.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:a},Cf(x),s}function j0(s){return s?(s=ii,s):ii}function k0(s,a,c,f,y,x){y=j0(y),f.context===null?f.context=y:f.pendingContext=y,f=Nr(a),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=Tr(s,f,a),c!==null&&(_n(c,s,a),zo(c,s,a))}function _0(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<a?c:a}}function Kh(s,a){_0(s,a),(s=s.alternate)&&_0(s,a)}function N0(s){if(s.tag===13||s.tag===31){var a=ua(s,67108864);a!==null&&_n(a,s,67108864),Kh(s,67108864)}}function T0(s){if(s.tag===13||s.tag===31){var a=In();a=Vd(a);var c=ua(s,a);c!==null&&_n(c,s,a),Kh(s,a)}}var fu=!0;function qE(s,a,c,f){var y=$.T;$.T=null;var x=V.p;try{V.p=2,Yh(s,a,c,f)}finally{V.p=x,$.T=y}}function HE(s,a,c,f){var y=$.T;$.T=null;var x=V.p;try{V.p=8,Yh(s,a,c,f)}finally{V.p=x,$.T=y}}function Yh(s,a,c,f){if(fu){var y=Wh(f);if(y===null)Mh(s,a,f,hu,c),C0(s,f);else if(KE(y,s,a,c,f))f.stopPropagation();else if(C0(s,f),a&4&&-1<GE.indexOf(s)){for(;y!==null;){var x=Wa(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var k=te(x.pendingLanes);if(k!==0){var E=x;for(E.pendingLanes|=2,E.entangledLanes|=2;k;){var U=1<<31-at(k);E.entanglements[1]|=U,k&=~U}Es(x),(st&6)===0&&(Wc=At()+500,Qo(0))}}break;case 31:case 13:E=ua(x,2),E!==null&&_n(E,x,2),Jc(),Kh(x,2)}if(x=Wh(f),x===null&&Mh(s,a,f,hu,c),x===y)break;y=x}y!==null&&f.stopPropagation()}else Mh(s,a,f,null,c)}}function Wh(s){return s=Xd(s),Xh(s)}var hu=null;function Xh(s){if(hu=null,s=Ya(s),s!==null){var a=l(s);if(a===null)s=null;else{var c=a.tag;if(c===13){if(s=u(a),s!==null)return s;s=null}else if(c===31){if(s=d(a),s!==null)return s;s=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return hu=s,null}function E0(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(qa()){case re:return 2;case me:return 8;case Oe:case Fe:return 32;case Ze:return 268435456;default:return 32}default:return 32}}var Jh=!1,Ir=null,Ur=null,Br=null,al=new Map,il=new Map,Vr=[],GE="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 C0(s,a){switch(s){case"focusin":case"focusout":Ir=null;break;case"dragenter":case"dragleave":Ur=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":al.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":il.delete(a.pointerId)}}function ol(s,a,c,f,y,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[y]},a!==null&&(a=Wa(a),a!==null&&N0(a)),s):(s.eventSystemFlags|=f,a=s.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),s)}function KE(s,a,c,f,y){switch(a){case"focusin":return Ir=ol(Ir,s,a,c,f,y),!0;case"dragenter":return Ur=ol(Ur,s,a,c,f,y),!0;case"mouseover":return Br=ol(Br,s,a,c,f,y),!0;case"pointerover":var x=y.pointerId;return al.set(x,ol(al.get(x)||null,s,a,c,f,y)),!0;case"gotpointercapture":return x=y.pointerId,il.set(x,ol(il.get(x)||null,s,a,c,f,y)),!0}return!1}function A0(s){var a=Ya(s.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){s.blockedOn=a,qy(s.priority,function(){T0(c)});return}}else if(a===31){if(a=d(c),a!==null){s.blockedOn=a,qy(s.priority,function(){T0(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function mu(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var c=Wh(s.nativeEvent);if(c===null){c=s.nativeEvent;var f=new c.constructor(c.type,c);Wd=f,c.target.dispatchEvent(f),Wd=null}else return a=Wa(c),a!==null&&N0(a),s.blockedOn=c,!1;a.shift()}return!0}function R0(s,a,c){mu(s)&&c.delete(a)}function YE(){Jh=!1,Ir!==null&&mu(Ir)&&(Ir=null),Ur!==null&&mu(Ur)&&(Ur=null),Br!==null&&mu(Br)&&(Br=null),al.forEach(R0),il.forEach(R0)}function pu(s,a){s.blockedOn===a&&(s.blockedOn=null,Jh||(Jh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YE)))}var gu=null;function D0(s){gu!==s&&(gu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gu===s&&(gu=null);for(var a=0;a<s.length;a+=3){var c=s[a],f=s[a+1],y=s[a+2];if(typeof f!="function"){if(Xh(f||c)===null)continue;break}var x=Wa(c);x!==null&&(s.splice(a,3),a-=3,Wf(x,{pending:!0,data:y,method:c.method,action:f},f,y))}}))}function Ai(s){function a(U){return pu(U,s)}Ir!==null&&pu(Ir,s),Ur!==null&&pu(Ur,s),Br!==null&&pu(Br,s),al.forEach(a),il.forEach(a);for(var c=0;c<Vr.length;c++){var f=Vr[c];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Vr.length&&(c=Vr[0],c.blockedOn===null);)A0(c),c.blockedOn===null&&Vr.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var y=c[f],x=c[f+1],k=y[vn]||null;if(typeof x=="function")k||D0(c);else if(k){var E=null;if(x&&x.hasAttribute("formAction")){if(y=x,k=x[vn]||null)E=k.formAction;else if(Xh(y)!==null)continue}else E=k.action;typeof E=="function"?c[f+1]=E:(c.splice(f,3),f-=3),D0(c)}}}function O0(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(k){return y=k})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function Qh(s){this._internalRoot=s}yu.prototype.render=Qh.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,f=In();k0(c,f,s,a,null,null)},yu.prototype.unmount=Qh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;k0(s.current,2,null,s,null,null),Jc(),a[Ka]=null}};function yu(s){this._internalRoot=s}yu.prototype.unstable_scheduleHydration=function(s){if(s){var a=$y();s={blockedOn:null,target:s,priority:a};for(var c=0;c<Vr.length&&a!==0&&a<Vr[c].priority;c++);Vr.splice(c,0,s),c===0&&A0(s)}};var M0=t.version;if(M0!=="19.2.3")throw Error(r(527,M0,"19.2.3"));V.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(a),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var WE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xu.isDisabled&&xu.supportsFiber)try{Qt=xu.inject(WE),Rt=xu}catch{}}return cl.createRoot=function(s,a){if(!i(s))throw Error(r(299));var c=!1,f="",y=Vv,x=Fv,k=$v;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=S0(s,1,!1,null,null,c,f,null,y,x,k,O0),s[Ka]=a.current,Oh(s),new Qh(a)},cl.hydrateRoot=function(s,a,c){if(!i(s))throw Error(r(299));var f=!1,y="",x=Vv,k=Fv,E=$v,U=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(k=c.onCaughtError),c.onRecoverableError!==void 0&&(E=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),a=S0(s,1,!0,a,c??null,f,y,U,x,k,E,O0),a.context=j0(null),c=a.current,f=In(),f=Vd(f),y=Nr(f),y.callback=null,Tr(c,y,f),c=f,a.current.lanes=c,xo(a,c),Es(a),s[Ka]=a.current,Oh(s),new yu(a)},cl.version="19.2.3",cl}var q0;function aC(){if(q0)return tm.exports;q0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),tm.exports=rC(),tm.exports}var iC=aC();const oC=Yl(iC);const lC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),H0=e=>{const t=cC(e);return t.charAt(0).toUpperCase()+t.slice(1)},nj=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),uC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var dC={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 fC=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:u,...d},h)=>w.createElement("svg",{ref:h,...dC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:nj("lucide",i),...!l&&!uC(d)&&{"aria-hidden":"true"},...d},[...u.map(([m,p])=>w.createElement(m,p)),...Array.isArray(l)?l:[l]]));const ce=(e,t)=>{const n=w.forwardRef(({className:r,...i},l)=>w.createElement(fC,{ref:l,iconNode:t,className:nj(`lucide-${lC(H0(e))}`,`lucide-${e}`,r),...i}));return n.displayName=H0(e),n};const hC=[["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"}]],mC=ce("activity",hC);const pC=[["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"}]],sj=ce("archive",pC);const gC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],yC=ce("arrow-down",gC);const xC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],gg=ce("arrow-left",xC);const vC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],bC=ce("arrow-right",vC);const wC=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],SC=ce("arrow-up",wC);const jC=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],kC=ce("bold",jC);const _C=[["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"}]],NC=ce("boxes",_C);const TC=[["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"}]],Zr=ce("brain",TC);const EC=[["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"}]],rj=ce("briefcase",EC);const CC=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],AC=ce("building-2",CC);const RC=[["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"}]],yd=ce("calendar",RC);const DC=[["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"}]],OC=ce("camera",DC);const MC=[["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"}]],yg=ce("chart-column",MC);const PC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ir=ce("check",PC);const zC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Wl=ce("chevron-down",zC);const LC=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],IC=ce("chevron-left",LC);const UC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],so=ce("chevron-right",UC);const BC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aj=ce("chevron-up",BC);const VC=[["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"}]],qn=ce("circle-alert",VC);const FC=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Qu=ce("circle-check-big",FC);const $C=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xg=ce("circle-check",$C);const qC=[["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"}]],HC=ce("circle-user",qC);const GC=[["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"}]],KC=ce("circle-x",GC);const YC=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ls=ce("clock",YC);const WC=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Os=ce("code",WC);const XC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],JC=ce("columns-2",XC);const QC=[["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"}]],xd=ce("cpu",QC);const ZC=[["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"}]],Wr=ce("database",ZC);const eA=[["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"}]],Cl=ce("external-link",eA);const tA=[["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"}]],nA=ce("eye-off",tA);const sA=[["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"}]],vd=ce("eye",sA);const rA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],aA=ce("file-text",rA);const iA=[["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"}]],oA=ce("flag",iA);const lA=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],cA=ce("funnel",lA);const uA=[["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"}]],ij=ce("globe",uA);const dA=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],fA=ce("graduation-cap",dA);const hA=[["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"}]],mA=ce("hash",hA);const pA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],gA=ce("heading-1",pA);const yA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],xA=ce("heading-2",yA);const vA=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],bA=ce("heading-3",vA);const wA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],SA=ce("image",wA);const jA=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],kA=ce("inbox",jA);const _A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ro=ce("info",_A);const NA=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],TA=ce("italic",NA);const EA=[["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"}]],G0=ce("key-round",EA);const CA=[["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"}]],vg=ce("key",CA);const AA=[["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"}]],RA=ce("layout-dashboard",AA);const DA=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],bg=ce("lightbulb",DA);const OA=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],MA=ce("link",OA);const PA=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],zA=ce("list-ordered",PA);const LA=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],IA=ce("list",LA);const UA=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jt=ce("loader-circle",UA);const BA=[["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"}]],VA=ce("log-in",BA);const FA=[["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"}]],$A=ce("log-out",FA);const qA=[["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"}]],is=ce("mail",qA);const HA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],oj=ce("maximize-2",HA);const GA=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],bd=ce("message-square",GA);const KA=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],YA=ce("mic-off",KA);const WA=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],K0=ce("mic",WA);const XA=[["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"}]],wg=ce("minimize-2",XA);const JA=[["path",{d:"M5 12h14",key:"1ays0h"}]],QA=ce("minus",JA);const ZA=[["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"}]],eR=ce("moon",ZA);const tR=[["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"}]],ap=ce("paperclip",tR);const nR=[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],sR=ce("pen-line",nR);const rR=[["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"}]],lj=ce("pen",rR);const aR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],cr=ce("plus",aR);const iR=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ip=ce("power",iR);const oR=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],lR=ce("quote",oR);const cR=[["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=ce("refresh-cw",cR);const uR=[["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"}]],dR=ce("rocket",uR);const fR=[["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"}]],cj=ce("rotate-ccw",fR);const hR=[["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"}]],mR=ce("save",hR);const pR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gR=ce("search",pR);const yR=[["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"}]],Xl=ce("send",yR);const xR=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],vR=ce("server",xR);const bR=[["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"}]],Al=ce("settings",bR);const wR=[["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"}]],SR=ce("settings-2",wR);const jR=[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],kR=ce("shield-alert",jR);const _R=[["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"}]],Sg=ce("shield-check",_R);const NR=[["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"}]],jg=ce("shield",NR);const TR=[["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"}]],qu=ce("sparkles",TR);const ER=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],CR=ce("square",ER);const AR=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],op=ce("star",AR);const RR=[["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"}]],DR=ce("sun",RR);const OR=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],MR=ce("table",OR);const PR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],uj=ce("target",PR);const zR=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Rl=ce("terminal",zR);const LR=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],IR=ce("test-tube",LR);const UR=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],dj=ce("thumbs-up",UR);const BR=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],VR=ce("timer",BR);const FR=[["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"}]],wd=ce("trash-2",FR);const $R=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],qR=ce("trending-up",$R);const HR=[["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"}]],ea=ce("triangle-alert",HR);const GR=[["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"}]],KR=ce("upload",GR);const YR=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]],WR=ce("user-check",YR);const XR=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],JR=ce("user-cog",XR);const QR=[["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"}]],ZR=ce("user-plus",QR);const eD=[["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"}]],Sd=ce("user",eD);const tD=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],nD=ce("users",tD);const sD=[["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"}]],Dl=ce("volume-2",sD);const rD=[["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"}]],kg=ce("volume-x",rD);const aD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fn=ce("x",aD);const iD=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ao=ce("zap",iD),oD={theme:"system",setTheme:()=>null},fj=w.createContext(oD);function lD({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme"}){const[r,i]=w.useState(()=>localStorage.getItem(n)||t);w.useEffect(()=>{const u=window.document.documentElement;if(u.classList.remove("light","dark"),r==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";u.classList.add(d);return}u.classList.add(r)},[r]);const l={theme:r,setTheme:u=>{localStorage.setItem(n,u),i(u)}};return o.jsx(fj.Provider,{value:l,children:e})}const cD=()=>{const e=w.useContext(fj);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function Y0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jd(...e){return t=>{let n=!1;const r=e.map(i=>{const l=Y0(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<r.length;i++){const l=r[i];typeof l=="function"?l():Y0(e[i],null)}}}}function Va(...e){return w.useCallback(jd(...e),e)}var uD=Symbol.for("react.lazy"),Zu=pg[" use ".trim().toString()];function dD(e){return typeof e=="object"&&e!==null&&"then"in e}function hj(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===uD&&"_payload"in e&&dD(e._payload)}function mj(e){const t=hD(e),n=w.forwardRef((r,i)=>{let{children:l,...u}=r;hj(l)&&typeof Zu=="function"&&(l=Zu(l._payload));const d=w.Children.toArray(l),h=d.find(pD);if(h){const m=h.props.children,p=d.map(g=>g===h?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:g);return o.jsx(t,{...u,ref:i,children:w.isValidElement(m)?w.cloneElement(m,void 0,p):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}var fD=mj("Slot");function hD(e){const t=w.forwardRef((n,r)=>{let{children:i,...l}=n;if(hj(i)&&typeof Zu=="function"&&(i=Zu(i._payload)),w.isValidElement(i)){const u=yD(i),d=gD(l,i.props);return i.type!==w.Fragment&&(d.ref=r?jd(r,u):u),w.cloneElement(i,d)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mD=Symbol("radix.slottable");function pD(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mD}function gD(e,t){const n={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?n[r]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...l}:r==="className"&&(n[r]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function yD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=pj(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function gj(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=pj(e))&&(r&&(r+=" "),r+=t);return r}const W0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,X0=gj,_g=(e,t)=>n=>{var r;if(t?.variants==null)return X0(e,n?.class,n?.className);const{variants:i,defaultVariants:l}=t,u=Object.keys(i).map(m=>{const p=n?.[m],g=l?.[m];if(p===null)return null;const v=W0(p)||W0(g);return i[m][v]}),d=n&&Object.entries(n).reduce((m,p)=>{let[g,v]=p;return v===void 0||(m[g]=v),m},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((m,p)=>{let{class:g,className:v,...b}=p;return Object.entries(b).every(j=>{let[_,S]=j;return Array.isArray(S)?S.includes({...l,...d}[_]):{...l,...d}[_]===S})?[...m,g,v]:m},[]);return X0(e,u,h,n?.class,n?.className)},xD=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},vD=(e,t)=>({classGroupId:e,validator:t}),yj=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ed="-",J0=[],bD="arbitrary..",wD=e=>{const t=jD(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return SD(u);const d=u.split(ed),h=d[0]===""&&d.length>1?1:0;return xj(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=r[u],m=n[u];return h?m?xD(m,h):h:m||J0}return n[u]||J0}}},xj=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],l=n.nextPart.get(i);if(l){const m=xj(e,t+1,l);if(m)return m}const u=n.validators;if(u===null)return;const d=t===0?e.join(ed):e.slice(t).join(ed),h=u.length;for(let m=0;m<h;m++){const p=u[m];if(p.validator(d))return p.classGroupId}},SD=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?bD+r:void 0})(),jD=e=>{const{theme:t,classGroups:n}=e;return kD(n,t)},kD=(e,t)=>{const n=yj();for(const r in e){const i=e[r];Ng(i,n,r,t)}return n},Ng=(e,t,n,r)=>{const i=e.length;for(let l=0;l<i;l++){const u=e[l];_D(u,t,n,r)}},_D=(e,t,n,r)=>{if(typeof e=="string"){ND(e,t,n);return}if(typeof e=="function"){TD(e,t,n,r);return}ED(e,t,n,r)},ND=(e,t,n)=>{const r=e===""?t:vj(t,e);r.classGroupId=n},TD=(e,t,n,r)=>{if(CD(e)){Ng(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(vD(n,e))},ED=(e,t,n,r)=>{const i=Object.entries(e),l=i.length;for(let u=0;u<l;u++){const[d,h]=i[u];Ng(h,vj(t,d),n,r)}},vj=(e,t)=>{let n=e;const r=t.split(ed),i=r.length;for(let l=0;l<i;l++){const u=r[l];let d=n.nextPart.get(u);d||(d=yj(),n.nextPart.set(u,d)),n=d}return n},CD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(l,u)=>{n[l]=u,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(l){let u=n[l];if(u!==void 0)return u;if((u=r[l])!==void 0)return i(l,u),u},set(l,u){l in n?n[l]=u:i(l,u)}}},lp="!",Q0=":",RD=[],Z0=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),DD=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const l=[];let u=0,d=0,h=0,m;const p=i.length;for(let _=0;_<p;_++){const S=i[_];if(u===0&&d===0){if(S===Q0){l.push(i.slice(h,_)),h=_+1;continue}if(S==="/"){m=_;continue}}S==="["?u++:S==="]"?u--:S==="("?d++:S===")"&&d--}const g=l.length===0?i:i.slice(h);let v=g,b=!1;g.endsWith(lp)?(v=g.slice(0,-1),b=!0):g.startsWith(lp)&&(v=g.slice(1),b=!0);const j=m&&m>h?m-h:void 0;return Z0(l,b,v,j)};if(t){const i=t+Q0,l=r;r=u=>u.startsWith(i)?l(u.slice(i.length)):Z0(RD,!1,u,void 0,!0)}if(n){const i=r;r=l=>n({className:l,parseClassName:i})}return r},OD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let l=0;l<n.length;l++){const u=n[l],d=u[0]==="[",h=t.has(u);d||h?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(u)):i.push(u)}return i.length>0&&(i.sort(),r.push(...i)),r}},MD=e=>({cache:AD(e.cacheSize),parseClassName:DD(e),sortModifiers:OD(e),...wD(e)}),PD=/\s+/,zD=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:l}=t,u=[],d=e.trim().split(PD);let h="";for(let m=d.length-1;m>=0;m-=1){const p=d[m],{isExternal:g,modifiers:v,hasImportantModifier:b,baseClassName:j,maybePostfixModifierPosition:_}=n(p);if(g){h=p+(h.length>0?" "+h:h);continue}let S=!!_,N=r(S?j.substring(0,_):j);if(!N){if(!S){h=p+(h.length>0?" "+h:h);continue}if(N=r(j),!N){h=p+(h.length>0?" "+h:h);continue}S=!1}const C=v.length===0?"":v.length===1?v[0]:l(v).join(":"),T=b?C+lp:C,D=T+N;if(u.indexOf(D)>-1)continue;u.push(D);const L=i(N,S);for(let O=0;O<L.length;++O){const B=L[O];u.push(T+B)}h=p+(h.length>0?" "+h:h)}return h},LD=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=bj(n))&&(i&&(i+=" "),i+=r);return i},bj=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=bj(e[r]))&&(n&&(n+=" "),n+=t);return n},ID=(e,...t)=>{let n,r,i,l;const u=h=>{const m=t.reduce((p,g)=>g(p),e());return n=MD(m),r=n.cache.get,i=n.cache.set,l=d,d(h)},d=h=>{const m=r(h);if(m)return m;const p=zD(h,n);return i(h,p),p};return l=u,(...h)=>l(LD(...h))},UD=[],Ht=e=>{const t=n=>n[e]||UD;return t.isThemeGetter=!0,t},wj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Sj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,BD=/^\d+\/\d+$/,VD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FD=/\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$/,$D=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ri=e=>BD.test(e),$e=e=>!!e&&!Number.isNaN(Number(e)),$r=e=>!!e&&Number.isInteger(Number(e)),am=e=>e.endsWith("%")&&$e(e.slice(0,-1)),rr=e=>VD.test(e),GD=()=>!0,KD=e=>FD.test(e)&&!$D.test(e),jj=()=>!1,YD=e=>qD.test(e),WD=e=>HD.test(e),XD=e=>!be(e)&&!we(e),JD=e=>lo(e,Nj,jj),be=e=>wj.test(e),ja=e=>lo(e,Tj,KD),im=e=>lo(e,n4,$e),ew=e=>lo(e,kj,jj),QD=e=>lo(e,_j,WD),vu=e=>lo(e,Ej,YD),we=e=>Sj.test(e),ul=e=>co(e,Tj),ZD=e=>co(e,s4),tw=e=>co(e,kj),e4=e=>co(e,Nj),t4=e=>co(e,_j),bu=e=>co(e,Ej,!0),lo=(e,t,n)=>{const r=wj.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},co=(e,t,n=!1)=>{const r=Sj.exec(e);return r?r[1]?t(r[1]):n:!1},kj=e=>e==="position"||e==="percentage",_j=e=>e==="image"||e==="url",Nj=e=>e==="length"||e==="size"||e==="bg-size",Tj=e=>e==="length",n4=e=>e==="number",s4=e=>e==="family-name",Ej=e=>e==="shadow",r4=()=>{const e=Ht("color"),t=Ht("font"),n=Ht("text"),r=Ht("font-weight"),i=Ht("tracking"),l=Ht("leading"),u=Ht("breakpoint"),d=Ht("container"),h=Ht("spacing"),m=Ht("radius"),p=Ht("shadow"),g=Ht("inset-shadow"),v=Ht("text-shadow"),b=Ht("drop-shadow"),j=Ht("blur"),_=Ht("perspective"),S=Ht("aspect"),N=Ht("ease"),C=Ht("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...D(),we,be],O=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],M=()=>[we,be,h],q=()=>[Ri,"full","auto",...M()],R=()=>[$r,"none","subgrid",we,be],J=()=>["auto",{span:["full",$r,we,be]},$r,we,be],K=()=>[$r,"auto",we,be],he=()=>["auto","min","max","fr",we,be],se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...M()],V=()=>[Ri,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],G=()=>[e,we,be],fe=()=>[...D(),tw,ew,{position:[we,be]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",e4,JD,{size:[we,be]}],z=()=>[am,ul,ja],A=()=>["","none","full",m,we,be],ee=()=>["",$e,ul,ja],ge=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[$e,am,tw,ew],ke=()=>["","none",j,we,be],Ne=()=>["none",$e,we,be],Ie=()=>["none",$e,we,be],rt=()=>[$e,we,be],Pt=()=>[Ri,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rr],breakpoint:[rr],color:[GD],container:[rr],"drop-shadow":[rr],ease:["in","out","in-out"],font:[XD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rr],shadow:[rr],spacing:["px",$e],text:[rr],"text-shadow":[rr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ri,be,we,S]}],container:["container"],columns:[{columns:[$e,be,we,d]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:L()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[$r,"auto",we,be]}],basis:[{basis:[Ri,"full","auto",d,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$e,Ri,"auto","initial","none",be]}],grow:[{grow:["",$e,we,be]}],shrink:[{shrink:["",$e,we,be]}],order:[{order:[$r,"first","last","none",we,be]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":he()}],"auto-rows":[{"auto-rows":he()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...se(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...se()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":se()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],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:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[d,"screen",...V()]}],"min-w":[{"min-w":[d,"screen","none",...V()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,ul,ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,we,im]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",am,be]}],"font-family":[{font:[ZD,be,t]}],"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:[i,we,be]}],"line-clamp":[{"line-clamp":[$e,"none",we,im]}],leading:[{leading:[l,...M()]}],"list-image":[{"list-image":["none",we,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[$e,"from-font","auto",we,ja]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[$e,"auto",we,be]}],"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",we,be]}],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",we,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:fe()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$r,we,be],radial:["",we,be],conic:[$r,we,be]},t4,QD]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$e,we,be]}],"outline-w":[{outline:["",$e,ul,ja]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",p,bu,vu]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",g,bu,vu]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[$e,ja]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",v,bu,vu]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[$e,we,be]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$e]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[we,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[$e]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:fe()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,be]}],filter:[{filter:["","none",we,be]}],blur:[{blur:ke()}],brightness:[{brightness:[$e,we,be]}],contrast:[{contrast:[$e,we,be]}],"drop-shadow":[{"drop-shadow":["","none",b,bu,vu]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",$e,we,be]}],"hue-rotate":[{"hue-rotate":[$e,we,be]}],invert:[{invert:["",$e,we,be]}],saturate:[{saturate:[$e,we,be]}],sepia:[{sepia:["",$e,we,be]}],"backdrop-filter":[{"backdrop-filter":["","none",we,be]}],"backdrop-blur":[{"backdrop-blur":ke()}],"backdrop-brightness":[{"backdrop-brightness":[$e,we,be]}],"backdrop-contrast":[{"backdrop-contrast":[$e,we,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$e,we,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$e,we,be]}],"backdrop-invert":[{"backdrop-invert":["",$e,we,be]}],"backdrop-opacity":[{"backdrop-opacity":[$e,we,be]}],"backdrop-saturate":[{"backdrop-saturate":[$e,we,be]}],"backdrop-sepia":[{"backdrop-sepia":["",$e,we,be]}],"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",we,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$e,"initial",we,be]}],ease:[{ease:["linear","initial",N,we,be]}],delay:[{delay:[$e,we,be]}],animate:[{animate:["none",C,we,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,we,be]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[we,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pt()}],"translate-x":[{"translate-x":Pt()}],"translate-y":[{"translate-y":Pt()}],"translate-z":[{"translate-z":Pt()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",we,be]}],"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",we,be]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[$e,ul,ja,im]}],stroke:[{stroke:["none",...G()]}],"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"]}},a4=ID(r4);function pe(...e){return a4(gj(e))}const i4=_g("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Z=w.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},l)=>{const u=r?fD:"button";return o.jsx(u,{className:pe(i4({variant:t,size:n,className:e})),ref:l,...i})});Z.displayName="Button";function Cj(){const{setTheme:e,theme:t}=cD();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>e(t==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${t==="dark"?"light":"dark"} mode`,children:[t==="dark"?o.jsx(DR,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(eR,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Ds=function(){return Ds=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ds.apply(this,arguments)};function uo(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function o4(e,t,n,r){function i(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(p){try{m(r.next(p))}catch(g){u(g)}}function h(p){try{m(r.throw(p))}catch(g){u(g)}}function m(p){p.done?l(p.value):i(p.value).then(d,h)}m((r=r.apply(e,t||[])).next())})}function l4(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,l;r<i;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}const c4=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Tg extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class u4 extends Tg{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class nw extends Tg{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class sw extends Tg{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var cp;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(cp||(cp={}));class d4{constructor(t,{headers:n={},customFetch:r,region:i=cp.Any}={}){this.url=t,this.headers=n,this.region=i,this.fetch=c4(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return o4(this,arguments,void 0,function*(n,r={}){var i;let l,u;try{const{headers:d,method:h,body:m,signal:p,timeout:g}=r;let v={},{region:b}=r;b||(b=this.region);const j=new URL(`${this.url}/${n}`);b&&b!=="any"&&(v["x-region"]=b,j.searchParams.set("forceFunctionRegion",b));let _;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(v["Content-Type"]="application/octet-stream",_=m):typeof m=="string"?(v["Content-Type"]="text/plain",_=m):typeof FormData<"u"&&m instanceof FormData?_=m:(v["Content-Type"]="application/json",_=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?_=JSON.stringify(m):_=m;let S=p;g&&(u=new AbortController,l=setTimeout(()=>u.abort(),g),p?(S=u.signal,p.addEventListener("abort",()=>u.abort())):S=u.signal);const N=yield this.fetch(j.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},v),this.headers),d),body:_,signal:S}).catch(L=>{throw new u4(L)}),C=N.headers.get("x-relay-error");if(C&&C==="true")throw new nw(N);if(!N.ok)throw new sw(N);let T=((i=N.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),D;return T==="application/json"?D=yield N.json():T==="application/octet-stream"||T==="application/pdf"?D=yield N.blob():T==="text/event-stream"?D=N:T==="multipart/form-data"?D=yield N.formData():D=yield N.text(),{data:D,error:null,response:N}}catch(d){return{data:null,error:d,response:d instanceof sw||d instanceof nw?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var f4=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},h4=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=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 i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,d=null,h=null,m=l.status,p=l.statusText;if(l.ok){var g,v;if(n.method!=="HEAD"){var b;const N=await l.text();N===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((b=n.headers.get("Accept"))===null||b===void 0)&&b.includes("application/vnd.pgrst.plan+text"))?d=N:d=JSON.parse(N))}const _=(g=n.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),S=(v=l.headers.get("content-range"))===null||v===void 0?void 0:v.split("/");_&&S&&S.length>1&&(h=parseInt(S[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,m=406,p="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{var j;const _=await l.text();try{u=JSON.parse(_),Array.isArray(u)&&l.status===404&&(d=[],u=null,m=200,p="OK")}catch{l.status===404&&_===""?(m=204,p="No Content"):u={message:_}}if(u&&n.isMaybeSingle&&(!(u==null||(j=u.details)===null||j===void 0)&&j.includes("0 rows"))&&(u=null,m=200,p="OK"),u&&n.shouldThrowOnError)throw new f4(u)}return{error:u,data:d,count:h,status:m,statusText:p}});return this.shouldThrowOnError||(i=i.catch(l=>{var u;let d="";const h=l?.cause;if(h){var m,p,g,v;const j=(m=h?.message)!==null&&m!==void 0?m:"",_=(p=h?.code)!==null&&p!==void 0?p:"";d=`${(g=l?.name)!==null&&g!==void 0?g:"FetchError"}: ${l?.message}`,d+=`
10
+
11
+ Caused by: ${(v=h?.name)!==null&&v!==void 0?v:"Error"}: ${j}`,_&&(d+=` (${_})`),h?.stack&&(d+=`
12
+ ${h.stack}`)}else{var b;d=(b=l?.stack)!==null&&b!==void 0?b:""}return{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}returns(){return this}overrideTypes(){return this}},m4=class extends h4{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){const l=i?`${i}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(l,`${t-e+1}`),this}abortSignal(e){return this.signal=e,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:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:l="text"}={}){var u;const d=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${h}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const rw=new RegExp("[,()]");var $i=class extends m4{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&rw.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&rw.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${l}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},p4=class{constructor(e,{headers:t={},schema:n,fetch:r}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},i=n?"HEAD":"GET";let l=!1;const u=(e??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),r&&h.append("Prefer",`count=${r}`),new $i({method:i,url:d,headers:h,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const i="POST",{url:l,headers:u}=this.cloneRequestState();if(t&&u.append("Prefer",`count=${t}`),n||u.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((h,m)=>h.concat(Object.keys(m)),[]);if(d.length>0){const h=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",h.join(","))}}return new $i({method:i,url:l,headers:u,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&d.searchParams.set("on_conflict",t),r&&h.append("Prefer",`count=${r}`),i||h.append("Prefer","missing=default"),Array.isArray(e)){const m=e.reduce((p,g)=>p.concat(Object.keys(g)),[]);if(m.length>0){const p=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",p.join(","))}}return new $i({method:u,url:d,headers:h,schema:this.schema,body:e,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}update(e,{count:t}={}){var n;const r="PATCH",{url:i,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new $i({method:r,url:i,headers:l,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new $i({method:n,url:r,headers:i,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}},g4=class Aj{constructor(t,{headers:n={},schema:r,fetch:i}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.fetch=i}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new p4(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new Aj(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,get:i=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${t}`);let m;const p=b=>b!==null&&typeof b=="object"&&(!Array.isArray(b)||b.some(p)),g=r&&Object.values(n).some(p);g?(d="POST",m=n):r||i?(d=r?"HEAD":"GET",Object.entries(n).filter(([b,j])=>j!==void 0).map(([b,j])=>[b,Array.isArray(j)?`{${j.join(",")}}`:`${j}`]).forEach(([b,j])=>{h.searchParams.append(b,j)})):(d="POST",m=n);const v=new Headers(this.headers);return g?v.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&v.set("Prefer",`count=${l}`),new $i({method:d,url:h,headers:v,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};class y4{constructor(){}static detectEnvironment(){var t;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"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const i=r.node,l=parseInt(i.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} 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 t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
15
+
16
+ Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const r=this.getWebSocketConstructor();return new r(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const x4="2.90.1",v4=`realtime-js/${x4}`,Rj="1.0.0",b4="2.0.0",aw=Rj,up=1e4,w4=1e3,S4=100;var Kr;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Kr||(Kr={}));var Gt;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Gt||(Gt={}));var ys;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(ys||(ys={}));var dp;(function(e){e.websocket="websocket"})(dp||(dp={}));var Ra;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Ra||(Ra={}));class j4{constructor(t){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=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const i=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(t){var n,r;const i=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},u=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(t,n,r){var i,l;const u=t.topic,d=(i=t.ref)!==null&&i!==void 0?i:"",h=(l=t.join_ref)!==null&&l!==void 0?l:"",m=t.payload.event,p=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},g=Object.keys(p).length===0?"":JSON.stringify(p);if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const v=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+g.length,b=new ArrayBuffer(this.HEADER_LENGTH+v);let j=new DataView(b),_=0;j.setUint8(_++,this.KINDS.userBroadcastPush),j.setUint8(_++,h.length),j.setUint8(_++,d.length),j.setUint8(_++,u.length),j.setUint8(_++,m.length),j.setUint8(_++,g.length),j.setUint8(_++,n),Array.from(h,N=>j.setUint8(_++,N.charCodeAt(0))),Array.from(d,N=>j.setUint8(_++,N.charCodeAt(0))),Array.from(u,N=>j.setUint8(_++,N.charCodeAt(0))),Array.from(m,N=>j.setUint8(_++,N.charCodeAt(0))),Array.from(g,N=>j.setUint8(_++,N.charCodeAt(0)));var S=new Uint8Array(b.byteLength+r.byteLength);return S.set(new Uint8Array(b),0),S.set(new Uint8Array(r),b.byteLength),S.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[i,l,u,d,h]=r;return n({join_ref:i,ref:l,topic:u,event:d,payload:h})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),i=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,i)}_decodeUserBroadcast(t,n,r){const i=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),d=n.getUint8(4);let h=this.HEADER_LENGTH+4;const m=r.decode(t.slice(h,h+i));h=h+i;const p=r.decode(t.slice(h,h+l));h=h+l;const g=r.decode(t.slice(h,h+u));h=h+u;const v=t.slice(h,t.byteLength),b=d===this.JSON_ENCODING?JSON.parse(r.decode(v)):v,j={type:this.BROADCAST_EVENT,event:p,payload:b};return u>0&&(j.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:j}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}class Dj{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}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 ht;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(ht||(ht={}));const iw=(e,t,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((l,u)=>(l[u]=k4(u,e,t,i),l),{}):{}},k4=(e,t,n,r)=>{const i=t.find(d=>d.name===e),l=i?.type,u=n[e];return l&&!r.includes(l)?Oj(l,u):fp(u)},Oj=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return E4(t,n)}switch(e){case ht.bool:return _4(t);case ht.float4:case ht.float8:case ht.int2:case ht.int4:case ht.int8:case ht.numeric:case ht.oid:return N4(t);case ht.json:case ht.jsonb:return T4(t);case ht.timestamp:return C4(t);case ht.abstime:case ht.date:case ht.daterange:case ht.int4range:case ht.int8range:case ht.money:case ht.reltime:case ht.text:case ht.time:case ht.timestamptz:case ht.timetz:case ht.tsrange:case ht.tstzrange:return fp(t);default:return fp(t)}},fp=e=>e,_4=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},N4=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},T4=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},E4=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let l;const u=e.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>Oj(t,d))}return e},C4=e=>typeof e=="string"?e.replace(" ","T"):e,Mj=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class om{constructor(t,n,r={},i=up){this.channel=t,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,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(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var ow;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(ow||(ow={}));class vl{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=vl.syncState(this.state,i,l,u),this.pendingDiffs.forEach(h=>{this.state=vl.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel._on(r.diff,{},i=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=vl.syncDiff(this.state,i,l,u),d())}),this.onJoin((i,l,u)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:l,newPresences:u})}),this.onLeave((i,l,u)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,i){const l=this.cloneDeep(t),u=this.transformState(n),d={},h={};return this.map(l,(m,p)=>{u[m]||(h[m]=p)}),this.map(u,(m,p)=>{const g=l[m];if(g){const v=p.map(S=>S.presence_ref),b=g.map(S=>S.presence_ref),j=p.filter(S=>b.indexOf(S.presence_ref)<0),_=g.filter(S=>v.indexOf(S.presence_ref)<0);j.length>0&&(d[m]=j),_.length>0&&(h[m]=_)}else d[m]=p}),this.syncDiff(l,{joins:d,leaves:h},r,i)}static syncDiff(t,n,r,i){const{joins:l,leaves:u}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(l,(d,h)=>{var m;const p=(m=t[d])!==null&&m!==void 0?m:[];if(t[d]=this.cloneDeep(h),p.length>0){const g=t[d].map(b=>b.presence_ref),v=p.filter(b=>g.indexOf(b.presence_ref)<0);t[d].unshift(...v)}r(d,p,h)}),this.map(u,(d,h)=>{let m=t[d];if(!m)return;const p=h.map(g=>g.presence_ref);m=m.filter(g=>p.indexOf(g.presence_ref)<0),t[d]=m,i(d,m,h),m.length===0&&delete t[d]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const i=t[r];return"metas"in i?n[r]=i.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):n[r]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var lw;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(lw||(lw={}));var bl;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(bl||(bl={}));var ar;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(ar||(ar={}));class Ki{constructor(t,n={config:{}},r){var i,l;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=Gt.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new om(this,ys.join,this.params,this.timeout),this.rejoinTimer=new Dj(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Gt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Gt.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Gt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Gt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Gt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ys.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new vl(this),this.broadcastEndpointURL=Mj(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,i,l;if(this.socket.isConnected()||this.socket.connect(),this.state==Gt.closed){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(b=>b.filter))!==null&&i!==void 0?i:[],p=!!this.bindings[bl.PRESENCE]&&this.bindings[bl.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},v={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:p}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(b=>t?.(ar.CHANNEL_ERROR,b)),this._onClose(()=>t?.(ar.CLOSED)),this.updateJoinPayload(Object.assign({config:v},g)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:b})=>{var j;if(this.socket._isManualToken()||this.socket.setAuth(),b===void 0){t?.(ar.SUBSCRIBED);return}else{const _=this.bindings.postgres_changes,S=(j=_?.length)!==null&&j!==void 0?j:0,N=[];for(let C=0;C<S;C++){const T=_[C],{filter:{event:D,schema:L,table:O,filter:B}}=T,M=b&&b[C];if(M&&M.event===D&&Ki.isFilterValueEqual(M.schema,L)&&Ki.isFilterValueEqual(M.table,O)&&Ki.isFilterValueEqual(M.filter,B))N.push(Object.assign(Object.assign({},T),{id:M.id}));else{this.unsubscribe(),this.state=Gt.errored,t?.(ar.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=N,t&&t(ar.SUBSCRIBED);return}}).receive("error",b=>{this.state=Gt.errored,t?.(ar.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(b).join(", ")||"error")))}).receive("timeout",()=>{t?.(ar.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this.state===Gt.joined&&t===bl.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(t,n,r)}async httpSend(t,n,r={}){var i;if(n==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(d.status===202)return{success:!0};let h=d.statusText;try{const m=await d.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(t,n={}){var r,i;if(!this._canPush()&&t.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:l,payload:u}=t,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=m.body)===null||i===void 0?void 0:i.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((h=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||h===void 0)&&h.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Gt.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ys.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new om(this,ys.leave,{},t),r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Gt.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const i=new AbortController,l=setTimeout(()=>i.abort(),r),u=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(l),u}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new om(this,t,n,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>S4){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var i,l;const u=t.toLocaleLowerCase(),{close:d,error:h,leave:m,join:p}=ys;if(r&&[d,h,m,p].indexOf(u)>=0&&r!==this._joinRef())return;let v=this._onMessage(u,n,r);if(n&&!v)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(b=>{var j,_,S;return((j=b.filter)===null||j===void 0?void 0:j.event)==="*"||((S=(_=b.filter)===null||_===void 0?void 0:_.event)===null||S===void 0?void 0:S.toLocaleLowerCase())===u}).map(b=>b.callback(v,r)):(l=this.bindings[u])===null||l===void 0||l.filter(b=>{var j,_,S,N,C,T,D,L;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in b){const O=b.id,B=(j=b.filter)===null||j===void 0?void 0:j.event;return O&&((_=n.ids)===null||_===void 0?void 0:_.includes(O))&&(B==="*"||B?.toLocaleLowerCase()===((S=n.data)===null||S===void 0?void 0:S.type.toLocaleLowerCase()))&&(!(!((N=b.filter)===null||N===void 0)&&N.table)||b.filter.table===((C=n.data)===null||C===void 0?void 0:C.table))}else{const O=(D=(T=b?.filter)===null||T===void 0?void 0:T.event)===null||D===void 0?void 0:D.toLocaleLowerCase();return O==="*"||O===((L=n?.event)===null||L===void 0?void 0:L.toLocaleLowerCase())}else return b.type.toLocaleLowerCase()===u}).map(b=>{if(typeof v=="object"&&"ids"in v){const j=v.data,{schema:_,table:S,commit_timestamp:N,type:C,errors:T}=j;v=Object.assign(Object.assign({},{schema:_,table:S,commit_timestamp:N,eventType:C,new:{},old:{},errors:T}),this._getPayloadRecords(j))}b.callback(v,r)})}_isClosed(){return this.state===Gt.closed}_isJoined(){return this.state===Gt.joined}_isJoining(){return this.state===Gt.joining}_isLeaving(){return this.state===Gt.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const i=t.toLocaleLowerCase(),l={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(l):this.bindings[i]=[l],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var l;return!(((l=i.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===r&&Ki.isEqual(i.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(ys.close,{},t)}_onError(t){this._on(ys.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Gt.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=iw(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=iw(t.columns,t.old_record)),n}}const lm=()=>{},wu={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},A4=[1e3,2e3,5e3,1e4],R4=1e4,D4=`
17
+ addEventListener("message", (e) => {
18
+ if (e.data.event === "start") {
19
+ setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
20
+ }
21
+ });`;class O4{constructor(t,n){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=up,this.transport=null,this.heartbeatIntervalMs=wu.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=lm,this.ref=0,this.reconnectTimer=null,this.vsn=aw,this.logger=lm,this.conn=null,this.sendBuffer=[],this.serializer=new j4,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=i=>i?(...l)=>i(...l):(...l)=>fetch(...l),!(!((r=n?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${dp.websocket}`,this.httpEndpoint=Mj(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.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=y4.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}
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: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,n){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"&&(t?this.conn.close(t,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Kr.connecting:return Ra.Connecting;case Kr.open:return Ra.Open;case Kr.closing:return Ra.Closing;default:return Ra.Closed}}isConnected(){return this.connectionState()===Ra.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,i=this.getChannels().find(l=>l.topic===r);if(i)return i;{const l=new Ki(`realtime:${t}`,n,this);return this.channels.push(l),l}}push(t){const{topic:n,event:r,payload:i,ref:l}=t,u=()=>{this.encode(t,d=>{var h;(h=this.conn)===null||h===void 0||h.send(d)})};this.log("push",`${n} ${r} (${l})`,i),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}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(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(w4,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},wu.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(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",m)}catch(p){this.log("error","error in heartbeat callback",p)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:i,payload:l,ref:u}=n,d=u?`(${u})`:"",h=l.status||"";this.log("receive",`${h} ${r} ${i} ${d}`.trim(),l),this.channels.filter(m=>m._isMember(r)).forEach(m=>m._trigger(i,l,u)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.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=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===Kr.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Kr.open||this.conn.readyState===Kr.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}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(t=>t.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(n=>{this.log("error","error waiting for auth on connect",n),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 t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.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(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(ys.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${r}${i}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([D4],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const l={access_token:n,version:v4};n&&i.updateJoinPayload(l),i.joinedOnce&&i._isJoined()&&i._push(ys.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Dj(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},wu.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,i,l,u,d,h,m,p,g,v,b;switch(this.transport=(n=t?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t?.timeout)!==null&&r!==void 0?r:up,this.heartbeatIntervalMs=(i=t?.heartbeatIntervalMs)!==null&&i!==void 0?i:wu.HEARTBEAT_INTERVAL,this.worker=(l=t?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=t?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=t?.heartbeatCallback)!==null&&d!==void 0?d:lm,this.vsn=(h=t?.vsn)!==null&&h!==void 0?h:aw,t?.params&&(this.params=t.params),t?.logger&&(this.logger=t.logger),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(m=t?.reconnectAfterMs)!==null&&m!==void 0?m:(j=>A4[j-1]||R4),this.vsn){case Rj:this.encode=(p=t?.encode)!==null&&p!==void 0?p:((j,_)=>_(JSON.stringify(j))),this.decode=(g=t?.decode)!==null&&g!==void 0?g:((j,_)=>_(JSON.parse(j)));break;case b4:this.encode=(v=t?.encode)!==null&&v!==void 0?v:this.serializer.encode.bind(this.serializer),this.decode=(b=t?.decode)!==null&&b!==void 0?b: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=t?.workerUrl}}}var Ol=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function M4(e,t,n){const r=new URL(t,e);if(n)for(const[i,l]of Object.entries(n))l!==void 0&&r.searchParams.set(i,l);return r.toString()}async function P4(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function z4(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:l,headers:u}){const d=M4(e.baseUrl,r,i),h=await P4(e.auth),m=await t(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),p=await m.text(),g=(m.headers.get("content-type")||"").includes("application/json"),v=g&&p?JSON.parse(p):p;if(!m.ok){const b=g?v:void 0,j=b?.error;throw new Ol(j?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:j?.type,icebergCode:j?.code,details:b})}return{status:m.status,headers:m.headers,data:v}}}}function Su(e){return e.join("")}var L4=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Su(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Su(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Su(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Su(e.namespace)}`}),!0}catch(t){if(t instanceof Ol&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Ol&&n.status===409)return;throw n}}};function Di(e){return e.join("")}var I4=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Di(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Ol&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Ol&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},U4=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=z4({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new L4(this.client,t),this.tableOps=new I4(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},kd=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function St(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var B4=class extends kd{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},hp=class extends kd{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const Eg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),V4=()=>Response,mp=e=>{if(Array.isArray(e))return e.map(n=>mp(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[i]=mp(r)}),t},F4=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},$4=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function Ml(e){"@babel/helpers - typeof";return Ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ml(e)}function q4(e,t){if(Ml(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ml(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H4(e){var t=q4(e,"string");return Ml(t)=="symbol"?t:t+""}function G4(e,t,n){return(t=H4(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cw(Object(n),!0).forEach(function(r){G4(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const cm=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},K4=async(e,t,n)=>{e instanceof await V4()&&!n?.noResolveJson?e.json().then(r=>{const i=e.status||500,l=r?.statusCode||i+"";t(new B4(cm(r),i,l))}).catch(r=>{t(new hp(cm(r),r))}):t(new hp(cm(e),e))},Y4=(e,t,n,r)=>{const i={method:e,headers:t?.headers||{}};return e==="GET"||!r?i:(F4(r)?(i.headers=Pe({"Content-Type":"application/json"},t?.headers),i.body=JSON.stringify(r)):i.body=r,t?.duplex&&(i.duplex=t.duplex),Pe(Pe({},i),n))};async function Jl(e,t,n,r,i,l){return new Promise((u,d)=>{e(n,Y4(t,r,i,l)).then(h=>{if(!h.ok)throw h;return r?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>K4(h,d,r))})}async function Pl(e,t,n,r){return Jl(e,"GET",t,n,r)}async function gs(e,t,n,r,i){return Jl(e,"POST",t,r,i,n)}async function pp(e,t,n,r,i){return Jl(e,"PUT",t,r,i,n)}async function W4(e,t,n,r){return Jl(e,"HEAD",t,Pe(Pe({},n),{},{noResolveJson:!0}),r)}async function Cg(e,t,n,r,i){return Jl(e,"DELETE",t,r,i,n)}var X4=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(St(t))return{data:null,error:t};throw t}}};let Pj;Pj=Symbol.toStringTag;var J4=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Pj]="BlobDownloadBuilder",this.promise=null}asStream(){return new X4(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(St(t))return{data:null,error:t};throw t}}};const Q4={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},uw={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Z4=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=Eg(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,r){var i=this;try{let l;const u=Pe(Pe({},uw),r);let d=Pe(Pe({},i.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",i.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",i.encodeMetadata(h))):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=i.toBase64(i.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),r?.headers&&(d=Pe(Pe({},d),r.headers));const m=i._removeEmptyFolders(t),p=i._getFinalPath(m),g=await(e=="PUT"?pp:gs)(i.fetch,`${i.url}/object/${p}`,l,Pe({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:m,id:g.Id,fullPath:g.Key},error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(St(l))return{data:null,error:l};throw l}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var i=this;const l=i._removeEmptyFolders(e),u=i._getFinalPath(l),d=new URL(i.url+`/object/upload/sign/${u}`);d.searchParams.set("token",t);try{let h;const m=Pe({upsert:uw.upsert},r),p=Pe(Pe({},i.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",m.cacheControl)):(h=n,p["cache-control"]=`max-age=${m.cacheControl}`,p["content-type"]=m.contentType),{data:{path:l,fullPath:(await pp(i.fetch,d.toString(),h,{headers:p})).Key},error:null}}catch(h){if(i.shouldThrowOnError)throw h;if(St(h))return{data:null,error:h};throw h}}async createSignedUploadUrl(e,t){var n=this;try{let r=n._getFinalPath(e);const i=Pe({},n.headers);t?.upsert&&(i["x-upsert"]="true");const l=await gs(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),u=new URL(n.url+l.url),d=u.searchParams.get("token");if(!d)throw new kd("No token returned by API");return{data:{signedUrl:u.toString(),path:e,token:d},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;try{return{data:await gs(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers}),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async copy(e,t,n){var r=this;try{return{data:{path:(await gs(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key},error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async createSignedUrl(e,t,n){var r=this;try{let i=r._getFinalPath(e),l=await gs(r.fetch,`${r.url}/object/sign/${i}`,Pe({expiresIn:t},n?.transform?{transform:n.transform}:{}),{headers:r.headers});const u=n?.download?`&download=${n.download===!0?"":n.download}`:"";return l={signedUrl:encodeURI(`${r.url}${l.signedURL}${u}`)},{data:l,error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async createSignedUrls(e,t,n){var r=this;try{const i=await gs(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(u=>Pe(Pe({},u),{},{signedUrl:u.signedURL?encodeURI(`${r.url}${u.signedURL}${l}`):null})),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}download(e,t){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(t?.transform||{}),i=r?`?${r}`:"",l=this._getFinalPath(e),u=()=>Pl(this.fetch,`${this.url}/${n}/${l}${i}`,{headers:this.headers,noResolveJson:!0});return new J4(u,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:mp(await Pl(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await W4(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(St(r)&&r instanceof hp){const i=r.originalError;if([400,404].includes(i?.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],i=t?.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&r.push(i);const l=typeof t?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(t?.transform||{});u!==""&&r.push(u);let d=r.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${d}`)}}}async remove(e){var t=this;try{return{data:await Cg(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async list(e,t,n){var r=this;try{const i=Pe(Pe(Pe({},Q4),t),{},{prefix:e||""});return{data:await gs(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async listV2(e,t){var n=this;try{const r=Pe({},e);return{data:await gs(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const zj="2.90.1",Lj={"X-Client-Info":`storage-js/${zj}`};var eO=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1;const i=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Pe(Pe({},Lj),t),this.fetch=Eg(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await Pl(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await Pl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await gs(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async updateBucket(e,t){var n=this;try{return{data:await pp(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async emptyBucket(e){var t=this;try{return{data:await gs(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Cg(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},tO=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pe(Pe({},Lj),t),this.fetch=Eg(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await gs(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async listBuckets(e){var t=this;try{const n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",e.limit.toString()),e?.offset!==void 0&&n.set("offset",e.offset.toString()),e?.sortColumn&&n.set("sortColumn",e.sortColumn),e?.sortOrder&&n.set("sortOrder",e.sortOrder),e?.search&&n.set("search",e.search);const r=n.toString(),i=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return{data:await Pl(t.fetch,i,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Cg(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!$4(e))throw new kd("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 n=new U4({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(i,l){const u=i[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(i,d),error:null}}catch(h){if(r)throw h;return{data:null,error:h}}}}})}};const Ag={"X-Client-Info":`storage-js/${zj}`,"Content-Type":"application/json"};var Ij=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Vn(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var um=class extends Ij{constructor(e,t,n){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},nO=class extends Ij{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const Rg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),sO=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},dw=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rO=async(e,t,n)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!n?.noResolveJson){const r=e.status||500,i=e;if(typeof i.json=="function")i.json().then(l=>{const u=l?.statusCode||l?.code||r+"";t(new um(dw(l),r,u))}).catch(()=>{const l=r+"";t(new um(i.statusText||`HTTP ${r} error`,r,l))});else{const l=r+"";t(new um(i.statusText||`HTTP ${r} error`,r,l))}}else t(new nO(dw(e),e))},aO=(e,t,n,r)=>{const i={method:e,headers:t?.headers||{}};return r?(sO(r)?(i.headers=Pe({"Content-Type":"application/json"},t?.headers),i.body=JSON.stringify(r)):i.body=r,Pe(Pe({},i),n)):i};async function iO(e,t,n,r,i,l){return new Promise((u,d)=>{e(n,aO(t,r,i,l)).then(h=>{if(!h.ok)throw h;if(r?.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>u(h)).catch(h=>rO(h,d,r))})}async function Fn(e,t,n,r,i){return iO(e,"POST",t,r,i,n)}var oO=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pe(Pe({},Ag),t),this.fetch=Rg(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await Fn(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Vn(r))return{data:null,error:r};throw r}}async listIndexes(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await Fn(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Vn(r))return{data:null,error:r};throw r}}},lO=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pe(Pe({},Ag),t),this.fetch=Rg(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){var t=this;try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Fn(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async listVectors(e){var t=this;try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:await Fn(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async deleteVectors(e){var t=this;try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Fn(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}},cO=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Pe(Pe({},Ag),t),this.fetch=Rg(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Fn(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Vn(n))return{data:null,error:n};throw n}}},uO=class extends cO{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new dO(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},dO=class extends oO{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new fO(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},fO=class extends lO{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Pe(Pe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},hO=class extends eO{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Z4(this.url,this.headers,e,this.fetch)}get vectors(){return new uO(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new tO(this.url+"/iceberg",this.headers,this.fetch)}};const Uj="2.90.1",qi=30*1e3,gp=3,dm=gp*qi,mO="http://localhost:9999",pO="supabase.auth.token",gO={"X-Client-Info":`gotrue-js/${Uj}`},yp="X-Supabase-Api-Version",Bj={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},yO=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,xO=600*1e3;class zl extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function _e(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class vO extends zl{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function bO(e){return _e(e)&&e.name==="AuthApiError"}class Da extends zl{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class mr extends zl{constructor(t,n,r,i){super(t,r,i),this.name=n,this.status=r}}class Un extends mr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function wO(e){return _e(e)&&e.name==="AuthSessionMissingError"}class Oi extends mr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ju extends mr{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ku extends mr{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function SO(e){return _e(e)&&e.name==="AuthImplicitGrantRedirectError"}class fw extends mr{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class jO extends mr{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 xp extends mr{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function fm(e){return _e(e)&&e.name==="AuthRetryableFetchError"}class hw extends mr{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class vp extends mr{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),mw=`
35
+ \r=`.split(""),kO=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<mw.length;t+=1)e[mw[t].charCodeAt(0)]=-2;for(let t=0;t<td.length;t+=1)e[td[t].charCodeAt(0)]=t;return e})();function pw(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(td[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(td[r]),t.queuedBits-=6}}function Vj(e,t,n){const r=kO[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function gw(e){const t=[],n=u=>{t.push(String.fromCodePoint(u))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},l=u=>{TO(u,r,n)};for(let u=0;u<e.length;u+=1)Vj(e.charCodeAt(u),i,l);return t.join("")}function _O(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function NO(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}_O(r,t)}}function TO(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if((e>>7-r&1)===0){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Qi(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};for(let i=0;i<e.length;i+=1)Vj(e.charCodeAt(i),n,r);return new Uint8Array(t)}function EO(e){const t=[];return NO(e,n=>t.push(n)),new Uint8Array(t)}function Oa(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};return e.forEach(i=>pw(i,n,r)),pw(null,n,r),t.join("")}function CO(e){return Math.round(Date.now()/1e3)+e}function AO(){return Symbol("auth-callback")}const an=()=>typeof window<"u"&&typeof document<"u",ka={tested:!1,writable:!1},Fj=()=>{if(!an())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ka.tested)return ka.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ka.tested=!0,ka.writable=!0}catch{ka.tested=!0,ka.writable=!1}return ka.writable};function RO(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,l)=>{t[l]=i})}catch{}return n.searchParams.forEach((r,i)=>{t[i]=r}),t}const $j=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),DO=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Hi=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},_a=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},rn=async(e,t)=>{await e.removeItem(t)};class _d{constructor(){this.promise=new _d.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}_d.promiseConstructor=Promise;function hm(e){const t=e.split(".");if(t.length!==3)throw new vp("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!yO.test(t[r]))throw new vp("JWT not in base64url format");return{header:JSON.parse(gw(t[0])),payload:JSON.parse(gw(t[1])),signature:Qi(t[2]),raw:{header:t[0],payload:t[1]}}}async function OO(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function MO(e,t){return new Promise((r,i)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await e(l);if(!t(l,null,u)){r(u);return}}catch(u){if(!t(l,u)){i(u);return}}})()})}function PO(e){return("0"+e.toString(16)).substr(-2)}function zO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let l=0;l<56;l++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(t),Array.from(t,PO).join("")}async function LO(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(l=>String.fromCharCode(l)).join("")}async function IO(e){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."),e;const n=await LO(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Mi(e,t,n=!1){const r=zO();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await Hi(e,`${t}-code-verifier`,i);const l=await IO(r);return[l,r===l?"plain":"s256"]}const UO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function BO(e){const t=e.headers.get(yp);if(!t||!t.match(UO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function VO(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function FO(e){switch(e){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 $O=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Pi(e){if(!$O.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function mm(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function qO(e,t){return new Proxy(e,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}return!t.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."),t.value=!0),Reflect.get(n,r,i)}})}function yw(e){return JSON.parse(JSON.stringify(e))}const Ea=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),HO=[502,503,504];async function xw(e){var t;if(!DO(e))throw new xp(Ea(e),0);if(HO.includes(e.status))throw new xp(Ea(e),e.status);let n;try{n=await e.json()}catch(l){throw new Da(Ea(l),l)}let r;const i=BO(e);if(i&&i.getTime()>=Bj["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new hw(Ea(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Un}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new hw(Ea(n),e.status,n.weak_password.reasons);throw new vO(Ea(n),e.status||500,r)}const GO=(e,t,n,r)=>{const i={method:e,headers:t?.headers||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function Me(e,t,n,r){var i;const l=Object.assign({},r?.headers);l[yp]||(l[yp]=Bj["2024-01-01"].name),r?.jwt&&(l.Authorization=`Bearer ${r.jwt}`);const u=(i=r?.query)!==null&&i!==void 0?i:{};r?.redirectTo&&(u.redirect_to=r.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await KO(e,t,n+d,{headers:l,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(h):{data:Object.assign({},h),error:null}}async function KO(e,t,n,r,i,l){const u=GO(t,r,i,l);let d;try{d=await e(n,Object.assign({},u))}catch(h){throw console.error(h),new xp(Ea(h),0)}if(d.ok||await xw(d),r?.noResolveJson)return d;try{return await d.json()}catch(h){await xw(h)}}function ms(e){var t;let n=null;XO(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=CO(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function vw(e){const t=ms(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Yr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function YO(e){return{data:e,error:null}}function WO(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:l}=e,u=uo(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function bw(e){return e}function XO(e){return e.access_token&&e.refresh_token&&e.expires_in}const pm=["global","local","others"];class JO{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=$j(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(t,n=pm[0]){if(pm.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${pm.join(", ")}`);try{return await Me(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(_e(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Me(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Yr})}catch(r){if(_e(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=uo(t,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r?.newEmail,delete i.newEmail),await Me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:WO,redirectTo:n?.redirectTo})}catch(n){if(_e(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Yr})}catch(n){if(_e(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,i,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},p=await Me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(l=(i=t?.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:bw});if(p.error)throw p.error;const g=await p.json(),v=(u=p.headers.get("x-total-count"))!==null&&u!==void 0?u:0,b=(h=(d=p.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return b.length>0&&(b.forEach(j=>{const _=parseInt(j.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(j.split(";")[1].split("=")[1]);m[`${S}Page`]=_}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(_e(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){Pi(t);try{return await Me(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Yr})}catch(n){if(_e(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Pi(t);try{return await Me(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Yr})}catch(r){if(_e(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Pi(t);try{return await Me(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Yr})}catch(r){if(_e(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Pi(t.userId);try{const{data:n,error:r}=await Me(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(_e(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Pi(t.userId),Pi(t.id);try{return{data:await Me(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(_e(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,i,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},p=await Me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(l=(i=t?.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:bw});if(p.error)throw p.error;const g=await p.json(),v=(u=p.headers.get("x-total-count"))!==null&&u!==void 0?u:0,b=(h=(d=p.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return b.length>0&&(b.forEach(j=>{const _=parseInt(j.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(j.split(";")[1].split("=")[1]);m[`${S}Page`]=_}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(_e(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_e(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_e(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(_e(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(_e(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(_e(n))return{data:null,error:n};throw n}}}function ww(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const zi={debug:!!(globalThis&&Fj()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class qj extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class QO extends qj{}async function ZO(e,t,n){zi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),zi.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){zi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{zi.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw zi.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new QO(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(zi.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}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 n()}}))}function e5(){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 Hj(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function t5(e){return parseInt(e,16)}function n5(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function s5(e){var t;const{chainId:n,domain:r,expirationTime:i,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:p,uri:g,version:v}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(v!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${v}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
36
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const b=Hj(e.address),j=p?`${p}://${r}`:r,_=e.statement?`${e.statement}
37
+ `:"",S=`${j} wants you to sign in with your Ethereum account:
38
+ ${b}
39
+
40
+ ${_}`;let N=`URI: ${g}
41
+ Version: ${v}
42
+ Chain ID: ${n}${u?`
43
+ Nonce: ${u}`:""}
44
+ Issued At: ${l.toISOString()}`;if(i&&(N+=`
45
+ Expiration Time: ${i.toISOString()}`),d&&(N+=`
46
+ Not Before: ${d.toISOString()}`),h&&(N+=`
47
+ Request ID: ${h}`),m){let C=`
48
+ Resources:`;for(const T of m){if(!T||typeof T!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${T}`);C+=`
49
+ - ${T}`}N+=C}return`${S}
50
+ ${N}`}class Vt extends Error{constructor({message:t,code:n,cause:r,name:i}){var l;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(l=i??(r instanceof Error?r.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}}class nd extends Vt{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function r5({error:e,options:t}){var n,r,i;const{publicKey:l}=t;if(!l)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Vt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Vt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=l.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Vt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Vt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Vt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Vt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Vt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Vt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const u=window.location.hostname;if(Gj(u)){if(l.rp.id!==u)return new Vt({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Vt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Vt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Vt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Vt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function a5({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Vt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Vt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Gj(r)){if(n.rpId!==r)return new Vt({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Vt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Vt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Vt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class i5{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const o5=new i5;function l5(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,i=uo(e,["challenge","user","excludeCredentials"]),l=Qi(t).buffer,u=Object.assign(Object.assign({},n),{id:Qi(n.id).buffer}),d=Object.assign(Object.assign({},i),{challenge:l,user:u});if(r&&r.length>0){d.excludeCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:Qi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function c5(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=uo(e,["challenge","allowCredentials"]),i=Qi(t).buffer,l=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:Qi(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function u5(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Oa(new Uint8Array(e.response.attestationObject)),clientDataJSON:Oa(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function d5(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),i=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Oa(new Uint8Array(i.authenticatorData)),clientDataJSON:Oa(new Uint8Array(i.clientDataJSON)),signature:Oa(new Uint8Array(i.signature)),userHandle:i.userHandle?Oa(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Gj(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Sw(){var e,t;return!!(an()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.get)=="function")}async function f5(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new nd("Browser returned unexpected credential type",t)}:{data:null,error:new nd("Empty credential response",t)}}catch(t){return{data:null,error:r5({error:t,options:e})}}}async function h5(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new nd("Browser returned unexpected credential type",t)}:{data:null,error:new nd("Empty credential response",t)}}catch(t){return{data:null,error:a5({error:t,options:e})}}}const m5={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},p5={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function sd(...e){const t=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of e)if(i)for(const l in i){const u=i[l];if(u!==void 0)if(Array.isArray(u))r[l]=u;else if(n(u))r[l]=u;else if(t(u)){const d=r[l];t(d)?r[l]=sd(d,u):r[l]=sd(u)}else r[l]=u}return r}function g5(e,t){return sd(m5,e,t||{})}function y5(e,t){return sd(p5,e,t||{})}class x5{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:i},l){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!u)return{data:null,error:d};const h=i??o5.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:m}=u.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${r}`),m.displayName||(m.displayName=m.name)}switch(u.webauthn.type){case"create":{const m=g5(u.webauthn.credential_options.publicKey,l?.create),{data:p,error:g}=await f5({publicKey:m,signal:h});return p?{data:{factorId:t,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}case"request":{const m=y5(u.webauthn.credential_options.publicKey,l?.request),{data:p,error:g}=await h5(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:m,signal:h}));return p?{data:{factorId:t,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:p}},error:null}:{data:null,error:g}}}}catch(u){return _e(u)?{data:null,error:u}:{data:null,error:new Da("Unexpected error in challenge",u)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},l){if(!n)return{data:null,error:new zl("rpId is required for WebAuthn authentication")};try{if(!Sw())return{data:null,error:new Da("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:r,credential_response:h.credential_response}})}catch(u){return _e(u)?{data:null,error:u}:{data:null,error:new Da("Unexpected error in authenticate",u)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},l){if(!n)return{data:null,error:new zl("rpId is required for WebAuthn registration")};try{if(!Sw())return{data:null,error:new Da("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(p=>{var g;return(g=p.data)===null||g===void 0?void 0:g.all.find(v=>v.factor_type==="webauthn"&&v.friendly_name===t&&v.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p?.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:r,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return _e(u)?{data:null,error:u}:{data:null,error:new Da("Unexpected error in register",u)}}}}e5();const v5={url:mO,storageKey:pO,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:gO,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function jw(e,t,n){return await n()}const Li={};class Ll{get jwks(){var t,n;return(n=(t=Li[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Li[this.storageKey]=Object.assign(Object.assign({},Li[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Li[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Li[this.storageKey]=Object.assign(Object.assign({},Li[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,i;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 l=Object.assign(Object.assign({},v5),t);if(this.storageKey=l.storageKey,this.instanceID=(n=Ll.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ll.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&an()){const u=`${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(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new JO({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=$j(l.fetch),this.lock=l.lock||jw,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCustomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&an()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=ZO:this.lock=jw,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 x5(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?(l.storage?this.storage=l.storage:Fj()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ww(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=ww(this.memoryStorage)),an()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Uj}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),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 t;try{let n={},r="none";if(an()&&(n=RO(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),an()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:l}=await this._getSessionFromURL(n,r);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),SO(l)){const h=(t=l.details)===null||t===void 0?void 0:t.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=i;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return _e(n)?this._returnResult({error:n}):this._returnResult({error:new Da("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,i;try{const l=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t?.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=t?.options)===null||i===void 0?void 0:i.captchaToken}},xform:ms}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(_e(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var n,r,i;try{let l;if("email"in t){const{email:p,password:g,options:v}=t;let b=null,j=null;this.flowType==="pkce"&&([b,j]=await Mi(this.storage,this.storageKey)),l=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:v?.emailRedirectTo,body:{email:p,password:g,data:(n=v?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:v?.captchaToken},code_challenge:b,code_challenge_method:j},xform:ms})}else if("phone"in t){const{phone:p,password:g,options:v}=t;l=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:g,data:(r=v?.data)!==null&&r!==void 0?r:{},channel:(i=v?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:v?.captchaToken}},xform:ms})}else throw new ju("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await rn(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(t){try{let n;if("email"in t){const{email:l,password:u,options:d}=t;n=await Me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:vw})}else if("phone"in t){const{phone:l,password:u,options:d}=t;n=await Me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:vw})}else throw new ju("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const l=new Oi;return this._returnResult({data:{user:null,session:null},error:l})}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:i})}catch(n){if(_e(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,i,l;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(l=t.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,i,l,u,d,h,m,p,g,v;let b,j;if("message"in t)b=t.message,j=t.signature;else{const{chain:_,wallet:S,statement:N,options:C}=t;let T;if(an())if(typeof S=="object")T=S;else{const q=window;if("ethereum"in q&&typeof q.ethereum=="object"&&"request"in q.ethereum&&typeof q.ethereum.request=="function")T=q.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 S!="object"||!C?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");T=S}const D=new URL((n=C?.url)!==null&&n!==void 0?n:window.location.href),L=await T.request({method:"eth_requestAccounts"}).then(q=>q).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!L||L.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const O=Hj(L[0]);let B=(r=C?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!B){const q=await T.request({method:"eth_chainId"});B=t5(q)}const M={domain:D.host,address:O,statement:N,uri:D.href,version:"1",chainId:B,nonce:(i=C?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(u=(l=C?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=C?.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=C?.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=C?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(p=C?.signInWithEthereum)===null||p===void 0?void 0:p.resources};b=s5(M),j=await T.request({method:"personal_sign",params:[n5(b),O]})}try{const{data:_,error:S}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:b,signature:j},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(v=t.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:ms});if(S)throw S;if(!_||!_.session||!_.user){const N=new Oi;return this._returnResult({data:{user:null,session:null},error:N})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:S})}catch(_){if(_e(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async signInWithSolana(t){var n,r,i,l,u,d,h,m,p,g,v,b;let j,_;if("message"in t)j=t.message,_=t.signature;else{const{chain:S,wallet:N,statement:C,options:T}=t;let D;if(an())if(typeof N=="object")D=N;else{const O=window;if("solana"in O&&typeof O.solana=="object"&&("signIn"in O.solana&&typeof O.solana.signIn=="function"||"signMessage"in O.solana&&typeof O.solana.signMessage=="function"))D=O.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 N!="object"||!T?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=N}const L=new URL((n=T?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in D&&D.signIn){const O=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},T?.signInWithSolana),{version:"1",domain:L.host,uri:L.href}),C?{statement:C}:null));let B;if(Array.isArray(O)&&O[0]&&typeof O[0]=="object")B=O[0];else if(O&&typeof O=="object"&&"signedMessage"in O&&"signature"in O)B=O;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in B&&"signature"in B&&(typeof B.signedMessage=="string"||B.signedMessage instanceof Uint8Array)&&B.signature instanceof Uint8Array)j=typeof B.signedMessage=="string"?B.signedMessage:new TextDecoder().decode(B.signedMessage),_=B.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");j=[`${L.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...C?["",C,""]:[""],"Version: 1",`URI: ${L.href}`,`Issued At: ${(i=(r=T?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((l=T?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${T.signInWithSolana.notBefore}`]:[],...!((u=T?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${T.signInWithSolana.expirationTime}`]:[],...!((d=T?.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${T.signInWithSolana.chainId}`]:[],...!((h=T?.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${T.signInWithSolana.nonce}`]:[],...!((m=T?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${T.signInWithSolana.requestId}`]:[],...!((g=(p=T?.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||g===void 0)&&g.length?["Resources",...T.signInWithSolana.resources.map(B=>`- ${B}`)]:[]].join(`
51
+ `);const O=await D.signMessage(new TextEncoder().encode(j),"utf8");if(!O||!(O instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");_=O}}try{const{data:S,error:N}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:j,signature:Oa(_)},!((v=t.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(b=t.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:ms});if(N)throw N;if(!S||!S.session||!S.user){const C=new Oi;return this._returnResult({data:{user:null,session:null},error:C})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:N})}catch(S){if(_e(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async _exchangeCodeForSession(t){const n=await _a(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new jO;const{data:l,error:u}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:ms});if(await rn(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Oi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:i??null}),error:u})}catch(l){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(t){try{const{options:n,provider:r,token:i,access_token:l,nonce:u}=t,d=await Me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:ms}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const p=new Oi;return this._returnResult({data:{user:null,session:null},error:p})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(n){if(_e(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,i,l,u;try{if("email"in t){const{email:d,options:h}=t;let m=null,p=null;this.flowType==="pkce"&&([m,p]=await Mi(this.storage,this.storageKey));const{error:g}=await Me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(n=h?.data)!==null&&n!==void 0?n:{},create_user:(r=h?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:m,code_challenge_method:p},redirectTo:h?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in t){const{phone:d,options:h}=t,{data:m,error:p}=await Me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(i=h?.data)!==null&&i!==void 0?i:{},create_user:(l=h?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},channel:(u=h?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:p})}throw new ju("You must provide either an email or phone number.")}catch(d){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(t){var n,r;try{let i,l;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,l=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:u,error:d}=await Me(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:i,xform:ms});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h?.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(i){if(_e(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(t){var n,r,i,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await Mi(this.storage,this.storageKey));const m=await Me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=t?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:YO});return!((l=m.data)===null||l===void 0)&&l.url&&an()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Un;const{error:i}=await Me(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(t){if(_e(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:i,options:l}=t,{error:u}=await Me(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in t){const{phone:r,type:i,options:l}=t,{data:u,error:d}=await Me(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new ju("You must provide either an email or phone number and a type")}catch(n){if(_e(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.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(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}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 t=null;const n=await _a(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<dm:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const u=await _a(this.userStorage,this.storageKey+"-user");u?.user?t.user=u.user:t.user=mm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=qO(t.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Yr}):await this._useSession(async n=>{var r,i,l;const{data:u,error:d}=n;if(d)throw d;return!(!((r=u.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Un}:await Me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(i=u.session)===null||i===void 0?void 0:i.access_token)!==null&&l!==void 0?l:void 0,xform:Yr})})}catch(n){if(_e(n))return wO(n)&&(await this._removeSession(),await rn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:i,error:l}=r;if(l)throw l;if(!i.session)throw new Un;const u=i.session;let d=null,h=null;this.flowType==="pkce"&&t.email!=null&&([d,h]=await Mi(this.storage,this.storageKey));const{data:m,error:p}=await Me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:Yr});if(p)throw p;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(r){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Un;const n=Date.now()/1e3;let r=n,i=!0,l=null;const{payload:u}=hm(t.access_token);if(u.exp&&(r=u.exp,i=r<=n),i){const{data:d,error:h}=await this._callRefreshToken(t.refresh_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:h}=await this._getUser(t.access_token);if(h)throw h;l={access_token:t.access_token,refresh_token:t.refresh_token,user:d.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(_e(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:u,error:d}=n;if(d)throw d;t=(r=u.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new Un;const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(_e(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!an())throw new ku("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ku(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new fw("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ku("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new fw("No code detected.");const{data:C,error:T}=await this._exchangeCodeForSession(t.code);if(T)throw T;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:C.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:l,refresh_token:u,expires_in:d,expires_at:h,token_type:m}=t;if(!l||!d||!u||!m)throw new ku("No session defined in URL");const p=Math.round(Date.now()/1e3),g=parseInt(d);let v=p+g;h&&(v=parseInt(h));const b=v-p;b*1e3<=qi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${g}s`);const j=v-g;p-j>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",j,v,p):p-j<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",j,v,p);const{data:_,error:S}=await this._getUser(l);if(S)throw S;const N={provider_token:r,provider_refresh_token:i,access_token:l,expires_in:g,expires_at:v,refresh_token:u,token_type:m,user:_.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:N,redirectType:t.type},error:null})}catch(r){if(_e(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await _a(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:l}=n;if(l)return this._returnResult({error:l});const u=(r=i.session)===null||r===void 0?void 0:r.access_token;if(u){const{error:d}=await this.admin.signOut(u,t);if(d&&!(bO(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await rn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=AO(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,i;try{const{data:{session:l},error:u}=n;if(u)throw u;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",t,"session",l)}catch(l){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),console.error(l)}})}async resetPasswordForEmail(t,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await Mi(this.storage,this.storageKey,!0));try{return await Me(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:i}=await this._useSession(async l=>{var u,d,h,m,p;const{data:g,error:v}=l;if(v)throw v;const b=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(u=t.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=t.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=t.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await Me(this.fetch,"GET",b,{headers:this.headers,jwt:(p=(m=g.session)===null||m===void 0?void 0:m.access_token)!==null&&p!==void 0?p:void 0})});if(i)throw i;return an()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:t.provider,url:r?.url},error:null})}catch(r){if(_e(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:l}}=n;if(i)throw i;const{options:u,provider:d,token:h,access_token:m,nonce:p}=t,g=await Me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=l?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:d,id_token:h,access_token:m,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:ms}),{data:v,error:b}=g;return b?this._returnResult({data:{user:null,session:null},error:b}):!v||!v.session||!v.user?this._returnResult({data:{user:null,session:null},error:new Oi}):(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("USER_UPDATED",v.session)),this._returnResult({data:v,error:b}))}catch(i){if(await rn(this.storage,`${this.storageKey}-code-verifier`),_e(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,i;const{data:l,error:u}=n;if(u)throw u;return await Me(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await MO(async i=>(i>0&&await OO(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Me(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ms})),(i,l)=>{const u=200*Math.pow(2,i);return l&&fm(l)&&Date.now()+u-r<qi})}catch(r){if(this._debug(n,"error",r),_e(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),an()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await _a(this.storage,this.storageKey);if(i&&this.userStorage){let u=await _a(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:i.user},await Hi(this.userStorage,this.storageKey+"-user",u)),i.user=(t=u?.user)!==null&&t!==void 0?t:mm()}else if(i&&!i.user&&!i.user){const u=await _a(this.storage,this.storageKey+"-user");u&&u?.user?(i.user=u.user,await rn(this.storage,this.storageKey+"-user"),await Hi(this.storage,this.storageKey,i)):i.user=mm()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const l=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<dm;if(this._debug(r,`session has${l?"":" not"} expired with margin of ${dm}s`),l){if(this.autoRefreshToken&&i.refresh_token){const{error:u}=await this._callRefreshToken(i.refresh_token);u&&(console.error(u),fm(u)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(i.access_token);!d&&u?.user?(i.user=u.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(r,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Un;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new _d;const{data:l,error:u}=await this._refreshAccessToken(t);if(u)throw u;if(!l.session)throw new Un;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(i,"error",l),_e(l)){const u={data:null,error:l};return fm(l)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(l),l}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(t,n,r=!0){const i=`#_notifyAllSubscribers(${t})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(t,n)}catch(h){l.push(h)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(i,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await rn(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Hi(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const l=yw(i);await Hi(this.storage,this.storageKey,l)}else{const i=yw(n);await Hi(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await rn(this.storage,this.storageKey),await rn(this.storage,this.storageKey+"-code-verifier"),await rn(this.storage,this.storageKey+"-user"),this.userStorage&&await rn(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&an()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),qi);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-t)/qi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${qi}ms, refresh threshold is ${gp} ticks`),i<=gp&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof qj)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!an()||!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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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(t,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[l,u]=await Mi(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});i.push(d.toString())}if(r?.queryParams){const l=new URLSearchParams(r.queryParams);i.push(l.toString())}return r?.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:i,error:l}=n;return l?this._returnResult({data:null,error:l}):await Me(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,i;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:h,error:m}=await Me(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});return m?this._returnResult({data:null,error:m}):(t.factorType==="totp"&&h.type==="totp"&&(!((i=h?.totp)===null||i===void 0)&&i.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?u5(t.webauthn.credential_response):d5(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:h}=await Me(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:u,headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:h}))})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=await Me(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:l5(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:c5(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=n?.factors)!==null&&t!==void 0?t:[])i.all.push(l),l.status==="verified"&&i[l.factor_type].push(l);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:r},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=hm(r.access_token);let u=null;l.aal&&(u=l.aal);let d=u;((n=(t=r.user.factors)===null||t===void 0?void 0:t.filter(p=>p.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(d="aal2");const m=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await Me(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new Un})})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:i},error:l}=r;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new Un});const u=await Me(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&an()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(r){if(_e(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:i},error:l}=r;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new Un});const u=await Me(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&an()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(r){if(_e(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Me(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Un})})}catch(t){if(_e(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await Me(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Un})})}catch(n){if(_e(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(d=>d.kid===t);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(d=>d.kid===t),r&&this.jwks_cached_at+xO>i)return r;const{data:l,error:u}=await Me(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=i,r=l.keys.find(d=>d.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:b,error:j}=await this.getSession();if(j||!b.session)return this._returnResult({data:null,error:j});r=b.session.access_token}const{header:i,payload:l,signature:u,raw:{header:d,payload:h}}=hm(r);n?.allowExpired||VO(l.exp);const m=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:b}=await this.getUser(r);if(b)throw b;return{data:{claims:l,header:i,signature:u},error:null}}const p=FO(i.alg),g=await crypto.subtle.importKey("jwk",m,p,!0,["verify"]);if(!await crypto.subtle.verify(p,g,u,EO(`${d}.${h}`)))throw new vp("Invalid JWT signature");return{data:{claims:l,header:i,signature:u},error:null}}catch(r){if(_e(r))return this._returnResult({data:null,error:r});throw r}}}Ll.nextInstanceID={};const b5=Ll,w5="2.90.1";let gl="";typeof Deno<"u"?gl="deno":typeof document<"u"?gl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?gl="react-native":gl="node";const S5={"X-Client-Info":`supabase-js-${gl}/${w5}`},j5={headers:S5},k5={schema:"public"},_5={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},N5={};function Il(e){"@babel/helpers - typeof";return Il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Il(e)}function T5(e,t){if(Il(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Il(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function E5(e){var t=T5(e,"string");return Il(t)=="symbol"?t:t+""}function C5(e,t,n){return(t=E5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kw(Object(n),!0).forEach(function(r){C5(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const A5=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),R5=()=>Headers,D5=(e,t,n)=>{const r=A5(n),i=R5();return async(l,u)=>{var d;const h=(d=await t())!==null&&d!==void 0?d:e;let m=new i(u?.headers);return m.has("apikey")||m.set("apikey",e),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),r(l,Tt(Tt({},u),{},{headers:m}))}};function O5(e){return e.endsWith("/")?e:e+"/"}function M5(e,t){var n,r;const{db:i,auth:l,realtime:u,global:d}=e,{db:h,auth:m,realtime:p,global:g}=t,v={db:Tt(Tt({},h),i),auth:Tt(Tt({},m),l),realtime:Tt(Tt({},p),u),storage:{},global:Tt(Tt(Tt({},g),d),{},{headers:Tt(Tt({},(n=g?.headers)!==null&&n!==void 0?n:{}),(r=d?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?v.accessToken=e.accessToken:delete v.accessToken,v}function P5(e){const t=e?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(O5(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var z5=class extends b5{constructor(e){super(e)}},L5=class{constructor(e,t,n){var r,i;this.supabaseUrl=e,this.supabaseKey=t;const l=P5(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:k5,realtime:N5,auth:Tt(Tt({},_5),{},{storageKey:u}),global:j5},h=M5(n??{},d);if(this.storageKey=(r=h.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(p,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=h.auth)!==null&&m!==void 0?m:{},this.headers,h.global.fetch)}this.fetch=D5(t,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(Tt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.accessToken&&this.accessToken().then(p=>this.realtime.setAuth(p)).catch(p=>console.warn("Failed to set initial Realtime auth token:",p)),this.rest=new g4(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new hO(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new d4(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m},p,g){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new z5({url:this.authUrl.href,headers:Tt(Tt({},v),p),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,flowType:u,lock:d,debug:h,throwOnError:m,fetch:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new O4(this.realtimeUrl.href,Tt(Tt({},e),{},{params:Tt(Tt({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t?.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const bp=(e,t,n)=>new L5(e,t,n);function I5(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}I5()&&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 Nd="email_automator_supabase_config";function fo(){const e=n=>n&&typeof n.url=="string"&&typeof n.anonKey=="string"&&n.url.startsWith("http")&&!n.url.includes("placeholder.supabase.co")&&n.url!=="your_supabase_url"&&n.anonKey!=="your_supabase_anon_key";try{const n=localStorage.getItem(Nd);if(n){const r=JSON.parse(n);if(e(r))return r}}catch(n){console.error("Error reading Supabase config:",n)}const t={url:void 0,anonKey:void 0};return e(t)?t:null}function gm(e){try{localStorage.setItem(Nd,JSON.stringify(e))}catch(t){console.error("Error saving Supabase config:",t)}}function U5(){try{localStorage.removeItem(Nd)}catch(e){console.error("Error clearing Supabase config:",e)}}async function B5(e,t){try{if(!e.startsWith("http://")&&!e.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=t.startsWith("eyJ"),r=t.startsWith("sb_publishable_");if(!n&&!r)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(r)return{valid:!0};const i=await fetch(`${e}/rest/v1/`,{method:"GET",headers:{apikey:t,Authorization:`Bearer ${t}`}});return i.ok?{valid:!0}:i.status===401||i.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${i.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function V5(){return localStorage.getItem(Nd)?"ui":"none"}function F5(){const e=fo();return!e||!e.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),bp("https://placeholder.supabase.co","placeholder-key")):bp(e.url,e.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const xt=F5();function wp(){const e=fo(),t=e?`${e.url}/functions/v1`:"",n=e?e.anonKey:"",r=window.location.port==="5173";let i="";return r?i="http://localhost:3004":i=window.location.origin,{edgeFunctionsUrl:t,expressApiUrl:i,anonKey:n}}class $5{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;initialized=!1;constructor(){const t=wp();this.edgeFunctionsUrl=t.edgeFunctionsUrl,this.expressApiUrl=t.expressApiUrl,this.anonKey=t.anonKey}setSupabaseClient(t){this.supabaseClient=t,this.initialized=!0,console.debug("[HybridApiClient] Supabase client initialized")}setToken(t){console.debug(t?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=t}async request(t,n,r={}){const{auth:i=!0,...l}=r,u={"Content-Type":"application/json",...r.headers||{}};if(i&&!this.initialized){console.warn(`[HybridApiClient] API not initialized yet for ${n} - waiting...`);const d=Date.now();for(;!this.initialized&&Date.now()-d<3e3;)await new Promise(h=>setTimeout(h,100));if(!this.initialized)return console.error(`[HybridApiClient] Timeout waiting for API initialization for ${n}`),{error:{code:"NOT_INITIALIZED",message:"API client not initialized. Please refresh the page."}}}if(i&&this.supabaseClient)try{const{data:{session:d},error:h}=await this.supabaseClient.auth.getSession();h?console.error("[HybridApiClient] Failed to get Supabase session:",h):d?.access_token&&(this.token=d.access_token)}catch(d){console.error("[HybridApiClient] Session recovery error:",d)}if(i&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${n} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};i&&this.token&&(u.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${r.method||"GET"} ${t}${n}`);const d=await fetch(`${t}${n}`,{...l,headers:u});if(!d.ok){const m=await d.json().catch(()=>({})),p=typeof m.error=="string"?m.error:m.error?.message||`Request failed: ${d.status}`;return{error:{code:m.error?.code||"API_ERROR",message:p}}}return{data:await d.json()}}catch(d){return{error:{code:"NETWORK_ERROR",message:d instanceof Error?d.message:"Network error"}}}}edgeRequest(t,n){const r={...n?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,t,{...n,headers:r})}expressRequest(t,n){const r=wp(),i={...n?.headers||{},"X-Supabase-Url":r.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":r.anonKey};return this.request(this.expressApiUrl,t,{...n,headers:i})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(t){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:t})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(t){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:t})})}async connectImap(t){return this.expressRequest("/api/auth/imap/connect",{method:"POST",body:JSON.stringify(t)})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(t){return this.edgeRequest(`/api-v1-accounts/${t}`,{method:"DELETE"})}async updateAccount(t,n){return this.edgeRequest(`/api-v1-accounts/${t}`,{method:"PATCH",body:JSON.stringify(n)})}async getEmails(t={}){const n=new URLSearchParams;return t.limit&&n.set("limit",t.limit.toString()),t.offset&&n.set("offset",t.offset.toString()),t.category&&n.set("category",t.category),t.search&&n.set("search",t.search),t.sort_by&&n.set("sort_by",t.sort_by),t.sort_order&&n.set("sort_order",t.sort_order),this.edgeRequest(`/api-v1-emails?${n}`)}async getEmail(t){return this.edgeRequest(`/api-v1-emails/${t}`)}async getEmailEvents(t){return this.edgeRequest(`/api-v1-emails/${t}/events`)}async deleteEmail(t){return this.edgeRequest(`/api-v1-emails/${t}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async retryEmail(t){return this.expressRequest(`/api/emails/${t}/retry`,{method:"POST"})}async getRules(){return this.expressRequest("/api/rules")}async createRule(t){return this.expressRequest("/api/rules",{method:"POST",body:JSON.stringify(t)})}async updateRule(t,n){return this.expressRequest(`/api/rules/${t}`,{method:"PATCH",body:JSON.stringify(n)})}async deleteRule(t){return this.expressRequest(`/api/rules/${t}`,{method:"DELETE"})}async toggleRule(t){return this.expressRequest(`/api/rules/${t}/toggle`,{method:"POST"})}async getSettings(){return this.edgeRequest("/api-v1-settings")}async getRunEvents(t){return this.edgeRequest(`/api-v1-settings/logs/${t}/events`)}async updateSettings(t){return this.edgeRequest("/api-v1-settings",{method:"PATCH",body:JSON.stringify(t)})}async getStats(){return this.edgeRequest("/api-v1-settings/stats")}async testLlm(t){return this.expressRequest("/api/settings/test-llm",{method:"POST",body:JSON.stringify(t||{})})}async getChatProviders(){return this.expressRequest("/api/sdk/providers/chat")}async getEmbedProviders(){return this.expressRequest("/api/sdk/providers/embed")}async triggerSync(t){return this.expressRequest("/api/sync",{method:"POST",body:JSON.stringify({accountId:t})})}async syncAll(){return this.expressRequest("/api/sync/all",{method:"POST"})}async getSyncLogs(t=10){return this.expressRequest(`/api/sync/logs?limit=${t}`)}async stopSync(){return this.expressRequest("/api/sync/stop",{method:"POST"})}async executeAction(t,n,r){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:t,action:n,draftContent:r})})}async generateDraft(t,n){return this.expressRequest(`/api/actions/draft/${t}`,{method:"POST",body:JSON.stringify({instructions:n})})}async bulkAction(t,n){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:t,action:n})})}async getDrafts(t={}){const n=new URLSearchParams;return t.status&&n.set("status",t.status),t.limit&&n.set("limit",t.limit.toString()),t.offset&&n.set("offset",t.offset.toString()),t.account_id&&n.set("account_id",t.account_id),this.expressRequest(`/api/drafts?${n}`)}async sendDraft(t,n){return this.expressRequest(`/api/drafts/${t}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})})}async dismissDraft(t){return this.expressRequest(`/api/drafts/${t}/dismiss`,{method:"POST"})}async updateDraft(t,n){return this.expressRequest(`/api/drafts/${t}`,{method:"PATCH",body:JSON.stringify({draft_content:n})})}async regenerateDraft(t,n){return this.expressRequest(`/api/drafts/${t}/regenerate`,{method:"POST",body:JSON.stringify({instructions:n})})}async uploadAttachment(t,n){const r=new FormData;return r.append("file",n),this.expressRequest(`/api/drafts/${t}/attachments`,{method:"POST",body:r})}async deleteAttachment(t,n){return this.expressRequest(`/api/drafts/${t}/attachments/${n}`,{method:"DELETE"})}async healthCheck(){return this.expressRequest("/api/health",{auth:!1})}async getProfile(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:t}}=await this.supabaseClient.auth.getUser();if(!t)return{error:"Not authenticated"};const{data:n,error:r}=await this.supabaseClient.from("profiles").select("*").eq("id",t.id).single();return{data:n,error:r}}async updateProfile(t){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:n}}=await this.supabaseClient.auth.getUser();if(!n)return{error:"Not authenticated"};const{data:r,error:i}=await this.supabaseClient.from("profiles").update({...t,updated_at:new Date().toISOString()}).eq("id",n.id).select().single();return{data:r,error:i}}async changePassword(t){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:n}=await this.supabaseClient.auth.updateUser({password:t});return{success:!n,error:n}}async submitFeedback(t){return this.expressRequest("/api/learning/feedback",{method:"POST",body:JSON.stringify(t)})}async getLearningMetrics(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:t}}=await this.supabaseClient.auth.getUser();if(!t)return{error:"Not authenticated"};const{data:n}=await this.supabaseClient.from("learning_metrics").select("*").eq("user_id",t.id).single(),{data:r}=await this.supabaseClient.from("user_settings").select("category_patterns, vip_senders").eq("user_id",t.id).single();return{data:{...n,category_patterns:r?.category_patterns||{},vip_senders:r?.vip_senders||[]}}}}const Re=new $5;async function Kj(e){Re.setSupabaseClient(e);const{data:{session:t}}=await e.auth.getSession();t?.access_token&&Re.setToken(t.access_token),e.auth.onAuthStateChange((n,r)=>{Re.setToken(r?.access_token||null)})}const q5=Object.freeze(Object.defineProperty({__proto__:null,api:Re,initializeApi:Kj},Symbol.toStringTag,{value:"Module"}));function H5({userId:e,onInsert:t,onUpdate:n,onDelete:r,enabled:i=!0}){const[l,u]=w.useState(!1);return w.useEffect(()=>{if(!i||!e){u(!1);return}const d=xt.channel(`emails-realtime-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},h=>{h.eventType==="INSERT"?t?.(h.new):h.eventType==="UPDATE"?n?.(h.new):h.eventType==="DELETE"&&r?.(h.old.id)}).subscribe(h=>{u(h==="SUBSCRIBED")});return()=>{xt.removeChannel(d)}},[e,i,t,n,r]),{isSubscribed:l}}class G5{ctx=null;enabled=!1;constructor(){const t=localStorage.getItem("ea_sounds_enabled");this.enabled=t!=="false"}setEnabled(t){this.enabled=t,localStorage.setItem("ea_sounds_enabled",t?"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(t=10){typeof navigator<"u"&&navigator.vibrate&&navigator.vibrate(t)}playNotify(){if(!this.enabled)return;const t=this.initCtx(),n=t.createOscillator(),r=t.createGain();n.type="sine",n.frequency.setValueAtTime(880,t.currentTime),n.frequency.exponentialRampToValueAtTime(440,t.currentTime+.1),r.gain.setValueAtTime(0,t.currentTime),r.gain.linearRampToValueAtTime(.1,t.currentTime+.01),r.gain.exponentialRampToValueAtTime(.001,t.currentTime+.3),n.connect(r),r.connect(t.destination),n.start(),n.stop(t.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const t=this.initCtx(),n=(r,i)=>{const l=t.createOscillator(),u=t.createGain();l.type="sine",l.frequency.setValueAtTime(r,t.currentTime+i),u.gain.setValueAtTime(0,t.currentTime+i),u.gain.linearRampToValueAtTime(.1,t.currentTime+i+.05),u.gain.exponentialRampToValueAtTime(.001,t.currentTime+i+.4),l.connect(u),u.connect(t.destination),l.start(t.currentTime+i),l.stop(t.currentTime+i+.4)};n(660,0),n(880,.1),this.haptic([20,50,20])}playStart(){if(!this.enabled)return;const t=this.initCtx(),n=t.createOscillator(),r=t.createGain();n.type="sine",n.frequency.setValueAtTime(440,t.currentTime),n.frequency.exponentialRampToValueAtTime(880,t.currentTime+.2),r.gain.setValueAtTime(0,t.currentTime),r.gain.linearRampToValueAtTime(.05,t.currentTime+.05),r.gain.exponentialRampToValueAtTime(.001,t.currentTime+.2),n.connect(r),r.connect(t.destination),n.start(),n.stop(t.currentTime+.2),this.haptic(10)}playSuccess(){if(!this.enabled)return;const t=this.initCtx(),n=t.createOscillator(),r=t.createGain();n.type="triangle",n.frequency.setValueAtTime(523.25,t.currentTime),n.frequency.exponentialRampToValueAtTime(1046.5,t.currentTime+.1),r.gain.setValueAtTime(0,t.currentTime),r.gain.linearRampToValueAtTime(.05,t.currentTime+.02),r.gain.exponentialRampToValueAtTime(.001,t.currentTime+.2),n.connect(r),r.connect(t.destination),n.start(),n.stop(t.currentTime+.2),this.haptic(15)}}const Ms=new G5;let Rs=[],Sp=new Set;function jp(){Sp.forEach(e=>e())}const le={success:(e,t)=>_u("success",e,t),error:(e,t)=>_u("error",e,t),info:(e,t)=>_u("info",e,t),warning:(e,t)=>_u("warning",e,t)};function _u(e,t,n=5e3){const r=Rs.findIndex(l=>l.message===t&&l.type===e);if(r!==-1){const l=Rs[r];Rs=[...Rs],Rs[r]={...l,count:(l.count||1)+1,lastUpdated:Date.now()},jp();return}const i=Math.random().toString(36).substr(2,9);Rs=[...Rs,{id:i,type:e,message:t,duration:n,count:1,lastUpdated:Date.now()}],jp(),n>0&&setTimeout(()=>Yj(i),n)}function Yj(e){Rs=Rs.filter(t=>t.id!==e),jp()}function K5(){const[,e]=w.useState(0);return w.useEffect(()=>{const t=()=>e(n=>n+1);return Sp.add(t),()=>{Sp.delete(t)}},[]),Rs}const Y5={success:Qu,error:qn,info:ro,warning:ea},W5={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 X5({toast:e}){const t=Y5[e.type];return o.jsxs("div",{className:pe("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",W5[e.type]),children:[o.jsxs("div",{className:"relative",children:[o.jsx(t,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),e.count&&e.count>1&&o.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:e.count})]}),o.jsx("p",{className:"text-sm flex-1",children:e.message}),o.jsx("button",{onClick:()=>Yj(e.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(fn,{className:"w-4 h-4"})})]})}function J5(){const e=K5();return e.length===0?null:o.jsx("div",{className:"fixed bottom-4 left-4 z-50 flex flex-col-reverse gap-2 max-w-sm w-full",children:e.map(t=>o.jsx(X5,{toast:t},t.id))})}function Q5(e){if(!e){console.warn("[TTS Sync] No settings provided, skipping sync");return}try{const t=e.tts_provider||"piper_local";localStorage.setItem("tts_provider",t),e.tts_voice?localStorage.setItem("tts_voice",e.tts_voice):localStorage.removeItem("tts_voice");const n=e.tts_speed??1;localStorage.setItem("tts_speed",n.toString());const r=e.tts_quality??10;localStorage.setItem("tts_quality",r.toString());const i=e.tts_auto_play??!0;localStorage.setItem("auto_speak_enabled",i.toString()),console.log("[TTS Sync] Synced to localStorage:",{provider:t,voice:e.tts_voice||"(none)",speed:n,quality:r,autoPlay:i})}catch(t){console.error("[TTS Sync] Failed to sync to localStorage:",t)}}function Z5(){try{localStorage.removeItem("tts_provider"),localStorage.removeItem("tts_voice"),localStorage.removeItem("tts_speed"),localStorage.removeItem("tts_quality"),localStorage.removeItem("auto_speak_enabled"),console.log("[TTS Sync] Cleared from localStorage")}catch(e){console.error("[TTS Sync] Failed to clear localStorage:",e)}}function kp(){try{const e=localStorage.getItem("tts_provider")||void 0,t=localStorage.getItem("tts_voice")||void 0,n=parseFloat(localStorage.getItem("tts_speed")||"1.0"),r=parseInt(localStorage.getItem("tts_quality")||"10",10),i=localStorage.getItem("auto_speak_enabled")!=="false";return{provider:e,voice:t,speed:n,quality:r,autoPlay:i}}catch(e){return console.error("[TTS Sync] Failed to read from localStorage:",e),{speed:1,quality:10,autoPlay:!0}}}function ts(e,t){return e?typeof e=="string"?e:e.message||t:t}const Wj={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 e3(e,t){switch(t.type){case"SET_USER":return{...e,user:t.payload,isAuthenticated:!!t.payload,isLoading:!1};case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_INITIALIZED":return{...e,isInitialized:t.payload};case"SET_ERROR":return{...e,error:t.payload,isLoading:!1};case"SET_EMAILS":return{...e,emails:t.payload.emails,emailsTotal:t.payload.total,emailsOffset:t.payload.offset,activeCategory:t.payload.category!==void 0?t.payload.category:e.activeCategory,activeSearch:t.payload.search!==void 0?t.payload.search:e.activeSearch,sortBy:t.payload.sortBy||e.sortBy,sortOrder:t.payload.sortOrder||e.sortOrder};case"ADD_EMAIL":{const n=t.payload,r=!e.activeCategory||n.category===e.activeCategory,i=!e.activeSearch||n.subject?.toLowerCase().includes(e.activeSearch.toLowerCase())||n.sender?.toLowerCase().includes(e.activeSearch.toLowerCase());return!r||!i?{...e,emailsTotal:e.emailsTotal+1}:{...e,emails:[n,...e.emails],emailsTotal:e.emailsTotal+1}}case"UPDATE_EMAIL":{const n=t.payload;if(e.emails.findIndex(u=>u.id===n.id)!==-1)return{...e,emails:e.emails.map(u=>u.id===n.id?n:u)};const i=!e.activeCategory||n.category===e.activeCategory,l=!e.activeSearch||n.subject?.toLowerCase().includes(e.activeSearch.toLowerCase())||n.sender?.toLowerCase().includes(e.activeSearch.toLowerCase());return i&&l?{...e,emails:[n,...e.emails]}:e}case"REMOVE_EMAIL":return{...e,emails:e.emails.filter(n=>n.id!==t.payload),emailsTotal:Math.max(0,e.emailsTotal-1)};case"SET_PROFILE":return{...e,profile:t.payload};case"UPDATE_PROFILE":return{...e,profile:t.payload};case"SET_ACCOUNTS":return{...e,accounts:t.payload};case"ADD_ACCOUNT":return{...e,accounts:[t.payload,...e.accounts]};case"REMOVE_ACCOUNT":return{...e,accounts:e.accounts.filter(n=>n.id!==t.payload)};case"SET_RULES":return{...e,rules:t.payload};case"ADD_RULE":return{...e,rules:[t.payload,...e.rules]};case"UPDATE_RULE":return{...e,rules:e.rules.map(n=>n.id===t.payload.id?t.payload:n)};case"REMOVE_RULE":return{...e,rules:e.rules.filter(n=>n.id!==t.payload)};case"SET_SETTINGS":return Q5(t.payload),{...e,settings:t.payload};case"SET_STATS":return{...e,stats:t.payload};case"SET_SELECTED_EMAIL":return{...e,selectedEmailId:t.payload};case"SET_SYNCING":return{...e,isSyncing:t.payload};case"CLEAR_DATA":return{...Wj,isLoading:!1,isInitialized:!0};default:return e}}const Xj=w.createContext(null);function t3({children:e}){const[t,n]=w.useReducer(e3,Wj),r=w.useCallback(async(m,p=3,g=500)=>{for(let v=1;v<=p;v++){const b=await Re.getEmail(m);if(b.data?.email)return b.data.email;v<p&&await new Promise(j=>setTimeout(j,g))}return null},[]),i=w.useCallback(async m=>{const p=await r(m.id);p&&(n({type:"ADD_EMAIL",payload:p}),p.processing_status==="completed"&&(p.ai_analysis?.priority==="High"?(Ms.playAlert(),le.success("High Priority Email Processed!")):(Ms.playNotify(),le.info("New email processed"))))},[n,r]),l=w.useCallback(async m=>{const p=await r(m.id);p&&(n({type:"UPDATE_EMAIL",payload:p}),p.processing_status==="completed"&&m.processing_status==="completed"&&(p.ai_analysis?.priority==="High"?(Ms.playAlert(),le.success("High Priority Email Processed!")):(Ms.playNotify(),le.info("Email analysis complete"))))},[n,r]),u=w.useCallback(m=>{n({type:"REMOVE_EMAIL",payload:m})},[n]),{isSubscribed:d}=H5({userId:t.user?.id,onInsert:i,onUpdate:l,onDelete:u,enabled:t.isAuthenticated});w.useEffect(()=>{async function m(){if(!fo()){n({type:"SET_INITIALIZED",payload:!0});return}try{const{error:g}=await xt.from("init_state").select("count",{count:"exact",head:!0});if(g&&g.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),n({type:"SET_INITIALIZED",payload:!0});return}await Kj(xt);const{data:{session:v}}=await xt.auth.getSession();n({type:"SET_USER",payload:v?.user||null}),n({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:b}}=xt.auth.onAuthStateChange((j,_)=>{n({type:"SET_USER",payload:_?.user||null}),_||n({type:"CLEAR_DATA"})});return()=>b.unsubscribe()}catch(g){console.error("[AppContext] Init error:",g),n({type:"SET_ERROR",payload:"Failed to initialize"}),n({type:"SET_INITIALIZED",payload:!0})}}m()},[]);const h={fetchEmails:async(m={})=>{const p=await Re.getEmails({limit:20,offset:m.offset||0,category:m.category,search:m.search,sort_by:m.sortBy||t.sortBy,sort_order:m.sortOrder||t.sortOrder});p.data&&n({type:"SET_EMAILS",payload:{emails:p.data.emails,total:p.data.total,offset:m.offset||0,category:m.category||null,search:m.search||"",sortBy:m.sortBy,sortOrder:m.sortOrder}})},fetchAccounts:async()=>{const m=await Re.getAccounts();m.data?n({type:"SET_ACCOUNTS",payload:m.data.accounts}):m.error&&console.error("[AppContext] Failed to fetch accounts:",m.error)},fetchRules:async()=>{const m=await Re.getRules();m.data?n({type:"SET_RULES",payload:m.data.rules}):m.error&&console.error("[AppContext] Failed to fetch rules:",m.error)},fetchSettings:async()=>{const m=await Re.getSettings();m.data?n({type:"SET_SETTINGS",payload:m.data.settings}):m.error&&console.error("[AppContext] Failed to fetch settings:",m.error)},fetchProfile:async()=>{const m=await Re.getProfile();m.data&&n({type:"SET_PROFILE",payload:m.data})},fetchStats:async()=>{const m=await Re.getStats();m.data&&n({type:"SET_STATS",payload:m.data.stats})},executeAction:async(m,p,g)=>{const v=await Re.executeAction(m,p,g);if(v.data?.success){const b=t.emails.find(j=>j.id===m);return b&&n({type:"UPDATE_EMAIL",payload:{...b,action_taken:p}}),!0}return n({type:"SET_ERROR",payload:ts(v.error,"Action failed")}),!1},triggerSync:async m=>{n({type:"SET_SYNCING",payload:!0});try{const p=m?await Re.triggerSync(m):await Re.syncAll();return await h.fetchAccounts(),p.error?(n({type:"SET_ERROR",payload:ts(p.error,"Sync failed")}),!1):!0}finally{n({type:"SET_SYNCING",payload:!1})}},stopSync:async()=>{const m=await Re.stopSync();return m.data?.success?(le.info("Stop request sent"),!0):(n({type:"SET_ERROR",payload:ts(m.error,"Failed to stop sync")}),!1)},disconnectAccount:async m=>{const p=await Re.disconnectAccount(m);return p.data?.success?(n({type:"REMOVE_ACCOUNT",payload:m}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to disconnect")}),!1)},updateSettings:async m=>{const p=await Re.updateSettings(m);return p.data?(n({type:"SET_SETTINGS",payload:p.data.settings}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to update settings")}),!1)},updateProfile:async m=>{const p=await Re.updateProfile(m);return p.data?(n({type:"UPDATE_PROFILE",payload:p.data}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to update profile")}),!1)},updateAccount:async(m,p)=>{const g=await Re.updateAccount(m,p);return g.data?(n({type:"SET_ACCOUNTS",payload:t.accounts.map(v=>v.id===m?{...v,...p}:v)}),!0):(n({type:"SET_ERROR",payload:ts(g.error,"Failed to update account")}),!1)},retryProcessing:async m=>{const p=await Re.retryEmail(m);if(p.data?.success){const g=t.emails.find(v=>v.id===m);return g&&n({type:"UPDATE_EMAIL",payload:{...g,processing_status:"pending",processing_error:null}}),!0}return n({type:"SET_ERROR",payload:ts(p.error,"Retry failed")}),!1},createRule:async m=>{const p=await Re.createRule(m);return p.data?(n({type:"ADD_RULE",payload:p.data.rule}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to create rule")}),!1)},updateRule:async(m,p)=>{const g=await Re.updateRule(m,p);return g.data?(n({type:"UPDATE_RULE",payload:g.data.rule}),!0):(n({type:"SET_ERROR",payload:ts(g.error,"Failed to update rule")}),!1)},deleteRule:async m=>{const p=await Re.deleteRule(m);return p.data?.success?(n({type:"REMOVE_RULE",payload:m}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to delete rule")}),!1)},toggleRule:async m=>{const p=await Re.toggleRule(m);return p.data?(n({type:"UPDATE_RULE",payload:p.data.rule}),!0):(n({type:"SET_ERROR",payload:ts(p.error,"Failed to toggle rule")}),!1)}};return o.jsx(Xj.Provider,{value:{state:t,isSubscribed:d,dispatch:n,actions:h},children:e})}function Tn(){const e=w.useContext(Xj);if(!e)throw new Error("useApp must be used within AppProvider");return e}const Jj=w.createContext(void 0);function n3({children:e,value:t}){return o.jsx(Jj.Provider,{value:t,children:e})}function s3(){return w.useContext(Jj)}const Qj=w.createContext(null);function r3({children:e}){const[t,n]=w.useState(!1),r=()=>n(!0),i=()=>n(!1);return o.jsx(Qj.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:i},children:e})}function Zj(){const e=w.useContext(Qj);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}const Ge=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Ge.displayName="Card";const Mt=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-6",e),...t}));Mt.displayName="CardHeader";const $t=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("font-semibold leading-none tracking-tight",e),...t}));$t.displayName="CardTitle";const xs=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));xs.displayName="CardDescription";const wt=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));wt.displayName="CardContent";const ek=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));ek.displayName="CardFooter";class a3 extends w.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught an error:",t,n)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:o.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:o.jsxs(Ge,{className:"max-w-md w-full p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(ea,{className:"w-8 h-8"})}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&o.jsx("pre",{className:"text-xs text-left bg-secondary p-3 rounded-lg mb-6 overflow-auto max-h-32",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsxs(Z,{onClick:this.handleReset,variant:"outline",children:[o.jsx(Jt,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function yt({size:e="md",className:t,text:n}){const r={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return o.jsxs("div",{className:pe("flex flex-col items-center justify-center gap-3",t),children:[o.jsx(jt,{className:pe("animate-spin text-primary",r[e])}),n&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})}function rd({text:e="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(yt,{size:"lg",text:e})})}function i3(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(yt,{size:"md"})})}const Dg=w.createContext({});function Og(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const tk=typeof window<"u",nk=tk?w.useLayoutEffect:w.useEffect,Td=w.createContext(null);function Mg(e,t){e.indexOf(t)===-1&&e.push(t)}function Pg(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const zs=(e,t,n)=>n>t?t:n<e?e:n;let zg=()=>{};const dr={},sk=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function rk(e){return typeof e=="object"&&e!==null}const ak=e=>/^0[^.\s]+$/u.test(e);function Lg(e){let t;return()=>(t===void 0&&(t=e()),t)}const as=e=>e,o3=(e,t)=>n=>t(e(n)),Ql=(...e)=>e.reduce(o3),Ul=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Ig{constructor(){this.subscriptions=[]}add(t){return Mg(this.subscriptions,t),()=>Pg(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let l=0;l<i;l++){const u=this.subscriptions[l];u&&u(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ur=e=>e*1e3,rs=e=>e/1e3;function ik(e,t){return t?e*(1e3/t):0}const ok=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,l3=1e-7,c3=12;function u3(e,t,n,r,i){let l,u,d=0;do u=t+(n-t)/2,l=ok(u,r,i)-e,l>0?n=u:t=u;while(Math.abs(l)>l3&&++d<c3);return u}function Zl(e,t,n,r){if(e===t&&n===r)return as;const i=l=>u3(l,0,1,e,n);return l=>l===0||l===1?l:ok(i(l),t,r)}const lk=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ck=e=>t=>1-e(1-t),uk=Zl(.33,1.53,.69,.99),Ug=ck(uk),dk=lk(Ug),fk=e=>(e*=2)<1?.5*Ug(e):.5*(2-Math.pow(2,-10*(e-1))),Bg=e=>1-Math.sin(Math.acos(e)),hk=ck(Bg),mk=lk(Bg),d3=Zl(.42,0,1,1),f3=Zl(0,0,.58,1),pk=Zl(.42,0,.58,1),h3=e=>Array.isArray(e)&&typeof e[0]!="number",gk=e=>Array.isArray(e)&&typeof e[0]=="number",m3={linear:as,easeIn:d3,easeInOut:pk,easeOut:f3,circIn:Bg,circInOut:mk,circOut:hk,backIn:Ug,backInOut:dk,backOut:uk,anticipate:fk},p3=e=>typeof e=="string",_w=e=>{if(gk(e)){zg(e.length===4);const[t,n,r,i]=e;return Zl(t,n,r,i)}else if(p3(e))return m3[e];return e},Nu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function g3(e,t){let n=new Set,r=new Set,i=!1,l=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function h(p){u.has(p)&&(m.schedule(p),e()),p(d)}const m={schedule:(p,g=!1,v=!1)=>{const j=v&&i?n:r;return g&&u.add(p),j.has(p)||j.add(p),p},cancel:p=>{r.delete(p),u.delete(p)},process:p=>{if(d=p,i){l=!0;return}i=!0,[n,r]=[r,n],n.forEach(h),n.clear(),i=!1,l&&(l=!1,m.process(p))}};return m}const y3=40;function yk(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=Nu.reduce((T,D)=>(T[D]=g3(l),T),{}),{setup:d,read:h,resolveKeyframes:m,preUpdate:p,update:g,preRender:v,render:b,postRender:j}=u,_=()=>{const T=dr.useManualTiming?i.timestamp:performance.now();n=!1,dr.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(T-i.timestamp,y3),1)),i.timestamp=T,i.isProcessing=!0,d.process(i),h.process(i),m.process(i),p.process(i),g.process(i),v.process(i),b.process(i),j.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(_))},S=()=>{n=!0,r=!0,i.isProcessing||e(_)};return{schedule:Nu.reduce((T,D)=>{const L=u[D];return T[D]=(O,B=!1,M=!1)=>(n||S(),L.schedule(O,B,M)),T},{}),cancel:T=>{for(let D=0;D<Nu.length;D++)u[Nu[D]].cancel(T)},state:i,steps:u}}const{schedule:vt,cancel:ta,state:on,steps:ym}=yk(typeof requestAnimationFrame<"u"?requestAnimationFrame:as,!0);let Hu;function x3(){Hu=void 0}const yn={now:()=>(Hu===void 0&&yn.set(on.isProcessing||dr.useManualTiming?on.timestamp:performance.now()),Hu),set:e=>{Hu=e,queueMicrotask(x3)}},xk=e=>t=>typeof t=="string"&&t.startsWith(e),vk=xk("--"),v3=xk("var(--"),Vg=e=>v3(e)?b3.test(e.split("/*")[0].trim()):!1,b3=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Nw(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const ho={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Bl={...ho,transform:e=>zs(0,1,e)},Tu={...ho,default:1},wl=e=>Math.round(e*1e5)/1e5,Fg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function w3(e){return e==null}const S3=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$g=(e,t)=>n=>!!(typeof n=="string"&&S3.test(n)&&n.startsWith(e)||t&&!w3(n)&&Object.prototype.hasOwnProperty.call(n,t)),bk=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,l,u,d]=r.match(Fg);return{[e]:parseFloat(i),[t]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},j3=e=>zs(0,255,e),xm={...ho,transform:e=>Math.round(j3(e))},Ma={test:$g("rgb","red"),parse:bk("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+xm.transform(e)+", "+xm.transform(t)+", "+xm.transform(n)+", "+wl(Bl.transform(r))+")"};function k3(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const _p={test:$g("#"),parse:k3,transform:Ma.transform},ec=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Hr=ec("deg"),Ps=ec("%"),Se=ec("px"),_3=ec("vh"),N3=ec("vw"),Tw={...Ps,parse:e=>Ps.parse(e)/100,transform:e=>Ps.transform(e*100)},Yi={test:$g("hsl","hue"),parse:bk("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ps.transform(wl(t))+", "+Ps.transform(wl(n))+", "+wl(Bl.transform(r))+")"},Ft={test:e=>Ma.test(e)||_p.test(e)||Yi.test(e),parse:e=>Ma.test(e)?Ma.parse(e):Yi.test(e)?Yi.parse(e):_p.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ma.transform(e):Yi.transform(e),getAnimatableNone:e=>{const t=Ft.parse(e);return t.alpha=0,Ft.transform(t)}},T3=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function E3(e){return isNaN(e)&&typeof e=="string"&&(e.match(Fg)?.length||0)+(e.match(T3)?.length||0)>0}const wk="number",Sk="color",C3="var",A3="var(",Ew="${}",R3=/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 Vl(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let l=0;const d=t.replace(R3,h=>(Ft.test(h)?(r.color.push(l),i.push(Sk),n.push(Ft.parse(h))):h.startsWith(A3)?(r.var.push(l),i.push(C3),n.push(h)):(r.number.push(l),i.push(wk),n.push(parseFloat(h))),++l,Ew)).split(Ew);return{values:n,split:d,indexes:r,types:i}}function jk(e){return Vl(e).values}function kk(e){const{split:t,types:n}=Vl(e),r=t.length;return i=>{let l="";for(let u=0;u<r;u++)if(l+=t[u],i[u]!==void 0){const d=n[u];d===wk?l+=wl(i[u]):d===Sk?l+=Ft.transform(i[u]):l+=i[u]}return l}}const D3=e=>typeof e=="number"?0:Ft.test(e)?Ft.getAnimatableNone(e):e;function O3(e){const t=jk(e);return kk(e)(t.map(D3))}const na={test:E3,parse:jk,createTransformer:kk,getAnimatableNone:O3};function vm(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function M3({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,l=0,u=0;if(!t)i=l=u=n;else{const d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;i=vm(h,d,e+1/3),l=vm(h,d,e),u=vm(h,d,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:r}}function ad(e,t){return n=>n>0?t:e}const kt=(e,t,n)=>e+(t-e)*n,bm=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},P3=[_p,Ma,Yi],z3=e=>P3.find(t=>t.test(e));function Cw(e){const t=z3(e);if(!t)return!1;let n=t.parse(e);return t===Yi&&(n=M3(n)),n}const Aw=(e,t)=>{const n=Cw(e),r=Cw(t);if(!n||!r)return ad(e,t);const i={...n};return l=>(i.red=bm(n.red,r.red,l),i.green=bm(n.green,r.green,l),i.blue=bm(n.blue,r.blue,l),i.alpha=kt(n.alpha,r.alpha,l),Ma.transform(i))},Np=new Set(["none","hidden"]);function L3(e,t){return Np.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function I3(e,t){return n=>kt(e,t,n)}function qg(e){return typeof e=="number"?I3:typeof e=="string"?Vg(e)?ad:Ft.test(e)?Aw:V3:Array.isArray(e)?_k:typeof e=="object"?Ft.test(e)?Aw:U3:ad}function _k(e,t){const n=[...e],r=n.length,i=e.map((l,u)=>qg(l)(l,t[u]));return l=>{for(let u=0;u<r;u++)n[u]=i[u](l);return n}}function U3(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=qg(e[i])(e[i],t[i]));return i=>{for(const l in r)n[l]=r[l](i);return n}}function B3(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],u=e.indexes[l][r[l]],d=e.values[u]??0;n[i]=d,r[l]++}return n}const V3=(e,t)=>{const n=na.createTransformer(t),r=Vl(e),i=Vl(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Np.has(e)&&!i.values.length||Np.has(t)&&!r.values.length?L3(e,t):Ql(_k(B3(r,i),i.values),n):ad(e,t)};function Nk(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?kt(e,t,n):qg(e)(e,t)}const F3=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>vt.update(t,n),stop:()=>ta(t),now:()=>on.isProcessing?on.timestamp:yn.now()}},Tk=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let l=0;l<i;l++)r+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},id=2e4;function Hg(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<id;)t+=n,r=e.next(t);return t>=id?1/0:t}function $3(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(Hg(r),id);return{type:"keyframes",ease:l=>r.next(i*l).value/t,duration:rs(i)}}const q3=5;function Ek(e,t,n){const r=Math.max(t-q3,0);return ik(n-e(r),t-r)}const Et={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},wm=.001;function H3({duration:e=Et.duration,bounce:t=Et.bounce,velocity:n=Et.velocity,mass:r=Et.mass}){let i,l,u=1-t;u=zs(Et.minDamping,Et.maxDamping,u),e=zs(Et.minDuration,Et.maxDuration,rs(e)),u<1?(i=m=>{const p=m*u,g=p*e,v=p-n,b=Tp(m,u),j=Math.exp(-g);return wm-v/b*j},l=m=>{const g=m*u*e,v=g*n+n,b=Math.pow(u,2)*Math.pow(m,2)*e,j=Math.exp(-g),_=Tp(Math.pow(m,2),u);return(-i(m)+wm>0?-1:1)*((v-b)*j)/_}):(i=m=>{const p=Math.exp(-m*e),g=(m-n)*e+1;return-wm+p*g},l=m=>{const p=Math.exp(-m*e),g=(n-m)*(e*e);return p*g});const d=5/e,h=K3(i,l,d);if(e=ur(e),isNaN(h))return{stiffness:Et.stiffness,damping:Et.damping,duration:e};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:u*2*Math.sqrt(r*m),duration:e}}}const G3=12;function K3(e,t,n){let r=n;for(let i=1;i<G3;i++)r=r-e(r)/t(r);return r}function Tp(e,t){return e*Math.sqrt(1-t*t)}const Y3=["duration","bounce"],W3=["stiffness","damping","mass"];function Rw(e,t){return t.some(n=>e[n]!==void 0)}function X3(e){let t={velocity:Et.velocity,stiffness:Et.stiffness,damping:Et.damping,mass:Et.mass,isResolvedFromDuration:!1,...e};if(!Rw(e,W3)&&Rw(e,Y3))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,l=2*zs(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Et.mass,stiffness:i,damping:l}}else{const n=H3(e);t={...t,...n,mass:Et.mass},t.isResolvedFromDuration=!0}return t}function od(e=Et.visualDuration,t=Et.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:m,mass:p,duration:g,velocity:v,isResolvedFromDuration:b}=X3({...n,velocity:-rs(n.velocity||0)}),j=v||0,_=m/(2*Math.sqrt(h*p)),S=u-l,N=rs(Math.sqrt(h/p)),C=Math.abs(S)<5;r||(r=C?Et.restSpeed.granular:Et.restSpeed.default),i||(i=C?Et.restDelta.granular:Et.restDelta.default);let T;if(_<1){const L=Tp(N,_);T=O=>{const B=Math.exp(-_*N*O);return u-B*((j+_*N*S)/L*Math.sin(L*O)+S*Math.cos(L*O))}}else if(_===1)T=L=>u-Math.exp(-N*L)*(S+(j+N*S)*L);else{const L=N*Math.sqrt(_*_-1);T=O=>{const B=Math.exp(-_*N*O),M=Math.min(L*O,300);return u-B*((j+_*N*S)*Math.sinh(M)+L*S*Math.cosh(M))/L}}const D={calculatedDuration:b&&g||null,next:L=>{const O=T(L);if(b)d.done=L>=g;else{let B=L===0?j:0;_<1&&(B=L===0?ur(j):Ek(T,L,O));const M=Math.abs(B)<=r,q=Math.abs(u-O)<=i;d.done=M&&q}return d.value=d.done?u:O,d},toString:()=>{const L=Math.min(Hg(D),id),O=Tk(B=>D.next(L*B).value,L,30);return L+"ms "+O},toTransition:()=>{}};return D}od.applyToOptions=e=>{const t=$3(e,100,od);return e.ease=t.ease,e.duration=ur(t.duration),e.type="keyframes",e};function Ep({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:m=.5,restSpeed:p}){const g=e[0],v={done:!1,value:g},b=M=>d!==void 0&&M<d||h!==void 0&&M>h,j=M=>d===void 0?h:h===void 0||Math.abs(d-M)<Math.abs(h-M)?d:h;let _=n*t;const S=g+_,N=u===void 0?S:u(S);N!==S&&(_=N-g);const C=M=>-_*Math.exp(-M/r),T=M=>N+C(M),D=M=>{const q=C(M),R=T(M);v.done=Math.abs(q)<=m,v.value=v.done?N:R};let L,O;const B=M=>{b(v.value)&&(L=M,O=od({keyframes:[v.value,j(v.value)],velocity:Ek(T,M,v.value),damping:i,stiffness:l,restDelta:m,restSpeed:p}))};return B(0),{calculatedDuration:null,next:M=>{let q=!1;return!O&&L===void 0&&(q=!0,D(M),B(M)),L!==void 0&&M>=L?O.next(M-L):(!q&&D(M),v)}}}function J3(e,t,n){const r=[],i=n||dr.mix||Nk,l=e.length-1;for(let u=0;u<l;u++){let d=i(e[u],e[u+1]);if(t){const h=Array.isArray(t)?t[u]||as:t;d=Ql(h,d)}r.push(d)}return r}function Q3(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const l=e.length;if(zg(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const d=J3(t,r,i),h=d.length,m=p=>{if(u&&p<e[0])return t[0];let g=0;if(h>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const v=Ul(e[g],e[g+1],p);return d[g](v)};return n?p=>m(zs(e[0],e[l-1],p)):m}function Z3(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Ul(0,t,r);e.push(kt(n,1,i))}}function eM(e){const t=[0];return Z3(t,e.length-1),t}function tM(e,t){return e.map(n=>n*t)}function nM(e,t){return e.map(()=>t||pk).splice(0,e.length-1)}function Sl({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=h3(r)?r.map(_w):_w(r),l={done:!1,value:t[0]},u=tM(n&&n.length===t.length?n:eM(t),e),d=Q3(u,t,{ease:Array.isArray(i)?i:nM(t,i)});return{calculatedDuration:e,next:h=>(l.value=d(h),l.done=h>=e,l)}}const sM=e=>e!==null;function Gg(e,{repeat:t,repeatType:n="loop"},r,i=1){const l=e.filter(sM),d=i<0||t&&n!=="loop"&&t%2===1?0:l.length-1;return!d||r===void 0?l[d]:r}const rM={decay:Ep,inertia:Ep,tween:Sl,keyframes:Sl,spring:od};function Ck(e){typeof e.type=="string"&&(e.type=rM[e.type])}class Kg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const aM=e=>e/100;class Yg extends Kg{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==yn.now()&&this.tick(yn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Ck(t);const{type:n=Sl,repeat:r=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:d}=t;const h=n||Sl;h!==Sl&&typeof d[0]!="number"&&(this.mixKeyframes=Ql(aM,Nk(d[0],d[1])),d=[0,100]);const m=h({...t,keyframes:d});l==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...d].reverse(),velocity:-u})),m.calculatedDuration===null&&(m.calculatedDuration=Hg(m));const{calculatedDuration:p}=m;this.calculatedDuration=p,this.resolvedDuration=p+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=m}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:p,repeat:g,repeatType:v,repeatDelay:b,type:j,onUpdate:_,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const N=this.currentTime-m*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?N<0:N>i;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let T=this.currentTime,D=r;if(g){const M=Math.min(this.currentTime,i)/d;let q=Math.floor(M),R=M%1;!R&&M>=1&&(R=1),R===1&&q--,q=Math.min(q,g+1),q%2&&(v==="reverse"?(R=1-R,b&&(R-=b/d)):v==="mirror"&&(D=u)),T=zs(0,1,R)*d}const L=C?{done:!1,value:p[0]}:D.next(T);l&&(L.value=l(L.value));let{done:O}=L;!C&&h!==null&&(O=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return B&&j!==Ep&&(L.value=Gg(p,this.options,S,this.speed)),_&&_(L.value),B&&this.finish(),L}then(t,n){return this.finished.then(t,n)}get duration(){return rs(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+rs(t)}get time(){return rs(this.currentTime)}set time(t){t=ur(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(yn.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=rs(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=F3,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),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=n??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(yn.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(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function iM(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Pa=e=>e*180/Math.PI,Cp=e=>{const t=Pa(Math.atan2(e[1],e[0]));return Ap(t)},oM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Cp,rotateZ:Cp,skewX:e=>Pa(Math.atan(e[1])),skewY:e=>Pa(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ap=e=>(e=e%360,e<0&&(e+=360),e),Dw=Cp,Ow=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Mw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),lM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ow,scaleY:Mw,scale:e=>(Ow(e)+Mw(e))/2,rotateX:e=>Ap(Pa(Math.atan2(e[6],e[5]))),rotateY:e=>Ap(Pa(Math.atan2(-e[2],e[0]))),rotateZ:Dw,rotate:Dw,skewX:e=>Pa(Math.atan(e[4])),skewY:e=>Pa(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Rp(e){return e.includes("scale")?1:0}function Dp(e,t){if(!e||e==="none")return Rp(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=lM,i=n;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=oM,i=d}if(!i)return Rp(t);const l=r[t],u=i[1].split(",").map(uM);return typeof l=="function"?l(u):u[l]}const cM=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Dp(n,t)};function uM(e){return parseFloat(e.trim())}const mo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],po=new Set(mo),Pw=e=>e===ho||e===Se,dM=new Set(["x","y","z"]),fM=mo.filter(e=>!dM.has(e));function hM(e){const t=[];return fM.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Xr={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Dp(t,"x"),y:(e,{transform:t})=>Dp(t,"y")};Xr.translateX=Xr.x;Xr.translateY=Xr.y;const za=new Set;let Op=!1,Mp=!1,Pp=!1;function Ak(){if(Mp){const e=Array.from(za).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=hM(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([l,u])=>{r.getValue(l)?.set(u)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Mp=!1,Op=!1,za.forEach(e=>e.complete(Pp)),za.clear()}function Rk(){za.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mp=!0)})}function mM(){Pp=!0,Rk(),Ak(),Pp=!1}class Wg{constructor(t,n,r,i,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(za.add(this),Op||(Op=!0,vt.read(Rk),vt.resolveKeyframes(Ak))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const l=i?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(r&&n){const d=r.readValue(n,u);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=u),i&&l===void 0&&i.set(t[0])}iM(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),za.delete(this)}cancel(){this.state==="scheduled"&&(za.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const pM=e=>e.startsWith("--");function gM(e,t,n){pM(t)?e.style.setProperty(t,n):e.style[t]=n}const yM=Lg(()=>window.ScrollTimeline!==void 0),xM={};function vM(e,t){const n=Lg(e);return()=>xM[t]??n()}const Dk=vM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),yl=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,zw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:yl([0,.65,.55,1]),circOut:yl([.55,0,1,.45]),backIn:yl([.31,.01,.66,-.59]),backOut:yl([.33,1.53,.69,.99])};function Ok(e,t){if(e)return typeof e=="function"?Dk()?Tk(e,t):"ease-out":gk(e)?yl(e):Array.isArray(e)?e.map(n=>Ok(n,t)||zw.easeOut):zw[e]}function bM(e,t,n,{delay:r=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:h}={},m=void 0){const p={[t]:n};h&&(p.offset=h);const g=Ok(d,i);Array.isArray(g)&&(p.easing=g);const v={delay:r,duration:i,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return m&&(v.pseudoElement=m),e.animate(p,v)}function Mk(e){return typeof e=="function"&&"applyToOptions"in e}function wM({type:e,...t}){return Mk(e)&&Dk()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class SM extends Kg{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,zg(typeof t.type!="string");const m=wM(t);this.animation=bM(n,r,i,m,l),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=Gg(i,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(p):gM(n,r,p),this.animation.cancel()}h?.(),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:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return rs(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+rs(t)}get time(){return rs(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ur(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&yM()?(this.animation.timeline=t,as):n(this)}}const Pk={anticipate:fk,backInOut:dk,circInOut:mk};function jM(e){return e in Pk}function kM(e){typeof e.ease=="string"&&jM(e.ease)&&(e.ease=Pk[e.ease])}const Sm=10;class _M extends SM{constructor(t){kM(t),Ck(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:l,...u}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const d=new Yg({...u,autoplay:!1}),h=Math.max(Sm,yn.now()-this.startTime),m=zs(0,Sm,h-Sm);n.setWithVelocity(d.sample(Math.max(0,h-m)).value,d.sample(h).value,m),d.stop()}}const Lw=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(na.test(e)||e==="0")&&!e.startsWith("url("));function NM(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function TM(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=Lw(i,t),d=Lw(l,t);return!u||!d?!1:NM(e)||(n==="spring"||Mk(n))&&r}function zp(e){e.duration=0,e.type="keyframes"}const EM=new Set(["opacity","clipPath","filter","transform"]),CM=Lg(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function AM(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=t.owner.getProps();return CM()&&n&&EM.has(n)&&(n!=="transform"||!m)&&!h&&!r&&i!=="mirror"&&l!==0&&u!=="inertia"}const RM=40;class DM extends Kg{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:u="loop",keyframes:d,name:h,motionValue:m,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yn.now();const v={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:l,repeatType:u,name:h,motionValue:m,element:p,...g},b=p?.KeyframeResolver||Wg;this.keyframeResolver=new b(d,(j,_,S)=>this.onKeyframesResolved(j,_,v,!S),h,m,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:h,isHandoff:m,onUpdate:p}=r;this.resolvedAt=yn.now(),TM(t,l,u,d)||((dr.instantAnimations||!h)&&p?.(Gg(t,r,n)),t[0]=t[t.length-1],zp(r),r.repeat=0);const v={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>RM?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},b=!m&&AM(v),j=v.motionValue?.owner?.current,_=b?new _M({...v,element:j}):new Yg(v);_.finished.then(()=>{this.notifyFinished()}).catch(as),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),mM()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function zk(e,t,n,r=0,i=1){const l=Array.from(e).sort((m,p)=>m.sortNodePosition(p)).indexOf(t),u=e.size,d=(u-1)*r;return typeof n=="function"?n(l,u):i===1?l*r:d-l*r}const OM=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function MM(e){const t=OM.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Lk(e,t,n=1){const[r,i]=MM(e);if(!r)return;const l=window.getComputedStyle(t).getPropertyValue(r);if(l){const u=l.trim();return sk(u)?parseFloat(u):u}return Vg(i)?Lk(i,t,n+1):i}const PM={type:"spring",stiffness:500,damping:25,restSpeed:10},zM=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LM={type:"keyframes",duration:.8},IM={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},UM=(e,{keyframes:t})=>t.length>2?LM:po.has(e)?e.startsWith("scale")?zM(t[1]):PM:IM,BM=e=>e!==null;function VM(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(BM),l=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[l]}function Xg(e,t){return e?.[t]??e?.default??e}function FM({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:m,...p}){return!!Object.keys(p).length}const Jg=(e,t,n,r={},i,l)=>u=>{const d=Xg(r,e)||{},h=d.delay||r.delay||0;let{elapsed:m=0}=r;m=m-ur(h);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-m,onUpdate:v=>{t.set(v),d.onUpdate&&d.onUpdate(v)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:l?void 0:i};FM(d)||Object.assign(p,UM(e,p)),p.duration&&(p.duration=ur(p.duration)),p.repeatDelay&&(p.repeatDelay=ur(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(zp(p),p.delay===0&&(g=!0)),(dr.instantAnimations||dr.skipAnimations)&&(g=!0,zp(p),p.delay=0),p.allowFlatten=!d.type&&!d.ease,g&&!l&&t.get()!==void 0){const v=VM(p.keyframes,d);if(v!==void 0){vt.update(()=>{p.onUpdate(v),p.onComplete()});return}}return d.isSync?new Yg(p):new DM(p)};function Iw(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Qg(e,t,n,r){if(typeof t=="function"){const[i,l]=Iw(r);t=t(n!==void 0?n:e.custom,i,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,l]=Iw(r);t=t(n!==void 0?n:e.custom,i,l)}return t}function Zi(e,t,n){const r=e.getProps();return Qg(r,t,n!==void 0?n:r.custom,e)}const Ik=new Set(["width","height","top","left","right","bottom",...mo]),Uw=30,$M=e=>!isNaN(parseFloat(e));class qM{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=yn.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=yn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=$M(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Ig);const r=this.events[t].add(n);return t==="change"?()=>{r(),vt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=yn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Uw)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Uw);return ik(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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 io(e,t){return new qM(e,t)}const Lp=e=>Array.isArray(e);function HM(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,io(n))}function GM(e){return Lp(e)?e[e.length-1]||0:e}function KM(e,t){const n=Zi(e,t);let{transitionEnd:r={},transition:i={},...l}=n||{};l={...l,...r};for(const u in l){const d=GM(l[u]);HM(e,u,d)}}const un=e=>!!(e&&e.getVelocity);function YM(e){return!!(un(e)&&e.add)}function Ip(e,t){const n=e.getValue("willChange");if(YM(n))return n.add(t);if(!n&&dr.WillChange){const r=new dr.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Zg(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const WM="framerAppearId",Uk="data-"+Zg(WM);function Bk(e){return e.props[Uk]}function XM({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Vk(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:l=e.getDefaultTransition(),transitionEnd:u,...d}=t;const h=l?.reduceMotion;r&&(l=r);const m=[],p=i&&e.animationState&&e.animationState.getState()[i];for(const g in d){const v=e.getValue(g,e.latestValues[g]??null),b=d[g];if(b===void 0||p&&XM(p,g))continue;const j={delay:n,...Xg(l||{},g)},_=v.get();if(_!==void 0&&!v.isAnimating&&!Array.isArray(b)&&b===_&&!j.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const T=Bk(e);if(T){const D=window.MotionHandoffAnimation(T,g,vt);D!==null&&(j.startTime=D,S=!0)}}Ip(e,g);const N=h??e.shouldReduceMotion;v.start(Jg(g,v,b,N&&Ik.has(g)?{type:!1}:j,e,S));const C=v.animation;C&&m.push(C)}return u&&Promise.all(m).then(()=>{vt.update(()=>{u&&KM(e,u)})}),m}function Up(e,t,n={}){const r=Zi(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const l=r?()=>Promise.all(Vk(e,r,n)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:p,staggerDirection:g}=i;return JM(e,t,h,m,p,g,n)}:()=>Promise.resolve(),{when:d}=i;if(d){const[h,m]=d==="beforeChildren"?[l,u]:[u,l];return h().then(()=>m())}else return Promise.all([l(),u(n.delay)])}function JM(e,t,n=0,r=0,i=0,l=1,u){const d=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),d.push(Up(h,t,{...u,delay:n+(typeof r=="function"?0:r)+zk(e.variantChildren,h,r,i,l)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(d)}function QM(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(l=>Up(e,l,n));r=Promise.all(i)}else if(typeof t=="string")r=Up(e,t,n);else{const i=typeof t=="function"?Zi(e,t,n.custom):t;r=Promise.all(Vk(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const ZM={test:e=>e==="auto",parse:e=>e},Fk=e=>t=>t.test(e),$k=[ho,Se,Ps,Hr,N3,_3,ZM],Bw=e=>$k.find(Fk(e));function eP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ak(e):!0}const tP=new Set(["brightness","contrast","saturate","opacity"]);function nP(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Fg)||[];if(!r)return e;const i=n.replace(r,"");let l=tP.has(t)?1:0;return r!==n&&(l*=100),t+"("+l+i+")"}const sP=/\b([a-z-]*)\(.*?\)/gu,Bp={...na,getAnimatableNone:e=>{const t=e.match(sP);return t?t.map(nP).join(" "):e}},Vw={...ho,transform:Math.round},rP={rotate:Hr,rotateX:Hr,rotateY:Hr,rotateZ:Hr,scale:Tu,scaleX:Tu,scaleY:Tu,scaleZ:Tu,skew:Hr,skewX:Hr,skewY:Hr,distance:Se,translateX:Se,translateY:Se,translateZ:Se,x:Se,y:Se,z:Se,perspective:Se,transformPerspective:Se,opacity:Bl,originX:Tw,originY:Tw,originZ:Se},ey={borderWidth:Se,borderTopWidth:Se,borderRightWidth:Se,borderBottomWidth:Se,borderLeftWidth:Se,borderRadius:Se,borderTopLeftRadius:Se,borderTopRightRadius:Se,borderBottomRightRadius:Se,borderBottomLeftRadius:Se,width:Se,maxWidth:Se,height:Se,maxHeight:Se,top:Se,right:Se,bottom:Se,left:Se,inset:Se,insetBlock:Se,insetBlockStart:Se,insetBlockEnd:Se,insetInline:Se,insetInlineStart:Se,insetInlineEnd:Se,padding:Se,paddingTop:Se,paddingRight:Se,paddingBottom:Se,paddingLeft:Se,paddingBlock:Se,paddingBlockStart:Se,paddingBlockEnd:Se,paddingInline:Se,paddingInlineStart:Se,paddingInlineEnd:Se,margin:Se,marginTop:Se,marginRight:Se,marginBottom:Se,marginLeft:Se,marginBlock:Se,marginBlockStart:Se,marginBlockEnd:Se,marginInline:Se,marginInlineStart:Se,marginInlineEnd:Se,fontSize:Se,backgroundPositionX:Se,backgroundPositionY:Se,...rP,zIndex:Vw,fillOpacity:Bl,strokeOpacity:Bl,numOctaves:Vw},aP={...ey,color:Ft,backgroundColor:Ft,outlineColor:Ft,fill:Ft,stroke:Ft,borderColor:Ft,borderTopColor:Ft,borderRightColor:Ft,borderBottomColor:Ft,borderLeftColor:Ft,filter:Bp,WebkitFilter:Bp},qk=e=>aP[e];function Hk(e,t){let n=qk(e);return n!==Bp&&(n=na),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iP=new Set(["auto","none","0"]);function oP(e,t,n){let r=0,i;for(;r<e.length&&!i;){const l=e[r];typeof l=="string"&&!iP.has(l)&&Vl(l).values.length&&(i=e[r]),r++}if(i&&n)for(const l of t)e[l]=Hk(n,i)}class lP extends Wg{constructor(t,n,r,i,l){super(t,n,r,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let p=0;p<t.length;p++){let g=t[p];if(typeof g=="string"&&(g=g.trim(),Vg(g))){const v=Lk(g,n.current);v!==void 0&&(t[p]=v),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Ik.has(r)||t.length!==2)return;const[i,l]=t,u=Bw(i),d=Bw(l),h=Nw(i),m=Nw(l);if(h!==m&&Xr[r]){this.needsMeasurement=!0;return}if(u!==d)if(Pw(u)&&Pw(d))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else Xr[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||eP(t[i]))&&r.push(i);r.length&&oP(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Xr[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const l=r.length-1,u=r[l];r[l]=Xr[n](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{t.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function cP(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const Gk=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Vp(e){return rk(e)&&"offsetHeight"in e}const{schedule:ty}=yk(queueMicrotask,!1),ps={x:!1,y:!1};function Kk(){return ps.x||ps.y}function uP(e){return e==="x"||e==="y"?ps[e]?null:(ps[e]=!0,()=>{ps[e]=!1}):ps.x||ps.y?null:(ps.x=ps.y=!0,()=>{ps.x=ps.y=!1})}function Yk(e,t){const n=cP(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Fw(e){return!(e.pointerType==="touch"||Kk())}function dP(e,t,n={}){const[r,i,l]=Yk(e,n),u=d=>{if(!Fw(d))return;const{target:h}=d,m=t(h,d);if(typeof m!="function"||!h)return;const p=g=>{Fw(g)&&(m(g),h.removeEventListener("pointerleave",p))};h.addEventListener("pointerleave",p,i)};return r.forEach(d=>{d.addEventListener("pointerenter",u,i)}),l}const Wk=(e,t)=>t?e===t?!0:Wk(e,t.parentElement):!1,ny=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,fP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Xk(e){return fP.has(e.tagName)||e.isContentEditable===!0}const Gu=new WeakSet;function $w(e){return t=>{t.key==="Enter"&&e(t)}}function jm(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const hP=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=$w(()=>{if(Gu.has(n))return;jm(n,"down");const i=$w(()=>{jm(n,"up")}),l=()=>jm(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",l,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function qw(e){return ny(e)&&!Kk()}function mP(e,t,n={}){const[r,i,l]=Yk(e,n),u=d=>{const h=d.currentTarget;if(!qw(d))return;Gu.add(h);const m=t(h,d),p=(b,j)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),Gu.has(h)&&Gu.delete(h),qw(b)&&typeof m=="function"&&m(b,{success:j})},g=b=>{p(b,h===window||h===document||n.useGlobalTarget||Wk(h,b.target))},v=b=>{p(b,!1)};window.addEventListener("pointerup",g,i),window.addEventListener("pointercancel",v,i)};return r.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,i),Vp(d)&&(d.addEventListener("focus",m=>hP(m,i)),!Xk(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function Jk(e){return rk(e)&&"ownerSVGElement"in e}function pP(e){return Jk(e)&&e.tagName==="svg"}const gP=[...$k,Ft,na],yP=e=>gP.find(Fk(e)),Hw=()=>({translate:0,scale:1,origin:0,originPoint:0}),Wi=()=>({x:Hw(),y:Hw()}),Gw=()=>({min:0,max:0}),Kt=()=>({x:Gw(),y:Gw()}),Fp={current:null},Qk={current:!1},xP=typeof window<"u";function vP(){if(Qk.current=!0,!!xP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Fp.current=e.matches;e.addEventListener("change",t),t()}else Fp.current=!1}const bP=new WeakMap;function Ed(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Fl(e){return typeof e=="string"||Array.isArray(e)}const sy=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ry=["initial",...sy];function Cd(e){return Ed(e.animate)||ry.some(t=>Fl(e[t]))}function Zk(e){return!!(Cd(e)||e.variants)}function wP(e,t,n){for(const r in t){const i=t[r],l=n[r];if(un(i))e.addValue(r,i);else if(un(l))e.addValue(r,io(i,{owner:e}));else if(l!==i)if(e.hasValue(r)){const u=e.getValue(r);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(r);e.addValue(r,io(u!==void 0?u:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Kw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ld={};function e_(e){ld=e}function SP(){return ld}class jP{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Wg,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 v=yn.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,vt.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=Cd(n),this.isVariantNode=Zk(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in g){const b=g[v];h[v]!==void 0&&un(b)&&b.set(h[v])}}mount(t){this.current=t,bP.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Qk.current||vP(),this.shouldReduceMotion=Fp.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),ta(this.notifyUpdate),ta(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=po.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&vt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),l&&l(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ld){const n=ld[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Kw.length;r++){const i=Kw[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const l="on"+i,u=t[l];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=wP(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=io(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(sk(r)||ak(r))?r=parseFloat(r):!yP(r)&&na.test(n)&&(r=Hk(t,n)),this.setBaseTarget(t,un(r)?r.get():r)),un(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const l=Qg(this.props,n,this.presenceContext?.custom);l&&(r=l[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!un(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ig),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){ty.render(this.render)}}class t_ extends jP{constructor(){super(...arguments),this.KeyframeResolver=lP}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;un(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class sa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function n_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function kP({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function _P(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function km(e){return e===void 0||e===1}function $p({scale:e,scaleX:t,scaleY:n}){return!km(e)||!km(t)||!km(n)}function Ca(e){return $p(e)||s_(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function s_(e){return Yw(e.x)||Yw(e.y)}function Yw(e){return e&&e!=="0%"}function cd(e,t,n){const r=e-n,i=t*r;return n+i}function Ww(e,t,n,r,i){return i!==void 0&&(e=cd(e,i,r)),cd(e,n,r)+t}function qp(e,t=0,n=1,r,i){e.min=Ww(e.min,t,n,r,i),e.max=Ww(e.max,t,n,r,i)}function r_(e,{x:t,y:n}){qp(e.x,t.translate,t.scale,t.originPoint),qp(e.y,n.translate,n.scale,n.originPoint)}const Xw=.999999999999,Jw=1.0000000000001;function NP(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let l,u;for(let d=0;d<i;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Ji(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,r_(e,u)),r&&Ca(l.latestValues)&&Ji(e,l.latestValues))}t.x<Jw&&t.x>Xw&&(t.x=1),t.y<Jw&&t.y>Xw&&(t.y=1)}function Xi(e,t){e.min=e.min+t,e.max=e.max+t}function Qw(e,t,n,r,i=.5){const l=kt(e.min,e.max,i);qp(e,t,n,l,r)}function Ji(e,t){Qw(e.x,t.x,t.scaleX,t.scale,t.originX),Qw(e.y,t.y,t.scaleY,t.scale,t.originY)}function a_(e,t){return n_(_P(e.getBoundingClientRect(),t))}function TP(e,t,n){const r=a_(e,n),{scroll:i}=t;return i&&(Xi(r.x,i.offset.x),Xi(r.y,i.offset.y)),r}const EP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},CP=mo.length;function AP(e,t,n){let r="",i=!0;for(let l=0;l<CP;l++){const u=mo[l],d=e[u];if(d===void 0)continue;let h=!0;if(typeof d=="number")h=d===(u.startsWith("scale")?1:0);else{const m=parseFloat(d);h=u.startsWith("scale")?m===1:m===0}if(!h||n){const m=Gk(d,ey[u]);if(!h){i=!1;const p=EP[u]||u;r+=`${p}(${m}) `}n&&(t[u]=m)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function ay(e,t,n){const{style:r,vars:i,transformOrigin:l}=e;let u=!1,d=!1;for(const h in t){const m=t[h];if(po.has(h)){u=!0;continue}else if(vk(h)){i[h]=m;continue}else{const p=Gk(m,ey[h]);h.startsWith("origin")?(d=!0,l[h]=p):r[h]=p}}if(t.transform||(u||n?r.transform=AP(t,e.transform,n):r.transform&&(r.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:p=0}=l;r.transformOrigin=`${h} ${m} ${p}`}}function i_(e,{style:t,vars:n},r,i){const l=e.style;let u;for(u in t)l[u]=t[u];i?.applyProjectionStyles(l,r);for(u in n)l.setProperty(u,n[u])}function Zw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const dl={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Se.test(e))e=parseFloat(e);else return e;const n=Zw(e,t.target.x),r=Zw(e,t.target.y);return`${n}% ${r}%`}},RP={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=na.parse(e);if(i.length>5)return r;const l=na.createTransformer(e),u=typeof i[0]!="number"?1:0,d=n.x.scale*t.x,h=n.y.scale*t.y;i[0+u]/=d,i[1+u]/=h;const m=kt(d,h,.5);return typeof i[2+u]=="number"&&(i[2+u]/=m),typeof i[3+u]=="number"&&(i[3+u]/=m),l(i)}},Hp={borderRadius:{...dl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:dl,borderTopRightRadius:dl,borderBottomLeftRadius:dl,borderBottomRightRadius:dl,boxShadow:RP};function o_(e,{layout:t,layoutId:n}){return po.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Hp[e]||e==="opacity")}function iy(e,t,n){const r=e.style,i=t?.style,l={};if(!r)return l;for(const u in r)(un(r[u])||i&&un(i[u])||o_(u,e)||n?.getValue(u)?.liveStyle!==void 0)&&(l[u]=r[u]);return l}function DP(e){return window.getComputedStyle(e)}class OP extends t_{constructor(){super(...arguments),this.type="html",this.renderInstance=i_}readValueFromInstance(t,n){if(po.has(n))return this.projection?.isProjecting?Rp(n):cM(t,n);{const r=DP(t),i=(vk(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return a_(t,n)}build(t,n,r){ay(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return iy(t,n,r)}}const MP={offset:"stroke-dashoffset",array:"stroke-dasharray"},PP={offset:"strokeDashoffset",array:"strokeDasharray"};function zP(e,t,n=1,r=0,i=!0){e.pathLength=1;const l=i?MP:PP;e[l.offset]=`${-r}`,e[l.array]=`${t} ${n}`}const LP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function l_(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...d},h,m,p){if(ay(e,d,m),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:v}=e;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const b of LP)g[b]!==void 0&&(v[b]=g[b],delete g[b]);t!==void 0&&(g.x=t),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),i!==void 0&&zP(g,i,l,u,!1)}const c_=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"]),u_=e=>typeof e=="string"&&e.toLowerCase()==="svg";function IP(e,t,n,r){i_(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(c_.has(i)?i:Zg(i),t.attrs[i])}function d_(e,t,n){const r=iy(e,t,n);for(const i in e)if(un(e[i])||un(t[i])){const l=mo.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[l]=e[i]}return r}class UP extends t_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(po.has(n)){const r=qk(n);return r&&r.default||0}return n=c_.has(n)?n:Zg(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return d_(t,n,r)}build(t,n,r){l_(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){IP(t,n,r,i)}mount(t){this.isSVGTag=u_(t.tagName),super.mount(t)}}const BP=ry.length;function f_(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?f_(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<BP;n++){const r=ry[n],i=e.props[r];(Fl(i)||i===!1)&&(t[r]=i)}return t}function h_(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const VP=[...sy].reverse(),FP=sy.length;function $P(e){return t=>Promise.all(t.map(({animation:n,options:r})=>QM(e,n,r)))}function qP(e){let t=$P(e),n=e1(),r=!0;const i=h=>(m,p)=>{const g=Zi(e,p,h==="exit"?e.presenceContext?.custom:void 0);if(g){const{transition:v,transitionEnd:b,...j}=g;m={...m,...j,...b}}return m};function l(h){t=h(e)}function u(h){const{props:m}=e,p=f_(e.parent)||{},g=[],v=new Set;let b={},j=1/0;for(let S=0;S<FP;S++){const N=VP[S],C=n[N],T=m[N]!==void 0?m[N]:p[N],D=Fl(T),L=N===h?C.isActive:null;L===!1&&(j=S);let O=T===p[N]&&T!==m[N]&&D;if(O&&r&&e.manuallyAnimateOnMount&&(O=!1),C.protectedKeys={...b},!C.isActive&&L===null||!T&&!C.prevProp||Ed(T)||typeof T=="boolean")continue;const B=HP(C.prevProp,T);let M=B||N===h&&C.isActive&&!O&&D||S>j&&D,q=!1;const R=Array.isArray(T)?T:[T];let J=R.reduce(i(N),{});L===!1&&(J={});const{prevResolvedValues:K={}}=C,he={...K,...J},se=V=>{M=!0,v.has(V)&&(q=!0,v.delete(V)),C.needsAnimating[V]=!0;const G=e.getValue(V);G&&(G.liveStyle=!1)};for(const V in he){const G=J[V],fe=K[V];if(b.hasOwnProperty(V))continue;let P=!1;Lp(G)&&Lp(fe)?P=!h_(G,fe):P=G!==fe,P?G!=null?se(V):v.add(V):G!==void 0&&v.has(V)?se(V):C.protectedKeys[V]=!0}C.prevProp=T,C.prevResolvedValues=J,C.isActive&&(b={...b,...J}),r&&e.blockInitialAnimation&&(M=!1);const ie=O&&B;M&&(!ie||q)&&g.push(...R.map(V=>{const G={type:N};if(typeof V=="string"&&r&&!ie&&e.manuallyAnimateOnMount&&e.parent){const{parent:fe}=e,P=Zi(fe,V);if(fe.enteringChildren&&P){const{delayChildren:I}=P.transition||{};G.delay=zk(fe.enteringChildren,e,I)}}return{animation:V,options:G}}))}if(v.size){const S={};if(typeof m.initial!="boolean"){const N=Zi(e,Array.isArray(m.initial)?m.initial[0]:m.initial);N&&N.transition&&(S.transition=N.transition)}v.forEach(N=>{const C=e.getBaseTarget(N),T=e.getValue(N);T&&(T.liveStyle=!0),S[N]=C??null}),g.push({animation:S})}let _=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(g):Promise.resolve()}function d(h,m){if(n[h].isActive===m)return Promise.resolve();e.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const p=u(h);for(const g in n)n[g].protectedKeys={};return p}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=e1()}}}function HP(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!h_(t,e):!1}function Na(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function e1(){return{animate:Na(!0),whileInView:Na(),whileHover:Na(),whileTap:Na(),whileDrag:Na(),whileFocus:Na(),exit:Na()}}function t1(e,t){e.min=t.min,e.max=t.max}function hs(e,t){t1(e.x,t.x),t1(e.y,t.y)}function n1(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const m_=1e-4,GP=1-m_,KP=1+m_,p_=.01,YP=0-p_,WP=0+p_;function xn(e){return e.max-e.min}function XP(e,t,n){return Math.abs(e-t)<=n}function s1(e,t,n,r=.5){e.origin=r,e.originPoint=kt(t.min,t.max,e.origin),e.scale=xn(n)/xn(t),e.translate=kt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=GP&&e.scale<=KP||isNaN(e.scale))&&(e.scale=1),(e.translate>=YP&&e.translate<=WP||isNaN(e.translate))&&(e.translate=0)}function jl(e,t,n,r){s1(e.x,t.x,n.x,r?r.originX:void 0),s1(e.y,t.y,n.y,r?r.originY:void 0)}function r1(e,t,n){e.min=n.min+t.min,e.max=e.min+xn(t)}function JP(e,t,n){r1(e.x,t.x,n.x),r1(e.y,t.y,n.y)}function a1(e,t,n){e.min=t.min-n.min,e.max=e.min+xn(t)}function ud(e,t,n){a1(e.x,t.x,n.x),a1(e.y,t.y,n.y)}function i1(e,t,n,r,i){return e-=t,e=cd(e,1/n,r),i!==void 0&&(e=cd(e,1/i,r)),e}function QP(e,t=0,n=1,r=.5,i,l=e,u=e){if(Ps.test(t)&&(t=parseFloat(t),t=kt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let d=kt(l.min,l.max,r);e===l&&(d-=t),e.min=i1(e.min,t,n,d,i),e.max=i1(e.max,t,n,d,i)}function o1(e,t,[n,r,i],l,u){QP(e,t[n],t[r],t[i],t.scale,l,u)}const ZP=["x","scaleX","originX"],ez=["y","scaleY","originY"];function l1(e,t,n,r){o1(e.x,t,ZP,n?n.x:void 0,r?r.x:void 0),o1(e.y,t,ez,n?n.y:void 0,r?r.y:void 0)}function c1(e){return e.translate===0&&e.scale===1}function g_(e){return c1(e.x)&&c1(e.y)}function u1(e,t){return e.min===t.min&&e.max===t.max}function tz(e,t){return u1(e.x,t.x)&&u1(e.y,t.y)}function d1(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function y_(e,t){return d1(e.x,t.x)&&d1(e.y,t.y)}function f1(e){return xn(e.x)/xn(e.y)}function h1(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ns(e){return[e("x"),e("y")]}function nz(e,t,n){let r="";const i=e.x.translate/t.x,l=e.y.translate/t.y,u=n?.z||0;if((i||l||u)&&(r=`translate3d(${i}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:m,rotate:p,rotateX:g,rotateY:v,skewX:b,skewY:j}=n;m&&(r=`perspective(${m}px) ${r}`),p&&(r+=`rotate(${p}deg) `),g&&(r+=`rotateX(${g}deg) `),v&&(r+=`rotateY(${v}deg) `),b&&(r+=`skewX(${b}deg) `),j&&(r+=`skewY(${j}deg) `)}const d=e.x.scale*t.x,h=e.y.scale*t.y;return(d!==1||h!==1)&&(r+=`scale(${d}, ${h})`),r||"none"}const x_=["TopLeft","TopRight","BottomLeft","BottomRight"],sz=x_.length,m1=e=>typeof e=="string"?parseFloat(e):e,p1=e=>typeof e=="number"||Se.test(e);function rz(e,t,n,r,i,l){i?(e.opacity=kt(0,n.opacity??1,az(r)),e.opacityExit=kt(t.opacity??1,0,iz(r))):l&&(e.opacity=kt(t.opacity??1,n.opacity??1,r));for(let u=0;u<sz;u++){const d=`border${x_[u]}Radius`;let h=g1(t,d),m=g1(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||p1(h)===p1(m)?(e[d]=Math.max(kt(m1(h),m1(m),r),0),(Ps.test(m)||Ps.test(h))&&(e[d]+="%")):e[d]=m}(t.rotate||n.rotate)&&(e.rotate=kt(t.rotate||0,n.rotate||0,r))}function g1(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const az=v_(0,.5,hk),iz=v_(.5,.95,as);function v_(e,t,n){return r=>r<e?0:r>t?1:n(Ul(e,t,r))}function oz(e,t,n){const r=un(e)?e:io(e);return r.start(Jg("",r,t,n)),r.animation}function $l(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const lz=(e,t)=>e.depth-t.depth;class cz{constructor(){this.children=[],this.isDirty=!1}add(t){Mg(this.children,t),this.isDirty=!0}remove(t){Pg(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(lz),this.isDirty=!1,this.children.forEach(t)}}function uz(e,t){const n=yn.now(),r=({timestamp:i})=>{const l=i-n;l>=t&&(ta(r),e(l-t))};return vt.setup(r,!0),()=>ta(r)}function Ku(e){return un(e)?e.get():e}class dz{constructor(){this.members=[]}add(t){Mg(this.members,t),t.scheduleRender()}remove(t){if(Pg(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const l=this.members[i];if(l.isPresent!==!1){r=l;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender();const i=r.options.layoutDependency,l=t.options.layoutDependency;i!==void 0&&l!==void 0&&i===l||(t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0));const{crossfade:d}=t.options;d===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Yu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},_m=["","X","Y","Z"],fz=1e3;let hz=0;function Nm(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function b_(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Bk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",vt,!(i||l))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&b_(r)}function w_({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(u={},d=t?.()){this.id=hz++,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(gz),this.nodes.forEach(bz),this.nodes.forEach(wz),this.nodes.forEach(yz)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new cz)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ig),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=Jk(u)&&!pP(u),this.instance=u;const{layoutId:d,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),e){let p,g=0;const v=()=>this.root.updateBlockedByResize=!1;vt.read(()=>{g=window.innerWidth}),e(u,()=>{const b=window.innerWidth;b!==g&&(g=b,this.root.updateBlockedByResize=!0,p&&p(),p=uz(v,250),Yu.hasAnimatedSinceResize&&(Yu.hasAnimatedSinceResize=!1,this.nodes.forEach(v1)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&m&&(d||h)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||m.getDefaultTransition()||Nz,{onLayoutAnimationStart:_,onLayoutAnimationComplete:S}=m.getProps(),N=!this.targetLayout||!y_(this.targetLayout,b),C=!g&&v;if(this.options.layoutRoot||this.resumeFrom||C||g&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Xg(j,"layout"),onPlay:_,onComplete:S};(m.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(p,C)}else g||v1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ta(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(Sz),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&b_(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(y1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(x1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(vz),this.nodes.forEach(mz),this.nodes.forEach(pz)):this.nodes.forEach(x1),this.clearAllSnapshots();const d=yn.now();on.delta=zs(0,1e3/60,d-on.timestamp),on.timestamp=d,on.isProcessing=!0,ym.update.process(on),ym.preRender.process(on),ym.render.process(on),on.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ty.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xz),this.sharedNodes.forEach(jz)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xn(this.snapshot.measuredBox.x)&&!xn(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 h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Kt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!g_(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,p=m!==this.prevTransformTemplateValue;u&&this.instance&&(d||Ca(this.latestValues)||p)&&(i(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),Tz(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Kt();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Ez))){const{scroll:m}=this.root;m&&(Xi(d.x,m.offset.x),Xi(d.y,m.offset.y))}return d}removeElementScroll(u){const d=Kt();if(hs(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:p,options:g}=m;m!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&hs(d,u),Xi(d.x,p.offset.x),Xi(d.y,p.offset.y))}return d}applyTransform(u,d=!1){const h=Kt();hs(h,u);for(let m=0;m<this.path.length;m++){const p=this.path[m];!d&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Ji(h,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Ca(p.latestValues)&&Ji(h,p.latestValues)}return Ca(this.latestValues)&&Ji(h,this.latestValues),h}removeTransform(u){const d=Kt();hs(d,u);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!Ca(m.latestValues))continue;$p(m.latestValues)&&m.updateSnapshot();const p=Kt(),g=m.measurePageBox();hs(p,g),l1(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,p)}return Ca(this.latestValues)&&l1(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.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!==on.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(u||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=on.timestamp;const v=this.getClosestProjectingParent();v&&this.linkedParentVersion!==v.layoutVersion&&!v.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(v&&v.layout?this.createRelativeTarget(v,this.layout.layoutBox,v.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Kt(),this.targetWithTransforms=Kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),JP(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hs(this.target,this.layout.layoutBox),r_(this.target,this.targetDelta)):hs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?this.createRelativeTarget(v,this.target,v.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||$p(this.parent.latestValues)||s_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,d,h){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),ud(this.relativeTargetOrigin,d,h),hs(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),d=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===on.timestamp&&(h=!1),h)return;const{layout:m,layoutId:p}=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||p))return;hs(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;NP(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Kt());const{target:b}=u;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(n1(this.prevProjectionDelta.x,this.projectionDelta.x),n1(this.prevProjectionDelta.y,this.projectionDelta.y)),jl(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!h1(this.projectionDelta.x,this.prevProjectionDelta.x)||!h1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Wi(),this.projectionDelta=Wi(),this.projectionDeltaWithTransform=Wi()}setAnimationOrigin(u,d=!1){const h=this.snapshot,m=h?h.latestValues:{},p={...this.latestValues},g=Wi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const v=Kt(),b=h?h.source:void 0,j=this.layout?this.layout.source:void 0,_=b!==j,S=this.getStack(),N=!S||S.members.length<=1,C=!!(_&&!N&&this.options.crossfade===!0&&!this.path.some(_z));this.animationProgress=0;let T;this.mixTargetDelta=D=>{const L=D/1e3;b1(g.x,u.x,L),b1(g.y,u.y,L),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ud(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kz(this.relativeTarget,this.relativeTargetOrigin,v,L),T&&tz(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Kt()),hs(T,this.relativeTarget)),_&&(this.animationValues=p,rz(p,m,this.latestValues,L,C,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=L},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ta(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vt.update(()=>{Yu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=io(0)),this.currentAnimation=oz(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(fz),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:p}=u;if(!(!d||!h||!m)){if(this!==u&&this.layout&&m&&S_(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Kt();const g=xn(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+g;const v=xn(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+v}hs(d,h),Ji(d,p),jl(this.projectionDeltaWithTransform,this.layoutCorrected,d,p)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new dz),this.sharedNodes.get(u).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const m={};h.z&&Nm("z",u,m,this.animationValues);for(let p=0;p<_m.length;p++)Nm(`rotate${_m[p]}`,u,m,this.animationValues),Nm(`skew${_m[p]}`,u,m,this.animationValues);u.render();for(const p in m)u.setStaticValue(p,m[p]),this.animationValues&&(this.animationValues[p]=m[p]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Ku(d?.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Ku(d?.pointerEvents)||""),this.hasProjected&&!Ca(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=nz(this.projectionDeltaWithTransform,this.treeScale,p);h&&(g=h(p,g)),u.transform=g;const{x:v,y:b}=this.projectionDelta;u.transformOrigin=`${v.origin*100}% ${b.origin*100}% 0`,m.animationValues?u.opacity=m===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=m===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const j in Hp){if(p[j]===void 0)continue;const{correct:_,applyTo:S,isCSSVariable:N}=Hp[j],C=g==="none"?p[j]:_(p[j],m);if(S){const T=S.length;for(let D=0;D<T;D++)u[S[D]]=C}else N?this.options.visualElement.renderState.vars[j]=C:u[j]=C}this.options.layoutId&&(u.pointerEvents=m===this?Ku(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(y1),this.root.sharedNodes.clear()}}}function mz(e){e.updateLayout()}function pz(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,l=t.source!==e.layout.source;i==="size"?ns(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=xn(g);g.min=n[p].min,g.max=g.min+v}):S_(i,t.layoutBox,n)&&ns(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=xn(n[p]);g.max=g.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const u=Wi();jl(u,n,t.layoutBox);const d=Wi();l?jl(d,e.applyTransform(r,!0),t.measuredBox):jl(d,n,t.layoutBox);const h=!g_(u);let m=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:v}=p;if(g&&v){const b=Kt();ud(b,t.layoutBox,g.layoutBox);const j=Kt();ud(j,n,v.layoutBox),y_(b,j)||(m=!0),p.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=b,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:d,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function gz(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function yz(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function xz(e){e.clearSnapshot()}function y1(e){e.clearMeasurements()}function x1(e){e.isLayoutDirty=!1}function vz(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function v1(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function bz(e){e.resolveTargetDelta()}function wz(e){e.calcProjection()}function Sz(e){e.resetSkewAndRotation()}function jz(e){e.removeLeadSnapshot()}function b1(e,t,n){e.translate=kt(t.translate,0,n),e.scale=kt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function w1(e,t,n,r){e.min=kt(t.min,n.min,r),e.max=kt(t.max,n.max,r)}function kz(e,t,n,r){w1(e.x,t.x,n.x,r),w1(e.y,t.y,n.y,r)}function _z(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Nz={duration:.45,ease:[.4,0,.1,1]},S1=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),j1=S1("applewebkit/")&&!S1("chrome/")?Math.round:as;function k1(e){e.min=j1(e.min),e.max=j1(e.max)}function Tz(e){k1(e.x),k1(e.y)}function S_(e,t,n){return e==="position"||e==="preserve-aspect"&&!XP(f1(t),f1(n),.2)}function Ez(e){return e!==e.root&&e.scroll?.wasRoot}const Cz=w_({attachResizeListener:(e,t)=>$l(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Tm={current:void 0},j_=w_({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Tm.current){const e=new Cz({});e.mount(window),e.setOptions({layoutScroll:!0}),Tm.current=e}return Tm.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),oy=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function _1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Az(...e){return t=>{let n=!1;const r=e.map(i=>{const l=_1(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<r.length;i++){const l=r[i];typeof l=="function"?l():_1(e[i],null)}}}}function Rz(...e){return w.useCallback(Az(...e),e)}class Dz extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=Vp(r)&&r.offsetWidth||0,l=Vp(r)&&r.offsetHeight||0,u=this.props.sizeRef.current;u.height=n.offsetHeight||0,u.width=n.offsetWidth||0,u.top=n.offsetTop,u.left=n.offsetLeft,u.right=i-u.width-u.left,u.bottom=l-u.height-u.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Oz({children:e,isPresent:t,anchorX:n,anchorY:r,root:i}){const l=w.useId(),u=w.useRef(null),d=w.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=w.useContext(oy),m=e.props?.ref??e?.ref,p=Rz(u,m);return w.useInsertionEffect(()=>{const{width:g,height:v,top:b,left:j,right:_,bottom:S}=d.current;if(t||!u.current||!g||!v)return;const N=n==="left"?`left: ${j}`:`right: ${_}`,C=r==="bottom"?`bottom: ${S}`:`top: ${b}`;u.current.dataset.motionPopId=l;const T=document.createElement("style");h&&(T.nonce=h);const D=i??document.head;return D.appendChild(T),T.sheet&&T.sheet.insertRule(`
52
+ [data-motion-pop-id="${l}"] {
53
+ position: absolute !important;
54
+ width: ${g}px !important;
55
+ height: ${v}px !important;
56
+ ${N}px !important;
57
+ ${C}px !important;
58
+ }
59
+ `),()=>{D.contains(T)&&D.removeChild(T)}},[t]),o.jsx(Dz,{isPresent:t,childRef:u,sizeRef:d,children:w.cloneElement(e,{ref:p})})}const Mz=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:l,mode:u,anchorX:d,anchorY:h,root:m})=>{const p=Og(Pz),g=w.useId();let v=!0,b=w.useMemo(()=>(v=!1,{id:g,initial:t,isPresent:n,custom:i,onExitComplete:j=>{p.set(j,!0);for(const _ of p.values())if(!_)return;r&&r()},register:j=>(p.set(j,!1),()=>p.delete(j))}),[n,p,r]);return l&&v&&(b={...b}),w.useMemo(()=>{p.forEach((j,_)=>p.set(_,!1))},[n]),w.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),u==="popLayout"&&(e=o.jsx(Oz,{isPresent:n,anchorX:d,anchorY:h,root:m,children:e})),o.jsx(Td.Provider,{value:b,children:e})};function Pz(){return new Map}function k_(e=!0){const t=w.useContext(Td);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,l=w.useId();w.useEffect(()=>{if(e)return i(l)},[e]);const u=w.useCallback(()=>e&&r&&r(l),[l,r,e]);return!n&&r?[!1,u]:[!0]}const Eu=e=>e.key||"";function N1(e){const t=[];return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const __=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:l="sync",propagate:u=!1,anchorX:d="left",anchorY:h="top",root:m})=>{const[p,g]=k_(u),v=w.useMemo(()=>N1(e),[e]),b=u&&!p?[]:v.map(Eu),j=w.useRef(!0),_=w.useRef(v),S=Og(()=>new Map),N=w.useRef(new Set),[C,T]=w.useState(v),[D,L]=w.useState(v);nk(()=>{j.current=!1,_.current=v;for(let M=0;M<D.length;M++){const q=Eu(D[M]);b.includes(q)?(S.delete(q),N.current.delete(q)):S.get(q)!==!0&&S.set(q,!1)}},[D,b.length,b.join("-")]);const O=[];if(v!==C){let M=[...v];for(let q=0;q<D.length;q++){const R=D[q],J=Eu(R);b.includes(J)||(M.splice(q,0,R),O.push(R))}return l==="wait"&&O.length&&(M=O),L(N1(M)),T(v),null}const{forceRender:B}=w.useContext(Dg);return o.jsx(o.Fragment,{children:D.map(M=>{const q=Eu(M),R=u&&!p?!1:v===D||b.includes(q),J=()=>{if(N.current.has(q))return;if(N.current.add(q),S.has(q))S.set(q,!0);else return;let K=!0;S.forEach(he=>{he||(K=!1)}),K&&(B?.(),L(_.current),u&&g?.(),r&&r())};return o.jsx(Mz,{isPresent:R,initial:!j.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:l,root:m,onExitComplete:R?void 0:J,anchorX:d,anchorY:h,children:M},q)})})},N_=w.createContext({strict:!1}),T1={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 E1=!1;function zz(){if(E1)return;const e={};for(const t in T1)e[t]={isEnabled:n=>T1[t].some(r=>!!n[r])};e_(e),E1=!0}function T_(){return zz(),SP()}function Lz(e){const t=T_();for(const n in e)t[n]={...t[n],...e[n]};e_(t)}const Iz=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 dd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Iz.has(e)}let E_=e=>!dd(e);function Uz(e){typeof e=="function"&&(E_=t=>t.startsWith("on")?!dd(t):e(t))}try{Uz(require("@emotion/is-prop-valid").default)}catch{}function Bz(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(E_(i)||n===!0&&dd(i)||!t&&!dd(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Ad=w.createContext({});function Vz(e,t){if(Cd(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Fl(n)?n:void 0,animate:Fl(r)?r:void 0}}return e.inherit!==!1?t:{}}function Fz(e){const{initial:t,animate:n}=Vz(e,w.useContext(Ad));return w.useMemo(()=>({initial:t,animate:n}),[C1(t),C1(n)])}function C1(e){return Array.isArray(e)?e.join(" "):e}const ly=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function C_(e,t,n){for(const r in t)!un(t[r])&&!o_(r,n)&&(e[r]=t[r])}function $z({transformTemplate:e},t){return w.useMemo(()=>{const n=ly();return ay(n,t,e),Object.assign({},n.vars,n.style)},[t])}function qz(e,t){const n=e.style||{},r={};return C_(r,n,e),Object.assign(r,$z(e,t)),r}function Hz(e,t){const n={},r=qz(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const A_=()=>({...ly(),attrs:{}});function Gz(e,t,n,r){const i=w.useMemo(()=>{const l=A_();return l_(l,t,u_(r),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};C_(l,e.style,e),i.style={...l,...i.style}}return i}const Kz=["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 cy(e){return typeof e!="string"||e.includes("-")?!1:!!(Kz.indexOf(e)>-1||/[A-Z]/u.test(e))}function Yz(e,t,n,{latestValues:r},i,l=!1,u){const h=(u??cy(e)?Gz:Hz)(t,r,i,e),m=Bz(t,typeof e=="string",l),p=e!==w.Fragment?{...m,...h,ref:n}:{},{children:g}=t,v=w.useMemo(()=>un(g)?g.get():g,[g]);return w.createElement(e,{...p,children:v})}function Wz({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Xz(n,r,i,e),renderState:t()}}function Xz(e,t,n,r){const i={},l=r(e,{});for(const v in l)i[v]=Ku(l[v]);let{initial:u,animate:d}=e;const h=Cd(e),m=Zk(e);t&&m&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),d===void 0&&(d=t.animate));let p=n?n.initial===!1:!1;p=p||u===!1;const g=p?d:u;if(g&&typeof g!="boolean"&&!Ed(g)){const v=Array.isArray(g)?g:[g];for(let b=0;b<v.length;b++){const j=Qg(e,v[b]);if(j){const{transitionEnd:_,transition:S,...N}=j;for(const C in N){let T=N[C];if(Array.isArray(T)){const D=p?T.length-1:0;T=T[D]}T!==null&&(i[C]=T)}for(const C in _)i[C]=_[C]}}}return i}const R_=e=>(t,n)=>{const r=w.useContext(Ad),i=w.useContext(Td),l=()=>Wz(e,t,r,i);return n?l():Og(l)},Jz=R_({scrapeMotionValuesFromProps:iy,createRenderState:ly}),Qz=R_({scrapeMotionValuesFromProps:d_,createRenderState:A_}),Zz=Symbol.for("motionComponentSymbol");function eL(e,t,n){const r=w.useRef(n);w.useInsertionEffect(()=>{r.current=n});const i=w.useRef(null);return w.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=r.current;if(typeof u=="function")if(l){const d=u(l);typeof d=="function"&&(i.current=d)}else i.current?(i.current(),i.current=null):u(l);else u&&(u.current=l)},[t])}const D_=w.createContext({});function xl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function tL(e,t,n,r,i,l){const{visualElement:u}=w.useContext(Ad),d=w.useContext(N_),h=w.useContext(Td),m=w.useContext(oy).reducedMotion,p=w.useRef(null),g=w.useRef(!1);r=r||d.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:u,props:n,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:m,isSVG:l}),g.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const v=p.current,b=w.useContext(D_);v&&!v.projection&&i&&(v.type==="html"||v.type==="svg")&&nL(p.current,n,i,b);const j=w.useRef(!1);w.useInsertionEffect(()=>{v&&j.current&&v.update(n,h)});const _=n[Uk],S=w.useRef(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return nk(()=>{g.current=!0,v&&(j.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),S.current&&v.animationState&&v.animationState.animateChanges())}),w.useEffect(()=>{v&&(!S.current&&v.animationState&&v.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),S.current=!1),v.enteringChildren=void 0)}),v}function nL(e,t,n,r){const{layoutId:i,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:m,layoutCrossfade:p}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:O_(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!u||d&&xl(d),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:r,crossfade:p,layoutScroll:h,layoutRoot:m})}function O_(e){if(e)return e.options.allowProjection!==!1?e.projection:O_(e.parent)}function Em(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Lz(r);const l=n?n==="svg":cy(e),u=l?Qz:Jz;function d(m,p){let g;const v={...w.useContext(oy),...m,layoutId:sL(m)},{isStatic:b}=v,j=Fz(m),_=u(m,b);if(!b&&tk){rL();const S=aL(v);g=S.MeasureLayout,j.visualElement=tL(e,_,v,i,S.ProjectionNode,l)}return o.jsxs(Ad.Provider,{value:j,children:[g&&j.visualElement?o.jsx(g,{visualElement:j.visualElement,...v}):null,Yz(e,m,eL(_,j.visualElement,p),_,b,t,l)]})}d.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=w.forwardRef(d);return h[Zz]=e,h}function sL({layoutId:e}){const t=w.useContext(Dg).id;return t&&e!==void 0?t+"-"+e:e}function rL(e,t){w.useContext(N_).strict}function aL(e){const t=T_(),{drag:n,layout:r}=t;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n?.isEnabled(e)||r?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function iL(e,t){if(typeof Proxy>"u")return Em;const n=new Map,r=(l,u)=>Em(l,u,e,t),i=(l,u)=>r(l,u);return new Proxy(i,{get:(l,u)=>u==="create"?r:(n.has(u)||n.set(u,Em(u,void 0,e,t)),n.get(u))})}const oL=(e,t)=>t.isSVG??cy(e)?new UP(t):new OP(t,{allowProjection:e!==w.Fragment});class lL extends sa{constructor(t){super(t),t.animationState||(t.animationState=qP(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Ed(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let cL=0;class uL extends sa{constructor(){super(...arguments),this.id=cL++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const dL={animation:{Feature:lL},exit:{Feature:uL}};function tc(e){return{point:{x:e.pageX,y:e.pageY}}}const fL=e=>t=>ny(t)&&e(t,tc(t));function kl(e,t,n,r){return $l(e,t,fL(n),r)}const M_=({current:e})=>e?e.ownerDocument.defaultView:null,A1=(e,t)=>Math.abs(e-t);function hL(e,t){const n=A1(e.x,t.x),r=A1(e.y,t.y);return Math.sqrt(n**2+r**2)}const R1=new Set(["auto","scroll"]);class P_{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Am(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,_=hL(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!_)return;const{point:S}=b,{timestamp:N}=on;this.history.push({...S,timestamp:N});const{onStart:C,onMove:T}=this.handlers;j||(C&&C(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,j)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Cm(j,this.transformPagePoint),vt.update(this.updatePoint,!0)},this.handlePointerUp=(b,j)=>{this.end();const{onEnd:_,onSessionEnd:S,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const C=Am(b.type==="pointercancel"?this.lastMoveEventInfo:Cm(j,this.transformPagePoint),this.history);this.startEvent&&_&&_(b,C),S&&S(b,C)},!ny(t))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=u,this.contextWindow=i||window;const h=tc(t),m=Cm(h,this.transformPagePoint),{point:p}=m,{timestamp:g}=on;this.history=[{...p,timestamp:g}];const{onSessionStart:v}=n;v&&v(t,Am(m,this.history)),this.removeListeners=Ql(kl(this.contextWindow,"pointermove",this.handlePointerMove),kl(this.contextWindow,"pointerup",this.handlePointerUp),kl(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(R1.has(r.overflowX)||R1.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.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(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:i.x-n.x,y:i.y-n.y};l.x===0&&l.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,i),vt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ta(this.updatePoint)}}function Cm(e,t){return t?{point:t(e.point)}:e}function D1(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Am({point:e},t){return{point:e,delta:D1(e,z_(t)),offset:D1(e,mL(t)),velocity:pL(t,.1)}}function mL(e){return e[0]}function z_(e){return e[e.length-1]}function pL(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=z_(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>ur(t)));)n--;if(!r)return{x:0,y:0};const l=rs(i.timestamp-r.timestamp);if(l===0)return{x:0,y:0};const u={x:(i.x-r.x)/l,y:(i.y-r.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function gL(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?kt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?kt(n,e,r.max):Math.min(e,n)),e}function O1(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function yL(e,{top:t,left:n,bottom:r,right:i}){return{x:O1(e.x,n,i),y:O1(e.y,t,r)}}function M1(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function xL(e,t){return{x:M1(e.x,t.x),y:M1(e.y,t.y)}}function vL(e,t){let n=.5;const r=xn(e),i=xn(t);return i>r?n=Ul(t.min,t.max-r,e.min):r>i&&(n=Ul(e.min,e.max-i,t.min)),zs(0,1,n)}function bL(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Gp=.35;function wL(e=Gp){return e===!1?e=0:e===!0&&(e=Gp),{x:P1(e,"left","right"),y:P1(e,"top","bottom")}}function P1(e,t,n){return{min:z1(e,t),max:z1(e,n)}}function z1(e,t){return typeof e=="number"?e:e[t]||0}const SL=new WeakMap;class jL{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=g=>{n?(this.stopAnimation(),this.snapToCursor(tc(g).point)):this.pauseAnimation()},u=(g,v)=>{this.stopAnimation();const{drag:b,dragPropagation:j,onDragStart:_}=this.getProps();if(b&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=uP(b),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ns(N=>{let C=this.getAxisMotionValue(N).get()||0;if(Ps.test(C)){const{projection:T}=this.visualElement;if(T&&T.layout){const D=T.layout.layoutBox[N];D&&(C=xn(D)*(parseFloat(C)/100))}}this.originPoint[N]=C}),_&&vt.postRender(()=>_(g,v)),Ip(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},d=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:b,dragDirectionLock:j,onDirectionLock:_,onDrag:S}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:N}=v;if(j&&this.currentDirection===null){this.currentDirection=kL(N),this.currentDirection!==null&&_&&_(this.currentDirection);return}this.updateAxis("x",v.point,N),this.updateAxis("y",v.point,N),this.visualElement.render(),S&&S(g,v)},h=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v,this.stop(g,v),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>ns(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:p}=this.getProps();this.panSession=new P_(t,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:r,contextWindow:M_(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!r)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&vt.postRender(()=>d(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Cu(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(u=gL(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&xl(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=yL(r.layoutBox,t):this.constraints=!1,this.elastic=wL(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ns(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=bL(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!xl(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=TP(r,i.root,this.visualElement.getTransformPagePoint());let u=xL(i.layout.layoutBox,l);if(n){const d=n(kP(u));this.hasMutatedConstraints=!!d,d&&(u=n_(d))}return u}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=ns(p=>{if(!Cu(p,n,this.currentDirection))return;let g=h&&h[p]||{};u&&(g={min:0,max:0});const v=i?200:1e6,b=i?40:1e7,j={type:"inertia",velocity:r?t[p]:0,bounceStiffness:v,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,j)});return Promise.all(m).then(d)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Ip(this.visualElement,t),r.start(Jg(t,r,0,n,this.visualElement,!1))}stopAnimation(){ns(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ns(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ns(n=>{const{drag:r}=this.getProps();if(!Cu(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(n);if(i&&i.layout){const{min:u,max:d}=i.layout.layoutBox[n],h=l.get()||0;l.set(t[n]-kt(u,d,.5)+h)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!xl(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ns(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();i[u]=vL({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ns(u=>{if(!Cu(u,t,null))return;const d=this.getAxisMotionValue(u),{min:h,max:m}=this.constraints[u];d.set(kt(h,m,i[u]))})}addListeners(){if(!this.visualElement.current)return;SL.set(this.visualElement,this);const t=this.visualElement.current,n=kl(t,"pointerdown",h=>{const{drag:m,dragListener:p=!0}=this.getProps(),g=h.target,v=g!==t&&Xk(g);m&&p&&!v&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();xl(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,l=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),vt.read(r);const u=$l(window,"resize",()=>this.scalePositionWithinConstraints()),d=i.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(ns(p=>{const g=this.getAxisMotionValue(p);g&&(this.originPoint[p]+=h[p].translate,g.set(g.get()+h[p].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:u=Gp,dragMomentum:d=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function Cu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function kL(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class _L extends sa{constructor(t){super(t),this.removeGroupControls=as,this.removeListeners=as,this.controls=new jL(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||as}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const L1=e=>(t,n)=>{e&&vt.postRender(()=>e(t,n))};class NL extends sa{constructor(){super(...arguments),this.removePointerDownListener=as}onPointerDown(t){this.session=new P_(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:M_(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:L1(t),onStart:L1(n),onMove:r,onEnd:(l,u)=>{delete this.session,i&&vt.postRender(()=>i(l,u))}}}mount(){this.removePointerDownListener=kl(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Rm=!1;class TL extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:l}=t;l&&(n.group&&n.group.add(l),r&&r.register&&i&&r.register(l),Rm&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Yu.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:l}=this.props,{projection:u}=r;return u&&(u.isPresent=l,t.layoutDependency!==n&&u.setOptions({...u.options,layoutDependency:n}),Rm=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||vt.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),ty.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;Rm=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function L_(e){const[t,n]=k_(),r=w.useContext(Dg);return o.jsx(TL,{...e,layoutGroup:r,switchLayoutGroup:w.useContext(D_),isPresent:t,safeToRemove:n})}const EL={pan:{Feature:NL},drag:{Feature:_L,ProjectionNode:j_,MeasureLayout:L_}};function I1(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,l=r[i];l&&vt.postRender(()=>l(t,tc(t)))}class CL extends sa{mount(){const{current:t}=this.node;t&&(this.unmount=dP(t,(n,r)=>(I1(this.node,r,"Start"),i=>I1(this.node,i,"End"))))}unmount(){}}class AL extends sa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Ql($l(this.node.current,"focus",()=>this.onFocus()),$l(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function U1(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),l=r[i];l&&vt.postRender(()=>l(t,tc(t)))}class RL extends sa{mount(){const{current:t}=this.node;t&&(this.unmount=mP(t,(n,r)=>(U1(this.node,r,"Start"),(i,{success:l})=>U1(this.node,i,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Kp=new WeakMap,Dm=new WeakMap,DL=e=>{const t=Kp.get(e.target);t&&t(e)},OL=e=>{e.forEach(DL)};function ML({root:e,...t}){const n=e||document;Dm.has(n)||Dm.set(n,{});const r=Dm.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(OL,{root:e,...t})),r[i]}function PL(e,t,n){const r=ML(t);return Kp.set(e,n),r.observe(e),()=>{Kp.delete(e),r.unobserve(e)}}const zL={some:0,all:1};class LL extends sa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:l}=t,u={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:zL[i]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,l&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),v=m?p:g;v&&v(h)};return PL(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(IL(t,n))&&this.startObserver()}unmount(){}}function IL({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const UL={inView:{Feature:LL},tap:{Feature:RL},focus:{Feature:AL},hover:{Feature:CL}},BL={layout:{ProjectionNode:j_,MeasureLayout:L_}},VL={...dL,...UL,...EL,...BL},or=iL(VL,oL),FL="modulepreload",$L=function(e){return"/"+e},B1={},Aa=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let m=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};var u=m;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");i=m(n.map(p=>{if(p=$L(p),p in B1)return;B1[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":FL,g||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),g)return new Promise((j,_)=>{b.addEventListener("load",j),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return i.then(d=>{for(const h of d||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})},qL=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((i,l)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(l.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},I_={"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.drafts":"Drafts","nav.autopilot":"Auto-Pilot","nav.analytics":"Analytics","nav.configuration":"Configuration","nav.accountSettings":"Account Settings","nav.signOut":"Sign Out","drafts.title":"Draft Review Center","drafts.pending":"pending drafts","drafts.noDrafts":"No pending drafts","drafts.noDraftsDesc":"AI-generated draft replies will appear here for your review","drafts.send":"Send Now","drafts.preview":"Preview","drafts.dismiss":"Dismiss","drafts.regenerate":"Regenerate","drafts.selectAll":"Select All","drafts.sendSelected":"Send Selected","drafts.dismissSelected":"Dismiss Selected","drafts.filterByAccount":"All Accounts","drafts.filterByDate":"Filter by Date","drafts.originalEmail":"Original Email","drafts.aiReply":"AI-Generated Reply","drafts.createdBy":"Created by rule:","drafts.sendSuccess":"Draft sent successfully!","drafts.sendError":"Failed to send draft","drafts.dismissSuccess":"Draft dismissed","drafts.loadError":"Failed to load drafts","drafts.compose":"Compose Draft","drafts.feedback":"What's wrong?","drafts.editPlaceholder":"Write your reply in Markdown...","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","setup.agent.systemInstruction":'You are the Setup Wizard assistant. Guide the user through connecting Supabase, choosing a setup mode, and completing migrations. Ask only for the next required input and provide step-by-step actions. If the user says "help me set up", immediately outline the steps in this wizard.',"agent.intro.setup":`👋 Welcome to Setup! I can help you:
60
+ • Choose Quick Start or Manual setup
61
+ • Connect your Supabase project
62
+ • Run database migrations
63
+ • Troubleshoot connection issues
64
+
65
+ Tell me what you want to do or say "help me set up".`,"agent.intro.configuration":`👋 Welcome to Configuration! I can help you:
66
+ • Connect email accounts ({accountsCount} connected)
67
+ • Set up automation rules ({rulesCount} active)
68
+ • Configure LLM & TTS settings
69
+ • Troubleshoot connection issues
70
+
71
+ What would you like to set up?`,"agent.intro.drafts.one":`📧 I'm your Draft Review Assistant!
72
+
73
+ You have {count} pending draft.
74
+
75
+ I can help you:
76
+ • Summarize all drafts
77
+ • Send or dismiss specific drafts
78
+ • Preview draft content
79
+ • Review recipients and subjects
80
+
81
+ Try: "Summarize my drafts" or "Send the draft to John"`,"agent.intro.drafts.other":`📧 I'm your Draft Review Assistant!
82
+
83
+ You have {count} pending drafts.
84
+
85
+ I can help you:
86
+ • Summarize all drafts
87
+ • Send or dismiss specific drafts
88
+ • Preview draft content
89
+ • Review recipients and subjects
90
+
91
+ Try: "Summarize my drafts" or "Send the draft to John"`,"agent.intro.explainer":`🌐 Translation & Explanation Helper
92
+
93
+ I can help you understand:
94
+ • What automation rules mean
95
+ • How settings affect your workflow
96
+ • Technical terms in plain language
97
+
98
+ Ask me anything about what you're seeing!`,"agent.intro.global":`👋 Hi! I'm your AI Assistant.
99
+
100
+ I can help you navigate and understand any part of the Email Automator.
101
+
102
+ What would you like to know?`,"agent.intro.default":`👋 Hi! I'm here to help with {page}.
103
+
104
+ What can I assist you with?`,"agent.composer.placeholder":"Ask a question, or click the mic...","agent.composer.listening":"Listening...","agent.title.setup":"Setup Wizard","agent.title.configuration":"Configuration Helper","agent.title.drafts":"Draft Assistant","agent.title.explainer":"Translation Helper","agent.title.global":"AI Assistant","agent.title.default":"{page} Assistant","agent.status.listening":"Listening...","agent.status.analyzing":"Analyzing","agent.status.speaking":"Speaking","agent.status.ready":"Ready","agent.recording":"Recording...","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.openLogin":"Open Microsoft Login","config.outlook.waitingSignin":"Waiting for sign-in...","config.outlook.note":"Note: You need an Azure App Registration for this to work.","config.outlook.clientId":"Client ID (Application ID)","config.outlook.tenantIdOptional":"Tenant ID (Optional)","config.outlook.tenantHelp":'Default is "common". Use your specific Tenant ID for organization accounts.',"config.outlook.saveConnect":"Save & Connect","config.outlook.actionRequired":"Action Required","config.outlook.waitingAuth":"Waiting for authorization...","config.outlook.tenantPlaceholder":"common","config.model.title":"AI Model Configuration","config.model.desc":"Configure your AI model and processing settings","config.llm.title":"LLM","config.model.provider":"LLM Provider","config.model.defaultProvider":"RealTimeX AI (Default)","config.model.discovering":"Discovering...","config.model.name":"Model Name","config.model.selectModel":"Select a model","config.model.modelPlaceholder":"e.g. gpt-4o-mini","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.providers.gmail":"Gmail","config.providers.outlook":"Outlook","config.storage.title":"Storage Path","config.storage.desc":"Choose where raw email files are stored locally","config.storage.label":"Local Storage Path","config.storage.placeholder":"e.g. /Users/you/Documents/email-archive","config.storage.help":"Must be writable. Leave blank to use the default application folder.","config.rename.title":"Intelligent Rename","config.rename.desc":"Control filename formatting for stored emails","config.rename.label":"Enable intelligent rename","config.rename.help":"Creates readable, slugified filenames instead of raw message IDs.","config.sync.title":"Sync Interval (minutes)","config.sync.desc":"Controls how often background sync runs","config.sync.label":"Minutes between sync runs","config.sync.help":"Lower values increase freshness but may use more resources.","config.embed.title":"Embedding (RAG)","config.embed.desc":"Configure embeddings for knowledge base search (RAG).","config.embed.provider":"Embedding Provider","config.embed.model":"Embedding Model","config.embed.modelPlaceholder":"e.g. text-embedding-3-small","config.embed.autoModel":"Auto (text-embedding-3-small)","config.embed.help":"Used for semantic search in the knowledge base.","config.embed.discovering":"Discovering...","config.embed.defaultProvider":"RealTimeX AI (Default)","config.byok.title":"OAuth Credentials (Advanced)","config.byok.desc":"Configure OAuth credentials for Gmail and Outlook email access. IMAP is recommended for most users.","config.byok.systemDefault":"","config.byok.googleTitle":"Google / Gmail","config.byok.microsoftTitle":"Microsoft / Outlook","config.byok.clientId":"Client ID","config.byok.clientSecret":"Client Secret","config.byok.clientSecretOptional":"Client Secret (Optional)","config.byok.tenantId":"Tenant ID","config.byok.save":"Save API Key","config.imap.title":"Connect via IMAP","config.imap.connect":"Connect IMAP Account","config.imap.desc":"Connect any email provider using IMAP and SMTP protocols.","config.imap.appPasswordTitle":"Use an App Password","config.imap.appPasswordDesc":"Standard passwords often fail due to 2FA. Please generate an App Password in your email provider's security settings.","config.imap.emailLabel":"Email Address","config.imap.passwordLabel":"App Password","config.imap.nameLabel":"Sender Name (Optional)","config.imap.serverSettings":"Server Settings","config.imap.host":"Host","config.imap.port":"Port","config.imap.connectBtn":"Connect Account","config.imap.missingFields":"Please fill in all required fields","config.imap.connected":"IMAP account connected successfully","config.imap.connectFailed":"Failed to connect. Please check your credentials and server settings.","config.imap.connectDesc":"Connect any provider via App Password","config.providers.imap":"IMAP / SMTP","config.gmail.authSteps":`1. A new tab opened with Google Sign-In
105
+ 2. Sign in and authorize the app
106
+ 3. Copy the authorization code shown
107
+ 4. Paste it below`,"config.gmail.authCode":"Authorization Code","config.gmail.clientIdPlaceholder":"xxx.apps.googleusercontent.com","config.gmail.clientSecretPlaceholder":"GOCSPX-...","config.gmail.authCodePlaceholder":"4/0AQlEd8x...","config.rules.actionsHelp":"Select one or more actions to execute when the rule matches","config.rules.instructionsPlaceholder":"e.g. Tell them I'm busy until Friday, but interested in the proposal.","config.rules.attachmentsOptional":"Attachments (Optional)","config.rules.days":"days","config.rules.placeholder.domain":"rta.vn","config.rules.placeholder.email":"john@example.com","config.rules.category.newsletter":"Newsletter","config.rules.category.spam":"Spam","config.rules.category.promotional":"Promotional","config.rules.category.transactional":"Transactional","config.rules.category.social":"Social","config.rules.category.support":"Support","config.rules.category.client":"Client","config.rules.category.internal":"Internal","config.rules.category.personal":"Personal","config.rules.category.other":"Other","config.rules.sentiment.positive":"Positive","config.rules.sentiment.neutral":"Neutral","config.rules.sentiment.negative":"Negative","config.rules.priority.high":"High","config.rules.priority.medium":"Medium","config.rules.priority.low":"Low","config.voice.title":"Voice & Speech","config.voice.desc":"Configure text-to-speech for AI responses","config.voice.autoTitle":"Auto-Speak AI Responses","config.voice.autoHelp":"Automatically read AI responses aloud using text-to-speech","config.voice.provider":"TTS Provider","config.voice.providerHelp":"Select the text-to-speech provider","config.voice.loadingProviders":"Loading providers...","config.voice.voice":"Voice","config.voice.selectVoice":"Select a voice","config.voice.noVoices":"No voices available","config.voice.voiceHelp":"Choose the voice personality for speech synthesis","config.voice.speed":"Speed","config.voice.speedSlow":"0.5x (Slower)","config.voice.speedFast":"2.0x (Faster)","config.voice.quality":"Quality","config.voice.qualityLow":"1 (Lower quality, faster)","config.voice.qualityHigh":"20 (Higher quality, slower)","config.voice.test":"Test","config.voice.save":"Save Settings","config.voice.testText":"Hello! This is a test of the text-to-speech system.","config.voice.piperLocal":"Piper (Local)","config.voice.toast.providersFailed":"Failed to load TTS providers. Ensure RealTimeX Desktop is running.","config.voice.toast.serviceFailed":"Failed to connect to TTS service","config.voice.toast.testFailed":"Failed to test text-to-speech","config.voice.toast.saved":"Voice & Speech settings saved","config.voice.toast.saveFailed":"Failed to save settings","config.voice.toast.autoOn":"Auto-speak AI responses enabled","config.voice.toast.autoOff":"Auto-speak AI responses disabled","config.voice.toast.updateFailed":"Failed to update setting","config.agent.systemInstruction":"You are the Configuration Wizard. Guide the user through setting up their accounts, rules, and system preferences. Explain what each setting does and help them troubleshoot connections.","config.toast.providersFailed":"Failed to load providers","config.toast.providersFailedFallback":"Failed to load providers. Using defaults.","config.toast.embedProvidersFailed":"Failed to load embedding providers","config.toast.embedProvidersFailedFallback":"Failed to load embedding providers. Using defaults.","config.toast.connectionFailed":"Connection failed","config.toast.systemRuleMissing":"System rule not found. Please sync your database.","config.toast.startConnectionFailed":"Failed to start connection. Please ensure you are logged in.","config.toast.startGmailFailed":"Failed to start Gmail connection","config.toast.detectedDesktopCreds":"Detected Desktop app credentials","config.toast.detectedWebCreds":"Detected Web app - make sure redirect URI is configured in Google Cloud Console","config.toast.missingGmailCreds":"Please provide both Client ID and Client Secret","config.toast.authorizeAndPaste":"Please authorize in the opened tab, then paste the code here","config.toast.oauthUrlFailed":"Failed to get OAuth URL","config.toast.saveCredsFailed":"Failed to save credentials","config.toast.missingAuthCode":"Please paste the authorization code","config.toast.gmailConnected":"Gmail account connected successfully!","config.toast.gmailConnectFailed":"Failed to connect Gmail","config.toast.missingOutlookClientId":"Please provide the Client ID","config.toast.deviceFlowFailed":"Failed to start device flow","config.toast.outlookStartFailed":"Failed to start Outlook connection","config.toast.outlookConnected":"Outlook account connected","config.toast.connectionTimedOut":"Connection timed out. Please try again.","config.toast.ruleNameRequired":"Please name your rule","config.toast.ruleActionRequired":"Please select at least one action","config.toast.ruleUpdated":"Rule updated","config.toast.ruleCreated":"Rule created","config.toast.ruleUpdateFailed":"Failed to update rule","config.toast.ruleCreateFailed":"Failed to create rule","config.toast.ruleSaveError":"An error occurred while saving the rule","config.toast.disconnectConfirm":"Are you sure you want to disconnect this account?","config.toast.accountDisconnected":"Account disconnected","config.toast.settingsSaved":"Settings saved","config.toast.fileUploaded":"File uploaded","config.toast.fileUploadFailed":"Failed to upload file","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.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.selectCategories":"Select Categories (multiple allowed)","autopilot.editDialog.cat.newsletter":"Newsletter","autopilot.editDialog.cat.news":"News","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.notification":"Notification","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","terminal.tokens":"Tokens: {promptTokens} (in) + {completionTokens} (out)","terminal.itemsFailed":"⚠️ {count} items failed to process.","terminal.detail.systemPrompt":"System Prompt","terminal.detail.inputContent":"Input Content (Cleaned)","terminal.detail.rawLLMOutput":"Raw LLM JSON Output","terminal.detail.rawResponse":"Raw Response (from Error)","terminal.state.running":"Running","terminal.state.finished":"Finished","terminal.state.sync":"Sync","terminal.state.fetching":"Fetching","terminal.state.error":"Error","terminal.state.skipped":"Skipped","terminal.state.ingesting":"Ingesting","terminal.state.storage_error":"Storage Error","terminal.state.database_error":"Database Error","terminal.state.ingested":"Ingested","terminal.state.processing":"Processing","terminal.state.rules_matched":"Rules Matched","terminal.state.actions_resolved":"Actions Resolved","terminal.state.low_confidence":"Low Confidence","terminal.state.no_match":"No Match","terminal.state.processing_failed":"Processing Failed","terminal.state.multi_action":"Multi-Action","terminal.state.skipped_draft":"Skipped Draft","terminal.state.thinking":"Thinking","terminal.state.draft_processing_failed":"Draft Processing Failed","terminal.state.draft_skipped":"Draft Skipped","terminal.state.retention":"Retention","terminal.state.acting":"Acting","terminal.state.drafted":"Drafted","terminal.state.acted":"Acted","terminal.state.action_failed":"Action Failed","terminal.state.stopped":"Stopped","terminal.state.sdk_error":"SDK Error","terminal.state.empty_response":"Empty Response","terminal.state.decided":"Decided","terminal.state.malformed_response":"Malformed Response","terminal.message.background_processing":"Background processing: {subject}","terminal.message.rules_apply":"{count} rule(s) apply: {rules}","terminal.message.conflict_resolution":"After conflict resolution: {actions}","terminal.message.analyzing_email":"Analyzing email: {subject}","terminal.message.context_aware_analysis":"Context-aware analysis: {subject}","terminal.message.generating_draft":"Generating customized draft based on rule","persona.title":"Digital Persona","persona.subtitle":"Manage how your AI assistant represents you.","persona.identity":"Identity","persona.communication":"Communication","persona.automation":"Automation","persona.network":"Network","persona.edit.title":"Edit Persona","persona.edit.desc":"Update your digital assistant preferences.","common.edit":"Edit"},HL=Object.freeze(Object.defineProperty({__proto__:null,default:I_},Symbol.toStringTag,{value:"Module"})),V1={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:"🇻🇳"}},Au=I_,U_=w.createContext(void 0);function GL({children:e}){const[t,n]=w.useState(()=>localStorage.getItem("app_language")||"en"),[r,i]=w.useState(t==="en"?Au:{}),[l,u]=w.useState(t!=="en");w.useEffect(()=>{localStorage.setItem("app_language",t),document.documentElement.lang=t,(async()=>{if(t==="en"){i(Au),u(!1);return}u(!0);try{const p=await qL(Object.assign({"../locales/languages/en.json":()=>Aa(()=>Promise.resolve().then(()=>HL),void 0),"../locales/languages/es.json":()=>Aa(()=>import("./es-CUs1SbHI.js"),[]),"../locales/languages/fr.json":()=>Aa(()=>import("./fr-BPxHcEwt.js"),[]),"../locales/languages/ja.json":()=>Aa(()=>import("./ja-DmCVk5Xs.js"),[]),"../locales/languages/ko.json":()=>Aa(()=>import("./ko-Hn7rPT_g.js"),[]),"../locales/languages/vi.json":()=>Aa(()=>import("./vi-DZcpqfWU.js"),[])}),`../locales/languages/${t}.json`,4);i(p.default)}catch(p){console.error(`Failed to load translations for ${t}:`,p),i(Au)}finally{u(!1)}})()},[t]);const d=m=>{n(m)},h=m=>r[m]||Au[m]||m;return o.jsx(U_.Provider,{value:{language:t,setLanguage:d,t:h,isLoading:l},children:e})}function nt(){const e=w.useContext(U_);if(e===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return e}function uy({className:e}){const{language:t,setLanguage:n}=nt(),[r,i]=w.useState(!1),l=w.useRef(null);w.useEffect(()=>{function d(h){l.current&&!l.current.contains(h.target)&&i(!1)}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const u=V1[t];return o.jsxs("div",{className:pe("relative z-50",e),ref:l,children:[o.jsxs("button",{onClick:()=>i(!r),className:pe("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:[o.jsx("span",{className:"text-lg leading-none",children:u.flag}),o.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:t}),o.jsx(Wl,{className:pe("w-3 h-3 transition-transform duration-200",r&&"rotate-180")})]}),r&&o.jsxs("div",{className:pe("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:[o.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(V1).map(([d,{name:h,flag:m}])=>o.jsxs("button",{onClick:()=>{n(d),i(!1)},className:pe("flex items-center justify-between w-full px-3 py-2 rounded-lg text-sm transition-colors",t===d?"bg-primary/10 text-primary font-bold":"hover:bg-secondary text-muted-foreground hover:text-foreground"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg leading-none",children:m}),o.jsx("span",{children:h})]}),t===d&&o.jsx(ir,{className:"w-4 h-4"})]},d))]})]})}const B_=w.createContext(void 0);function KL({children:e}){const[t,n]=w.useState(!1),[r,i]=w.useState(!1),[l,u]=w.useState(null),d=w.useRef(null),h=w.useRef(null),m=w.useRef(null),p=w.useRef(null),g=w.useRef(0),v=w.useCallback(()=>{if(p.current&&(p.current.cancel().catch(()=>{}),p.current=null),m.current){try{m.current.stop(),m.current.disconnect()}catch{}m.current=null}d.current&&(d.current.pause(),d.current.currentTime=0,d.current=null),n(!1),i(!1),u(null),g.current++},[]),b=w.useCallback((S,N)=>new Promise((C,T)=>{S.decodeAudioData(N,D=>{const L=S.createBufferSource();L.buffer=D,L.connect(S.destination),L.onended=()=>C(),L.start(0),m.current=L},D=>T(D))}),[]),j=w.useCallback(async(S,N,C={})=>{v();const T=g.current;i(!0),u(N||null);const D={text:S,...C};console.log("[TTSContext] Sending TTS request:",D);try{const L=await fetch("/api/tts/speak",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)});if(!L.ok)throw new Error("TTS generation failed");const O=await L.blob(),B=URL.createObjectURL(O),M=new Audio(B);d.current=M,M.onplay=()=>n(!0),M.onended=()=>{g.current===T&&(n(!1),i(!1),u(null),URL.revokeObjectURL(B))},M.onerror=()=>{g.current===T&&(n(!1),i(!1),u(null),URL.revokeObjectURL(B),console.error("[TTSContext] Audio playback failed"))},await M.play()}catch(L){console.error("[TTSContext] Speak failed:",L),g.current===T&&(i(!1),u(null))}},[v]),_=w.useCallback(async(S,N,C={})=>{v();const T=g.current;i(!0),u(N||null);try{const D=await fetch("/api/tts/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:S,...C})});if(!D.ok)throw new Error("TTS streaming failed");const L=D.body?.getReader();if(!L)throw new Error("No response body");p.current=L;const O=new TextDecoder;let B="";const M=[];h.current||(h.current=new(window.AudioContext||window.webkitAudioContext));const q=h.current;for(;g.current===T;){const{done:R,value:J}=await L.read();if(R)break;B+=O.decode(J,{stream:!0});const K=B.split(`
108
+ `);B=K.pop()||"";for(const he of K){const se=he.trim();if(!se||!se.startsWith("data:"))continue;const ie=se.slice(5).trim();if(ie)try{const $=JSON.parse(ie);if($.audio){const V=atob($.audio),G=new Uint8Array(V.length);for(let fe=0;fe<V.length;fe++)G[fe]=V.charCodeAt(fe);M.push(G.buffer),M.length===1&&(n(!0),await b(q,G.buffer))}}catch{}}}if(g.current===T)for(let R=1;R<M.length&&g.current===T;R++)await b(q,M[R]);g.current===T&&(n(!1),i(!1),u(null))}catch(D){console.error("[TTSContext] Stream failed:",D),g.current===T&&(n(!1),i(!1),u(null))}},[v,b]);return o.jsx(B_.Provider,{value:{isPlaying:t,isSpeaking:r,speakingId:l,currentAudio:d.current,speak:j,speakStream:_,stop:v},children:e})}function V_(){const e=w.useContext(B_);if(e===void 0)throw new Error("useTTSContext must be used within a TTSProvider");return e}function dy(){const{speak:e,speakStream:t,stop:n,isPlaying:r,isSpeaking:i,speakingId:l}=V_(),u=w.useCallback(async(h,m,p={})=>e(h,m,p),[e]),d=w.useCallback(async(h,m,p={})=>t(h,m,p),[t]);return{speak:u,speakStream:d,stop:n,isPlaying:r,isSpeaking:i,speakingId:l}}const F_=w.createContext(void 0),F1={page_id:"global",system_instruction:"You are a helpful Email Assistant. Use general knowledge to help the user."};function $1(){return kp().autoPlay}function YL({children:e}){const[t,n]=w.useState(F1),[r,i]=w.useState([]),[l,u]=w.useState("idle"),{speak:d}=dy(),h=w.useCallback(g=>{n(v=>v.page_id===g.page_id&&JSON.stringify(v.data)===JSON.stringify(g.data)?v:(console.log(`[AgentContext] Registering new agent context: ${g.page_id}`),g))},[]),m=w.useCallback(()=>{n(F1)},[]),p=w.useCallback(async g=>{u("thinking");const v={role:"user",content:g};i(b=>[...b,v]);try{const b="/api/agent/chat",j=localStorage.getItem("supabase.auth.token"),_=wp(),S={...t,lang:localStorage.getItem("app_language")||"en",tools:t.tools?.map(D=>({name:D.name,description:D.description,parameters:D.parameters}))},N={message:g,context:S,history:r.slice(-10)},C=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${j||""}`,"X-Supabase-Url":_.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":_.anonKey},body:JSON.stringify(N)});if(!C.ok)throw new Error(`API request failed: ${C.status} ${C.statusText}`);const T=await C.json();if(T.success&&T.response){const D=T.response.content,L=T.response.action,O={role:"assistant",content:D};if(i(B=>[...B,O]),D&&$1()&&(u("speaking"),await d(D,void 0,kp())),L&&t.tools){console.log(`[AgentContext] Executing tool: ${L.name}`,L.args);const B=t.tools.find(M=>M.name===L.name);if(B)try{if(B.parameters?.required){const R=B.parameters.required.filter(J=>!(J in(L.args||{})));if(R.length>0)throw new Error(`Missing required parameters: ${R.join(", ")}`)}const M=await B.callback(L.args),q=M?.message||`✓ Action completed: ${L.name}`;i(R=>[...R,{role:"system",content:q}]),console.log("[AgentContext] Tool executed successfully:",M)}catch(M){console.error("[AgentContext] Tool execution failed:",M);const q=M?.message||"Unknown error occurred";i(R=>[...R,{role:"system",content:`⚠️ Error: ${q}`}]),$1()&&await d(`Error: ${q}`,void 0,kp())}else{const M=`Tool "${L.name}" not found. Available tools: ${t.tools.map(q=>q.name).join(", ")}`;console.warn(`[AgentContext] ${M}`),i(q=>[...q,{role:"system",content:`⚠️ ${M}`}])}}u("idle")}else{const D=T.error||"Sorry, I encountered an error processing your request.";console.error("[AgentContext] API error:",T.error),i(L=>[...L,{role:"assistant",content:`⚠️ ${D}`}]),u("idle")}}catch(b){console.error("[AgentContext] Chat failed:",b);let j="Network error. Please try again.";b.message?.includes("Failed to fetch")?j="Cannot connect to the AI service. Please ensure the API server is running.":b.message&&(j=b.message),i(_=>[..._,{role:"system",content:`⚠️ ${j}`}]),u("idle")}},[t,r,d]);return o.jsx(F_.Provider,{value:{currentConfig:t,registerAgent:h,chatHistory:r,agentState:l,sendMessage:p,resetAgent:m},children:e})}function $_(){const e=w.useContext(F_);if(e===void 0)throw new Error("useAgentContext must be used within an AgentProvider");return e}function fy(e){const{registerAgent:t,resetAgent:n}=$_();w.useRef(e);const r=JSON.stringify(e);w.useEffect(()=>(t(e),()=>{n()}),[r,t,n])}const eo="2.24.0",WL="20260206000017";function XL(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<Math.max(n.length,r.length);i++){const l=n[i]||0,u=r[i]||0;if(l>u)return 1;if(l<u)return-1}return 0}async function JL(e){try{const{data:t,error:n}=await e.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?(console.info("[Migration Check] RPC function missing - assuming fresh DB."),{version:null,latestMigrationTimestamp:"0"}):(console.warn("Could not get latest migration timestamp:",n.message),{version:null,latestMigrationTimestamp:null}):{version:eo,latestMigrationTimestamp:t||null}}catch(t){return console.error("Error checking database migration info:",t),{version:null,latestMigrationTimestamp:null}}}async function hy(e){const t=eo,n=WL,r=await JL(e);if(console.log("[Migration Check]",{appVersion:t,appMigrationTimestamp:n,dbVersion:r.version,dbMigrationTimestamp:r.latestMigrationTimestamp}),r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const i=n,l=r.latestMigrationTimestamp;return i>l?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:l,message:`New migrations available. Database is at ${l}, app has ${i}.`}:i<l?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:l,message:`Database (${l}) is ahead of app (${i}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:l,message:"Database schema is up-to-date."})}if(r.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const i=XL(t,r.version);return i>0?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database schema (v${r.version}) is outdated. Migration to v${t} required.`}:i===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${t}).`}):{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:null,message:`Database version (v${r.version}) is ahead of app (v${t}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:`Database schema unknown. Migration required to v${t}.`}}const Yp={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 QL(e,t){switch(t.type){case"SET_STEP":return{...e,step:t.payload,error:null};case"SET_ACCESS_TOKEN":return{...e,managed:{...e.managed,accessToken:t.payload}};case"SET_ORGANIZATIONS":return{...e,managed:{...e.managed,organizations:t.payload,selectedOrg:t.payload.length>0?t.payload[0].id:""}};case"SET_SELECTED_ORG":return{...e,managed:{...e.managed,selectedOrg:t.payload}};case"SET_PROJECT_NAME":return{...e,managed:{...e.managed,projectName:t.payload}};case"SET_REGION":return{...e,managed:{...e.managed,region:t.payload}};case"SET_FETCHING_ORGS":return{...e,managed:{...e.managed,isFetchingOrgs:t.payload}};case"SET_MANUAL_URL":return{...e,manual:{...e.manual,url:t.payload}};case"SET_MANUAL_ANON_KEY":return{...e,manual:{...e.manual,anonKey:t.payload}};case"SET_PROJECT_ID":return{...e,projectId:t.payload};case"ADD_LOG":return{...e,logs:[...e.logs,{...t.payload,timestamp:Date.now()}].slice(-500)};case"CLEAR_LOGS":return{...e,logs:[]};case"SET_ERROR":return{...e,error:t.payload};case"SET_MIGRATING":return{...e,isMigrating:t.payload};case"SET_MIGRATION_STATUS":return{...e,migrationStatus:t.payload};case"RESET_MANAGED_FLOW":return{...e,managed:{...Yp.managed},error:null};case"RESET_MANUAL_FLOW":return{...e,manual:{...Yp.manual},error:null};default:return e}}function Om(e){const t=e.trim();return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}.supabase.co`:""}function q_(e){const t=e.trim();return t?t.startsWith("sbp_")?t.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 q1(e){const t=e.trim();if(!t)return null;if(!t.includes(".")&&!t.includes("/"))return t;try{return new URL(t.startsWith("http")?t:`https://${t}`).hostname.split(".")[0]||null}catch{return null}}class ZL{buffer="";processChunk(t){const n=[];this.buffer+=t;const r=this.buffer.split(`
109
+ `);this.buffer=r.pop()||"";for(const i of r)if(i.startsWith("data: "))try{const l=i.slice(6),u=JSON.parse(l);n.push(u)}catch(l){console.warn("[SSEParser] Failed to parse event:",i,l)}return n}flush(){if(!this.buffer.trim())return[];const t=[];if(this.buffer.startsWith("data: "))try{const n=this.buffer.slice(6),r=JSON.parse(n);t.push(r)}catch(n){console.warn("[SSEParser] Failed to parse final buffer:",this.buffer,n)}return this.buffer="",t}reset(){this.buffer=""}}async function H_(e,t,n={}){const{timeout:r=3e5,onError:i}=n;if(!e.body)throw new Error("Response body is empty");const l=e.body.getReader(),u=new TextDecoder,d=new ZL,h=setTimeout(()=>{l.cancel("Timeout")},r);try{for(;;){const{value:m,done:p}=await l.read();if(p){d.flush().forEach(t);break}const g=u.decode(m,{stream:!0});d.processChunk(g).forEach(t)}}catch(m){const p=m instanceof Error?m:new Error(String(m));if(i)i(p);else throw p}finally{clearTimeout(h),d.reset()}}class Jr extends Error{constructor(t,n,r){super(t),this.code=n,this.status=r,this.name="SetupApiError"}}async function e6(e){const t=await fetch("/api/setup/organizations",{headers:{Authorization:`Bearer ${e}`}}),n=await t.json();if(!t.ok)throw new Jr(n.error||"Failed to fetch organizations","FETCH_ORGS_FAILED",t.status);return n}async function t6(e,t){const n=await fetch("/api/setup/auto-provision",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.accessToken}`},body:JSON.stringify({orgId:e.orgId,projectName:e.projectName,region:e.region})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Jr(r.error||"Failed to provision project","PROVISION_FAILED",n.status)}await H_(n,t,{timeout:3e5,onError:r=>{throw new Jr(`Provisioning stream error: ${r.message}`,"STREAM_ERROR")}})}async function n6(e,t){const n=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:e.projectRef,dbPassword:e.dbPassword,accessToken:e.accessToken,anonKey:e.anonKey})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Jr(r.error||"Failed to start migration","MIGRATION_FAILED",n.status)}await H_(n,t,{timeout:6e5,onError:r=>{throw new Jr(`Migration stream error: ${r.message}`,"STREAM_ERROR")}})}function s6({onNext:e}){const{t}=nt(),n=r=>{r.key==="Enter"&&(r.preventDefault(),e())};return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-8",onKeyDown:n,children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-4xl font-black italic tracking-tighter uppercase leading-none",children:t("setup.welcomeTitle")}),o.jsx("p",{className:"text-sm text-muted-foreground font-medium max-w-sm",children:t("setup.welcomeSubtitle")})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.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:[o.jsx(jg,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:t("setup.encryptedTitle")}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:t("setup.encryptedDesc")})]}),o.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:[o.jsx(ao,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest",children:t("setup.turboTitle")}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:t("setup.turboDesc")})]})]}),o.jsxs(Z,{onClick:e,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",autoFocus:!0,children:[t("setup.getStarted"),o.jsx(gg,{className:"w-5 h-5 ml-4 rotate-180 group-hover:translate-x-1 transition-transform","aria-hidden":"true"})]})]})}function r6({onManaged:e,onManual:t,onBack:n}){const{t:r}=nt();return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:r("setup.connectionMode")}),o.jsx("p",{className:"text-xs text-muted-foreground font-bold tracking-widest uppercase",children:r("setup.selectVector")})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("button",{onClick:e,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:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"p-3 bg-primary rounded-xl shadow-lg ring-4 ring-primary/10",children:o.jsx(dR,{className:"w-6 h-6 text-primary-foreground","aria-hidden":"true"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight",children:r("setup.quickIgnition")}),o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:r("setup.autoProvision")})]})]}),o.jsx(so,{className:"w-5 h-5 text-primary opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]}),o.jsxs("button",{onClick:t,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:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"p-3 bg-muted rounded-xl",children:o.jsx(xd,{className:"w-6 h-6 text-muted-foreground","aria-hidden":"true"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-black uppercase italic text-sm tracking-tight text-foreground/80",children:r("setup.manualSync")}),o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:r("setup.existingCredentials")})]})]}),o.jsx(so,{className:"w-5 h-5 text-muted-foreground opacity-50 group-hover:opacity-100 transition-all group-hover:translate-x-1"})]})]}),o.jsxs("button",{onClick:n,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:[o.jsx(gg,{size:12,"aria-hidden":"true"})," ",r("setup.abortAccess")]})]})}const De=w.forwardRef(({className:e,type:t,...n},r)=>o.jsx("input",{type:t,className:pe("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",e),ref:r,...n}));De.displayName="Input";var G_=tj();const a6=Yl(G_);var i6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],o6=i6.reduce((e,t)=>{const n=mj(`Primitive.${t}`),r=w.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),l6="Label",K_=w.forwardRef((e,t)=>o.jsx(o6.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));K_.displayName=l6;var c6=K_;function Ye({className:e,...t}){return o.jsx(c6,{"data-slot":"label",className:pe("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",e),...t})}const u6=_g("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 La({className:e,variant:t,...n}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:pe(u6({variant:t}),e),...n})}function Ia({className:e,...t}){return o.jsx("div",{"data-slot":"alert-description",className:pe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function d6({accessToken:e,error:t,isFetching:n,onTokenChange:r,onFetchOrgs:i,onBack:l}){const d=q_(e).valid,h=m=>{m.key==="Enter"&&d&&!n?(m.preventDefault(),i()):m.key==="Escape"&&!n&&(m.preventDefault(),l())};return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",onKeyDown:h,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Forge Token"}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Supabase API coordinates"})]}),t&&o.jsxs(La,{variant:"destructive",className:"rounded-xl bg-destructive/5 text-destructive border-destructive/20 text-[11px] font-bold",children:[o.jsx(qn,{className:"h-4 w-4"}),o.jsx(Ia,{children:t})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"access-token",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Personal Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(vg,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:14,"aria-hidden":"true"}),o.jsx(De,{id:"access-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:e,onChange:m=>r(m.target.value),className:"pl-10 h-12 bg-muted/20 border-border/50 rounded-xl","aria-describedby":"token-help","aria-invalid":t?"true":"false",autoFocus:!0})]}),o.jsxs("p",{id:"token-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:["Generate at"," ",o.jsx("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"supabase.com/dashboard/tokens"})]})]}),o.jsxs("div",{className:"flex gap-3 pt-4",children:[o.jsx(Z,{variant:"outline",onClick:l,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",disabled:n,children:"Back"}),o.jsx(Z,{onClick:i,disabled:!d||n,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest group shadow-lg hover:shadow-primary/20",children:n?o.jsx(jt,{className:"w-4 h-4 animate-spin"}):o.jsxs(o.Fragment,{children:["Scan Organizations"," ",o.jsx(so,{size:14,className:"ml-2 group-hover:translate-x-1 transition-transform"})]})})]})]})]})}function f6({organizations:e,selectedOrg:t,projectName:n,region:r,onOrgSelect:i,onProjectNameChange:l,onRegionChange:u,onProvision:d,onBack:h}){const m=p=>{p.key==="Enter"&&t?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),h())};return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",onKeyDown:m,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Project Config"}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Engine parameters"})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{htmlFor:"project-name",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Project Name"}),o.jsx(De,{id:"project-name",value:n,onChange:p=>l(p.target.value),className:"bg-muted/20 border-border/50 rounded-xl text-[11px]",autoFocus:!0})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{htmlFor:"region",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Hosting Sector"}),o.jsxs("select",{id:"region",value:r,onChange:p=>u(p.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:[o.jsx("option",{value:"us-east-1",children:"US East (N. Virginia)"}),o.jsx("option",{value:"us-west-1",children:"US West (N. California)"}),o.jsx("option",{value:"eu-central-1",children:"Europe (Frankfurt)"}),o.jsx("option",{value:"ap-southeast-1",children:"Asia Pacific (Singapore)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:"Vessel (Organization)"}),o.jsx("div",{className:"max-h-[160px] overflow-y-auto space-y-2 pr-1 custom-scrollbar",role:"radiogroup","aria-label":"Select organization",children:e.map(p=>o.jsxs("button",{onClick:()=>i(p.id),role:"radio","aria-checked":t===p.id,className:pe("w-full flex items-center justify-between p-3 rounded-xl border text-[11px] font-bold transition-all",t===p.id?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/30 border-border/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ij,{className:pe("w-3.5 h-3.5",t===p.id?"text-primary":"text-muted-foreground/50"),"aria-hidden":"true"}),o.jsx("span",{children:p.name})]}),t===p.id&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-primary animate-pulse","aria-hidden":"true"})]},p.id))})]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsx(Z,{variant:"outline",onClick:h,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Back"}),o.jsx(Z,{onClick:d,disabled:!t,className:"flex-1 h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest shadow-md",children:"Initialize System"})]})]})]})}function Y_({logs:e,className:t}){const n=w.useRef(null);return w.useEffect(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[e]),o.jsxs("div",{className:pe("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",t),role:"log","aria-live":"polite","aria-label":"Setup progress logs",children:[o.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:[o.jsx(Rl,{size:10,"aria-hidden":"true"}),o.jsx("span",{children:"Live Feed"})]}),e.length===0?o.jsx("div",{className:"text-slate-600 italic animate-pulse",role:"status",children:"Awaiting kernel signals..."}):o.jsxs(o.Fragment,{children:[e.map((r,i)=>o.jsxs("div",{className:pe("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:[o.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}-${i}`)),o.jsx("div",{ref:n})]})]})}function h6({logs:e,error:t,onRetry:n}){return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(jt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}),o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Provisioning"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Assembling infrastructure..."})]}),o.jsx(Y_,{logs:e}),t&&o.jsx(Z,{variant:"destructive",onClick:n,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Re-Initialize Engine"})]})}function m6({url:e,anonKey:t,error:n,onUrlChange:r,onAnonKeyChange:i,onSave:l,onBack:u}){const{t:d}=nt(),h=e.trim().length>0&&t.trim().length>0,m=p=>{p.key==="Enter"&&h?(p.preventDefault(),l()):p.key==="Escape"&&(p.preventDefault(),u())};return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",onKeyDown:m,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:d("setup.manualSync")}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:d("setup.injectCoordinates")})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{htmlFor:"platform-url",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:d("setup.platformUrl")}),o.jsx(De,{id:"platform-url",placeholder:"https://xyz.supabase.co",value:e,onChange:p=>r(p.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"url-help","aria-invalid":n?"true":"false",autoFocus:!0}),o.jsx("p",{id:"url-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:d("setup.urlHelp")})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{htmlFor:"anon-key",className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground ml-1",children:d("setup.anonMatrixKey")}),o.jsx(De,{id:"anon-key",type:"password",placeholder:"eyJ...",value:t,onChange:p=>i(p.target.value),className:"bg-muted/20 border-border/50 rounded-xl h-12","aria-describedby":"key-help","aria-invalid":n?"true":"false"}),o.jsx("p",{id:"key-help",className:"text-[9px] text-muted-foreground/60 px-1 italic",children:d("setup.keyHelp")})]})]}),n&&o.jsxs(or.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:[o.jsx(qn,{size:14,"aria-hidden":"true"}),o.jsx("span",{children:n})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-4",children:[o.jsx(Z,{variant:"outline",onClick:u,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:d("setup.back")}),o.jsx(Z,{onClick:l,disabled:!h,className:"h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest bg-primary shadow-lg hover:shadow-primary/20",children:d("setup.engage")})]})]})}function p6({logs:e,error:t,isMigrating:n,migrationStatus:r,accessToken:i,onTokenChange:l,onRunMigration:u,onBypass:d}){const h=!i,m=r?.dbVersion!==null&&!r?.isUnknown,p=r?.dbVersion===null||r?.isUnknown,g=v=>{v.key==="Enter"&&!h&&!n&&(v.preventDefault(),u())};return o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-6",onKeyDown:g,children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[n?o.jsx(jt,{className:"w-5 h-5 animate-spin text-primary","aria-hidden":"true"}):o.jsx(NC,{className:"w-5 h-5 text-primary","aria-hidden":"true"}),o.jsx("h3",{className:"text-2xl font-black uppercase italic tracking-tighter",children:"Installation"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-widest uppercase",children:"Applying schema DNA..."})]}),o.jsx(Y_,{logs:e}),!n&&o.jsxs(or.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:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed font-medium",children:p?"Empty project detected. Initialization is mandatory to install core AI systems.":`Version mismatch detected (v${r?.dbVersion||"?.?"} → v${r?.appVersion||eo}). Normalization is recommended.`}),h&&o.jsxs("div",{className:"space-y-2 pt-2 border-t border-primary/10",children:[o.jsx(Ye,{htmlFor:"migration-token",className:"text-[10px] font-bold uppercase tracking-widest text-primary/60",children:"Management Token Required"}),o.jsxs("div",{className:"relative",children:[o.jsx(vg,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-primary/30",size:12,"aria-hidden":"true"}),o.jsx(De,{id:"migration-token",type:"password",placeholder:"sbp_xxxxxxxxxxxxxxxx",value:i,onChange:v=>l(v.target.value),className:"pl-9 h-10 bg-background/50 border-primary/20 rounded-xl text-[11px]","aria-describedby":"migration-token-help",autoFocus:!0})]}),o.jsxs("p",{id:"migration-token-help",className:"text-[9px] text-muted-foreground/60 italic px-1",children:["Used once to run ",o.jsx("code",{className:"text-primary/70",children:"migrate.sh"})," on your backend."]})]})]}),o.jsxs("div",{className:"flex gap-3",children:[m&&o.jsx(Z,{variant:"ghost",onClick:d,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)"}),o.jsx(Z,{onClick:u,disabled:h,className:"flex-1 h-11 bg-primary text-[10px] font-bold uppercase tracking-widest shadow-lg hover:shadow-primary/30",children:p?"Install Systems":"Normalize System"})]})]}),t&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs(La,{variant:"destructive",className:"rounded-xl border-destructive/20 bg-destructive/5 text-destructive font-bold text-[11px]",children:[o.jsx(qn,{className:"h-4 w-4"}),o.jsx(Ia,{children:t})]}),o.jsx(Z,{variant:"outline",onClick:u,className:"w-full h-12 rounded-xl text-[10px] font-bold uppercase tracking-widest",children:"Retry Installation"})]})]})}function Ru({step:e,currentStep:t,label:n}){const r=Array.isArray(e)?e.includes(t):t===e;return o.jsx("div",{className:pe("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:n})}function my({className:e}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:pe("w-9 h-9",e),children:[o.jsx("path",{d:"M112 112H400C426.51 112 448 133.49 448 160V352C448 378.51 426.51 400 400 400H112C85.4903 400 64 378.51 64 352V160C64 133.49 85.4903 112 112 112Z",stroke:"currentColor",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M64 160 L240 290 C250 295 262 295 272 290 L448 160",stroke:"currentColor",strokeWidth:"28",strokeLinecap:"round",strokeLinejoin:"round"}),o.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 W_({onComplete:e,open:t=!0,canClose:n=!1}){const[r,i]=w.useReducer(QL,Yp),{t:l}=nt();fy({page_id:"setup_wizard",system_instruction:l("setup.agent.systemInstruction"),data:{step:r.step,managedFlow:["managed-token","managed-org","provisioning","validating"].includes(r.step),projectId:r.projectId||null,hasAccessToken:!!r.managed.accessToken}});const u=w.useRef(""),d=w.useRef("");w.useEffect(()=>()=>{u.current="",d.current=""},[]);const h=w.useCallback((j,_)=>{i({type:"ADD_LOG",payload:{type:j,message:_}})},[]),m=w.useCallback(async()=>{i({type:"SET_ERROR",payload:null}),i({type:"SET_FETCHING_ORGS",payload:!0});const j=r.managed.accessToken.trim(),_=q_(j);if(!_.valid){i({type:"SET_ERROR",payload:_.message||"Invalid token"}),i({type:"SET_FETCHING_ORGS",payload:!1});return}try{u.current=j;const S=await e6(j);i({type:"SET_ORGANIZATIONS",payload:S}),i({type:"SET_STEP",payload:"managed-org"})}catch(S){const N=S instanceof Jr?S:new Error(String(S));i({type:"SET_ERROR",payload:N.message})}finally{i({type:"SET_FETCHING_ORGS",payload:!1})}},[r.managed.accessToken]),p=w.useCallback(async()=>{i({type:"SET_ERROR",payload:null}),i({type:"SET_STEP",payload:"provisioning"}),i({type:"CLEAR_LOGS"}),h("info","Connecting to Supabase provisioning engine...");const j=u.current||r.managed.accessToken.trim();let _=null;try{if(await t6({accessToken:j,orgId:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region},S=>{switch(S.type){case"info":h("info",S.data);break;case"project_id":i({type:"SET_PROJECT_ID",payload:S.data});break;case"success":_=S.data,h("success","✨ Project ready! Initializing database..."),gm({url:Om(_.url),anonKey:_.anonKey.trim()}),d.current=_.dbPass,i({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:eo,isUnknown:!0}});break;case"error":i({type:"SET_ERROR",payload:S.data}),h("error",S.data);break}}),_){const S=_;await g(S.projectId,j,S.url,S.anonKey)}}catch(S){const N=S instanceof Jr?S:new Error(String(S));i({type:"SET_ERROR",payload:N.message}),h("error",`Provisioning failed: ${N.message}`)}},[r.managed.selectedOrg,r.managed.projectName,r.managed.region,r.managed.accessToken,h]),g=w.useCallback(async(j,_,S,N)=>{const C=j||r.projectId||q1(r.manual.url),T=_||u.current||r.managed.accessToken.trim(),D=S||r.manual.url,L=N||r.manual.anonKey;if(!C||!T){i({type:"SET_ERROR",payload:"Project ID and Access Token are required for migration."});return}i({type:"SET_STEP",payload:"migration"}),i({type:"SET_ERROR",payload:null}),i({type:"SET_MIGRATING",payload:!0}),i({type:"CLEAR_LOGS"}),h("info","📦 Preparing database schema initialization...");try{let O=!1;if(await n6({projectRef:C,dbPassword:d.current,accessToken:T,anonKey:L},B=>{switch(B.type){case"stdout":h("stdout",B.data);break;case"stderr":h("stderr",`⚠️ ${B.data}`);break;case"info":h("info",B.data);break;case"error":h("error",B.data);break;case"done":B.data==="success"?(O=!0,h("success","✅ Database setup complete!"),D&&L&&gm({url:Om(D),anonKey:L.trim()}),u.current="",d.current="",setTimeout(()=>{e(),window.location.reload()},2e3)):i({type:"SET_ERROR",payload:"Migration failed. Check terminal logs for details."});break}}),!O)throw new Error("Migration did not complete successfully")}catch(O){const B=O instanceof Jr?O:new Error(String(O));i({type:"SET_ERROR",payload:B.message}),h("error",`Migration failed: ${B.message}`)}finally{i({type:"SET_MIGRATING",payload:!1})}},[r.projectId,r.manual.url,r.manual.anonKey,r.managed.accessToken,h,e]),v=w.useCallback(async()=>{i({type:"SET_ERROR",payload:null}),i({type:"SET_STEP",payload:"validating"});const j=Om(r.manual.url),_=r.manual.anonKey.trim(),S=await B5(j,_);if(S.valid){i({type:"SET_MANUAL_URL",payload:j});const N=q1(j);N&&i({type:"SET_PROJECT_ID",payload:N}),gm({url:j,anonKey:_});try{const C=bp(j,_),T=await hy(C);i({type:"SET_MIGRATION_STATUS",payload:T}),T.needsMigration?i({type:"SET_STEP",payload:"migration"}):(h("success","✨ Database is already up-to-date! Redirecting..."),setTimeout(()=>{e(),window.location.reload()},2e3))}catch(C){console.warn("[SetupWizard] Migration check failed:",C),i({type:"SET_MIGRATION_STATUS",payload:{needsMigration:!0,dbVersion:null,appVersion:eo,isUnknown:!0}}),i({type:"SET_STEP",payload:"migration"})}}else i({type:"SET_ERROR",payload:S.error||"Connection failed"}),i({type:"SET_STEP",payload:"credentials"})},[r.manual.url,r.manual.anonKey,h,e]);if(!t)return null;const b={initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20}};return o.jsx("div",{className:"fixed inset-0 z-50 bg-background flex flex-col items-center justify-center p-0 md:p-8",children:o.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:[o.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:[o.jsxs("div",{className:"space-y-8 relative z-10",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o.jsx("div",{className:"p-2 bg-primary rounded-lg flex-shrink-0",children:o.jsx(my,{className:"w-5 h-5 text-primary-foreground"})}),o.jsx("span",{className:"font-black italic tracking-tighter uppercase text-xs truncate",children:"Automator Forge"})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.4em] text-muted-foreground/30 ml-1",children:"Assembly Phase"}),o.jsxs("div",{className:"space-y-4 px-1",children:[o.jsx(Ru,{step:"welcome",currentStep:r.step,label:l("setup.initiation")}),o.jsx(Ru,{step:["type","managed-token","credentials"],currentStep:r.step,label:l("setup.coordinates")}),o.jsx(Ru,{step:["managed-org","provisioning","validating"],currentStep:r.step,label:l("setup.foundation")}),o.jsx(Ru,{step:"migration",currentStep:r.step,label:l("setup.ignition")})]})]})]}),o.jsx("div",{className:"relative z-10 space-y-4",children:o.jsxs("p",{className:"text-[9px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em] px-2 text-center",children:["v",eo," // Stable Build"]})})]}),o.jsxs("div",{className:"flex-1 p-8 md:p-12 flex flex-col relative",children:[n&&o.jsx("button",{onClick:e,className:"absolute top-6 right-6 p-2 rounded-full hover:bg-secondary transition-colors z-[60]","aria-label":"Close setup wizard",children:o.jsx(fn,{className:"w-5 h-5 text-muted-foreground opacity-40 hover:opacity-100 transition-opacity"})}),o.jsx("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:o.jsx(uy,{})}),o.jsx(__,{mode:"wait",children:o.jsxs(or.div,{initial:"initial",animate:"animate",exit:"exit",variants:b,transition:{type:"spring",damping:25,stiffness:200},className:"flex-1 flex flex-col",children:[r.step==="welcome"&&o.jsx(s6,{onNext:()=>i({type:"SET_STEP",payload:"type"})}),r.step==="type"&&o.jsx(r6,{onManaged:()=>{i({type:"RESET_MANUAL_FLOW"}),i({type:"SET_STEP",payload:"managed-token"})},onManual:()=>{i({type:"RESET_MANAGED_FLOW"}),i({type:"SET_STEP",payload:"credentials"})},onBack:()=>i({type:"SET_STEP",payload:"welcome"})}),r.step==="managed-token"&&o.jsx(d6,{accessToken:r.managed.accessToken,error:r.error,isFetching:r.managed.isFetchingOrgs,onTokenChange:j=>i({type:"SET_ACCESS_TOKEN",payload:j}),onFetchOrgs:m,onBack:()=>i({type:"SET_STEP",payload:"type"})}),r.step==="managed-org"&&o.jsx(f6,{organizations:r.managed.organizations,selectedOrg:r.managed.selectedOrg,projectName:r.managed.projectName,region:r.managed.region,onOrgSelect:j=>i({type:"SET_SELECTED_ORG",payload:j}),onProjectNameChange:j=>i({type:"SET_PROJECT_NAME",payload:j}),onRegionChange:j=>i({type:"SET_REGION",payload:j}),onProvision:p,onBack:()=>i({type:"SET_STEP",payload:"managed-token"})}),r.step==="provisioning"&&o.jsx(h6,{logs:r.logs,error:r.error,onRetry:()=>i({type:"SET_STEP",payload:"managed-token"})}),r.step==="credentials"&&o.jsx(m6,{url:r.manual.url,anonKey:r.manual.anonKey,error:r.error,onUrlChange:j=>i({type:"SET_MANUAL_URL",payload:j}),onAnonKeyChange:j=>i({type:"SET_MANUAL_ANON_KEY",payload:j}),onSave:v,onBack:()=>i({type:"SET_STEP",payload:"type"})}),r.step==="migration"&&o.jsx(p6,{logs:r.logs,error:r.error,isMigrating:r.isMigrating,migrationStatus:r.migrationStatus,accessToken:r.managed.accessToken,onTokenChange:j=>i({type:"SET_ACCESS_TOKEN",payload:j}),onRunMigration:()=>g(),onBypass:()=>{e(),window.location.reload()}})]},r.step)})]})]})})}function Qr(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function g6(e,t){const n=w.createContext(t),r=l=>{const{children:u,...d}=l,h=w.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function i(l){const u=w.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,i]}function y6(e,t=[]){let n=[];function r(l,u){const d=w.createContext(u),h=n.length;n=[...n,u];const m=g=>{const{scope:v,children:b,...j}=g,_=v?.[e]?.[h]||d,S=w.useMemo(()=>j,Object.values(j));return o.jsx(_.Provider,{value:S,children:b})};m.displayName=l+"Provider";function p(g,v){const b=v?.[e]?.[h]||d,j=w.useContext(b);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,p]}const i=()=>{const l=n.map(u=>w.createContext(u));return function(d){const h=d?.[e]||l;return w.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[r,x6(i,...t)]}function x6(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var ql=globalThis?.document?w.useLayoutEffect:()=>{},v6=pg[" useId ".trim().toString()]||(()=>{}),b6=0;function Mm(e){const[t,n]=w.useState(v6());return ql(()=>{n(r=>r??String(b6++))},[e]),e||(t?`radix-${t}`:"")}var w6=pg[" useInsertionEffect ".trim().toString()]||ql;function S6({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,l,u]=j6({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:i;{const p=w.useRef(e!==void 0);w.useEffect(()=>{const g=p.current;g!==d&&console.warn(`${r} is changing from ${g?"controlled":"uncontrolled"} to ${d?"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.`),p.current=d},[d,r])}const m=w.useCallback(p=>{if(d){const g=k6(p)?p(e):p;g!==e&&u.current?.(g)}else l(p)},[d,e,l,u]);return[h,m]}function j6({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),i=w.useRef(n),l=w.useRef(t);return w6(()=>{l.current=t},[t]),w.useEffect(()=>{i.current!==n&&(l.current?.(n),i.current=n)},[n,i]),[n,r,l]}function k6(e){return typeof e=="function"}function _6(e){const t=N6(e),n=w.forwardRef((r,i)=>{const{children:l,...u}=r,d=w.Children.toArray(l),h=d.find(E6);if(h){const m=h.props.children,p=d.map(g=>g===h?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:g);return o.jsx(t,{...u,ref:i,children:w.isValidElement(m)?w.cloneElement(m,void 0,p):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function N6(e){const t=w.forwardRef((n,r)=>{const{children:i,...l}=n;if(w.isValidElement(i)){const u=A6(i),d=C6(l,i.props);return i.type!==w.Fragment&&(d.ref=r?jd(r,u):u),w.cloneElement(i,d)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var T6=Symbol("radix.slottable");function E6(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===T6}function C6(e,t){const n={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?n[r]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...l}:r==="className"&&(n[r]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function A6(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var R6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pr=R6.reduce((e,t)=>{const n=_6(`Primitive.${t}`),r=w.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function D6(e,t){e&&G_.flushSync(()=>e.dispatchEvent(t))}function Hl(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>t.current?.(...n),[])}function O6(e,t=globalThis?.document){const n=Hl(e);w.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var M6="DismissableLayer",Wp="dismissableLayer.update",P6="dismissableLayer.pointerDownOutside",z6="dismissableLayer.focusOutside",H1,X_=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),J_=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=w.useContext(X_),[p,g]=w.useState(null),v=p?.ownerDocument??globalThis?.document,[,b]=w.useState({}),j=Va(t,B=>g(B)),_=Array.from(m.layers),[S]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),N=_.indexOf(S),C=p?_.indexOf(p):-1,T=m.layersWithOutsidePointerEventsDisabled.size>0,D=C>=N,L=U6(B=>{const M=B.target,q=[...m.branches].some(R=>R.contains(M));!D||q||(i?.(B),u?.(B),B.defaultPrevented||d?.())},v),O=B6(B=>{const M=B.target;[...m.branches].some(R=>R.contains(M))||(l?.(B),u?.(B),B.defaultPrevented||d?.())},v);return O6(B=>{C===m.layers.size-1&&(r?.(B),!B.defaultPrevented&&d&&(B.preventDefault(),d()))},v),w.useEffect(()=>{if(p)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(H1=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),G1(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=H1)}},[p,v,n,m]),w.useEffect(()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),G1())},[p,m]),w.useEffect(()=>{const B=()=>b({});return document.addEventListener(Wp,B),()=>document.removeEventListener(Wp,B)},[]),o.jsx(pr.div,{...h,ref:j,style:{pointerEvents:T?D?"auto":"none":void 0,...e.style},onFocusCapture:Qr(e.onFocusCapture,O.onFocusCapture),onBlurCapture:Qr(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Qr(e.onPointerDownCapture,L.onPointerDownCapture)})});J_.displayName=M6;var L6="DismissableLayerBranch",I6=w.forwardRef((e,t)=>{const n=w.useContext(X_),r=w.useRef(null),i=Va(t,r);return w.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),o.jsx(pr.div,{...e,ref:i})});I6.displayName=L6;function U6(e,t=globalThis?.document){const n=Hl(e),r=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){Q_(P6,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function B6(e,t=globalThis?.document){const n=Hl(e),r=w.useRef(!1);return w.useEffect(()=>{const i=l=>{l.target&&!r.current&&Q_(z6,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function G1(){const e=new CustomEvent(Wp);document.dispatchEvent(e)}function Q_(e,t,n,{discrete:r}){const i=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?D6(i,l):i.dispatchEvent(l)}var Pm="focusScope.autoFocusOnMount",zm="focusScope.autoFocusOnUnmount",K1={bubbles:!1,cancelable:!0},V6="FocusScope",Z_=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=e,[d,h]=w.useState(null),m=Hl(i),p=Hl(l),g=w.useRef(null),v=Va(t,_=>h(_)),b=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let _=function(T){if(b.paused||!d)return;const D=T.target;d.contains(D)?g.current=D:Gr(g.current,{select:!0})},S=function(T){if(b.paused||!d)return;const D=T.relatedTarget;D!==null&&(d.contains(D)||Gr(g.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const L of T)L.removedNodes.length>0&&Gr(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",S);const C=new MutationObserver(N);return d&&C.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),C.disconnect()}}},[r,d,b.paused]),w.useEffect(()=>{if(d){W1.add(b);const _=document.activeElement;if(!d.contains(_)){const N=new CustomEvent(Pm,K1);d.addEventListener(Pm,m),d.dispatchEvent(N),N.defaultPrevented||(F6(K6(eN(d)),{select:!0}),document.activeElement===_&&Gr(d))}return()=>{d.removeEventListener(Pm,m),setTimeout(()=>{const N=new CustomEvent(zm,K1);d.addEventListener(zm,p),d.dispatchEvent(N),N.defaultPrevented||Gr(_??document.body,{select:!0}),d.removeEventListener(zm,p),W1.remove(b)},0)}}},[d,m,p,b]);const j=w.useCallback(_=>{if(!n&&!r||b.paused)return;const S=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,N=document.activeElement;if(S&&N){const C=_.currentTarget,[T,D]=$6(C);T&&D?!_.shiftKey&&N===D?(_.preventDefault(),n&&Gr(T,{select:!0})):_.shiftKey&&N===T&&(_.preventDefault(),n&&Gr(D,{select:!0})):N===C&&_.preventDefault()}},[n,r,b.paused]);return o.jsx(pr.div,{tabIndex:-1,...u,ref:v,onKeyDown:j})});Z_.displayName=V6;function F6(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Gr(r,{select:t}),document.activeElement!==n)return}function $6(e){const t=eN(e),n=Y1(t,e),r=Y1(t.reverse(),e);return[n,r]}function eN(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Y1(e,t){for(const n of e)if(!q6(n,{upTo:t}))return n}function q6(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function H6(e){return e instanceof HTMLInputElement&&"select"in e}function Gr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&H6(e)&&t&&e.select()}}var W1=G6();function G6(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=X1(e,t),e.unshift(t)},remove(t){e=X1(e,t),e[0]?.resume()}}}function X1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function K6(e){return e.filter(t=>t.tagName!=="A")}var Y6="Portal",tN=w.forwardRef((e,t)=>{const{container:n,...r}=e,[i,l]=w.useState(!1);ql(()=>l(!0),[]);const u=n||i&&globalThis?.document?.body;return u?a6.createPortal(o.jsx(pr.div,{...r,ref:t}),u):null});tN.displayName=Y6;function W6(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Rd=e=>{const{present:t,children:n}=e,r=X6(t),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),l=Va(r.ref,J6(i));return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:l}):null};Rd.displayName="Presence";function X6(e){const[t,n]=w.useState(),r=w.useRef(null),i=w.useRef(e),l=w.useRef("none"),u=e?"mounted":"unmounted",[d,h]=W6(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const m=Du(r.current);l.current=d==="mounted"?m:"none"},[d]),ql(()=>{const m=r.current,p=i.current;if(p!==e){const v=l.current,b=Du(m);e?h("MOUNT"):b==="none"||m?.display==="none"?h("UNMOUNT"):h(p&&v!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),ql(()=>{if(t){let m;const p=t.ownerDocument.defaultView??window,g=b=>{const _=Du(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&_&&(h("ANIMATION_END"),!i.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",m=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},v=b=>{b.target===t&&(l.current=Du(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(m),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:w.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function Du(e){return e?.animationName||"none"}function J6(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Lm=0;function Q6(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??J1()),document.body.insertAdjacentElement("beforeend",e[1]??J1()),Lm++,()=>{Lm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Lm--}},[])}function J1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Wu="right-scroll-bar-position",Xu="width-before-scroll-bar",Z6="with-scroll-bars-hidden",eI="--removed-body-scroll-bar-size";function Im(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tI(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var nI=typeof window<"u"?w.useLayoutEffect:w.useEffect,Q1=new WeakMap;function sI(e,t){var n=tI(null,function(r){return e.forEach(function(i){return Im(i,r)})});return nI(function(){var r=Q1.get(n);if(r){var i=new Set(r),l=new Set(e),u=n.current;i.forEach(function(d){l.has(d)||Im(d,null)}),l.forEach(function(d){i.has(d)||Im(d,u)})}Q1.set(n,e)},[e]),n}function rI(e){return e}function aI(e,t){t===void 0&&(t=rI);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var p=u;u=[],p.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(p){u.push(p),m()},filter:function(p){return u=u.filter(p),n}}}};return i}function iI(e){e===void 0&&(e={});var t=aI(null);return t.options=Ds({async:!0,ssr:!1},e),t}var nN=function(e){var t=e.sideCar,n=uo(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,Ds({},n))};nN.isSideCarExport=!0;function oI(e,t){return e.useMedium(t),nN}var sN=iI(),Um=function(){},Dd=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Um,onWheelCapture:Um,onTouchMoveCapture:Um}),i=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,p=e.enabled,g=e.shards,v=e.sideCar,b=e.noRelative,j=e.noIsolation,_=e.inert,S=e.allowPinchZoom,N=e.as,C=N===void 0?"div":N,T=e.gapMode,D=uo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=v,O=sI([n,t]),B=Ds(Ds({},D),i);return w.createElement(w.Fragment,null,p&&w.createElement(L,{sideCar:sN,removeScrollBar:m,shards:g,noRelative:b,noIsolation:j,inert:_,setCallbacks:l,allowPinchZoom:!!S,lockRef:n,gapMode:T}),u?w.cloneElement(w.Children.only(d),Ds(Ds({},B),{ref:O})):w.createElement(C,Ds({},B,{className:h,ref:O}),d))});Dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dd.classNames={fullWidth:Xu,zeroRight:Wu};var lI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lI();return t&&e.setAttribute("nonce",t),e}function uI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cI())&&(uI(t,n),dI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hI=function(){var e=fI();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rN=function(){var e=hI(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},mI={left:0,top:0,right:0,gap:0},Bm=function(e){return parseInt(e||"",10)||0},pI=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Bm(n),Bm(r),Bm(i)]},gI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mI;var t=pI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},yI=rN(),to="data-scroll-locked",xI=function(e,t,n,r){var i=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
110
+ .`.concat(Z6,` {
111
+ overflow: hidden `).concat(r,`;
112
+ padding-right: `).concat(d,"px ").concat(r,`;
113
+ }
114
+ body[`).concat(to,`] {
115
+ overflow: hidden `).concat(r,`;
116
+ overscroll-behavior: contain;
117
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
118
+ padding-left: `.concat(i,`px;
119
+ padding-top: `).concat(l,`px;
120
+ padding-right: `).concat(u,`px;
121
+ margin-left:0;
122
+ margin-top:0;
123
+ margin-right: `).concat(d,"px ").concat(r,`;
124
+ `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(r,";")].filter(Boolean).join(""),`
125
+ }
126
+
127
+ .`).concat(Wu,` {
128
+ right: `).concat(d,"px ").concat(r,`;
129
+ }
130
+
131
+ .`).concat(Xu,` {
132
+ margin-right: `).concat(d,"px ").concat(r,`;
133
+ }
134
+
135
+ .`).concat(Wu," .").concat(Wu,` {
136
+ right: 0 `).concat(r,`;
137
+ }
138
+
139
+ .`).concat(Xu," .").concat(Xu,` {
140
+ margin-right: 0 `).concat(r,`;
141
+ }
142
+
143
+ body[`).concat(to,`] {
144
+ `).concat(eI,": ").concat(d,`px;
145
+ }
146
+ `)},Z1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},vI=function(){w.useEffect(function(){return document.body.setAttribute(to,(Z1()+1).toString()),function(){var e=Z1()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},bI=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;vI();var l=w.useMemo(function(){return gI(i)},[i]);return w.createElement(yI,{styles:xI(l,!t,i,n?"":"!important")})},Xp=!1;if(typeof window<"u")try{var Ou=Object.defineProperty({},"passive",{get:function(){return Xp=!0,!0}});window.addEventListener("test",Ou,Ou),window.removeEventListener("test",Ou,Ou)}catch{Xp=!1}var Ii=Xp?{passive:!1}:!1,wI=function(e){return e.tagName==="TEXTAREA"},aN=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!wI(e)&&n[t]==="visible")},SI=function(e){return aN(e,"overflowY")},jI=function(e){return aN(e,"overflowX")},eS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=iN(e,r);if(i){var l=oN(e,r),u=l[1],d=l[2];if(u>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kI=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},_I=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},iN=function(e,t){return e==="v"?SI(t):jI(t)},oN=function(e,t){return e==="v"?kI(t):_I(t)},NI=function(e,t){return e==="h"&&t==="rtl"?-1:1},TI=function(e,t,n,r,i){var l=NI(e,window.getComputedStyle(t).direction),u=l*r,d=n.target,h=t.contains(d),m=!1,p=u>0,g=0,v=0;do{if(!d)break;var b=oN(e,d),j=b[0],_=b[1],S=b[2],N=_-S-l*j;(j||N)&&iN(e,d)&&(g+=N,v+=j);var C=d.parentNode;d=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(p&&Math.abs(g)<1||!p&&Math.abs(v)<1)&&(m=!0),m},Mu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tS=function(e){return[e.deltaX,e.deltaY]},nS=function(e){return e&&"current"in e?e.current:e},EI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},CI=function(e){return`
147
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
148
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
149
+ `)},AI=0,Ui=[];function RI(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(AI++)[0],l=w.useState(rN)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var _=l4([e.lockRef.current],(e.shards||[]).map(nS),!0).filter(Boolean);return _.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=w.useCallback(function(_,S){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!u.current.allowPinchZoom;var N=Mu(_),C=n.current,T="deltaX"in _?_.deltaX:C[0]-N[0],D="deltaY"in _?_.deltaY:C[1]-N[1],L,O=_.target,B=Math.abs(T)>Math.abs(D)?"h":"v";if("touches"in _&&B==="h"&&O.type==="range")return!1;var M=window.getSelection(),q=M&&M.anchorNode,R=q?q===O||q.contains(O):!1;if(R)return!1;var J=eS(B,O);if(!J)return!0;if(J?L=B:(L=B==="v"?"h":"v",J=eS(B,O)),!J)return!1;if(!r.current&&"changedTouches"in _&&(T||D)&&(r.current=L),!L)return!0;var K=r.current||L;return TI(K,S,_,K==="h"?T:D)},[]),h=w.useCallback(function(_){var S=_;if(!(!Ui.length||Ui[Ui.length-1]!==l)){var N="deltaY"in S?tS(S):Mu(S),C=t.current.filter(function(L){return L.name===S.type&&(L.target===S.target||S.target===L.shadowParent)&&EI(L.delta,N)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var T=(u.current.shards||[]).map(nS).filter(Boolean).filter(function(L){return L.contains(S.target)}),D=T.length>0?d(S,T[0]):!u.current.noIsolation;D&&S.cancelable&&S.preventDefault()}}},[]),m=w.useCallback(function(_,S,N,C){var T={name:_,delta:S,target:N,should:C,shadowParent:DI(N)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(D){return D!==T})},1)},[]),p=w.useCallback(function(_){n.current=Mu(_),r.current=void 0},[]),g=w.useCallback(function(_){m(_.type,tS(_),_.target,d(_,e.lockRef.current))},[]),v=w.useCallback(function(_){m(_.type,Mu(_),_.target,d(_,e.lockRef.current))},[]);w.useEffect(function(){return Ui.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:v}),document.addEventListener("wheel",h,Ii),document.addEventListener("touchmove",h,Ii),document.addEventListener("touchstart",p,Ii),function(){Ui=Ui.filter(function(_){return _!==l}),document.removeEventListener("wheel",h,Ii),document.removeEventListener("touchmove",h,Ii),document.removeEventListener("touchstart",p,Ii)}},[]);var b=e.removeScrollBar,j=e.inert;return w.createElement(w.Fragment,null,j?w.createElement(l,{styles:CI(i)}):null,b?w.createElement(bI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function DI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const OI=oI(sN,RI);var lN=w.forwardRef(function(e,t){return w.createElement(Dd,Ds({},e,{ref:t,sideCar:OI}))});lN.classNames=Dd.classNames;var MI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bi=new WeakMap,Pu=new WeakMap,zu={},Vm=0,cN=function(e){return e&&(e.host||cN(e.parentNode))},PI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=cN(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},zI=function(e,t,n,r){var i=PI(t,Array.isArray(e)?e:[e]);zu[n]||(zu[n]=new WeakMap);var l=zu[n],u=[],d=new Set,h=new Set(i),m=function(g){!g||d.has(g)||(d.add(g),m(g.parentNode))};i.forEach(m);var p=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(v){if(d.has(v))p(v);else try{var b=v.getAttribute(r),j=b!==null&&b!=="false",_=(Bi.get(v)||0)+1,S=(l.get(v)||0)+1;Bi.set(v,_),l.set(v,S),u.push(v),_===1&&j&&Pu.set(v,!0),S===1&&v.setAttribute(n,"true"),j||v.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",v,N)}})};return p(t),d.clear(),Vm++,function(){u.forEach(function(g){var v=Bi.get(g)-1,b=l.get(g)-1;Bi.set(g,v),l.set(g,b),v||(Pu.has(g)||g.removeAttribute(r),Pu.delete(g)),b||g.removeAttribute(n)}),Vm--,Vm||(Bi=new WeakMap,Bi=new WeakMap,Pu=new WeakMap,zu={})}},LI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=MI(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),zI(r,i,n,"aria-hidden")):function(){return null}};function II(e){const t=UI(e),n=w.forwardRef((r,i)=>{const{children:l,...u}=r,d=w.Children.toArray(l),h=d.find(VI);if(h){const m=h.props.children,p=d.map(g=>g===h?w.Children.count(m)>1?w.Children.only(null):w.isValidElement(m)?m.props.children:null:g);return o.jsx(t,{...u,ref:i,children:w.isValidElement(m)?w.cloneElement(m,void 0,p):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function UI(e){const t=w.forwardRef((n,r)=>{const{children:i,...l}=n;if(w.isValidElement(i)){const u=$I(i),d=FI(l,i.props);return i.type!==w.Fragment&&(d.ref=r?jd(r,u):u),w.cloneElement(i,d)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BI=Symbol("radix.slottable");function VI(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BI}function FI(e,t){const n={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?n[r]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[r]=i):r==="style"?n[r]={...i,...l}:r==="className"&&(n[r]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function $I(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Od="Dialog",[uN]=y6(Od),[qI,ws]=uN(Od),dN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=w.useRef(null),h=w.useRef(null),[m,p]=S6({prop:r,defaultProp:i??!1,onChange:l,caller:Od});return o.jsx(qI,{scope:t,triggerRef:d,contentRef:h,contentId:Mm(),titleId:Mm(),descriptionId:Mm(),open:m,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(g=>!g),[p]),modal:u,children:n})};dN.displayName=Od;var fN="DialogTrigger",HI=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ws(fN,n),l=Va(t,i.triggerRef);return o.jsx(pr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yy(i.open),...r,ref:l,onClick:Qr(e.onClick,i.onOpenToggle)})});HI.displayName=fN;var py="DialogPortal",[GI,hN]=uN(py,{forceMount:void 0}),mN=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,l=ws(py,t);return o.jsx(GI,{scope:t,forceMount:n,children:w.Children.map(r,u=>o.jsx(Rd,{present:n||l.open,children:o.jsx(tN,{asChild:!0,container:i,children:u})}))})};mN.displayName=py;var fd="DialogOverlay",pN=w.forwardRef((e,t)=>{const n=hN(fd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,l=ws(fd,e.__scopeDialog);return l.modal?o.jsx(Rd,{present:r||l.open,children:o.jsx(YI,{...i,ref:t})}):null});pN.displayName=fd;var KI=II("DialogOverlay.RemoveScroll"),YI=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ws(fd,n);return o.jsx(lN,{as:KI,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(pr.div,{"data-state":yy(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ua="DialogContent",gN=w.forwardRef((e,t)=>{const n=hN(Ua,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,l=ws(Ua,e.__scopeDialog);return o.jsx(Rd,{present:r||l.open,children:l.modal?o.jsx(WI,{...i,ref:t}):o.jsx(XI,{...i,ref:t})})});gN.displayName=Ua;var WI=w.forwardRef((e,t)=>{const n=ws(Ua,e.__scopeDialog),r=w.useRef(null),i=Va(t,n.contentRef,r);return w.useEffect(()=>{const l=r.current;if(l)return LI(l)},[]),o.jsx(yN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qr(e.onCloseAutoFocus,l=>{l.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Qr(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Qr(e.onFocusOutside,l=>l.preventDefault())})}),XI=w.forwardRef((e,t)=>{const n=ws(Ua,e.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return o.jsx(yN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(r.current||n.triggerRef.current?.focus(),l.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),yN=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=e,d=ws(Ua,n),h=w.useRef(null),m=Va(t,h);return Q6(),o.jsxs(o.Fragment,{children:[o.jsx(Z_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(J_,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":yy(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(JI,{titleId:d.titleId}),o.jsx(ZI,{contentRef:h,descriptionId:d.descriptionId})]})]})}),gy="DialogTitle",xN=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ws(gy,n);return o.jsx(pr.h2,{id:i.titleId,...r,ref:t})});xN.displayName=gy;var vN="DialogDescription",bN=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ws(vN,n);return o.jsx(pr.p,{id:i.descriptionId,...r,ref:t})});bN.displayName=vN;var wN="DialogClose",SN=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ws(wN,n);return o.jsx(pr.button,{type:"button",...r,ref:t,onClick:Qr(e.onClick,()=>i.onOpenChange(!1))})});SN.displayName=wN;function yy(e){return e?"open":"closed"}var jN="DialogTitleWarning",[$$,kN]=g6(jN,{contentName:Ua,titleName:gy,docsSlug:"dialog"}),JI=({titleId:e})=>{const t=kN(jN),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
150
+
151
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
152
+
153
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},QI="DialogDescriptionWarning",ZI=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${kN(QI).contentName}}.`;return w.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},eU=dN,tU=mN,nU=pN,sU=gN,rU=xN,aU=bN,iU=SN;function os({...e}){return o.jsx(eU,{"data-slot":"dialog",...e})}function oU({...e}){return o.jsx(tU,{"data-slot":"dialog-portal",...e})}function lU({className:e,...t}){return o.jsx(nU,{"data-slot":"dialog-overlay",className:pe("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",e),...t})}function ls({className:e,children:t,...n}){return o.jsxs(oU,{"data-slot":"dialog-portal",children:[o.jsx(lU,{}),o.jsxs(sU,{"data-slot":"dialog-content",className:pe("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",e),...n,children:[t,o.jsxs(iU,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(fn,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fr({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:pe("flex flex-col gap-2 text-center sm:text-left",e),...t})}function lr({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-footer",className:pe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function bs({className:e,...t}){return o.jsx(rU,{"data-slot":"dialog-title",className:pe("text-lg leading-none font-semibold",e),...t})}function hr({className:e,...t}){return o.jsx(aU,{"data-slot":"dialog-description",className:pe("text-muted-foreground text-sm",e),...t})}const _N=w.forwardRef(({className:e,...t},n)=>o.jsx("textarea",{className:pe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));_N.displayName="Textarea";const nc=w.createContext(null),sS=({children:e,value:t,onValueChange:n,...r})=>{const[i,l]=w.useState(!1),u=w.useRef(null);return w.useEffect(()=>{const d=h=>{u.current&&!u.current.contains(h.target)&&l(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]),o.jsx(nc.Provider,{value:{value:t,onValueChange:n,open:i,setOpen:l},children:o.jsx("div",{ref:u,className:"relative inline-block w-full",...r,children:e})})},Jp=w.forwardRef(({className:e,children:t,...n},r)=>{const i=w.useContext(nc);return o.jsxs("button",{ref:r,type:"button",onClick:()=>i?.setOpen(!i.open),className:pe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,o.jsx("svg",{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",className:"h-4 w-4 opacity-50",children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]})});Jp.displayName="SelectTrigger";const Qp=w.forwardRef(({className:e,placeholder:t,...n},r)=>{const i=w.useContext(nc);return o.jsx("span",{ref:r,className:pe("pointer-events-none",e),...n,children:i?.value||t})});Qp.displayName="SelectValue";const Zp=w.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>w.useContext(nc)?.open?o.jsx("div",{ref:i,className:pe("absolute z-50 min-w-[8rem] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80 mt-1",n==="popper"&&"translate-y-1",e),...r,children:o.jsx("div",{className:"p-1 bg-white dark:bg-zinc-950",children:t})}):null);Zp.displayName="SelectContent";const eg=w.forwardRef(({className:e,children:t,value:n,...r},i)=>{const l=w.useContext(nc);return o.jsxs("div",{ref:i,className:pe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground cursor-pointer",e),onClick:()=>{l?.onValueChange?.(n),l?.setOpen(!1)},...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l?.value===n&&o.jsx("svg",{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",className:"h-4 w-4",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})}),o.jsx("span",{className:"truncate",children:t})]})});eg.displayName="SelectItem";const xy=w.forwardRef(({className:e,onCheckedChange:t,onChange:n,...r},i)=>o.jsx("input",{type:"checkbox",className:pe("h-4 w-4 rounded border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 accent-primary",e),ref:i,onChange:l=>{n?.(l),t?.(l.target.checked)},...r}));xy.displayName="Checkbox";const cU=[{value:"spam",label:"Spam"},{value:"newsletter",label:"Newsletter"},{value:"personal",label:"Personal"},{value:"client",label:"Client / Work"},{value:"transactional",label:"Receipt / Transaction"},{value:"internal",label:"Internal Team"},{value:"social",label:"Social Media"},{value:"promotional",label:"Promotional"},{value:"news",label:"News"},{value:"support",label:"Support Ticket"},{value:"other",label:"Other"}],uU=["High","Medium","Low"],dU=[{id:"tone_too_formal",label:"Too formal"},{id:"tone_too_casual",label:"Too casual"},{id:"too_long",label:"Too long"},{id:"missing_context",label:"Missing key context"},{id:"wrong_facts",label:"Factually incorrect"},{id:"bad_signature",label:"Wrong signature"}];function NN({email:e,isOpen:t,onClose:n,defaultType:r="analysis"}){const{state:i}=Tn(),{user:l}=i,[u,d]=w.useState(!1),[h,m]=w.useState(e.category||"other"),[p,g]=w.useState(e.ai_analysis?.priority||"Medium"),[v,b]=w.useState([]),[j,_]=w.useState(""),[S,N]=w.useState(r),C=D=>{v.includes(D)?b(L=>L.filter(O=>O!==D)):b(L=>[...L,D])},T=async()=>{if(l){d(!0);try{const D=S==="analysis"?{category:e.category,priority:e.ai_analysis?.priority}:{draft_content:"...timestamp..."},L=S==="analysis"?{category:h,priority:p}:{issues:v};await Re.submitFeedback({email_id:e.id,feedback_type:S,original_state:D,corrected_state:L,reasoning:j.trim()||void 0}),S==="analysis"&&e.category,le.success("Thanks! I'll learn from this feedback."),m(e.category||"other"),g(e.ai_analysis?.priority||"Medium"),b([]),_(""),n()}catch(D){console.error("Feedback error:",D),le.error("Failed to submit feedback.")}finally{d(!1)}}};return o.jsx(os,{open:t,onOpenChange:D=>!D&&n(),children:o.jsxs(ls,{className:"sm:max-w-md",children:[o.jsx(fr,{children:o.jsxs(bs,{className:"flex items-center gap-2",children:[o.jsx(dj,{className:"h-5 w-5 text-primary"}),"Help Improve Intelligence"]})}),o.jsxs("div",{className:"flex gap-2 mb-4",children:[o.jsx(Z,{variant:S==="analysis"?"default":"outline",size:"sm",onClick:()=>N("analysis"),className:"flex-1",children:"Categorization"}),o.jsx(Z,{variant:S==="draft"?"default":"outline",size:"sm",onClick:()=>N("draft"),className:"flex-1",children:"Draft Quality"})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[S==="analysis"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Correct Category"}),o.jsxs(sS,{value:h,onValueChange:m,children:[o.jsx(Jp,{children:o.jsx(Qp,{})}),o.jsx(Zp,{children:cU.map(D=>o.jsx(eg,{value:D.value,children:D.label},D.value))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Correct Priority"}),o.jsxs(sS,{value:p,onValueChange:g,children:[o.jsx(Jp,{children:o.jsx(Qp,{})}),o.jsx(Zp,{children:uU.map(D=>o.jsx(eg,{value:D,children:D},D))})]})]})]}):o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"What was wrong with the draft?"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:dU.map(D=>o.jsxs("div",{className:"flex items-center space-x-2 border p-2 rounded hover:bg-muted/50 cursor-pointer",onClick:()=>C(D.id),children:[o.jsx(xy,{checked:v.includes(D.id),id:D.id}),o.jsx("label",{htmlFor:D.id,className:"text-sm cursor-pointer",children:D.label})]},D.id))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Why? (Optional context for learning)"}),o.jsx(_N,{placeholder:"e.g. This sender is actually a client, not a newsletter...",value:j,onChange:D=>_(D.target.value),className:"h-20"})]})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"ghost",onClick:n,children:"Cancel"}),o.jsxs(Z,{onClick:T,disabled:u,children:[u&&o.jsx(jt,{className:"mr-2 h-4 w-4 animate-spin"}),"Submit Feedback"]})]})]})})}function fU({status:e,onRunMigrations:t}){const n=[{icon:"🎯",title:"Smart rule exclusions",desc:"Negative conditions prevent false positives"},{icon:"🎚️",title:"Confidence threshold tuning",desc:"Fine-tune LLM matching per rule"},{icon:"⚡",title:"Template improvements",desc:"Better zero-config defaults"}];return o.jsxs("div",{className:"rounded-lg border-2 border-yellow-500 bg-gradient-to-br from-yellow-50 to-orange-50 dark:from-yellow-950/30 dark:to-orange-950/30 shadow-lg overflow-hidden",children:[o.jsxs("div",{className:"bg-yellow-500 text-yellow-950 px-4 py-3 flex items-center gap-3",children:[o.jsx(qn,{className:"h-5 w-5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm",children:"🔔 Action Required"}),o.jsx("p",{className:"text-xs opacity-90",children:"Database updates available"})]})]}),o.jsxs("div",{className:"p-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"What's New:"}),o.jsx("div",{className:"space-y-2",children:n.map((r,i)=>o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"text-lg leading-none",children:r.icon}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-xs font-medium text-foreground",children:r.title}),o.jsx("p",{className:"text-xs text-muted-foreground",children:r.desc})]})]},i))})]}),o.jsx("div",{className:"pt-2 border-t border-yellow-200 dark:border-yellow-800",children:o.jsxs(Z,{onClick:t,className:"w-full bg-yellow-600 hover:bg-yellow-700 text-yellow-50",children:[o.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Update Now",o.jsx(bC,{className:"h-4 w-4 ml-2"})]})}),o.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:"💡 Your existing data will be preserved (safe migration)"})]})]})}function hU({email:e,isOpen:t,onOpenChange:n,onRetry:r}){const{t:i}=nt(),[l,u]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{t&&e&&m()},[t,e]);const m=async()=>{if(e){h(!0);try{const g=await Re.getEmailEvents(e.id);g.data&&u(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{h(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Zr,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(qn,{className:"w-4 h-4 text-red-500"});default:return o.jsx(ro,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(os,{open:t,onOpenChange:n,children:o.jsxs(ls,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(fr,{className:"p-6 border-b flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xd,{className:"w-5 h-5 text-primary"}),o.jsx(bs,{children:i("dashboard.aiTrace")})]}),o.jsx(hr,{children:i("dashboard.aiTraceDesc")})]}),e?.processing_status==="failed"&&r&&o.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>{r(e),n(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[o.jsx(Jt,{className:"w-3.5 h-3.5"}),i("dashboard.retryProcessing")]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:d?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(yt,{})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:i("dashboard.noTrace")}):l.map((g,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(g.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:g.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ls,{className:"w-3 h-3"}),new Date(g.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[g.event_type==="info"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Os,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:g.details.system_prompt})]}),g.details?.content_preview&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Os,{className:"w-3 h-3"})," ",i("dashboard.emailContent")]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details.content_preview})]})]}),g.event_type==="analysis"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsxs("span",{className:"text-muted-foreground mr-1",children:[i("config.rules.category"),":"]}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.category||i("dashboard.analyzing")})]}),o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsxs("span",{className:"text-muted-foreground mr-1",children:[i("config.rules.sentiment"),":"]}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.sentiment||i("dashboard.analyzing")})]})]}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Os,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details?.system_prompt})]}),g.details?._raw_response&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Os,{className:"w-3 h-3"})," Raw LLM Response"]}),o.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(g.details._raw_response),null,2)})]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:g.details.usage.total_tokens})]})]})]}),g.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[i("dashboard.done")," ",g.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',g.details?.reason,'"']})]}),o.jsx(xg,{className:"w-5 h-5 text-emerald-500"})]}),g.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof g.details?.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details?.error}),g.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})]})]})]})]},g.id))})]})})}const mU={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 pU(){const{state:e,actions:t}=Tn(),{t:n}=nt(),{openTerminal:r}=Zj(),i=s3(),[l,u]=w.useState(!0),{isSyncing:d}=e,[h,m]=w.useState(""),[p,g]=w.useState(null),[v,b]=w.useState(null),[j,_]=w.useState({}),[S,N]=w.useState(null),[C,T]=w.useState(!1),[D,L]=w.useState(null),[O,B]=w.useState(!1),[M,q]=w.useState(null);w.useEffect(()=>{e.isAuthenticated?(R(),t.fetchStats()):u(!1)},[p,e.isAuthenticated]);const R=async(z=0)=>{u(!0),await t.fetchEmails({category:p||void 0,search:h||void 0,offset:z,sortBy:e.sortBy,sortOrder:e.sortOrder}),u(!1)},J=z=>{t.fetchEmails({category:p||void 0,search:h||void 0,offset:0,sortBy:z,sortOrder:e.sortOrder})},K=()=>{t.fetchEmails({category:p||void 0,search:h||void 0,offset:0,sortBy:e.sortBy,sortOrder:e.sortOrder==="asc"?"desc":"asc"})},he=async()=>{if(e.accounts.length===0){le.warning(n("dashboard.noEmailsConnected"));return}Ms.playStart(),r(),await t.triggerSync()?(Ms.playSuccess(),le.success(n("dashboard.syncSuccess"))):le.error(n("dashboard.syncFailed"))},se=async(z,A)=>{if(A==="delete"&&S!==z.id){N(z.id);return}N(null),_(ge=>({...ge,[z.id]:A}));const ee=await t.executeAction(z.id,A);_(ge=>{const ye={...ge};return delete ye[z.id],ye}),ee&&(le.success(`Email ${A==="delete"?"deleted":A==="archive"?"archived":"updated"}`),A==="delete"&&R(e.emailsOffset))},ie=()=>{N(null)},$=z=>{z.preventDefault(),R()},V=z=>{const A=z==="next"?e.emailsOffset+20:Math.max(0,e.emailsOffset-20);R(A)},G=z=>{L(z),T(!0)},fe=async z=>{await t.retryProcessing(z.id)&&le.success("Retrying email processing...")},P=z=>{q(z),B(!0)},I=async z=>{try{await Re.submitFeedback({email_id:z.id,feedback_type:"analysis",original_state:{category:z.category,priority:z.ai_analysis?.priority},corrected_state:{category:z.category,priority:z.ai_analysis?.priority,is_correct:!0}}),le.success(n("dashboard.positiveFeedbackSuccess")||"Thanks! This helps improve AI accuracy.")}catch(A){console.error("Positive feedback error:",A),le.error(n("dashboard.positiveFeedbackError")||"Failed to submit feedback.")}};return o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[o.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[o.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[o.jsx(is,{className:"w-5 h-5 text-primary"}),n("dashboard.recentAnalysis")]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(Z,{onClick:he,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:d,children:[o.jsx(Jt,{className:pe("w-3.5 h-3.5 mr-2",d&&"animate-spin")}),n(d?"dashboard.syncing":"dashboard.syncNow")]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[e.emailsTotal," ",n("dashboard.emails")]})]})]}),d&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx(jt,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:n("dashboard.syncInProgress")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("dashboard.syncInProgressDesc")})]})]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs",children:[o.jsx(xd,{className:"w-3.5 h-3.5 mr-2"}),n("common.viewLogs")]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:$,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(gR,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(De,{placeholder:n("dashboard.searchPlaceholder"),value:h,onChange:z=>m(z.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:n("dashboard.search")})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:e.sortBy,onChange:z=>J(z.target.value),children:[o.jsx("option",{value:"date",children:n("dashboard.receivedTime")}),o.jsx("option",{value:"created_at",children:n("dashboard.processedTime")})]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-primary",onClick:K,title:e.sortOrder==="asc"?n("dashboard.sortOldest"):n("dashboard.sortNewest"),children:e.sortOrder==="asc"?o.jsx(SC,{className:"w-3.5 h-3.5"}):o.jsx(yC,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:e.activeCategory===null?"secondary":"ghost",onClick:()=>g(null),children:n("dashboard.category.all")}),["spam","client","newsletter","support"].map(z=>o.jsx(Z,{size:"sm",variant:e.activeCategory===z?"secondary":"ghost",onClick:()=>g(z),className:"capitalize",children:z},z))]}),l?o.jsx(i3,{}):e.emails.length===0?o.jsxs(Ge,{className:"p-20 text-center shadow-sm",children:[o.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(is,{className:"w-8 h-8"})}),o.jsx("h3",{className:"text-lg font-medium",children:n("dashboard.noEmails")}),o.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:e.accounts.length===0?n("dashboard.noEmailsConnected"):n("dashboard.noEmailsFilters")}),e.accounts.length>0&&o.jsxs(Z,{onClick:()=>{r(),he()},disabled:d,children:[o.jsx(Jt,{className:pe("w-4 h-4 mr-2",d&&"animate-spin")}),n("dashboard.syncNow")]})]}):o.jsxs(o.Fragment,{children:[e.emails.map(z=>o.jsx(xU,{email:z,onAction:se,onRetry:fe,onViewTrace:G,onFeedback:P,onPositiveFeedback:I,onSelect:()=>b(z),isSelected:v?.id===z.id,loadingAction:j[z.id],isDeletePending:S===z.id,onCancelDelete:ie},z.id)),o.jsx(hU,{isOpen:C,onOpenChange:T,email:D,onRetry:fe}),M&&o.jsx(NN,{isOpen:O,onClose:()=>B(!1),email:M,defaultType:"analysis"}),e.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>V("prev"),disabled:e.emailsOffset===0,children:[o.jsx(IC,{className:"w-4 h-4 mr-1"}),n("common.previous")]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.emailsOffset+1," - ",Math.min(e.emailsOffset+20,e.emailsTotal)," ",n("common.of")," ",e.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>V("next"),disabled:e.emailsOffset+20>=e.emailsTotal,children:[n("common.next"),o.jsx(so,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[i?.migrationStatus&&i.migrationStatus.needsMigration&&o.jsx(fU,{status:i.migrationStatus,onRunMigrations:i.openMigrationModal}),v&&o.jsxs(Ge,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:n("dashboard.emailDetails")}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(null),children:o.jsx(fn,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:n("dashboard.from")}),o.jsx("p",{className:"font-medium truncate",children:v.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:n("dashboard.subject")}),o.jsx("p",{className:"font-medium",children:v.subject})]}),v.ai_analysis&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:n("dashboard.summary")}),o.jsx("p",{className:"text-xs mt-1",children:v.ai_analysis.summary})]}),v.ai_analysis.key_points&&o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:n("dashboard.keyPoints")}),o.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:v.ai_analysis.key_points.map((z,A)=>o.jsx("li",{children:z},A))})]}),v.ai_analysis.draft_response&&o.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[o.jsx(Xl,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"text-xs font-bold uppercase",children:n("dashboard.aiDraftReply")})]}),o.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:v.ai_analysis.draft_response}),o.jsx("p",{className:"mt-2 text-[9px] text-muted-foreground",children:n("dashboard.draftSavedHelp").replace("{provider}",v.email_accounts?.provider==="gmail"?"Gmail":"Outlook")})]})]})]})]}),o.jsx(gU,{accounts:e.accounts,onUpdate:t.updateAccount,onSync:t.triggerSync,settings:e.settings,onUpdateSettings:t.updateSettings,openTerminal:r}),o.jsxs(Ge,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(cj,{className:"w-4 h-4 text-primary"}),n("dashboard.syncHistory")]}),o.jsx("div",{className:"space-y-4",children:!e.stats?.recentSyncs||e.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:n("dashboard.noSyncHistory")}):e.stats.recentSyncs.slice(0,5).map(z=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:pe("w-1.5 h-1.5 rounded-full",z.status==="success"?"bg-emerald-500":z.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(z.started_at).toLocaleDateString()," ",new Date(z.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:[n("dashboard.processed")," ",o.jsx("span",{className:"font-medium text-foreground",children:z.emails_processed})," •",n("dashboard.actioned")," ",o.jsx("span",{className:"font-medium text-foreground",children:z.emails_deleted+z.emails_drafted})]}),z.error_message&&o.jsxs("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:z.error_message,children:[n("dashboard.error")," ",z.error_message]})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:z.status==="running"?n("dashboard.running"):z.completed_at?`${Math.round((new Date(z.completed_at).getTime()-new Date(z.started_at).getTime())/1e3)}s`:"..."})]},z.id))})]}),o.jsxs(Ge,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:n("dashboard.quickStats")}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:n("dashboard.totalProcessed")}),o.jsx("span",{className:"font-medium",children:e.emailsTotal})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:n("dashboard.connectedAccounts")}),o.jsx("span",{className:"font-medium",children:e.accounts.length})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:n("dashboard.activeRules")}),o.jsx("span",{className:"font-medium",children:e.rules.filter(z=>z.is_enabled).length})]})]})]})]})]})}function gU({accounts:e,onUpdate:t,onSync:n,settings:r,onUpdateSettings:i,openTerminal:l}){const{t:u}=nt();return e.length===0?null:o.jsxs(Ge,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(SR,{className:"w-4 h-4 text-primary"}),u("dashboard.syncScope")]}),o.jsx("div",{className:"space-y-6",children:e.map(d=>o.jsx(yU,{account:d,onUpdate:t,onSync:n,openTerminal:l},d.id))})]})}function yU({account:e,onUpdate:t,onSync:n,openTerminal:r}){const{t:i}=nt(),[l,u]=w.useState(!1),[d,h]=w.useState(""),[m,p]=w.useState(""),g=_=>{if(!_)return"";const S=typeof _=="string"&&/^\d+$/.test(_)?parseInt(_):_,N=new Date(S);if(isNaN(N.getTime()))return"";const C=T=>T<10?"0"+T:T;return N.getFullYear()+"-"+C(N.getMonth()+1)+"-"+C(N.getDate())+"T"+C(N.getHours())+":"+C(N.getMinutes())};w.useEffect(()=>{const _=e.sync_start_date||e.last_sync_checkpoint||e.last_sync_at;h(g(_)),p((e.sync_max_emails_per_run||50).toString())},[e.id,e.sync_start_date,e.last_sync_checkpoint,e.last_sync_at,e.sync_max_emails_per_run]);const v=async _=>{u(!0),await t(e.id,_),u(!1)},b=()=>{const _=e.sync_start_date?new Date(e.sync_start_date).toISOString():"",S=d?new Date(d).toISOString():"";S!==_&&v({sync_start_date:S||null})},j=()=>{const _=parseInt(m,10)||50;_!==e.sync_max_emails_per_run&&v({sync_max_emails_per_run:_})};return o.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:e.email_address,children:e.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[e.last_sync_status==="syncing"?o.jsx(jt,{className:"w-3 h-3 text-primary animate-spin"}):e.last_sync_status==="success"?o.jsx(xg,{className:"w-3 h-3 text-emerald-500"}):e.last_sync_status==="error"?o.jsx("span",{title:e.last_sync_error||"Error",children:o.jsx(qn,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{r(),n(e.id)},disabled:e.last_sync_status==="syncing",children:o.jsx(Jt,{className:pe("w-3 h-3",e.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-orange-500",title:"Reset Checkpoint (Force Full Re-sync from Start Date)",onClick:()=>t(e.id,{last_sync_checkpoint:null}),disabled:e.last_sync_status==="syncing",children:o.jsx(cj,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(yd,{className:"w-2.5 h-2.5"})," ",i("dashboard.syncFrom")]}),o.jsx(De,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:d,onChange:_=>h(_.target.value),onBlur:b,disabled:l||e.last_sync_status==="syncing"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(mA,{className:"w-2.5 h-2.5"})," ",i("dashboard.maxEmails")]}),o.jsx(De,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:m,onChange:_=>p(_.target.value),onBlur:j,disabled:l||e.last_sync_status==="syncing"})]})]}),e.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:[i("dashboard.lastSync")," ",new Date(e.last_sync_at).toLocaleString()]}),e.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:e.last_sync_error,children:[i("dashboard.error")," ",e.last_sync_error]})]})}function xU({email:e,onAction:t,onRetry:n,onViewTrace:r,onFeedback:i,onPositiveFeedback:l,onSelect:u,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:p}){const{t:g}=nt();if(!e)return null;const v=mU[e.category||"other"],b=!!h,j=()=>{if(!e.email_accounts)return"#";const{provider:_,email_address:S}=e.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${S}/#all/${e.external_id}`:_==="outlook"?`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(e.external_id)}`:"#"};return o.jsx(Ge,{className:pe("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:u,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[o.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[o.jsx("div",{className:pe("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",e.category==="spam"?"bg-destructive":"bg-primary"),children:e.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:e.subject||g("dashboard.noSubject")}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",title:e.sender||"",children:e.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:pe("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",v),children:e.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Ls,{className:"w-2.5 h-2.5"})," ",g("dashboard.queued")]}),e.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(jt,{className:"w-2.5 h-2.5 animate-spin"})," ",g("dashboard.analyzing")]}),e.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Zr,{className:"w-2.5 h-2.5"})," ",g("dashboard.analyzed")]}),e.processing_status==="failed"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:e.processing_error||g("common.error"),children:[o.jsx(qn,{className:"w-2.5 h-2.5"})," ",g("dashboard.failed")]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:_=>{_.stopPropagation(),n(e)},title:g("dashboard.retryProcessing"),children:o.jsx(Jt,{className:"w-2.5 h-2.5"})})]}),!e.processing_status&&!e.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(jt,{className:"w-2.5 h-2.5 animate-spin"})," ",g("dashboard.queued")]}),!e.processing_status&&e.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Zr,{className:"w-2.5 h-2.5"})," ",g("dashboard.analyzed")]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:e.date?new Date(e.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsxs("span",{className:"opacity-70 text-[9px]",children:[g("dashboard.receivedAbbr"),":"]})," ",e.date?new Date(e.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(e.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsxs("span",{className:"opacity-70 text-[9px]",children:[g("dashboard.processedAbbr"),":"]})," ",new Date(e.created_at).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:e.body_snippet}),o.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[o.jsx(Sg,{className:"w-3.5 h-3.5 text-emerald-500"}),g("dashboard.suggested"),e.suggested_actions&&e.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:e.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:e.suggested_action||g("dashboard.category.none")}),e.actions_taken&&e.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:e.actions_taken.join(", "),children:["(",g("dashboard.done")," ",e.actions_taken.join(", "),")"]}):e.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(",g("dashboard.done")," ",e.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:m?o.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[o.jsx("span",{className:"text-xs text-destructive mr-1",children:g("dashboard.deleteConfirm")}),o.jsx(Z,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>t(e,"delete"),disabled:b,children:h==="delete"?o.jsx(jt,{className:"w-3 h-3 animate-spin"}):g("common.yes")}),o.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:p,disabled:b,children:g("common.no")})]}):o.jsxs(o.Fragment,{children:[e.email_accounts?.provider!=="imap"&&o.jsx("a",{href:j(),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:g("dashboard.openIn").replace("{provider}",e.email_accounts?.provider==="gmail"?"Gmail":"Outlook"),children:o.jsx(Cl,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-green-500",onClick:()=>l(e),title:g("dashboard.positiveFeedbackTooltip")||"AI got this right!",children:o.jsx(dj,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>i(e),title:g("dashboard.feedbackTooltip")||"Report Issue / Feedback",children:o.jsx(bd,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(e),title:g("dashboard.viewTraceTooltip"),children:o.jsx(vd,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>t(e,"delete"),disabled:b,title:g("common.delete"),children:h==="delete"?o.jsx(jt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(wd,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>t(e,"archive"),disabled:b,title:g("common.archive"),children:h==="archive"?o.jsx(jt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(sj,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>t(e,"flag"),disabled:b,title:g("common.flag"),children:h==="flag"?o.jsx(jt,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(oA,{className:"w-3.5 h-3.5"})})]})})]})]})})}function vU(){const[e,t]=w.useState({isOpen:!1,title:"",description:"",confirmText:"Confirm",cancelText:"Cancel",destructive:!1,onConfirm:()=>{},onCancel:()=>{}});return{confirm:w.useCallback(r=>new Promise(i=>{t({...r,isOpen:!0,confirmText:r.confirmText||"Confirm",cancelText:r.cancelText||"Cancel",onConfirm:()=>{t(l=>({...l,isOpen:!1})),i(!0)},onCancel:()=>{t(l=>({...l,isOpen:!1})),i(!1)}})}),[]),dialogState:e}}function bU({state:e}){return o.jsx(os,{open:e.isOpen,onOpenChange:t=>!t&&e.onCancel(),children:o.jsxs(ls,{children:[o.jsxs(fr,{children:[o.jsxs(bs,{className:"flex items-center gap-2",children:[e.destructive&&o.jsx(ea,{className:"w-5 h-5 text-destructive"}),e.title]}),o.jsx(hr,{children:e.description})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"outline",onClick:e.onCancel,children:e.cancelText}),o.jsx(Z,{variant:e.destructive?"destructive":"default",onClick:e.onConfirm,children:e.confirmText})]})]})})}function wU({onPreview:e}){const{t}=nt(),[n,r]=w.useState([]),[i,l]=w.useState([]),[u,d]=w.useState(!0),[h,m]=w.useState(new Set),[p,g]=w.useState(null),{confirm:v,dialogState:b}=vU(),[j,_]=w.useState(""),[S,N]=w.useState("pending"),C=[{name:"send_draft",description:"Sends a specific email draft by ID. The draft will be sent immediately to the recipient.",parameters:{type:"object",properties:{draft_id:{type:"string",description:"The unique ID of the draft to send"}},required:["draft_id"]},callback:async R=>(await L(R.draft_id,!0),{success:!0,message:"Draft sent successfully"})},{name:"dismiss_draft",description:"Dismisses/discards a specific email draft by ID. This is a destructive action.",parameters:{type:"object",properties:{draft_id:{type:"string",description:"The unique ID of the draft to dismiss"}},required:["draft_id"]},callback:async R=>(await O(R.draft_id,!1),{success:!0,message:"Draft dismissed"})},{name:"preview_draft",description:"Opens a preview of a specific draft to show the user its full content.",parameters:{type:"object",properties:{draft_id:{type:"string",description:"The unique ID of the draft to preview"}},required:["draft_id"]},callback:async R=>{const J=n.find(K=>K.id===R.draft_id);if(J)return e(J),{success:!0,message:"Preview opened"};throw new Error("Draft not found")}},{name:"summarize_drafts",description:"Provides a summary of all pending drafts to help the user triage them.",parameters:{},callback:async()=>{const R=n.slice(0,5).map((J,K)=>`${K+1}. "${J.subject||"No Subject"}" from ${J.sender} - ${J.ai_analysis?.summary||"No summary"}`).join(`
154
+ `);return{success:!0,summary:`You have ${n.length} pending drafts. Here are the first 5:
155
+ ${R}`}}}];fy({page_id:"draft_review",system_instruction:"You are the Draft Review Assistant. Help the user review, send, or dismiss their email drafts. You can summarize the pending drafts and take actions based on user commands.",data:{count:n.length,drafts:n.slice(0,10).map(R=>({id:R.id,subject:R.subject||"No Subject",to:R.recipient||"Unknown",sender:R.sender,ai_summary:R.ai_analysis?.summary||"No summary"})),filters:{account:j,status:S}},tools:C}),w.useEffect(()=>{D(),T()},[j,S]);const T=w.useCallback(async()=>{try{const R=await Re.getAccounts();R.data?.accounts?.length&&(l(R.data.accounts),j||_(R.data.accounts[0].id))}catch(R){console.error("Failed to fetch accounts:",R)}},[j]),D=w.useCallback(async()=>{if(j){d(!0);try{const R=await Re.getDrafts({status:S,limit:100,account_id:j});if(R.error)throw new Error(typeof R.error=="string"?R.error:R.error.message);r(R.data?.drafts||[])}catch(R){console.error("Failed to fetch drafts:",R),le.error(t("drafts.loadError")||"Failed to load drafts")}finally{d(!1)}}},[S,j,t]),L=w.useCallback(async(R,J=!1)=>{const he=n.find(se=>se.id===R)?.subject||"this draft";if(!(!J&&!await v({title:"Send Draft?",description:`Are you sure you want to send the draft: "${he}"?`,confirmText:"Send",cancelText:"Cancel",destructive:!1}))){g(R);try{const se=await Re.sendDraft(R);if(se.error)throw new Error(typeof se.error=="string"?se.error:se.error.message);le.success(t("drafts.sendSuccess")||"Draft sent successfully!"),D()}catch(se){throw console.error("Failed to send draft:",se),le.error(t("drafts.sendError")||"Failed to send draft"),se}finally{g(null)}}},[n,v,t]),O=w.useCallback(async(R,J=!1)=>{const he=n.find(se=>se.id===R)?.subject||"this draft";if(!(!J&&!await v({title:"Dismiss Draft?",description:`Are you sure you want to dismiss the draft: "${he}"? This action cannot be undone.`,confirmText:"Dismiss",cancelText:"Cancel",destructive:!0}))){g(R);try{const se=await Re.dismissDraft(R);if(se.error)throw new Error(typeof se.error=="string"?se.error:se.error.message);le.success(t("drafts.dismissSuccess")||"Draft dismissed"),D()}catch(se){throw console.error("Failed to dismiss draft:",se),le.error("Failed to dismiss draft"),se}finally{g(null)}}},[n,v,t]),B=()=>{h.size===n.length?m(new Set):m(new Set(n.map(R=>R.id)))},M=w.useCallback(async()=>{const R=Array.from(h);if(await v({title:"Send Multiple Drafts?",description:`Are you sure you want to send ${R.length} draft(s)?`,confirmText:`Send ${R.length} Draft(s)`,cancelText:"Cancel",destructive:!1})){for(const K of R)await L(K,!0);m(new Set)}},[h,v,L]),q=w.useCallback(async()=>{const R=Array.from(h);if(await v({title:"Dismiss Multiple Drafts?",description:`Are you sure you want to dismiss ${R.length} draft(s)? This action cannot be undone.`,confirmText:`Dismiss ${R.length} Draft(s)`,cancelText:"Cancel",destructive:!0})){for(const K of R)await O(K,!0);m(new Set)}},[h,v,O]);return u?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(yt,{})}):o.jsxs(o.Fragment,{children:[o.jsx(bU,{state:b}),o.jsxs("div",{className:"space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(is,{className:"w-6 h-6 text-primary"}),t("drafts.title")||"Draft Review Center"]}),o.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[n.length," ",t("drafts.pending")||"pending drafts"]})]}),o.jsxs(Z,{onClick:D,variant:"outline",size:"sm",children:[o.jsx(Jt,{className:"w-4 h-4 mr-2"}),"Refresh"]})]}),o.jsx(Ge,{className:"p-4",children:o.jsxs("div",{className:"flex items-center gap-4",children:[i.length>1&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(cA,{className:"w-4 h-4 text-muted-foreground"}),o.jsx("select",{value:j,onChange:R=>_(R.target.value),className:"px-3 py-1.5 rounded-md border bg-background text-sm",children:i.map(R=>o.jsx("option",{value:R.id,children:R.email_address},R.id))})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs("select",{value:S,onChange:R=>N(R.target.value),className:"px-3 py-1.5 rounded-md border bg-background text-sm",children:[o.jsx("option",{value:"pending",children:"Pending"}),o.jsx("option",{value:"sent",children:"Sent"}),o.jsx("option",{value:"dismissed",children:"Dismissed"})]})}),h.size>0&&o.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[o.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.size," selected"]}),o.jsxs(Z,{onClick:M,size:"sm",variant:"default",children:[o.jsx(Xl,{className:"w-4 h-4 mr-2"}),t("drafts.sendSelected")||"Send Selected"]}),o.jsxs(Z,{onClick:q,size:"sm",variant:"outline",children:[o.jsx(fn,{className:"w-4 h-4 mr-2"}),t("drafts.dismissSelected")||"Dismiss Selected"]})]})]})}),n.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",checked:h.size===n.length,onChange:B,className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t("drafts.selectAll")||"Select All"})]}),n.length===0?o.jsxs(Ge,{className:"p-12 text-center",children:[o.jsx(is,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:t("drafts.noDrafts")||"No pending drafts"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:t("drafts.noDraftsDesc")||"AI-generated draft replies will appear here for your review"})]}):o.jsx("div",{className:"space-y-3",children:n.map(R=>o.jsx(SU,{draft:R,isSelected:h.has(R.id),onSelect:()=>{const J=new Set(h);J.has(R.id)?J.delete(R.id):J.add(R.id),m(J)},onSend:()=>L(R.id),onDismiss:()=>O(R.id),onPreview:()=>e(R),isLoading:p===R.id},R.id))})]})]})}function SU({draft:e,isSelected:t,onSelect:n,onSend:r,onDismiss:i,onPreview:l,isLoading:u}){const{t:d}=nt(),h=e.draft_content?.substring(0,200)||e.ai_analysis?.draft_response?.substring(0,200)||e.ai_analysis?.draft_content?.substring(0,200)||"",m=e.draft_created_at?jU(new Date(e.draft_created_at)):"";return o.jsx(Ge,{className:pe("p-4 hover:shadow-md transition-shadow",t&&"ring-2 ring-primary"),children:o.jsxs("div",{className:"flex items-start gap-4",children:[o.jsx("input",{type:"checkbox",checked:t,onChange:n,className:"mt-1 rounded border-gray-300"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("h3",{className:"font-semibold text-sm truncate",children:["Re: ",e.subject||d("dashboard.noSubject")]}),o.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["From: ",e.sender]})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground flex-shrink-0",children:[o.jsx(Ls,{className:"w-3 h-3"}),m]})]}),o.jsxs("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:[h,"..."]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-3",children:[o.jsx(is,{className:"w-3 h-3"}),e.email_accounts?.email_address]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Z,{onClick:r,disabled:u,size:"sm",className:"gap-2",children:[u?o.jsx(jt,{className:"w-4 h-4 animate-spin"}):o.jsx(Xl,{className:"w-4 h-4"}),d("drafts.send")||"Send Now"]}),o.jsxs(Z,{onClick:l,disabled:u,size:"sm",variant:"outline",className:"gap-2",children:[o.jsx(vd,{className:"w-4 h-4"}),d("drafts.preview")||"Preview"]}),o.jsxs(Z,{onClick:i,disabled:u,size:"sm",variant:"ghost",className:"gap-2",children:[o.jsx(fn,{className:"w-4 h-4"}),d("drafts.dismiss")||"Dismiss"]})]})]})]})})}function jU(e){const n=new Date().getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),l=Math.floor(i/24);return r<1?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:`${l}d ago`}function kU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _U=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NU=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TU={};function rS(e,t){return(TU.jsx?NU:_U).test(e)}const EU=/[ \t\n\f\r]/g;function CU(e){return typeof e=="object"?e.type==="text"?aS(e.value):!1:aS(e)}function aS(e){return e.replace(EU,"")===""}class sc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}sc.prototype.normal={};sc.prototype.property={};sc.prototype.space=void 0;function TN(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new sc(n,r,t)}function tg(e){return e.toLowerCase()}class En{constructor(t,n){this.attribute=n,this.property=t}}En.prototype.attribute="";En.prototype.booleanish=!1;En.prototype.boolean=!1;En.prototype.commaOrSpaceSeparated=!1;En.prototype.commaSeparated=!1;En.prototype.defined=!1;En.prototype.mustUseProperty=!1;En.prototype.number=!1;En.prototype.overloadedBoolean=!1;En.prototype.property="";En.prototype.spaceSeparated=!1;En.prototype.space=void 0;let AU=0;const Ve=Fa(),Bt=Fa(),ng=Fa(),de=Fa(),mt=Fa(),no=Fa(),Bn=Fa();function Fa(){return 2**++AU}const sg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Bt,commaOrSpaceSeparated:Bn,commaSeparated:no,number:de,overloadedBoolean:ng,spaceSeparated:mt},Symbol.toStringTag,{value:"Module"})),Fm=Object.keys(sg);class vy extends En{constructor(t,n,r,i){let l=-1;if(super(t,n),iS(this,"space",i),typeof r=="number")for(;++l<Fm.length;){const u=Fm[l];iS(this,Fm[l],(r&sg[u])===sg[u])}}}vy.prototype.defined=!0;function iS(e,t,n){n&&(e[t]=n)}function go(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new vy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[tg(r)]=r,n[tg(l.attribute)]=r}return new sc(t,n,e.space)}const EN=go({properties:{ariaActiveDescendant:null,ariaAtomic:Bt,ariaAutoComplete:null,ariaBusy:Bt,ariaChecked:Bt,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:mt,ariaCurrent:null,ariaDescribedBy:mt,ariaDetails:null,ariaDisabled:Bt,ariaDropEffect:mt,ariaErrorMessage:null,ariaExpanded:Bt,ariaFlowTo:mt,ariaGrabbed:Bt,ariaHasPopup:null,ariaHidden:Bt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mt,ariaLevel:de,ariaLive:null,ariaModal:Bt,ariaMultiLine:Bt,ariaMultiSelectable:Bt,ariaOrientation:null,ariaOwns:mt,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:Bt,ariaReadOnly:Bt,ariaRelevant:null,ariaRequired:Bt,ariaRoleDescription:mt,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:Bt,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CN(e,t){return t in e?e[t]:t}function AN(e,t){return CN(e,t.toLowerCase())}const RU=go({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:no,acceptCharset:mt,accessKey:mt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:mt,autoFocus:Ve,autoPlay:Ve,blocking:mt,capture:null,charSet:null,checked:Ve,cite:null,className:mt,cols:de,colSpan:null,content:null,contentEditable:Bt,controls:Ve,controlsList:mt,coords:de|no,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:ng,draggable:Bt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:mt,height:de,hidden:ng,high:de,href:null,hrefLang:null,htmlFor:mt,httpEquiv:mt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:mt,itemRef:mt,itemScope:Ve,itemType:mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:de,pattern:null,ping:mt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:mt,required:Ve,reversed:Ve,rows:de,rowSpan:de,sandbox:mt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:Bt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Bt,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mt,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:Bt,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:AN}),DU=go({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Bn,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:mt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:no,g2:no,glyphName:no,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:Bn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:de,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bn,rev:Bn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bn,requiredFeatures:Bn,requiredFonts:Bn,requiredFormats:Bn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:Bn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bn,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CN}),RN=go({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),DN=go({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:AN}),ON=go({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),OU={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},MU=/[A-Z]/g,oS=/-[a-z]/g,PU=/^data[-\w.:]+$/i;function zU(e,t){const n=tg(t);let r=t,i=En;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&PU.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(oS,IU);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!oS.test(l)){let u=l.replace(MU,LU);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}i=vy}return new i(r,t)}function LU(e){return"-"+e.toLowerCase()}function IU(e){return e.charAt(1).toUpperCase()}const UU=TN([EN,RU,RN,DN,ON],"html"),by=TN([EN,DU,RN,DN,ON],"svg");function BU(e){return e.join(" ").trim()}var Vi={},$m,lS;function VU(){if(lS)return $m;lS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,h=`
156
+ `,m="/",p="*",g="",v="comment",b="declaration";function j(S,N){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];N=N||{};var C=1,T=1;function D(se){var ie=se.match(t);ie&&(C+=ie.length);var $=se.lastIndexOf(h);T=~$?se.length-$:T+se.length}function L(){var se={line:C,column:T};return function(ie){return ie.position=new O(se),q(),ie}}function O(se){this.start=se,this.end={line:C,column:T},this.source=N.source}O.prototype.content=S;function B(se){var ie=new Error(N.source+":"+C+":"+T+": "+se);if(ie.reason=se,ie.filename=N.source,ie.line=C,ie.column=T,ie.source=S,!N.silent)throw ie}function M(se){var ie=se.exec(S);if(ie){var $=ie[0];return D($),S=S.slice($.length),ie}}function q(){M(n)}function R(se){var ie;for(se=se||[];ie=J();)ie!==!1&&se.push(ie);return se}function J(){var se=L();if(!(m!=S.charAt(0)||p!=S.charAt(1))){for(var ie=2;g!=S.charAt(ie)&&(p!=S.charAt(ie)||m!=S.charAt(ie+1));)++ie;if(ie+=2,g===S.charAt(ie-1))return B("End of comment missing");var $=S.slice(2,ie-2);return T+=2,D($),S=S.slice(ie),T+=2,se({type:v,comment:$})}}function K(){var se=L(),ie=M(r);if(ie){if(J(),!M(i))return B("property missing ':'");var $=M(l),V=se({type:b,property:_(ie[0].replace(e,g)),value:$?_($[0].replace(e,g)):g});return M(u),V}}function he(){var se=[];R(se);for(var ie;ie=K();)ie!==!1&&(se.push(ie),R(se));return se}return q(),he()}function _(S){return S?S.replace(d,g):g}return $m=j,$m}var cS;function FU(){if(cS)return Vi;cS=1;var e=Vi&&Vi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.default=n;const t=e(VU());function n(r,i){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),d=typeof i=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:m,value:p}=h;d?i(m,p,h):p&&(l=l||{},l[m]=p)}),l}return Vi}var fl={},uS;function $U(){if(uS)return fl;uS=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},u=function(m,p){return p.toUpperCase()},d=function(m,p){return"".concat(p,"-")},h=function(m,p){return p===void 0&&(p={}),l(m)?m:(m=m.toLowerCase(),p.reactCompat?m=m.replace(i,d):m=m.replace(r,d),m.replace(t,u))};return fl.camelCase=h,fl}var hl,dS;function qU(){if(dS)return hl;dS=1;var e=hl&&hl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(FU()),n=$U();function r(i,l){var u={};return!i||typeof i!="string"||(0,t.default)(i,function(d,h){d&&h&&(u[(0,n.camelCase)(d,l)]=h)}),u}return r.default=r,hl=r,hl}var HU=qU();const GU=Yl(HU),MN=PN("end"),wy=PN("start");function PN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function KU(e){const t=wy(e),n=MN(e);if(t&&n)return{start:t,end:n}}function _l(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fS(e.position):"start"in e||"end"in e?fS(e):"line"in e||"column"in e?rg(e):""}function rg(e){return hS(e&&e.line)+":"+hS(e&&e.column)}function fS(e){return rg(e&&e.start)+"-"+rg(e&&e.end)}function hS(e){return e&&typeof e=="number"?e:1}class hn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(u=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?l.ruleId=r:(l.source=r.slice(0,h),l.ruleId=r.slice(h+1))}if(!l.place&&l.ancestors&&l.ancestors){const h=l.ancestors[l.ancestors.length-1];h&&(l.place=h.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=d?d.line:void 0,this.name=_l(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const Sy={}.hasOwnProperty,YU=new Map,WU=/[A-Z]/g,XU=new Set(["table","tbody","thead","tfoot","tr"]),JU=new Set(["td","th"]),zN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QU(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=i8(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=a8(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?by:UU,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=LN(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function LN(e,t,n){if(t.type==="element")return ZU(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return e8(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return n8(e,t,n);if(t.type==="mdxjsEsm")return t8(e,t);if(t.type==="root")return s8(e,t,n);if(t.type==="text")return r8(e,t)}function ZU(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=by,e.schema=i),e.ancestors.push(t);const l=UN(e,t.tagName,!1),u=o8(e,t);let d=ky(e,t);return XU.has(t.tagName)&&(d=d.filter(function(h){return typeof h=="string"?!CU(h):!0})),IN(e,u,l,t),jy(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function e8(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Gl(e,t.position)}function t8(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Gl(e,t.position)}function n8(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=by,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:UN(e,t.name,!0),u=l8(e,t),d=ky(e,t);return IN(e,u,l,t),jy(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function s8(e,t,n){const r={};return jy(r,ky(e,t)),e.create(t,e.Fragment,r,n)}function r8(e,t){return t.value}function IN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function jy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function a8(e,t,n){return r;function r(i,l,u,d){const m=Array.isArray(u.children)?n:t;return d?m(l,u,d):m(l,u)}}function i8(e,t){return n;function n(r,i,l,u){const d=Array.isArray(l.children),h=wy(r);return t(i,l,u,d,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function o8(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Sy.call(t.properties,i)){const l=c8(e,i,t.properties[i]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&JU.has(t.tagName)?r=d:n[u]=d}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function l8(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Gl(e,t.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Gl(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function ky(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:YU;for(;++r<t.children.length;){const l=t.children[r];let u;if(e.passKeys){const h=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(h){const m=i.get(h)||0;u=h+"-"+m,i.set(h,m+1)}}const d=LN(e,l,u);d!==void 0&&n.push(d)}return n}function c8(e,t,n){const r=zU(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?kU(n):BU(n)),r.property==="style"){let i=typeof n=="object"?n:u8(e,String(n));return e.stylePropertyNameCase==="css"&&(i=d8(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?OU[r.property]||r.property:r.attribute,n]}}function u8(e,t){try{return GU(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=zN+"#cannot-parse-style-attribute",i}}function UN(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,u;for(;++l<i.length;){const d=rS(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}r=u}else r=rS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Sy.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Gl(e)}function Gl(e,t){const n=new hn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=zN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function d8(e){const t={};let n;for(n in e)Sy.call(e,n)&&(t[f8(n)]=e[n]);return t}function f8(e){let t=e.replace(WU,h8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function h8(e){return"-"+e.toLowerCase()}const qm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},m8={};function _y(e,t){const n=m8,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return BN(e,r,i)}function BN(e,t,n){if(p8(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return mS(e.children,t,n)}return Array.isArray(e)?mS(e,t,n):""}function mS(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=BN(e[i],t,n);return r.join("")}function p8(e){return!!(e&&typeof e=="object")}const pS=document.createElement("i");function Ny(e){const t="&"+e+";";pS.innerHTML=t;const n=pS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $n(e,t,n,r){const i=e.length;let l=0,u;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<r.length;)u=r.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function ss(e,t){return e.length>0?($n(e,e.length,0,t),e):t}const gS={}.hasOwnProperty;function VN(e){const t={};let n=-1;for(;++n<e.length;)g8(t,e[n]);return t}function g8(e,t){let n;for(n in t){const i=(gS.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let u;if(l)for(u in l){gS.call(i,u)||(i[u]=[]);const d=l[u];y8(i[u],Array.isArray(d)?d:d?[d]:[])}}}function y8(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$n(e,0,0,r)}function FN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function vs(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gn=ra(/[A-Za-z]/),dn=ra(/[\dA-Za-z]/),x8=ra(/[#-'*+\--9=?A-Z^-~]/);function hd(e){return e!==null&&(e<32||e===127)}const ag=ra(/\d/),v8=ra(/[\dA-Fa-f]/),b8=ra(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const Md=ra(new RegExp("\\p{P}|\\p{S}","u")),Ba=ra(/\s/);function ra(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function yo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let u="";if(l===37&&dn(e.charCodeAt(n+1))&&dn(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(u=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(u=String.fromCharCode(l,d),i=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+i+1,u=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Qe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(h){return Ke(h)?(e.enter(n),d(h)):t(h)}function d(h){return Ke(h)&&l++<i?(e.consume(h),d):(e.exit(n),t(h))}}const w8={tokenize:S8};function S8(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Qe(e,t,"linePrefix")}function i(d){return e.enter("paragraph"),l(d)}function l(d){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Ce(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),u)}}const j8={tokenize:k8},yS={tokenize:_8};function k8(e){const t=this,n=[];let r=0,i,l,u;return d;function d(T){if(r<n.length){const D=n[r];return t.containerState=D[1],e.attempt(D[0].continuation,h,m)(T)}return m(T)}function h(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&C();const D=t.events.length;let L=D,O;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){O=t.events[L][1].end;break}N(r);let B=D;for(;B<t.events.length;)t.events[B][1].end={...O},B++;return $n(t.events,L+1,0,t.events.slice(D)),t.events.length=B,m(T)}return d(T)}function m(T){if(r===n.length){if(!i)return v(T);if(i.currentConstruct&&i.currentConstruct.concrete)return j(T);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yS,p,g)(T)}function p(T){return i&&C(),N(r),v(T)}function g(T){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,j(T)}function v(T){return t.containerState={},e.attempt(yS,b,j)(T)}function b(T){return r++,n.push([t.currentConstruct,t.containerState]),v(T)}function j(T){if(T===null){i&&C(),N(0),e.consume(T);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),_(T)}function _(T){if(T===null){S(e.exit("chunkFlow"),!0),N(0),e.consume(T);return}return Ce(T)?(e.consume(T),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(T),_)}function S(T,D){const L=t.sliceStream(T);if(D&&L.push(null),T.previous=l,l&&(l.next=T),l=T,i.defineSkip(T.start),i.write(L),t.parser.lazy[T.start.line]){let O=i.events.length;for(;O--;)if(i.events[O][1].start.offset<u&&(!i.events[O][1].end||i.events[O][1].end.offset>u))return;const B=t.events.length;let M=B,q,R;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(q){R=t.events[M][1].end;break}q=!0}for(N(r),O=B;O<t.events.length;)t.events[O][1].end={...R},O++;$n(t.events,M+1,0,t.events.slice(B)),t.events.length=O}}function N(T){let D=n.length;for(;D-- >T;){const L=n[D];t.containerState=L[1],L[0].exit.call(t,e)}n.length=T}function C(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function _8(e,t,n){return Qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oo(e){if(e===null||ft(e)||Ba(e))return 1;if(Md(e))return 2}function Pd(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const ig={name:"attention",resolveAll:N8,tokenize:T8};function N8(e,t){let n=-1,r,i,l,u,d,h,m,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[r][1].end},v={...e[n][1].start};xS(g,-h),xS(v,h),u={type:h>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},d={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},l={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:h>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},m=[],e[r][1].end.offset-e[r][1].start.offset&&(m=ss(m,[["enter",e[r][1],t],["exit",e[r][1],t]])),m=ss(m,[["enter",i,t],["enter",u,t],["exit",u,t],["enter",l,t]]),m=ss(m,Pd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),m=ss(m,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,m=ss(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,$n(e,r-1,n-r+3,m),n=r+m.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function T8(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=oo(r);let l;return u;function u(h){return l=h,e.enter("attentionSequence"),d(h)}function d(h){if(h===l)return e.consume(h),d;const m=e.exit("attentionSequence"),p=oo(h),g=!p||p===2&&i||n.includes(h),v=!i||i===2&&p||n.includes(r);return m._open=!!(l===42?g:g&&(i||!v)),m._close=!!(l===42?v:v&&(p||!g)),t(h)}}function xS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const E8={name:"autolink",tokenize:C8};function C8(e,t,n){let r=0;return i;function i(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return gn(b)?(e.consume(b),u):b===64?n(b):m(b)}function u(b){return b===43||b===45||b===46||dn(b)?(r=1,d(b)):m(b)}function d(b){return b===58?(e.consume(b),r=0,h):(b===43||b===45||b===46||dn(b))&&r++<32?(e.consume(b),d):(r=0,m(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||hd(b)?n(b):(e.consume(b),h)}function m(b){return b===64?(e.consume(b),p):x8(b)?(e.consume(b),m):n(b)}function p(b){return dn(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),r=0,p):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):v(b)}function v(b){if((b===45||dn(b))&&r++<63){const j=b===45?v:g;return e.consume(b),j}return n(b)}}const rc={partial:!0,tokenize:A8};function A8(e,t,n){return r;function r(l){return Ke(l)?Qe(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||Ce(l)?t(l):n(l)}}const $N={continuation:{tokenize:D8},exit:O8,name:"blockQuote",tokenize:R8};function R8(e,t,n){const r=this;return i;function i(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),l}return n(u)}function l(u){return Ke(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function D8(e,t,n){const r=this;return i;function i(u){return Ke(u)?Qe(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt($N,t,n)(u)}}function O8(e){e.exit("blockQuote")}const qN={name:"characterEscape",tokenize:M8};function M8(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return b8(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const HN={name:"characterReference",tokenize:P8};function P8(e,t,n){const r=this;let i=0,l,u;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),h}function h(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,u=dn,p(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,u=v8,p):(e.enter("characterReferenceValue"),l=7,u=ag,p(g))}function p(g){if(g===59&&i){const v=e.exit("characterReferenceValue");return u===dn&&!Ny(r.sliceSerialize(v))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(g)&&i++<l?(e.consume(g),p):n(g)}}const vS={partial:!0,tokenize:L8},bS={concrete:!0,name:"codeFenced",tokenize:z8};function z8(e,t,n){const r=this,i={partial:!0,tokenize:L};let l=0,u=0,d;return h;function h(O){return m(O)}function m(O){const B=r.events[r.events.length-1];return l=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,d=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===d?(u++,e.consume(O),p):u<3?n(O):(e.exit("codeFencedFenceSequence"),Ke(O)?Qe(e,g,"whitespace")(O):g(O))}function g(O){return O===null||Ce(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(vS,_,D)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(O))}function v(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):Ke(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Qe(e,b,"whitespace")(O)):O===96&&O===d?n(O):(e.consume(O),v)}function b(O){return O===null||Ce(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(O))}function j(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===d?n(O):(e.consume(O),j)}function _(O){return e.attempt(i,D,S)(O)}function S(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),N}function N(O){return l>0&&Ke(O)?Qe(e,C,"linePrefix",l+1)(O):C(O)}function C(O){return O===null||Ce(O)?e.check(vS,_,D)(O):(e.enter("codeFlowValue"),T(O))}function T(O){return O===null||Ce(O)?(e.exit("codeFlowValue"),C(O)):(e.consume(O),T)}function D(O){return e.exit("codeFenced"),t(O)}function L(O,B,M){let q=0;return R;function R(ie){return O.enter("lineEnding"),O.consume(ie),O.exit("lineEnding"),J}function J(ie){return O.enter("codeFencedFence"),Ke(ie)?Qe(O,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ie):K(ie)}function K(ie){return ie===d?(O.enter("codeFencedFenceSequence"),he(ie)):M(ie)}function he(ie){return ie===d?(q++,O.consume(ie),he):q>=u?(O.exit("codeFencedFenceSequence"),Ke(ie)?Qe(O,se,"whitespace")(ie):se(ie)):M(ie)}function se(ie){return ie===null||Ce(ie)?(O.exit("codeFencedFence"),B(ie)):M(ie)}}}function L8(e,t,n){const r=this;return i;function i(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Hm={name:"codeIndented",tokenize:U8},I8={partial:!0,tokenize:B8};function U8(e,t,n){const r=this;return i;function i(m){return e.enter("codeIndented"),Qe(e,l,"linePrefix",5)(m)}function l(m){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?h(m):Ce(m)?e.attempt(I8,u,h)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||Ce(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),d)}function h(m){return e.exit("codeIndented"),t(m)}}function B8(e,t,n){const r=this;return i;function i(u){return r.parser.lazy[r.now().line]?n(u):Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),i):Qe(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Ce(u)?i(u):n(u)}}const V8={name:"codeText",previous:$8,resolve:F8,tokenize:q8};function F8(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function $8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function q8(e,t,n){let r=0,i,l;return u;function u(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),r++,d):(e.exit("codeTextSequence"),h(g))}function h(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),h):g===96?(l=e.enter("codeTextSequence"),i=0,p(g)):Ce(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||Ce(g)?(e.exit("codeTextData"),h(g)):(e.consume(g),m)}function p(g){return g===96?(e.consume(g),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",m(g))}}class H8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ml(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ml(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ml(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ml(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ml(this.left,n.reverse())}}}function ml(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function GN(e){const t={};let n=-1,r,i,l,u,d,h,m;const p=new H8(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,l=0,l<h.length&&h[l][1].type==="lineEndingBlank"&&(l+=2),l<h.length&&h[l][1].type==="content"))for(;++l<h.length&&h[l][1].type!=="content";)h[l][1].type==="chunkText"&&(h[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,G8(p,n)),n=t[n],m=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(u=p.get(l),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),u[1].type="lineEnding",i=l);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},d=p.slice(i,n),d.unshift(r),p.splice(i,n-i+1,d))}}return $n(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!m}function G8(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,h=[],m={};let p,g,v=-1,b=n,j=0,_=0;const S=[_];for(;b;){for(;e.get(++i)[1]!==b;);l.push(i),b._tokenizer||(p=r.sliceStream(b),b.next||p.push(null),g&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(p),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(_=v+1,S.push(_),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):S.pop(),v=S.length;v--;){const N=d.slice(S[v],S[v+1]),C=l.pop();h.push([C,C+N.length-1]),e.splice(C,2,N)}for(h.reverse(),v=-1;++v<h.length;)m[j+h[v][0]]=j+h[v][1],j+=h[v][1]-h[v][0]-1;return m}const K8={resolve:W8,tokenize:X8},Y8={partial:!0,tokenize:J8};function W8(e){return GN(e),e}function X8(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(d)}function i(d){return d===null?l(d):Ce(d)?e.check(Y8,u,l)(d):(e.consume(d),i)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function J8(e,t,n){const r=this;return i;function i(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Qe(e,l,"linePrefix")}function l(u){if(u===null||Ce(u))return n(u);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function KN(e,t,n,r,i,l,u,d,h){const m=h||Number.POSITIVE_INFINITY;let p=0;return g;function g(N){return N===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(N),e.exit(l),v):N===null||N===32||N===41||hd(N)?n(N):(e.enter(r),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),_(N))}function v(N){return N===62?(e.enter(l),e.consume(N),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===62?(e.exit("chunkString"),e.exit(d),v(N)):N===null||N===60||Ce(N)?n(N):(e.consume(N),N===92?j:b)}function j(N){return N===60||N===62||N===92?(e.consume(N),b):b(N)}function _(N){return!p&&(N===null||N===41||ft(N))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(N)):p<m&&N===40?(e.consume(N),p++,_):N===41?(e.consume(N),p--,_):N===null||N===32||N===40||hd(N)?n(N):(e.consume(N),N===92?S:_)}function S(N){return N===40||N===41||N===92?(e.consume(N),_):_(N)}}function YN(e,t,n,r,i,l){const u=this;let d=0,h;return m;function m(b){return e.enter(r),e.enter(i),e.consume(b),e.exit(i),e.enter(l),p}function p(b){return d>999||b===null||b===91||b===93&&!h||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(l),e.enter(i),e.consume(b),e.exit(i),e.exit(r),t):Ce(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Ce(b)||d++>999?(e.exit("chunkString"),p(b)):(e.consume(b),h||(h=!Ke(b)),b===92?v:g)}function v(b){return b===91||b===92||b===93?(e.consume(b),d++,g):g(b)}}function WN(e,t,n,r,i,l){let u;return d;function d(v){return v===34||v===39||v===40?(e.enter(r),e.enter(i),e.consume(v),e.exit(i),u=v===40?41:v,h):n(v)}function h(v){return v===u?(e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):(e.enter(l),m(v))}function m(v){return v===u?(e.exit(l),h(u)):v===null?n(v):Ce(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Qe(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===u||v===null||Ce(v)?(e.exit("chunkString"),m(v)):(e.consume(v),v===92?g:p)}function g(v){return v===u||v===92?(e.consume(v),p):p(v)}}function Nl(e,t){let n;return r;function r(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ke(i)?Qe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Q8={name:"definition",tokenize:e9},Z8={partial:!0,tokenize:t9};function e9(e,t,n){const r=this;let i;return l;function l(b){return e.enter("definition"),u(b)}function u(b){return YN.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return i=vs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return ft(b)?Nl(e,m)(b):m(b)}function m(b){return KN(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return e.attempt(Z8,g,g)(b)}function g(b){return Ke(b)?Qe(e,v,"whitespace")(b):v(b)}function v(b){return b===null||Ce(b)?(e.exit("definition"),r.parser.defined.push(i),t(b)):n(b)}}function t9(e,t,n){return r;function r(d){return ft(d)?Nl(e,i)(d):n(d)}function i(d){return WN(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return Ke(d)?Qe(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Ce(d)?t(d):n(d)}}const n9={name:"hardBreakEscape",tokenize:s9};function s9(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return Ce(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const r9={name:"headingAtx",resolve:a9,tokenize:i9};function a9(e,t){let n=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},$n(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function i9(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||ft(p)?(e.exit("atxHeadingSequence"),d(p)):n(p)}function d(p){return p===35?(e.enter("atxHeadingSequence"),h(p)):p===null||Ce(p)?(e.exit("atxHeading"),t(p)):Ke(p)?Qe(e,d,"whitespace")(p):(e.enter("atxHeadingText"),m(p))}function h(p){return p===35?(e.consume(p),h):(e.exit("atxHeadingSequence"),d(p))}function m(p){return p===null||p===35||ft(p)?(e.exit("atxHeadingText"),d(p)):(e.consume(p),m)}}const o9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wS=["pre","script","style","textarea"],l9={concrete:!0,name:"htmlFlow",resolveTo:d9,tokenize:f9},c9={partial:!0,tokenize:m9},u9={partial:!0,tokenize:h9};function d9(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function f9(e,t,n){const r=this;let i,l,u,d,h;return m;function m(A){return p(A)}function p(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),v):A===47?(e.consume(A),l=!0,_):A===63?(e.consume(A),i=3,r.interrupt?t:P):gn(A)?(e.consume(A),u=String.fromCharCode(A),S):n(A)}function v(A){return A===45?(e.consume(A),i=2,b):A===91?(e.consume(A),i=5,d=0,j):gn(A)?(e.consume(A),i=4,r.interrupt?t:P):n(A)}function b(A){return A===45?(e.consume(A),r.interrupt?t:P):n(A)}function j(A){const ee="CDATA[";return A===ee.charCodeAt(d++)?(e.consume(A),d===ee.length?r.interrupt?t:K:j):n(A)}function _(A){return gn(A)?(e.consume(A),u=String.fromCharCode(A),S):n(A)}function S(A){if(A===null||A===47||A===62||ft(A)){const ee=A===47,ge=u.toLowerCase();return!ee&&!l&&wS.includes(ge)?(i=1,r.interrupt?t(A):K(A)):o9.includes(u.toLowerCase())?(i=6,ee?(e.consume(A),N):r.interrupt?t(A):K(A)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):l?C(A):T(A))}return A===45||dn(A)?(e.consume(A),u+=String.fromCharCode(A),S):n(A)}function N(A){return A===62?(e.consume(A),r.interrupt?t:K):n(A)}function C(A){return Ke(A)?(e.consume(A),C):R(A)}function T(A){return A===47?(e.consume(A),R):A===58||A===95||gn(A)?(e.consume(A),D):Ke(A)?(e.consume(A),T):R(A)}function D(A){return A===45||A===46||A===58||A===95||dn(A)?(e.consume(A),D):L(A)}function L(A){return A===61?(e.consume(A),O):Ke(A)?(e.consume(A),L):T(A)}function O(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,B):Ke(A)?(e.consume(A),O):M(A)}function B(A){return A===h?(e.consume(A),h=null,q):A===null||Ce(A)?n(A):(e.consume(A),B)}function M(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||ft(A)?L(A):(e.consume(A),M)}function q(A){return A===47||A===62||Ke(A)?T(A):n(A)}function R(A){return A===62?(e.consume(A),J):n(A)}function J(A){return A===null||Ce(A)?K(A):Ke(A)?(e.consume(A),J):n(A)}function K(A){return A===45&&i===2?(e.consume(A),$):A===60&&i===1?(e.consume(A),V):A===62&&i===4?(e.consume(A),I):A===63&&i===3?(e.consume(A),P):A===93&&i===5?(e.consume(A),fe):Ce(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(c9,z,he)(A)):A===null||Ce(A)?(e.exit("htmlFlowData"),he(A)):(e.consume(A),K)}function he(A){return e.check(u9,se,z)(A)}function se(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),ie}function ie(A){return A===null||Ce(A)?he(A):(e.enter("htmlFlowData"),K(A))}function $(A){return A===45?(e.consume(A),P):K(A)}function V(A){return A===47?(e.consume(A),u="",G):K(A)}function G(A){if(A===62){const ee=u.toLowerCase();return wS.includes(ee)?(e.consume(A),I):K(A)}return gn(A)&&u.length<8?(e.consume(A),u+=String.fromCharCode(A),G):K(A)}function fe(A){return A===93?(e.consume(A),P):K(A)}function P(A){return A===62?(e.consume(A),I):A===45&&i===2?(e.consume(A),P):K(A)}function I(A){return A===null||Ce(A)?(e.exit("htmlFlowData"),z(A)):(e.consume(A),I)}function z(A){return e.exit("htmlFlow"),t(A)}}function h9(e,t,n){const r=this;return i;function i(u){return Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function m9(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(rc,t,n)}}const p9={name:"htmlText",tokenize:g9};function g9(e,t,n){const r=this;let i,l,u;return d;function d(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),h}function h(P){return P===33?(e.consume(P),m):P===47?(e.consume(P),L):P===63?(e.consume(P),T):gn(P)?(e.consume(P),M):n(P)}function m(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),l=0,j):gn(P)?(e.consume(P),C):n(P)}function p(P){return P===45?(e.consume(P),b):n(P)}function g(P){return P===null?n(P):P===45?(e.consume(P),v):Ce(P)?(u=g,V(P)):(e.consume(P),g)}function v(P){return P===45?(e.consume(P),b):g(P)}function b(P){return P===62?$(P):P===45?v(P):g(P)}function j(P){const I="CDATA[";return P===I.charCodeAt(l++)?(e.consume(P),l===I.length?_:j):n(P)}function _(P){return P===null?n(P):P===93?(e.consume(P),S):Ce(P)?(u=_,V(P)):(e.consume(P),_)}function S(P){return P===93?(e.consume(P),N):_(P)}function N(P){return P===62?$(P):P===93?(e.consume(P),N):_(P)}function C(P){return P===null||P===62?$(P):Ce(P)?(u=C,V(P)):(e.consume(P),C)}function T(P){return P===null?n(P):P===63?(e.consume(P),D):Ce(P)?(u=T,V(P)):(e.consume(P),T)}function D(P){return P===62?$(P):T(P)}function L(P){return gn(P)?(e.consume(P),O):n(P)}function O(P){return P===45||dn(P)?(e.consume(P),O):B(P)}function B(P){return Ce(P)?(u=B,V(P)):Ke(P)?(e.consume(P),B):$(P)}function M(P){return P===45||dn(P)?(e.consume(P),M):P===47||P===62||ft(P)?q(P):n(P)}function q(P){return P===47?(e.consume(P),$):P===58||P===95||gn(P)?(e.consume(P),R):Ce(P)?(u=q,V(P)):Ke(P)?(e.consume(P),q):$(P)}function R(P){return P===45||P===46||P===58||P===95||dn(P)?(e.consume(P),R):J(P)}function J(P){return P===61?(e.consume(P),K):Ce(P)?(u=J,V(P)):Ke(P)?(e.consume(P),J):q(P)}function K(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),i=P,he):Ce(P)?(u=K,V(P)):Ke(P)?(e.consume(P),K):(e.consume(P),se)}function he(P){return P===i?(e.consume(P),i=void 0,ie):P===null?n(P):Ce(P)?(u=he,V(P)):(e.consume(P),he)}function se(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||ft(P)?q(P):(e.consume(P),se)}function ie(P){return P===47||P===62||ft(P)?q(P):n(P)}function $(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function V(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),G}function G(P){return Ke(P)?Qe(e,fe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):fe(P)}function fe(P){return e.enter("htmlTextData"),u(P)}}const Ty={name:"labelEnd",resolveAll:b9,resolveTo:w9,tokenize:S9},y9={tokenize:j9},x9={tokenize:k9},v9={tokenize:_9};function b9(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&$n(e,0,e.length,n),e}function w9(e,t){let n=e.length,r=0,i,l,u,d;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(u=n);const h={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},p={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",h,t],["enter",m,t]],d=ss(d,e.slice(l+1,l+r+3)),d=ss(d,[["enter",p,t]]),d=ss(d,Pd(t.parser.constructs.insideSpan.null,e.slice(l+r+4,u-3),t)),d=ss(d,[["exit",p,t],e[u-2],e[u-1],["exit",m,t]]),d=ss(d,e.slice(u+1)),d=ss(d,[["exit",h,t]]),$n(e,l,e.length,d),e}function S9(e,t,n){const r=this;let i=r.events.length,l,u;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return d;function d(v){return l?l._inactive?g(v):(u=r.parser.defined.includes(vs(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),h):n(v)}function h(v){return v===40?e.attempt(y9,p,u?p:g)(v):v===91?e.attempt(x9,p,u?m:g)(v):u?p(v):g(v)}function m(v){return e.attempt(v9,p,g)(v)}function p(v){return t(v)}function g(v){return l._balanced=!0,n(v)}}function j9(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),i}function i(g){return ft(g)?Nl(e,l)(g):l(g)}function l(g){return g===41?p(g):KN(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function u(g){return ft(g)?Nl(e,h)(g):p(g)}function d(g){return n(g)}function h(g){return g===34||g===39||g===40?WN(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function m(g){return ft(g)?Nl(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function k9(e,t,n){const r=this;return i;function i(d){return YN.call(r,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return r.parser.defined.includes(vs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function _9(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const N9={name:"labelStartImage",resolveAll:Ty.resolveAll,tokenize:T9};function T9(e,t,n){const r=this;return i;function i(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const E9={name:"labelStartLink",resolveAll:Ty.resolveAll,tokenize:C9};function C9(e,t,n){const r=this;return i;function i(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Gm={name:"lineEnding",tokenize:A9};function A9(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Qe(e,t,"linePrefix")}}const Ju={name:"thematicBreak",tokenize:R9};function R9(e,t,n){let r=0,i;return l;function l(m){return e.enter("thematicBreak"),u(m)}function u(m){return i=m,d(m)}function d(m){return m===i?(e.enter("thematicBreakSequence"),h(m)):r>=3&&(m===null||Ce(m))?(e.exit("thematicBreak"),t(m)):n(m)}function h(m){return m===i?(e.consume(m),r++,h):(e.exit("thematicBreakSequence"),Ke(m)?Qe(e,d,"whitespace")(m):d(m))}}const Nn={continuation:{tokenize:P9},exit:L9,name:"list",tokenize:M9},D9={partial:!0,tokenize:I9},O9={partial:!0,tokenize:z9};function M9(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,u=0;return d;function d(b){const j=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:ag(b)){if(r.containerState.type||(r.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Ju,n,m)(b):m(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return ag(b)&&++u<10?(e.consume(b),h):(!r.interrupt||u<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(rc,r.interrupt?n:p,e.attempt(D9,v,g))}function p(b){return r.containerState.initialBlankLine=!0,l++,v(b)}function g(b){return Ke(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):n(b)}function v(b){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function P9(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(rc,i,l);function i(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qe(e,t,"listItemIndent",r.containerState.size+1)(d)}function l(d){return r.containerState.furtherBlankLines||!Ke(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(O9,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qe(e,e.attempt(Nn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function z9(e,t,n){const r=this;return Qe(e,i,"listItemIndent",r.containerState.size+1);function i(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function L9(e){e.exit(this.containerState.type)}function I9(e,t,n){const r=this;return Qe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const u=r.events[r.events.length-1];return!Ke(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const SS={name:"setextUnderline",resolveTo:U9,tokenize:B9};function U9(e,t){let n=e.length,r,i,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function B9(e,t,n){const r=this;let i;return l;function l(m){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),i=m,u(m)):n(m)}function u(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===i?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),Ke(m)?Qe(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||Ce(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const V9={tokenize:F9};function F9(e){const t=this,n=e.attempt(rc,r,e.attempt(this.parser.constructs.flowInitial,i,Qe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(K8,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $9={resolveAll:JN()},q9=XN("string"),H9=XN("text");function XN(e){return{resolveAll:JN(e==="text"?G9:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,u,d);return u;function u(p){return m(p)?l(p):d(p)}function d(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),h}function h(p){return m(p)?(n.exit("data"),l(p)):(n.consume(p),h)}function m(p){if(p===null)return!0;const g=i[p];let v=-1;if(g)for(;++v<g.length;){const b=g[v];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function JN(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function G9(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let l=i.length,u=-1,d=0,h;for(;l--;){const m=i[l];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(m===-2)h=!0,d++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const m={type:n===e.length||h||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:r.start._bufferIndex+u,_index:r.start._index+l,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...m.start},r.start.offset===r.end.offset?Object.assign(r,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const K9={42:Nn,43:Nn,45:Nn,48:Nn,49:Nn,50:Nn,51:Nn,52:Nn,53:Nn,54:Nn,55:Nn,56:Nn,57:Nn,62:$N},Y9={91:Q8},W9={[-2]:Hm,[-1]:Hm,32:Hm},X9={35:r9,42:Ju,45:[SS,Ju],60:l9,61:SS,95:Ju,96:bS,126:bS},J9={38:HN,92:qN},Q9={[-5]:Gm,[-4]:Gm,[-3]:Gm,33:N9,38:HN,42:ig,60:[E8,p9],91:E9,92:[n9,qN],93:Ty,95:ig,96:V8},Z9={null:[ig,$9]},eB={null:[42,95]},tB={null:[]},nB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:eB,contentInitial:Y9,disable:tB,document:K9,flow:X9,flowInitial:W9,insideSpan:Z9,string:J9,text:Q9},Symbol.toStringTag,{value:"Module"}));function sB(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},l=[];let u=[],d=[];const h={attempt:B(L),check:B(O),consume:C,enter:T,exit:D,interrupt:B(O,{interrupt:!0})},m={code:null,containerState:{},defineSkip:_,events:[],now:j,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:g};let p=t.tokenize.call(m,h);return t.resolveAll&&l.push(t),m;function g(J){return u=ss(u,J),S(),u[u.length-1]!==null?[]:(M(t,0),m.events=Pd(l,m.events,m),m.events)}function v(J,K){return aB(b(J),K)}function b(J){return rB(u,J)}function j(){const{_bufferIndex:J,_index:K,line:he,column:se,offset:ie}=r;return{_bufferIndex:J,_index:K,line:he,column:se,offset:ie}}function _(J){i[J.line]=J.column,R()}function S(){let J;for(;r._index<u.length;){const K=u[r._index];if(typeof K=="string")for(J=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===J&&r._bufferIndex<K.length;)N(K.charCodeAt(r._bufferIndex));else N(K)}}function N(J){p=p(J)}function C(J){Ce(J)?(r.line++,r.column=1,r.offset+=J===-3?2:1,R()):J!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=J}function T(J,K){const he=K||{};return he.type=J,he.start=j(),m.events.push(["enter",he,m]),d.push(he),he}function D(J){const K=d.pop();return K.end=j(),m.events.push(["exit",K,m]),K}function L(J,K){M(J,K.from)}function O(J,K){K.restore()}function B(J,K){return he;function he(se,ie,$){let V,G,fe,P;return Array.isArray(se)?z(se):"tokenize"in se?z([se]):I(se);function I(ye){return ue;function ue(ke){const Ne=ke!==null&&ye[ke],Ie=ke!==null&&ye.null,rt=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return z(rt)(ke)}}function z(ye){return V=ye,G=0,ye.length===0?$:A(ye[G])}function A(ye){return ue;function ue(ke){return P=q(),fe=ye,ye.partial||(m.currentConstruct=ye),ye.name&&m.parser.constructs.disable.null.includes(ye.name)?ge():ye.tokenize.call(K?Object.assign(Object.create(m),K):m,h,ee,ge)(ke)}}function ee(ye){return J(fe,P),ie}function ge(ye){return P.restore(),++G<V.length?A(V[G]):$}}}function M(J,K){J.resolveAll&&!l.includes(J)&&l.push(J),J.resolve&&$n(m.events,K,m.events.length-K,J.resolve(m.events.slice(K),m)),J.resolveTo&&(m.events=J.resolveTo(m.events,m))}function q(){const J=j(),K=m.previous,he=m.currentConstruct,se=m.events.length,ie=Array.from(d);return{from:se,restore:$};function $(){r=J,m.previous=K,m.currentConstruct=he,m.events.length=se,d=ie,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function rB(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let u;if(n===i)u=[e[n].slice(r,l)];else{if(u=e.slice(n,i),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}l>0&&u.push(e[i].slice(0,l))}return u}function aB(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let u;if(typeof l=="string")u=l;else switch(l){case-5:{u="\r";break}case-4:{u=`
157
+ `;break}case-3:{u=`\r
158
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&i)continue;u=" ";break}default:u=String.fromCharCode(l)}i=l===-2,r.push(u)}return r.join("")}function iB(e){const r={constructs:VN([nB,...(e||{}).extensions||[]]),content:i(w8),defined:[],document:i(j8),flow:i(V9),lazy:{},string:i(q9),text:i(H9)};return r;function i(l){return u;function u(d){return sB(r,l,d)}}}function oB(e){for(;!GN(e););return e}const jS=/[\0\t\n\r]/g;function lB(){let e=1,t="",n=!0,r;return i;function i(l,u,d){const h=[];let m,p,g,v,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(u||void 0).decode(l)),g=0,t="",n&&(l.charCodeAt(0)===65279&&g++,n=void 0);g<l.length;){if(jS.lastIndex=g,m=jS.exec(l),v=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(v),!m){t=l.slice(g);break}if(b===10&&g===v&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),g<v&&(h.push(l.slice(g,v)),e+=v-g),b){case 0:{h.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,h.push(-2);e++<p;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}g=v+1}return d&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const cB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uB(e){return e.replace(cB,dB)}function dB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return FN(n.slice(l?2:1),l?16:10)}return Ny(n)||e}const QN={}.hasOwnProperty;function fB(e,t,n){return typeof t!="string"&&(n=t,t=void 0),hB(n)(oB(iB(n).document().write(lB()(e,t,!0))))}function hB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(js),autolinkProtocol:q,autolinkEmail:q,atxHeading:l(Yt),blockQuote:l(Ie),characterEscape:q,characterReference:q,codeFenced:l(rt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(rt,u),codeText:l(Pt,u),codeTextData:q,data:q,codeFlowValue:q,definition:l(Ee),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(Ct),hardBreakEscape:l(Cn),hardBreakTrailing:l(Cn),htmlFlow:l(An,u),htmlFlowData:q,htmlText:l(An,u),htmlTextData:q,image:l(Ss),label:u,link:l(js),listItem:l($a),listItemValue:v,listOrdered:l(yr,g),listUnordered:l(yr),paragraph:l(Us),reference:A,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(Yt),strong:l(ic),thematicBreak:l(qa)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:Ne,autolinkProtocol:ke,blockQuote:h(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:ye,characterReference:ue,codeFenced:h(S),codeFencedFence:_,codeFencedFenceInfo:b,codeFencedFenceMeta:j,codeFlowValue:R,codeIndented:h(N),codeText:h(ie),codeTextData:R,data:R,definition:h(),definitionDestinationString:D,definitionLabelString:C,definitionTitleString:T,emphasis:h(),hardBreakEscape:h(K),hardBreakTrailing:h(K),htmlFlow:h(he),htmlFlowData:R,htmlText:h(se),htmlTextData:R,image:h(V),label:fe,labelText:G,lineEnding:J,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ee,resourceDestinationString:P,resourceTitleString:I,resource:z,setextHeading:h(M),setextHeadingLineSequence:B,setextHeadingText:O,strong:h(),thematicBreak:h()}};ZN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(re){let me={type:"root",children:[]};const Oe={stack:[me],tokenStack:[],config:t,enter:d,exit:m,buffer:u,resume:p,data:n},Fe=[];let Ze=-1;for(;++Ze<re.length;)if(re[Ze][1].type==="listOrdered"||re[Ze][1].type==="listUnordered")if(re[Ze][0]==="enter")Fe.push(Ze);else{const mn=Fe.pop();Ze=i(re,mn,Ze)}for(Ze=-1;++Ze<re.length;){const mn=t[re[Ze][0]];QN.call(mn,re[Ze][1].type)&&mn[re[Ze][1].type].call(Object.assign({sliceSerialize:re[Ze][2].sliceSerialize},Oe),re[Ze][1])}if(Oe.tokenStack.length>0){const mn=Oe.tokenStack[Oe.tokenStack.length-1];(mn[1]||kS).call(Oe,void 0,mn[0])}for(me.position={start:qr(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:qr(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Ze=-1;++Ze<t.transforms.length;)me=t.transforms[Ze](me)||me;return me}function i(re,me,Oe){let Fe=me-1,Ze=-1,mn=!1,cs,Qt,Rt,ln;for(;++Fe<=Oe;){const at=re[Fe];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?Ze++:Ze--,ln=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(cs&&!ln&&!Ze&&!Rt&&(Rt=Fe),ln=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ln=void 0}if(!Ze&&at[0]==="enter"&&at[1].type==="listItemPrefix"||Ze===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(cs){let ks=Fe;for(Qt=void 0;ks--;){const Rn=re[ks];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;Qt&&(re[Qt][1].type="lineEndingBlank",mn=!0),Rn[1].type="lineEnding",Qt=ks}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}Rt&&(!Qt||Rt<Qt)&&(cs._spread=!0),cs.end=Object.assign({},Qt?re[Qt][1].start:at[1].end),re.splice(Qt||Fe,0,["exit",cs,at[2]]),Fe++,Oe++}if(at[1].type==="listItemPrefix"){const ks={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};cs=ks,re.splice(Fe,0,["enter",ks,at[2]]),Fe++,Oe++,Rt=void 0,ln=!0}}}return re[me][1]._spread=mn,Oe}function l(re,me){return Oe;function Oe(Fe){d.call(this,re(Fe),Fe),me&&me.call(this,Fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(re,me,Oe){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([me,Oe||void 0]),re.position={start:qr(me.start),end:void 0}}function h(re){return me;function me(Oe){re&&re.call(this,Oe),m.call(this,Oe)}}function m(re,me){const Oe=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==re.type&&(me?me.call(this,re,Fe[0]):(Fe[1]||kS).call(this,re,Fe[0]));else throw new Error("Cannot close `"+re.type+"` ("+_l({start:re.start,end:re.end})+"): it’s not open");Oe.position.end=qr(re.end)}function p(){return _y(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(re){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function b(){const re=this.resume(),me=this.stack[this.stack.length-1];me.lang=re}function j(){const re=this.resume(),me=this.stack[this.stack.length-1];me.meta=re}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const re=this.resume(),me=this.stack[this.stack.length-1];me.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const re=this.resume(),me=this.stack[this.stack.length-1];me.value=re.replace(/(\r?\n|\r)$/g,"")}function C(re){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=vs(this.sliceSerialize(re)).toLowerCase()}function T(){const re=this.resume(),me=this.stack[this.stack.length-1];me.title=re}function D(){const re=this.resume(),me=this.stack[this.stack.length-1];me.url=re}function L(re){const me=this.stack[this.stack.length-1];if(!me.depth){const Oe=this.sliceSerialize(re).length;me.depth=Oe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function B(re){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function q(re){const Oe=this.stack[this.stack.length-1].children;let Fe=Oe[Oe.length-1];(!Fe||Fe.type!=="text")&&(Fe=At(),Fe.position={start:qr(re.start),end:void 0},Oe.push(Fe)),this.stack.push(Fe)}function R(re){const me=this.stack.pop();me.value+=this.sliceSerialize(re),me.position.end=qr(re.end)}function J(re){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=me.children[me.children.length-1];Oe.position.end=qr(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(q.call(this,re),R.call(this,re))}function K(){this.data.atHardBreak=!0}function he(){const re=this.resume(),me=this.stack[this.stack.length-1];me.value=re}function se(){const re=this.resume(),me=this.stack[this.stack.length-1];me.value=re}function ie(){const re=this.resume(),me=this.stack[this.stack.length-1];me.value=re}function $(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=me,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function V(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=me,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function G(re){const me=this.sliceSerialize(re),Oe=this.stack[this.stack.length-2];Oe.label=uB(me),Oe.identifier=vs(me).toLowerCase()}function fe(){const re=this.stack[this.stack.length-1],me=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const Fe=re.children;Oe.children=Fe}else Oe.alt=me}function P(){const re=this.resume(),me=this.stack[this.stack.length-1];me.url=re}function I(){const re=this.resume(),me=this.stack[this.stack.length-1];me.title=re}function z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ee(re){const me=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=me,Oe.identifier=vs(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function ge(re){this.data.characterReferenceType=re.type}function ye(re){const me=this.sliceSerialize(re),Oe=this.data.characterReferenceType;let Fe;Oe?(Fe=FN(me,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=Ny(me);const Ze=this.stack[this.stack.length-1];Ze.value+=Fe}function ue(re){const me=this.stack.pop();me.position.end=qr(re.end)}function ke(re){R.call(this,re);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(re)}function Ne(re){R.call(this,re);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(re)}function Ie(){return{type:"blockquote",children:[]}}function rt(){return{type:"code",lang:null,meta:null,value:""}}function Pt(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ct(){return{type:"emphasis",children:[]}}function Yt(){return{type:"heading",depth:0,children:[]}}function Cn(){return{type:"break"}}function An(){return{type:"html",value:""}}function Ss(){return{type:"image",title:null,url:"",alt:null}}function js(){return{type:"link",title:null,url:"",children:[]}}function yr(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function $a(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Us(){return{type:"paragraph",children:[]}}function ic(){return{type:"strong",children:[]}}function At(){return{type:"text",value:""}}function qa(){return{type:"thematicBreak"}}}function qr(e){return{line:e.line,column:e.column,offset:e.offset}}function ZN(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ZN(e,r):mB(e,r)}}function mB(e,t){let n;for(n in t)if(QN.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function kS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+_l({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_l({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+_l({start:t.start,end:t.end})+") is still open")}function pB(e){const t=this;t.parser=n;function n(r){return fB(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function gB(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function yB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
159
+ `}]}function xB(e,t){const n=t.value?t.value+`
160
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function vB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=yo(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,d+=1,e.footnoteCounts.set(r,d);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const m={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,m),e.applyData(t,m)}function SB(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function e2(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const u=i[i.length-1];return u&&u.type==="text"?u.value+=r:i.push({type:"text",value:r}),i}function kB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return e2(e,t);const i={src:yo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function _B(e,t){const n={src:yo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function NB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function TB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return e2(e,t);const i={href:yo(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function EB(e,t){const n={href:yo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function CB(e,t,n){const r=e.all(t),i=n?AB(n):t2(t),l={},u=[];if(typeof t.checked=="boolean"){const p=r[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const p=r[d];(i||d!==0||p.type!=="element"||p.tagName!=="p")&&u.push({type:"text",value:`
161
+ `}),p.type==="element"&&p.tagName==="p"&&!i?u.push(...p.children):u.push(p)}const h=r[r.length-1];h&&(i||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
162
+ `});const m={type:"element",tagName:"li",properties:l,children:u};return e.patch(t,m),e.applyData(t,m)}function AB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=t2(n[r])}return t}function t2(e){const t=e.spread;return t??e.children.length>1}function RB(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const u=r[i];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function DB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function MB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],u),i.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=wy(t.children[1]),h=MN(t.children[t.children.length-1]);d&&h&&(u.position={start:d,end:h}),i.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function zB(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let h=-1;const m=[];for(;++h<d;){const g=t.children[h],v={},b=u?u[h]:void 0;b&&(v.align=b);let j={type:"element",tagName:l,properties:v,children:[]};g&&(j.children=e.all(g),e.patch(g,j),j=e.applyData(g,j)),m.push(j)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,p),e.applyData(t,p)}function LB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const _S=9,NS=32;function IB(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const l=[];for(;r;)l.push(TS(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return l.push(TS(t.slice(i),i>0,!1)),l.join("")}function TS(e,t,n){let r=0,i=e.length;if(t){let l=e.codePointAt(r);for(;l===_S||l===NS;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(i-1);for(;l===_S||l===NS;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function UB(e,t){const n={type:"text",value:IB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function BB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const VB={blockquote:gB,break:yB,code:xB,delete:vB,emphasis:bB,footnoteReference:wB,heading:SB,html:jB,imageReference:kB,image:_B,inlineCode:NB,linkReference:TB,link:EB,listItem:CB,list:RB,paragraph:DB,root:OB,strong:MB,table:PB,tableCell:LB,tableRow:zB,text:UB,thematicBreak:BB,toml:Lu,yaml:Lu,definition:Lu,footnoteDefinition:Lu};function Lu(){}const n2=-1,zd=0,Tl=1,md=2,Ey=3,Cy=4,Ay=5,Ry=6,s2=7,r2=8,ES=typeof self=="object"?self:globalThis,FB=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,u]=t[i];switch(l){case zd:case n2:return n(u,i);case Tl:{const d=n([],i);for(const h of u)d.push(r(h));return d}case md:{const d=n({},i);for(const[h,m]of u)d[r(h)]=r(m);return d}case Ey:return n(new Date(u),i);case Cy:{const{source:d,flags:h}=u;return n(new RegExp(d,h),i)}case Ay:{const d=n(new Map,i);for(const[h,m]of u)d.set(r(h),r(m));return d}case Ry:{const d=n(new Set,i);for(const h of u)d.add(r(h));return d}case s2:{const{name:d,message:h}=u;return n(new ES[d](h),i)}case r2:return n(BigInt(u),i);case"BigInt":return n(Object(BigInt(u)),i);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return n(new DataView(d),u)}}return n(new ES[l](u),i)};return r},CS=e=>FB(new Map,e)(0),Fi="",{toString:$B}={},{keys:qB}=Object,pl=e=>{const t=typeof e;if(t!=="object"||!e)return[zd,t];const n=$B.call(e).slice(8,-1);switch(n){case"Array":return[Tl,Fi];case"Object":return[md,Fi];case"Date":return[Ey,Fi];case"RegExp":return[Cy,Fi];case"Map":return[Ay,Fi];case"Set":return[Ry,Fi];case"DataView":return[Tl,n]}return n.includes("Array")?[Tl,n]:n.includes("Error")?[s2,n]:[md,n]},Iu=([e,t])=>e===zd&&(t==="function"||t==="symbol"),HB=(e,t,n,r)=>{const i=(u,d)=>{const h=r.push(u)-1;return n.set(d,h),h},l=u=>{if(n.has(u))return n.get(u);let[d,h]=pl(u);switch(d){case zd:{let p=u;switch(h){case"bigint":d=r2,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);p=null;break;case"undefined":return i([n2],u)}return i([d,p],u)}case Tl:{if(h){let v=u;return h==="DataView"?v=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(u)),i([h,[...v]],u)}const p=[],g=i([d,p],u);for(const v of u)p.push(l(v));return g}case md:{if(h)switch(h){case"BigInt":return i([h,u.toString()],u);case"Boolean":case"Number":case"String":return i([h,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const p=[],g=i([d,p],u);for(const v of qB(u))(e||!Iu(pl(u[v])))&&p.push([l(v),l(u[v])]);return g}case Ey:return i([d,u.toISOString()],u);case Cy:{const{source:p,flags:g}=u;return i([d,{source:p,flags:g}],u)}case Ay:{const p=[],g=i([d,p],u);for(const[v,b]of u)(e||!(Iu(pl(v))||Iu(pl(b))))&&p.push([l(v),l(b)]);return g}case Ry:{const p=[],g=i([d,p],u);for(const v of u)(e||!Iu(pl(v)))&&p.push(l(v));return g}}const{message:m}=u;return i([d,{name:h,message:m}],u)};return l},AS=(e,{json:t,lossy:n}={})=>{const r=[];return HB(!(t||n),!!t,new Map,r)(e),r},pd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?CS(AS(e,t)):structuredClone(e):(e,t)=>CS(AS(e,t));function GB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function KB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function YB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||GB,r=e.options.footnoteBackLabel||KB,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let h=-1;for(;++h<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[h]);if(!m)continue;const p=e.all(m),g=String(m.identifier).toUpperCase(),v=yo(g.toLowerCase());let b=0;const j=[],_=e.footnoteCounts.get(g);for(;_!==void 0&&++b<=_;){j.length>0&&j.push({type:"text",value:" "});let C=typeof n=="string"?n:n(h,b);typeof C=="string"&&(C={type:"text",value:C}),j.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,b),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const C=S.children[S.children.length-1];C&&C.type==="text"?C.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...j)}else p.push(...j);const N={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(p,!0)};e.patch(m,N),d.push(N)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...pd(u),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
163
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
164
+ `}]}}const Ld=(function(e){if(e==null)return QB;if(typeof e=="function")return Id(e);if(typeof e=="object")return Array.isArray(e)?WB(e):XB(e);if(typeof e=="string")return JB(e);throw new Error("Expected function, string, or object as test")});function WB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ld(e[n]);return Id(r);function r(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function XB(e){const t=e;return Id(n);function n(r){const i=r;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function JB(e){return Id(t);function t(n){return n&&n.type===e}}function Id(e){return t;function t(n,r,i){return!!(ZB(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function QB(){return!0}function ZB(e){return e!==null&&typeof e=="object"&&"type"in e}const a2=[],eV=!0,og=!1,tV="skip";function i2(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const l=Ld(i),u=r?-1:1;d(e,void 0,[])();function d(h,m,p){const g=h&&typeof h=="object"?h:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=a2,j,_,S;if((!t||l(h,m,p[p.length-1]||void 0))&&(b=nV(n(h,p)),b[0]===og))return b;if("children"in h&&h.children){const N=h;if(N.children&&b[0]!==tV)for(_=(r?N.children.length:-1)+u,S=p.concat(N);_>-1&&_<N.children.length;){const C=N.children[_];if(j=d(C,_,S)(),j[0]===og)return j;_=typeof j[1]=="number"?j[1]:_+u}}return b}}}function nV(e){return Array.isArray(e)?e:typeof e=="number"?[eV,e]:e==null?a2:[e]}function Dy(e,t,n,r){let i,l,u;typeof t=="function"&&typeof n!="function"?(l=void 0,u=t,i=n):(l=t,u=n,i=r),i2(e,l,d,i);function d(h,m){const p=m[m.length-1],g=p?p.children.indexOf(h):void 0;return u(h,g,p)}}const lg={}.hasOwnProperty,sV={};function rV(e,t){const n=t||sV,r=new Map,i=new Map,l=new Map,u={...VB,...n.handlers},d={all:m,applyData:iV,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:u,one:h,options:n,patch:aV,wrap:lV};return Dy(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?r:i,v=String(p.identifier).toUpperCase();g.has(v)||g.set(v,p)}}),d;function h(p,g){const v=p.type,b=d.handlers[v];if(lg.call(d.handlers,v)&&b)return b(d,p,g);if(d.options.passThrough&&d.options.passThrough.includes(v)){if("children"in p){const{children:_,...S}=p,N=pd(S);return N.children=d.all(p),N}return pd(p)}return(d.options.unknownHandler||oV)(d,p,g)}function m(p){const g=[];if("children"in p){const v=p.children;let b=-1;for(;++b<v.length;){const j=d.one(v[b],p);if(j){if(b&&v[b-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=RS(j.value)),!Array.isArray(j)&&j.type==="element")){const _=j.children[0];_&&_.type==="text"&&(_.value=RS(_.value))}Array.isArray(j)?g.push(...j):g.push(j)}}}return g}}function aV(e,t){e.position&&(t.position=KU(e))}function iV(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&l&&Object.assign(n.properties,pd(l)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function oV(e,t){const n=t.data||{},r="value"in t&&!(lg.call(n,"hProperties")||lg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lV(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
165
+ `});++r<e.length;)r&&n.push({type:"text",value:`
166
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
167
+ `}),n}function RS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function DS(e,t){const n=rV(e,t),r=n.one(e,void 0),i=YB(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
168
+ `},i),l}function cV(e,t){return e&&"run"in e?async function(n,r){const i=DS(n,{file:r,...t});await e.run(i,r)}:function(n,r){return DS(n,{file:r,...e||t})}}function OS(e){if(e)throw e}var Km,MS;function uV(){if(MS)return Km;MS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},l=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var p=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!p&&!g)return!1;var v;for(v in m);return typeof v>"u"||e.call(m,v)},u=function(m,p){n&&p.name==="__proto__"?n(m,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):m[p.name]=p.newValue},d=function(m,p){if(p==="__proto__")if(e.call(m,p)){if(r)return r(m,p).value}else return;return m[p]};return Km=function h(){var m,p,g,v,b,j,_=arguments[0],S=1,N=arguments.length,C=!1;for(typeof _=="boolean"&&(C=_,_=arguments[1]||{},S=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});S<N;++S)if(m=arguments[S],m!=null)for(p in m)g=d(_,p),v=d(m,p),_!==v&&(C&&v&&(l(v)||(b=i(v)))?(b?(b=!1,j=g&&i(g)?g:[]):j=g&&l(g)?g:{},u(_,{name:p,newValue:h(C,j,v)})):typeof v<"u"&&u(_,{name:p,newValue:v}));return _},Km}var dV=uV();const Ym=Yl(dV);function cg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function fV(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const u=i.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...i);function d(h,...m){const p=e[++l];let g=-1;if(h){u(h);return}for(;++g<i.length;)(m[g]===null||m[g]===void 0)&&(m[g]=i[g]);i=m,p?hV(p,d)(...m):u(null,...m)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function hV(e,t){let n;return r;function r(...u){const d=e.length>u.length;let h;d&&u.push(i);try{h=e.apply(this,u)}catch(m){const p=m;if(d&&n)throw p;return i(p)}d||(h&&h.then&&typeof h.then=="function"?h.then(l,i):h instanceof Error?i(h):l(h))}function i(u,...d){n||(n=!0,t(u,...d))}function l(u){i(null,u)}}const As={basename:mV,dirname:pV,extname:gV,join:yV,sep:"/"};function mV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ac(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,d=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else u<0&&(l=!0,u=i+1),d>-1&&(e.codePointAt(i)===t.codePointAt(d--)?d<0&&(r=i):(d=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function pV(e){if(ac(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function gV(e){ac(e);let t=e.length,n=-1,r=0,i=-1,l=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),d===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function yV(...e){let t=-1,n;for(;++t<e.length;)ac(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":xV(n)}function xV(e){ac(e);const t=e.codePointAt(0)===47;let n=vV(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function vV(e,t){let n="",r=0,i=-1,l=0,u=-1,d,h;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(i===u-1||l===1))if(i!==u-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),i=u,l=0;continue}}else if(n.length>0){n="",r=0,i=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,u):n=e.slice(i+1,u),r=u-i-1;i=u,l=0}else d===46&&l>-1?l++:l=-1}return n}function ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bV={cwd:wV};function wV(){return"/"}function ug(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function SV(e){if(typeof e=="string")e=new URL(e);else if(!ug(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return jV(e)}function jV(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Wm=["history","path","basename","stem","extname","dirname"];class o2{constructor(t){let n;t?ug(t)?n={path:t}:typeof t=="string"||kV(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":bV.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Wm.length;){const l=Wm[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Wm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?As.basename(this.path):void 0}set basename(t){Jm(t,"basename"),Xm(t,"basename"),this.path=As.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?As.dirname(this.path):void 0}set dirname(t){PS(this.basename,"dirname"),this.path=As.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?As.extname(this.path):void 0}set extname(t){if(Xm(t,"extname"),PS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=As.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ug(t)&&(t=SV(t)),Jm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?As.basename(this.path,this.extname):void 0}set stem(t){Jm(t,"stem"),Xm(t,"stem"),this.path=As.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new hn(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xm(e,t){if(e&&e.includes(As.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+As.sep+"`")}function Jm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function PS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _V=(function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),NV={}.hasOwnProperty;class Oy extends _V{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=fV()}copy(){const t=new Oy;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ym(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ep("data",this.frozen),this.namespace[t]=n,this):NV.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ep("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Uu(t),r=this.parser||this.Parser;return Qm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Qm("process",this.parser||this.Parser),Zm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,u){const d=Uu(t),h=r.parse(d);r.run(h,d,function(p,g,v){if(p||!g||!v)return m(p);const b=g,j=r.stringify(b,v);CV(j)?v.value=j:v.result=j,m(p,v)});function m(p,g){p||!g?u(p):l?l(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Qm("processSync",this.parser||this.Parser),Zm("processSync",this.compiler||this.Compiler),this.process(t,i),LS("processSync","process",n),r;function i(l,u){n=!0,OS(l),r=u}}run(t,n,r){zS(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(u,d){const h=Uu(n);i.run(t,h,m);function m(p,g,v){const b=g||t;p?d(p):u?u(b):r(void 0,b,v)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),LS("runSync","run",r),i;function l(u,d){OS(u),i=d,r=!0}}stringify(t,n){this.freeze();const r=Uu(n),i=this.compiler||this.Compiler;return Zm("stringify",i),zS(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(ep("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(m){if(typeof m=="function")h(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[p,...g]=m;h(p,g)}else u(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function u(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(m.plugins),m.settings&&(i.settings=Ym(!0,i.settings,m.settings))}function d(m){let p=-1;if(m!=null)if(Array.isArray(m))for(;++p<m.length;){const g=m[p];l(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function h(m,p){let g=-1,v=-1;for(;++g<r.length;)if(r[g][0]===m){v=g;break}if(v===-1)r.push([m,...p]);else if(p.length>0){let[b,...j]=p;const _=r[v][1];cg(_)&&cg(b)&&(b=Ym(!0,_,b)),r[v]=[m,b,...j]}}}}const TV=new Oy().freeze();function Qm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ep(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zS(e){if(!cg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function LS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Uu(e){return EV(e)?e:new o2(e)}function EV(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function CV(e){return typeof e=="string"||AV(e)}function AV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RV="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",IS=[],US={allowDangerousHtml:!0},DV=/^(https?|ircs?|mailto|xmpp)$/i,OV=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function l2(e){const t=MV(e),n=PV(e);return zV(t.runSync(t.parse(n),n),e)}function MV(e){const t=e.rehypePlugins||IS,n=e.remarkPlugins||IS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...US}:US;return TV().use(pB).use(n).use(cV,r).use(t)}function PV(e){const t=e.children||"",n=new o2;return typeof t=="string"&&(n.value=t),n}function zV(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,l=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,h=t.urlTransform||LV;for(const p of OV)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+RV+p.id,void 0);return Dy(e,m),QU(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function m(p,g,v){if(p.type==="raw"&&v&&typeof g=="number")return u?v.children.splice(g,1):v.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let b;for(b in qm)if(Object.hasOwn(qm,b)&&Object.hasOwn(p.properties,b)){const j=p.properties[b],_=qm[b];(_===null||_.includes(p.tagName))&&(p.properties[b]=h(String(j||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!b&&r&&typeof g=="number"&&(b=!r(p,g,v)),b&&v&&typeof g=="number")return d&&p.children?v.children.splice(g,1,...p.children):v.children.splice(g,1),g}}}function LV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||DV.test(e.slice(0,t))?e:""}function BS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function IV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function UV(e,t,n){const i=Ld((n||{}).ignore||[]),l=BV(t);let u=-1;for(;++u<l.length;)i2(e,"text",d);function d(m,p){let g=-1,v;for(;++g<p.length;){const b=p[g],j=v?v.children:void 0;if(i(b,j?j.indexOf(b):void 0,v))return;v=b}if(v)return h(m,p)}function h(m,p){const g=p[p.length-1],v=l[u][0],b=l[u][1];let j=0;const S=g.children.indexOf(m);let N=!1,C=[];v.lastIndex=0;let T=v.exec(m.value);for(;T;){const D=T.index,L={index:T.index,input:T.input,stack:[...p,m]};let O=b(...T,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?v.lastIndex=D+1:(j!==D&&C.push({type:"text",value:m.value.slice(j,D)}),Array.isArray(O)?C.push(...O):O&&C.push(O),j=D+T[0].length,N=!0),!v.global)break;T=v.exec(m.value)}return N?(j<m.value.length&&C.push({type:"text",value:m.value.slice(j)}),g.children.splice(S,1,...C)):C=[m],S+C.length}}function BV(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([VV(i[0]),FV(i[1])])}return t}function VV(e){return typeof e=="string"?new RegExp(IV(e),"g"):e}function FV(e){return typeof e=="function"?e:function(){return e}}const tp="phrasing",np=["autolink","link","image","label"];function $V(){return{transforms:[XV],enter:{literalAutolink:HV,literalAutolinkEmail:sp,literalAutolinkHttp:sp,literalAutolinkWww:sp},exit:{literalAutolink:WV,literalAutolinkEmail:YV,literalAutolinkHttp:GV,literalAutolinkWww:KV}}}function qV(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tp,notInConstruct:np},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tp,notInConstruct:np},{character:":",before:"[ps]",after:"\\/",inConstruct:tp,notInConstruct:np}]}}function HV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function sp(e){this.config.enter.autolinkProtocol.call(this,e)}function GV(e){this.config.exit.autolinkProtocol.call(this,e)}function KV(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function YV(e){this.config.exit.autolinkEmail.call(this,e)}function WV(e){this.exit(e)}function XV(e){UV(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,JV],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),QV]],{ignore:["link","linkReference"]})}function JV(e,t,n,r,i){let l="";if(!c2(i)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!ZV(n)))return!1;const u=eF(n+r);if(!u[0])return!1;const d={type:"link",title:null,url:l+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function QV(e,t,n,r){return!c2(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ZV(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function eF(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=BS(e,"(");let l=BS(e,")");for(;r!==-1&&i>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function c2(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ba(n)||Md(n))&&(!t||n!==47)}u2.peek=cF;function tF(){this.buffer()}function nF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function sF(){this.buffer()}function rF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function aF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iF(e){this.exit(e)}function oF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function lF(e){this.exit(e)}function cF(){return"["}function u2(e,t,n,r){const i=n.createTracker(r);let l=i.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return l+=i.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),u(),l+=i.move("]"),l}function uF(){return{enter:{gfmFootnoteCallString:tF,gfmFootnoteCall:nF,gfmFootnoteDefinitionLabelString:sF,gfmFootnoteDefinition:rF},exit:{gfmFootnoteCallString:aF,gfmFootnoteCall:iF,gfmFootnoteDefinitionLabelString:oF,gfmFootnoteDefinition:lF}}}function dF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:u2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,l,u){const d=l.createTracker(u);let h=d.move("[^");const m=l.enter("footnoteDefinition"),p=l.enter("label");return h+=d.move(l.safe(l.associationId(r),{before:h,after:"]"})),p(),h+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),h+=d.move((t?`
169
+ `:" ")+l.indentLines(l.containerFlow(r,d.current()),t?d2:fF))),m(),h}}function fF(e,t,n){return t===0?e:d2(e,t,n)}function d2(e,t,n){return(n?"":" ")+e}const hF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];f2.peek=xF;function mF(){return{canContainEols:["delete"],enter:{strikethrough:gF},exit:{strikethrough:yF}}}function pF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:hF}],handlers:{delete:f2}}}function gF(e){this.enter({type:"delete",children:[]},e)}function yF(e){this.exit(e)}function f2(e,t,n,r){const i=n.createTracker(r),l=n.enter("strikethrough");let u=i.move("~~");return u+=n.containerPhrasing(e,{...i.current(),before:u,after:"~"}),u+=i.move("~~"),l(),u}function xF(){return"~"}function vF(e){return e.length}function bF(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||vF,l=[],u=[],d=[],h=[];let m=0,p=-1;for(;++p<e.length;){const _=[],S=[];let N=-1;for(e[p].length>m&&(m=e[p].length);++N<e[p].length;){const C=wF(e[p][N]);if(n.alignDelimiters!==!1){const T=i(C);S[N]=T,(h[N]===void 0||T>h[N])&&(h[N]=T)}_.push(C)}u[p]=_,d[p]=S}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<m;)l[g]=VS(r[g]);else{const _=VS(r);for(;++g<m;)l[g]=_}g=-1;const v=[],b=[];for(;++g<m;){const _=l[g];let S="",N="";_===99?(S=":",N=":"):_===108?S=":":_===114&&(N=":");let C=n.alignDelimiters===!1?1:Math.max(1,h[g]-S.length-N.length);const T=S+"-".repeat(C)+N;n.alignDelimiters!==!1&&(C=S.length+C+N.length,C>h[g]&&(h[g]=C),b[g]=C),v[g]=T}u.splice(1,0,v),d.splice(1,0,b),p=-1;const j=[];for(;++p<u.length;){const _=u[p],S=d[p];g=-1;const N=[];for(;++g<m;){const C=_[g]||"";let T="",D="";if(n.alignDelimiters!==!1){const L=h[g]-(S[g]||0),O=l[g];O===114?T=" ".repeat(L):O===99?L%2?(T=" ".repeat(L/2+.5),D=" ".repeat(L/2-.5)):(T=" ".repeat(L/2),D=T):D=" ".repeat(L)}n.delimiterStart!==!1&&!g&&N.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||g)&&N.push(" "),n.alignDelimiters!==!1&&N.push(T),N.push(C),n.alignDelimiters!==!1&&N.push(D),n.padding!==!1&&N.push(" "),(n.delimiterEnd!==!1||g!==m-1)&&N.push("|")}j.push(n.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return j.join(`
170
+ `)}function wF(e){return e==null?"":String(e)}function VS(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function SF(e,t,n,r){const i=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),jF);return i(),u}function jF(e,t,n){return">"+(n?"":" ")+e}function kF(e,t){return FS(e,t.inConstruct,!0)&&!FS(e,t.notInConstruct,!1)}function FS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function $S(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
171
+ `&&kF(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
172
+ `}function _F(e,t){const n=String(e);let r=n.indexOf(t),i=r,l=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++l>u&&(u=l):l=1,i=r+t.length,r=n.indexOf(t,i);return u}function NF(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function TF(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function EF(e,t,n,r){const i=TF(n),l=e.value||"",u=i==="`"?"GraveAccent":"Tilde";if(NF(e,n)){const g=n.enter("codeIndented"),v=n.indentLines(l,CF);return g(),v}const d=n.createTracker(r),h=i.repeat(Math.max(_F(l,i)+1,3)),m=n.enter("codeFenced");let p=d.move(h);if(e.lang){const g=n.enter(`codeFencedLang${u}`);p+=d.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${u}`);p+=d.move(" "),p+=d.move(n.safe(e.meta,{before:p,after:`
173
+ `,encode:["`"],...d.current()})),g()}return p+=d.move(`
174
+ `),l&&(p+=d.move(l+`
175
+ `)),p+=d.move(h),m(),p}function CF(e,t,n){return(n?"":" ")+e}function My(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function AF(e,t,n,r){const i=My(n),l=i==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const h=n.createTracker(r);let m=h.move("[");return m+=h.move(n.safe(n.associationId(e),{before:m,after:"]",...h.current()})),m+=h.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(n.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(d=n.enter("destinationRaw"),m+=h.move(n.safe(e.url,{before:m,after:e.title?" ":`
176
+ `,...h.current()}))),d(),e.title&&(d=n.enter(`title${l}`),m+=h.move(" "+i),m+=h.move(n.safe(e.title,{before:m,after:i,...h.current()})),m+=h.move(i),d()),u(),m}function RF(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Kl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function gd(e,t,n){const r=oo(e),i=oo(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}h2.peek=DF;function h2(e,t,n,r){const i=RF(n),l=n.enter("emphasis"),u=n.createTracker(r),d=u.move(i);let h=u.move(n.containerPhrasing(e,{after:i,before:d,...u.current()}));const m=h.charCodeAt(0),p=gd(r.before.charCodeAt(r.before.length-1),m,i);p.inside&&(h=Kl(m)+h.slice(1));const g=h.charCodeAt(h.length-1),v=gd(r.after.charCodeAt(0),g,i);v.inside&&(h=h.slice(0,-1)+Kl(g));const b=u.move(i);return l(),n.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},d+h+b}function DF(e,t,n){return n.options.emphasis||"*"}function OF(e,t){let n=!1;return Dy(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,og}),!!((!e.depth||e.depth<3)&&_y(e)&&(t.options.setext||n))}function MF(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(OF(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),v=n.containerPhrasing(e,{...l.current(),before:`
177
+ `,after:`
178
+ `});return g(),p(),v+`
179
+ `+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
180
+ `))+1))}const u="#".repeat(i),d=n.enter("headingAtx"),h=n.enter("phrasing");l.move(u+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
181
+ `,...l.current()});return/^[\t ]/.test(m)&&(m=Kl(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,n.options.closeAtx&&(m+=" "+u),h(),d(),m}m2.peek=PF;function m2(e){return e.value||""}function PF(){return"<"}p2.peek=zF;function p2(e,t,n,r){const i=My(n),l=i==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const h=n.createTracker(r);let m=h.move("![");return m+=h.move(n.safe(e.alt,{before:m,after:"]",...h.current()})),m+=h.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(n.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(d=n.enter("destinationRaw"),m+=h.move(n.safe(e.url,{before:m,after:e.title?" ":")",...h.current()}))),d(),e.title&&(d=n.enter(`title${l}`),m+=h.move(" "+i),m+=h.move(n.safe(e.title,{before:m,after:i,...h.current()})),m+=h.move(i),d()),m+=h.move(")"),u(),m}function zF(){return"!"}g2.peek=LF;function g2(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(r);let h=d.move("![");const m=n.safe(e.alt,{before:h,after:"]",...d.current()});h+=d.move(m+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const g=n.safe(n.associationId(e),{before:h,after:"]",...d.current()});return u(),n.stack=p,l(),i==="full"||!m||m!==g?h+=d.move(g+"]"):i==="shortcut"?h=h.slice(0,-1):h+=d.move("]"),h}function LF(){return"!"}y2.peek=IF;function y2(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const u=n.unsafe[l],d=n.compilePattern(u);let h;if(u.atBreak)for(;h=d.exec(r);){let m=h.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(h.index+1)}}return i+r+i}function IF(){return"`"}function x2(e,t){const n=_y(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}v2.peek=UF;function v2(e,t,n,r){const i=My(n),l=i==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let d,h;if(x2(e,n)){const p=n.stack;n.stack=[],d=n.enter("autolink");let g=u.move("<");return g+=u.move(n.containerPhrasing(e,{before:g,after:">",...u.current()})),g+=u.move(">"),d(),n.stack=p,g}d=n.enter("link"),h=n.enter("label");let m=u.move("[");return m+=u.move(n.containerPhrasing(e,{before:m,after:"](",...u.current()})),m+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(n.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(h=n.enter("destinationRaw"),m+=u.move(n.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${l}`),m+=u.move(" "+i),m+=u.move(n.safe(e.title,{before:m,after:i,...u.current()})),m+=u.move(i),h()),m+=u.move(")"),d(),m}function UF(e,t,n){return x2(e,n)?"<":"["}b2.peek=BF;function b2(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(r);let h=d.move("[");const m=n.containerPhrasing(e,{before:h,after:"]",...d.current()});h+=d.move(m+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const g=n.safe(n.associationId(e),{before:h,after:"]",...d.current()});return u(),n.stack=p,l(),i==="full"||!m||m!==g?h+=d.move(g+"]"):i==="shortcut"?h=h.slice(0,-1):h+=d.move("]"),h}function BF(){return"["}function Py(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function VF(e){const t=Py(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function FF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function w2(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function $F(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?FF(n):Py(n);const d=e.ordered?u==="."?")":".":VF(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),w2(n)===u&&p){let g=-1;for(;++g<e.children.length;){const v=e.children[g];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=d),n.bulletCurrent=u;const m=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=l,i(),m}function qF(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function HF(e,t,n,r){const i=qF(n);let l=n.bulletCurrent||Py(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=n.createTracker(r);d.move(l+" ".repeat(u-l.length)),d.shift(u);const h=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,d.current()),p);return h(),m;function p(g,v,b){return v?(b?"":" ".repeat(u))+g:(b?l:l+" ".repeat(u-l.length))+g}}function GF(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),i(),u}const KF=Ld(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function YF(e,t,n,r){return(e.children.some(function(u){return KF(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function WF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}S2.peek=XF;function S2(e,t,n,r){const i=WF(n),l=n.enter("strong"),u=n.createTracker(r),d=u.move(i+i);let h=u.move(n.containerPhrasing(e,{after:i,before:d,...u.current()}));const m=h.charCodeAt(0),p=gd(r.before.charCodeAt(r.before.length-1),m,i);p.inside&&(h=Kl(m)+h.slice(1));const g=h.charCodeAt(h.length-1),v=gd(r.after.charCodeAt(0),g,i);v.inside&&(h=h.slice(0,-1)+Kl(g));const b=u.move(i+i);return l(),n.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},d+h+b}function XF(e,t,n){return n.options.strong||"*"}function JF(e,t,n,r){return n.safe(e.value,r)}function QF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ZF(e,t,n){const r=(w2(n)+(n.options.ruleSpaces?" ":"")).repeat(QF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const j2={blockquote:SF,break:$S,code:EF,definition:AF,emphasis:h2,hardBreak:$S,heading:MF,html:m2,image:p2,imageReference:g2,inlineCode:y2,link:v2,linkReference:b2,list:$F,listItem:HF,paragraph:GF,root:YF,strong:S2,text:JF,thematicBreak:ZF};function e7(){return{enter:{table:t7,tableData:qS,tableHeader:qS,tableRow:s7},exit:{codeText:r7,table:n7,tableData:rp,tableHeader:rp,tableRow:rp}}}function t7(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function n7(e){this.exit(e),this.data.inTable=void 0}function s7(e){this.enter({type:"tableRow",children:[]},e)}function rp(e){this.exit(e)}function qS(e){this.enter({type:"tableCell",children:[]},e)}function r7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,a7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function a7(e,t){return t==="|"?t:e}function i7(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
182
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:u,tableCell:h,tableRow:d}};function u(b,j,_,S){return m(p(b,_,S),b.align)}function d(b,j,_,S){const N=g(b,_,S),C=m([N]);return C.slice(0,C.indexOf(`
183
+ `))}function h(b,j,_,S){const N=_.enter("tableCell"),C=_.enter("phrasing"),T=_.containerPhrasing(b,{...S,before:l,after:l});return C(),N(),T}function m(b,j){return bF(b,{align:j,alignDelimiters:r,padding:n,stringLength:i})}function p(b,j,_){const S=b.children;let N=-1;const C=[],T=j.enter("table");for(;++N<S.length;)C[N]=g(S[N],j,_);return T(),C}function g(b,j,_){const S=b.children;let N=-1;const C=[],T=j.enter("tableRow");for(;++N<S.length;)C[N]=h(S[N],b,j,_);return T(),C}function v(b,j,_){let S=j2.inlineCode(b,j,_);return _.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function o7(){return{exit:{taskListCheckValueChecked:HS,taskListCheckValueUnchecked:HS,paragraph:c7}}}function l7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:u7}}}function HS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function c7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,u;for(;++l<i.length;){const d=i[l];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function u7(e,t,n,r){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);l&&d.move(u);let h=j2.listItem(e,t,n,{...r,...d.current()});return l&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(p){return p+u}}function d7(){return[$V(),uF(),mF(),e7(),o7()]}function f7(e){return{extensions:[qV(),dF(e),pF(),i7(e),l7()]}}const h7={tokenize:v7,partial:!0},k2={tokenize:b7,partial:!0},_2={tokenize:w7,partial:!0},N2={tokenize:S7,partial:!0},m7={tokenize:j7,partial:!0},T2={name:"wwwAutolink",tokenize:y7,previous:C2},E2={name:"protocolAutolink",tokenize:x7,previous:A2},gr={name:"emailAutolink",tokenize:g7,previous:R2},Is={};function p7(){return{text:Is}}let Ta=48;for(;Ta<123;)Is[Ta]=gr,Ta++,Ta===58?Ta=65:Ta===91&&(Ta=97);Is[43]=gr;Is[45]=gr;Is[46]=gr;Is[95]=gr;Is[72]=[gr,E2];Is[104]=[gr,E2];Is[87]=[gr,T2];Is[119]=[gr,T2];function g7(e,t,n){const r=this;let i,l;return u;function u(g){return!dg(g)||!R2.call(r,r.previous)||zy(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return dg(g)?(e.consume(g),d):g===64?(e.consume(g),h):n(g)}function h(g){return g===46?e.check(m7,p,m)(g):g===45||g===95||dn(g)?(l=!0,e.consume(g),h):p(g)}function m(g){return e.consume(g),i=!0,h}function p(g){return l&&i&&gn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function y7(e,t,n){const r=this;return i;function i(u){return u!==87&&u!==119||!C2.call(r,r.previous)||zy(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(h7,e.attempt(k2,e.attempt(_2,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function x7(e,t,n){const r=this;let i="",l=!1;return u;function u(g){return(g===72||g===104)&&A2.call(r,r.previous)&&!zy(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),e.consume(g),d):n(g)}function d(g){if(gn(g)&&i.length<5)return i+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const v=i.toLowerCase();if(v==="http"||v==="https")return e.consume(g),h}return n(g)}function h(g){return g===47?(e.consume(g),l?m:(l=!0,h)):n(g)}function m(g){return g===null||hd(g)||ft(g)||Ba(g)||Md(g)?n(g):e.attempt(k2,e.attempt(_2,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function v7(e,t,n){let r=0;return i;function i(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),i):u===46&&r===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function b7(e,t,n){let r,i,l;return u;function u(m){return m===46||m===95?e.check(N2,h,d)(m):m===null||ft(m)||Ba(m)||m!==45&&Md(m)?h(m):(l=!0,e.consume(m),u)}function d(m){return m===95?r=!0:(i=r,r=void 0),e.consume(m),u}function h(m){return i||r||!l?n(m):t(m)}}function w7(e,t){let n=0,r=0;return i;function i(u){return u===40?(n++,e.consume(u),i):u===41&&r<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(N2,t,l)(u):u===null||ft(u)||Ba(u)?t(u):(e.consume(u),i)}function l(u){return u===41&&r++,e.consume(u),i}}function S7(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),l):d===93?(e.consume(d),i):d===60||d===null||ft(d)||Ba(d)?t(d):n(d)}function i(d){return d===null||d===40||d===91||ft(d)||Ba(d)?t(d):r(d)}function l(d){return gn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):gn(d)?(e.consume(d),u):n(d)}}function j7(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return dn(l)?n(l):t(l)}}function C2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ft(e)}function A2(e){return!gn(e)}function R2(e){return!(e===47||dg(e))}function dg(e){return e===43||e===45||e===46||e===95||dn(e)}function zy(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const k7={tokenize:D7,partial:!0};function _7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:C7,continuation:{tokenize:A7},exit:R7}},text:{91:{name:"gfmFootnoteCall",tokenize:E7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:N7,resolveTo:T7}}}}function N7(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;i--;){const h=r.events[i][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return d;function d(h){if(!u||!u._balanced)return n(h);const m=vs(r.sliceSerialize({start:u.end,end:r.now()}));return m.codePointAt(0)!==94||!l.includes(m.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function T7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function E7(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),h}function h(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(l>999||g===93&&!u||g===null||g===91||ft(g))return n(g);if(g===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return i.includes(vs(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return ft(g)||(u=!0),l++,e.consume(g),g===92?p:m}function p(g){return g===91||g===92||g===93?(e.consume(g),l++,m):m(g)}}function C7(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,d;return h;function h(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(j)}function p(j){if(u>999||j===93&&!d||j===null||j===91||ft(j))return n(j);if(j===93){e.exit("chunkString");const _=e.exit("gfmFootnoteDefinitionLabelString");return l=vs(r.sliceSerialize(_)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return ft(j)||(d=!0),u++,e.consume(j),j===92?g:p}function g(j){return j===91||j===92||j===93?(e.consume(j),u++,p):p(j)}function v(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),i.includes(l)||i.push(l),Qe(e,b,"gfmFootnoteDefinitionWhitespace")):n(j)}function b(j){return t(j)}}function A7(e,t,n){return e.check(rc,t,e.attempt(k7,t,n))}function R7(e){e.exit("gfmFootnoteDefinition")}function D7(e,t,n){const r=this;return Qe(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function O7(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(u,d){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let m=h;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[h][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[h][1].end)},g={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[h][1].start)},v=[["enter",p,d],["enter",u[m][1],d],["exit",u[m][1],d],["enter",g,d]],b=d.parser.constructs.insideSpan.null;b&&$n(v,v.length,0,Pd(b,u.slice(m+1,h),d)),$n(v,v.length,0,[["exit",g,d],["enter",u[h][1],d],["exit",u[h][1],d],["exit",p,d]]),$n(u,m-1,h-m+3,v),h=m+v.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function l(u,d,h){const m=this.previous,p=this.events;let g=0;return v;function v(j){return m===126&&p[p.length-1][1].type!=="characterEscape"?h(j):(u.enter("strikethroughSequenceTemporary"),b(j))}function b(j){const _=oo(m);if(j===126)return g>1?h(j):(u.consume(j),g++,b);if(g<2&&!n)return h(j);const S=u.exit("strikethroughSequenceTemporary"),N=oo(j);return S._open=!N||N===2&&!!_,S._close=!_||_===2&&!!N,d(j)}}}class M7{constructor(){this.map=[]}add(t,n,r){P7(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0}}function P7(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function z7(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function L7(){return{flow:{null:{name:"table",tokenize:I7,resolveAll:U7}}}}function I7(e,t,n){const r=this;let i=0,l=0,u;return d;function d(R){let J=r.events.length-1;for(;J>-1;){const se=r.events[J][1].type;if(se==="lineEnding"||se==="linePrefix")J--;else break}const K=J>-1?r.events[J][1].type:null,he=K==="tableHead"||K==="tableRow"?O:h;return he===O&&r.parser.lazy[r.now().line]?n(R):he(R)}function h(R){return e.enter("tableHead"),e.enter("tableRow"),m(R)}function m(R){return R===124||(u=!0,l+=1),p(R)}function p(R){return R===null?n(R):Ce(R)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),b):n(R):Ke(R)?Qe(e,p,"whitespace")(R):(l+=1,u&&(u=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),g(R)))}function g(R){return R===null||R===124||ft(R)?(e.exit("data"),p(R)):(e.consume(R),R===92?v:g)}function v(R){return R===92||R===124?(e.consume(R),g):g(R)}function b(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),u=!1,Ke(R)?Qe(e,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):j(R))}function j(R){return R===45||R===58?S(R):R===124?(u=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),_):L(R)}function _(R){return Ke(R)?Qe(e,S,"whitespace")(R):S(R)}function S(R){return R===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),N):R===45?(l+=1,N(R)):R===null||Ce(R)?D(R):L(R)}function N(R){return R===45?(e.enter("tableDelimiterFiller"),C(R)):L(R)}function C(R){return R===45?(e.consume(R),C):R===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(R))}function T(R){return Ke(R)?Qe(e,D,"whitespace")(R):D(R)}function D(R){return R===124?j(R):R===null||Ce(R)?!u||i!==l?L(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):L(R)}function L(R){return n(R)}function O(R){return e.enter("tableRow"),B(R)}function B(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),B):R===null||Ce(R)?(e.exit("tableRow"),t(R)):Ke(R)?Qe(e,B,"whitespace")(R):(e.enter("data"),M(R))}function M(R){return R===null||R===124||ft(R)?(e.exit("data"),B(R)):(e.consume(R),R===92?q:M)}function q(R){return R===92||R===124?(e.consume(R),M):M(R)}}function U7(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,h=0,m,p,g;const v=new M7;for(;++n<e.length;){const b=e[n],j=b[1];b[0]==="enter"?j.type==="tableHead"?(d=!1,h!==0&&(GS(v,t,h,m,p),p=void 0,h=0),m={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},v.add(n,0,[["enter",m,t]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(r=!0,g=void 0,l=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,p={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},v.add(n,0,[["enter",p,t]])),i=j.type==="tableDelimiterRow"?2:p?3:1):i&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],g=Bu(v,t,l,i,void 0,g),l=[0,0,0,0]),u[2]=n)):j.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(u[0]=u[1],g=Bu(v,t,l,i,void 0,g)),l=u,u=[l[1],n,0,0])):j.type==="tableHead"?(d=!0,h=n):j.type==="tableRow"||j.type==="tableDelimiterRow"?(h=n,l[1]!==0?(u[0]=u[1],g=Bu(v,t,l,i,n,g)):u[1]!==0&&(g=Bu(v,t,u,i,n,g)),i=0):i&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&GS(v,t,h,m,p),v.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=z7(t.events,n))}return e}function Bu(e,t,n,r,i,l){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},Gi(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const h=Gi(t.events,n[1]);if(l={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const m=Gi(t.events,n[2]),p=Gi(t.events,n[3]),g={type:d,start:Object.assign({},m),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const v=t.events[n[2]],b=t.events[n[3]];if(v[1].end=Object.assign({},b[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const j=n[2]+1,_=n[3]-n[2]-1;e.add(j,_,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return i!==void 0&&(l.end=Object.assign({},Gi(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function GS(e,t,n,r,i){const l=[],u=Gi(t.events,n);i&&(i.end=Object.assign({},u),l.push(["exit",i,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Gi(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const B7={name:"tasklistCheck",tokenize:F7};function V7(){return{text:{91:B7}}}function F7(e,t,n){const r=this;return i;function i(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),l)}function l(h){return ft(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(h)}function d(h){return Ce(h)?t(h):Ke(h)?e.check({tokenize:$7},t,n)(h):n(h)}}function $7(e,t,n){return Qe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function q7(e){return VN([p7(),_7(),O7(e),L7(),V7()])}const H7={};function D2(e){const t=this,n=e||H7,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(q7(n)),l.push(d7()),u.push(f7(n))}const G7={h1:({children:e})=>o.jsx("h1",{className:"text-2xl font-bold my-3 border-b pb-2",children:e}),h2:({children:e})=>o.jsx("h2",{className:"text-xl font-bold my-3 border-b pb-2",children:e}),h3:({children:e})=>o.jsx("h3",{className:"text-lg font-semibold my-2",children:e}),p:({children:e})=>o.jsx("p",{className:"mb-2 leading-relaxed",children:e}),ul:({children:e})=>o.jsx("ul",{className:"mb-3 pl-6 list-disc space-y-1",children:e}),ol:({children:e})=>o.jsx("ol",{className:"mb-3 pl-6 list-decimal space-y-1",children:e}),blockquote:({children:e})=>o.jsx("blockquote",{className:"border-l-4 border-muted pl-4 my-3 italic text-muted-foreground",children:e}),code:({node:e,className:t,children:n,...r})=>!!/language-(\w+)/.exec(t||"")||e?.position?.start.line!==e?.position?.end.line?o.jsx("code",{className:"block bg-slate-900 dark:bg-slate-800 text-slate-100 p-3 rounded-lg my-3 font-mono text-xs overflow-x-auto",...r,children:n}):o.jsx("code",{className:"bg-muted px-1 rounded text-red-500 font-mono text-sm",...r,children:n}),a:({href:e,children:t,...n})=>o.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",...n,children:t}),table:({children:e})=>o.jsx("div",{className:"overflow-x-auto my-3",children:o.jsx("table",{className:"min-w-full border border-border",children:e})}),th:({children:e})=>o.jsx("th",{className:"border border-border px-3 py-2 bg-muted",children:e}),td:({children:e})=>o.jsx("td",{className:"border border-border px-3 py-2",children:e})},K7=[{icon:kC,label:"Bold",before:"**",after:"**",placeholder:"bold text"},{icon:TA,label:"Italic",before:"*",after:"*",placeholder:"italic text"},{icon:gA,label:"Heading 1",before:"# ",after:"",placeholder:"Heading 1",newLine:!0},{icon:xA,label:"Heading 2",before:"## ",after:"",placeholder:"Heading 2",newLine:!0},{icon:bA,label:"Heading 3",before:"### ",after:"",placeholder:"Heading 3",newLine:!0},{type:"divider"},{icon:IA,label:"Bullet List",before:"- ",after:"",placeholder:"List item",newLine:!0},{icon:zA,label:"Numbered List",before:"1. ",after:"",placeholder:"List item",newLine:!0},{icon:lR,label:"Quote",before:"> ",after:"",placeholder:"Quote",newLine:!0},{type:"divider"},{icon:Os,label:"Highlight",before:"`",after:"`",placeholder:"code"},{icon:Rl,label:"Code Block",before:"```\n",after:"\n```",placeholder:"code block",newLine:!0},{icon:MA,label:"Link",before:"[",after:"](url)",placeholder:"link text"},{icon:SA,label:"Image",before:"![",after:"](url)",placeholder:"alt text"},{type:"divider"},{icon:QA,label:"Horizontal Rule",before:`
184
+ ---
185
+ `,after:"",placeholder:""},{icon:MR,label:"Table",before:`
186
+ | Header 1 | Header 2 |
187
+ | --- | --- |
188
+ | Cell 1 | Cell 2 |
189
+ `,after:"",placeholder:""}],KS=({value:e,className:t,style:n})=>o.jsx("div",{className:pe("px-4 py-3 overflow-y-auto markdown-preview scrollbar-thin","text-sm text-foreground bg-background",t),style:n,children:e?o.jsx(l2,{remarkPlugins:[D2],components:G7,children:e}):o.jsx("p",{className:"text-muted-foreground/50 italic",children:"Nothing to preview yet..."})}),YS=({value:e,onChange:t,placeholder:n,disabled:r,className:i,textareaRef:l,minHeight:u})=>o.jsx("textarea",{ref:l,value:e,onChange:d=>t?.(d.target.value),placeholder:n,disabled:r,className:pe("w-full h-full px-4 py-3 bg-background text-foreground","placeholder-muted-foreground/50 focus:outline-none","text-sm font-mono resize-none scrollbar-thin",i),style:{minHeight:u}}),WS=({onFormat:e,disabled:t})=>o.jsx("div",{className:"flex items-center gap-0.5 px-3 py-1.5 bg-muted/30 border-b border-border overflow-x-auto",children:K7.map((n,r)=>{if(n.type==="divider")return o.jsx("div",{className:"w-px h-5 bg-border mx-1"},`divider-${r}`);const i=n.icon;return o.jsx("button",{type:"button",onClick:()=>e(n),disabled:t,className:"p-1.5 rounded hover:bg-secondary text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",title:n.label,children:o.jsx(i,{className:"w-4 h-4"})},n.label)})}),XS=({mode:e,setMode:t,disabled:n,isFullscreen:r,onExpandClick:i,onCloseClick:l})=>o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary border-b border-border flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1 bg-background rounded-lg p-0.5 border border-border",children:[o.jsxs("button",{type:"button",onClick:()=>t("edit"),disabled:n,className:pe("px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider rounded-md transition-all flex items-center gap-1.5",e==="edit"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(sR,{className:"w-3 h-3"}),"Edit"]}),o.jsxs("button",{type:"button",onClick:()=>t("split"),className:pe("px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider rounded-md transition-all flex items-center gap-1.5",e==="split"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(JC,{className:"w-3 h-3"}),"Split"]}),o.jsxs("button",{type:"button",onClick:()=>t("preview"),className:pe("px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider rounded-md transition-all flex items-center gap-1.5",e==="preview"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(vd,{className:"w-3 h-3"}),"Preview"]})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&i&&o.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:i,className:"h-7 w-7 p-0",title:"Open in fullscreen",children:o.jsx(oj,{className:"w-4 h-4"})}),r&&l&&o.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:l,className:"h-7 w-7 p-0",title:"Close",children:o.jsx(fn,{className:"w-4 h-4"})})]})]}),JS=({mode:e,value:t,onChange:n,placeholder:r,disabled:i,textareaRef:l,minHeight:u})=>{const d=!u,h=d?"h-full":"",m=!d&&u?{height:u}:{};return o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col h-full",children:[e==="edit"&&o.jsx("div",{className:"flex-1 h-full",children:o.jsx(YS,{value:t,onChange:n,placeholder:r,disabled:i,textareaRef:l,minHeight:u})}),e==="preview"&&o.jsx(KS,{value:t,className:pe("scrollbar-thin",h),style:m}),e==="split"&&o.jsxs("div",{className:"flex h-full flex-1",style:{minHeight:u},children:[o.jsx("div",{className:"w-1/2 h-full border-r border-border overflow-hidden",children:o.jsx(YS,{value:t,onChange:n,placeholder:r,disabled:i,textareaRef:l,minHeight:u})}),o.jsx("div",{className:"w-1/2 h-full overflow-hidden",children:o.jsx(KS,{value:t,className:h,style:m})})]})]})};function Y7({value:e="",onChange:t,placeholder:n="Write your content in Markdown...",minHeight:r="200px",disabled:i=!1}){const[l,u]=w.useState("edit"),[d,h]=w.useState(!1),m=w.useRef(null),p=w.useRef(null),g=w.useCallback((b,j=!1)=>{const S=(j?p:m).current;if(!S)return;const N=S.selectionStart,C=S.selectionEnd,T=e.substring(N,C);let D,L;if(T)D=`${b.before}${T}${b.after}`,L=N+b.before.length+T.length+b.after.length;else{const M=b.placeholder||"";D=`${b.before}${M}${b.after}`,L=N+b.before.length}let O="";b.newLine&&N>0&&e[N-1]!==`
190
+ `&&(O=`
191
+ `);const B=e.substring(0,N)+O+D+e.substring(C);t?.(B),setTimeout(()=>{S.focus();const M=O.length;if(T)S.setSelectionRange(L+M,L+M);else{const q=N+M+b.before.length,R=q+(b.placeholder?.length||0);S.setSelectionRange(q,R)}},0)},[e,t]),v=l==="edit"||l==="split";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col overflow-hidden rounded-xl border border-border",style:{minHeight:r},children:[o.jsx(XS,{mode:l,setMode:u,disabled:i,isFullscreen:!1,onExpandClick:()=>h(!0)}),v&&o.jsx(WS,{onFormat:b=>g(b,!1),disabled:i}),o.jsx("div",{className:"flex-1",style:{minHeight:r},children:o.jsx(JS,{mode:l,value:e,onChange:t,placeholder:n,disabled:i,textareaRef:m,minHeight:r})})]}),o.jsx(os,{open:d,onOpenChange:h,children:o.jsxs(ls,{className:"max-w-[95vw] w-[95vw] h-[90vh] p-0 gap-0 flex flex-col overflow-hidden",children:[o.jsx(XS,{mode:l,setMode:u,disabled:i,isFullscreen:!0,onCloseClick:()=>h(!1)}),v&&o.jsx(WS,{onFormat:b=>g(b,!0),disabled:i}),o.jsx(JS,{mode:l,value:e,onChange:t,placeholder:n,disabled:i,textareaRef:p})]})})]})}const W7=e=>(e?.match(/<([^>]+)>/)||e?.match(/([^\s,<>]+@[^\s,<>]+)/))?.[1]||e||"";function X7({email:e,onClose:t,onSend:n,onDismiss:r}){const{t:i}=nt(),[l,u]=w.useState(!1),[d,h]=w.useState(""),[m,p]=w.useState(!1),[g,v]=w.useState(!1),b=e.draft_content||e.ai_analysis?.draft_response||e.ai_analysis?.draft_content||"",[j,_]=w.useState(b),[S,N]=w.useState(!1),[C,T]=w.useState(!1),D=w.useRef(null),L=e.subject?.toLowerCase().startsWith("re:")?e.subject:`Re: ${e.subject||""}`,[O,B]=w.useState(W7(e.sender||"")),[M,q]=w.useState(""),[R,J]=w.useState(""),[K,he]=w.useState(L),[se,ie]=w.useState(!1),[$,V]=w.useState(!1),[G,fe]=w.useState(!1),[P,I]=w.useState([]),[z,A]=w.useState(!1),ee=w.useRef(null),ge=e.body_snippet||"";w.useEffect(()=>{const Ee=Array.isArray(e.attachments)?e.attachments:[];I(Ee)},[e.attachments]),w.useEffect(()=>(S&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{ke()},2e3)),()=>{D.current&&clearTimeout(D.current)}),[S,j]);const ye=async()=>{if(!O.trim()){le.error("Please enter a recipient email address");return}u(!0);try{S&&await ke(),(await Re.sendDraft(e.id,{to:O.trim(),cc:M.trim()||void 0,bcc:R.trim()||void 0,subject:K.trim()})).data?.success?(le.success("Email sent successfully"),t(),await n(e.id)):le.error("Failed to send email")}catch(Ee){console.error("Failed to send:",Ee),le.error("Failed to send email")}finally{u(!1)}},ue=async()=>{u(!0);try{await r(e.id),t()}catch(Ee){console.error("Failed to dismiss:",Ee)}finally{u(!1)}},ke=async()=>{if(S){T(!0);try{(await Re.updateDraft(e.id,j)).data?.success?(N(!1),le.success("Draft saved")):le.error("Failed to save draft")}catch{le.error("Failed to save draft")}finally{T(!1)}}},Ne=async()=>{if(!d.trim()){le.error("Please provide instructions for regeneration");return}u(!0);try{const Ee=await Re.regenerateDraft(e.id,d);Ee.data?.draft_content?(_(Ee.data.draft_content),N(!1),le.success("Draft regenerated")):le.error("Failed to regenerate draft"),p(!1),h("")}catch{le.error("Failed to regenerate draft")}finally{u(!1)}},Ie=async Ee=>{const Ct=Ee.target.files;if(!Ct||Ct.length===0)return;const Yt=Ct[0],Cn=10*1024*1024;if(Yt.size>Cn){le.error("File size exceeds 10MB limit");return}A(!0);try{const An=await Re.uploadAttachment(e.id,Yt);An.data?.success&&An.data.attachment?(I(Ss=>[...Ss,An.data.attachment]),le.success(`Attached ${Yt.name}`)):le.error("Failed to upload attachment")}catch(An){console.error("Upload failed:",An),le.error("Failed to upload attachment")}finally{A(!1),ee.current&&(ee.current.value="")}},rt=async Ee=>{try{(await Re.deleteAttachment(e.id,Ee)).data?.success?(I(Yt=>Yt.filter(Cn=>Cn.id!==Ee)),le.success("Attachment removed")):le.error("Failed to remove attachment")}catch(Ct){console.error("Delete failed:",Ct),le.error("Failed to remove attachment")}},Pt=Ee=>Ee<1024?`${Ee} B`:Ee<1024*1024?`${(Ee/1024).toFixed(1)} KB`:`${(Ee/(1024*1024)).toFixed(1)} MB`;return o.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:[o.jsxs(Ge,{className:"w-full max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b",children:[o.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[o.jsx(is,{className:"w-5 h-5 text-primary"}),i("drafts.compose")||"Compose Draft"]}),o.jsx(Z,{onClick:t,variant:"ghost",size:"sm",children:o.jsx(fn,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold mb-3 text-muted-foreground uppercase tracking-wide",children:i("drafts.compose")||"Compose Email"}),o.jsxs(Ge,{className:"p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground w-12 flex-shrink-0",children:"To:"}),o.jsx("input",{type:"email",value:O,onChange:Ee=>B(Ee.target.value),className:"flex-1 px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"recipient@example.com"}),o.jsxs("div",{className:"flex items-center gap-2",children:[!$&&o.jsx("button",{type:"button",onClick:()=>V(!0),className:"text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1",children:"Cc"}),!G&&o.jsx("button",{type:"button",onClick:()=>fe(!0),className:"text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1",children:"Bcc"})]})]}),$&&o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground w-12 flex-shrink-0",children:"CC:"}),o.jsx("input",{type:"email",value:M,onChange:Ee=>q(Ee.target.value),className:"flex-1 px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"email1@example.com, email2@example.com",autoFocus:!0})]}),G&&o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground w-12 flex-shrink-0",children:"BCC:"}),o.jsx("input",{type:"email",value:R,onChange:Ee=>J(Ee.target.value),className:"flex-1 px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"email1@example.com, email2@example.com",autoFocus:!0})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground w-12 flex-shrink-0",children:"Subject:"}),o.jsx("input",{type:"text",value:K,onChange:Ee=>he(Ee.target.value),className:"flex-1 px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"Email subject"})]}),o.jsxs("div",{className:"pt-3 border-t",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Attachments"}),o.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>ee.current?.click(),disabled:z,children:z?o.jsxs(o.Fragment,{children:[o.jsx(jt,{className:"w-3 h-3 animate-spin"}),"Uploading..."]}):o.jsxs(o.Fragment,{children:[o.jsx(ap,{className:"w-3 h-3"}),"Attach File"]})}),o.jsx("input",{ref:ee,type:"file",className:"hidden",onChange:Ie,accept:"*/*"})]}),P.length>0?o.jsx("div",{className:"space-y-1.5",children:P.map(Ee=>o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/30 rounded-md text-xs group",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(ap,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"font-medium truncate",children:Ee.name}),o.jsxs("span",{className:"text-muted-foreground flex-shrink-0",children:["(",Pt(Ee.size),")"]})]}),o.jsx("button",{type:"button",onClick:()=>rt(Ee.id),className:"ml-2 p-1 rounded hover:bg-destructive/10 hover:text-destructive transition-colors opacity-0 group-hover:opacity-100",title:"Remove attachment",children:o.jsx(fn,{className:"w-3 h-3"})})]},Ee.id))}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No attachments. Files up to 10MB supported."})]}),o.jsxs("button",{type:"button",onClick:()=>ie(!se),className:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors mt-2",children:[se?o.jsx(Wl,{className:"w-3 h-3"}):o.jsx(so,{className:"w-3 h-3"}),"Show original message"]}),se&&o.jsxs("div",{className:"mt-3 pt-3 border-t space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[o.jsx(Sd,{className:"w-3 h-3 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"From:"})," ",e.sender]})]}),o.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[o.jsx(yd,{className:"w-3 h-3 mt-0.5 text-muted-foreground flex-shrink-0"}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Date:"})," ",e.date?new Date(e.date).toLocaleString():"-"]})]}),o.jsx("div",{className:"mt-2 pt-2 border-t",children:o.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ge})})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:i("drafts.aiReply")||"AI-Generated Reply"}),S&&o.jsx("span",{className:pe("text-xs",C?"text-muted-foreground":"text-amber-600 dark:text-amber-400"),children:C?"Saving…":"Unsaved changes"})]}),o.jsx(Y7,{value:j,onChange:Ee=>{_(Ee),N(!0)},placeholder:i("drafts.editPlaceholder")||"Write your reply in Markdown...",minHeight:"300px",disabled:l||C})]}),o.jsx("div",{className:"text-xs text-muted-foreground",children:e.draft_created_at&&o.jsxs("p",{children:["Created ",new Date(e.draft_created_at).toLocaleString()]})}),m&&o.jsxs(Ge,{className:"p-4 bg-muted/30",children:[o.jsx("h4",{className:"text-sm font-semibold mb-3",children:i("drafts.regenerate")||"Regenerate Draft"}),o.jsx("textarea",{value:d,onChange:Ee=>h(Ee.target.value),placeholder:"Provide new instructions (e.g., 'Make it more formal', 'Add a specific deadline')",className:"w-full px-3 py-2 rounded-md border bg-background text-sm min-h-[100px]"}),o.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[o.jsxs(Z,{onClick:Ne,disabled:l||!d.trim(),size:"sm",children:[l?o.jsx(jt,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Jt,{className:"w-4 h-4 mr-2"}),"Regenerate"]}),o.jsx(Z,{onClick:()=>p(!1),variant:"ghost",size:"sm",children:"Cancel"})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4 p-6 border-t bg-muted/30",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Z,{onClick:ye,disabled:l,className:"gap-2",children:[l?o.jsx(jt,{className:"w-4 h-4 animate-spin"}):o.jsx(Xl,{className:"w-4 h-4"}),i("drafts.send")||"Send Now"]}),!m&&o.jsxs(Z,{onClick:()=>p(!0),variant:"outline",className:"gap-2",children:[o.jsx(Jt,{className:"w-4 h-4"}),i("drafts.regenerate")||"Regenerate"]}),o.jsxs(Z,{onClick:()=>v(!0),variant:"ghost",className:"gap-2 text-muted-foreground hover:text-foreground",title:"Report issues with this draft",children:[o.jsx(bd,{className:"w-4 h-4"}),i("drafts.feedback")||"What's wrong?"]})]}),o.jsxs(Z,{onClick:ue,disabled:l,variant:"ghost",className:"gap-2",children:[o.jsx(fn,{className:"w-4 h-4"}),i("drafts.dismiss")||"Dismiss"]})]})]}),g&&o.jsx(NN,{email:e,isOpen:g,onClose:()=>v(!1),defaultType:"draft"})]})}function J7(){const{t:e}=nt(),{state:t,actions:n}=Tn(),{speak:r}=dy(),[i,l]=w.useState(t.settings?.tts_provider||"piper_local"),[u,d]=w.useState(t.settings?.tts_voice||null),[h,m]=w.useState(t.settings?.tts_speed||1),[p,g]=w.useState(t.settings?.tts_quality||10),[v,b]=w.useState(t.settings?.tts_auto_play??!0),[j,_]=w.useState([]),[S,N]=w.useState(!1),[C,T]=w.useState(!1),[D,L]=w.useState(!1);w.useEffect(()=>{t.settings&&(l(t.settings.tts_provider||"piper_local"),d(t.settings.tts_voice||null),m(t.settings.tts_speed||1),g(t.settings.tts_quality||10),b(t.settings.tts_auto_play??!0))},[t.settings]),w.useEffect(()=>{(async()=>{N(!0);try{const he=await fetch("/api/tts/providers");if(he.ok){const se=await he.json();if(se.success&&se.providers&&(_(se.providers),!i&&se.providers.length>0)){const ie=se.providers[0];l(ie.id),ie.config?.voices?.length>0&&d(ie.config.voices[0])}}else console.error("Failed to fetch TTS providers:",he.statusText),le.error(e("config.voice.toast.providersFailed"))}catch(he){console.error("Error fetching TTS providers:",he),le.error(e("config.voice.toast.serviceFailed"))}finally{N(!1)}})()},[]);const B=j.find(K=>K.id===i)?.config?.voices||[],M=K=>{l(K);const he=j.find(se=>se.id===K);he&&he.config?.voices&&he.config.voices.length>0?d(he.config.voices[0]):d(null)},q=async()=>{T(!0);try{const K=e("config.voice.testText");await r(K,void 0,{provider:i,voice:u||void 0,speed:h,quality:p})}catch(K){console.error("TTS test failed:",K),le.error(e("config.voice.toast.testFailed"))}finally{T(!1)}},R=async()=>{L(!0),await n.updateSettings({tts_provider:i,tts_voice:u,tts_speed:h,tts_quality:p,tts_auto_play:v})?le.success(e("config.voice.toast.saved")):le.error(e("config.voice.toast.saveFailed")),L(!1)},J=async()=>{const K=!v;b(K),await n.updateSettings({tts_auto_play:K})?K?le.success(e("config.voice.toast.autoOn")):le.info(e("config.voice.toast.autoOff")):(b(!K),le.error(e("config.voice.toast.updateFailed")))};return o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsxs($t,{className:"flex items-center gap-2",children:[o.jsx(Dl,{className:"w-5 h-5 text-purple-500"}),e("config.voice.title")]}),o.jsx(xs,{children:e("config.voice.desc")})]}),o.jsxs(wt,{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between pb-4 border-b",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:e("config.voice.autoTitle")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:e("config.voice.autoHelp")})]}),o.jsxs(Z,{variant:v?"default":"outline",size:"sm",onClick:J,className:"gap-2",children:[v?o.jsx(Dl,{className:"w-4 h-4"}):o.jsx(kg,{className:"w-4 h-4"}),e(v?"common.enabled":"common.disabled")]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:e("config.voice.provider")}),S?o.jsxs("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20",children:[o.jsx(yt,{size:"sm",className:"mr-2"}),o.jsx("span",{className:"text-xs text-muted-foreground italic",children:e("config.voice.loadingProviders")})]}):o.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:i,onChange:K=>M(K.target.value),disabled:S,children:[j.length===0&&o.jsx("option",{value:"piper_local",children:e("config.voice.piperLocal")}),j.map(K=>o.jsx("option",{value:K.id,children:K.name},K.id))]}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:e("config.voice.providerHelp")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:e("config.voice.voice")}),B.length>0?o.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:u||"",onChange:K=>d(K.target.value),disabled:S,children:[!u&&o.jsx("option",{value:"",children:e("config.voice.selectVoice")}),B.map(K=>o.jsx("option",{value:K,children:K},K))]}):o.jsx("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20 text-xs text-muted-foreground",children:e(S?"config.voice.loadingProviders":"config.voice.noVoices")}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:e("config.voice.voiceHelp")})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{className:"text-sm font-medium",children:e("config.voice.speed")}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[h.toFixed(1),"x"]})]}),o.jsx("input",{type:"range",min:"0.5",max:"2.0",step:"0.1",value:h,onChange:K=>m(parseFloat(K.target.value)),className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary"}),o.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[o.jsx("span",{children:e("config.voice.speedSlow")}),o.jsx("span",{children:e("config.voice.speedFast")})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{className:"text-sm font-medium",children:e("config.voice.quality")}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,"/20"]})]}),o.jsx("input",{type:"range",min:"1",max:"20",step:"1",value:p,onChange:K=>g(parseInt(K.target.value,10)),className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary"}),o.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[o.jsx("span",{children:e("config.voice.qualityLow")}),o.jsx("span",{children:e("config.voice.qualityHigh")})]})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[o.jsxs(Z,{variant:"outline",onClick:q,disabled:C,children:[C?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(IR,{className:"w-4 h-4 mr-2"}),e("config.voice.test")]}),o.jsxs(Z,{onClick:R,disabled:D,children:[D?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(Jt,{className:"w-4 h-4 mr-2"}),e("config.voice.save")]})]})]})]})}function Q7({open:e,onOpenChange:t}){const{t:n}=nt(),{actions:r}=Tn(),[i,l]=w.useState(!1),[u,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,b]=w.useState(993),[j,_]=w.useState(""),[S,N]=w.useState(465),[C,T]=w.useState(!0),[D,L]=w.useState(!0),O=M=>{const q=M.target.value;if(d(q),q.includes("@")){const R=q.split("@")[1].toLowerCase();R.includes("gmail.com")?(g("imap.gmail.com"),_("smtp.gmail.com"),b(993),T(!0),N(465),L(!0)):R.includes("outlook.com")||R.includes("hotmail.com")?(g("outlook.office365.com"),_("smtp.office365.com"),b(993),T(!0),N(587),L(!1)):R.includes("yahoo.com")?(g("imap.mail.yahoo.com"),_("smtp.mail.yahoo.com"),b(993),T(!0),N(465),L(!0)):R.includes("icloud.com")?(g("imap.mail.me.com"),_("smtp.mail.me.com"),b(993),T(!0),N(587),L(!1)):R.includes("fastmail.com")&&(g("imap.fastmail.com"),_("smtp.fastmail.com"),b(993),T(!0),N(465),L(!0))}},B=async()=>{if(!u||!h||!p||!j){le.error(n("config.imap.missingFields")||"Please fill in all required fields");return}l(!0);try{const M=await Re.connectImap({email:u,password:h,imapHost:p,imapPort:Number(v),smtpHost:j,smtpPort:Number(S),imapSecure:C,smtpSecure:D});if(M.data?.success)le.success(n("config.imap.connected")||"IMAP account connected successfully"),t(!1),r.fetchAccounts(),d(""),m(""),g(""),_(""),b(993),N(465),T(!0),L(!0);else{const q=typeof M.error=="string"?M.error:M.error?.message;le.error(q||n("config.imap.connectFailed")||"Failed to connect")}}catch(M){console.error("IMAP Connect Error:",M),le.error(n("config.imap.connectFailed")||"Failed to connect")}finally{l(!1)}};return o.jsx(os,{open:e,onOpenChange:t,children:o.jsxs(ls,{className:"sm:max-w-2xl",children:[o.jsxs(fr,{children:[o.jsxs(bs,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center text-slate-600 dark:text-slate-400 font-bold text-sm",children:o.jsx(is,{className:"w-4 h-4"})}),n("config.imap.connect")||"Connect via IMAP"]}),o.jsx(hr,{children:n("config.imap.desc")||"Connect any email provider using IMAP and SMTP."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg flex gap-3",children:[o.jsx(qn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsx("p",{className:"font-medium",children:n("config.imap.appPasswordTitle")||"Use an App Password"}),o.jsx("p",{children:n("config.imap.appPasswordDesc")||"Standard passwords often fail due to 2FA. generate an App Password in your email provider's security settings."})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.imap.emailLabel")||"Email Address"}),o.jsx(De,{placeholder:"you@example.com",value:u,onChange:O,type:"email"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.imap.passwordLabel")||"App Password"}),o.jsx(De,{placeholder:"xxxx-xxxx-xxxx-xxxx",value:h,onChange:M=>m(M.target.value),type:"password"})]}),o.jsxs("div",{className:"pt-2",children:[o.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[o.jsx(vR,{className:"w-4 h-4"}),n("config.imap.serverSettings")||"Server Settings"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 border rounded-lg bg-secondary/10",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"IMAP Host"}),o.jsx(De,{className:"h-8 text-xs font-mono",placeholder:"imap.example.com",value:p,onChange:M=>g(M.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),o.jsx(De,{className:"h-8 text-xs font-mono",placeholder:"993",type:"number",value:v,onChange:M=>{const q=parseInt(M.target.value)||993;b(q),T(q===993)}}),o.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:C,onChange:M=>T(M.target.checked),className:"accent-primary"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Implicit TLS"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"SMTP Host"}),o.jsx(De,{className:"h-8 text-xs font-mono",placeholder:"smtp.example.com",value:j,onChange:M=>_(M.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),o.jsx(De,{className:"h-8 text-xs font-mono",placeholder:"465",type:"number",value:S,onChange:M=>{const q=parseInt(M.target.value)||465;N(q),L(q===465)}}),o.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:D,onChange:M=>L(M.target.checked),className:"accent-primary"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Implicit TLS"})]})]})]})]})]})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>t(!1),children:n("common.cancel")}),o.jsxs(Z,{onClick:B,disabled:i||!u||!h||!p||!j,children:[i?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("config.imap.connectBtn")||"Connect Account"]})]})]})})}const Cs="realtimexai";function Z7(){const{state:e,actions:t}=Tn(),{t:n}=nt(),[r,i]=w.useState(!1),[l,u]=w.useState(!1),[d,h]=w.useState(null),[m,p]=w.useState(!1),[g,v]=w.useState(!1),[b,j]=w.useState({});fy({page_id:"configuration_wizard",system_instruction:n("config.agent.systemInstruction"),data:{accounts_count:e.accounts.length,connected_providers:e.accounts.map(te=>te.provider),rules_count:e.rules.length,active_rules:e.rules.filter(te=>te.is_enabled).map(te=>te.name),current_settings:{llm_provider:b.llm_provider,llm_model:b.llm_model}}});const[_,S]=w.useState(!1),[N,C]=w.useState("credentials"),[T,D]=w.useState(""),[L,O]=w.useState(""),[B,M]=w.useState(""),[q,R]=w.useState(""),[J,K]=w.useState(!1),[he,se]=w.useState(!1),[ie,$]=w.useState(!1),[V,G]=w.useState("credentials"),[fe,P]=w.useState(""),[I,z]=w.useState(""),[A,ee]=w.useState(!1),[ge,ye]=w.useState(!1),[ue,ke]=w.useState([]),[Ne,Ie]=w.useState(!1),[rt,Pt]=w.useState(null),[Ee,Ct]=w.useState([]),[Yt,Cn]=w.useState(!1),[An,Ss]=w.useState(null),[js,yr]=w.useState(!1);w.useEffect(()=>{(async()=>{Ie(!0),Pt(null);try{const Ue=await Re.getChatProviders();Ue.data?.success?ke(Ue.data.providers||[]):Pt(Ue.data?.message||n("config.toast.providersFailed"))}catch(Ue){console.error("Failed to fetch providers:",Ue),Pt(n("config.toast.providersFailedFallback"))}finally{Ie(!1)}})(),(async()=>{Cn(!0),Ss(null);try{const Ue=await Re.getEmbedProviders();Ue.data?.success?Ct(Ue.data.providers||[]):Ss(Ue.data?.message||n("config.toast.embedProvidersFailed"))}catch(Ue){console.error("Failed to fetch embedding providers:",Ue),Ss(n("config.toast.embedProvidersFailedFallback"))}finally{Cn(!1)}})()},[]);const Us=ue.find(te=>te.provider===(b.llm_provider||Cs))?.models||[],At=Ee.find(te=>te.provider===(b.embedding_provider||Cs))?.models||[],qa=w.useMemo(()=>!b.llm_model||Us.some(ve=>ve.id===b.llm_model)?Us:[{id:b.llm_model,name:`${b.llm_model} (saved)`},...Us],[Us,b.llm_model]),re=w.useMemo(()=>!b.llm_provider||b.llm_provider===Cs||ue.some(ve=>ve.provider===b.llm_provider)?ue:[{provider:b.llm_provider,name:`${b.llm_provider} (saved)`,models:[]},...ue],[ue,b.llm_provider]),me=w.useMemo(()=>!b.embedding_model||At.some(ve=>ve.id===b.embedding_model)?At:[{id:b.embedding_model,name:`${b.embedding_model} (saved)`},...At],[At,b.embedding_model]),Oe=w.useMemo(()=>!b.embedding_provider||b.embedding_provider===Cs||Ee.some(ve=>ve.provider===b.embedding_provider)?Ee:[{provider:b.embedding_provider,name:`${b.embedding_provider} (saved)`,models:[]},...Ee],[Ee,b.embedding_provider]),Fe=te=>{const ve=ue.find(Ue=>Ue.provider===te);j(Ue=>({...Ue,llm_provider:te,llm_model:ve?.models?.[0]?.id||""}))},Ze=te=>{const ve=Ee.find(Ue=>Ue.provider===te);j(Ue=>({...Ue,embedding_provider:te,embedding_model:ve?.models?.[0]?.id||""}))},mn=async()=>{v(!0);try{const te=await Re.testLlm({llm_provider:b.llm_provider||void 0,llm_model:b.llm_model||void 0});te.data?.success?le.success(te.data.message):le.error(te.data?.message||n("config.toast.connectionFailed"))}catch(te){le.error(te.response?.data?.message||n("config.toast.connectionFailed"))}finally{v(!1)}};w.useEffect(()=>{t.fetchAccounts(),t.fetchRules(),t.fetchSettings()},[]),w.useEffect(()=>{e.settings&&j(e.settings)},[e.settings]);const cs=w.useRef(null),Qt=()=>{C("credentials"),D(""),O(""),M(""),R(""),S(!0)},Rt=te=>{D(te);try{const ve=JSON.parse(te),Ue=ve.installed||ve.web||ve;Ue.client_id&&O(Ue.client_id),Ue.client_secret&&M(Ue.client_secret),ve.installed?le.success(n("config.toast.detectedDesktopCreds")):ve.web&&le.info(n("config.toast.detectedWebCreds"))}catch{}},ln=async()=>{if(!L||!B){le.error(n("config.toast.missingGmailCreds"));return}K(!0);try{if(await t.updateSettings({...b,google_client_id:L,google_client_secret:B})){j(Ue=>({...Ue,google_client_id:L,google_client_secret:B}));const ve=await Re.getGmailAuthUrl();if(ve.data?.url)window.open(ve.data.url,"_blank"),C("code"),le.success(n("config.toast.authorizeAndPaste"));else{const Ue=typeof ve.error=="string"?ve.error:ve.error?.message;le.error(Ue||n("config.toast.oauthUrlFailed"))}}else le.error(n("config.toast.saveCredsFailed"))}catch{le.error(n("config.toast.saveCredsFailed"))}finally{K(!1)}},at=async()=>{if(!q.trim()){le.error(n("config.toast.missingAuthCode"));return}se(!0);try{const te=await Re.connectGmail(q.trim());if(te.data?.success)le.success(n("config.toast.gmailConnected")),S(!1),t.fetchAccounts();else{const ve=typeof te.error=="string"?te.error:te.error?.message;le.error(ve||n("config.toast.gmailConnectFailed"))}}catch{le.error(n("config.toast.gmailConnectFailed"))}finally{se(!1)}},ks=()=>{G("credentials"),P(""),z(""),$(!0)},Rn=async()=>{if(!fe){le.error(n("config.toast.missingOutlookClientId"));return}ee(!0);try{if(await t.updateSettings({...b,microsoft_client_id:fe,microsoft_tenant_id:I||"common"})){j(Ue=>({...Ue,microsoft_client_id:fe,microsoft_tenant_id:I||"common"}));const ve=await Re.startMicrosoftDeviceFlow();if(ve.data)h(ve.data),G("device-code"),Ud(ve.data.deviceCode,ve.data.interval);else{const Ue=typeof ve.error=="string"?ve.error:ve.error?.message;le.error(Ue||n("config.toast.deviceFlowFailed"))}}else le.error(n("config.toast.saveCredsFailed"))}catch{le.error(n("config.toast.saveCredsFailed"))}finally{ee(!1)}},Ud=async(te,ve)=>{const Ue=setInterval(async()=>{try{const aa=await Re.pollMicrosoftDeviceCode(te);aa.data?.status==="completed"?(clearInterval(Ue),h(null),u(!1),$(!1),le.success(n("config.toast.outlookConnected")),t.fetchAccounts()):aa.error&&typeof aa.error=="object"&&aa.error.code}catch{}},ve*1e3);setTimeout(()=>{clearInterval(Ue),l&&(h(null),u(!1),$(!1),le.error(n("config.toast.connectionTimedOut")))},900*1e3)},Ha=async te=>{if(!confirm(n("config.toast.disconnectConfirm")))return;await t.disconnectAccount(te)&&le.success(n("config.toast.accountDisconnected"))},xr=async()=>{p(!0);const te=await t.updateSettings(b);p(!1),te&&le.success(n("config.toast.settingsSaved"))},Ga=te=>te==="gmail"?o.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold",children:"G"}):te==="imap"?o.jsx("div",{className:"w-10 h-10 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center text-slate-600 dark:text-slate-400",children:o.jsx(is,{className:"w-5 h-5"})}):o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold",children:"O"});return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsx(os,{open:_,onOpenChange:S,children:o.jsxs(ls,{className:"sm:max-w-lg",children:[o.jsxs(fr,{children:[o.jsxs(bs,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold text-sm",children:"G"}),n("config.gmail.connect")]}),o.jsx(hr,{children:n(N==="credentials"?"config.gmail.credentialsDesc":"config.gmail.authCodeDesc")})]}),N==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(KR,{className:"w-4 h-4"}),n("config.gmail.pasteJson")]}),o.jsx("textarea",{className:"w-full h-24 p-3 text-xs font-mono border rounded-lg bg-secondary/30 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:'{"installed":{"client_id":"...","client_secret":"..."}}',value:T,onChange:te=>Rt(te.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("config.gmail.downloadHelp")})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:o.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:n("config.gmail.orEnterManually")})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientId")}),o.jsx(De,{placeholder:n("config.gmail.clientIdPlaceholder"),value:L,onChange:te=>O(te.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientSecret")}),o.jsx(De,{type:"password",placeholder:n("config.gmail.clientSecretPlaceholder"),value:B,onChange:te=>M(te.target.value)})]})]})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>S(!1),children:n("common.cancel")}),o.jsxs(Z,{onClick:ln,disabled:J||!L||!B,children:[J?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("common.save")," & ",n("setup.engage")]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:n("config.gmail.authSteps")})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.gmail.authCode")}),o.jsx(De,{placeholder:n("config.gmail.authCodePlaceholder"),value:q,onChange:te=>R(te.target.value),className:"font-mono"})]})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>C("credentials"),children:n("setup.back")}),o.jsxs(Z,{onClick:at,disabled:he||!q.trim(),children:[he?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("setup.engage")]})]})]})]})}),o.jsx(os,{open:ie,onOpenChange:$,children:o.jsxs(ls,{className:"sm:max-w-lg",children:[o.jsxs(fr,{children:[o.jsxs(bs,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-sm",children:"O"}),n("config.outlook.connect")]}),o.jsx(hr,{children:n(V==="credentials"?"config.outlook.credentialsDesc":"config.outlook.instructions")})]}),V==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:n("config.outlook.note")})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.outlook.clientId")}),o.jsx(De,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:fe,onChange:te=>P(te.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.outlook.tenantIdOptional")}),o.jsx(De,{placeholder:n("config.outlook.tenantPlaceholder"),value:I,onChange:te=>z(te.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("config.outlook.tenantHelp")})]})]})]}),o.jsxs(lr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>$(!1),children:n("common.cancel")}),o.jsxs(Z,{onClick:Rn,disabled:A||!fe,children:[A?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("config.outlook.saveConnect")]})]})]}):o.jsxs(o.Fragment,{children:[d&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:n("config.outlook.actionRequired")}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:d.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:d.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(d.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx(Cl,{className:"w-4 h-4 ml-2"})]})]})]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(yt,{size:"sm"}),n("config.outlook.waitingAuth")]})})]}),o.jsx(lr,{children:o.jsx(Z,{variant:"outline",onClick:()=>$(!1),children:n("common.cancel")})})]})]})}),o.jsx(Q7,{open:ge,onOpenChange:ye}),o.jsx("div",{ref:cs,children:o.jsxs(Ge,{children:[o.jsxs(Mt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>yr(!js),children:[o.jsxs($t,{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Sg,{className:"w-5 h-5 text-orange-500"}),n("config.byok.title")]}),js?o.jsx(Wl,{className:"w-5 h-5 text-muted-foreground"}):o.jsx(so,{className:"w-5 h-5 text-muted-foreground"})]}),o.jsx(xs,{children:n("config.byok.desc")})]}),js&&o.jsxs(wt,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-4 border-b pb-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," ",n("config.byok.googleTitle")]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientId")}),o.jsx(De,{type:"password",placeholder:n("config.gmail.clientIdPlaceholder"),value:b.google_client_id||"",onChange:te=>j(ve=>({...ve,google_client_id:te.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientSecret")}),o.jsx(De,{type:"password",placeholder:n("config.gmail.clientSecretPlaceholder"),value:b.google_client_secret||"",onChange:te=>j(ve=>({...ve,google_client_secret:te.target.value}))})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," ",n("config.byok.microsoftTitle")]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientId")}),o.jsx(De,{type:"password",value:b.microsoft_client_id||"",onChange:te=>j(ve=>({...ve,microsoft_client_id:te.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.clientSecretOptional")}),o.jsx(De,{type:"password",value:b.microsoft_client_secret||"",onChange:te=>j(ve=>({...ve,microsoft_client_secret:te.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.byok.tenantId")}),o.jsx(De,{placeholder:n("config.outlook.tenantPlaceholder"),value:b.microsoft_tenant_id||"",onChange:te=>j(ve=>({...ve,microsoft_tenant_id:te.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:xr,disabled:m,variant:"secondary",children:[m?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("config.byok.save")]})})]})]})}),o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsxs($t,{className:"flex items-center gap-2",children:[o.jsx(Wr,{className:"w-5 h-5 text-primary"}),n("config.accounts.title")]}),o.jsx(xs,{children:n("config.accounts.desc")})]}),o.jsx(wt,{children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold mb-3",children:n("config.accounts.addNew")}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Z,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:Qt,disabled:r||l,children:o.jsxs("div",{className:"flex items-center gap-3 w-full",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold shrink-0",children:"G"}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"font-medium",children:n("config.providers.gmail")}),o.jsx("div",{className:"text-xs text-muted-foreground",children:n("config.gmail.connectDesc")})]}),r?o.jsx(yt,{size:"sm"}):o.jsx(cr,{className:"w-5 h-5 shrink-0"})]})}),o.jsx(Z,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:ks,disabled:r||l,children:o.jsxs("div",{className:"flex items-center gap-3 w-full",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold shrink-0",children:"O"}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"font-medium",children:n("config.providers.outlook")}),o.jsx("div",{className:"text-xs text-muted-foreground",children:n("config.outlook.connectDesc")})]}),l&&!d?o.jsx(yt,{size:"sm"}):o.jsx(cr,{className:"w-5 h-5 shrink-0"})]})}),o.jsx(Z,{className:"w-full border-dashed justify-start h-auto py-4",variant:"outline",onClick:()=>ye(!0),disabled:r||l,children:o.jsxs("div",{className:"flex items-center gap-3 w-full",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center text-slate-600 dark:text-slate-400 font-bold shrink-0",children:o.jsx(is,{className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"font-medium",children:n("config.providers.imap")||"IMAP / SMTP"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:n("config.imap.connectDesc")||"Connect any provider via App Password"})]}),o.jsx(cr,{className:"w-5 h-5 shrink-0"})]})})]})]}),d&&o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg animate-in slide-in-from-top-2",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:n("config.outlook.signinRequired")}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:d.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:d.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(d.verificationUri,"_blank"),children:[n("config.outlook.openLogin"),o.jsx(Cl,{className:"w-4 h-4 ml-2"})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:n("config.outlook.waitingSignin")})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-semibold mb-3",children:n("config.accounts.yourAccounts")}),e.accounts.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 border-2 border-dashed rounded-lg",children:[o.jsx(Wr,{className:"w-12 h-12 text-muted-foreground/40 mb-3"}),o.jsx("p",{className:"text-sm text-muted-foreground text-center",children:n("config.accounts.noAccounts")}),o.jsx("p",{className:"text-xs text-muted-foreground text-center mt-1",children:n("config.accounts.connectHelp")})]}):o.jsx("div",{className:"space-y-3",children:e.accounts.map(te=>o.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card hover:bg-secondary/30 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[Ga(te.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:te.provider==="imap"?"IMAP":te.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:te.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[te.is_active?o.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:n("common.active")}):o.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:n("common.inactive")}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>Ha(te.id),title:n("config.accounts.disconnect"),children:o.jsx(wd,{className:"w-4 h-4"})})]})]},te.id))})]})]})})]}),o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsxs($t,{className:"flex items-center gap-2",children:[o.jsx(Wr,{className:"w-5 h-5 text-primary"}),"System Configuration"]}),o.jsx(xs,{children:"Configure storage, file naming, and synchronization settings"})]}),o.jsxs(wt,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3 pb-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Wr,{className:"w-4 h-4 text-primary"}),o.jsx("h4",{className:"font-medium",children:n("config.storage.title")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.storage.label")}),o.jsx(De,{placeholder:n("config.storage.placeholder"),value:b.storage_path||"",onChange:te=>j(ve=>({...ve,storage_path:te.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:n("config.storage.help")})]})]}),o.jsxs("div",{className:"space-y-3 pb-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ip,{className:"w-4 h-4 text-indigo-500"}),o.jsx("h4",{className:"font-medium",children:n("config.rename.title")})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:n("config.rename.label")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n("config.rename.help")})]}),o.jsxs(Z,{variant:b.intelligent_rename?"default":"outline",size:"sm",onClick:()=>j(te=>({...te,intelligent_rename:!te.intelligent_rename})),children:[o.jsx(ip,{className:"w-4 h-4 mr-1"}),b.intelligent_rename?n("common.enabled"):n("common.disabled")]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ls,{className:"w-4 h-4 text-primary"}),o.jsx("h4",{className:"font-medium",children:n("config.sync.title")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.sync.label")}),o.jsx(De,{type:"number",min:1,max:1440,value:b.sync_interval_minutes||5,onChange:te=>j(ve=>({...ve,sync_interval_minutes:parseInt(te.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:n("config.sync.help")})]})]}),o.jsx("div",{className:"flex justify-end pt-4",children:o.jsxs(Z,{onClick:xr,disabled:m,children:[m?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})})]})]}),o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsxs($t,{className:"flex items-center gap-2",children:[o.jsx(Jt,{className:"w-5 h-5 text-indigo-500"}),n("config.model.title")]}),o.jsx(xs,{children:n("config.model.desc")})]}),o.jsxs(wt,{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"text-sm font-semibold",children:n("config.llm.title")}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.model.provider")}),Ne?o.jsxs("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20",children:[o.jsx(yt,{size:"sm",className:"mr-2"}),o.jsx("span",{className:"text-xs text-muted-foreground italic",children:n("config.model.discovering")})]}):o.jsxs(o.Fragment,{children:[o.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:b.llm_provider||Cs,onChange:te=>Fe(te.target.value),disabled:Ne,children:[o.jsx("option",{value:Cs,children:n("config.model.defaultProvider")}),re.filter(te=>te.provider!==Cs).map(te=>o.jsx("option",{value:te.provider,children:te.name||te.provider},te.provider))]}),rt&&o.jsxs("div",{className:"text-[10px] text-amber-500 mt-1 px-1 bg-amber-50/50 rounded",children:["⚠️ ",rt]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.model.name")}),qa.length>0||Ne?o.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:b.llm_model||"",onChange:te=>j(ve=>({...ve,llm_model:te.target.value})),disabled:Ne,children:[!b.llm_model&&o.jsx("option",{value:"",children:n("config.model.selectModel")}),qa.map(te=>o.jsx("option",{value:te.id,children:te.name||te.id},te.id))]}):o.jsx(De,{placeholder:n("config.model.modelPlaceholder"),value:b.llm_model||"",onChange:te=>j(ve=>({...ve,llm_model:te.target.value}))})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"text-sm font-semibold",children:n("config.embed.title")}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.embed.provider")}),Yt?o.jsxs("div",{className:"h-10 border rounded-md flex items-center px-3 bg-muted/20",children:[o.jsx(yt,{size:"sm",className:"mr-2"}),o.jsx("span",{className:"text-xs text-muted-foreground italic",children:n("config.embed.discovering")})]}):o.jsxs(o.Fragment,{children:[o.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:b.embedding_provider||Cs,onChange:te=>Ze(te.target.value),disabled:Yt,children:[o.jsx("option",{value:Cs,children:n("config.embed.defaultProvider")}),Oe.filter(te=>te.provider!==Cs).map(te=>o.jsx("option",{value:te.provider,children:te.name||te.provider},te.provider))]}),An&&o.jsxs("div",{className:"text-[10px] text-amber-500 mt-1 px-1 bg-amber-50/50 rounded",children:["⚠️ ",An]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:n("config.embed.model")}),me.length>0||Yt?o.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:b.embedding_model||"",onChange:te=>j(ve=>({...ve,embedding_model:te.target.value})),disabled:Yt,children:[!b.embedding_model&&o.jsx("option",{value:"",children:n("config.embed.autoModel")}),me.map(te=>o.jsx("option",{value:te.id,children:te.name||te.id},te.id))]}):o.jsx(De,{placeholder:n("config.embed.modelPlaceholder"),value:b.embedding_model||"",onChange:te=>j(ve=>({...ve,embedding_model:te.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:n("config.embed.help")})]})]})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(Z,{variant:"outline",onClick:mn,disabled:g,children:[g?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(Jt,{className:"w-4 h-4 mr-2"}),n("config.model.checkConnection")]}),o.jsxs(Z,{onClick:xr,disabled:m,children:[m?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(ir,{className:"w-4 h-4 mr-2"}),n("config.model.saveConfig")]})]})]})]}),o.jsx(J7,{})]})}const e$=_g("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function El({className:e,variant:t,...n}){return o.jsx("div",{className:pe(e$({variant:t}),e),...n})}const Ly=w.forwardRef(({className:e,value:t,...n},r)=>o.jsx("div",{ref:r,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t,className:pe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:o.jsx("div",{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ly.displayName="Progress";const t$=[{id:"corporate",label:"Corporate",desc:"Formal, structured, detailed",icon:AC},{id:"startup",label:"Startup",desc:"Fast-paced, direct, concise",icon:bg},{id:"creative",label:"Creative",desc:"Flexible, casual, collaborative",icon:rj},{id:"academic",label:"Academic",desc:"Thorough, precise, formal",icon:fA}];function n$({data:e,updateData:t}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2 text-center md:text-left",children:[o.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"👤 Tell us about yourself"}),o.jsx("p",{className:"text-muted-foreground",children:"This helps the AI understand your professional context and communication expectations."})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"full_name",children:"Your Name"}),o.jsx(De,{id:"full_name",placeholder:"Trung Le",value:e.full_name||"",onChange:n=>t({full_name:n.target.value}),autoFocus:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"role",children:"Your Role"}),o.jsx(De,{id:"role",placeholder:"CEO / Founder",value:e.role||"",onChange:n=>t({role:n.target.value})})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"company",children:"Company"}),o.jsx(De,{id:"company",placeholder:"RealTimeX",value:e.company||"",onChange:n=>t({company:n.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"industry",children:"Industry"}),o.jsxs("select",{id:"industry",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",value:e.industry||"",onChange:n=>t({industry:n.target.value}),children:[o.jsx("option",{value:"",disabled:!0,children:"Select an industry..."}),o.jsx("option",{value:"Software & Technology",children:"Software & Technology"}),o.jsx("option",{value:"Finance & Banking",children:"Finance & Banking"}),o.jsx("option",{value:"Healthcare",children:"Healthcare"}),o.jsx("option",{value:"Education",children:"Education"}),o.jsx("option",{value:"Real Estate",children:"Real Estate"}),o.jsx("option",{value:"Consulting",children:"Consulting"}),o.jsx("option",{value:"Legal",children:"Legal"}),o.jsx("option",{value:"Other",children:"Other"})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Work Style"}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:t$.map(n=>o.jsx(Ge,{className:pe("cursor-pointer transition-all hover:bg-accent/50",e.work_style===n.id?"border-primary bg-accent":""),onClick:()=>t({work_style:n.id}),children:o.jsxs(wt,{className:"flex items-center p-4 space-x-4",children:[o.jsx(n.icon,{className:pe("h-5 w-5",e.work_style===n.id?"text-primary":"text-muted-foreground")}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:n.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n.desc})]})]})},n.id))})]}),o.jsxs("div",{className:"bg-blue-500/10 text-blue-500 text-sm p-4 rounded-lg flex items-start gap-2",children:[o.jsx(bg,{className:"h-4 w-4 mt-0.5 shrink-0"}),o.jsx("p",{children:'We use this to determine how detailed or urgent your drafts should be. For example, specific "Startup" contexts will result in briefer, action-oriented emails.'})]})]})}const s$=[{id:"formal",label:"Formal",example:"Dear Sir/Madam, regarding..."},{id:"professional",label:"Professional",example:"Hello, thank you for the update..."},{id:"casual",label:"Casual",example:"Hey! Thanks for reaching out..."},{id:"friendly",label:"Friendly",example:"Hi there! Great to hear from you..."}];function r$({data:e,updateData:t}){const[n,r]=w.useState(""),i=()=>{if(n.trim()){const d=e.common_phrases||[];d.includes(n.trim())||t({common_phrases:[...d,n.trim()]}),r("")}},l=d=>{const h=e.common_phrases||[];t({common_phrases:h.filter(m=>m!==d)})},u=()=>{const d=e.preferred_tone||"professional",h=e.preferred_length||"medium",m=e.signature||(e.full_name?`Best,
192
+ ${e.full_name}`:`Best,
193
+ [Name]`);let p="";switch(d){case"formal":p=`Dear [Recipient],
194
+
195
+ I trust this email finds you well.
196
+
197
+ Regarding the proposal you sent earlier, I have reviewed the attached documents.`;break;case"professional":p=`Hi [Recipient],
198
+
199
+ Thank you for sending over the proposal.
200
+
201
+ I've had a chance to review the documents.`;break;case"casual":p=`Hey [Recipient],
202
+
203
+ Thanks for the proposal!
204
+
205
+ Just took a look at the docs.`;break;case"friendly":p=`Hi [Recipient]! 👋
206
+
207
+ Thanks so much for sharing the proposal. Loved reading through it!`;break}return h==="brief"?p+=`
208
+
209
+ Looks good to go.`:h==="medium"?p+=`
210
+
211
+ Overall it looks solid, though I have a few minor questions about the timeline. Let's discuss briefly when you have a moment.`:p+=`
212
+
213
+ I've analyzed the key points and everything aligns with our objectives. Specifically, the timeline looks realistic and the budget is within scope. I do have a couple of questions regarding the implementation phase, but we can cover those in our next sync.`,p+=`
214
+
215
+ ${m}`,p};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2 text-center md:text-left",children:[o.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"✍️ How do you communicate?"}),o.jsx("p",{className:"text-muted-foreground",children:"We'll adjust all drafts to match your natural style."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Default Tone"}),o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s$.map(d=>o.jsx(Ge,{className:pe("cursor-pointer transition-all hover:bg-accent/50",e.preferred_tone===d.id?"border-primary bg-accent":""),onClick:()=>t({preferred_tone:d.id}),children:o.jsxs(wt,{className:"p-3",children:[o.jsx("p",{className:"font-medium text-sm",children:d.label}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:d.example})]})},d.id))})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx(Ye,{children:"Response Length"}),o.jsx("span",{className:"text-sm text-muted-foreground capitalize",children:e.preferred_length||"medium"})]}),o.jsx("input",{type:"range",min:"1",max:"3",step:"1",className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary",value:e.preferred_length==="brief"?1:e.preferred_length==="detailed"?3:2,onChange:d=>{const h=parseInt(d.target.value);t({preferred_length:h===1?"brief":h===3?"detailed":"medium"})}}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"Brief"}),o.jsx("span",{children:"Medium"}),o.jsx("span",{children:"Detailed"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"signature",children:"Signature"}),o.jsx("textarea",{id:"signature",className:"flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",rows:2,placeholder:`Best,
216
+ Trung Le`,value:e.signature||"",onChange:d=>t({signature:d.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Common Phrases"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(De,{placeholder:"e.g., Thanks for reaching out",value:n,onChange:d=>r(d.target.value),onKeyDown:d=>d.key==="Enter"&&i()}),o.jsx(Z,{size:"icon",variant:"secondary",onClick:i,children:o.jsx(cr,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.common_phrases?.map((d,h)=>o.jsxs("div",{className:"bg-secondary text-secondary-foreground px-2 py-1 rounded-md text-xs flex items-center gap-1",children:[d,o.jsx(fn,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>l(d)})]},h))})]}),o.jsxs("div",{className:"mt-6 pt-4 border-t",children:[o.jsx(Ye,{className:"text-muted-foreground mb-2 block",children:"Preview: How your drafts will look"}),o.jsx("div",{className:"bg-muted/30 border rounded-lg p-4 font-mono text-sm whitespace-pre-wrap",children:u()})]})]})}function a$({data:e,updateData:t}){const[n,r]=w.useState(""),[i,l]=w.useState(""),u=()=>{if(n.trim()){const g=e.vip_senders||[];g.includes(n.trim())||t({vip_senders:[...g,n.trim()]}),r("")}},d=g=>{const v=e.vip_senders||[];t({vip_senders:v.filter(b=>b!==g)})},h=()=>{if(i.trim()){let g=i.trim();g.startsWith("@")&&(g=g.substring(1));const v=e.trusted_domains||[];v.includes(g)||t({trusted_domains:[...v,g]}),l("")}},m=g=>{const v=e.trusted_domains||[];t({trusted_domains:v.filter(b=>b!==g)})},p=[{id:"newsletters",label:"Newsletters"},{id:"social_media",label:"Social media"},{id:"marketing",label:"Marketing emails"}];return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2 text-center md:text-left",children:[o.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"⭐ Who's important to you?"}),o.jsx("p",{className:"text-muted-foreground",children:"We'll prioritize emails from these people and domains."})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(op,{className:"h-4 w-4 text-yellow-500"}),o.jsx(Ye,{children:"VIPs (Always High Priority)"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(De,{placeholder:"investor@vc.com",value:n,onChange:g=>r(g.target.value),onKeyDown:g=>g.key==="Enter"&&u()}),o.jsx(Z,{size:"icon",variant:"secondary",onClick:u,children:o.jsx(cr,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"space-y-2 max-h-[150px] overflow-y-auto",children:[e.vip_senders?.map((g,v)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary/50 p-2 rounded-md text-sm",children:[o.jsx("span",{children:g}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>d(g),children:o.jsx(fn,{className:"h-3 w-3"})})]},v)),(!e.vip_senders||e.vip_senders.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No VIPs added yet"})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(nD,{className:"h-4 w-4 text-blue-500"}),o.jsx(Ye,{children:"Team & Trusted Domains"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(De,{placeholder:"company.com",value:i,onChange:g=>l(g.target.value),onKeyDown:g=>g.key==="Enter"&&h()}),o.jsx(Z,{size:"icon",variant:"secondary",onClick:h,children:o.jsx(cr,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"space-y-2 max-h-[150px] overflow-y-auto",children:[e.trusted_domains?.map((g,v)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary/50 p-2 rounded-md text-sm",children:[o.jsxs("span",{children:["@",g]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>m(g),children:o.jsx(fn,{className:"h-3 w-3"})})]},v)),(!e.trusted_domains||e.trusted_domains.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No domains added yet"})]})]})]}),o.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(sj,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(Ye,{children:"Low Priority (Auto-Archive)"})]}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:p.map(g=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("input",{type:"checkbox",id:g.id,className:"accent-primary h-4 w-4",defaultChecked:!0}),o.jsx("label",{htmlFor:g.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:g.label})]},g.id))})]}),o.jsxs("div",{className:"bg-blue-500/10 text-blue-500 text-sm p-4 rounded-lg flex items-start gap-2",children:[o.jsx(bg,{className:"h-4 w-4 mt-0.5 shrink-0"}),o.jsx("p",{children:'Tip: Adding your own company domain (@realtimex.ai) to "Team" ensures internal emails are never missed.'})]})]})}const i$=[{id:"inbox_zero",label:"Inbox Zero Daily",icon:kA},{id:"respond_faster",label:"Respond Faster",icon:VR},{id:"focus",label:"Focus on Important",icon:uj},{id:"reduce_time",label:"Reduce Email Time",icon:Ls}],o$=[{id:"legal",label:"Legal documents"},{id:"hr",label:"HR & payroll"},{id:"financial",label:"Financial transactions"},{id:"security",label:"Security alerts"}];function l$({data:e,updateData:t}){const n=r=>{const i=e.never_automate_categories||[];i.includes(r)?t({never_automate_categories:i.filter(l=>l!==r)}):t({never_automate_categories:[...i,r]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2 text-center md:text-left",children:[o.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"🎯 What are your email goals?"}),o.jsx("p",{className:"text-muted-foreground",children:"Let's set up automation that works for your specific targets."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Primary Goal"}),o.jsx("div",{className:"grid grid-cols-2 gap-3",children:i$.map(r=>o.jsx(Ge,{className:pe("cursor-pointer transition-all hover:bg-accent/50",e.primary_goal===r.id?"border-primary bg-accent":""),onClick:()=>t({primary_goal:r.id}),children:o.jsxs(wt,{className:"flex flex-col items-center justify-center p-4 text-center space-y-2",children:[o.jsx(r.icon,{className:pe("h-6 w-6",e.primary_goal===r.id?"text-primary":"text-muted-foreground")}),o.jsx("span",{className:"font-medium text-sm",children:r.label})]})},r.id))})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx(Ye,{children:"Time Budget"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.time_budget_minutes||30," minutes / day"]})]}),o.jsx("input",{type:"range",min:"15",max:"120",step:"15",className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary",value:e.time_budget_minutes||30,onChange:r=>t({time_budget_minutes:parseInt(r.target.value)})}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"15 min"}),o.jsx("span",{children:"1 hour"}),o.jsx("span",{children:"2 hours"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx(Ye,{children:"Automation Level"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:!e.automation_level||e.automation_level<=3?"Conservative":e.automation_level<=7?"Balanced":"Aggressive"})]}),o.jsxs("div",{className:"relative pt-6",children:[o.jsxs("div",{className:"absolute top-0 w-full flex justify-between text-xs font-medium text-muted-foreground px-1",children:[o.jsx("span",{children:"Manual"}),o.jsx("span",{children:"Fully Automated"})]}),o.jsx("input",{type:"range",min:"1",max:"10",step:"1",className:"w-full h-2 bg-gradient-to-r from-blue-500/20 to-blue-500 rounded-lg appearance-none cursor-pointer accent-primary",value:e.automation_level||5,onChange:r=>t({automation_level:parseInt(r.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:e.automation_level&&e.automation_level>7?"AI drafts and organizes aggressively. You review key items.":"AI suggests drafts. You maintain full control."})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(kR,{className:"h-4 w-4 text-destructive"}),o.jsx(Ye,{children:"Never Automate (Safety)"})]}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:o$.map(r=>o.jsxs("div",{className:"flex items-center space-x-2 border p-3 rounded-md bg-background",children:[o.jsx(xy,{id:`safety-${r.id}`,checked:e.never_automate_categories?.includes(r.id),onCheckedChange:()=>n(r.id)}),o.jsx(Ye,{htmlFor:`safety-${r.id}`,className:"cursor-pointer",children:r.label})]},r.id))})]}),o.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 p-4 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 font-medium",children:[o.jsx(yg,{className:"h-4 w-4"}),"Expected Results"]}),o.jsxs("ul",{className:"text-sm space-y-1 list-disc list-inside opacity-90",children:[o.jsx("li",{children:"Save ~2 hours per week"}),o.jsx("li",{children:"Respond 50% faster to clients"}),o.jsx("li",{children:"Zero missed important emails"})]})]})]})}const Vu=4;function O2({onComplete:e,onClose:t,initialData:n,className:r}){const{t:i}=nt(),{state:l}=Tn(),{user:u}=l,[d,h]=w.useState(1),[m,p]=w.useState(!1),[g,v]=w.useState(n||{work_style:"startup",preferred_tone:"professional",preferred_length:"medium",primary_goal:"inbox_zero",vip_senders:[],trusted_domains:[],blocked_domains:[],never_automate_categories:["legal","hr","financial"],automation_level:5,time_budget_minutes:30}),b=()=>{d<Vu?h(T=>T+1):_()},j=()=>{d>1?h(T=>T-1):t&&t()},_=async()=>{if(u){p(!0);try{const{error:T}=await xt.from("user_settings").update({...g,persona_completed:!0,persona_completed_at:new Date().toISOString()}).eq("user_id",u.id);if(T)throw T;le.success("Persona saved successfully!"),e()}catch(T){console.error("Failed to save persona:",T),le.error("Failed to save persona. Please try again.")}finally{p(!1)}}},S=T=>{v(D=>({...D,...T}))},N=()=>{switch(d){case 1:return o.jsx(n$,{data:g,updateData:S});case 2:return o.jsx(r$,{data:g,updateData:S});case 3:return o.jsx(a$,{data:g,updateData:S});case 4:return o.jsx(l$,{data:g,updateData:S});default:return null}},C=d/Vu*100;return o.jsxs(Ge,{className:pe("w-full max-w-2xl mx-auto border-none shadow-none md:border md:shadow-lg",r),children:[o.jsxs(Mt,{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("span",{className:"text-sm text-muted-foreground",children:["Step ",d," of ",Vu]}),t&&o.jsx(Z,{variant:"ghost",size:"sm",onClick:t,children:"Skip"})]}),o.jsx(Ly,{value:C,className:"h-2"})]}),o.jsx(wt,{className:"py-4 max-h-[60vh] overflow-y-auto",children:N()}),o.jsxs(ek,{className:"flex justify-between",children:[o.jsx(Z,{variant:"outline",onClick:j,disabled:m,children:d===1&&t?"Cancel":"Back"}),o.jsxs(Z,{onClick:b,disabled:m,children:[m&&o.jsx(jt,{className:"mr-2 h-4 w-4 animate-spin"}),d===Vu?"Complete Setup":"Next"]})]})]})}function c$(){const{t:e}=nt(),{state:t,actions:n}=Tn(),[r,i]=w.useState(!1),l=t.settings||{persona_completed:!1},u=async()=>{i(!1),await n.fetchSettings()};return r?o.jsx(os,{open:!0,onOpenChange:i,children:o.jsxs(ls,{className:"max-w-5xl sm:max-w-5xl h-[80vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs("div",{className:"p-6 pb-0",children:[o.jsx(bs,{children:e("persona.edit.title")||"Edit Persona"}),o.jsx(hr,{children:e("persona.edit.desc")||"Update your digital assistant preferences."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 pt-2",children:o.jsx(O2,{initialData:l,onComplete:u,onClose:()=>i(!1),className:"max-w-none shadow-none border-0 p-0"})})]})}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium",children:e("persona.title")||"Digital Persona"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e("persona.subtitle")||"Manage how your AI assistant represents you."})]}),o.jsxs(Z,{onClick:()=>i(!0),className:"gap-2",children:[o.jsx(lj,{className:"w-4 h-4"}),e("common.edit")||"Edit Persona"]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs(Ge,{children:[o.jsx(Mt,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Sd,{className:"w-5 h-5 text-primary"}),o.jsx($t,{className:"text-base",children:e("persona.identity")||"Identity"})]})}),o.jsx(wt,{className:"space-y-4 text-sm",children:o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"Role:"}),o.jsx("span",{className:"font-medium text-right",children:l.role||"Not set"}),o.jsx("span",{className:"text-muted-foreground",children:"Industry:"}),o.jsx("span",{className:"font-medium text-right",children:l.industry||"Not set"}),o.jsx("span",{className:"text-muted-foreground",children:"Style:"}),o.jsx("span",{className:"font-medium capitalize text-right",children:l.work_style||"Not set"})]})})]}),o.jsxs(Ge,{children:[o.jsx(Mt,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(bd,{className:"w-5 h-5 text-indigo-500"}),o.jsx($t,{className:"text-base",children:e("persona.communication")||"Communication"})]})}),o.jsx(wt,{className:"space-y-4 text-sm",children:o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"Tone:"}),o.jsx("span",{className:"font-medium capitalize text-right",children:l.preferred_tone||"Professional"}),o.jsx("span",{className:"text-muted-foreground",children:"Length:"}),o.jsx("span",{className:"font-medium capitalize text-right",children:l.preferred_length||"Medium"}),o.jsx("span",{className:"text-muted-foreground",children:"Languages:"}),o.jsx("div",{className:"flex justify-end gap-1 flex-wrap",children:(l.common_phrases?.length||0)>0?o.jsx(El,{variant:"secondary",className:"text-xs",children:"Custom Phrases Active"}):o.jsx("span",{className:"text-muted-foreground italic",children:"None"})})]})})]}),o.jsxs(Ge,{children:[o.jsx(Mt,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(uj,{className:"w-5 h-5 text-emerald-500"}),o.jsx($t,{className:"text-base",children:e("persona.automation")||"Automation"})]})}),o.jsxs(wt,{className:"space-y-4 text-sm",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"Primary Goal:"}),o.jsx("span",{className:"font-medium capitalize text-right",children:l.primary_goal?.replace("_"," ")||"Inbox Zero"}),o.jsx("span",{className:"text-muted-foreground",children:"Auto Level:"}),o.jsx("div",{className:"flex items-center justify-end gap-2",children:o.jsxs("span",{className:"font-medium",children:[l.automation_level||5,"/10"]})})]}),(l.never_automate_categories?.length||0)>0&&o.jsxs("div",{className:"pt-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground block mb-1",children:"Never Automate:"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:l.never_automate_categories?.map(d=>o.jsx(El,{variant:"outline",className:"text-xs py-0 h-5 bg-background",children:d},d))})]})]})]}),o.jsxs(Ge,{children:[o.jsx(Mt,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ij,{className:"w-5 h-5 text-sky-500"}),o.jsx($t,{className:"text-base",children:e("persona.network")||"Network"})]})}),o.jsxs(wt,{className:"space-y-4 text-sm",children:[o.jsxs("div",{children:[o.jsxs("span",{className:"text-xs text-muted-foreground block mb-2",children:["VIP Senders (",l.vip_senders?.length||0,")"]}),o.jsxs("div",{className:"flex flex-wrap gap-1 max-h-[60px] overflow-hidden",children:[l.vip_senders?.slice(0,3).map(d=>o.jsx(El,{variant:"secondary",className:"text-xs py-0 h-5 truncate max-w-[150px]",children:d},d)),(l.vip_senders?.length||0)>3&&o.jsxs("span",{className:"text-xs text-muted-foreground flex items-center",children:["+",l.vip_senders.length-3," more"]})]})]}),o.jsx("div",{className:"pt-2 border-t mt-2",children:o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-muted-foreground",children:"Trusted Domains:"}),o.jsx("span",{className:"font-medium",children:l.trusted_domains?.length||0})]})})]})]})]})]})}function u$(){const{t:e}=nt(),[t,n]=w.useState("profile"),{state:r,actions:i}=Tn();w.useEffect(()=>{i.fetchProfile()},[]);const l=[{id:"profile",label:e("account.profile"),icon:Sd},{id:"persona",label:e("persona.title")||"Persona",icon:JR},{id:"security",label:e("account.security"),icon:jg},{id:"database",label:e("account.database"),icon:Wr}];return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:e("account.title")}),o.jsx("p",{className:"text-muted-foreground",children:e("account.subtitle")})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[o.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[o.jsx("nav",{className:"space-y-1",children:l.map(u=>{const d=u.icon,h=t===u.id;return o.jsxs("button",{onClick:()=>n(u.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${h?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[o.jsx(d,{className:"w-4 h-4"}),u.label]},u.id)})}),o.jsxs("div",{className:"mt-auto space-y-1",children:[o.jsxs("button",{onClick:async()=>{await xt.auth.signOut(),Z5(),le.success(e("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:[o.jsx($A,{className:"w-4 h-4"}),e("account.logout")]}),o.jsxs("div",{className:"px-4 py-4 border-t border-border/40 text-center md:text-left",children:[o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:e("account.version")}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.24.0"]})]})]})]}),o.jsxs("div",{className:"flex-1 space-y-6",children:[t==="profile"&&o.jsx(d$,{}),t==="persona"&&o.jsx(c$,{}),t==="security"&&o.jsx(f$,{}),t==="database"&&o.jsx(h$,{})]})]})]})}function d$(){const{t:e}=nt(),{state:t,actions:n}=Tn(),[r,i]=w.useState(""),[l,u]=w.useState(""),[d,h]=w.useState(!1),[m,p]=w.useState(!1),[g,v]=w.useState(Ms.isEnabled());w.useEffect(()=>{t.profile&&(i(t.profile.first_name||""),u(t.profile.last_name||""))},[t.profile]);const b=()=>{const S=!g;Ms.setEnabled(S),v(S),S?(Ms.playSuccess(),le.success(e("account.profile.soundsEnabled"))):le.info(e("account.profile.soundsDisabled"))},j=async()=>{h(!0);const S=await n.updateProfile({first_name:r,last_name:l});h(!1),S&&le.success(e("account.profile.updated"))},_=async S=>{const N=S.target.files?.[0];if(!(!N||!t.user)){p(!0);try{const C=N.name.split(".").pop(),T=`${t.user.id}/avatar.${C}`,{data:D,error:L}=await xt.storage.from("avatars").upload(T,N,{upsert:!0});if(L)throw L;const{data:{publicUrl:O}}=xt.storage.from("avatars").getPublicUrl(T);await n.updateProfile({avatar_url:O}),le.success(e("account.profile.avatarUpdated"))}catch(C){console.error("Avatar upload error:",C),le.error(e("account.profile.avatarError"))}finally{p(!1)}}};return o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsx($t,{children:e("account.profile.title")}),o.jsx(xs,{children:e("account.profile.desc")})]}),o.jsxs(wt,{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:t.profile?.avatar_url?o.jsx("img",{src:t.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(Sd,{className:"w-12 h-12 text-muted-foreground"})}),o.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-full opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",children:[o.jsx(OC,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:_,disabled:m})]}),m&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(yt,{size:"sm"})})]}),o.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"first-name",children:e("account.profile.firstName")}),o.jsx(De,{id:"first-name",value:r,onChange:S=>i(S.target.value),placeholder:e("account.profile.firstNamePlaceholder")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"last-name",children:e("account.profile.lastName")}),o.jsx(De,{id:"last-name",value:l,onChange:S=>u(S.target.value),placeholder:e("account.profile.lastNamePlaceholder")})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"email",children:e("account.profile.email")}),o.jsx(De,{id:"email",value:t.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:e("account.profile.emailHelp")})]})]})]}),o.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:e("account.profile.sounds")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:e("account.profile.soundsHelp")})]}),o.jsxs(Z,{variant:g?"default":"outline",size:"sm",onClick:b,className:"gap-2",children:[g?o.jsx(Dl,{className:"w-4 h-4"}):o.jsx(kg,{className:"w-4 h-4"}),e(g?"common.enabled":"common.disabled")]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:j,disabled:d,children:[d?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(mR,{className:"w-4 h-4 mr-2"}),e("common.saveChanges")]})})]})]})}function f$(){const{t:e}=nt(),[t,n]=w.useState(""),[r,i]=w.useState(""),[l,u]=w.useState(!1),d=async()=>{if(!t){le.error(e("account.security.enterPassword"));return}if(t!==r){le.error(e("account.security.passwordsMismatch"));return}if(t.length<6){le.error(e("account.security.passwordTooShort"));return}u(!0);try{const{api:h}=await Aa(async()=>{const{api:p}=await Promise.resolve().then(()=>q5);return{api:p}},void 0),m=await h.changePassword(t);m.success?(le.success(e("account.security.passwordChanged")),n(""),i("")):le.error(m.error?.message||"Failed to change password")}catch{le.error(e("common.errorOccurred"))}finally{u(!1)}};return o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsx($t,{children:e("account.security.title")}),o.jsx(xs,{children:e("account.security.desc")})]}),o.jsxs(wt,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"new-password",children:e("account.security.newPassword")}),o.jsx(De,{id:"new-password",type:"password",value:t,onChange:h=>n(h.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"confirm-password",children:e("account.security.confirmPassword")}),o.jsx(De,{id:"confirm-password",type:"password",value:r,onChange:h=>i(h.target.value),placeholder:"••••••••"})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:d,disabled:l,children:[l?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(vg,{className:"w-4 h-4 mr-2"}),e("account.security.updatePassword")]})})]})]})}function h$(){const{t:e}=nt(),[t,n]=w.useState(!1),[r,i]=w.useState(null),l=fo(),u=V5();w.useEffect(()=>{l&&hy(xt).then(i)},[]);const d=()=>{confirm(e("account.database.clearConfirm"))&&(U5(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsxs($t,{className:"flex items-center gap-2",children:[o.jsx(Wr,{className:"w-5 h-5 text-primary"}),e("account.database.title")]}),o.jsx(xs,{children:e("account.database.desc")})]}),o.jsx(wt,{className:"space-y-6",children:l?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[o.jsx(Qu,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:e("account.database.connected")}),r?.latestMigrationTimestamp&&o.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]})]}),o.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:l.url})]})]}),u==="env"&&o.jsxs(La,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Al,{className:"h-4 w-4 text-amber-500"}),o.jsx(Ia,{className:"text-amber-700 dark:text-amber-400 text-xs",children:e("account.database.envAlert")})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs(Z,{variant:"outline",onClick:()=>n(!0),className:"w-full",children:[o.jsx(Al,{className:"w-4 h-4 mr-2"}),e("account.database.changeConnection")]}),u==="ui"&&o.jsxs(Z,{variant:"outline",onClick:d,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(wd,{className:"w-4 h-4 mr-2"}),e("account.database.clearConfig")]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(Ye,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:e("account.database.anonKey")}),o.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[l.anonKey.substring(0,20),"...",l.anonKey.substring(l.anonKey.length-10)]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[o.jsx(KC,{className:"w-12 h-12 text-destructive opacity-20"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:e("account.database.noConnection")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e("account.database.configureHelp")})]}),o.jsxs(Z,{onClick:()=>n(!0),children:[o.jsx(Wr,{className:"w-4 h-4 mr-2"}),e("account.database.setup")]})]})})]}),o.jsx(W_,{open:t,onComplete:()=>n(!1),canClose:!0})]})}function m$(){const{t:e}=nt();return o.jsx("span",{className:"inline-flex items-center text-xs px-2 py-0.5 rounded-full bg-blue-50 dark:bg-blue-950/70 text-blue-700 dark:text-blue-200 border border-blue-200 dark:border-blue-700 shrink-0 font-medium",children:e("autopilot.badge")})}function QS({rules:e,onToggleRule:t,onEditRule:n,onDeleteRule:r}){const{t:i}=nt(),l={email_organization:{label:i("autopilot.category.email_organization.label"),icon:is,emoji:"📧",description:i("autopilot.category.email_organization.desc")},priority_alerts:{label:i("autopilot.category.priority_alerts.label"),icon:qn,emoji:"🚨",description:i("autopilot.category.priority_alerts.desc")},development:{label:i("autopilot.category.development.label"),icon:Os,emoji:"💻",description:i("autopilot.category.development.desc")},sales_business:{label:i("autopilot.category.sales_business.label"),icon:rj,emoji:"💼",description:i("autopilot.category.sales_business.desc")},operations:{label:i("autopilot.category.operations.label"),icon:Al,emoji:"⚙️",description:i("autopilot.category.operations.desc")}},u=e.reduce((m,p)=>{const g=p.category||"email_organization";return m[g]||(m[g]=[]),m[g].push(p),m},{}),d=m=>{const p=m.filter(v=>v.is_enabled).length,g=m.length;return{enabled:p,total:g}},h=m=>!m||m.length===0?"":m.map(p=>p.startsWith("label:")?`label:${p.substring(6)}`:p).join(" + ");return o.jsx("div",{className:"space-y-8",children:Object.entries(l).map(([m,p])=>{const g=u[m]||[];if(g.length===0)return null;const v=d(g);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-lg bg-secondary/50 flex items-center justify-center text-primary",children:o.jsx(p.icon,{className:"w-5 h-5"})}),o.jsxs("div",{children:[o.jsxs("h3",{className:"font-semibold text-base flex items-center gap-2",children:[p.label,o.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:i("autopilot.enabledCount").replace("{enabled}",v.enabled.toString()).replace("{total}",v.total.toString())})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:p.description})]})]})}),o.jsx("div",{className:"space-y-1",children:g.map(b=>o.jsxs("div",{className:"flex items-center justify-between py-3 px-4 rounded-lg hover:bg-secondary/30 transition-colors",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h4",{className:"font-medium text-sm truncate",children:b.name}),b.is_system_managed&&o.jsx(m$,{})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[b.intent&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.intent}),b.actions&&b.actions.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["→ ",h(b.actions)]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>n(b.id),title:i("autopilot.editRuleTooltip"),children:o.jsx(lj,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:b.is_enabled?"default":"outline",size:"sm",onClick:()=>t(b.id,!b.is_enabled),className:"h-8 px-3",children:[o.jsx(ip,{className:"w-4 h-4 mr-1"}),b.is_enabled?i("common.on"):i("common.off")]}),!b.is_system_managed&&r&&o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",onClick:()=>r(b.id),title:i("autopilot.deleteRuleTooltip"),children:o.jsx(wd,{className:"w-4 h-4"})})]})]},b.id))})]},m)})})}function p$(e){const t=e.trim();if(!t)return;try{return JSON.parse(t)}catch{}const n=["newsletter","news","spam","promotional","transactional","social","support","client","internal","personal","notification","other"],r=t.toLowerCase();if(n.includes(r))return{category:r};if(t.includes(",")){const l=t.split(",").map(u=>u.trim().toLowerCase()).filter(u=>n.includes(u));if(l.length>0)return l.length===1?{category:l[0]}:{or:l.map(u=>({category:u}))}}if(t.startsWith("@")||/\.(com|net|org|io|co|ai)$/i.test(t))return{sender_domain:t.startsWith("@")?t.slice(1):t};if(t.includes("=")){const[i,l]=t.split("=").map(u=>u.trim());if(i&&l)return l.toLowerCase()==="true"?{[i]:!0}:l.toLowerCase()==="false"?{[i]:!1}:isNaN(Number(l))?{[i]:l}:{[i]:Number(l)}}return{or:[{sender_contains:t},{subject_contains:t}]}}function g$({open:e,rule:t,onClose:n,onSave:r,onFileUpload:i,onRemoveAttachment:l}){const{t:u}=nt(),[d,h]=w.useState(!1),[m,p]=w.useState(!1),[g,v]=w.useState(""),[b,j]=w.useState(""),[_,S]=w.useState(""),[N,C]=w.useState("category"),[T,D]=w.useState("newsletter"),[L,O]=w.useState(["newsletter"]),[B,M]=w.useState(""),[q,R]=w.useState(["archive"]),[J,K]=w.useState(""),[he,se]=w.useState([]),[ie,$]=w.useState(""),[V,G]=w.useState(.7);w.useEffect(()=>{if(t){v(t.name||""),j(t.description||""),S(t.intent||""),R(t.actions||["archive"]),K(t.instructions||""),se(t.attachments||[]);const z=t.condition||{},A=(ue,ke)=>{if(ue[ke])return ue[ke];if(ue.and&&Array.isArray(ue.and))for(const Ne of ue.and){const Ie=A(Ne,ke);if(Ie!==void 0)return Ie}if(ue.or&&Array.isArray(ue.or))for(const Ne of ue.or){const Ie=A(Ne,ke);if(Ie!==void 0)return Ie}},ee=ue=>{const ke=[];if(ue.category)return ke.push(ue.category),ke;if(ue.or&&Array.isArray(ue.or)){for(const Ne of ue.or)Ne.category&&ke.push(Ne.category);if(ke.length>0)return ke}if(ue.and&&Array.isArray(ue.and))for(const Ne of ue.and){const Ie=ee(Ne);if(Ie.length>0)return Ie}return ke},ge=ee(z);if(ge.length>0)C("category"),O(ge),D(ge[0]);else{const ue=["sentiment","priority","sender_email","sender_domain","sender_contains","subject_contains","body_contains"];let ke=null,Ne=null;for(const Ie of ue){const rt=A(z,Ie);if(rt!==void 0){ke=Ie,Ne=rt;break}}if(ke&&Ne!==null)C(ke),D(Ne),O(["newsletter"]);else{const Ie=Object.keys(z).filter(rt=>rt!=="older_than_days"&&rt!=="and"&&rt!=="or"&&rt!=="not"&&rt!=="confidence_gt");Ie.length>0&&(C(Ie[0]),D(z[Ie[0]])),O(["newsletter"])}}const ye=A(z,"older_than_days");M(ye!==void 0?String(ye):""),t.negative_condition?$(JSON.stringify(t.negative_condition,null,2)):$(""),G(t.min_confidence??.7)}else v(""),j(""),S(""),C("category"),D("newsletter"),O(["newsletter"]),M(""),R(["archive"]),K(""),se([]),$(""),G(.7)},[t,e]);const fe=async()=>{if(g.trim()&&q.length!==0){h(!0);try{let z;if(N==="category"){if(L.length===1?z={category:L[0]}:L.length>1?z={or:L.map(ue=>({category:ue}))}:z={category:"newsletter"},B){const ue=parseInt(B,10);L.length===1?z.older_than_days=ue:z={and:[z,{older_than_days:ue}]}}}else z={[N]:T},B&&(z.older_than_days=parseInt(B,10));const A=q.includes("draft");let ee;if(ie.trim()&&(ee=p$(ie.trim()),ee===null)){alert("Could not parse negative condition. Please check the input.");return}const ge={name:g.trim(),description:b.trim()||void 0,intent:_.trim()||void 0,condition:z,negative_condition:ee,min_confidence:V,actions:q,instructions:A?J:void 0,attachments:A?he:[],is_enabled:!0};await r(ge)&&n()}finally{h(!1)}}},P=async z=>{if(!i)return;const A=z.target.files;if(!(!A||A.length===0)){p(!0);try{const ee=await i(A[0]);ee&&se(ge=>[...ge,ee])}finally{p(!1),z.target.value=""}}},I=z=>{se(A=>A.filter(ee=>ee.path!==z)),l&&l(z)};return o.jsx(os,{open:e,onOpenChange:z=>!z&&n(),children:o.jsxs(ls,{className:"sm:max-w-3xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(fr,{className:"p-6 border-b",children:[o.jsx(bs,{children:u(t?"autopilot.editDialog.editTitle":"autopilot.editDialog.createTitle")}),o.jsx(hr,{children:u("autopilot.editDialog.desc")})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.ruleName")}),o.jsx(De,{placeholder:u("autopilot.editDialog.namePlaceholder"),value:g,onChange:z=>v(z.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.description")}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:u("autopilot.editDialog.descPlaceholder"),value:b,onChange:z=>j(z.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("autopilot.editDialog.descriptionHelp")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.intent")}),o.jsx(De,{placeholder:u("autopilot.editDialog.intentPlaceholder"),value:_,onChange:z=>S(z.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("autopilot.editDialog.intentHelp")})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.conditionField")}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:N,onChange:z=>{C(z.target.value),z.target.value==="category"?(O(["newsletter"]),D("newsletter")):z.target.value==="sentiment"?D("Positive"):z.target.value==="priority"?D("High"):D("")},children:[o.jsxs("optgroup",{label:u("autopilot.editDialog.aiAnalysisGroup"),children:[o.jsx("option",{value:"category",children:u("autopilot.editDialog.category")}),o.jsx("option",{value:"sentiment",children:u("autopilot.editDialog.sentiment")}),o.jsx("option",{value:"priority",children:u("autopilot.editDialog.priority")})]}),o.jsxs("optgroup",{label:u("autopilot.editDialog.metadataGroup"),children:[o.jsx("option",{value:"sender_email",children:u("autopilot.editDialog.senderEmail")}),o.jsx("option",{value:"sender_domain",children:u("autopilot.editDialog.senderDomain")}),o.jsx("option",{value:"sender_contains",children:u("autopilot.editDialog.senderContains")}),o.jsx("option",{value:"subject_contains",children:u("autopilot.editDialog.subjectContains")}),o.jsx("option",{value:"body_contains",children:u("autopilot.editDialog.bodyContains")})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u(N==="category"?"autopilot.editDialog.selectCategories":"autopilot.editDialog.equalsValue")}),N==="category"?o.jsx("div",{className:"grid grid-cols-2 gap-2 p-3 border rounded-md bg-background",children:[{value:"newsletter",label:u("autopilot.editDialog.cat.newsletter")},{value:"news",label:u("autopilot.editDialog.cat.news")},{value:"spam",label:u("autopilot.editDialog.cat.spam")},{value:"promotional",label:u("autopilot.editDialog.cat.promotional")},{value:"transactional",label:u("autopilot.editDialog.cat.transactional")},{value:"social",label:u("autopilot.editDialog.cat.social")},{value:"support",label:u("autopilot.editDialog.cat.support")},{value:"client",label:u("autopilot.editDialog.cat.client")},{value:"internal",label:u("autopilot.editDialog.cat.internal")},{value:"personal",label:u("autopilot.editDialog.cat.personal")},{value:"notification",label:u("autopilot.editDialog.cat.notification")||"Notification"},{value:"other",label:u("autopilot.editDialog.cat.other")}].map(z=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors text-sm ${L.includes(z.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:L.includes(z.value),onChange:A=>{A.target.checked?O([...L,z.value]):O(L.filter(ee=>ee!==z.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:z.label})]},z.value))}):N==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:T,onChange:z=>D(z.target.value),children:[o.jsx("option",{value:"Positive",children:u("autopilot.editDialog.sent.positive")}),o.jsx("option",{value:"Neutral",children:u("autopilot.editDialog.sent.neutral")}),o.jsx("option",{value:"Negative",children:u("autopilot.editDialog.sent.negative")})]}):N==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:T,onChange:z=>D(z.target.value),children:[o.jsx("option",{value:"High",children:u("autopilot.editDialog.prio.high")}),o.jsx("option",{value:"Medium",children:u("autopilot.editDialog.prio.medium")}),o.jsx("option",{value:"Low",children:u("autopilot.editDialog.prio.low")})]}):o.jsx(De,{placeholder:N==="sender_domain"?"rta.vn":N==="sender_email"?"john@example.com":u("autopilot.editDialog.keywordsPlaceholder"),value:T,onChange:z=>D(z.target.value)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Ls,{className:"w-4 h-4"}),u("autopilot.editDialog.olderThan")]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(De,{type:"number",min:"0",placeholder:"0",className:"w-24",value:B,onChange:z=>M(z.target.value)}),o.jsx("span",{className:"text-sm text-muted-foreground",children:u("autopilot.editDialog.days")})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("autopilot.editDialog.olderThanHelp")})]}),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx("span",{children:"Exclude When (Optional)"}),o.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"Advanced"})]}),o.jsx("textarea",{className:"w-full p-3 border rounded-md bg-background min-h-[100px] text-xs font-mono custom-scrollbar",placeholder:"Google Alert\\nnewsletter\\n@googlealerts.com\\nis_automated=true",value:ie,onChange:z=>$(z.target.value)}),o.jsxs("div",{className:"text-[10px] text-muted-foreground space-y-1",children:[o.jsx("p",{className:"font-medium",children:"💡 Smart input - use plain text or JSON:"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 pl-2",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[9px] opacity-70 mb-0.5",children:"Plain text:"}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block",children:"Google Alert"}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block mt-0.5",children:"newsletter"}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block mt-0.5",children:"@googlealerts.com"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-[9px] opacity-70 mb-0.5",children:"JSON (advanced):"}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block",children:'{ "is_automated": true }'}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block mt-0.5",children:'{ "category": "news" }'}),o.jsx("code",{className:"bg-secondary/50 px-1 py-0.5 rounded block mt-0.5",children:'{ "or": [...] }'})]})]})]})]}),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx("span",{children:"Confidence Threshold"}),o.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:[(V*100).toFixed(0),"% minimum"]})]}),o.jsx("input",{type:"range",min:"0.5",max:"1.0",step:"0.05",value:V,onChange:z=>G(parseFloat(z.target.value)),className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-primary"}),o.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"50% (Experimental)"}),o.jsx("span",{children:"70% (Balanced)"}),o.jsx("span",{children:"100% (Strict)"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"💡 Lower = more matches but more false positives. Higher = fewer matches but more precision. Recommended: 90% for critical rules, 70% for default, 50% for experimental/cleanup rules."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.performActions")}),o.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:u("autopilot.editDialog.actionsDesc")}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:u("autopilot.editDialog.action.archive")},{value:"delete",label:u("autopilot.editDialog.action.delete")},{value:"draft",label:u("autopilot.editDialog.action.draft")},{value:"star",label:u("autopilot.editDialog.action.star")}].map(z=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${q.includes(z.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:q.includes(z.value),onChange:A=>{A.target.checked?R([...q,z.value]):R(q.filter(ee=>ee!==z.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:z.label})]},z.value))})]}),q.includes("draft")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsx("label",{className:"text-sm font-medium",children:u("autopilot.editDialog.draftInstructions")}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:u("autopilot.editDialog.draftInstPlaceholder"),value:J,onChange:z=>K(z.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("autopilot.editDialog.draftInstHelp")})]}),i&&o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(ap,{className:"w-4 h-4"}),u("autopilot.editDialog.attachments")]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[he.map(z=>o.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[o.jsx("span",{className:"truncate max-w-[200px]",children:z.name}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>I(z.path),children:o.jsx(fn,{className:"w-3 h-3"})})]},z.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:P,disabled:m}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:m,children:[m?o.jsx(yt,{size:"sm",className:"mr-2"}):o.jsx(cr,{className:"w-3 h-3 mr-2"}),u(m?"autopilot.editDialog.uploading":"autopilot.editDialog.addAttachment")]})]})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("autopilot.editDialog.attachmentsHelp")})]})]})]}),o.jsxs(lr,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:n,children:u("common.cancel")}),o.jsxs(Z,{onClick:fe,disabled:d||!g.trim()||q.length===0,children:[d?o.jsx(yt,{size:"sm",className:"mr-2"}):t?o.jsx(ir,{className:"w-4 h-4 mr-2"}):o.jsx(cr,{className:"w-4 h-4 mr-2"}),u(t?"common.saveChanges":"autopilot.addCustomRule")]})]})]})})}function y$(){const{state:e,actions:t}=Tn(),{t:n}=nt(),[r,i]=w.useState([]),[l,u]=w.useState(!0),[d,h]=w.useState(null),[m,p]=w.useState(!1),[g,v]=w.useState(null),b=async()=>{u(!0),h(null);try{const M=await Re.getRules();if(M.error)throw new Error(typeof M.error=="string"?M.error:M.error.message);i(M.data?.rules||[])}catch(M){h(M instanceof Error?M.message:n("autopilot.loadError")),console.error("Error fetching rules:",M)}finally{u(!1)}};w.useEffect(()=>{b()},[]);const j=async(M,q)=>{try{const R=await Re.updateRule(M,{is_enabled:q});if(R.error)throw new Error(typeof R.error=="string"?R.error:R.error.message);i(J=>J.map(K=>K.id===M?{...K,is_enabled:q}:K))}catch(R){console.error("Error toggling rule:",R),await b()}},_=M=>{const q=r.find(R=>R.id===M);q&&(v(q),p(!0))},S=async M=>{if(confirm(n("autopilot.deleteConfirm")))try{await t.deleteRule(M)?(le.success(n("autopilot.ruleDeleted")),i(R=>R.filter(J=>J.id!==M))):le.error(n("autopilot.ruleDeleteFailed"))}catch(q){console.error("Error deleting rule:",q),le.error(n("autopilot.ruleDeleteError"))}},N=()=>{v(null),p(!0)},C=async M=>{try{let q=!1;return g?q=await t.updateRule(g.id,M):q=await t.createRule(M),q?(le.success(n(g?"autopilot.ruleUpdated":"autopilot.ruleCreated")),await b(),!0):(le.error(n(g?"autopilot.ruleUpdateFailed":"autopilot.ruleCreateFailed")),!1)}catch(q){return console.error("Error saving rule:",q),le.error(n("autopilot.ruleSaveError")),!1}},T=async M=>{try{const q=M.name.split(".").pop(),R=`${Math.random().toString(36).substring(2)}.${q}`,J=`${e.user.id}/${R}`,{error:K}=await xt.storage.from("rule-attachments").upload(J,M);if(K)throw K;return le.success(n("autopilot.fileUploaded")),{name:M.name,path:J,type:M.type,size:M.size}}catch(q){return console.error("Upload error:",q),le.error(n("autopilot.fileUploadFailed")),null}},D=()=>{p(!1),v(null)};if(l)return o.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Jt,{className:"w-8 h-8 animate-spin text-gray-400"}),o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:n("autopilot.loadingRules")})]})});if(d)return o.jsxs(La,{variant:"destructive",children:[o.jsx(qn,{className:"h-4 w-4"}),o.jsxs(Ia,{children:[d,o.jsxs(Z,{variant:"outline",size:"sm",onClick:b,className:"ml-4",children:[o.jsx(Jt,{className:"w-4 h-4 mr-2"}),n("autopilot.refresh")]})]})]});const L=r.filter(M=>M.is_system_managed),O=r.filter(M=>!M.is_system_managed),B=L.filter(M=>M.is_enabled).length;return r.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:[o.jsx(qu,{className:"w-16 h-16 text-gray-300 dark:text-gray-700 mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:n("autopilot.noRulesTitle")}),o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center max-w-md mb-4",children:n("autopilot.noRulesDesc")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-8",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(qu,{className:"w-6 h-6 text-blue-500"}),n("autopilot.title")]}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:n("autopilot.rulesEnabled").replace("{enabled}",B.toString()).replace("{total}",L.length.toString())})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Z,{variant:"default",size:"sm",onClick:N,children:[o.jsx(cr,{className:"w-4 h-4 mr-2"}),n("autopilot.addCustomRule")]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:b,disabled:l,children:[o.jsx(Jt,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),n("autopilot.refresh")]})]})]}),L.length>0&&o.jsxs(La,{children:[o.jsx(qu,{className:"h-4 w-4"}),o.jsx(Ia,{children:n("autopilot.infoDesc")})]}),L.length>0&&o.jsx(QS,{rules:L,onToggleRule:j,onEditRule:_,onDeleteRule:S}),O.length>0&&o.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:n("autopilot.customRules")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n("autopilot.customRulesDesc")})]}),o.jsx(QS,{rules:O,onToggleRule:j,onEditRule:_,onDeleteRule:S})]})]}),o.jsx(g$,{open:m,rule:g,onClose:D,onSave:C,onFileUpload:T})]})}function x$({length:e=6,value:t,onChange:n,onComplete:r,disabled:i=!1,error:l=!1}){const u=w.useRef([]),[d,h]=w.useState(null),m=(v,b)=>{const j=b.replace(/[^0-9]/g,"");if(j.length===0){const N=t.split("");N[v]=" ",t.split("");let C=t.split("");v<C.length&&C.splice(v,1);const T=C.join("");n(T),v>0&&u.current[v-1]?.focus();return}t.split("");const _=[...t];_[v]=j[0],n(_.join("")),v<e-1&&u.current[v+1]?.focus();const S=_.join("");S.length===e&&r&&r(S)},p=(v,b)=>{b.key==="Backspace"&&!t[v]&&v>0||b.key==="ArrowLeft"&&v>0?u.current[v-1]?.focus():b.key==="ArrowRight"&&v<e-1&&u.current[v+1]?.focus()},g=v=>{v.preventDefault();const j=v.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,e);n(j);const _=Math.min(j.length,e-1);u.current[_]?.focus(),j.length===e&&r&&r(j)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:e}).map((v,b)=>o.jsx(De,{ref:j=>{u.current[b]=j},type:"text",inputMode:"numeric",maxLength:1,value:t[b]||"",onChange:j=>m(b,j.target.value),onKeyDown:j=>p(b,j),onPaste:g,onFocus:()=>h(b),onBlur:()=>h(null),disabled:i,className:pe("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",l&&"border-destructive focus-visible:ring-destructive",d===b&&"ring-2 ring-ring"),"aria-label":`Digit ${b+1}`},b))})}function v$({onSuccess:e,onConfigure:t,isInitialized:n}){const{t:r}=nt(),[i,l]=w.useState(""),[u,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,b]=w.useState(!1),[j,_]=w.useState(n===void 0),[S,N]=w.useState(n??!1),[C,T]=w.useState(""),[D,L]=w.useState(!1),[O,B]=w.useState("password"),[M,q]=w.useState("email"),[R,J]=w.useState(""),[K,he]=w.useState(!1);w.useEffect(()=>{n===void 0?se():he(!n)},[n]);const se=async()=>{try{const{data:V,error:G}=await xt.from("init_state").select("is_initialized");if(G){if(G.code==="42P01"){console.info("[Login] init_state relation missing - fresh database detected."),N(!1),he(!0);return}console.warn("[Login] Init check error:",G),N(!1),he(!0),T(G.message);return}const fe=V&&V.length>0&&V[0].is_initialized>0;N(fe),he(!fe)}catch(V){console.warn("[Login] Init check exception:",V),N(!1),he(!0),T(V.message||"Connection failed")}finally{_(!1)}},ie=async V=>{V.preventDefault(),b(!0),T("");try{if(S){if(O==="password"){const{error:G}=await xt.auth.signInWithPassword({email:i,password:u});if(G)throw G;le.success("Logged in successfully"),e?.()}else if(M==="email"){const{error:G}=await xt.auth.signInWithOtp({email:i,options:{shouldCreateUser:!1}});if(G)throw G;q("verify"),le.success("Validation code sent to your email")}}else{const{data:G,error:fe}=await xt.functions.invoke("setup",{body:{email:i,password:u,first_name:h,last_name:p}});if(fe||!G){if(fe?.message?.includes("First user already exists")){le.info("System already initialized. Please log in."),N(!0);return}throw new Error(fe?.message||"Failed to create admin account")}le.success("Admin account created! Signing you in...");const{error:P}=await xt.auth.signInWithPassword({email:i,password:u});if(P)throw P;N(!0),e?.()}}catch(G){T(G?.message||"Authentication failed"),console.error("[Login] Error:",G)}finally{b(!1)}},$=async()=>{b(!0),T("");try{const{data:V,error:G}=await xt.auth.verifyOtp({email:i,token:R,type:"magiclink"});if(G)throw G;if(!V.session)throw new Error("Failed to create session");le.success("Logged in successfully"),e?.()}catch(V){T(V?.message||"Invalid code")}finally{b(!1)}};return j?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(jt,{className:"w-10 h-10 animate-spin text-primary"}),o.jsx("p",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground",children:"Initializing Engine..."})]})}):o.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative overflow-hidden",children:[o.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[t&&o.jsxs(Z,{variant:"ghost",size:"sm",onClick:t,className:"text-xs font-bold uppercase tracking-widest text-muted-foreground hover:text-primary transition-all",children:[o.jsx(Al,{className:"w-3.5 h-3.5 mr-2"}),"Configure"]}),o.jsx(Cj,{}),o.jsx(uy,{})]}),o.jsxs(or.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md relative z-10",children:[o.jsxs("div",{className:"glass p-10 space-y-8 relative overflow-hidden",children:[o.jsxs("div",{className:"text-center space-y-3",children:[o.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-2xl flex items-center justify-center mb-6",children:o.jsx(my,{className:"w-10 h-10 text-primary-foreground"})}),o.jsx("h2",{className:"text-3xl font-black italic tracking-tighter uppercase text-foreground",children:r(K?"login.initialize":"login.secureLogin")}),o.jsx("p",{className:"text-[10px] text-muted-foreground font-bold tracking-[0.2em] uppercase",children:K?"Create your primary administrator account":O==="otp"?"Magic link authentication":"Personal Access Key Required"})]}),o.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[o.jsxs(__,{mode:"wait",children:[K&&o.jsxs(or.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"First Name"}),o.jsx(De,{value:h,onChange:V=>m(V.target.value),required:K,placeholder:r("login.firstNamePlaceholder"),className:"bg-background"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Last Name"}),o.jsx(De,{value:p,onChange:V=>g(V.target.value),required:K,placeholder:r("login.lastNamePlaceholder"),className:"bg-background"})]})]},"signup-fields"),O==="password"||M==="email"?o.jsxs(or.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Email Coordinates"}),o.jsxs("div",{className:"relative",children:[o.jsx(is,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),o.jsx(De,{type:"email",placeholder:r("login.emailPlaceholder"),value:i,onChange:V=>l(V.target.value),required:!0,className:"pl-10 bg-background",autoComplete:"email",disabled:M==="verify"})]})]},"email-field"):null,O==="password"&&o.jsxs(or.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-bold uppercase text-muted-foreground ml-1",children:"Access Password"}),o.jsxs("div",{className:"relative",children:[o.jsx(G0,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/30",size:16}),o.jsx(De,{type:D?"text":"password",placeholder:"••••••••",value:u,onChange:V=>d(V.target.value),required:!0,minLength:6,className:"pl-10 pr-10 bg-background",autoComplete:K?"new-password":"current-password"}),o.jsx("button",{type:"button",onClick:()=>L(!D),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground/30 hover:text-primary transition-colors",children:D?o.jsx(nA,{size:16}):o.jsx(vd,{size:16})})]})]},"password-field"),O==="otp"&&M==="verify"&&o.jsxs(or.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"space-y-6 py-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(x$,{value:R,onChange:J,length:6,onComplete:()=>{}})}),o.jsx(Z,{type:"button",variant:"link",className:"w-full text-[10px] font-bold uppercase tracking-widest text-primary/60",onClick:()=>q("email"),children:"Change Coordinates"}),o.jsxs(Z,{type:"button",onClick:$,disabled:v||R.length!==6,className:"w-full h-12 shadow-md",children:[v?o.jsx(jt,{className:"w-5 h-5 animate-spin mr-2"}):o.jsx(jg,{size:18,className:"mr-2"}),"Verify Access"]})]},"otp-field")]}),C&&o.jsxs(or.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:[o.jsx(qn,{size:14,className:"mt-0.5 shrink-0"}),o.jsx("p",{children:C})]}),O!=="otp"||M==="email"?o.jsx(Z,{type:"submit",disabled:v||!i||O==="password"&&!u,className:"w-full h-12 shadow-md mt-4",children:v?o.jsx(jt,{className:"w-5 h-5 animate-spin"}):o.jsxs(o.Fragment,{children:[K?o.jsx(ZR,{className:"w-5 h-5 mr-2"}):O==="otp"?o.jsx(is,{className:"w-5 h-5 mr-2"}):o.jsx(VA,{className:"w-5 h-5 mr-2"}),r(K?"login.initializeMaster":O==="otp"?"login.sendMagicLink":"login.openDashboard")]})}):null]}),o.jsxs("div",{className:"space-y-4 pt-4 border-t border-border/10",children:[!K&&o.jsx("div",{className:"flex flex-col gap-2",children:O==="password"?o.jsxs("button",{type:"button",onClick:()=>{B("otp"),q("email"),T("")},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:[o.jsx(G0,{size:14})," Magic Link Login"]}):o.jsxs("button",{type:"button",onClick:()=>{B("password"),T("")},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:[o.jsx(gg,{size:14})," Password Access"]})}),o.jsxs("p",{className:"text-center text-[10px] text-muted-foreground font-bold uppercase tracking-wider",children:[K?"Already have an account?":"Need a new account?"," "," ",o.jsx("button",{onClick:()=>{he(!K),B("password"),T("")},className:"text-primary hover:underline ml-1",children:K?"Login Instead":"Create Account"})]})]})]}),o.jsx("div",{className:"mt-8 text-center",children:o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/30 uppercase tracking-[0.4em]",children:"Powered by RealTimeX Intelligence"})})]})]})}function b$({status:e,onSnooze:t,onOpenModal:n}){const[r,i]=w.useState(!1),[l,u]=w.useState(!1),d=m=>{const p=new Date(Date.now()+m*60*60*1e3);t?.(p),le.success(`Reminder snoozed until ${p.toLocaleTimeString()}`)},h=["Per-rule confidence threshold tuning","Smart negative conditions (exclusion logic)","Template improvements with zero-config UX"];return r?o.jsx("div",{className:"fixed top-16 left-1/2 -translate-x-1/2 z-50 animate-in slide-in-from-top-5",children:o.jsxs("button",{onClick:()=>i(!1),className:"flex items-center gap-2 px-3 py-2 bg-yellow-500 text-yellow-950 rounded-full shadow-lg hover:bg-yellow-400 transition-colors text-sm font-medium",children:[o.jsx(ea,{className:"h-4 w-4"}),o.jsx("span",{children:"Database updates available"})]})}):o.jsx("div",{className:"fixed top-0 left-0 right-0 z-50 animate-in slide-in-from-top-5",children:o.jsx("div",{className:"bg-gradient-to-r from-yellow-500 to-orange-500 text-yellow-950 px-4 py-3 shadow-lg",children:o.jsx("div",{className:"max-w-7xl mx-auto",children:o.jsxs("div",{className:"flex items-start gap-4",children:[o.jsx(ea,{className:"h-6 w-6 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-base",children:"⚠️ Database Updates Available"}),o.jsx("p",{className:"text-sm opacity-90 mt-0.5",children:"New features ready: Per-rule confidence, Smart exclusions, Zero-config templates"})]}),o.jsxs(Z,{size:"icon",variant:"ghost",className:"h-6 w-6 text-yellow-950 hover:bg-yellow-600/30",onClick:()=>i(!0),children:[o.jsx(wg,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Minimize"})]})]}),l&&o.jsxs("div",{className:"bg-yellow-950/20 rounded-md p-3 space-y-2",children:[o.jsx("p",{className:"text-xs font-medium",children:"What's new:"}),o.jsx("ul",{className:"text-xs space-y-1 ml-4",children:h.map((m,p)=>o.jsxs("li",{children:["• ",m]},p))})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Z,{size:"sm",className:"h-8 bg-yellow-950 hover:bg-yellow-900 text-yellow-50",onClick:n,children:"Run Now"}),o.jsxs(Z,{size:"sm",variant:"outline",className:"h-8 border-yellow-950 text-yellow-950 hover:bg-yellow-950/10",onClick:()=>d(1),children:[o.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Remind in 1 Hour"]}),o.jsxs(Z,{size:"sm",variant:"outline",className:"h-8 border-yellow-950 text-yellow-950 hover:bg-yellow-950/10",onClick:()=>d(24),children:[o.jsx(yd,{className:"h-3 w-3 mr-1"}),"Remind Tomorrow"]}),o.jsx(Z,{size:"sm",variant:"ghost",className:"h-8 text-yellow-950 hover:bg-yellow-950/10",onClick:()=>u(!l),children:l?o.jsxs(o.Fragment,{children:[o.jsx(aj,{className:"h-3 w-3 mr-1"}),"Hide Details"]}):o.jsxs(o.Fragment,{children:[o.jsx(Wl,{className:"h-3 w-3 mr-1"}),"What's Changing?"]})})]})]})]})})})})}function w$({open:e,onOpenChange:t,status:n,onSnooze:r}){const i=fo(),l=_=>{const S=new Date(Date.now()+_*60*60*1e3);r?.(S),le.success(`Reminder snoozed until ${S.toLocaleTimeString()}`),t(!1)},[u,d]=w.useState(!1),[h,m]=w.useState([]),[p,g]=w.useState(""),v=w.useRef(null),b=w.useMemo(()=>{const _=i?.url;if(!_)return"";try{return new URL(_).hostname.split(".")[0]||""}catch{return""}},[i?.url]);w.useEffect(()=>{v.current&&v.current.scrollIntoView({behavior:"smooth"})},[h]);const j=async()=>{if(!b){le.error("Missing Project ID");return}if(!p){le.error("Provide a Supabase Personal Access Token.");return}d(!0),m(["Initializing migration..."]);try{const _=async T=>{const D=new TextDecoder;let L="",O=null;const B=M=>{const q=M.trim();if(!(!q||!q.startsWith("data: ")))try{const R=q.substring(6),J=JSON.parse(R);J.type==="done"?(J.data==="success"||J.data==="failed")&&(O=J.data==="success"?"success":"failure"):J.data&&m(K=>[...K,J.data])}catch(R){console.error("Failed to parse SSE line:",q,R)}};for(;;){const{done:M,value:q}=await T.read();if(M)break;L+=D.decode(q,{stream:!0});const R=L.split(`
217
+ `);L=R.pop()||"",R.forEach(B)}return L+=D.decode(),L&&B(L),O};m(T=>[...T,"","📦 Database Migration & Edge Functions Deployment"]);const S=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:b,accessToken:p})});if(!S.ok)throw new Error(`Migration failed: ${S.status} ${S.statusText}`);const N=S.body?.getReader();if(!N)throw new Error("No migration response stream received.");if(await _(N)!=="success")throw new Error("Migration did not complete successfully");m(T=>[...T,"","═".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(_){console.error(_),m(S=>[...S,"",`❌ Error: ${_ instanceof Error?_.message:String(_)}`]),le.error("Setup failed. Check logs for details.")}finally{d(!1)}};return o.jsx(os,{open:e,onOpenChange:_=>!u&&t(_),children:o.jsxs(ls,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(fr,{children:[o.jsxs(bs,{className:"flex items-center gap-2 text-xl",children:[o.jsx(ea,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Setup Required"]}),o.jsxs(hr,{children:["Your application version (",n.appVersion,") requires database migration and Edge Functions deployment to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(La,{children:[o.jsx(ro,{className:"h-4 w-4"}),o.jsxs(Ia,{children:[o.jsx("strong",{children:"Why is this needed?"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Updates your database schema to match version ",n.appVersion]}),o.jsx("li",{children:"Deploys Edge Functions (API endpoints) to your Supabase project"}),o.jsx("li",{children:"Enables new features and performance improvements"}),o.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Setup"}),o.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."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Ye,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(De,{id:"project-id",value:b,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(Ye,{htmlFor:"access-token",children:"Access Token"}),o.jsxs("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Generate Token ",o.jsx(Cl,{className:"h-3 w-3"})]})]}),o.jsx(De,{id:"access-token",type:"password",placeholder:"sbp_...",value:p,onChange:_=>g(_.target.value),disabled:u}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This token is used only for this migration and is not stored."})]}),o.jsx(Z,{onClick:j,disabled:u||!p,className:"w-full",children:u?o.jsxs(o.Fragment,{children:[o.jsx(jt,{className:"mr-2 h-4 w-4 animate-spin"}),"Running Setup..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Rl,{className:"mr-2 h-4 w-4"}),"Start Setup"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[h.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):h.map((_,S)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:_},S)),o.jsx("div",{ref:v})]})]}),o.jsxs(La,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(ea,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(Ia,{children:[o.jsx("strong",{children:"Troubleshooting"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Ensure your Access Token has ",o.jsx("code",{children:"read"})," and ",o.jsx("code",{children:"write"})," permissions."]}),o.jsx("li",{children:"Verify that your Supabase Project ID is correct and active."})]})]})]})]}),o.jsx(lr,{className:"flex-col sm:flex-row gap-2",children:o.jsxs("div",{className:"flex gap-2 flex-1",children:[o.jsxs(Z,{type:"button",variant:"outline",onClick:()=>l(1),disabled:u,className:"flex-1 sm:flex-initial",children:[o.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Remind in 1 Hour"]}),o.jsxs(Z,{type:"button",variant:"outline",onClick:()=>l(24),disabled:u,className:"flex-1 sm:flex-initial",children:[o.jsx(yd,{className:"h-4 w-4 mr-2"}),"Remind Tomorrow"]})]})})]})})}const S$="https://registry.npmjs.org/@realtimex/email-automator/latest",j$=300*1e3,M2="email_automator_last_version_check",P2="email_automator_update_dismissed";function k$(){return"2.24.0"}async function _$(){try{const e=await fetch(S$,{cache:"no-store"});return e.ok?(await e.json()).version||null:(console.warn("[Version Check] Failed to fetch latest version"),null)}catch(e){return console.error("[Version Check] Error fetching latest version:",e),null}}function N$(e,t){if(t==="unknown")return!1;const n=m=>m.replace(/^v/,"").split(".").map(g=>parseInt(g,10)||0),[r,i,l]=n(e),[u,d,h]=n(t);return u>r?!0:u<r?!1:d>i?!0:d<i?!1:h>l}function T$(){try{const e=localStorage.getItem(M2);if(!e)return!0;const t=new Date(e).getTime();return Date.now()-t>j$}catch{return!0}}function E$(){try{localStorage.setItem(M2,new Date().toISOString())}catch(e){console.error("[Version Check] Error saving check timestamp:",e)}}function C$(e=24){try{const t=localStorage.getItem(P2);if(!t)return!1;const n=new Date(t).getTime();return(Date.now()-n)/(1e3*60*60)<e}catch{return!1}}function A$(){try{localStorage.setItem(P2,new Date().toISOString())}catch(e){console.error("[Version Check] Error dismissing update prompt:",e)}}async function R$(){if(!T$())return console.log("[Version Check] Skipping (throttled)"),null;const e=k$(),t=await _$();if(E$(),!t)return console.warn("[Version Check] Could not determine latest version"),null;const n=N$(e,t);return console.log("[Version Check]",{current:e,latest:t,updateAvailable:n}),n?{current:e,latest:t,updateAvailable:!0,updateUrl:"https://github.com/realtimex/email-automator/releases/latest"}:null}function D$(){typeof window<"u"&&window.location.reload(),window.electron?.ipcRenderer&&window.electron.ipcRenderer.send("restart-app")}function O$({versionInfo:e,onDismiss:t}){const[n,r]=w.useState(!0),[i,l]=w.useState(!1);if(!n)return null;const u=()=>{A$(),r(!1),t?.()},d=()=>{l(!0),setTimeout(()=>{D$()},500)},h=()=>{e.updateUrl&&window.open(e.updateUrl,"_blank")};return o.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:o.jsx("div",{className:"rounded-lg border border-blue-500 bg-blue-50 p-4 shadow-lg dark:bg-blue-950/90 dark:border-blue-600",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Jt,{className:"h-5 w-5 flex-shrink-0 text-blue-600 dark:text-blue-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"Update Available"}),o.jsxs(Z,{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:u,children:[o.jsx(fn,{className:"h-3 w-3"}),o.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),o.jsxs("p",{className:"text-xs text-blue-800 dark:text-blue-200",children:["Version ",e.latest," is now available (you're on ",e.current,")"]}),o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsx(Z,{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:d,disabled:i,children:i?o.jsxs(o.Fragment,{children:[o.jsx(Jt,{className:"h-3 w-3 mr-1 animate-spin"}),"Updating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Update Now"]})}),e.updateUrl&&o.jsxs(Z,{size:"sm",variant:"ghost",className:"h-7 text-xs text-blue-900 hover:bg-blue-100 dark:text-blue-100 dark:hover:bg-blue-900/30",onClick:h,children:[o.jsx(Cl,{className:"h-3 w-3 mr-1"}),"What's New"]}),o.jsx(Z,{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:u,children:"Later"})]})]})]})})})}function M$(){const{t:e}=nt(),[t,n]=w.useState([]),{isExpanded:r,setIsExpanded:i}=Zj(),{state:l,actions:u}=Tn(),{isSyncing:d}=l,[h,m]=w.useState({});w.useEffect(()=>{p();const S=xt.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},N=>{const C=N.new;C.event_type==="error"&&m(T=>({...T,[C.id]:!0})),n(T=>{const D=[C,...T];return C.details?.is_completion&&r&&setTimeout(()=>{i(!1)},3e3),D.length>100?D.slice(0,100):D})}).subscribe();return()=>{xt.removeChannel(S)}},[r,i]);const p=async()=>{const{data:S}=await xt.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);S&&n(S)},g=S=>{m(N=>({...N,[S]:!N[S]}))},v=S=>{if(S.details?.is_completion)return o.jsx(Qu,{className:"w-3 h-3 text-emerald-500"});switch(S.event_type){case"analysis":return o.jsx(Zr,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(ao,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(ea,{className:"w-3 h-3 text-red-500"});default:return o.jsx(ro,{className:"w-3 h-3 text-blue-500"})}},b=S=>new Date(S).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),j=S=>{const N=`terminal.state.${S.toLowerCase().replace(/\s+/g,"_")}`,C=e(N);return C.startsWith("terminal.state.")?S:C},_=S=>{if(!S)return"";if(S.startsWith("Background processing: ")){const C=S.replace("Background processing: ","");return e("terminal.message.background_processing").replace("{subject}",C)}const N=S.match(/^(\d+) rule\(s\) apply: (.+)$/);if(N){const[,C,T]=N;return e("terminal.message.rules_apply").replace("{count}",C).replace("{rules}",T)}if(S.startsWith("After conflict resolution: ")){const C=S.replace("After conflict resolution: ","");return e("terminal.message.conflict_resolution").replace("{actions}",C)}if(S.startsWith("Analyzing email: ")){const C=S.replace("Analyzing email: ","");return e("terminal.message.analyzing_email").replace("{subject}",C)}if(S.startsWith("Context-aware analysis: ")){const C=S.replace("Context-aware analysis: ","");return e("terminal.message.context_aware_analysis").replace("{subject}",C)}return S==="Generating customized draft based on rule"?e("terminal.message.generating_draft"):S};return r?o.jsxs(Ge,{className:"fixed bottom-4 right-4 z-50 w-[550px] h-[650px] flex flex-col shadow-2xl border-border bg-background/95 text-foreground backdrop-blur-md animate-in slide-in-from-bottom-10",children:[o.jsxs(Mt,{className:"py-3 px-4 border-b border-border flex flex-row items-center justify-between sticky top-0 bg-background/95 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Rl,{className:"w-4 h-4 text-primary"}),o.jsx($t,{className:"text-sm font-mono font-bold",children:e("terminal.title")}),o.jsxs("div",{className:pe("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded-full border font-bold animate-pulse transition-colors duration-500",d?"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:[o.jsx(mC,{className:"w-3 h-3"}),e(d?"terminal.syncing":"terminal.live")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d&&o.jsxs(Z,{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:()=>u.stopSync(),children:[o.jsx(CR,{className:"w-3 h-3 mr-1 fill-current"}),e("terminal.stopSync")]}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>n([]),children:e("terminal.clear")}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>i(!1),children:o.jsx(wg,{className:"w-4 h-4"})})]})]}),o.jsxs(wt,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[t.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:e("terminal.waiting")}),t.map((S,N)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[N!==t.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:pe("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",S.event_type==="error"&&"border-red-500/50 bg-red-500/5",S.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",S.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5",S.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:v(S)}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between group",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:pe("font-bold uppercase tracking-tight text-[10px]",S.event_type==="info"&&"text-muted-foreground",S.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",S.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",S.event_type==="error"&&"text-red-600 dark:text-red-400"),children:j(S.agent_state)}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:b(S.created_at)})]}),(S.details?.system_prompt||S.details?._raw_response||S.details?.raw_response)&&o.jsxs(Z,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[9px] text-muted-foreground hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>g(S.id),children:[h[S.id]?o.jsx(aj,{className:"w-3 h-3 mr-1"}):o.jsx(Wl,{className:"w-3 h-3 mr-1"}),e("terminal.details")]})]}),S.event_type==="analysis"&&S.details?o.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:pe("px-1.5 py-0.5 rounded text-[9px] font-bold border",S.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:S.details.is_useless?e("terminal.useless"):e("terminal.relevant")}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:S.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',S.details.summary,'"']}),S.details.suggested_actions&&S.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:S.details.suggested_actions.map(C=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20 uppercase",children:[o.jsx(ao,{className:"w-2.5 h-2.5"}),C]},C))}),S.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:[e("terminal.tokens").replace("{promptTokens}",String(S.details.usage.prompt_tokens)).replace("{completionTokens}",String(S.details.usage.completion_tokens))," = ",o.jsx("span",{className:"text-purple-500 font-bold",children:S.details.usage.total_tokens})]})})]}):S.event_type==="action"&&S.details?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[o.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:e("terminal.executionComplete")}),o.jsxs("p",{className:"text-foreground font-medium",children:[S.details.action==="delete"&&e("terminal.action.delete"),S.details.action==="archive"&&e("terminal.action.archive"),S.details.action==="draft"&&e("terminal.action.draft"),S.details.action==="star"&&e("terminal.action.star"),!["delete","archive","draft","star"].includes(S.details.action)&&S.details.action]}),S.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(ro,{className:"w-3 h-3"}),S.details.reason]})]}):S.event_type==="error"&&S.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof S.details.error=="object"?S.details.error.message||JSON.stringify(S.details.error):S.details.error}):S.details?.is_completion?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[o.jsx(Qu,{className:"w-3.5 h-3.5"}),e("terminal.batchFinished")]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:e("terminal.processed")}),o.jsx("p",{className:"text-sm font-bold",children:S.details.total_processed||0})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:e("terminal.actions")}),o.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(S.details.deleted||0)+(S.details.drafted||0)})]})]}),S.details.errors>0&&o.jsx("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:e("terminal.itemsFailed").replace("{count}",String(S.details.errors))})]}):S.agent_state==="Rule Evaluation"&&S.details?o.jsxs("div",{className:"bg-blue-500/5 border border-blue-500/10 rounded-lg p-3 space-y-3",children:[S.details.ai_analysis&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"text-[9px] font-bold text-blue-600 dark:text-blue-400 uppercase tracking-widest",children:"AI Analysis"}),o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:S.details.ai_analysis.category}),o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20",children:["Confidence: ",(S.details.ai_analysis.confidence*100).toFixed(0),"%"]}),o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20",children:["Age: ",S.details.ai_analysis.email_age_days," days"]})]})]}),S.details.rule_evaluations&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-[9px] font-bold text-muted-foreground uppercase tracking-widest",children:["Rules Evaluated (",S.details.rule_evaluations.length,")"]}),o.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto custom-scrollbar",children:S.details.rule_evaluations.map((C,T)=>o.jsxs("div",{className:pe("p-2 rounded border text-[10px]",C.result==="MATCHED"?"bg-emerald-500/5 border-emerald-500/20":"bg-muted/50 border-border"),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"font-bold text-foreground",children:C.rule_name}),o.jsx("span",{className:pe("px-1.5 py-0.5 rounded text-[8px] font-bold uppercase",C.result==="MATCHED"?"bg-emerald-500/20 text-emerald-600 dark:text-emerald-400":"bg-red-500/20 text-red-600 dark:text-red-400"),children:C.result==="MATCHED"?"✓ Matched":"✗ Failed"})]}),C.result==="MATCHED"?o.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[o.jsxs("p",{children:["Confidence: ",(C.confidence*100).toFixed(0),"%"]}),C.reasoning&&o.jsxs("p",{className:"italic",children:['"',C.reasoning,'"']})]}):o.jsx("ul",{className:"space-y-0.5 text-muted-foreground list-disc list-inside",children:C.reasons?.map((D,L)=>o.jsx("li",{className:"text-red-600 dark:text-red-400",children:D},L))})]},T))})]})]}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:_(S.details?.message)||JSON.stringify(S.details)}),h[S.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[S.details?.system_prompt&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Os,{className:"w-3 h-3"})," ",e("terminal.detail.systemPrompt")]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:S.details.system_prompt})})]}),S.details?.content_preview&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Os,{className:"w-3 h-3"})," ",e("terminal.detail.inputContent")]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:o.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:S.details.content_preview})})]}),S.details?._raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Os,{className:"w-3 h-3"})," ",e("terminal.detail.rawLLMOutput")]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:(()=>{try{return JSON.stringify(JSON.parse(S.details._raw_response),null,2)}catch{return S.details._raw_response}})()})})]}),S.details?.raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Os,{className:"w-3 h-3"})," ",e("terminal.detail.rawResponse")]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof S.details.raw_response=="object"?JSON.stringify(S.details.raw_response,null,2):S.details.raw_response})})]})]})]})]},S.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(Z,{onClick:()=>i(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Rl,{className:"w-4 h-4 mr-2"}),e("terminal.liveActivity"),(t.length>0||d)&&o.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[o.jsx("span",{className:pe("animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",d?"bg-red-400":"bg-green-400")}),o.jsx("span",{className:pe("relative inline-flex rounded-full h-2 w-2",d?"bg-red-500":"bg-green-500")})]})]})})}const Iy=w.createContext(null),z2=w.forwardRef(({className:e,defaultValue:t,value:n,onValueChange:r,...i},l)=>{const[u,d]=w.useState(t||""),h=n!==void 0?n:u,m=w.useCallback(p=>{r&&r(p),n===void 0&&d(p)},[r,n]);return o.jsx(Iy.Provider,{value:{value:h,onValueChange:m},children:o.jsx("div",{ref:l,className:e,...i})})});z2.displayName="Tabs";const L2=w.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:pe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));L2.displayName="TabsList";const fg=w.forwardRef(({className:e,value:t,onClick:n,...r},i)=>{const l=w.useContext(Iy);if(!l)throw new Error("TabsTrigger must be used within Tabs");const u=l.value===t;return o.jsx("button",{ref:i,type:"button",role:"tab","aria-selected":u,"data-state":u?"active":"inactive",className:pe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),onClick:d=>{l.onValueChange(t),n?.(d)},...r})});fg.displayName="TabsTrigger";const hg=w.forwardRef(({className:e,value:t,...n},r)=>{const i=w.useContext(Iy);if(!i)throw new Error("TabsContent must be used within Tabs");return i.value!==t?null:o.jsx("div",{ref:r,role:"tabpanel","data-state":"active",className:pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})});hg.displayName="TabsContent";const P$=()=>{const[e,t]=w.useState(null),[n,r]=w.useState(!0),i=w.useCallback(async()=>{try{const h=(await Re.getLearningMetrics()).data;t(h?{total_classifications:h.total_classifications||0,correct_classifications:h.correct_classifications||0,drafts_generated:h.drafts_generated||0,drafts_edited:h.drafts_edited||0,category_patterns:h.category_patterns||{},vip_senders:h.vip_senders||[]}:{total_classifications:0,correct_classifications:0,drafts_generated:0,drafts_edited:0,category_patterns:{},vip_senders:[]})}catch(d){console.error("Failed to load learning metrics",d)}finally{r(!1)}},[]);if(w.useEffect(()=>{i()},[i]),n)return o.jsxs("div",{className:"p-8 text-center text-muted-foreground flex items-center justify-center gap-2",children:[o.jsx(Zr,{className:"w-5 h-5 animate-pulse text-primary"})," Loading AI DNA..."]});if(!e)return null;const l=e.total_classifications>0?Math.round(e.correct_classifications/e.total_classifications*100):100,u=Math.round(e.drafts_generated*5);return e.drafts_generated>0&&Math.round((e.drafts_generated-e.drafts_edited)/e.drafts_generated*100),o.jsxs("div",{className:"space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(Ge,{children:[o.jsxs(Mt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx($t,{className:"text-sm font-medium",children:"AI Accuracy"}),o.jsx(Zr,{className:"h-4 w-4 text-primary"})]}),o.jsxs(wt,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[l,"%"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Classification confidence"}),o.jsx(Ly,{value:l,className:"mt-3 h-2"})]})]}),o.jsxs(Ge,{children:[o.jsxs(Mt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx($t,{className:"text-sm font-medium",children:"Time Saved"}),o.jsx(qR,{className:"h-4 w-4 text-green-500"})]}),o.jsxs(wt,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[u,"m"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Est. minutes saved drafting"})]})]}),o.jsxs(Ge,{children:[o.jsxs(Mt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx($t,{className:"text-sm font-medium",children:"Learned Patterns"}),o.jsx(Sg,{className:"h-4 w-4 text-blue-500"})]}),o.jsxs(wt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:Object.keys(e.category_patterns).length}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Domain rules learned"})]})]}),o.jsxs(Ge,{children:[o.jsxs(Mt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx($t,{className:"text-sm font-medium",children:"VIP Network"}),o.jsx(op,{className:"h-4 w-4 text-yellow-500"})]}),o.jsxs(wt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:e.vip_senders.length}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"High-priority contacts"})]})]})]}),o.jsxs(z2,{defaultValue:"patterns",className:"w-full",children:[o.jsxs(L2,{children:[o.jsx(fg,{value:"patterns",children:"Domain Patterns"}),o.jsx(fg,{value:"vips",children:"VIP Senders"})]}),o.jsx(hg,{value:"patterns",className:"space-y-4 pt-4",children:o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsx($t,{className:"text-lg",children:"Learned Categorization Rules"}),o.jsx(xs,{children:"The AI automatically learns to classify emails from these domains based on your corrections."})]}),o.jsx(wt,{children:o.jsx("div",{className:"space-y-4",children:Object.entries(e.category_patterns).length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground border border-dashed rounded-lg bg-secondary/10",children:[o.jsx(ao,{className:"h-10 w-10 mb-4 opacity-50"}),o.jsx("p",{children:"No patterns learned yet."}),o.jsx("p",{className:"text-xs mt-1",children:"Correct some email categories in the Dashboard to teach the AI!"})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(e.category_patterns).map(([d,h])=>o.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500"}),o.jsx("span",{className:"font-mono text-sm",children:d})]}),o.jsx(El,{variant:"secondary",className:"capitalize",children:h})]},d))})})})]})}),o.jsx(hg,{value:"vips",className:"pt-4",children:o.jsxs(Ge,{children:[o.jsxs(Mt,{children:[o.jsx($t,{className:"text-lg",children:"Identified VIP Senders"}),o.jsx(xs,{children:"Contacts that are automatically flagged as High Priority."})]}),o.jsx(wt,{children:o.jsx("div",{className:"space-y-4",children:e.vip_senders.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground border border-dashed rounded-lg bg-secondary/10",children:[o.jsx(WR,{className:"h-10 w-10 mb-4 opacity-50"}),o.jsx("p",{children:"No VIPs identified yet."}),o.jsx("p",{className:"text-xs mt-1",children:"Interacting frequently with contacts will elevate them to VIP status."})]}):o.jsx("div",{className:"flex flex-wrap gap-2",children:e.vip_senders.map(d=>o.jsxs(El,{variant:"outline",className:"pl-1 pr-3 py-1.5 text-sm flex items-center gap-2 bg-secondary/20",children:[o.jsx("div",{className:"w-5 h-5 rounded-full bg-yellow-500/10 flex items-center justify-center",children:o.jsx(op,{className:"w-3 h-3 text-yellow-500 fill-yellow-500"})}),d]},d))})})})]})})]})]})},I2=w.forwardRef(({className:e,...t},n)=>o.jsx("span",{ref:n,className:pe("absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0","[clip:rect(0,0,0,0)]",e),...t}));I2.displayName="VisuallyHidden";function z$(e={}){const[t,n]=w.useState(!1),[r,i]=w.useState(""),[l,u]=w.useState(""),[d,h]=w.useState(!1),m=w.useRef(null);w.useEffect(()=>{const b=window.SpeechRecognition||window.webkitSpeechRecognition;return h(!!b),b&&(m.current=new b,m.current.continuous=e.continuous??!1,m.current.interimResults=e.interimResults??!0,m.current.lang=e.lang||"en-US",m.current.onresult=j=>{let _="",S="";for(let N=j.resultIndex;N<j.results.length;N++){const C=j.results[N][0].transcript;j.results[N].isFinal?S+=C:_+=C}S&&i(N=>N+" "+S),u(_)},m.current.onend=()=>{n(!1)},m.current.onerror=j=>{console.error("[SpeechRecognition] Error:",j.error),n(!1)}),()=>{m.current&&m.current.stop()}},[e.continuous,e.interimResults,e.lang]);const p=w.useCallback(()=>{m.current&&!t&&(i(""),u(""),m.current.start(),n(!0))},[t]),g=w.useCallback(()=>{m.current&&t&&(m.current.stop(),n(!1))},[t]),v=w.useCallback(()=>{i(""),u("")},[]);return{isListening:t,transcript:r,interimTranscript:l,isSupported:d,startListening:p,stopListening:g,resetTranscript:v}}const L$=(e,t)=>{const n={setup_wizard:"agent.title.setup",configuration_wizard:"agent.title.configuration",draft_review:"agent.title.drafts",explainer:"agent.title.explainer",global:"agent.title.global"};return n[e]?t(n[e]):t("agent.title.default").replace("{page}",e.replace(/_/g," "))},ZS=(e,t,n)=>{switch(e){case"setup_wizard":return t("agent.intro.setup");case"configuration_wizard":return t("agent.intro.configuration").replace("{accountsCount}",String(n?.accounts_count||0)).replace("{rulesCount}",String(n?.rules_count||0));case"draft_review":{const r=n?.count||0;return t(r===1?"agent.intro.drafts.one":"agent.intro.drafts.other").replace("{count}",String(r))}case"explainer":return t("agent.intro.explainer");case"global":return t("agent.intro.global");default:return t("agent.intro.default").replace("{page}",e.replace(/_/g," "))}};function Fu({className:e}){const{currentConfig:t,chatHistory:n,agentState:r,sendMessage:i}=$_(),{state:l}=Tn(),{speak:u}=dy(),{speakingId:d,stop:h}=V_(),{t:m}=nt(),[p,g]=w.useState(!1),[v,b]=w.useState(""),[j,_]=w.useState(!1),[S,N]=w.useState(!1),C=w.useRef(null),T=w.useRef(t.page_id),{isListening:D,transcript:L,interimTranscript:O,isSupported:B,startListening:M,stopListening:q,resetTranscript:R}=z$({continuous:!1,interimResults:!0});w.useEffect(()=>{const V=()=>{try{const P=localStorage.getItem("auto_speak_enabled");return P===null?!0:P==="true"}catch{return!0}},G=p&&n.length===0&&!j&&V(),fe=t.page_id!==T.current;if(G||p&&fe&&n.length===0){const P=ZS(t.page_id,m,t.data),I={provider:l.settings?.tts_provider||void 0,voice:l.settings?.tts_voice||void 0,speed:l.settings?.tts_speed!==void 0?l.settings.tts_speed:1,quality:l.settings?.tts_quality!==void 0?l.settings.tts_quality:10};console.log("[AgentOverlay] Intro speaking with TTS options:",I),u(P,`intro-${t.page_id}`,I),_(!0),T.current=t.page_id}p||_(!1)},[p,n.length,t.page_id,j,u]),w.useEffect(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[n,p]),w.useEffect(()=>{L&&!D&&(b(L.trim()),R())},[L,D,R]),w.useEffect(()=>{D&&(L||O)&&b((L+" "+O).trim())},[L,O,D]);const J=async()=>{if(!v.trim())return;const V=v;b(""),R(),await i(V)},K=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),J())},he=()=>{D?q():M()},se=async(V,G)=>{const fe=`msg-${G}`;if(d===fe){h();return}const P={provider:l.settings?.tts_provider||void 0,voice:l.settings?.tts_voice||void 0,speed:l.settings?.tts_speed!==void 0?l.settings.tts_speed:1,quality:l.settings?.tts_quality!==void 0?l.settings.tts_quality:10};console.log("[AgentOverlay] Speaking with TTS options:",P),await u(V,fe,P)},ie={p:({children:V})=>o.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:V}),ul:({children:V})=>o.jsx("ul",{className:"list-disc pl-4 space-y-1 text-sm",children:V}),ol:({children:V})=>o.jsx("ol",{className:"list-decimal pl-4 space-y-1 text-sm",children:V}),li:({children:V})=>o.jsx("li",{className:"text-sm",children:V}),a:({href:V,children:G})=>o.jsx("a",{href:V,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2",children:G}),code:V=>{const{inline:G,children:fe}=V;return G?o.jsx("code",{className:"px-1 py-0.5 rounded bg-background/60 text-[12px] font-mono",children:fe}):o.jsx("code",{className:"text-[12px] font-mono",children:fe})},pre:({children:V})=>o.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-background/60 p-2 text-[12px] font-mono",children:V}),blockquote:({children:V})=>o.jsx("blockquote",{className:"border-l-2 border-border pl-3 text-sm text-muted-foreground",children:V}),strong:({children:V})=>o.jsx("strong",{className:"font-semibold",children:V}),em:({children:V})=>o.jsx("em",{className:"italic",children:V})},$=pe("fixed bottom-6 left-6 z-50",e);return o.jsxs(o.Fragment,{children:[p&&o.jsx("div",{className:$,children:o.jsxs("div",{className:pe(S?"w-[calc(100vw-2rem)] sm:w-[33vw] sm:max-w-[560px] h-[90vh] max-h-[calc(100vh-6rem)]":"w-[360px] sm:w-[380px] h-[520px] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-6rem)]","bg-background border border-border/60 rounded-2xl shadow-2xl","flex flex-col overflow-hidden","animate-in slide-in-from-bottom-10 fade-in duration-200","transition-[width,height] duration-200 ease-out","motion-reduce:transition-none motion-reduce:animate-none"),children:[o.jsxs("div",{className:"p-3 border-b bg-muted/40 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:pe("w-2.5 h-2.5 rounded-full",D?"bg-red-500 animate-pulse":r==="idle"?"bg-muted-foreground":r==="thinking"?"bg-yellow-500 animate-pulse":r==="speaking"?"bg-emerald-500 animate-pulse":"bg-red-500")}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"font-semibold text-sm leading-tight",children:D?m("agent.status.listening"):L$(t.page_id,m)}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:m(r==="thinking"?"agent.status.analyzing":r==="speaking"?"agent.status.speaking":"agent.status.ready")})]})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(V=>!V),"aria-label":S?"Collapse assistant":"Expand assistant",title:S?"Collapse":"Expand",children:S?o.jsx(wg,{className:"w-4 h-4"}):o.jsx(oj,{className:"w-4 h-4"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(!1),"aria-label":"Close assistant",children:o.jsx(fn,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{ref:C,className:"flex-1 overflow-y-auto p-4 space-y-4 bg-background",children:[n.length===0&&o.jsx("div",{className:"text-center text-muted-foreground text-xs mt-10 whitespace-pre-line",children:ZS(t.page_id,m,t.data)}),n.map((V,G)=>{const fe=`msg-${G}`,P=d===fe,I=V.role!=="user";return o.jsx("div",{className:pe("flex flex-col max-w-[85%] rounded-2xl p-3 text-sm relative group",V.role==="user"?"self-end bg-primary/10 text-foreground ml-auto rounded-br-md":"self-start bg-secondary text-secondary-foreground rounded-bl-md"),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("div",{className:"flex-1",children:V.role==="user"?V.content:o.jsx(l2,{remarkPlugins:[D2],components:ie,children:V.content})}),I&&o.jsx("button",{onClick:()=>se(V.content,G),className:pe("shrink-0 p-1.5 rounded-md hover:bg-background/60 transition-colors","opacity-0 group-hover:opacity-100",P&&"opacity-100"),title:P?"Stop speaking":"Speak message",children:P?o.jsx(kg,{className:"w-3.5 h-3.5 text-muted-foreground animate-pulse"}):o.jsx(Dl,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})},G)}),r==="thinking"&&o.jsxs("div",{className:"self-start bg-secondary/50 rounded-lg p-3 flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 bg-foreground/40 rounded-full animate-bounce [animation-delay:-0.3s]"}),o.jsx("span",{className:"w-1.5 h-1.5 bg-foreground/40 rounded-full animate-bounce [animation-delay:-0.15s]"}),o.jsx("span",{className:"w-1.5 h-1.5 bg-foreground/40 rounded-full animate-bounce"})]}),D&&o.jsxs("div",{className:"self-start bg-red-500/10 border border-red-500/30 rounded-lg p-4 flex flex-col gap-2 animate-pulse",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(K0,{className:"w-4 h-4 text-red-500 animate-pulse"}),o.jsx("span",{className:"text-xs font-semibold text-red-500",children:m("agent.recording")})]}),o.jsx("div",{className:"flex items-center justify-center gap-1 h-8",children:[...Array(12)].map((V,G)=>o.jsx("div",{className:"w-1 bg-red-500 rounded-full animate-pulse",style:{height:`${20+Math.sin(G)*15}px`,animationDelay:`${G*.1}s`,animationDuration:"0.8s"}},G))}),O&&o.jsxs("div",{className:"text-xs text-muted-foreground italic",children:['"',O,'..."']})]})]}),o.jsxs("div",{className:"p-3 border-t bg-background flex gap-2",children:[o.jsx("input",{className:"flex-1 bg-secondary/40 border border-border/50 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-primary/40 outline-none",placeholder:m(D?"agent.composer.listening":"agent.composer.placeholder"),value:v,onChange:V=>b(V.target.value),onKeyDown:K,disabled:r==="thinking"||r==="speaking"||D}),B&&o.jsx(Z,{size:"icon",variant:D?"default":"outline",className:pe("h-9 w-9 shrink-0",D&&"bg-red-500 hover:bg-red-600 animate-pulse"),onClick:he,disabled:r==="thinking"||r==="speaking","aria-label":D?"Stop listening":"Start listening",children:D?o.jsx(YA,{className:"w-4 h-4"}):o.jsx(K0,{className:"w-4 h-4"})}),o.jsx(Z,{size:"icon",className:"h-9 w-9 shrink-0",onClick:J,disabled:!v.trim()||r==="thinking"||D,"aria-label":"Send message",children:r==="thinking"?o.jsx(jt,{className:"w-4 h-4 animate-spin"}):o.jsx(Xl,{className:"w-4 h-4"})})]})]})}),o.jsx("div",{className:$,children:o.jsx(Z,{size:"icon",className:pe("relative rounded-full h-11 w-11 border border-border/60 bg-primary text-primary-foreground shadow-md","transition-all duration-200 ease-out","hover:bg-primary/90 hover:shadow-lg hover:-translate-y-0.5","active:translate-y-0 active:shadow-md active:scale-95","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background","motion-reduce:transition-none motion-reduce:hover:transform-none",p?"rotate-0 scale-0 opacity-0":"scale-100 opacity-100",r==="speaking"&&"ring-4 ring-emerald-500/30 animate-pulse"),onClick:()=>g(!0),"aria-label":"Open assistant chat",title:"Open assistant chat",children:r==="speaking"?o.jsx(Dl,{className:"w-5 h-5 animate-pulse"}):o.jsx(bd,{className:"w-5 h-5"})})})]})}function I$(){const{state:e,isSubscribed:t,actions:n}=Tn(),{t:r}=nt(),[i,l]=w.useState(null),[u,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(!0),[v,b]=w.useState("dashboard"),[j,_]=w.useState(!1),[S,N]=w.useState(null),[C,T]=w.useState(!1),[D,L]=w.useState(!1),[O,B]=w.useState(!1),[M,q]=w.useState(()=>{const ee=localStorage.getItem("migration_snoozed_until");return ee?new Date(ee):null}),[R,J]=w.useState(null),[K,he]=w.useState(!1),[se,ie]=w.useState(null),[$,V]=w.useState(!1),[G,fe]=w.useState(!1);if(w.useEffect(()=>{if(e.isInitialized&&e.isAuthenticated&&e.settings&&!e.isLoading&&!e.settings.persona_completed&&!$&&!G){const ee=setTimeout(()=>{V(!0)},2e3);return()=>clearTimeout(ee)}},[e.isInitialized,e.isAuthenticated,e.settings,e.isLoading,G]),w.useEffect(()=>{const ge=new URLSearchParams(window.location.search).get("code");ge&&!j&&(async()=>{_(!0);try{const ue=await Re.connectGmail(ge);if(ue.data?.success)le.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),n.fetchAccounts());else{const ke=typeof ue.error=="string"?ue.error:ue.error?.message;le.error(ke||"Failed to connect Gmail")}}catch{le.error("Connection failed")}finally{_(!1)}})()},[]),j)return o.jsx(rd,{text:r("app.connecting")});w.useEffect(()=>{(async()=>{if(!fo()){m(!0),d(!1);return}try{const{data:ke,error:Ne}=await xt.from("init_state").select("is_initialized").single();Ne?(console.warn("[App] Init check error (might be fresh DB):",Ne),Ne.code==="42P01"&&g(!1)):g(ke.is_initialized>0);const{data:{session:Ie}}=await xt.auth.getSession();if(l(Ie?.user??null),Ie?.user){const Pt=await hy(xt);if(N(Pt.needsMigration?Pt:null),Pt.needsMigration){const Ee=localStorage.getItem("migration_snoozed_until"),Ct=Ee?new Date(Ee):null;(!Ct||new Date>Ct)&&T(!0)}}const rt=await R$();rt&&!C$()&&(J(rt),he(!0))}catch(ke){console.error("[App] Status check failed:",ke),ke instanceof Error&&ke.message.includes("Invalid API key")&&m(!0)}finally{d(!1)}})();const{data:{subscription:ge}}=xt.auth.onAuthStateChange((ue,ke)=>{l(ke?.user??null),ke||(N(null),T(!1))}),ye=()=>{if(Ms.isEnabled()){const ue=new(window.AudioContext||window.webkitAudioContext);ue.state==="suspended"&&ue.resume()}window.removeEventListener("click",ye),window.removeEventListener("keydown",ye)};return window.addEventListener("click",ye),window.addEventListener("keydown",ye),()=>{ge.unsubscribe(),window.removeEventListener("click",ye),window.removeEventListener("keydown",ye)}},[]),w.useEffect(()=>{if(i){n.fetchAccounts(),n.fetchRules(),n.fetchSettings(),n.fetchProfile();const ee=setTimeout(()=>{console.debug("[App] Retrying fetchAccounts after initialization"),n.fetchAccounts()},1e3);return()=>clearTimeout(ee)}},[i]),w.useEffect(()=>{const ee=async()=>{try{await Re.healthCheck()}catch{console.warn("[App] Keep-alive ping failed")}};ee();const ge=setInterval(ee,3e4);return()=>clearInterval(ge)},[]);const P=()=>{L(!0),T(!1)},I=ee=>{q(ee),localStorage.setItem("migration_snoozed_until",ee.toISOString()),T(!1),L(!1)},z=S&&S.needsMigration&&(!M||new Date>M),A={migrationStatus:S,showMigrationBanner:C,showMigrationModal:D,openMigrationModal:P,suppressMigrationBanner:O,setSuppressMigrationBanner:B};return u?o.jsxs(o.Fragment,{children:[o.jsx(rd,{text:r("app.loadingWorkspace")}),o.jsx(Fu,{className:"z-[80]"})]}):h?o.jsxs(o.Fragment,{children:[o.jsx(W_,{onComplete:()=>m(!1)}),o.jsx(Fu,{className:"z-[80]"})]}):i?o.jsx(n3,{value:A,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>b("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(my,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:r("app.name")}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:pe("flex items-center gap-1.5 px-2 h-6 rounded-full text-[10px] font-bold border transition-colors",t?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsxs("div",{className:"relative flex items-center justify-center",children:[t&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:pe("relative w-2 h-2 rounded-full",t?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",children:r(t?"app.statusLive":"app.statusOffline")})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(Z,{variant:v==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>b("dashboard"),className:"gap-2",children:[o.jsx(RA,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:r("nav.dashboard")})]}),o.jsxs(Z,{variant:v==="drafts"?"secondary":"ghost",size:"sm",onClick:()=>b("drafts"),className:"gap-2",children:[o.jsx(aA,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:r("nav.drafts")||"Drafts"})]}),o.jsxs(Z,{variant:v==="autopilot"?"secondary":"ghost",size:"sm",onClick:()=>b("autopilot"),className:"gap-2",children:[o.jsx(qu,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:r("nav.autopilot")})]}),o.jsxs(Z,{variant:v==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>b("analytics"),className:"gap-2",children:[o.jsx(yg,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:r("nav.analytics")})]}),o.jsxs(Z,{variant:v==="config"?"secondary":"ghost",size:"sm",onClick:()=>b("config"),className:"gap-2",children:[o.jsx(Al,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:r("nav.configuration")})]})]}),o.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),o.jsx(uy,{}),o.jsx(Cj,{}),o.jsx(Z,{variant:v==="account"?"secondary":"ghost",size:"sm",onClick:()=>b("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:r("nav.accountSettings"),children:e.profile?.avatar_url?o.jsx("img",{src:e.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(HC,{className:"w-5 h-5"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[v==="dashboard"&&o.jsx(pU,{}),v==="drafts"&&o.jsx(wU,{onPreview:ie}),v==="autopilot"&&o.jsx(y$,{}),v==="config"&&o.jsx(Z7,{}),v==="analytics"&&o.jsx(B$,{}),v==="account"&&o.jsx(u$,{})]}),o.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:o.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",o.jsx("span",{className:"mx-1",children:"•"})," v","2.24.0"]})}),e.error&&o.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:o.jsx("p",{className:"text-sm",children:e.error})})}),z&&!O&&o.jsx(b$,{status:S,onSnooze:I,onOpenModal:P}),R&&K&&o.jsx(O$,{versionInfo:R,onDismiss:()=>he(!1)}),S&&o.jsx(w$,{open:D,onOpenChange:L,status:S,onSnooze:I}),se&&o.jsx(X7,{email:se,onClose:()=>ie(null),onSend:async ee=>{ie(null)},onDismiss:async ee=>{(await Re.dismissDraft(ee)).data?.success?(le.success(r("drafts.dismissSuccess")||"Draft dismissed"),ie(null)):le.error(r("drafts.dismissError")||"Failed to dismiss draft")}}),o.jsx(M$,{}),o.jsx(Fu,{}),o.jsx(os,{open:$,onOpenChange:ee=>{ee||fe(!0),V(ee)},children:o.jsxs(ls,{className:"max-w-3xl border-none bg-transparent shadow-none p-0 sm:max-w-3xl",children:[o.jsx(I2,{children:o.jsx(bs,{children:"Persona Setup Wizard"})}),o.jsx(O2,{onComplete:()=>{V(!1),n.fetchSettings()},onClose:()=>{V(!1),fe(!0)}})]})})]})}):o.jsxs(o.Fragment,{children:[o.jsx(v$,{onSuccess:()=>n.fetchProfile(),onConfigure:()=>m(!0),isInitialized:p}),o.jsx(Fu,{className:"z-[80]"})]})}function U$({runId:e,accountEmail:t,isOpen:n,onOpenChange:r}){const{t:i}=nt(),[l,u]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{n&&e&&m()},[n,e]);const m=async()=>{if(e){h(!0);try{const g=await Re.getRunEvents(e);g.data&&u(g.data.events)}catch(g){console.error("Failed to fetch run trace:",g)}finally{h(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Zr,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(ao,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(qn,{className:"w-4 h-4 text-red-500"});default:return o.jsx(ro,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(os,{open:n,onOpenChange:r,children:o.jsxs(ls,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(fr,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xd,{className:"w-5 h-5 text-primary"}),o.jsx(bs,{children:i("trace.runTrace")})]}),o.jsx(hr,{children:t?i("trace.fullLogFor").replace("{email}",t):i("trace.historicalLog")})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:d?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(rd,{text:i("trace.loadingTrace")})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:i("trace.noTraceEvents")}):l.map((g,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(g.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:g.agent_state}),g.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",g.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ls,{className:"w-3 h-3"}),new Date(g.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[g.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),g.event_type==="analysis"&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',g.details?.summary,'"']}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:g.details?.category}),g.details?.suggested_actions?.map(b=>o.jsx("span",{className:"text-[9px] bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-500/20 font-bold uppercase",children:b},b))]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:g.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:g.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:g.details.usage.total_tokens})]})]})]}),g.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:[i("dashboard.done")," ",g.details?.action]}),o.jsx(xg,{className:"w-4 h-4 text-emerald-500"})]}),g.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:g.details?.error})]})]})]},g.id))})]})})}function B$(){const{state:e,actions:t}=Tn(),{t:n}=nt(),[r,i]=w.useState(null),[l,u]=w.useState(void 0),[d,h]=w.useState(!1),[m,p]=w.useState("overview");if(w.useEffect(()=>{t.fetchStats()},[]),!e.stats)return o.jsx(rd,{text:n("common.loading")});const g=(b,j)=>{i(b),u(j),h(!0)},{stats:v}=e;return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(yg,{className:"w-6 h-6 text-primary"}),n("analytics.title")]}),o.jsxs("div",{className:"flex p-1 bg-muted rounded-lg w-full md:w-auto",children:[o.jsx("button",{onClick:()=>p("overview"),className:`flex-1 md:w-32 px-3 py-1.5 text-sm font-medium rounded-md transition-all ${m==="overview"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/50"}`,children:"Overview"}),o.jsxs("button",{onClick:()=>p("learning"),className:`flex-1 md:w-32 px-3 py-1.5 text-sm font-medium rounded-md transition-all flex items-center justify-center gap-2 ${m==="learning"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/50"}`,children:[o.jsx(Zr,{className:"w-3.5 h-3.5"}),"Learning"]})]})]}),m==="learning"?o.jsx(P$,{}):o.jsxs("div",{className:"space-y-8",children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx($u,{title:n("analytics.totalEmails"),value:v.totalEmails,color:"primary"}),o.jsx($u,{title:n("analytics.spamCaught"),value:v.categoryCounts.spam||0,color:"destructive"}),o.jsx($u,{title:n("analytics.actionsTaken"),value:Object.values(v.actionCounts).reduce((b,j)=>b+j,0)-(v.actionCounts.none||0),color:"emerald"}),o.jsx($u,{title:n("analytics.accounts"),value:v.accountCount,color:"blue"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:n("analytics.categories")}),o.jsx("div",{className:"space-y-3",children:Object.entries(v.categoryCounts).map(([b,j])=>o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[o.jsx("span",{className:"capitalize",children:b}),o.jsx("span",{className:"text-muted-foreground",children:j})]}),o.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${j/v.totalEmails*100}%`}})})]})},b))})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:n("analytics.actionsTaken")}),o.jsx("div",{className:"space-y-3",children:Object.entries(v.actionCounts).map(([b,j])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:b}),o.jsx("span",{className:"font-medium",children:j})]},b))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:n("analytics.recentActivity")}),v.recentSyncs.length===0?o.jsx("p",{className:"text-muted-foreground text-sm",children:n("analytics.noActivity")}):o.jsx("div",{className:"space-y-3",children:v.recentSyncs.map(b=>{const j=b.completed_at?Math.round((new Date(b.completed_at).getTime()-new Date(b.started_at).getTime())/1e3):null;return o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>g(b.id,b.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:pe("w-2.5 h-2.5 rounded-full",b.status==="success"?"bg-emerald-500":b.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:b.email_accounts?.email_address||n("common.systemSync")}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ls,{className:"w-3 h-3"}),new Date(b.started_at).toLocaleString(),j!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[j,"s"]})]})]})]}),o.jsx("div",{className:"flex items-center gap-4 text-xs",children:o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsx("span",{className:"font-bold text-primary",children:n("analytics.emails").replace("{count}",b.emails_processed.toString())}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n("analytics.deleted").replace("{count}",b.emails_deleted.toString()),", ",n("analytics.drafted").replace("{count}",b.emails_drafted.toString())]})]})})]},b.id)})})]})]}),o.jsx(U$,{runId:r,accountEmail:l,isOpen:d,onOpenChange:h})]})}function $u({title:e,value:t,color:n}){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 o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:e}),o.jsx("p",{className:`text-3xl font-bold ${r[n]||""}`,children:t})]})}function V$(){return o.jsx(GL,{children:o.jsx(lD,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(a3,{children:o.jsx(r3,{children:o.jsx(KL,{children:o.jsx(YL,{children:o.jsxs(t3,{children:[o.jsx(I$,{}),o.jsx(J5,{})]})})})})})})})}oC.createRoot(document.getElementById("root")).render(o.jsx(ej.StrictMode,{children:o.jsx(V$,{})}));