Files
cruce-cuentas-glm-centralizado/dist/assets/index-Cj1bVpIM.js
T
2026-07-16 18:34:23 +00:00

254 lines
611 KiB
JavaScript

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function s(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function a(l){if(l.ep)return;l.ep=!0;const u=s(l);fetch(l.href,u)}})();var Eh={exports:{}},fr={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ay;function US(){if(Ay)return fr;Ay=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function s(a,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var d in l)d!=="key"&&(u[d]=l[d])}else u=l;return l=u.ref,{$$typeof:n,type:a,key:c,ref:l!==void 0?l:null,props:u}}return fr.Fragment=e,fr.jsx=s,fr.jsxs=s,fr}var Ry;function BS(){return Ry||(Ry=1,Eh.exports=US()),Eh.exports}var b=BS(),Ah={exports:{}},pe={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Cy;function LS(){if(Cy)return pe;Cy=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=w&&E[w]||E["@@iterator"],typeof E=="function"?E:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,k={};function C(E,B,K){this.props=E,this.context=B,this.refs=k,this.updater=K||S}C.prototype.isReactComponent={},C.prototype.setState=function(E,B){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,B,"setState")},C.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function N(){}N.prototype=C.prototype;function O(E,B,K){this.props=E,this.context=B,this.refs=k,this.updater=K||S}var P=O.prototype=new N;P.constructor=O,A(P,C.prototype),P.isPureReactComponent=!0;var J=Array.isArray;function X(){}var G={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function ee(E,B,K){var W=K.ref;return{$$typeof:n,type:E,key:B,ref:W!==void 0?W:null,props:K}}function ne(E,B){return ee(E.type,B,E.props)}function le(E){return typeof E=="object"&&E!==null&&E.$$typeof===n}function de(E){var B={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(K){return B[K]})}var je=/\/+/g;function Re(E,B){return typeof E=="object"&&E!==null&&E.key!=null?de(""+E.key):B.toString(36)}function ke(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(X,X):(E.status="pending",E.then(function(B){E.status==="pending"&&(E.status="fulfilled",E.value=B)},function(B){E.status==="pending"&&(E.status="rejected",E.reason=B)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function L(E,B,K,W,he){var ue=typeof E;(ue==="undefined"||ue==="boolean")&&(E=null);var _e=!1;if(E===null)_e=!0;else switch(ue){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(E.$$typeof){case n:case e:_e=!0;break;case g:return _e=E._init,L(_e(E._payload),B,K,W,he)}}if(_e)return he=he(E),_e=W===""?"."+Re(E,0):W,J(he)?(K="",_e!=null&&(K=_e.replace(je,"$&/")+"/"),L(he,B,K,"",function(_n){return _n})):he!=null&&(le(he)&&(he=ne(he,K+(he.key==null||E&&E.key===he.key?"":(""+he.key).replace(je,"$&/")+"/")+_e)),B.push(he)),1;_e=0;var qe=W===""?".":W+":";if(J(E))for(var He=0;He<E.length;He++)W=E[He],ue=qe+Re(W,He),_e+=L(W,B,K,ue,he);else if(He=x(E),typeof He=="function")for(E=He.call(E),He=0;!(W=E.next()).done;)W=W.value,ue=qe+Re(W,He++),_e+=L(W,B,K,ue,he);else if(ue==="object"){if(typeof E.then=="function")return L(ke(E),B,K,W,he);throw B=String(E),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return _e}function Q(E,B,K){if(E==null)return E;var W=[],he=0;return L(E,W,"","",function(ue){return B.call(K,ue,he++)}),W}function Y(E){if(E._status===-1){var B=E._result;B=B(),B.then(function(K){(E._status===0||E._status===-1)&&(E._status=1,E._result=K)},function(K){(E._status===0||E._status===-1)&&(E._status=2,E._result=K)}),E._status===-1&&(E._status=0,E._result=B)}if(E._status===1)return E._result.default;throw E._result}var I=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},oe={map:Q,forEach:function(E,B,K){Q(E,function(){B.apply(this,arguments)},K)},count:function(E){var B=0;return Q(E,function(){B++}),B},toArray:function(E){return Q(E,function(B){return B})||[]},only:function(E){if(!le(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return pe.Activity=v,pe.Children=oe,pe.Component=C,pe.Fragment=s,pe.Profiler=l,pe.PureComponent=O,pe.StrictMode=a,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,pe.__COMPILER_RUNTIME={__proto__:null,c:function(E){return G.H.useMemoCache(E)}},pe.cache=function(E){return function(){return E.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(E,B,K){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var W=A({},E.props),he=E.key;if(B!=null)for(ue in B.key!==void 0&&(he=""+B.key),B)!Z.call(B,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&B.ref===void 0||(W[ue]=B[ue]);var ue=arguments.length-2;if(ue===1)W.children=K;else if(1<ue){for(var _e=Array(ue),qe=0;qe<ue;qe++)_e[qe]=arguments[qe+2];W.children=_e}return ee(E.type,he,W)},pe.createContext=function(E){return E={$$typeof:c,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:u,_context:E},E},pe.createElement=function(E,B,K){var W,he={},ue=null;if(B!=null)for(W in B.key!==void 0&&(ue=""+B.key),B)Z.call(B,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(he[W]=B[W]);var _e=arguments.length-2;if(_e===1)he.children=K;else if(1<_e){for(var qe=Array(_e),He=0;He<_e;He++)qe[He]=arguments[He+2];he.children=qe}if(E&&E.defaultProps)for(W in _e=E.defaultProps,_e)he[W]===void 0&&(he[W]=_e[W]);return ee(E,ue,he)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(E){return{$$typeof:d,render:E}},pe.isValidElement=le,pe.lazy=function(E){return{$$typeof:g,_payload:{_status:-1,_result:E},_init:Y}},pe.memo=function(E,B){return{$$typeof:p,type:E,compare:B===void 0?null:B}},pe.startTransition=function(E){var B=G.T,K={};G.T=K;try{var W=E(),he=G.S;he!==null&&he(K,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(X,I)}catch(ue){I(ue)}finally{B!==null&&K.types!==null&&(B.types=K.types),G.T=B}},pe.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},pe.use=function(E){return G.H.use(E)},pe.useActionState=function(E,B,K){return G.H.useActionState(E,B,K)},pe.useCallback=function(E,B){return G.H.useCallback(E,B)},pe.useContext=function(E){return G.H.useContext(E)},pe.useDebugValue=function(){},pe.useDeferredValue=function(E,B){return G.H.useDeferredValue(E,B)},pe.useEffect=function(E,B){return G.H.useEffect(E,B)},pe.useEffectEvent=function(E){return G.H.useEffectEvent(E)},pe.useId=function(){return G.H.useId()},pe.useImperativeHandle=function(E,B,K){return G.H.useImperativeHandle(E,B,K)},pe.useInsertionEffect=function(E,B){return G.H.useInsertionEffect(E,B)},pe.useLayoutEffect=function(E,B){return G.H.useLayoutEffect(E,B)},pe.useMemo=function(E,B){return G.H.useMemo(E,B)},pe.useOptimistic=function(E,B){return G.H.useOptimistic(E,B)},pe.useReducer=function(E,B,K){return G.H.useReducer(E,B,K)},pe.useRef=function(E){return G.H.useRef(E)},pe.useState=function(E){return G.H.useState(E)},pe.useSyncExternalStore=function(E,B,K){return G.H.useSyncExternalStore(E,B,K)},pe.useTransition=function(){return G.H.useTransition()},pe.version="19.2.7",pe}var ky;function qd(){return ky||(ky=1,Ah.exports=LS()),Ah.exports}var V=qd(),Rh={exports:{}},mr={},Ch={exports:{}},kh={};/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var jy;function zS(){return jy||(jy=1,(function(n){function e(L,Q){var Y=L.length;L.push(Q);e:for(;0<Y;){var I=Y-1>>>1,oe=L[I];if(0<l(oe,Q))L[I]=Q,L[Y]=oe,Y=I;else break e}}function s(L){return L.length===0?null:L[0]}function a(L){if(L.length===0)return null;var Q=L[0],Y=L.pop();if(Y!==Q){L[0]=Y;e:for(var I=0,oe=L.length,E=oe>>>1;I<E;){var B=2*(I+1)-1,K=L[B],W=B+1,he=L[W];if(0>l(K,Y))W<oe&&0>l(he,K)?(L[I]=he,L[W]=Y,I=W):(L[I]=K,L[B]=Y,I=B);else if(W<oe&&0>l(he,Y))L[I]=he,L[W]=Y,I=W;else break e}}return Q}function l(L,Q){var Y=L.sortIndex-Q.sortIndex;return Y!==0?Y:L.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();n.unstable_now=function(){return c.now()-d}}var m=[],p=[],g=1,v=null,w=3,x=!1,S=!1,A=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function P(L){for(var Q=s(p);Q!==null;){if(Q.callback===null)a(p);else if(Q.startTime<=L)a(p),Q.sortIndex=Q.expirationTime,e(m,Q);else break;Q=s(p)}}function J(L){if(A=!1,P(L),!S)if(s(m)!==null)S=!0,X||(X=!0,de());else{var Q=s(p);Q!==null&&ke(J,Q.startTime-L)}}var X=!1,G=-1,Z=5,ee=-1;function ne(){return k?!0:!(n.unstable_now()-ee<Z)}function le(){if(k=!1,X){var L=n.unstable_now();ee=L;var Q=!0;try{e:{S=!1,A&&(A=!1,N(G),G=-1),x=!0;var Y=w;try{t:{for(P(L),v=s(m);v!==null&&!(v.expirationTime>L&&ne());){var I=v.callback;if(typeof I=="function"){v.callback=null,w=v.priorityLevel;var oe=I(v.expirationTime<=L);if(L=n.unstable_now(),typeof oe=="function"){v.callback=oe,P(L),Q=!0;break t}v===s(m)&&a(m),P(L)}else a(m);v=s(m)}if(v!==null)Q=!0;else{var E=s(p);E!==null&&ke(J,E.startTime-L),Q=!1}}break e}finally{v=null,w=Y,x=!1}Q=void 0}}finally{Q?de():X=!1}}}var de;if(typeof O=="function")de=function(){O(le)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,Re=je.port2;je.port1.onmessage=le,de=function(){Re.postMessage(null)}}else de=function(){C(le,0)};function ke(L,Q){G=C(function(){L(n.unstable_now())},Q)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_next=function(L){switch(w){case 1:case 2:case 3:var Q=3;break;default:Q=w}var Y=w;w=Q;try{return L()}finally{w=Y}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(L,Q){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var Y=w;w=L;try{return Q()}finally{w=Y}},n.unstable_scheduleCallback=function(L,Q,Y){var I=n.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?I+Y:I):Y=I,L){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=Y+oe,L={id:g++,callback:Q,priorityLevel:L,startTime:Y,expirationTime:oe,sortIndex:-1},Y>I?(L.sortIndex=Y,e(p,L),s(m)===null&&L===s(p)&&(A?(N(G),G=-1):A=!0,ke(J,Y-I))):(L.sortIndex=oe,e(m,L),S||x||(S=!0,X||(X=!0,de()))),L},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(L){var Q=w;return function(){var Y=w;w=Q;try{return L.apply(this,arguments)}finally{w=Y}}}})(kh)),kh}var Oy;function VS(){return Oy||(Oy=1,Ch.exports=zS()),Ch.exports}var jh={exports:{}},_t={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ny;function PS(){if(Ny)return _t;Ny=1;var n=qd();function e(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var a={d:{f:s,r:function(){throw Error(e(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:m,containerInfo:p,implementation:g}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return _t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,_t.createPortal=function(m,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return u(m,p,null,g)},_t.flushSync=function(m){var p=c.T,g=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=p,a.p=g,a.d.f()}},_t.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},_t.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},_t.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var g=p.as,v=d(g,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:x}):g==="script"&&a.d.X(m,{crossOrigin:v,integrity:w,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},_t.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=d(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},_t.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,v=d(g,p.crossOrigin);a.d.L(m,g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},_t.preloadModule=function(m,p){if(typeof m=="string")if(p){var g=d(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},_t.requestFormReset=function(m){a.d.r(m)},_t.unstable_batchedUpdates=function(m,p){return m(p)},_t.useFormState=function(m,p,g){return c.H.useFormState(m,p,g)},_t.useFormStatus=function(){return c.H.useHostTransitionStatus()},_t.version="19.2.7",_t}var Dy;function HS(){if(Dy)return jh.exports;Dy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),jh.exports=PS(),jh.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var My;function $S(){if(My)return mr;My=1;var n=VS(),e=qd(),s=HS();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)i+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,r=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(r=i.return),t=i.return;while(t)}return i.tag===3?r:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function d(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(a(188))}function p(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var r=t,o=i;;){var h=r.return;if(h===null)break;var f=h.alternate;if(f===null){if(o=h.return,o!==null){r=o;continue}break}if(h.child===f.child){for(f=h.child;f;){if(f===r)return m(h),t;if(f===o)return m(h),i;f=f.sibling}throw Error(a(188))}if(r.return!==o.return)r=h,o=f;else{for(var y=!1,_=h.child;_;){if(_===r){y=!0,r=h,o=f;break}if(_===o){y=!0,o=h,r=f;break}_=_.sibling}if(!y){for(_=f.child;_;){if(_===r){y=!0,r=f,o=h;break}if(_===o){y=!0,o=f,r=h;break}_=_.sibling}if(!y)throw Error(a(189))}}if(r.alternate!==o)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?t:i}function g(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=g(t),i!==null)return i;t=t.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function de(t){return t===null||typeof t!="object"?null:(t=le&&t[le]||t["@@iterator"],typeof t=="function"?t:null)}var je=Symbol.for("react.client.reference");function Re(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case J:return"Suspense";case X:return"SuspenseList";case ee:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case O:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case P:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case G:return i=t.displayName||null,i!==null?i:Re(t.type)||"Memo";case Z:i=t._payload,t=t._init;try{return Re(t(i))}catch{}}return null}var ke=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},I=[],oe=-1;function E(t){return{current:t}}function B(t){0>oe||(t.current=I[oe],I[oe]=null,oe--)}function K(t,i){oe++,I[oe]=t.current,t.current=i}var W=E(null),he=E(null),ue=E(null),_e=E(null);function qe(t,i){switch(K(ue,i),K(he,t),K(W,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?Xg(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=Xg(i),t=Jg(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}B(W),K(W,t)}function He(){B(W),B(he),B(ue)}function _n(t){t.memoizedState!==null&&K(_e,t);var i=W.current,r=Jg(i,t.type);i!==r&&(K(he,t),K(W,r))}function wt(t){he.current===t&&(B(W),B(he)),_e.current===t&&(B(_e),ur._currentValue=Y)}var Yt,oi;function dt(t){if(Yt===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);Yt=i&&i[1]||"",oi=-1<r.stack.indexOf(`
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Yt+t+oi}var Pi=!1;function F(t,i){if(!t||Pi)return"";Pi=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(z){var U=z}Reflect.construct(t,[],q)}else{try{q.call()}catch(z){U=z}t.call(q.prototype)}}else{try{throw Error()}catch(z){U=z}(q=t())&&typeof q.catch=="function"&&q.catch(function(){})}}catch(z){if(z&&U&&typeof z.stack=="string")return[z.stack,U.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),y=f[0],_=f[1];if(y&&_){var T=y.split(`
`),M=_.split(`
`);for(h=o=0;o<T.length&&!T[o].includes("DetermineComponentFrameRoot");)o++;for(;h<M.length&&!M[h].includes("DetermineComponentFrameRoot");)h++;if(o===T.length||h===M.length)for(o=T.length-1,h=M.length-1;1<=o&&0<=h&&T[o]!==M[h];)h--;for(;1<=o&&0<=h;o--,h--)if(T[o]!==M[h]){if(o!==1||h!==1)do if(o--,h--,0>h||T[o]!==M[h]){var H=`
`+T[o].replace(" at new "," at ");return t.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",t.displayName)),H}while(1<=o&&0<=h);break}}}finally{Pi=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?dt(r):""}function ge(t,i){switch(t.tag){case 26:case 27:case 5:return dt(t.type);case 16:return dt("Lazy");case 13:return t.child!==i&&i!==null?dt("Suspense Fallback"):dt("Suspense");case 19:return dt("SuspenseList");case 0:case 15:return F(t.type,!1);case 11:return F(t.type.render,!1);case 1:return F(t.type,!0);case 31:return dt("Activity");default:return""}}function Fe(t){try{var i="",r=null;do i+=ge(t,r),r=t,t=t.return;while(t);return i}catch(o){return`
Error generating stack: `+o.message+`
`+o.stack}}var Bt=Object.prototype.hasOwnProperty,Ln=n.unstable_scheduleCallback,Yr=n.unstable_cancelCallback,xn=n.unstable_shouldYield,Xr=n.unstable_requestPaint,Me=n.unstable_now,Sn=n.unstable_getCurrentPriorityLevel,Rf=n.unstable_ImmediatePriority,Cf=n.unstable_UserBlockingPriority,Jr=n.unstable_NormalPriority,g_=n.unstable_LowPriority,kf=n.unstable_IdlePriority,y_=n.log,v_=n.unstable_setDisableYieldValue,_a=null,Lt=null;function li(t){if(typeof y_=="function"&&v_(t),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(_a,t)}catch{}}var zt=Math.clz32?Math.clz32:__,b_=Math.log,w_=Math.LN2;function __(t){return t>>>=0,t===0?32:31-(b_(t)/w_|0)|0}var Qr=256,Zr=262144,Wr=4194304;function Hi(t){var i=t&42;if(i!==0)return i;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function eo(t,i,r){var o=t.pendingLanes;if(o===0)return 0;var h=0,f=t.suspendedLanes,y=t.pingedLanes;t=t.warmLanes;var _=o&134217727;return _!==0?(o=_&~f,o!==0?h=Hi(o):(y&=_,y!==0?h=Hi(y):r||(r=_&~t,r!==0&&(h=Hi(r))))):(_=o&~f,_!==0?h=Hi(_):y!==0?h=Hi(y):r||(r=o&~t,r!==0&&(h=Hi(r)))),h===0?0:i!==0&&i!==h&&(i&f)===0&&(f=h&-h,r=i&-i,f>=r||f===32&&(r&4194048)!==0)?i:h}function xa(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function x_(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 jf(){var t=Wr;return Wr<<=1,(Wr&62914560)===0&&(Wr=4194304),t}function fu(t){for(var i=[],r=0;31>r;r++)i.push(t);return i}function Sa(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function S_(t,i,r,o,h,f){var y=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var _=t.entanglements,T=t.expirationTimes,M=t.hiddenUpdates;for(r=y&~r;0<r;){var H=31-zt(r),q=1<<H;_[H]=0,T[H]=-1;var U=M[H];if(U!==null)for(M[H]=null,H=0;H<U.length;H++){var z=U[H];z!==null&&(z.lane&=-536870913)}r&=~q}o!==0&&Of(t,o,0),f!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=f&~(y&~i))}function Of(t,i,r){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-zt(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|r&261930}function Nf(t,i){var r=t.entangledLanes|=i;for(t=t.entanglements;r;){var o=31-zt(r),h=1<<o;h&i|t[o]&i&&(t[o]|=i),r&=~h}}function Df(t,i){var r=i&-i;return r=(r&42)!==0?1:mu(r),(r&(t.suspendedLanes|i))!==0?0:r}function mu(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function pu(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Mf(){var t=Q.p;return t!==0?t:(t=window.event,t===void 0?32:by(t.type))}function Uf(t,i){var r=Q.p;try{return Q.p=t,i()}finally{Q.p=r}}var ui=Math.random().toString(36).slice(2),ft="__reactFiber$"+ui,Rt="__reactProps$"+ui,gs="__reactContainer$"+ui,gu="__reactEvents$"+ui,T_="__reactListeners$"+ui,E_="__reactHandles$"+ui,Bf="__reactResources$"+ui,Ta="__reactMarker$"+ui;function yu(t){delete t[ft],delete t[Rt],delete t[gu],delete t[T_],delete t[E_]}function ys(t){var i=t[ft];if(i)return i;for(var r=t.parentNode;r;){if(i=r[gs]||r[ft]){if(r=i.alternate,i.child!==null||r!==null&&r.child!==null)for(t=iy(t);t!==null;){if(r=t[ft])return r;t=iy(t)}return i}t=r,r=t.parentNode}return null}function vs(t){if(t=t[ft]||t[gs]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function Ea(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function bs(t){var i=t[Bf];return i||(i=t[Bf]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ut(t){t[Ta]=!0}var Lf=new Set,zf={};function $i(t,i){ws(t,i),ws(t+"Capture",i)}function ws(t,i){for(zf[t]=i,t=0;t<i.length;t++)Lf.add(i[t])}var A_=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]*$"),Vf={},Pf={};function R_(t){return Bt.call(Pf,t)?!0:Bt.call(Vf,t)?!1:A_.test(t)?Pf[t]=!0:(Vf[t]=!0,!1)}function to(t,i,r){if(R_(i))if(r===null)t.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+r)}}function no(t,i,r){if(r===null)t.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+r)}}function zn(t,i,r,o){if(o===null)t.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(i,r,""+o)}}function Xt(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Hf(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function C_(t,i,r){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,f=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(y){r=""+y,f.call(this,y)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(y){r=""+y},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function vu(t){if(!t._valueTracker){var i=Hf(t)?"checked":"value";t._valueTracker=C_(t,i,""+t[i])}}function $f(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var r=i.getValue(),o="";return t&&(o=Hf(t)?t.checked?"true":"false":t.value),t=o,t!==r?(i.setValue(t),!0):!1}function io(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var k_=/[\n"\\]/g;function Jt(t){return t.replace(k_,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function bu(t,i,r,o,h,f,y,_){t.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?t.type=y:t.removeAttribute("type"),i!=null?y==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Xt(i)):t.value!==""+Xt(i)&&(t.value=""+Xt(i)):y!=="submit"&&y!=="reset"||t.removeAttribute("value"),i!=null?wu(t,y,Xt(i)):r!=null?wu(t,y,Xt(r)):o!=null&&t.removeAttribute("value"),h==null&&f!=null&&(t.defaultChecked=!!f),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+Xt(_):t.removeAttribute("name")}function qf(t,i,r,o,h,f,y,_){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.type=f),i!=null||r!=null){if(!(f!=="submit"&&f!=="reset"||i!=null)){vu(t);return}r=r!=null?""+Xt(r):"",i=i!=null?""+Xt(i):r,_||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=_?t.checked:!!o,t.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.name=y),vu(t)}function wu(t,i,r){i==="number"&&io(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function _s(t,i,r,o){if(t=t.options,i){i={};for(var h=0;h<r.length;h++)i["$"+r[h]]=!0;for(r=0;r<t.length;r++)h=i.hasOwnProperty("$"+t[r].value),t[r].selected!==h&&(t[r].selected=h),h&&o&&(t[r].defaultSelected=!0)}else{for(r=""+Xt(r),i=null,h=0;h<t.length;h++){if(t[h].value===r){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function If(t,i,r){if(i!=null&&(i=""+Xt(i),i!==t.value&&(t.value=i),r==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=r!=null?""+Xt(r):""}function Gf(t,i,r,o){if(i==null){if(o!=null){if(r!=null)throw Error(a(92));if(ke(o)){if(1<o.length)throw Error(a(93));o=o[0]}r=o}r==null&&(r=""),i=r}r=Xt(i),t.defaultValue=r,o=t.textContent,o===r&&o!==""&&o!==null&&(t.value=o),vu(t)}function xs(t,i){if(i){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=i;return}}t.textContent=i}var j_=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 Kf(t,i,r){var o=i.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,r):typeof r!="number"||r===0||j_.has(i)?i==="float"?t.cssFloat=r:t[i]=(""+r).trim():t[i]=r+"px"}function Ff(t,i,r){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&r[h]!==o&&Kf(t,h,o)}else for(var f in i)i.hasOwnProperty(f)&&Kf(t,f,i[f])}function _u(t){if(t.indexOf("-")===-1)return!1;switch(t){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 O_=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"]]),N_=/^[\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 so(t){return N_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Vn(){}var xu=null;function Su(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ss=null,Ts=null;function Yf(t){var i=vs(t);if(i&&(t=i.stateNode)){var r=t[Rt]||null;e:switch(t=i.stateNode,i.type){case"input":if(bu(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),i=r.name,r.type==="radio"&&i!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Jt(""+i)+'"][type="radio"]'),i=0;i<r.length;i++){var o=r[i];if(o!==t&&o.form===t.form){var h=o[Rt]||null;if(!h)throw Error(a(90));bu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<r.length;i++)o=r[i],o.form===t.form&&$f(o)}break e;case"textarea":If(t,r.value,r.defaultValue);break e;case"select":i=r.value,i!=null&&_s(t,!!r.multiple,i,!1)}}}var Tu=!1;function Xf(t,i,r){if(Tu)return t(i,r);Tu=!0;try{var o=t(i);return o}finally{if(Tu=!1,(Ss!==null||Ts!==null)&&(Ko(),Ss&&(i=Ss,t=Ts,Ts=Ss=null,Yf(i),t)))for(i=0;i<t.length;i++)Yf(t[i])}}function Aa(t,i){var r=t.stateNode;if(r===null)return null;var o=r[Rt]||null;if(o===null)return null;r=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(a(231,i,typeof r));return r}var Pn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eu=!1;if(Pn)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{Eu=!1}var ci=null,Au=null,ao=null;function Jf(){if(ao)return ao;var t,i=Au,r=i.length,o,h="value"in ci?ci.value:ci.textContent,f=h.length;for(t=0;t<r&&i[t]===h[t];t++);var y=r-t;for(o=1;o<=y&&i[r-o]===h[f-o];o++);return ao=h.slice(t,1<o?1-o:void 0)}function ro(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function oo(){return!0}function Qf(){return!1}function Ct(t){function i(r,o,h,f,y){this._reactName=r,this._targetInst=h,this.type=o,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(r=t[_],this[_]=r?r(f):f[_]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?oo:Qf,this.isPropagationStopped=Qf,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=oo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=oo)},persist:function(){},isPersistent:oo}),i}var qi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lo=Ct(qi),Ca=v({},qi,{view:0,detail:0}),D_=Ct(Ca),Ru,Cu,ka,uo=v({},Ca,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ju,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ka&&(ka&&t.type==="mousemove"?(Ru=t.screenX-ka.screenX,Cu=t.screenY-ka.screenY):Cu=Ru=0,ka=t),Ru)},movementY:function(t){return"movementY"in t?t.movementY:Cu}}),Zf=Ct(uo),M_=v({},uo,{dataTransfer:0}),U_=Ct(M_),B_=v({},Ca,{relatedTarget:0}),ku=Ct(B_),L_=v({},qi,{animationName:0,elapsedTime:0,pseudoElement:0}),z_=Ct(L_),V_=v({},qi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),P_=Ct(V_),H_=v({},qi,{data:0}),Wf=Ct(H_),$_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},q_={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"},I_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function G_(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=I_[t])?!!i[t]:!1}function ju(){return G_}var K_=v({},Ca,{key:function(t){if(t.key){var i=$_[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=ro(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?q_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ju,charCode:function(t){return t.type==="keypress"?ro(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ro(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),F_=Ct(K_),Y_=v({},uo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),em=Ct(Y_),X_=v({},Ca,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ju}),J_=Ct(X_),Q_=v({},qi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z_=Ct(Q_),W_=v({},uo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ex=Ct(W_),tx=v({},qi,{newState:0,oldState:0}),nx=Ct(tx),ix=[9,13,27,32],Ou=Pn&&"CompositionEvent"in window,ja=null;Pn&&"documentMode"in document&&(ja=document.documentMode);var sx=Pn&&"TextEvent"in window&&!ja,tm=Pn&&(!Ou||ja&&8<ja&&11>=ja),nm=" ",im=!1;function sm(t,i){switch(t){case"keyup":return ix.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function am(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Es=!1;function ax(t,i){switch(t){case"compositionend":return am(i);case"keypress":return i.which!==32?null:(im=!0,nm);case"textInput":return t=i.data,t===nm&&im?null:t;default:return null}}function rx(t,i){if(Es)return t==="compositionend"||!Ou&&sm(t,i)?(t=Jf(),ao=Au=ci=null,Es=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return tm&&i.locale!=="ko"?null:i.data;default:return null}}var ox={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 rm(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!ox[t.type]:i==="textarea"}function om(t,i,r,o){Ss?Ts?Ts.push(o):Ts=[o]:Ss=o,i=Wo(i,"onChange"),0<i.length&&(r=new lo("onChange","change",null,r,o),t.push({event:r,listeners:i}))}var Oa=null,Na=null;function lx(t){qg(t,0)}function co(t){var i=Ea(t);if($f(i))return t}function lm(t,i){if(t==="change")return i}var um=!1;if(Pn){var Nu;if(Pn){var Du="oninput"in document;if(!Du){var cm=document.createElement("div");cm.setAttribute("oninput","return;"),Du=typeof cm.oninput=="function"}Nu=Du}else Nu=!1;um=Nu&&(!document.documentMode||9<document.documentMode)}function hm(){Oa&&(Oa.detachEvent("onpropertychange",dm),Na=Oa=null)}function dm(t){if(t.propertyName==="value"&&co(Na)){var i=[];om(i,Na,t,Su(t)),Xf(lx,i)}}function ux(t,i,r){t==="focusin"?(hm(),Oa=i,Na=r,Oa.attachEvent("onpropertychange",dm)):t==="focusout"&&hm()}function cx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return co(Na)}function hx(t,i){if(t==="click")return co(i)}function dx(t,i){if(t==="input"||t==="change")return co(i)}function fx(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Vt=typeof Object.is=="function"?Object.is:fx;function Da(t,i){if(Vt(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var r=Object.keys(t),o=Object.keys(i);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var h=r[o];if(!Bt.call(i,h)||!Vt(t[h],i[h]))return!1}return!0}function fm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function mm(t,i){var r=fm(t);t=0;for(var o;r;){if(r.nodeType===3){if(o=t+r.textContent.length,t<=i&&o>=i)return{node:r,offset:i-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=fm(r)}}function pm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?pm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function gm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=io(t.document);i instanceof t.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)t=i.contentWindow;else break;i=io(t.document)}return i}function Mu(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var mx=Pn&&"documentMode"in document&&11>=document.documentMode,As=null,Uu=null,Ma=null,Bu=!1;function ym(t,i,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Bu||As==null||As!==io(o)||(o=As,"selectionStart"in o&&Mu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Ma&&Da(Ma,o)||(Ma=o,o=Wo(Uu,"onSelect"),0<o.length&&(i=new lo("onSelect","select",null,i,r),t.push({event:i,listeners:o}),i.target=As)))}function Ii(t,i){var r={};return r[t.toLowerCase()]=i.toLowerCase(),r["Webkit"+t]="webkit"+i,r["Moz"+t]="moz"+i,r}var Rs={animationend:Ii("Animation","AnimationEnd"),animationiteration:Ii("Animation","AnimationIteration"),animationstart:Ii("Animation","AnimationStart"),transitionrun:Ii("Transition","TransitionRun"),transitionstart:Ii("Transition","TransitionStart"),transitioncancel:Ii("Transition","TransitionCancel"),transitionend:Ii("Transition","TransitionEnd")},Lu={},vm={};Pn&&(vm=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function Gi(t){if(Lu[t])return Lu[t];if(!Rs[t])return t;var i=Rs[t],r;for(r in i)if(i.hasOwnProperty(r)&&r in vm)return Lu[t]=i[r];return t}var bm=Gi("animationend"),wm=Gi("animationiteration"),_m=Gi("animationstart"),px=Gi("transitionrun"),gx=Gi("transitionstart"),yx=Gi("transitioncancel"),xm=Gi("transitionend"),Sm=new Map,zu="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(" ");zu.push("scrollEnd");function un(t,i){Sm.set(t,i),$i(i,[t])}var ho=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Qt=[],Cs=0,Vu=0;function fo(){for(var t=Cs,i=Vu=Cs=0;i<t;){var r=Qt[i];Qt[i++]=null;var o=Qt[i];Qt[i++]=null;var h=Qt[i];Qt[i++]=null;var f=Qt[i];if(Qt[i++]=null,o!==null&&h!==null){var y=o.pending;y===null?h.next=h:(h.next=y.next,y.next=h),o.pending=h}f!==0&&Tm(r,h,f)}}function mo(t,i,r,o){Qt[Cs++]=t,Qt[Cs++]=i,Qt[Cs++]=r,Qt[Cs++]=o,Vu|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Pu(t,i,r,o){return mo(t,i,r,o),po(t)}function Ki(t,i){return mo(t,null,null,i),po(t)}function Tm(t,i,r){t.lanes|=r;var o=t.alternate;o!==null&&(o.lanes|=r);for(var h=!1,f=t.return;f!==null;)f.childLanes|=r,o=f.alternate,o!==null&&(o.childLanes|=r),f.tag===22&&(t=f.stateNode,t===null||t._visibility&1||(h=!0)),t=f,f=f.return;return t.tag===3?(f=t.stateNode,h&&i!==null&&(h=31-zt(r),t=f.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=r|536870912),f):null}function po(t){if(50<nr)throw nr=0,Xc=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var ks={};function vx(t,i,r,o){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(t,i,r,o){return new vx(t,i,r,o)}function Hu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Hn(t,i){var r=t.alternate;return r===null?(r=Pt(t.tag,i,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=i,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,i=t.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function Em(t,i){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,i=r.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function go(t,i,r,o,h,f){var y=0;if(o=t,typeof t=="function")Hu(t)&&(y=1);else if(typeof t=="string")y=SS(t,r,W.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ee:return t=Pt(31,r,i,h),t.elementType=ee,t.lanes=f,t;case A:return Fi(r.children,h,f,i);case k:y=8,h|=24;break;case C:return t=Pt(12,r,i,h|2),t.elementType=C,t.lanes=f,t;case J:return t=Pt(13,r,i,h),t.elementType=J,t.lanes=f,t;case X:return t=Pt(19,r,i,h),t.elementType=X,t.lanes=f,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case O:y=10;break e;case N:y=9;break e;case P:y=11;break e;case G:y=14;break e;case Z:y=16,o=null;break e}y=29,r=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=Pt(y,r,i,h),i.elementType=t,i.type=o,i.lanes=f,i}function Fi(t,i,r,o){return t=Pt(7,t,o,i),t.lanes=r,t}function $u(t,i,r){return t=Pt(6,t,null,i),t.lanes=r,t}function Am(t){var i=Pt(18,null,null,0);return i.stateNode=t,i}function qu(t,i,r){return i=Pt(4,t.children!==null?t.children:[],t.key,i),i.lanes=r,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Rm=new WeakMap;function Zt(t,i){if(typeof t=="object"&&t!==null){var r=Rm.get(t);return r!==void 0?r:(i={value:t,source:i,stack:Fe(i)},Rm.set(t,i),i)}return{value:t,source:i,stack:Fe(i)}}var js=[],Os=0,yo=null,Ua=0,Wt=[],en=0,hi=null,Tn=1,En="";function $n(t,i){js[Os++]=Ua,js[Os++]=yo,yo=t,Ua=i}function Cm(t,i,r){Wt[en++]=Tn,Wt[en++]=En,Wt[en++]=hi,hi=t;var o=Tn;t=En;var h=32-zt(o)-1;o&=~(1<<h),r+=1;var f=32-zt(i)+h;if(30<f){var y=h-h%5;f=(o&(1<<y)-1).toString(32),o>>=y,h-=y,Tn=1<<32-zt(i)+h|r<<h|o,En=f+t}else Tn=1<<f|r<<h|o,En=t}function Iu(t){t.return!==null&&($n(t,1),Cm(t,1,0))}function Gu(t){for(;t===yo;)yo=js[--Os],js[Os]=null,Ua=js[--Os],js[Os]=null;for(;t===hi;)hi=Wt[--en],Wt[en]=null,En=Wt[--en],Wt[en]=null,Tn=Wt[--en],Wt[en]=null}function km(t,i){Wt[en++]=Tn,Wt[en++]=En,Wt[en++]=hi,Tn=i.id,En=i.overflow,hi=t}var mt=null,Ie=null,Te=!1,di=null,tn=!1,Ku=Error(a(519));function fi(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(Zt(i,t)),Ku}function jm(t){var i=t.stateNode,r=t.type,o=t.memoizedProps;switch(i[ft]=t,i[Rt]=o,r){case"dialog":we("cancel",i),we("close",i);break;case"iframe":case"object":case"embed":we("load",i);break;case"video":case"audio":for(r=0;r<sr.length;r++)we(sr[r],i);break;case"source":we("error",i);break;case"img":case"image":case"link":we("error",i),we("load",i);break;case"details":we("toggle",i);break;case"input":we("invalid",i),qf(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":we("invalid",i);break;case"textarea":we("invalid",i),Gf(i,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||i.textContent===""+r||o.suppressHydrationWarning===!0||Fg(i.textContent,r)?(o.popover!=null&&(we("beforetoggle",i),we("toggle",i)),o.onScroll!=null&&we("scroll",i),o.onScrollEnd!=null&&we("scrollend",i),o.onClick!=null&&(i.onclick=Vn),i=!0):i=!1,i||fi(t,!0)}function Om(t){for(mt=t.return;mt;)switch(mt.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:mt=mt.return}}function Ns(t){if(t!==mt)return!1;if(!Te)return Om(t),Te=!0,!1;var i=t.tag,r;if((r=i!==3&&i!==27)&&((r=i===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||ch(t.type,t.memoizedProps)),r=!r),r&&Ie&&fi(t),Om(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ie=ny(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ie=ny(t)}else i===27?(i=Ie,Ri(t.type)?(t=ph,ph=null,Ie=t):Ie=i):Ie=mt?sn(t.stateNode.nextSibling):null;return!0}function Yi(){Ie=mt=null,Te=!1}function Fu(){var t=di;return t!==null&&(Nt===null?Nt=t:Nt.push.apply(Nt,t),di=null),t}function Ba(t){di===null?di=[t]:di.push(t)}var Yu=E(null),Xi=null,qn=null;function mi(t,i,r){K(Yu,i._currentValue),i._currentValue=r}function In(t){t._currentValue=Yu.current,B(Yu)}function Xu(t,i,r){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===r)break;t=t.return}}function Ju(t,i,r,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var f=h.dependencies;if(f!==null){var y=h.child;f=f.firstContext;e:for(;f!==null;){var _=f;f=h;for(var T=0;T<i.length;T++)if(_.context===i[T]){f.lanes|=r,_=f.alternate,_!==null&&(_.lanes|=r),Xu(f.return,r,t),o||(y=null);break e}f=_.next}}else if(h.tag===18){if(y=h.return,y===null)throw Error(a(341));y.lanes|=r,f=y.alternate,f!==null&&(f.lanes|=r),Xu(y,r,t),y=null}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===t){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}}function Ds(t,i,r,o){t=null;for(var h=i,f=!1;h!==null;){if(!f){if((h.flags&524288)!==0)f=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var y=h.alternate;if(y===null)throw Error(a(387));if(y=y.memoizedProps,y!==null){var _=h.type;Vt(h.pendingProps.value,y.value)||(t!==null?t.push(_):t=[_])}}else if(h===_e.current){if(y=h.alternate,y===null)throw Error(a(387));y.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(ur):t=[ur])}h=h.return}t!==null&&Ju(i,t,r,o),i.flags|=262144}function vo(t){for(t=t.firstContext;t!==null;){if(!Vt(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ji(t){Xi=t,qn=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function pt(t){return Nm(Xi,t)}function bo(t,i){return Xi===null&&Ji(t),Nm(t,i)}function Nm(t,i){var r=i._currentValue;if(i={context:i,memoizedValue:r,next:null},qn===null){if(t===null)throw Error(a(308));qn=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else qn=qn.next=i;return r}var bx=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(r,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(r){return r()})}},wx=n.unstable_scheduleCallback,_x=n.unstable_NormalPriority,tt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qu(){return{controller:new bx,data:new Map,refCount:0}}function La(t){t.refCount--,t.refCount===0&&wx(_x,function(){t.controller.abort()})}var za=null,Zu=0,Ms=0,Us=null;function xx(t,i){if(za===null){var r=za=[];Zu=0,Ms=th(),Us={status:"pending",value:void 0,then:function(o){r.push(o)}}}return Zu++,i.then(Dm,Dm),i}function Dm(){if(--Zu===0&&za!==null){Us!==null&&(Us.status="fulfilled");var t=za;za=null,Ms=0,Us=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Sx(t,i){var r=[],o={status:"pending",value:null,reason:null,then:function(h){r.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<r.length;h++)(0,r[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<r.length;h++)(0,r[h])(void 0)}),o}var Mm=L.S;L.S=function(t,i){yg=Me(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&xx(t,i),Mm!==null&&Mm(t,i)};var Qi=E(null);function Wu(){var t=Qi.current;return t!==null?t:ze.pooledCache}function wo(t,i){i===null?K(Qi,Qi.current):K(Qi,i.pool)}function Um(){var t=Wu();return t===null?null:{parent:tt._currentValue,pool:t}}var Bs=Error(a(460)),ec=Error(a(474)),_o=Error(a(542)),xo={then:function(){}};function Bm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Lm(t,i,r){switch(r=t[r],r===void 0?t.push(i):r!==i&&(i.then(Vn,Vn),i=r),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Vm(t),t;default:if(typeof i.status=="string")i.then(Vn,Vn);else{if(t=ze,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Vm(t),t}throw Wi=i,Bs}}function Zi(t){try{var i=t._init;return i(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Wi=r,Bs):r}}var Wi=null;function zm(){if(Wi===null)throw Error(a(459));var t=Wi;return Wi=null,t}function Vm(t){if(t===Bs||t===_o)throw Error(a(483))}var Ls=null,Va=0;function So(t){var i=Va;return Va+=1,Ls===null&&(Ls=[]),Lm(Ls,t,i)}function Pa(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function To(t,i){throw i.$$typeof===w?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function Pm(t){function i(j,R){if(t){var D=j.deletions;D===null?(j.deletions=[R],j.flags|=16):D.push(R)}}function r(j,R){if(!t)return null;for(;R!==null;)i(j,R),R=R.sibling;return null}function o(j){for(var R=new Map;j!==null;)j.key!==null?R.set(j.key,j):R.set(j.index,j),j=j.sibling;return R}function h(j,R){return j=Hn(j,R),j.index=0,j.sibling=null,j}function f(j,R,D){return j.index=D,t?(D=j.alternate,D!==null?(D=D.index,D<R?(j.flags|=67108866,R):D):(j.flags|=67108866,R)):(j.flags|=1048576,R)}function y(j){return t&&j.alternate===null&&(j.flags|=67108866),j}function _(j,R,D,$){return R===null||R.tag!==6?(R=$u(D,j.mode,$),R.return=j,R):(R=h(R,D),R.return=j,R)}function T(j,R,D,$){var ce=D.type;return ce===A?H(j,R,D.props.children,$,D.key):R!==null&&(R.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===Z&&Zi(ce)===R.type)?(R=h(R,D.props),Pa(R,D),R.return=j,R):(R=go(D.type,D.key,D.props,null,j.mode,$),Pa(R,D),R.return=j,R)}function M(j,R,D,$){return R===null||R.tag!==4||R.stateNode.containerInfo!==D.containerInfo||R.stateNode.implementation!==D.implementation?(R=qu(D,j.mode,$),R.return=j,R):(R=h(R,D.children||[]),R.return=j,R)}function H(j,R,D,$,ce){return R===null||R.tag!==7?(R=Fi(D,j.mode,$,ce),R.return=j,R):(R=h(R,D),R.return=j,R)}function q(j,R,D){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=$u(""+R,j.mode,D),R.return=j,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case x:return D=go(R.type,R.key,R.props,null,j.mode,D),Pa(D,R),D.return=j,D;case S:return R=qu(R,j.mode,D),R.return=j,R;case Z:return R=Zi(R),q(j,R,D)}if(ke(R)||de(R))return R=Fi(R,j.mode,D,null),R.return=j,R;if(typeof R.then=="function")return q(j,So(R),D);if(R.$$typeof===O)return q(j,bo(j,R),D);To(j,R)}return null}function U(j,R,D,$){var ce=R!==null?R.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ce!==null?null:_(j,R,""+D,$);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case x:return D.key===ce?T(j,R,D,$):null;case S:return D.key===ce?M(j,R,D,$):null;case Z:return D=Zi(D),U(j,R,D,$)}if(ke(D)||de(D))return ce!==null?null:H(j,R,D,$,null);if(typeof D.then=="function")return U(j,R,So(D),$);if(D.$$typeof===O)return U(j,R,bo(j,D),$);To(j,D)}return null}function z(j,R,D,$,ce){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return j=j.get(D)||null,_(R,j,""+$,ce);if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return j=j.get($.key===null?D:$.key)||null,T(R,j,$,ce);case S:return j=j.get($.key===null?D:$.key)||null,M(R,j,$,ce);case Z:return $=Zi($),z(j,R,D,$,ce)}if(ke($)||de($))return j=j.get(D)||null,H(R,j,$,ce,null);if(typeof $.then=="function")return z(j,R,D,So($),ce);if($.$$typeof===O)return z(j,R,D,bo(R,$),ce);To(R,$)}return null}function ie(j,R,D,$){for(var ce=null,Ee=null,re=R,ve=R=0,Se=null;re!==null&&ve<D.length;ve++){re.index>ve?(Se=re,re=null):Se=re.sibling;var Ae=U(j,re,D[ve],$);if(Ae===null){re===null&&(re=Se);break}t&&re&&Ae.alternate===null&&i(j,re),R=f(Ae,R,ve),Ee===null?ce=Ae:Ee.sibling=Ae,Ee=Ae,re=Se}if(ve===D.length)return r(j,re),Te&&$n(j,ve),ce;if(re===null){for(;ve<D.length;ve++)re=q(j,D[ve],$),re!==null&&(R=f(re,R,ve),Ee===null?ce=re:Ee.sibling=re,Ee=re);return Te&&$n(j,ve),ce}for(re=o(re);ve<D.length;ve++)Se=z(re,j,ve,D[ve],$),Se!==null&&(t&&Se.alternate!==null&&re.delete(Se.key===null?ve:Se.key),R=f(Se,R,ve),Ee===null?ce=Se:Ee.sibling=Se,Ee=Se);return t&&re.forEach(function(Ni){return i(j,Ni)}),Te&&$n(j,ve),ce}function me(j,R,D,$){if(D==null)throw Error(a(151));for(var ce=null,Ee=null,re=R,ve=R=0,Se=null,Ae=D.next();re!==null&&!Ae.done;ve++,Ae=D.next()){re.index>ve?(Se=re,re=null):Se=re.sibling;var Ni=U(j,re,Ae.value,$);if(Ni===null){re===null&&(re=Se);break}t&&re&&Ni.alternate===null&&i(j,re),R=f(Ni,R,ve),Ee===null?ce=Ni:Ee.sibling=Ni,Ee=Ni,re=Se}if(Ae.done)return r(j,re),Te&&$n(j,ve),ce;if(re===null){for(;!Ae.done;ve++,Ae=D.next())Ae=q(j,Ae.value,$),Ae!==null&&(R=f(Ae,R,ve),Ee===null?ce=Ae:Ee.sibling=Ae,Ee=Ae);return Te&&$n(j,ve),ce}for(re=o(re);!Ae.done;ve++,Ae=D.next())Ae=z(re,j,ve,Ae.value,$),Ae!==null&&(t&&Ae.alternate!==null&&re.delete(Ae.key===null?ve:Ae.key),R=f(Ae,R,ve),Ee===null?ce=Ae:Ee.sibling=Ae,Ee=Ae);return t&&re.forEach(function(MS){return i(j,MS)}),Te&&$n(j,ve),ce}function Le(j,R,D,$){if(typeof D=="object"&&D!==null&&D.type===A&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case x:e:{for(var ce=D.key;R!==null;){if(R.key===ce){if(ce=D.type,ce===A){if(R.tag===7){r(j,R.sibling),$=h(R,D.props.children),$.return=j,j=$;break e}}else if(R.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===Z&&Zi(ce)===R.type){r(j,R.sibling),$=h(R,D.props),Pa($,D),$.return=j,j=$;break e}r(j,R);break}else i(j,R);R=R.sibling}D.type===A?($=Fi(D.props.children,j.mode,$,D.key),$.return=j,j=$):($=go(D.type,D.key,D.props,null,j.mode,$),Pa($,D),$.return=j,j=$)}return y(j);case S:e:{for(ce=D.key;R!==null;){if(R.key===ce)if(R.tag===4&&R.stateNode.containerInfo===D.containerInfo&&R.stateNode.implementation===D.implementation){r(j,R.sibling),$=h(R,D.children||[]),$.return=j,j=$;break e}else{r(j,R);break}else i(j,R);R=R.sibling}$=qu(D,j.mode,$),$.return=j,j=$}return y(j);case Z:return D=Zi(D),Le(j,R,D,$)}if(ke(D))return ie(j,R,D,$);if(de(D)){if(ce=de(D),typeof ce!="function")throw Error(a(150));return D=ce.call(D),me(j,R,D,$)}if(typeof D.then=="function")return Le(j,R,So(D),$);if(D.$$typeof===O)return Le(j,R,bo(j,D),$);To(j,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,R!==null&&R.tag===6?(r(j,R.sibling),$=h(R,D),$.return=j,j=$):(r(j,R),$=$u(D,j.mode,$),$.return=j,j=$),y(j)):r(j,R)}return function(j,R,D,$){try{Va=0;var ce=Le(j,R,D,$);return Ls=null,ce}catch(re){if(re===Bs||re===_o)throw re;var Ee=Pt(29,re,null,j.mode);return Ee.lanes=$,Ee.return=j,Ee}finally{}}}var es=Pm(!0),Hm=Pm(!1),pi=!1;function tc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function gi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function yi(t,i,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Ce&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=po(t),Tm(t,null,r),i}return mo(t,o,i,r),po(t)}function Ha(t,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,Nf(t,r)}}function ic(t,i){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var h=null,f=null;if(r=r.firstBaseUpdate,r!==null){do{var y={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};f===null?h=f=y:f=f.next=y,r=r.next}while(r!==null);f===null?h=f=i:f=f.next=i}else h=f=i;r={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=i:t.next=i,r.lastBaseUpdate=i}var sc=!1;function $a(){if(sc){var t=Us;if(t!==null)throw t}}function qa(t,i,r,o){sc=!1;var h=t.updateQueue;pi=!1;var f=h.firstBaseUpdate,y=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var T=_,M=T.next;T.next=null,y===null?f=M:y.next=M,y=T;var H=t.alternate;H!==null&&(H=H.updateQueue,_=H.lastBaseUpdate,_!==y&&(_===null?H.firstBaseUpdate=M:_.next=M,H.lastBaseUpdate=T))}if(f!==null){var q=h.baseState;y=0,H=M=T=null,_=f;do{var U=_.lane&-536870913,z=U!==_.lane;if(z?(xe&U)===U:(o&U)===U){U!==0&&U===Ms&&(sc=!0),H!==null&&(H=H.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ie=t,me=_;U=i;var Le=r;switch(me.tag){case 1:if(ie=me.payload,typeof ie=="function"){q=ie.call(Le,q,U);break e}q=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=me.payload,U=typeof ie=="function"?ie.call(Le,q,U):ie,U==null)break e;q=v({},q,U);break e;case 2:pi=!0}}U=_.callback,U!==null&&(t.flags|=64,z&&(t.flags|=8192),z=h.callbacks,z===null?h.callbacks=[U]:z.push(U))}else z={lane:U,tag:_.tag,payload:_.payload,callback:_.callback,next:null},H===null?(M=H=z,T=q):H=H.next=z,y|=U;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;z=_,_=z.next,z.next=null,h.lastBaseUpdate=z,h.shared.pending=null}}while(!0);H===null&&(T=q),h.baseState=T,h.firstBaseUpdate=M,h.lastBaseUpdate=H,f===null&&(h.shared.lanes=0),xi|=y,t.lanes=y,t.memoizedState=q}}function $m(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function qm(t,i){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)$m(r[t],i)}var zs=E(null),Eo=E(0);function Im(t,i){t=Wn,K(Eo,t),K(zs,i),Wn=t|i.baseLanes}function ac(){K(Eo,Wn),K(zs,zs.current)}function rc(){Wn=Eo.current,B(zs),B(Eo)}var Ht=E(null),nn=null;function vi(t){var i=t.alternate;K(Ze,Ze.current&1),K(Ht,t),nn===null&&(i===null||zs.current!==null||i.memoizedState!==null)&&(nn=t)}function oc(t){K(Ze,Ze.current),K(Ht,t),nn===null&&(nn=t)}function Gm(t){t.tag===22?(K(Ze,Ze.current),K(Ht,t),nn===null&&(nn=t)):bi()}function bi(){K(Ze,Ze.current),K(Ht,Ht.current)}function $t(t){B(Ht),nn===t&&(nn=null),B(Ze)}var Ze=E(0);function Ao(t){for(var i=t;i!==null;){if(i.tag===13){var r=i.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||fh(r)||mh(r)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Gn=0,ye=null,Ue=null,nt=null,Ro=!1,Vs=!1,ts=!1,Co=0,Ia=0,Ps=null,Tx=0;function Ye(){throw Error(a(321))}function lc(t,i){if(i===null)return!1;for(var r=0;r<i.length&&r<t.length;r++)if(!Vt(t[r],i[r]))return!1;return!0}function uc(t,i,r,o,h,f){return Gn=f,ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,L.H=t===null||t.memoizedState===null?Cp:Tc,ts=!1,f=r(o,h),ts=!1,Vs&&(f=Fm(i,r,o,h)),Km(t),f}function Km(t){L.H=Fa;var i=Ue!==null&&Ue.next!==null;if(Gn=0,nt=Ue=ye=null,Ro=!1,Ia=0,Ps=null,i)throw Error(a(300));t===null||it||(t=t.dependencies,t!==null&&vo(t)&&(it=!0))}function Fm(t,i,r,o){ye=t;var h=0;do{if(Vs&&(Ps=null),Ia=0,Vs=!1,25<=h)throw Error(a(301));if(h+=1,nt=Ue=null,t.updateQueue!=null){var f=t.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}L.H=kp,f=i(r,o)}while(Vs);return f}function Ex(){var t=L.H,i=t.useState()[0];return i=typeof i.then=="function"?Ga(i):i,t=t.useState()[0],(Ue!==null?Ue.memoizedState:null)!==t&&(ye.flags|=1024),i}function cc(){var t=Co!==0;return Co=0,t}function hc(t,i,r){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~r}function dc(t){if(Ro){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}Ro=!1}Gn=0,nt=Ue=ye=null,Vs=!1,Ia=Co=0,Ps=null}function St(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?ye.memoizedState=nt=t:nt=nt.next=t,nt}function We(){if(Ue===null){var t=ye.alternate;t=t!==null?t.memoizedState:null}else t=Ue.next;var i=nt===null?ye.memoizedState:nt.next;if(i!==null)nt=i,Ue=t;else{if(t===null)throw ye.alternate===null?Error(a(467)):Error(a(310));Ue=t,t={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},nt===null?ye.memoizedState=nt=t:nt=nt.next=t}return nt}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ga(t){var i=Ia;return Ia+=1,Ps===null&&(Ps=[]),t=Lm(Ps,t,i),i=ye,(nt===null?i.memoizedState:nt.next)===null&&(i=i.alternate,L.H=i===null||i.memoizedState===null?Cp:Tc),t}function jo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ga(t);if(t.$$typeof===O)return pt(t)}throw Error(a(438,String(t)))}function fc(t){var i=null,r=ye.updateQueue;if(r!==null&&(i=r.memoCache),i==null){var o=ye.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),r===null&&(r=ko(),ye.updateQueue=r),r.memoCache=i,r=i.data[i.index],r===void 0)for(r=i.data[i.index]=Array(t),o=0;o<t;o++)r[o]=ne;return i.index++,r}function Kn(t,i){return typeof i=="function"?i(t):i}function Oo(t){var i=We();return mc(i,Ue,t)}function mc(t,i,r){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=r;var h=t.baseQueue,f=o.pending;if(f!==null){if(h!==null){var y=h.next;h.next=f.next,f.next=y}i.baseQueue=h=f,o.pending=null}if(f=t.baseState,h===null)t.memoizedState=f;else{i=h.next;var _=y=null,T=null,M=i,H=!1;do{var q=M.lane&-536870913;if(q!==M.lane?(xe&q)===q:(Gn&q)===q){var U=M.revertLane;if(U===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),q===Ms&&(H=!0);else if((Gn&U)===U){M=M.next,U===Ms&&(H=!0);continue}else q={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},T===null?(_=T=q,y=f):T=T.next=q,ye.lanes|=U,xi|=U;q=M.action,ts&&r(f,q),f=M.hasEagerState?M.eagerState:r(f,q)}else U={lane:q,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},T===null?(_=T=U,y=f):T=T.next=U,ye.lanes|=q,xi|=q;M=M.next}while(M!==null&&M!==i);if(T===null?y=f:T.next=_,!Vt(f,t.memoizedState)&&(it=!0,H&&(r=Us,r!==null)))throw r;t.memoizedState=f,t.baseState=y,t.baseQueue=T,o.lastRenderedState=f}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function pc(t){var i=We(),r=i.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=t;var o=r.dispatch,h=r.pending,f=i.memoizedState;if(h!==null){r.pending=null;var y=h=h.next;do f=t(f,y.action),y=y.next;while(y!==h);Vt(f,i.memoizedState)||(it=!0),i.memoizedState=f,i.baseQueue===null&&(i.baseState=f),r.lastRenderedState=f}return[f,o]}function Ym(t,i,r){var o=ye,h=We(),f=Te;if(f){if(r===void 0)throw Error(a(407));r=r()}else r=i();var y=!Vt((Ue||h).memoizedState,r);if(y&&(h.memoizedState=r,it=!0),h=h.queue,vc(Qm.bind(null,o,h,t),[t]),h.getSnapshot!==i||y||nt!==null&&nt.memoizedState.tag&1){if(o.flags|=2048,Hs(9,{destroy:void 0},Jm.bind(null,o,h,r,i),null),ze===null)throw Error(a(349));f||(Gn&127)!==0||Xm(o,i,r)}return r}function Xm(t,i,r){t.flags|=16384,t={getSnapshot:i,value:r},i=ye.updateQueue,i===null?(i=ko(),ye.updateQueue=i,i.stores=[t]):(r=i.stores,r===null?i.stores=[t]:r.push(t))}function Jm(t,i,r,o){i.value=r,i.getSnapshot=o,Zm(i)&&Wm(t)}function Qm(t,i,r){return r(function(){Zm(i)&&Wm(t)})}function Zm(t){var i=t.getSnapshot;t=t.value;try{var r=i();return!Vt(t,r)}catch{return!0}}function Wm(t){var i=Ki(t,2);i!==null&&Dt(i,t,2)}function gc(t){var i=St();if(typeof t=="function"){var r=t;if(t=r(),ts){li(!0);try{r()}finally{li(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:t},i}function ep(t,i,r,o){return t.baseState=r,mc(t,Ue,typeof o=="function"?o:Kn)}function Ax(t,i,r,o,h){if(Mo(t))throw Error(a(485));if(t=i.action,t!==null){var f={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};L.T!==null?r(!0):f.isTransition=!1,o(f),r=i.pending,r===null?(f.next=i.pending=f,tp(i,f)):(f.next=r.next,i.pending=r.next=f)}}function tp(t,i){var r=i.action,o=i.payload,h=t.state;if(i.isTransition){var f=L.T,y={};L.T=y;try{var _=r(h,o),T=L.S;T!==null&&T(y,_),np(t,i,_)}catch(M){yc(t,i,M)}finally{f!==null&&y.types!==null&&(f.types=y.types),L.T=f}}else try{f=r(h,o),np(t,i,f)}catch(M){yc(t,i,M)}}function np(t,i,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){ip(t,i,o)},function(o){return yc(t,i,o)}):ip(t,i,r)}function ip(t,i,r){i.status="fulfilled",i.value=r,sp(i),t.state=r,i=t.pending,i!==null&&(r=i.next,r===i?t.pending=null:(r=r.next,i.next=r,tp(t,r)))}function yc(t,i,r){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=r,sp(i),i=i.next;while(i!==o)}t.action=null}function sp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function ap(t,i){return i}function rp(t,i){if(Te){var r=ze.formState;if(r!==null){e:{var o=ye;if(Te){if(Ie){t:{for(var h=Ie,f=tn;h.nodeType!==8;){if(!f){h=null;break t}if(h=sn(h.nextSibling),h===null){h=null;break t}}f=h.data,h=f==="F!"||f==="F"?h:null}if(h){Ie=sn(h.nextSibling),o=h.data==="F!";break e}}fi(o)}o=!1}o&&(i=r[0])}}return r=St(),r.memoizedState=r.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ap,lastRenderedState:i},r.queue=o,r=Ep.bind(null,ye,o),o.dispatch=r,o=gc(!1),f=Sc.bind(null,ye,!1,o.queue),o=St(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,r=Ax.bind(null,ye,h,f,r),h.dispatch=r,o.memoizedState=t,[i,r,!1]}function op(t){var i=We();return lp(i,Ue,t)}function lp(t,i,r){if(i=mc(t,i,ap)[0],t=Oo(Kn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ga(i)}catch(y){throw y===Bs?_o:y}else o=i;i=We();var h=i.queue,f=h.dispatch;return r!==i.memoizedState&&(ye.flags|=2048,Hs(9,{destroy:void 0},Rx.bind(null,h,r),null)),[o,f,t]}function Rx(t,i){t.action=i}function up(t){var i=We(),r=Ue;if(r!==null)return lp(i,r,t);We(),i=i.memoizedState,r=We();var o=r.queue.dispatch;return r.memoizedState=t,[i,o,!1]}function Hs(t,i,r,o){return t={tag:t,create:r,deps:o,inst:i,next:null},i=ye.updateQueue,i===null&&(i=ko(),ye.updateQueue=i),r=i.lastEffect,r===null?i.lastEffect=t.next=t:(o=r.next,r.next=t,t.next=o,i.lastEffect=t),t}function cp(){return We().memoizedState}function No(t,i,r,o){var h=St();ye.flags|=t,h.memoizedState=Hs(1|i,{destroy:void 0},r,o===void 0?null:o)}function Do(t,i,r,o){var h=We();o=o===void 0?null:o;var f=h.memoizedState.inst;Ue!==null&&o!==null&&lc(o,Ue.memoizedState.deps)?h.memoizedState=Hs(i,f,r,o):(ye.flags|=t,h.memoizedState=Hs(1|i,f,r,o))}function hp(t,i){No(8390656,8,t,i)}function vc(t,i){Do(2048,8,t,i)}function Cx(t){ye.flags|=4;var i=ye.updateQueue;if(i===null)i=ko(),ye.updateQueue=i,i.events=[t];else{var r=i.events;r===null?i.events=[t]:r.push(t)}}function dp(t){var i=We().memoizedState;return Cx({ref:i,nextImpl:t}),function(){if((Ce&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function fp(t,i){return Do(4,2,t,i)}function mp(t,i){return Do(4,4,t,i)}function pp(t,i){if(typeof i=="function"){t=t();var r=i(t);return function(){typeof r=="function"?r():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function gp(t,i,r){r=r!=null?r.concat([t]):null,Do(4,4,pp.bind(null,i,t),r)}function bc(){}function yp(t,i){var r=We();i=i===void 0?null:i;var o=r.memoizedState;return i!==null&&lc(i,o[1])?o[0]:(r.memoizedState=[t,i],t)}function vp(t,i){var r=We();i=i===void 0?null:i;var o=r.memoizedState;if(i!==null&&lc(i,o[1]))return o[0];if(o=t(),ts){li(!0);try{t()}finally{li(!1)}}return r.memoizedState=[o,i],o}function wc(t,i,r){return r===void 0||(Gn&1073741824)!==0&&(xe&261930)===0?t.memoizedState=i:(t.memoizedState=r,t=bg(),ye.lanes|=t,xi|=t,r)}function bp(t,i,r,o){return Vt(r,i)?r:zs.current!==null?(t=wc(t,r,o),Vt(t,i)||(it=!0),t):(Gn&42)===0||(Gn&1073741824)!==0&&(xe&261930)===0?(it=!0,t.memoizedState=r):(t=bg(),ye.lanes|=t,xi|=t,i)}function wp(t,i,r,o,h){var f=Q.p;Q.p=f!==0&&8>f?f:8;var y=L.T,_={};L.T=_,Sc(t,!1,i,r);try{var T=h(),M=L.S;if(M!==null&&M(_,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var H=Sx(T,o);Ka(t,i,H,Gt(t))}else Ka(t,i,o,Gt(t))}catch(q){Ka(t,i,{then:function(){},status:"rejected",reason:q},Gt())}finally{Q.p=f,y!==null&&_.types!==null&&(y.types=_.types),L.T=y}}function kx(){}function _c(t,i,r,o){if(t.tag!==5)throw Error(a(476));var h=_p(t).queue;wp(t,h,i,Y,r===null?kx:function(){return xp(t),r(o)})}function _p(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:Y},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:r},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function xp(t){var i=_p(t);i.next===null&&(i=t.alternate.memoizedState),Ka(t,i.next.queue,{},Gt())}function xc(){return pt(ur)}function Sp(){return We().memoizedState}function Tp(){return We().memoizedState}function jx(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var r=Gt();t=gi(r);var o=yi(i,t,r);o!==null&&(Dt(o,i,r),Ha(o,i,r)),i={cache:Qu()},t.payload=i;return}i=i.return}}function Ox(t,i,r){var o=Gt();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Mo(t)?Ap(i,r):(r=Pu(t,i,r,o),r!==null&&(Dt(r,t,o),Rp(r,i,o)))}function Ep(t,i,r){var o=Gt();Ka(t,i,r,o)}function Ka(t,i,r,o){var h={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Mo(t))Ap(i,h);else{var f=t.alternate;if(t.lanes===0&&(f===null||f.lanes===0)&&(f=i.lastRenderedReducer,f!==null))try{var y=i.lastRenderedState,_=f(y,r);if(h.hasEagerState=!0,h.eagerState=_,Vt(_,y))return mo(t,i,h,0),ze===null&&fo(),!1}catch{}finally{}if(r=Pu(t,i,h,o),r!==null)return Dt(r,t,o),Rp(r,i,o),!0}return!1}function Sc(t,i,r,o){if(o={lane:2,revertLane:th(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Mo(t)){if(i)throw Error(a(479))}else i=Pu(t,r,o,2),i!==null&&Dt(i,t,2)}function Mo(t){var i=t.alternate;return t===ye||i!==null&&i===ye}function Ap(t,i){Vs=Ro=!0;var r=t.pending;r===null?i.next=i:(i.next=r.next,r.next=i),t.pending=i}function Rp(t,i,r){if((r&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,Nf(t,r)}}var Fa={readContext:pt,use:jo,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye};Fa.useEffectEvent=Ye;var Cp={readContext:pt,use:jo,useCallback:function(t,i){return St().memoizedState=[t,i===void 0?null:i],t},useContext:pt,useEffect:hp,useImperativeHandle:function(t,i,r){r=r!=null?r.concat([t]):null,No(4194308,4,pp.bind(null,i,t),r)},useLayoutEffect:function(t,i){return No(4194308,4,t,i)},useInsertionEffect:function(t,i){No(4,2,t,i)},useMemo:function(t,i){var r=St();i=i===void 0?null:i;var o=t();if(ts){li(!0);try{t()}finally{li(!1)}}return r.memoizedState=[o,i],o},useReducer:function(t,i,r){var o=St();if(r!==void 0){var h=r(i);if(ts){li(!0);try{r(i)}finally{li(!1)}}}else h=i;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=Ox.bind(null,ye,t),[o.memoizedState,t]},useRef:function(t){var i=St();return t={current:t},i.memoizedState=t},useState:function(t){t=gc(t);var i=t.queue,r=Ep.bind(null,ye,i);return i.dispatch=r,[t.memoizedState,r]},useDebugValue:bc,useDeferredValue:function(t,i){var r=St();return wc(r,t,i)},useTransition:function(){var t=gc(!1);return t=wp.bind(null,ye,t.queue,!0,!1),St().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,r){var o=ye,h=St();if(Te){if(r===void 0)throw Error(a(407));r=r()}else{if(r=i(),ze===null)throw Error(a(349));(xe&127)!==0||Xm(o,i,r)}h.memoizedState=r;var f={value:r,getSnapshot:i};return h.queue=f,hp(Qm.bind(null,o,f,t),[t]),o.flags|=2048,Hs(9,{destroy:void 0},Jm.bind(null,o,f,r,i),null),r},useId:function(){var t=St(),i=ze.identifierPrefix;if(Te){var r=En,o=Tn;r=(o&~(1<<32-zt(o)-1)).toString(32)+r,i="_"+i+"R_"+r,r=Co++,0<r&&(i+="H"+r.toString(32)),i+="_"}else r=Tx++,i="_"+i+"r_"+r.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:xc,useFormState:rp,useActionState:rp,useOptimistic:function(t){var i=St();i.memoizedState=i.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=r,i=Sc.bind(null,ye,!0,r),r.dispatch=i,[t,i]},useMemoCache:fc,useCacheRefresh:function(){return St().memoizedState=jx.bind(null,ye)},useEffectEvent:function(t){var i=St(),r={impl:t};return i.memoizedState=r,function(){if((Ce&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Tc={readContext:pt,use:jo,useCallback:yp,useContext:pt,useEffect:vc,useImperativeHandle:gp,useInsertionEffect:fp,useLayoutEffect:mp,useMemo:vp,useReducer:Oo,useRef:cp,useState:function(){return Oo(Kn)},useDebugValue:bc,useDeferredValue:function(t,i){var r=We();return bp(r,Ue.memoizedState,t,i)},useTransition:function(){var t=Oo(Kn)[0],i=We().memoizedState;return[typeof t=="boolean"?t:Ga(t),i]},useSyncExternalStore:Ym,useId:Sp,useHostTransitionStatus:xc,useFormState:op,useActionState:op,useOptimistic:function(t,i){var r=We();return ep(r,Ue,t,i)},useMemoCache:fc,useCacheRefresh:Tp};Tc.useEffectEvent=dp;var kp={readContext:pt,use:jo,useCallback:yp,useContext:pt,useEffect:vc,useImperativeHandle:gp,useInsertionEffect:fp,useLayoutEffect:mp,useMemo:vp,useReducer:pc,useRef:cp,useState:function(){return pc(Kn)},useDebugValue:bc,useDeferredValue:function(t,i){var r=We();return Ue===null?wc(r,t,i):bp(r,Ue.memoizedState,t,i)},useTransition:function(){var t=pc(Kn)[0],i=We().memoizedState;return[typeof t=="boolean"?t:Ga(t),i]},useSyncExternalStore:Ym,useId:Sp,useHostTransitionStatus:xc,useFormState:up,useActionState:up,useOptimistic:function(t,i){var r=We();return Ue!==null?ep(r,Ue,t,i):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:fc,useCacheRefresh:Tp};kp.useEffectEvent=dp;function Ec(t,i,r,o){i=t.memoizedState,r=r(o,i),r=r==null?i:v({},i,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Ac={enqueueSetState:function(t,i,r){t=t._reactInternals;var o=Gt(),h=gi(o);h.payload=i,r!=null&&(h.callback=r),i=yi(t,h,o),i!==null&&(Dt(i,t,o),Ha(i,t,o))},enqueueReplaceState:function(t,i,r){t=t._reactInternals;var o=Gt(),h=gi(o);h.tag=1,h.payload=i,r!=null&&(h.callback=r),i=yi(t,h,o),i!==null&&(Dt(i,t,o),Ha(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var r=Gt(),o=gi(r);o.tag=2,i!=null&&(o.callback=i),i=yi(t,o,r),i!==null&&(Dt(i,t,r),Ha(i,t,r))}};function jp(t,i,r,o,h,f,y){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,f,y):i.prototype&&i.prototype.isPureReactComponent?!Da(r,o)||!Da(h,f):!0}function Op(t,i,r,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(r,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(r,o),i.state!==t&&Ac.enqueueReplaceState(i,i.state,null)}function ns(t,i){var r=i;if("ref"in i){r={};for(var o in i)o!=="ref"&&(r[o]=i[o])}if(t=t.defaultProps){r===i&&(r=v({},r));for(var h in t)r[h]===void 0&&(r[h]=t[h])}return r}function Np(t){ho(t)}function Dp(t){console.error(t)}function Mp(t){ho(t)}function Uo(t,i){try{var r=t.onUncaughtError;r(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Up(t,i,r){try{var o=t.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Rc(t,i,r){return r=gi(r),r.tag=3,r.payload={element:null},r.callback=function(){Uo(t,i)},r}function Bp(t){return t=gi(t),t.tag=3,t}function Lp(t,i,r,o){var h=r.type.getDerivedStateFromError;if(typeof h=="function"){var f=o.value;t.payload=function(){return h(f)},t.callback=function(){Up(i,r,o)}}var y=r.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(t.callback=function(){Up(i,r,o),typeof h!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var _=o.stack;this.componentDidCatch(o.value,{componentStack:_!==null?_:""})})}function Nx(t,i,r,o,h){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=r.alternate,i!==null&&Ds(i,r,h,!0),r=Ht.current,r!==null){switch(r.tag){case 31:case 13:return nn===null?Fo():r.alternate===null&&Xe===0&&(Xe=3),r.flags&=-257,r.flags|=65536,r.lanes=h,o===xo?r.flags|=16384:(i=r.updateQueue,i===null?r.updateQueue=new Set([o]):i.add(o),Zc(t,o,h)),!1;case 22:return r.flags|=65536,o===xo?r.flags|=16384:(i=r.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=i):(r=i.retryQueue,r===null?i.retryQueue=new Set([o]):r.add(o)),Zc(t,o,h)),!1}throw Error(a(435,r.tag))}return Zc(t,o,h),Fo(),!1}if(Te)return i=Ht.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Ku&&(t=Error(a(422),{cause:o}),Ba(Zt(t,r)))):(o!==Ku&&(i=Error(a(423),{cause:o}),Ba(Zt(i,r))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Zt(o,r),h=Rc(t.stateNode,o,h),ic(t,h),Xe!==4&&(Xe=2)),!1;var f=Error(a(520),{cause:o});if(f=Zt(f,r),tr===null?tr=[f]:tr.push(f),Xe!==4&&(Xe=2),i===null)return!0;o=Zt(o,r),r=i;do{switch(r.tag){case 3:return r.flags|=65536,t=h&-h,r.lanes|=t,t=Rc(r.stateNode,o,t),ic(r,t),!1;case 1:if(i=r.type,f=r.stateNode,(r.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Si===null||!Si.has(f))))return r.flags|=65536,h&=-h,r.lanes|=h,h=Bp(h),Lp(h,t,r,o),ic(r,h),!1}r=r.return}while(r!==null);return!1}var Cc=Error(a(461)),it=!1;function gt(t,i,r,o){i.child=t===null?Hm(i,null,r,o):es(i,t.child,r,o)}function zp(t,i,r,o,h){r=r.render;var f=i.ref;if("ref"in o){var y={};for(var _ in o)_!=="ref"&&(y[_]=o[_])}else y=o;return Ji(i),o=uc(t,i,r,y,f,h),_=cc(),t!==null&&!it?(hc(t,i,h),Fn(t,i,h)):(Te&&_&&Iu(i),i.flags|=1,gt(t,i,o,h),i.child)}function Vp(t,i,r,o,h){if(t===null){var f=r.type;return typeof f=="function"&&!Hu(f)&&f.defaultProps===void 0&&r.compare===null?(i.tag=15,i.type=f,Pp(t,i,f,o,h)):(t=go(r.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(f=t.child,!Bc(t,h)){var y=f.memoizedProps;if(r=r.compare,r=r!==null?r:Da,r(y,o)&&t.ref===i.ref)return Fn(t,i,h)}return i.flags|=1,t=Hn(f,o),t.ref=i.ref,t.return=i,i.child=t}function Pp(t,i,r,o,h){if(t!==null){var f=t.memoizedProps;if(Da(f,o)&&t.ref===i.ref)if(it=!1,i.pendingProps=o=f,Bc(t,h))(t.flags&131072)!==0&&(it=!0);else return i.lanes=t.lanes,Fn(t,i,h)}return kc(t,i,r,o,h)}function Hp(t,i,r,o){var h=o.children,f=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(f=f!==null?f.baseLanes|r:r,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~f}else o=0,i.child=null;return $p(t,i,f,r,o)}if((r&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&wo(i,f!==null?f.cachePool:null),f!==null?Im(i,f):ac(),Gm(i);else return o=i.lanes=536870912,$p(t,i,f!==null?f.baseLanes|r:r,r,o)}else f!==null?(wo(i,f.cachePool),Im(i,f),bi(),i.memoizedState=null):(t!==null&&wo(i,null),ac(),bi());return gt(t,i,h,r),i.child}function Ya(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function $p(t,i,r,o,h){var f=Wu();return f=f===null?null:{parent:tt._currentValue,pool:f},i.memoizedState={baseLanes:r,cachePool:f},t!==null&&wo(i,null),ac(),Gm(i),t!==null&&Ds(t,i,o,!0),i.childLanes=h,null}function Bo(t,i){return i=zo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function qp(t,i,r){return es(i,t.child,null,r),t=Bo(i,i.pendingProps),t.flags|=2,$t(i),i.memoizedState=null,t}function Dx(t,i,r){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(Te){if(o.mode==="hidden")return t=Bo(i,o),i.lanes=536870912,Ya(null,t);if(oc(i),(t=Ie)?(t=ty(t,tn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:hi!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},r=Am(t),r.return=i,i.child=r,mt=i,Ie=null)):t=null,t===null)throw fi(i);return i.lanes=536870912,null}return Bo(i,o)}var f=t.memoizedState;if(f!==null){var y=f.dehydrated;if(oc(i),h)if(i.flags&256)i.flags&=-257,i=qp(t,i,r);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(it||Ds(t,i,r,!1),h=(r&t.childLanes)!==0,it||h){if(o=ze,o!==null&&(y=Df(o,r),y!==0&&y!==f.retryLane))throw f.retryLane=y,Ki(t,y),Dt(o,t,y),Cc;Fo(),i=qp(t,i,r)}else t=f.treeContext,Ie=sn(y.nextSibling),mt=i,Te=!0,di=null,tn=!1,t!==null&&km(i,t),i=Bo(i,o),i.flags|=4096;return i}return t=Hn(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Lo(t,i){var r=i.ref;if(r===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(t===null||t.ref!==r)&&(i.flags|=4194816)}}function kc(t,i,r,o,h){return Ji(i),r=uc(t,i,r,o,void 0,h),o=cc(),t!==null&&!it?(hc(t,i,h),Fn(t,i,h)):(Te&&o&&Iu(i),i.flags|=1,gt(t,i,r,h),i.child)}function Ip(t,i,r,o,h,f){return Ji(i),i.updateQueue=null,r=Fm(i,o,r,h),Km(t),o=cc(),t!==null&&!it?(hc(t,i,f),Fn(t,i,f)):(Te&&o&&Iu(i),i.flags|=1,gt(t,i,r,f),i.child)}function Gp(t,i,r,o,h){if(Ji(i),i.stateNode===null){var f=ks,y=r.contextType;typeof y=="object"&&y!==null&&(f=pt(y)),f=new r(o,f),i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Ac,i.stateNode=f,f._reactInternals=i,f=i.stateNode,f.props=o,f.state=i.memoizedState,f.refs={},tc(i),y=r.contextType,f.context=typeof y=="object"&&y!==null?pt(y):ks,f.state=i.memoizedState,y=r.getDerivedStateFromProps,typeof y=="function"&&(Ec(i,r,y,o),f.state=i.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&Ac.enqueueReplaceState(f,f.state,null),qa(i,o,f,h),$a(),f.state=i.memoizedState),typeof f.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){f=i.stateNode;var _=i.memoizedProps,T=ns(r,_);f.props=T;var M=f.context,H=r.contextType;y=ks,typeof H=="object"&&H!==null&&(y=pt(H));var q=r.getDerivedStateFromProps;H=typeof q=="function"||typeof f.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,H||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(_||M!==y)&&Op(i,f,o,y),pi=!1;var U=i.memoizedState;f.state=U,qa(i,o,f,h),$a(),M=i.memoizedState,_||U!==M||pi?(typeof q=="function"&&(Ec(i,r,q,o),M=i.memoizedState),(T=pi||jp(i,r,T,o,U,M,y))?(H||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(i.flags|=4194308)):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=M),f.props=o,f.state=M,f.context=y,o=T):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{f=i.stateNode,nc(t,i),y=i.memoizedProps,H=ns(r,y),f.props=H,q=i.pendingProps,U=f.context,M=r.contextType,T=ks,typeof M=="object"&&M!==null&&(T=pt(M)),_=r.getDerivedStateFromProps,(M=typeof _=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==q||U!==T)&&Op(i,f,o,T),pi=!1,U=i.memoizedState,f.state=U,qa(i,o,f,h),$a();var z=i.memoizedState;y!==q||U!==z||pi||t!==null&&t.dependencies!==null&&vo(t.dependencies)?(typeof _=="function"&&(Ec(i,r,_,o),z=i.memoizedState),(H=pi||jp(i,r,H,o,U,z,T)||t!==null&&t.dependencies!==null&&vo(t.dependencies))?(M||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,z,T),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,z,T)),typeof f.componentDidUpdate=="function"&&(i.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===t.memoizedProps&&U===t.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===t.memoizedProps&&U===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=z),f.props=o,f.state=z,f.context=T,o=H):(typeof f.componentDidUpdate!="function"||y===t.memoizedProps&&U===t.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===t.memoizedProps&&U===t.memoizedState||(i.flags|=1024),o=!1)}return f=o,Lo(t,i),o=(i.flags&128)!==0,f||o?(f=i.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:f.render(),i.flags|=1,t!==null&&o?(i.child=es(i,t.child,null,h),i.child=es(i,null,r,h)):gt(t,i,r,h),i.memoizedState=f.state,t=i.child):t=Fn(t,i,h),t}function Kp(t,i,r,o){return Yi(),i.flags|=256,gt(t,i,r,o),i.child}var jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oc(t){return{baseLanes:t,cachePool:Um()}}function Nc(t,i,r){return t=t!==null?t.childLanes&~r:0,i&&(t|=It),t}function Fp(t,i,r){var o=i.pendingProps,h=!1,f=(i.flags&128)!==0,y;if((y=f)||(y=t!==null&&t.memoizedState===null?!1:(Ze.current&2)!==0),y&&(h=!0,i.flags&=-129),y=(i.flags&32)!==0,i.flags&=-33,t===null){if(Te){if(h?vi(i):bi(),(t=Ie)?(t=ty(t,tn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:hi!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},r=Am(t),r.return=i,i.child=r,mt=i,Ie=null)):t=null,t===null)throw fi(i);return mh(t)?i.lanes=32:i.lanes=536870912,null}var _=o.children;return o=o.fallback,h?(bi(),h=i.mode,_=zo({mode:"hidden",children:_},h),o=Fi(o,h,r,null),_.return=i,o.return=i,_.sibling=o,i.child=_,o=i.child,o.memoizedState=Oc(r),o.childLanes=Nc(t,y,r),i.memoizedState=jc,Ya(null,o)):(vi(i),Dc(i,_))}var T=t.memoizedState;if(T!==null&&(_=T.dehydrated,_!==null)){if(f)i.flags&256?(vi(i),i.flags&=-257,i=Mc(t,i,r)):i.memoizedState!==null?(bi(),i.child=t.child,i.flags|=128,i=null):(bi(),_=o.fallback,h=i.mode,o=zo({mode:"visible",children:o.children},h),_=Fi(_,h,r,null),_.flags|=2,o.return=i,_.return=i,o.sibling=_,i.child=o,es(i,t.child,null,r),o=i.child,o.memoizedState=Oc(r),o.childLanes=Nc(t,y,r),i.memoizedState=jc,i=Ya(null,o));else if(vi(i),mh(_)){if(y=_.nextSibling&&_.nextSibling.dataset,y)var M=y.dgst;y=M,o=Error(a(419)),o.stack="",o.digest=y,Ba({value:o,source:null,stack:null}),i=Mc(t,i,r)}else if(it||Ds(t,i,r,!1),y=(r&t.childLanes)!==0,it||y){if(y=ze,y!==null&&(o=Df(y,r),o!==0&&o!==T.retryLane))throw T.retryLane=o,Ki(t,o),Dt(y,t,o),Cc;fh(_)||Fo(),i=Mc(t,i,r)}else fh(_)?(i.flags|=192,i.child=t.child,i=null):(t=T.treeContext,Ie=sn(_.nextSibling),mt=i,Te=!0,di=null,tn=!1,t!==null&&km(i,t),i=Dc(i,o.children),i.flags|=4096);return i}return h?(bi(),_=o.fallback,h=i.mode,T=t.child,M=T.sibling,o=Hn(T,{mode:"hidden",children:o.children}),o.subtreeFlags=T.subtreeFlags&65011712,M!==null?_=Hn(M,_):(_=Fi(_,h,r,null),_.flags|=2),_.return=i,o.return=i,o.sibling=_,i.child=o,Ya(null,o),o=i.child,_=t.child.memoizedState,_===null?_=Oc(r):(h=_.cachePool,h!==null?(T=tt._currentValue,h=h.parent!==T?{parent:T,pool:T}:h):h=Um(),_={baseLanes:_.baseLanes|r,cachePool:h}),o.memoizedState=_,o.childLanes=Nc(t,y,r),i.memoizedState=jc,Ya(t.child,o)):(vi(i),r=t.child,t=r.sibling,r=Hn(r,{mode:"visible",children:o.children}),r.return=i,r.sibling=null,t!==null&&(y=i.deletions,y===null?(i.deletions=[t],i.flags|=16):y.push(t)),i.child=r,i.memoizedState=null,r)}function Dc(t,i){return i=zo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function zo(t,i){return t=Pt(22,t,null,i),t.lanes=0,t}function Mc(t,i,r){return es(i,t.child,null,r),t=Dc(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function Yp(t,i,r){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Xu(t.return,i,r)}function Uc(t,i,r,o,h,f){var y=t.memoizedState;y===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:h,treeForkCount:f}:(y.isBackwards=i,y.rendering=null,y.renderingStartTime=0,y.last=o,y.tail=r,y.tailMode=h,y.treeForkCount=f)}function Xp(t,i,r){var o=i.pendingProps,h=o.revealOrder,f=o.tail;o=o.children;var y=Ze.current,_=(y&2)!==0;if(_?(y=y&1|2,i.flags|=128):y&=1,K(Ze,y),gt(t,i,o,r),o=Te?Ua:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Yp(t,r,i);else if(t.tag===19)Yp(t,r,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(r=i.child,h=null;r!==null;)t=r.alternate,t!==null&&Ao(t)===null&&(h=r),r=r.sibling;r=h,r===null?(h=i.child,i.child=null):(h=r.sibling,r.sibling=null),Uc(i,!1,h,r,f,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&Ao(t)===null){i.child=h;break}t=h.sibling,h.sibling=r,r=h,h=t}Uc(i,!0,r,null,f,o);break;case"together":Uc(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Fn(t,i,r){if(t!==null&&(i.dependencies=t.dependencies),xi|=i.lanes,(r&i.childLanes)===0)if(t!==null){if(Ds(t,i,r,!1),(r&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,r=Hn(t,t.pendingProps),i.child=r,r.return=i;t.sibling!==null;)t=t.sibling,r=r.sibling=Hn(t,t.pendingProps),r.return=i;r.sibling=null}return i.child}function Bc(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&vo(t)))}function Mx(t,i,r){switch(i.tag){case 3:qe(i,i.stateNode.containerInfo),mi(i,tt,t.memoizedState.cache),Yi();break;case 27:case 5:_n(i);break;case 4:qe(i,i.stateNode.containerInfo);break;case 10:mi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,oc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(vi(i),i.flags|=128,null):(r&i.child.childLanes)!==0?Fp(t,i,r):(vi(i),t=Fn(t,i,r),t!==null?t.sibling:null);vi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(r&i.childLanes)!==0,o||(Ds(t,i,r,!1),o=(r&i.childLanes)!==0),h){if(o)return Xp(t,i,r);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),K(Ze,Ze.current),o)break;return null;case 22:return i.lanes=0,Hp(t,i,r,i.pendingProps);case 24:mi(i,tt,t.memoizedState.cache)}return Fn(t,i,r)}function Jp(t,i,r){if(t!==null)if(t.memoizedProps!==i.pendingProps)it=!0;else{if(!Bc(t,r)&&(i.flags&128)===0)return it=!1,Mx(t,i,r);it=(t.flags&131072)!==0}else it=!1,Te&&(i.flags&1048576)!==0&&Cm(i,Ua,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=Zi(i.elementType),i.type=t,typeof t=="function")Hu(t)?(o=ns(t,o),i.tag=1,i=Gp(null,i,t,o,r)):(i.tag=0,i=kc(null,i,t,o,r));else{if(t!=null){var h=t.$$typeof;if(h===P){i.tag=11,i=zp(null,i,t,o,r);break e}else if(h===G){i.tag=14,i=Vp(null,i,t,o,r);break e}}throw i=Re(t)||t,Error(a(306,i,""))}}return i;case 0:return kc(t,i,i.type,i.pendingProps,r);case 1:return o=i.type,h=ns(o,i.pendingProps),Gp(t,i,o,h,r);case 3:e:{if(qe(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var f=i.memoizedState;h=f.element,nc(t,i),qa(i,o,null,r);var y=i.memoizedState;if(o=y.cache,mi(i,tt,o),o!==f.cache&&Ju(i,[tt],r,!0),$a(),o=y.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:y.cache},i.updateQueue.baseState=f,i.memoizedState=f,i.flags&256){i=Kp(t,i,o,r);break e}else if(o!==h){h=Zt(Error(a(424)),i),Ba(h),i=Kp(t,i,o,r);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ie=sn(t.firstChild),mt=i,Te=!0,di=null,tn=!0,r=Hm(i,null,o,r),i.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(Yi(),o===h){i=Fn(t,i,r);break e}gt(t,i,o,r)}i=i.child}return i;case 26:return Lo(t,i),t===null?(r=oy(i.type,null,i.pendingProps,null))?i.memoizedState=r:Te||(r=i.type,t=i.pendingProps,o=el(ue.current).createElement(r),o[ft]=i,o[Rt]=t,yt(o,r,t),ut(o),i.stateNode=o):i.memoizedState=oy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return _n(i),t===null&&Te&&(o=i.stateNode=sy(i.type,i.pendingProps,ue.current),mt=i,tn=!0,h=Ie,Ri(i.type)?(ph=h,Ie=sn(o.firstChild)):Ie=h),gt(t,i,i.pendingProps.children,r),Lo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&Te&&((h=o=Ie)&&(o=cS(o,i.type,i.pendingProps,tn),o!==null?(i.stateNode=o,mt=i,Ie=sn(o.firstChild),tn=!1,h=!0):h=!1),h||fi(i)),_n(i),h=i.type,f=i.pendingProps,y=t!==null?t.memoizedProps:null,o=f.children,ch(h,f)?o=null:y!==null&&ch(h,y)&&(i.flags|=32),i.memoizedState!==null&&(h=uc(t,i,Ex,null,null,r),ur._currentValue=h),Lo(t,i),gt(t,i,o,r),i.child;case 6:return t===null&&Te&&((t=r=Ie)&&(r=hS(r,i.pendingProps,tn),r!==null?(i.stateNode=r,mt=i,Ie=null,t=!0):t=!1),t||fi(i)),null;case 13:return Fp(t,i,r);case 4:return qe(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=es(i,null,o,r):gt(t,i,o,r),i.child;case 11:return zp(t,i,i.type,i.pendingProps,r);case 7:return gt(t,i,i.pendingProps,r),i.child;case 8:return gt(t,i,i.pendingProps.children,r),i.child;case 12:return gt(t,i,i.pendingProps.children,r),i.child;case 10:return o=i.pendingProps,mi(i,i.type,o.value),gt(t,i,o.children,r),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Ji(i),h=pt(h),o=o(h),i.flags|=1,gt(t,i,o,r),i.child;case 14:return Vp(t,i,i.type,i.pendingProps,r);case 15:return Pp(t,i,i.type,i.pendingProps,r);case 19:return Xp(t,i,r);case 31:return Dx(t,i,r);case 22:return Hp(t,i,r,i.pendingProps);case 24:return Ji(i),o=pt(tt),t===null?(h=Wu(),h===null&&(h=ze,f=Qu(),h.pooledCache=f,f.refCount++,f!==null&&(h.pooledCacheLanes|=r),h=f),i.memoizedState={parent:o,cache:h},tc(i),mi(i,tt,h)):((t.lanes&r)!==0&&(nc(t,i),qa(i,null,null,r),$a()),h=t.memoizedState,f=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),mi(i,tt,o)):(o=f.cache,mi(i,tt,o),o!==h.cache&&Ju(i,[tt],r,!0))),gt(t,i,i.pendingProps.children,r),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Yn(t){t.flags|=4}function Lc(t,i,r,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Sg())t.flags|=8192;else throw Wi=xo,ec}else t.flags&=-16777217}function Qp(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!dy(i))if(Sg())t.flags|=8192;else throw Wi=xo,ec}function Vo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?jf():536870912,t.lanes|=i,Gs|=i)}function Xa(t,i){if(!Te)switch(t.tailMode){case"hidden":i=t.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Ge(t){var i=t.alternate!==null&&t.alternate.child===t.child,r=0,o=0;if(i)for(var h=t.child;h!==null;)r|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)r|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=r,i}function Ux(t,i,r){var o=i.pendingProps;switch(Gu(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ge(i),null;case 1:return Ge(i),null;case 3:return r=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),In(tt),He(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ns(i)?Yn(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Fu())),Ge(i),null;case 26:var h=i.type,f=i.memoizedState;return t===null?(Yn(i),f!==null?(Ge(i),Qp(i,f)):(Ge(i),Lc(i,h,null,o,r))):f?f!==t.memoizedState?(Yn(i),Ge(i),Qp(i,f)):(Ge(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Yn(i),Ge(i),Lc(i,h,t,o,r)),null;case 27:if(wt(i),r=ue.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Yn(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Ge(i),null}t=W.current,Ns(i)?jm(i):(t=sy(h,o,r),i.stateNode=t,Yn(i))}return Ge(i),null;case 5:if(wt(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Yn(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Ge(i),null}if(f=W.current,Ns(i))jm(i);else{var y=el(ue.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?y.createElement(h,{is:o.is}):y.createElement(h)}}f[ft]=i,f[Rt]=o;e:for(y=i.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===i)break e;for(;y.sibling===null;){if(y.return===null||y.return===i)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}i.stateNode=f;e:switch(yt(f,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Yn(i)}}return Ge(i),Lc(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,r),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Yn(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=ue.current,Ns(i)){if(t=i.stateNode,r=i.memoizedProps,o=null,h=mt,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[ft]=i,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||Fg(t.nodeValue,r)),t||fi(i,!0)}else t=el(t).createTextNode(o),t[ft]=i,i.stateNode=t}return Ge(i),null;case 31:if(r=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ns(i),r!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[ft]=i}else Yi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ge(i),t=!1}else r=Fu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return i.flags&256?($t(i),i):($t(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ge(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ns(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[ft]=i}else Yi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ge(i),h=!1}else h=Fu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?($t(i),i):($t(i),null)}return $t(i),(i.flags&128)!==0?(i.lanes=r,i):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==h&&(o.flags|=2048)),r!==t&&r&&(i.child.flags|=8192),Vo(i,i.updateQueue),Ge(i),null);case 4:return He(),t===null&&ah(i.stateNode.containerInfo),Ge(i),null;case 10:return In(i.type),Ge(i),null;case 19:if(B(Ze),o=i.memoizedState,o===null)return Ge(i),null;if(h=(i.flags&128)!==0,f=o.rendering,f===null)if(h)Xa(o,!1);else{if(Xe!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(f=Ao(t),f!==null){for(i.flags|=128,Xa(o,!1),t=f.updateQueue,i.updateQueue=t,Vo(i,t),i.subtreeFlags=0,t=r,r=i.child;r!==null;)Em(r,t),r=r.sibling;return K(Ze,Ze.current&1|2),Te&&$n(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&Me()>Io&&(i.flags|=128,h=!0,Xa(o,!1),i.lanes=4194304)}else{if(!h)if(t=Ao(f),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,Vo(i,t),Xa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!Te)return Ge(i),null}else 2*Me()-o.renderingStartTime>Io&&r!==536870912&&(i.flags|=128,h=!0,Xa(o,!1),i.lanes=4194304);o.isBackwards?(f.sibling=i.child,i.child=f):(t=o.last,t!==null?t.sibling=f:i.child=f,o.last=f)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Me(),t.sibling=null,r=Ze.current,K(Ze,h?r&1|2:r&1),Te&&$n(i,o.treeForkCount),t):(Ge(i),null);case 22:case 23:return $t(i),rc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(r&536870912)!==0&&(i.flags&128)===0&&(Ge(i),i.subtreeFlags&6&&(i.flags|=8192)):Ge(i),r=i.updateQueue,r!==null&&Vo(i,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048),t!==null&&B(Qi),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),In(tt),Ge(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Bx(t,i){switch(Gu(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return In(tt),He(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return wt(i),null;case 31:if(i.memoizedState!==null){if($t(i),i.alternate===null)throw Error(a(340));Yi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if($t(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Yi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return B(Ze),null;case 4:return He(),null;case 10:return In(i.type),null;case 22:case 23:return $t(i),rc(),t!==null&&B(Qi),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return In(tt),null;case 25:return null;default:return null}}function Zp(t,i){switch(Gu(i),i.tag){case 3:In(tt),He();break;case 26:case 27:case 5:wt(i);break;case 4:He();break;case 31:i.memoizedState!==null&&$t(i);break;case 13:$t(i);break;case 19:B(Ze);break;case 10:In(i.type);break;case 22:case 23:$t(i),rc(),t!==null&&B(Qi);break;case 24:In(tt)}}function Ja(t,i){try{var r=i.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var h=o.next;r=h;do{if((r.tag&t)===t){o=void 0;var f=r.create,y=r.inst;o=f(),y.destroy=o}r=r.next}while(r!==h)}}catch(_){Ne(i,i.return,_)}}function wi(t,i,r){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var f=h.next;o=f;do{if((o.tag&t)===t){var y=o.inst,_=y.destroy;if(_!==void 0){y.destroy=void 0,h=i;var T=r,M=_;try{M()}catch(H){Ne(h,T,H)}}}o=o.next}while(o!==f)}}catch(H){Ne(i,i.return,H)}}function Wp(t){var i=t.updateQueue;if(i!==null){var r=t.stateNode;try{qm(i,r)}catch(o){Ne(t,t.return,o)}}}function eg(t,i,r){r.props=ns(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){Ne(t,i,o)}}function Qa(t,i){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(h){Ne(t,i,h)}}function An(t,i){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(h){Ne(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(h){Ne(t,i,h)}else r.current=null}function tg(t){var i=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(h){Ne(t,t.return,h)}}function zc(t,i,r){try{var o=t.stateNode;sS(o,t.type,r,i),o[Rt]=i}catch(h){Ne(t,t.return,h)}}function ng(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ri(t.type)||t.tag===4}function Vc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ng(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ri(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Pc(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(t),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=Vn));else if(o!==4&&(o===27&&Ri(t.type)&&(r=t.stateNode,i=null),t=t.child,t!==null))for(Pc(t,i,r),t=t.sibling;t!==null;)Pc(t,i,r),t=t.sibling}function Po(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?r.insertBefore(t,i):r.appendChild(t);else if(o!==4&&(o===27&&Ri(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(Po(t,i,r),t=t.sibling;t!==null;)Po(t,i,r),t=t.sibling}function ig(t){var i=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);yt(i,o,r),i[ft]=t,i[Rt]=r}catch(f){Ne(t,t.return,f)}}var Xn=!1,st=!1,Hc=!1,sg=typeof WeakSet=="function"?WeakSet:Set,ct=null;function Lx(t,i){if(t=t.containerInfo,lh=ol,t=gm(t),Mu(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{r.nodeType,f.nodeType}catch{r=null;break e}var y=0,_=-1,T=-1,M=0,H=0,q=t,U=null;t:for(;;){for(var z;q!==r||h!==0&&q.nodeType!==3||(_=y+h),q!==f||o!==0&&q.nodeType!==3||(T=y+o),q.nodeType===3&&(y+=q.nodeValue.length),(z=q.firstChild)!==null;)U=q,q=z;for(;;){if(q===t)break t;if(U===r&&++M===h&&(_=y),U===f&&++H===o&&(T=y),(z=q.nextSibling)!==null)break;q=U,U=q.parentNode}q=z}r=_===-1||T===-1?null:{start:_,end:T}}else r=null}r=r||{start:0,end:0}}else r=null;for(uh={focusedElem:t,selectionRange:r},ol=!1,ct=i;ct!==null;)if(i=ct,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,ct=t;else for(;ct!==null;){switch(i=ct,f=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)h=t[r],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&f!==null){t=void 0,r=i,h=f.memoizedProps,f=f.memoizedState,o=r.stateNode;try{var ie=ns(r.type,h);t=o.getSnapshotBeforeUpdate(ie,f),o.__reactInternalSnapshotBeforeUpdate=t}catch(me){Ne(r,r.return,me)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,r=t.nodeType,r===9)dh(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":dh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=i.sibling,t!==null){t.return=i.return,ct=t;break}ct=i.return}}function ag(t,i,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:Qn(t,r),o&4&&Ja(5,r);break;case 1:if(Qn(t,r),o&4)if(t=r.stateNode,i===null)try{t.componentDidMount()}catch(y){Ne(r,r.return,y)}else{var h=ns(r.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(y){Ne(r,r.return,y)}}o&64&&Wp(r),o&512&&Qa(r,r.return);break;case 3:if(Qn(t,r),o&64&&(t=r.updateQueue,t!==null)){if(i=null,r.child!==null)switch(r.child.tag){case 27:case 5:i=r.child.stateNode;break;case 1:i=r.child.stateNode}try{qm(t,i)}catch(y){Ne(r,r.return,y)}}break;case 27:i===null&&o&4&&ig(r);case 26:case 5:Qn(t,r),i===null&&o&4&&tg(r),o&512&&Qa(r,r.return);break;case 12:Qn(t,r);break;case 31:Qn(t,r),o&4&&lg(t,r);break;case 13:Qn(t,r),o&4&&ug(t,r),o&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=Kx.bind(null,r),dS(t,r))));break;case 22:if(o=r.memoizedState!==null||Xn,!o){i=i!==null&&i.memoizedState!==null||st,h=Xn;var f=st;Xn=o,(st=i)&&!f?Zn(t,r,(r.subtreeFlags&8772)!==0):Qn(t,r),Xn=h,st=f}break;case 30:break;default:Qn(t,r)}}function rg(t){var i=t.alternate;i!==null&&(t.alternate=null,rg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&yu(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Ke=null,kt=!1;function Jn(t,i,r){for(r=r.child;r!==null;)og(t,i,r),r=r.sibling}function og(t,i,r){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(_a,r)}catch{}switch(r.tag){case 26:st||An(r,i),Jn(t,i,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:st||An(r,i);var o=Ke,h=kt;Ri(r.type)&&(Ke=r.stateNode,kt=!1),Jn(t,i,r),rr(r.stateNode),Ke=o,kt=h;break;case 5:st||An(r,i);case 6:if(o=Ke,h=kt,Ke=null,Jn(t,i,r),Ke=o,kt=h,Ke!==null)if(kt)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(r.stateNode)}catch(f){Ne(r,i,f)}else try{Ke.removeChild(r.stateNode)}catch(f){Ne(r,i,f)}break;case 18:Ke!==null&&(kt?(t=Ke,Wg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Ws(t)):Wg(Ke,r.stateNode));break;case 4:o=Ke,h=kt,Ke=r.stateNode.containerInfo,kt=!0,Jn(t,i,r),Ke=o,kt=h;break;case 0:case 11:case 14:case 15:wi(2,r,i),st||wi(4,r,i),Jn(t,i,r);break;case 1:st||(An(r,i),o=r.stateNode,typeof o.componentWillUnmount=="function"&&eg(r,i,o)),Jn(t,i,r);break;case 21:Jn(t,i,r);break;case 22:st=(o=st)||r.memoizedState!==null,Jn(t,i,r),st=o;break;default:Jn(t,i,r)}}function lg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ws(t)}catch(r){Ne(i,i.return,r)}}}function ug(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ws(t)}catch(r){Ne(i,i.return,r)}}function zx(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new sg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new sg),i;default:throw Error(a(435,t.tag))}}function Ho(t,i){var r=zx(t);i.forEach(function(o){if(!r.has(o)){r.add(o);var h=Fx.bind(null,t,o);o.then(h,h)}})}function jt(t,i){var r=i.deletions;if(r!==null)for(var o=0;o<r.length;o++){var h=r[o],f=t,y=i,_=y;e:for(;_!==null;){switch(_.tag){case 27:if(Ri(_.type)){Ke=_.stateNode,kt=!1;break e}break;case 5:Ke=_.stateNode,kt=!1;break e;case 3:case 4:Ke=_.stateNode.containerInfo,kt=!0;break e}_=_.return}if(Ke===null)throw Error(a(160));og(f,y,h),Ke=null,kt=!1,f=h.alternate,f!==null&&(f.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)cg(i,t),i=i.sibling}var cn=null;function cg(t,i){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:jt(i,t),Ot(t),o&4&&(wi(3,t,t.return),Ja(3,t),wi(5,t,t.return));break;case 1:jt(i,t),Ot(t),o&512&&(st||r===null||An(r,r.return)),o&64&&Xn&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var h=cn;if(jt(i,t),Ot(t),o&512&&(st||r===null||An(r,r.return)),o&4){var f=r!==null?r.memoizedState:null;if(o=t.memoizedState,r===null)if(o===null)if(t.stateNode===null){e:{o=t.type,r=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":f=h.getElementsByTagName("title")[0],(!f||f[Ta]||f[ft]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=h.createElement(o),h.head.insertBefore(f,h.querySelector("head > title"))),yt(f,o,r),f[ft]=t,ut(f),o=f;break e;case"link":var y=cy("link","href",h).get(o+(r.href||""));if(y){for(var _=0;_<y.length;_++)if(f=y[_],f.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&f.getAttribute("rel")===(r.rel==null?null:r.rel)&&f.getAttribute("title")===(r.title==null?null:r.title)&&f.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){y.splice(_,1);break t}}f=h.createElement(o),yt(f,o,r),h.head.appendChild(f);break;case"meta":if(y=cy("meta","content",h).get(o+(r.content||""))){for(_=0;_<y.length;_++)if(f=y[_],f.getAttribute("content")===(r.content==null?null:""+r.content)&&f.getAttribute("name")===(r.name==null?null:r.name)&&f.getAttribute("property")===(r.property==null?null:r.property)&&f.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&f.getAttribute("charset")===(r.charSet==null?null:r.charSet)){y.splice(_,1);break t}}f=h.createElement(o),yt(f,o,r),h.head.appendChild(f);break;default:throw Error(a(468,o))}f[ft]=t,ut(f),o=f}t.stateNode=o}else hy(h,t.type,t.stateNode);else t.stateNode=uy(h,o,t.memoizedProps);else f!==o?(f===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):f.count--,o===null?hy(h,t.type,t.stateNode):uy(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&zc(t,t.memoizedProps,r.memoizedProps)}break;case 27:jt(i,t),Ot(t),o&512&&(st||r===null||An(r,r.return)),r!==null&&o&4&&zc(t,t.memoizedProps,r.memoizedProps);break;case 5:if(jt(i,t),Ot(t),o&512&&(st||r===null||An(r,r.return)),t.flags&32){h=t.stateNode;try{xs(h,"")}catch(ie){Ne(t,t.return,ie)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,zc(t,h,r!==null?r.memoizedProps:h)),o&1024&&(Hc=!0);break;case 6:if(jt(i,t),Ot(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,r=t.stateNode;try{r.nodeValue=o}catch(ie){Ne(t,t.return,ie)}}break;case 3:if(il=null,h=cn,cn=tl(i.containerInfo),jt(i,t),cn=h,Ot(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Ws(i.containerInfo)}catch(ie){Ne(t,t.return,ie)}Hc&&(Hc=!1,hg(t));break;case 4:o=cn,cn=tl(t.stateNode.containerInfo),jt(i,t),Ot(t),cn=o;break;case 12:jt(i,t),Ot(t);break;case 31:jt(i,t),Ot(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 13:jt(i,t),Ot(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(qo=Me()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 22:h=t.memoizedState!==null;var T=r!==null&&r.memoizedState!==null,M=Xn,H=st;if(Xn=M||h,st=H||T,jt(i,t),st=H,Xn=M,Ot(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(r===null||T||Xn||st||is(t)),r=null,i=t;;){if(i.tag===5||i.tag===26){if(r===null){T=r=i;try{if(f=T.stateNode,h)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{_=T.stateNode;var q=T.memoizedProps.style,U=q!=null&&q.hasOwnProperty("display")?q.display:null;_.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ie){Ne(T,T.return,ie)}}}else if(i.tag===6){if(r===null){T=i;try{T.stateNode.nodeValue=h?"":T.memoizedProps}catch(ie){Ne(T,T.return,ie)}}}else if(i.tag===18){if(r===null){T=i;try{var z=T.stateNode;h?ey(z,!0):ey(T.stateNode,!1)}catch(ie){Ne(T,T.return,ie)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;r===i&&(r=null),i=i.return}r===i&&(r=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,Ho(t,r))));break;case 19:jt(i,t),Ot(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 30:break;case 21:break;default:jt(i,t),Ot(t)}}function Ot(t){var i=t.flags;if(i&2){try{for(var r,o=t.return;o!==null;){if(ng(o)){r=o;break}o=o.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var h=r.stateNode,f=Vc(t);Po(t,f,h);break;case 5:var y=r.stateNode;r.flags&32&&(xs(y,""),r.flags&=-33);var _=Vc(t);Po(t,_,y);break;case 3:case 4:var T=r.stateNode.containerInfo,M=Vc(t);Pc(t,M,T);break;default:throw Error(a(161))}}catch(H){Ne(t,t.return,H)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function hg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;hg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Qn(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)ag(t,i.alternate,i),i=i.sibling}function is(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:wi(4,i,i.return),is(i);break;case 1:An(i,i.return);var r=i.stateNode;typeof r.componentWillUnmount=="function"&&eg(i,i.return,r),is(i);break;case 27:rr(i.stateNode);case 26:case 5:An(i,i.return),is(i);break;case 22:i.memoizedState===null&&is(i);break;case 30:is(i);break;default:is(i)}t=t.sibling}}function Zn(t,i,r){for(r=r&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=t,f=i,y=f.flags;switch(f.tag){case 0:case 11:case 15:Zn(h,f,r),Ja(4,f);break;case 1:if(Zn(h,f,r),o=f,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(M){Ne(o,o.return,M)}if(o=f,h=o.updateQueue,h!==null){var _=o.stateNode;try{var T=h.shared.hiddenCallbacks;if(T!==null)for(h.shared.hiddenCallbacks=null,h=0;h<T.length;h++)$m(T[h],_)}catch(M){Ne(o,o.return,M)}}r&&y&64&&Wp(f),Qa(f,f.return);break;case 27:ig(f);case 26:case 5:Zn(h,f,r),r&&o===null&&y&4&&tg(f),Qa(f,f.return);break;case 12:Zn(h,f,r);break;case 31:Zn(h,f,r),r&&y&4&&lg(h,f);break;case 13:Zn(h,f,r),r&&y&4&&ug(h,f);break;case 22:f.memoizedState===null&&Zn(h,f,r),Qa(f,f.return);break;case 30:break;default:Zn(h,f,r)}i=i.sibling}}function $c(t,i){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&La(r))}function qc(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&La(t))}function hn(t,i,r,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)dg(t,i,r,o),i=i.sibling}function dg(t,i,r,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:hn(t,i,r,o),h&2048&&Ja(9,i);break;case 1:hn(t,i,r,o);break;case 3:hn(t,i,r,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&La(t)));break;case 12:if(h&2048){hn(t,i,r,o),t=i.stateNode;try{var f=i.memoizedProps,y=f.id,_=f.onPostCommit;typeof _=="function"&&_(y,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(T){Ne(i,i.return,T)}}else hn(t,i,r,o);break;case 31:hn(t,i,r,o);break;case 13:hn(t,i,r,o);break;case 23:break;case 22:f=i.stateNode,y=i.alternate,i.memoizedState!==null?f._visibility&2?hn(t,i,r,o):Za(t,i):f._visibility&2?hn(t,i,r,o):(f._visibility|=2,$s(t,i,r,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&$c(y,i);break;case 24:hn(t,i,r,o),h&2048&&qc(i.alternate,i);break;default:hn(t,i,r,o)}}function $s(t,i,r,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var f=t,y=i,_=r,T=o,M=y.flags;switch(y.tag){case 0:case 11:case 15:$s(f,y,_,T,h),Ja(8,y);break;case 23:break;case 22:var H=y.stateNode;y.memoizedState!==null?H._visibility&2?$s(f,y,_,T,h):Za(f,y):(H._visibility|=2,$s(f,y,_,T,h)),h&&M&2048&&$c(y.alternate,y);break;case 24:$s(f,y,_,T,h),h&&M&2048&&qc(y.alternate,y);break;default:$s(f,y,_,T,h)}i=i.sibling}}function Za(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var r=t,o=i,h=o.flags;switch(o.tag){case 22:Za(r,o),h&2048&&$c(o.alternate,o);break;case 24:Za(r,o),h&2048&&qc(o.alternate,o);break;default:Za(r,o)}i=i.sibling}}var Wa=8192;function qs(t,i,r){if(t.subtreeFlags&Wa)for(t=t.child;t!==null;)fg(t,i,r),t=t.sibling}function fg(t,i,r){switch(t.tag){case 26:qs(t,i,r),t.flags&Wa&&t.memoizedState!==null&&TS(r,cn,t.memoizedState,t.memoizedProps);break;case 5:qs(t,i,r);break;case 3:case 4:var o=cn;cn=tl(t.stateNode.containerInfo),qs(t,i,r),cn=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Wa,Wa=16777216,qs(t,i,r),Wa=o):qs(t,i,r));break;default:qs(t,i,r)}}function mg(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function er(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];ct=o,gg(o,t)}mg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)pg(t),t=t.sibling}function pg(t){switch(t.tag){case 0:case 11:case 15:er(t),t.flags&2048&&wi(9,t,t.return);break;case 3:er(t);break;case 12:er(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,$o(t)):er(t);break;default:er(t)}}function $o(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];ct=o,gg(o,t)}mg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:wi(8,i,i.return),$o(i);break;case 22:r=i.stateNode,r._visibility&2&&(r._visibility&=-3,$o(i));break;default:$o(i)}t=t.sibling}}function gg(t,i){for(;ct!==null;){var r=ct;switch(r.tag){case 0:case 11:case 15:wi(8,r,i);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:La(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,ct=o;else e:for(r=t;ct!==null;){o=ct;var h=o.sibling,f=o.return;if(rg(o),o===r){ct=null;break e}if(h!==null){h.return=f,ct=h;break e}ct=f}}}var Vx={getCacheForType:function(t){var i=pt(tt),r=i.data.get(t);return r===void 0&&(r=t(),i.data.set(t,r)),r},cacheSignal:function(){return pt(tt).controller.signal}},Px=typeof WeakMap=="function"?WeakMap:Map,Ce=0,ze=null,be=null,xe=0,Oe=0,qt=null,_i=!1,Is=!1,Ic=!1,Wn=0,Xe=0,xi=0,ss=0,Gc=0,It=0,Gs=0,tr=null,Nt=null,Kc=!1,qo=0,yg=0,Io=1/0,Go=null,Si=null,ot=0,Ti=null,Ks=null,ei=0,Fc=0,Yc=null,vg=null,nr=0,Xc=null;function Gt(){return(Ce&2)!==0&&xe!==0?xe&-xe:L.T!==null?th():Mf()}function bg(){if(It===0)if((xe&536870912)===0||Te){var t=Zr;Zr<<=1,(Zr&3932160)===0&&(Zr=262144),It=t}else It=536870912;return t=Ht.current,t!==null&&(t.flags|=32),It}function Dt(t,i,r){(t===ze&&(Oe===2||Oe===9)||t.cancelPendingCommit!==null)&&(Fs(t,0),Ei(t,xe,It,!1)),Sa(t,r),((Ce&2)===0||t!==ze)&&(t===ze&&((Ce&2)===0&&(ss|=r),Xe===4&&Ei(t,xe,It,!1)),Rn(t))}function wg(t,i,r){if((Ce&6)!==0)throw Error(a(327));var o=!r&&(i&127)===0&&(i&t.expiredLanes)===0||xa(t,i),h=o?qx(t,i):Qc(t,i,!0),f=o;do{if(h===0){Is&&!o&&Ei(t,i,0,!1);break}else{if(r=t.current.alternate,f&&!Hx(r)){h=Qc(t,i,!1),f=!1;continue}if(h===2){if(f=i,t.errorRecoveryDisabledLanes&f)var y=0;else y=t.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){i=y;e:{var _=t;h=tr;var T=_.current.memoizedState.isDehydrated;if(T&&(Fs(_,y).flags|=256),y=Qc(_,y,!1),y!==2){if(Ic&&!T){_.errorRecoveryDisabledLanes|=f,ss|=f,h=4;break e}f=Nt,Nt=h,f!==null&&(Nt===null?Nt=f:Nt.push.apply(Nt,f))}h=y}if(f=!1,h!==2)continue}}if(h===1){Fs(t,0),Ei(t,i,0,!0);break}e:{switch(o=t,f=h,f){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Ei(o,i,It,!_i);break e;case 2:Nt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=qo+300-Me(),10<h)){if(Ei(o,i,It,!_i),eo(o,0,!0)!==0)break e;ei=i,o.timeoutHandle=Qg(_g.bind(null,o,r,Nt,Go,Kc,i,It,ss,Gs,_i,f,"Throttled",-0,0),h);break e}_g(o,r,Nt,Go,Kc,i,It,ss,Gs,_i,f,null,-0,0)}}break}while(!0);Rn(t)}function _g(t,i,r,o,h,f,y,_,T,M,H,q,U,z){if(t.timeoutHandle=-1,q=i.subtreeFlags,q&8192||(q&16785408)===16785408){q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vn},fg(i,f,q);var ie=(f&62914560)===f?qo-Me():(f&4194048)===f?yg-Me():0;if(ie=ES(q,ie),ie!==null){ei=f,t.cancelPendingCommit=ie(kg.bind(null,t,i,f,r,o,h,y,_,T,H,q,null,U,z)),Ei(t,f,y,!M);return}}kg(t,i,f,r,o,h,y,_,T)}function Hx(t){for(var i=t;;){var r=i.tag;if((r===0||r===11||r===15)&&i.flags&16384&&(r=i.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var h=r[o],f=h.getSnapshot;h=h.value;try{if(!Vt(f(),h))return!1}catch{return!1}}if(r=i.child,i.subtreeFlags&16384&&r!==null)r.return=i,i=r;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ei(t,i,r,o){i&=~Gc,i&=~ss,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var f=31-zt(h),y=1<<f;o[f]=-1,h&=~y}r!==0&&Of(t,r,i)}function Ko(){return(Ce&6)===0?(ir(0),!1):!0}function Jc(){if(be!==null){if(Oe===0)var t=be.return;else t=be,qn=Xi=null,dc(t),Ls=null,Va=0,t=be;for(;t!==null;)Zp(t.alternate,t),t=t.return;be=null}}function Fs(t,i){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,oS(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),ei=0,Jc(),ze=t,be=r=Hn(t.current,null),xe=i,Oe=0,qt=null,_i=!1,Is=xa(t,i),Ic=!1,Gs=It=Gc=ss=xi=Xe=0,Nt=tr=null,Kc=!1,(i&8)!==0&&(i|=i&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=i;0<o;){var h=31-zt(o),f=1<<h;i|=t[h],o&=~f}return Wn=i,fo(),r}function xg(t,i){ye=null,L.H=Fa,i===Bs||i===_o?(i=zm(),Oe=3):i===ec?(i=zm(),Oe=4):Oe=i===Cc?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,qt=i,be===null&&(Xe=1,Uo(t,Zt(i,t.current)))}function Sg(){var t=Ht.current;return t===null?!0:(xe&4194048)===xe?nn===null:(xe&62914560)===xe||(xe&536870912)!==0?t===nn:!1}function Tg(){var t=L.H;return L.H=Fa,t===null?Fa:t}function Eg(){var t=L.A;return L.A=Vx,t}function Fo(){Xe=4,_i||(xe&4194048)!==xe&&Ht.current!==null||(Is=!0),(xi&134217727)===0&&(ss&134217727)===0||ze===null||Ei(ze,xe,It,!1)}function Qc(t,i,r){var o=Ce;Ce|=2;var h=Tg(),f=Eg();(ze!==t||xe!==i)&&(Go=null,Fs(t,i)),i=!1;var y=Xe;e:do try{if(Oe!==0&&be!==null){var _=be,T=qt;switch(Oe){case 8:Jc(),y=6;break e;case 3:case 2:case 9:case 6:Ht.current===null&&(i=!0);var M=Oe;if(Oe=0,qt=null,Ys(t,_,T,M),r&&Is){y=0;break e}break;default:M=Oe,Oe=0,qt=null,Ys(t,_,T,M)}}$x(),y=Xe;break}catch(H){xg(t,H)}while(!0);return i&&t.shellSuspendCounter++,qn=Xi=null,Ce=o,L.H=h,L.A=f,be===null&&(ze=null,xe=0,fo()),y}function $x(){for(;be!==null;)Ag(be)}function qx(t,i){var r=Ce;Ce|=2;var o=Tg(),h=Eg();ze!==t||xe!==i?(Go=null,Io=Me()+500,Fs(t,i)):Is=xa(t,i);e:do try{if(Oe!==0&&be!==null){i=be;var f=qt;t:switch(Oe){case 1:Oe=0,qt=null,Ys(t,i,f,1);break;case 2:case 9:if(Bm(f)){Oe=0,qt=null,Rg(i);break}i=function(){Oe!==2&&Oe!==9||ze!==t||(Oe=7),Rn(t)},f.then(i,i);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:Bm(f)?(Oe=0,qt=null,Rg(i)):(Oe=0,qt=null,Ys(t,i,f,7));break;case 5:var y=null;switch(be.tag){case 26:y=be.memoizedState;case 5:case 27:var _=be;if(y?dy(y):_.stateNode.complete){Oe=0,qt=null;var T=_.sibling;if(T!==null)be=T;else{var M=_.return;M!==null?(be=M,Yo(M)):be=null}break t}}Oe=0,qt=null,Ys(t,i,f,5);break;case 6:Oe=0,qt=null,Ys(t,i,f,6);break;case 8:Jc(),Xe=6;break e;default:throw Error(a(462))}}Ix();break}catch(H){xg(t,H)}while(!0);return qn=Xi=null,L.H=o,L.A=h,Ce=r,be!==null?0:(ze=null,xe=0,fo(),Xe)}function Ix(){for(;be!==null&&!xn();)Ag(be)}function Ag(t){var i=Jp(t.alternate,t,Wn);t.memoizedProps=t.pendingProps,i===null?Yo(t):be=i}function Rg(t){var i=t,r=i.alternate;switch(i.tag){case 15:case 0:i=Ip(r,i,i.pendingProps,i.type,void 0,xe);break;case 11:i=Ip(r,i,i.pendingProps,i.type.render,i.ref,xe);break;case 5:dc(i);default:Zp(r,i),i=be=Em(i,Wn),i=Jp(r,i,Wn)}t.memoizedProps=t.pendingProps,i===null?Yo(t):be=i}function Ys(t,i,r,o){qn=Xi=null,dc(i),Ls=null,Va=0;var h=i.return;try{if(Nx(t,h,i,r,xe)){Xe=1,Uo(t,Zt(r,t.current)),be=null;return}}catch(f){if(h!==null)throw be=h,f;Xe=1,Uo(t,Zt(r,t.current)),be=null;return}i.flags&32768?(Te||o===1?t=!0:Is||(xe&536870912)!==0?t=!1:(_i=t=!0,(o===2||o===9||o===3||o===6)&&(o=Ht.current,o!==null&&o.tag===13&&(o.flags|=16384))),Cg(i,t)):Yo(i)}function Yo(t){var i=t;do{if((i.flags&32768)!==0){Cg(i,_i);return}t=i.return;var r=Ux(i.alternate,i,Wn);if(r!==null){be=r;return}if(i=i.sibling,i!==null){be=i;return}be=i=t}while(i!==null);Xe===0&&(Xe=5)}function Cg(t,i){do{var r=Bx(t.alternate,t);if(r!==null){r.flags&=32767,be=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!i&&(t=t.sibling,t!==null)){be=t;return}be=t=r}while(t!==null);Xe=6,be=null}function kg(t,i,r,o,h,f,y,_,T){t.cancelPendingCommit=null;do Xo();while(ot!==0);if((Ce&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(f=i.lanes|i.childLanes,f|=Vu,S_(t,r,f,y,_,T),t===ze&&(be=ze=null,xe=0),Ks=i,Ti=t,ei=r,Fc=f,Yc=h,vg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Yx(Jr,function(){return Mg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=L.T,L.T=null,h=Q.p,Q.p=2,y=Ce,Ce|=4;try{Lx(t,i,r)}finally{Ce=y,Q.p=h,L.T=o}}ot=1,jg(),Og(),Ng()}}function jg(){if(ot===1){ot=0;var t=Ti,i=Ks,r=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||r){r=L.T,L.T=null;var o=Q.p;Q.p=2;var h=Ce;Ce|=4;try{cg(i,t);var f=uh,y=gm(t.containerInfo),_=f.focusedElem,T=f.selectionRange;if(y!==_&&_&&_.ownerDocument&&pm(_.ownerDocument.documentElement,_)){if(T!==null&&Mu(_)){var M=T.start,H=T.end;if(H===void 0&&(H=M),"selectionStart"in _)_.selectionStart=M,_.selectionEnd=Math.min(H,_.value.length);else{var q=_.ownerDocument||document,U=q&&q.defaultView||window;if(U.getSelection){var z=U.getSelection(),ie=_.textContent.length,me=Math.min(T.start,ie),Le=T.end===void 0?me:Math.min(T.end,ie);!z.extend&&me>Le&&(y=Le,Le=me,me=y);var j=mm(_,me),R=mm(_,Le);if(j&&R&&(z.rangeCount!==1||z.anchorNode!==j.node||z.anchorOffset!==j.offset||z.focusNode!==R.node||z.focusOffset!==R.offset)){var D=q.createRange();D.setStart(j.node,j.offset),z.removeAllRanges(),me>Le?(z.addRange(D),z.extend(R.node,R.offset)):(D.setEnd(R.node,R.offset),z.addRange(D))}}}}for(q=[],z=_;z=z.parentNode;)z.nodeType===1&&q.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<q.length;_++){var $=q[_];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}ol=!!lh,uh=lh=null}finally{Ce=h,Q.p=o,L.T=r}}t.current=i,ot=2}}function Og(){if(ot===2){ot=0;var t=Ti,i=Ks,r=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||r){r=L.T,L.T=null;var o=Q.p;Q.p=2;var h=Ce;Ce|=4;try{ag(t,i.alternate,i)}finally{Ce=h,Q.p=o,L.T=r}}ot=3}}function Ng(){if(ot===4||ot===3){ot=0,Xr();var t=Ti,i=Ks,r=ei,o=vg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?ot=5:(ot=0,Ks=Ti=null,Dg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Si=null),pu(r),i=i.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(_a,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=L.T,h=Q.p,Q.p=2,L.T=null;try{for(var f=t.onRecoverableError,y=0;y<o.length;y++){var _=o[y];f(_.value,{componentStack:_.stack})}}finally{L.T=i,Q.p=h}}(ei&3)!==0&&Xo(),Rn(t),h=t.pendingLanes,(r&261930)!==0&&(h&42)!==0?t===Xc?nr++:(nr=0,Xc=t):nr=0,ir(0)}}function Dg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,La(i)))}function Xo(){return jg(),Og(),Ng(),Mg()}function Mg(){if(ot!==5)return!1;var t=Ti,i=Fc;Fc=0;var r=pu(ei),o=L.T,h=Q.p;try{Q.p=32>r?32:r,L.T=null,r=Yc,Yc=null;var f=Ti,y=ei;if(ot=0,Ks=Ti=null,ei=0,(Ce&6)!==0)throw Error(a(331));var _=Ce;if(Ce|=4,pg(f.current),dg(f,f.current,y,r),Ce=_,ir(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(_a,f)}catch{}return!0}finally{Q.p=h,L.T=o,Dg(t,i)}}function Ug(t,i,r){i=Zt(r,i),i=Rc(t.stateNode,i,2),t=yi(t,i,2),t!==null&&(Sa(t,2),Rn(t))}function Ne(t,i,r){if(t.tag===3)Ug(t,t,r);else for(;i!==null;){if(i.tag===3){Ug(i,t,r);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Si===null||!Si.has(o))){t=Zt(r,t),r=Bp(2),o=yi(i,r,2),o!==null&&(Lp(r,o,i,t),Sa(o,2),Rn(o));break}}i=i.return}}function Zc(t,i,r){var o=t.pingCache;if(o===null){o=t.pingCache=new Px;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(r)||(Ic=!0,h.add(r),t=Gx.bind(null,t,i,r),i.then(t,t))}function Gx(t,i,r){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ze===t&&(xe&r)===r&&(Xe===4||Xe===3&&(xe&62914560)===xe&&300>Me()-qo?(Ce&2)===0&&Fs(t,0):Gc|=r,Gs===xe&&(Gs=0)),Rn(t)}function Bg(t,i){i===0&&(i=jf()),t=Ki(t,i),t!==null&&(Sa(t,i),Rn(t))}function Kx(t){var i=t.memoizedState,r=0;i!==null&&(r=i.retryLane),Bg(t,r)}function Fx(t,i){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(r=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),Bg(t,r)}function Yx(t,i){return Ln(t,i)}var Jo=null,Xs=null,Wc=!1,Qo=!1,eh=!1,Ai=0;function Rn(t){t!==Xs&&t.next===null&&(Xs===null?Jo=Xs=t:Xs=Xs.next=t),Qo=!0,Wc||(Wc=!0,Jx())}function ir(t,i){if(!eh&&Qo){eh=!0;do for(var r=!1,o=Jo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var f=0;else{var y=o.suspendedLanes,_=o.pingedLanes;f=(1<<31-zt(42|t)+1)-1,f&=h&~(y&~_),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(r=!0,Pg(o,f))}else f=xe,f=eo(o,o===ze?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||xa(o,f)||(r=!0,Pg(o,f));o=o.next}while(r);eh=!1}}function Xx(){Lg()}function Lg(){Qo=Wc=!1;var t=0;Ai!==0&&rS()&&(t=Ai);for(var i=Me(),r=null,o=Jo;o!==null;){var h=o.next,f=zg(o,i);f===0?(o.next=null,r===null?Jo=h:r.next=h,h===null&&(Xs=r)):(r=o,(t!==0||(f&3)!==0)&&(Qo=!0)),o=h}ot!==0&&ot!==5||ir(t),Ai!==0&&(Ai=0)}function zg(t,i){for(var r=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,f=t.pendingLanes&-62914561;0<f;){var y=31-zt(f),_=1<<y,T=h[y];T===-1?((_&r)===0||(_&o)!==0)&&(h[y]=x_(_,i)):T<=i&&(t.expiredLanes|=_),f&=~_}if(i=ze,r=xe,r=eo(t,t===i?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,r===0||t===i&&(Oe===2||Oe===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Yr(o),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||xa(t,r)){if(i=r&-r,i===t.callbackPriority)return i;switch(o!==null&&Yr(o),pu(r)){case 2:case 8:r=Cf;break;case 32:r=Jr;break;case 268435456:r=kf;break;default:r=Jr}return o=Vg.bind(null,t),r=Ln(r,o),t.callbackPriority=i,t.callbackNode=r,i}return o!==null&&o!==null&&Yr(o),t.callbackPriority=2,t.callbackNode=null,2}function Vg(t,i){if(ot!==0&&ot!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(Xo()&&t.callbackNode!==r)return null;var o=xe;return o=eo(t,t===ze?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(wg(t,o,i),zg(t,Me()),t.callbackNode!=null&&t.callbackNode===r?Vg.bind(null,t):null)}function Pg(t,i){if(Xo())return null;wg(t,i,!0)}function Jx(){lS(function(){(Ce&6)!==0?Ln(Rf,Xx):Lg()})}function th(){if(Ai===0){var t=Ms;t===0&&(t=Qr,Qr<<=1,(Qr&261888)===0&&(Qr=256)),Ai=t}return Ai}function Hg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:so(""+t)}function $g(t,i){var r=i.ownerDocument.createElement("input");return r.name=i.name,r.value=i.value,t.id&&r.setAttribute("form",t.id),i.parentNode.insertBefore(r,i),t=new FormData(t),r.parentNode.removeChild(r),t}function Qx(t,i,r,o,h){if(i==="submit"&&r&&r.stateNode===h){var f=Hg((h[Rt]||null).action),y=o.submitter;y&&(i=(i=y[Rt]||null)?Hg(i.formAction):y.getAttribute("formAction"),i!==null&&(f=i,y=null));var _=new lo("action","action",null,o,h);t.push({event:_,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ai!==0){var T=y?$g(h,y):new FormData(h);_c(r,{pending:!0,data:T,method:h.method,action:f},null,T)}}else typeof f=="function"&&(_.preventDefault(),T=y?$g(h,y):new FormData(h),_c(r,{pending:!0,data:T,method:h.method,action:f},f,T))},currentTarget:h}]})}}for(var nh=0;nh<zu.length;nh++){var ih=zu[nh],Zx=ih.toLowerCase(),Wx=ih[0].toUpperCase()+ih.slice(1);un(Zx,"on"+Wx)}un(bm,"onAnimationEnd"),un(wm,"onAnimationIteration"),un(_m,"onAnimationStart"),un("dblclick","onDoubleClick"),un("focusin","onFocus"),un("focusout","onBlur"),un(px,"onTransitionRun"),un(gx,"onTransitionStart"),un(yx,"onTransitionCancel"),un(xm,"onTransitionEnd"),ws("onMouseEnter",["mouseout","mouseover"]),ws("onMouseLeave",["mouseout","mouseover"]),ws("onPointerEnter",["pointerout","pointerover"]),ws("onPointerLeave",["pointerout","pointerover"]),$i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$i("onBeforeInput",["compositionend","keypress","textInput","paste"]),$i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sr="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(" "),eS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sr));function qg(t,i){i=(i&4)!==0;for(var r=0;r<t.length;r++){var o=t[r],h=o.event;o=o.listeners;e:{var f=void 0;if(i)for(var y=o.length-1;0<=y;y--){var _=o[y],T=_.instance,M=_.currentTarget;if(_=_.listener,T!==f&&h.isPropagationStopped())break e;f=_,h.currentTarget=M;try{f(h)}catch(H){ho(H)}h.currentTarget=null,f=T}else for(y=0;y<o.length;y++){if(_=o[y],T=_.instance,M=_.currentTarget,_=_.listener,T!==f&&h.isPropagationStopped())break e;f=_,h.currentTarget=M;try{f(h)}catch(H){ho(H)}h.currentTarget=null,f=T}}}}function we(t,i){var r=i[gu];r===void 0&&(r=i[gu]=new Set);var o=t+"__bubble";r.has(o)||(Ig(i,t,2,!1),r.add(o))}function sh(t,i,r){var o=0;i&&(o|=4),Ig(r,t,o,i)}var Zo="_reactListening"+Math.random().toString(36).slice(2);function ah(t){if(!t[Zo]){t[Zo]=!0,Lf.forEach(function(r){r!=="selectionchange"&&(eS.has(r)||sh(r,!1,t),sh(r,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Zo]||(i[Zo]=!0,sh("selectionchange",!1,i))}}function Ig(t,i,r,o){switch(by(i)){case 2:var h=CS;break;case 8:h=kS;break;default:h=wh}r=h.bind(null,i,r,t),h=void 0,!Eu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,r,{capture:!0,passive:h}):t.addEventListener(i,r,!0):h!==void 0?t.addEventListener(i,r,{passive:h}):t.addEventListener(i,r,!1)}function rh(t,i,r,o,h){var f=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var y=o.tag;if(y===3||y===4){var _=o.stateNode.containerInfo;if(_===h)break;if(y===4)for(y=o.return;y!==null;){var T=y.tag;if((T===3||T===4)&&y.stateNode.containerInfo===h)return;y=y.return}for(;_!==null;){if(y=ys(_),y===null)return;if(T=y.tag,T===5||T===6||T===26||T===27){o=f=y;continue e}_=_.parentNode}}o=o.return}Xf(function(){var M=f,H=Su(r),q=[];e:{var U=Sm.get(t);if(U!==void 0){var z=lo,ie=t;switch(t){case"keypress":if(ro(r)===0)break e;case"keydown":case"keyup":z=F_;break;case"focusin":ie="focus",z=ku;break;case"focusout":ie="blur",z=ku;break;case"beforeblur":case"afterblur":z=ku;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":z=Zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":z=U_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":z=J_;break;case bm:case wm:case _m:z=z_;break;case xm:z=Z_;break;case"scroll":case"scrollend":z=D_;break;case"wheel":z=ex;break;case"copy":case"cut":case"paste":z=P_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":z=em;break;case"toggle":case"beforetoggle":z=nx}var me=(i&4)!==0,Le=!me&&(t==="scroll"||t==="scrollend"),j=me?U!==null?U+"Capture":null:U;me=[];for(var R=M,D;R!==null;){var $=R;if(D=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||D===null||j===null||($=Aa(R,j),$!=null&&me.push(ar(R,$,D))),Le)break;R=R.return}0<me.length&&(U=new z(U,ie,null,r,H),q.push({event:U,listeners:me}))}}if((i&7)===0){e:{if(U=t==="mouseover"||t==="pointerover",z=t==="mouseout"||t==="pointerout",U&&r!==xu&&(ie=r.relatedTarget||r.fromElement)&&(ys(ie)||ie[gs]))break e;if((z||U)&&(U=H.window===H?H:(U=H.ownerDocument)?U.defaultView||U.parentWindow:window,z?(ie=r.relatedTarget||r.toElement,z=M,ie=ie?ys(ie):null,ie!==null&&(Le=u(ie),me=ie.tag,ie!==Le||me!==5&&me!==27&&me!==6)&&(ie=null)):(z=null,ie=M),z!==ie)){if(me=Zf,$="onMouseLeave",j="onMouseEnter",R="mouse",(t==="pointerout"||t==="pointerover")&&(me=em,$="onPointerLeave",j="onPointerEnter",R="pointer"),Le=z==null?U:Ea(z),D=ie==null?U:Ea(ie),U=new me($,R+"leave",z,r,H),U.target=Le,U.relatedTarget=D,$=null,ys(H)===M&&(me=new me(j,R+"enter",ie,r,H),me.target=D,me.relatedTarget=Le,$=me),Le=$,z&&ie)t:{for(me=tS,j=z,R=ie,D=0,$=j;$;$=me($))D++;$=0;for(var ce=R;ce;ce=me(ce))$++;for(;0<D-$;)j=me(j),D--;for(;0<$-D;)R=me(R),$--;for(;D--;){if(j===R||R!==null&&j===R.alternate){me=j;break t}j=me(j),R=me(R)}me=null}else me=null;z!==null&&Gg(q,U,z,me,!1),ie!==null&&Le!==null&&Gg(q,Le,ie,me,!0)}}e:{if(U=M?Ea(M):window,z=U.nodeName&&U.nodeName.toLowerCase(),z==="select"||z==="input"&&U.type==="file")var Ee=lm;else if(rm(U))if(um)Ee=dx;else{Ee=cx;var re=ux}else z=U.nodeName,!z||z.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?M&&_u(M.elementType)&&(Ee=lm):Ee=hx;if(Ee&&(Ee=Ee(t,M))){om(q,Ee,r,H);break e}re&&re(t,U,M),t==="focusout"&&M&&U.type==="number"&&M.memoizedProps.value!=null&&wu(U,"number",U.value)}switch(re=M?Ea(M):window,t){case"focusin":(rm(re)||re.contentEditable==="true")&&(As=re,Uu=M,Ma=null);break;case"focusout":Ma=Uu=As=null;break;case"mousedown":Bu=!0;break;case"contextmenu":case"mouseup":case"dragend":Bu=!1,ym(q,r,H);break;case"selectionchange":if(mx)break;case"keydown":case"keyup":ym(q,r,H)}var ve;if(Ou)e:{switch(t){case"compositionstart":var Se="onCompositionStart";break e;case"compositionend":Se="onCompositionEnd";break e;case"compositionupdate":Se="onCompositionUpdate";break e}Se=void 0}else Es?sm(t,r)&&(Se="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(Se="onCompositionStart");Se&&(tm&&r.locale!=="ko"&&(Es||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Es&&(ve=Jf()):(ci=H,Au="value"in ci?ci.value:ci.textContent,Es=!0)),re=Wo(M,Se),0<re.length&&(Se=new Wf(Se,t,null,r,H),q.push({event:Se,listeners:re}),ve?Se.data=ve:(ve=am(r),ve!==null&&(Se.data=ve)))),(ve=sx?ax(t,r):rx(t,r))&&(Se=Wo(M,"onBeforeInput"),0<Se.length&&(re=new Wf("onBeforeInput","beforeinput",null,r,H),q.push({event:re,listeners:Se}),re.data=ve)),Qx(q,t,M,r,H)}qg(q,i)})}function ar(t,i,r){return{instance:t,listener:i,currentTarget:r}}function Wo(t,i){for(var r=i+"Capture",o=[];t!==null;){var h=t,f=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||f===null||(h=Aa(t,r),h!=null&&o.unshift(ar(t,h,f)),h=Aa(t,i),h!=null&&o.push(ar(t,h,f))),t.tag===3)return o;t=t.return}return[]}function tS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Gg(t,i,r,o,h){for(var f=i._reactName,y=[];r!==null&&r!==o;){var _=r,T=_.alternate,M=_.stateNode;if(_=_.tag,T!==null&&T===o)break;_!==5&&_!==26&&_!==27||M===null||(T=M,h?(M=Aa(r,f),M!=null&&y.unshift(ar(r,M,T))):h||(M=Aa(r,f),M!=null&&y.push(ar(r,M,T)))),r=r.return}y.length!==0&&t.push({event:i,listeners:y})}var nS=/\r\n?/g,iS=/\u0000|\uFFFD/g;function Kg(t){return(typeof t=="string"?t:""+t).replace(nS,`
`).replace(iS,"")}function Fg(t,i){return i=Kg(i),Kg(t)===i}function Be(t,i,r,o,h,f){switch(r){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||xs(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&xs(t,""+o);break;case"className":no(t,"class",o);break;case"tabIndex":no(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":no(t,r,o);break;case"style":Ff(t,o,f);break;case"data":if(i!=="object"){no(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||r!=="href")){t.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=so(""+o),t.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(r==="formAction"?(i!=="input"&&Be(t,i,"name",h.name,h,null),Be(t,i,"formEncType",h.formEncType,h,null),Be(t,i,"formMethod",h.formMethod,h,null),Be(t,i,"formTarget",h.formTarget,h,null)):(Be(t,i,"encType",h.encType,h,null),Be(t,i,"method",h.method,h,null),Be(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=so(""+o),t.setAttribute(r,o);break;case"onClick":o!=null&&(t.onclick=Vn);break;case"onScroll":o!=null&&we("scroll",t);break;case"onScrollEnd":o!=null&&we("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=r}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}r=so(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""+o):t.removeAttribute(r);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":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":o===!0?t.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,o):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(r,o):t.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(r):t.setAttribute(r,o);break;case"popover":we("beforetoggle",t),we("toggle",t),to(t,"popover",o);break;case"xlinkActuate":zn(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":zn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":zn(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":zn(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":zn(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":zn(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":zn(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":zn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":zn(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":to(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=O_.get(r)||r,to(t,r,o))}}function oh(t,i,r,o,h,f){switch(r){case"style":Ff(t,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=r}}break;case"children":typeof o=="string"?xs(t,o):(typeof o=="number"||typeof o=="bigint")&&xs(t,""+o);break;case"onScroll":o!=null&&we("scroll",t);break;case"onScrollEnd":o!=null&&we("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Vn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zf.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(h=r.endsWith("Capture"),i=r.slice(2,h?r.length-7:void 0),f=t[Rt]||null,f=f!=null?f[r]:null,typeof f=="function"&&t.removeEventListener(i,f,h),typeof o=="function")){typeof f!="function"&&f!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(i,o,h);break e}r in t?t[r]=o:o===!0?t.setAttribute(r,""):to(t,r,o)}}}function yt(t,i,r){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":we("error",t),we("load",t);var o=!1,h=!1,f;for(f in r)if(r.hasOwnProperty(f)){var y=r[f];if(y!=null)switch(f){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Be(t,i,f,y,r,null)}}h&&Be(t,i,"srcSet",r.srcSet,r,null),o&&Be(t,i,"src",r.src,r,null);return;case"input":we("invalid",t);var _=f=y=h=null,T=null,M=null;for(o in r)if(r.hasOwnProperty(o)){var H=r[o];if(H!=null)switch(o){case"name":h=H;break;case"type":y=H;break;case"checked":T=H;break;case"defaultChecked":M=H;break;case"value":f=H;break;case"defaultValue":_=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(a(137,i));break;default:Be(t,i,o,H,r,null)}}qf(t,f,_,T,M,y,h,!1);return;case"select":we("invalid",t),o=y=f=null;for(h in r)if(r.hasOwnProperty(h)&&(_=r[h],_!=null))switch(h){case"value":f=_;break;case"defaultValue":y=_;break;case"multiple":o=_;default:Be(t,i,h,_,r,null)}i=f,r=y,t.multiple=!!o,i!=null?_s(t,!!o,i,!1):r!=null&&_s(t,!!o,r,!0);return;case"textarea":we("invalid",t),f=h=o=null;for(y in r)if(r.hasOwnProperty(y)&&(_=r[y],_!=null))switch(y){case"value":o=_;break;case"defaultValue":h=_;break;case"children":f=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:Be(t,i,y,_,r,null)}Gf(t,o,h,f);return;case"option":for(T in r)if(r.hasOwnProperty(T)&&(o=r[T],o!=null))switch(T){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Be(t,i,T,o,r,null)}return;case"dialog":we("beforetoggle",t),we("toggle",t),we("cancel",t),we("close",t);break;case"iframe":case"object":we("load",t);break;case"video":case"audio":for(o=0;o<sr.length;o++)we(sr[o],t);break;case"image":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"embed":case"source":case"link":we("error",t),we("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(M in r)if(r.hasOwnProperty(M)&&(o=r[M],o!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Be(t,i,M,o,r,null)}return;default:if(_u(i)){for(H in r)r.hasOwnProperty(H)&&(o=r[H],o!==void 0&&oh(t,i,H,o,r,void 0));return}}for(_ in r)r.hasOwnProperty(_)&&(o=r[_],o!=null&&Be(t,i,_,o,r,null))}function sS(t,i,r,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,f=null,y=null,_=null,T=null,M=null,H=null;for(z in r){var q=r[z];if(r.hasOwnProperty(z)&&q!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":T=q;default:o.hasOwnProperty(z)||Be(t,i,z,null,o,q)}}for(var U in o){var z=o[U];if(q=r[U],o.hasOwnProperty(U)&&(z!=null||q!=null))switch(U){case"type":f=z;break;case"name":h=z;break;case"checked":M=z;break;case"defaultChecked":H=z;break;case"value":y=z;break;case"defaultValue":_=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(a(137,i));break;default:z!==q&&Be(t,i,U,z,o,q)}}bu(t,y,_,T,M,H,f,h);return;case"select":z=y=_=U=null;for(f in r)if(T=r[f],r.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":z=T;default:o.hasOwnProperty(f)||Be(t,i,f,null,o,T)}for(h in o)if(f=o[h],T=r[h],o.hasOwnProperty(h)&&(f!=null||T!=null))switch(h){case"value":U=f;break;case"defaultValue":_=f;break;case"multiple":y=f;default:f!==T&&Be(t,i,h,f,o,T)}i=_,r=y,o=z,U!=null?_s(t,!!r,U,!1):!!o!=!!r&&(i!=null?_s(t,!!r,i,!0):_s(t,!!r,r?[]:"",!1));return;case"textarea":z=U=null;for(_ in r)if(h=r[_],r.hasOwnProperty(_)&&h!=null&&!o.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Be(t,i,_,null,o,h)}for(y in o)if(h=o[y],f=r[y],o.hasOwnProperty(y)&&(h!=null||f!=null))switch(y){case"value":U=h;break;case"defaultValue":z=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==f&&Be(t,i,y,h,o,f)}If(t,U,z);return;case"option":for(var ie in r)if(U=r[ie],r.hasOwnProperty(ie)&&U!=null&&!o.hasOwnProperty(ie))switch(ie){case"selected":t.selected=!1;break;default:Be(t,i,ie,null,o,U)}for(T in o)if(U=o[T],z=r[T],o.hasOwnProperty(T)&&U!==z&&(U!=null||z!=null))switch(T){case"selected":t.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Be(t,i,T,U,o,z)}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 me in r)U=r[me],r.hasOwnProperty(me)&&U!=null&&!o.hasOwnProperty(me)&&Be(t,i,me,null,o,U);for(M in o)if(U=o[M],z=r[M],o.hasOwnProperty(M)&&U!==z&&(U!=null||z!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(a(137,i));break;default:Be(t,i,M,U,o,z)}return;default:if(_u(i)){for(var Le in r)U=r[Le],r.hasOwnProperty(Le)&&U!==void 0&&!o.hasOwnProperty(Le)&&oh(t,i,Le,void 0,o,U);for(H in o)U=o[H],z=r[H],!o.hasOwnProperty(H)||U===z||U===void 0&&z===void 0||oh(t,i,H,U,o,z);return}}for(var j in r)U=r[j],r.hasOwnProperty(j)&&U!=null&&!o.hasOwnProperty(j)&&Be(t,i,j,null,o,U);for(q in o)U=o[q],z=r[q],!o.hasOwnProperty(q)||U===z||U==null&&z==null||Be(t,i,q,U,o,z)}function Yg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function aS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var h=r[o],f=h.transferSize,y=h.initiatorType,_=h.duration;if(f&&_&&Yg(y)){for(y=0,_=h.responseEnd,o+=1;o<r.length;o++){var T=r[o],M=T.startTime;if(M>_)break;var H=T.transferSize,q=T.initiatorType;H&&Yg(q)&&(T=T.responseEnd,y+=H*(T<_?1:(_-M)/(T-M)))}if(--o,i+=8*(f+y)/(h.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var lh=null,uh=null;function el(t){return t.nodeType===9?t:t.ownerDocument}function Xg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Jg(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function ch(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var hh=null;function rS(){var t=window.event;return t&&t.type==="popstate"?t===hh?!1:(hh=t,!0):(hh=null,!1)}var Qg=typeof setTimeout=="function"?setTimeout:void 0,oS=typeof clearTimeout=="function"?clearTimeout:void 0,Zg=typeof Promise=="function"?Promise:void 0,lS=typeof queueMicrotask=="function"?queueMicrotask:typeof Zg<"u"?function(t){return Zg.resolve(null).then(t).catch(uS)}:Qg;function uS(t){setTimeout(function(){throw t})}function Ri(t){return t==="head"}function Wg(t,i){var r=i,o=0;do{var h=r.nextSibling;if(t.removeChild(r),h&&h.nodeType===8)if(r=h.data,r==="/$"||r==="/&"){if(o===0){t.removeChild(h),Ws(i);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")rr(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,rr(r);for(var f=r.firstChild;f;){var y=f.nextSibling,_=f.nodeName;f[Ta]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&f.rel.toLowerCase()==="stylesheet"||r.removeChild(f),f=y}}else r==="body"&&rr(t.ownerDocument.body);r=h}while(r);Ws(i)}function ey(t,i){var r=t;t=0;do{var o=r.nextSibling;if(r.nodeType===1?i?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(i?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=o}while(r)}function dh(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var r=i;switch(i=i.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":dh(r),yu(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function cS(t,i,r,o){for(;t.nodeType===1;){var h=r;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Ta])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(f=t.getAttribute("rel"),f==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(f!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(f=t.getAttribute("src"),(f!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&f&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var f=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===f)return t}else return t;if(t=sn(t.nextSibling),t===null)break}return null}function hS(t,i,r){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=sn(t.nextSibling),t===null))return null;return t}function ty(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=sn(t.nextSibling),t===null))return null;return t}function fh(t){return t.data==="$?"||t.data==="$~"}function mh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function dS(t,i){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||r.readyState!=="loading")i();else{var o=function(){i(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function sn(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var ph=null;function ny(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(i===0)return sn(t.nextSibling);i--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||i++}t=t.nextSibling}return null}function iy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(i===0)return t;i--}else r!=="/$"&&r!=="/&"||i++}t=t.previousSibling}return null}function sy(t,i,r){switch(i=el(r),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function rr(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);yu(t)}var an=new Map,ay=new Set;function tl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var ti=Q.d;Q.d={f:fS,r:mS,D:pS,C:gS,L:yS,m:vS,X:wS,S:bS,M:_S};function fS(){var t=ti.f(),i=Ko();return t||i}function mS(t){var i=vs(t);i!==null&&i.tag===5&&i.type==="form"?xp(i):ti.r(t)}var Js=typeof document>"u"?null:document;function ry(t,i,r){var o=Js;if(o&&typeof i=="string"&&i){var h=Jt(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof r=="string"&&(h+='[crossorigin="'+r+'"]'),ay.has(h)||(ay.add(h),t={rel:t,crossOrigin:r,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),yt(i,"link",t),ut(i),o.head.appendChild(i)))}}function pS(t){ti.D(t),ry("dns-prefetch",t,null)}function gS(t,i){ti.C(t,i),ry("preconnect",t,i)}function yS(t,i,r){ti.L(t,i,r);var o=Js;if(o&&t&&i){var h='link[rel="preload"][as="'+Jt(i)+'"]';i==="image"&&r&&r.imageSrcSet?(h+='[imagesrcset="'+Jt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(h+='[imagesizes="'+Jt(r.imageSizes)+'"]')):h+='[href="'+Jt(t)+'"]';var f=h;switch(i){case"style":f=Qs(t);break;case"script":f=Zs(t)}an.has(f)||(t=v({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:t,as:i},r),an.set(f,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(or(f))||i==="script"&&o.querySelector(lr(f))||(i=o.createElement("link"),yt(i,"link",t),ut(i),o.head.appendChild(i)))}}function vS(t,i){ti.m(t,i);var r=Js;if(r&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Jt(o)+'"][href="'+Jt(t)+'"]',f=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Zs(t)}if(!an.has(f)&&(t=v({rel:"modulepreload",href:t},i),an.set(f,t),r.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(lr(f)))return}o=r.createElement("link"),yt(o,"link",t),ut(o),r.head.appendChild(o)}}}function bS(t,i,r){ti.S(t,i,r);var o=Js;if(o&&t){var h=bs(o).hoistableStyles,f=Qs(t);i=i||"default";var y=h.get(f);if(!y){var _={loading:0,preload:null};if(y=o.querySelector(or(f)))_.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":i},r),(r=an.get(f))&&gh(t,r);var T=y=o.createElement("link");ut(T),yt(T,"link",t),T._p=new Promise(function(M,H){T.onload=M,T.onerror=H}),T.addEventListener("load",function(){_.loading|=1}),T.addEventListener("error",function(){_.loading|=2}),_.loading|=4,nl(y,i,o)}y={type:"stylesheet",instance:y,count:1,state:_},h.set(f,y)}}}function wS(t,i){ti.X(t,i);var r=Js;if(r&&t){var o=bs(r).hoistableScripts,h=Zs(t),f=o.get(h);f||(f=r.querySelector(lr(h)),f||(t=v({src:t,async:!0},i),(i=an.get(h))&&yh(t,i),f=r.createElement("script"),ut(f),yt(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(h,f))}}function _S(t,i){ti.M(t,i);var r=Js;if(r&&t){var o=bs(r).hoistableScripts,h=Zs(t),f=o.get(h);f||(f=r.querySelector(lr(h)),f||(t=v({src:t,async:!0,type:"module"},i),(i=an.get(h))&&yh(t,i),f=r.createElement("script"),ut(f),yt(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(h,f))}}function oy(t,i,r,o){var h=(h=ue.current)?tl(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=Qs(r.href),r=bs(h).hoistableStyles,o=r.get(i),o||(o={type:"style",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Qs(r.href);var f=bs(h).hoistableStyles,y=f.get(t);if(y||(h=h.ownerDocument||h,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(t,y),(f=h.querySelector(or(t)))&&!f._p&&(y.instance=f,y.state.loading=5),an.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},an.set(t,r),f||xS(h,t,r,y.state))),i&&o===null)throw Error(a(528,""));return y}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Zs(r),r=bs(h).hoistableScripts,o=r.get(i),o||(o={type:"script",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Qs(t){return'href="'+Jt(t)+'"'}function or(t){return'link[rel="stylesheet"]['+t+"]"}function ly(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function xS(t,i,r,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),yt(i,"link",r),ut(i),t.head.appendChild(i))}function Zs(t){return'[src="'+Jt(t)+'"]'}function lr(t){return"script[async]"+t}function uy(t,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Jt(r.href)+'"]');if(o)return i.instance=o,ut(o),o;var h=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),ut(o),yt(o,"style",h),nl(o,r.precedence,t),i.instance=o;case"stylesheet":h=Qs(r.href);var f=t.querySelector(or(h));if(f)return i.state.loading|=4,i.instance=f,ut(f),f;o=ly(r),(h=an.get(h))&&gh(o,h),f=(t.ownerDocument||t).createElement("link"),ut(f);var y=f;return y._p=new Promise(function(_,T){y.onload=_,y.onerror=T}),yt(f,"link",o),i.state.loading|=4,nl(f,r.precedence,t),i.instance=f;case"script":return f=Zs(r.src),(h=t.querySelector(lr(f)))?(i.instance=h,ut(h),h):(o=r,(h=an.get(f))&&(o=v({},r),yh(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),ut(h),yt(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,nl(o,r.precedence,t));return i.instance}function nl(t,i,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,f=h,y=0;y<o.length;y++){var _=o[y];if(_.dataset.precedence===i)f=_;else if(f!==h)break}f?f.parentNode.insertBefore(t,f.nextSibling):(i=r.nodeType===9?r.head:r,i.insertBefore(t,i.firstChild))}function gh(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function yh(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var il=null;function cy(t,i,r){if(il===null){var o=new Map,h=il=new Map;h.set(r,o)}else h=il,o=h.get(r),o||(o=new Map,h.set(r,o));if(o.has(t))return o;for(o.set(t,null),r=r.getElementsByTagName(t),h=0;h<r.length;h++){var f=r[h];if(!(f[Ta]||f[ft]||t==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(i)||"";y=t+y;var _=o.get(y);_?_.push(f):o.set(y,[f])}}return o}function hy(t,i,r){t=t.ownerDocument||t,t.head.insertBefore(r,i==="title"?t.querySelector("head > title"):null)}function SS(t,i,r){if(r===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function dy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function TS(t,i,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var h=Qs(o.href),f=i.querySelector(or(h));if(f){i=f._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=sl.bind(t),i.then(t,t)),r.state.loading|=4,r.instance=f,ut(f);return}f=i.ownerDocument||i,o=ly(o),(h=an.get(h))&&gh(o,h),f=f.createElement("link"),ut(f);var y=f;y._p=new Promise(function(_,T){y.onload=_,y.onerror=T}),yt(f,"link",o),r.instance=f}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=sl.bind(t),i.addEventListener("load",r),i.addEventListener("error",r))}}var vh=0;function ES(t,i){return t.stylesheets&&t.count===0&&rl(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var o=setTimeout(function(){if(t.stylesheets&&rl(t,t.stylesheets),t.unsuspend){var f=t.unsuspend;t.unsuspend=null,f()}},6e4+i);0<t.imgBytes&&vh===0&&(vh=62500*aS());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&rl(t,t.stylesheets),t.unsuspend)){var f=t.unsuspend;t.unsuspend=null,f()}},(t.imgBytes>vh?50:800)+i);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function sl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var al=null;function rl(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,al=new Map,i.forEach(AS,t),al=null,sl.call(t))}function AS(t,i){if(!(i.state.loading&4)){var r=al.get(t);if(r)var o=r.get(null);else{r=new Map,al.set(t,r);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<h.length;f++){var y=h[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(r.set(y.dataset.precedence,y),o=y)}o&&r.set(null,o)}h=i.instance,y=h.getAttribute("data-precedence"),f=r.get(y)||o,f===o&&r.set(null,h),r.set(y,h),this.count++,o=sl.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),f?f.parentNode.insertBefore(h,f.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),i.state.loading|=4}}var ur={$$typeof:O,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function RS(t,i,r,o,h,f,y,_,T){this.tag=1,this.containerInfo=t,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=fu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fu(0),this.hiddenUpdates=fu(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function fy(t,i,r,o,h,f,y,_,T,M,H,q){return t=new RS(t,i,r,y,T,M,H,q,_),i=1,f===!0&&(i|=24),f=Pt(3,null,null,i),t.current=f,f.stateNode=t,i=Qu(),i.refCount++,t.pooledCache=i,i.refCount++,f.memoizedState={element:o,isDehydrated:r,cache:i},tc(f),t}function my(t){return t?(t=ks,t):ks}function py(t,i,r,o,h,f){h=my(h),o.context===null?o.context=h:o.pendingContext=h,o=gi(i),o.payload={element:r},f=f===void 0?null:f,f!==null&&(o.callback=f),r=yi(t,o,i),r!==null&&(Dt(r,t,i),Ha(r,t,i))}function gy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<i?r:i}}function bh(t,i){gy(t,i),(t=t.alternate)&&gy(t,i)}function yy(t){if(t.tag===13||t.tag===31){var i=Ki(t,67108864);i!==null&&Dt(i,t,67108864),bh(t,67108864)}}function vy(t){if(t.tag===13||t.tag===31){var i=Gt();i=mu(i);var r=Ki(t,i);r!==null&&Dt(r,t,i),bh(t,i)}}var ol=!0;function CS(t,i,r,o){var h=L.T;L.T=null;var f=Q.p;try{Q.p=2,wh(t,i,r,o)}finally{Q.p=f,L.T=h}}function kS(t,i,r,o){var h=L.T;L.T=null;var f=Q.p;try{Q.p=8,wh(t,i,r,o)}finally{Q.p=f,L.T=h}}function wh(t,i,r,o){if(ol){var h=_h(o);if(h===null)rh(t,i,o,ll,r),wy(t,o);else if(OS(h,t,i,r,o))o.stopPropagation();else if(wy(t,o),i&4&&-1<jS.indexOf(t)){for(;h!==null;){var f=vs(h);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Hi(f.pendingLanes);if(y!==0){var _=f;for(_.pendingLanes|=2,_.entangledLanes|=2;y;){var T=1<<31-zt(y);_.entanglements[1]|=T,y&=~T}Rn(f),(Ce&6)===0&&(Io=Me()+500,ir(0))}}break;case 31:case 13:_=Ki(f,2),_!==null&&Dt(_,f,2),Ko(),bh(f,2)}if(f=_h(o),f===null&&rh(t,i,o,ll,r),f===h)break;h=f}h!==null&&o.stopPropagation()}else rh(t,i,o,null,r)}}function _h(t){return t=Su(t),xh(t)}var ll=null;function xh(t){if(ll=null,t=ys(t),t!==null){var i=u(t);if(i===null)t=null;else{var r=i.tag;if(r===13){if(t=c(i),t!==null)return t;t=null}else if(r===31){if(t=d(i),t!==null)return t;t=null}else if(r===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return ll=t,null}function by(t){switch(t){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(Sn()){case Rf:return 2;case Cf:return 8;case Jr:case g_:return 32;case kf:return 268435456;default:return 32}default:return 32}}var Sh=!1,Ci=null,ki=null,ji=null,cr=new Map,hr=new Map,Oi=[],jS="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 wy(t,i){switch(t){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":ki=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":cr.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":hr.delete(i.pointerId)}}function dr(t,i,r,o,h,f){return t===null||t.nativeEvent!==f?(t={blockedOn:i,domEventName:r,eventSystemFlags:o,nativeEvent:f,targetContainers:[h]},i!==null&&(i=vs(i),i!==null&&yy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function OS(t,i,r,o,h){switch(i){case"focusin":return Ci=dr(Ci,t,i,r,o,h),!0;case"dragenter":return ki=dr(ki,t,i,r,o,h),!0;case"mouseover":return ji=dr(ji,t,i,r,o,h),!0;case"pointerover":var f=h.pointerId;return cr.set(f,dr(cr.get(f)||null,t,i,r,o,h)),!0;case"gotpointercapture":return f=h.pointerId,hr.set(f,dr(hr.get(f)||null,t,i,r,o,h)),!0}return!1}function _y(t){var i=ys(t.target);if(i!==null){var r=u(i);if(r!==null){if(i=r.tag,i===13){if(i=c(r),i!==null){t.blockedOn=i,Uf(t.priority,function(){vy(r)});return}}else if(i===31){if(i=d(r),i!==null){t.blockedOn=i,Uf(t.priority,function(){vy(r)});return}}else if(i===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ul(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var r=_h(t.nativeEvent);if(r===null){r=t.nativeEvent;var o=new r.constructor(r.type,r);xu=o,r.target.dispatchEvent(o),xu=null}else return i=vs(r),i!==null&&yy(i),t.blockedOn=r,!1;i.shift()}return!0}function xy(t,i,r){ul(t)&&r.delete(i)}function NS(){Sh=!1,Ci!==null&&ul(Ci)&&(Ci=null),ki!==null&&ul(ki)&&(ki=null),ji!==null&&ul(ji)&&(ji=null),cr.forEach(xy),hr.forEach(xy)}function cl(t,i){t.blockedOn===i&&(t.blockedOn=null,Sh||(Sh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,NS)))}var hl=null;function Sy(t){hl!==t&&(hl=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){hl===t&&(hl=null);for(var i=0;i<t.length;i+=3){var r=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(xh(o||r)===null)continue;break}var f=vs(r);f!==null&&(t.splice(i,3),i-=3,_c(f,{pending:!0,data:h,method:r.method,action:o},o,h))}}))}function Ws(t){function i(T){return cl(T,t)}Ci!==null&&cl(Ci,t),ki!==null&&cl(ki,t),ji!==null&&cl(ji,t),cr.forEach(i),hr.forEach(i);for(var r=0;r<Oi.length;r++){var o=Oi[r];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Oi.length&&(r=Oi[0],r.blockedOn===null);)_y(r),r.blockedOn===null&&Oi.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var h=r[o],f=r[o+1],y=h[Rt]||null;if(typeof f=="function")y||Sy(r);else if(y){var _=null;if(f&&f.hasAttribute("formAction")){if(h=f,y=f[Rt]||null)_=y.formAction;else if(xh(h)!==null)continue}else _=y.action;typeof _=="function"?r[o+1]=_:(r.splice(o,3),o-=3),Sy(r)}}}function Ty(){function t(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return h=y})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),o||setTimeout(r,20)}function r(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Th(t){this._internalRoot=t}dl.prototype.render=Th.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var r=i.current,o=Gt();py(r,o,t,i,null,null)},dl.prototype.unmount=Th.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;py(t.current,2,null,t,null,null),Ko(),i[gs]=null}};function dl(t){this._internalRoot=t}dl.prototype.unstable_scheduleHydration=function(t){if(t){var i=Mf();t={blockedOn:null,target:t,priority:i};for(var r=0;r<Oi.length&&i!==0&&i<Oi[r].priority;r++);Oi.splice(r,0,t),r===0&&_y(t)}};var Ey=e.version;if(Ey!=="19.2.7")throw Error(a(527,Ey,"19.2.7"));Q.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=p(i),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var DS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fl.isDisabled&&fl.supportsFiber)try{_a=fl.inject(DS),Lt=fl}catch{}}return mr.createRoot=function(t,i){if(!l(t))throw Error(a(299));var r=!1,o="",h=Np,f=Dp,y=Mp;return i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(f=i.onCaughtError),i.onRecoverableError!==void 0&&(y=i.onRecoverableError)),i=fy(t,1,!1,null,null,r,o,null,h,f,y,Ty),t[gs]=i.current,ah(t),new Th(i)},mr.hydrateRoot=function(t,i,r){if(!l(t))throw Error(a(299));var o=!1,h="",f=Np,y=Dp,_=Mp,T=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError),r.formState!==void 0&&(T=r.formState)),i=fy(t,1,!0,i,r??null,o,h,T,f,y,_,Ty),i.context=my(null),r=i.current,o=Gt(),o=mu(o),h=gi(o),h.callback=null,yi(r,h,o),r=o,i.current.lanes=r,Sa(i,r),Rn(i),t[gs]=i.current,ah(t),new dl(i)},mr.version="19.2.7",mr}var Uy;function qS(){if(Uy)return Rh.exports;Uy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Rh.exports=$S(),Rh.exports}var IS=qS();const Id=V.createContext({});function Gd(n){const e=V.useRef(null);return e.current===null&&(e.current=n()),e.current}const GS=typeof window<"u",Kd=GS?V.useLayoutEffect:V.useEffect,iu=V.createContext(null);function Fd(n,e){n.indexOf(e)===-1&&n.push(e)}function Vl(n,e){const s=n.indexOf(e);s>-1&&n.splice(s,1)}const Mn=(n,e,s)=>s>e?e:s<n?n:s;let Yd=()=>{};const Li={},eb=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),tb=n=>typeof n=="object"&&n!==null,nb=n=>/^0[^.\s]+$/u.test(n);function ib(n){let e;return()=>(e===void 0&&(e=n()),e)}const ln=n=>n,qr=(...n)=>n.reduce((e,s)=>a=>s(e(a))),jr=(n,e,s)=>{const a=e-n;return a?(s-n)/a:1};class Xd{constructor(){this.subscriptions=[]}add(e){return Fd(this.subscriptions,e),()=>Vl(this.subscriptions,e)}notify(e,s,a){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](e,s,a);else for(let u=0;u<l;u++){const c=this.subscriptions[u];c&&c(e,s,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ft=n=>n*1e3,on=n=>n/1e3,sb=(n,e)=>e?n*(1e3/e):0,ab=(n,e,s)=>(((1-3*s+3*e)*n+(3*s-6*e))*n+3*e)*n,KS=1e-7,FS=12;function YS(n,e,s,a,l){let u,c,d=0;do c=e+(s-e)/2,u=ab(c,a,l)-n,u>0?s=c:e=c;while(Math.abs(u)>KS&&++d<FS);return c}function Ir(n,e,s,a){if(n===e&&s===a)return ln;const l=u=>YS(u,0,1,n,s);return u=>u===0||u===1?u:ab(l(u),e,a)}const rb=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,ob=n=>e=>1-n(1-e),lb=Ir(.33,1.53,.69,.99),Jd=ob(lb),ub=rb(Jd),cb=n=>n>=1?1:(n*=2)<1?.5*Jd(n):.5*(2-Math.pow(2,-10*(n-1))),Qd=n=>1-Math.sin(Math.acos(n)),hb=ob(Qd),db=rb(Qd),XS=Ir(.42,0,1,1),JS=Ir(0,0,.58,1),fb=Ir(.42,0,.58,1),QS=n=>Array.isArray(n)&&typeof n[0]!="number",mb=n=>Array.isArray(n)&&typeof n[0]=="number",ZS={linear:ln,easeIn:XS,easeInOut:fb,easeOut:JS,circIn:Qd,circInOut:db,circOut:hb,backIn:Jd,backInOut:ub,backOut:lb,anticipate:cb},WS=n=>typeof n=="string",By=n=>{if(mb(n)){Yd(n.length===4);const[e,s,a,l]=n;return Ir(e,s,a,l)}else if(WS(n))return ZS[n];return n},ml=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function e1(n){let e=new Set,s=new Set,a=!1,l=!1;const u=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function d(p){u.has(p)&&(m.schedule(p),n()),p(c)}const m={schedule:(p,g=!1,v=!1)=>{const x=v&&a?e:s;return g&&u.add(p),x.add(p),p},cancel:p=>{s.delete(p),u.delete(p)},process:p=>{if(c=p,a){l=!0;return}a=!0;const g=e;e=s,s=g,e.forEach(d),e.clear(),a=!1,l&&(l=!1,m.process(p))}};return m}const t1=40;function pb(n,e){let s=!1,a=!0;const l={delta:0,timestamp:0,isProcessing:!1},u=()=>s=!0,c=ml.reduce((O,P)=>(O[P]=e1(u),O),{}),{setup:d,read:m,resolveKeyframes:p,preUpdate:g,update:v,preRender:w,render:x,postRender:S}=c,A=()=>{const O=Li.useManualTiming,P=O?l.timestamp:performance.now();s=!1,O||(l.delta=a?1e3/60:Math.max(Math.min(P-l.timestamp,t1),1)),l.timestamp=P,l.isProcessing=!0,d.process(l),m.process(l),p.process(l),g.process(l),v.process(l),w.process(l),x.process(l),S.process(l),l.isProcessing=!1,s&&e&&(a=!1,n(A))},k=()=>{s=!0,a=!0,l.isProcessing||n(A)};return{schedule:ml.reduce((O,P)=>{const J=c[P];return O[P]=(X,G=!1,Z=!1)=>(s||k(),J.schedule(X,G,Z)),O},{}),cancel:O=>{for(let P=0;P<ml.length;P++)c[ml[P]].cancel(O)},state:l,steps:c}}const{schedule:Pe,cancel:zi,state:vt,steps:Oh}=pb(typeof requestAnimationFrame<"u"?requestAnimationFrame:ln,!0);let kl;function n1(){kl=void 0}const Tt={now:()=>(kl===void 0&&Tt.set(vt.isProcessing||Li.useManualTiming?vt.timestamp:performance.now()),kl),set:n=>{kl=n,queueMicrotask(n1)}},gb=n=>e=>typeof e=="string"&&e.startsWith(n),yb=gb("--"),i1=gb("var(--"),Zd=n=>i1(n)?s1.test(n.split("/*")[0].trim()):!1,s1=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ly(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const ya={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Or={...ya,transform:n=>Mn(0,1,n)},pl={...ya,default:1},xr=n=>Math.round(n*1e5)/1e5,Wd=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function a1(n){return n==null}const r1=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ef=(n,e)=>s=>!!(typeof s=="string"&&r1.test(s)&&s.startsWith(n)||e&&!a1(s)&&Object.prototype.hasOwnProperty.call(s,e)),vb=(n,e,s)=>a=>{if(typeof a!="string")return a;const[l,u,c,d]=a.match(Wd);return{[n]:parseFloat(l),[e]:parseFloat(u),[s]:parseFloat(c),alpha:d!==void 0?parseFloat(d):1}},o1=n=>Mn(0,255,n),Nh={...ya,transform:n=>Math.round(o1(n))},hs={test:ef("rgb","red"),parse:vb("red","green","blue"),transform:({red:n,green:e,blue:s,alpha:a=1})=>"rgba("+Nh.transform(n)+", "+Nh.transform(e)+", "+Nh.transform(s)+", "+xr(Or.transform(a))+")"};function l1(n){let e="",s="",a="",l="";return n.length>5?(e=n.substring(1,3),s=n.substring(3,5),a=n.substring(5,7),l=n.substring(7,9)):(e=n.substring(1,2),s=n.substring(2,3),a=n.substring(3,4),l=n.substring(4,5),e+=e,s+=s,a+=a,l+=l),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(a,16),alpha:l?parseInt(l,16)/255:1}}const sd={test:ef("#"),parse:l1,transform:hs.transform},Gr=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),ii=Gr("deg"),Dn=Gr("%"),se=Gr("px"),u1=Gr("vh"),c1=Gr("vw"),zy={...Dn,parse:n=>Dn.parse(n)/100,transform:n=>Dn.transform(n*100)},ua={test:ef("hsl","hue"),parse:vb("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:s,alpha:a=1})=>"hsla("+Math.round(n)+", "+Dn.transform(xr(e))+", "+Dn.transform(xr(s))+", "+xr(Or.transform(a))+")"},rt={test:n=>hs.test(n)||sd.test(n)||ua.test(n),parse:n=>hs.test(n)?hs.parse(n):ua.test(n)?ua.parse(n):sd.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?hs.transform(n):ua.transform(n),getAnimatableNone:n=>{const e=rt.parse(n);return e.alpha=0,rt.transform(e)}},h1=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function d1(n){var e,s;return isNaN(n)&&typeof n=="string"&&(((e=n.match(Wd))==null?void 0:e.length)||0)+(((s=n.match(h1))==null?void 0:s.length)||0)>0}const bb="number",wb="color",f1="var",m1="var(",Vy="${}",p1=/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 pa(n){const e=n.toString(),s=[],a={color:[],number:[],var:[]},l=[];let u=0;const d=e.replace(p1,m=>(rt.test(m)?(a.color.push(u),l.push(wb),s.push(rt.parse(m))):m.startsWith(m1)?(a.var.push(u),l.push(f1),s.push(m)):(a.number.push(u),l.push(bb),s.push(parseFloat(m))),++u,Vy)).split(Vy);return{values:s,split:d,indexes:a,types:l}}function g1(n){return pa(n).values}function _b({split:n,types:e}){const s=n.length;return a=>{let l="";for(let u=0;u<s;u++)if(l+=n[u],a[u]!==void 0){const c=e[u];c===bb?l+=xr(a[u]):c===wb?l+=rt.transform(a[u]):l+=a[u]}return l}}function y1(n){return _b(pa(n))}const v1=n=>typeof n=="number"?0:rt.test(n)?rt.getAnimatableNone(n):n,b1=(n,e)=>typeof n=="number"?e!=null&&e.trim().endsWith("/")?n:0:v1(n);function w1(n){const e=pa(n);return _b(e)(e.values.map((a,l)=>b1(a,e.split[l])))}const wn={test:d1,parse:g1,createTransformer:y1,getAnimatableNone:w1};function Dh(n,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?n+(e-n)*6*s:s<1/2?e:s<2/3?n+(e-n)*(2/3-s)*6:n}function _1({hue:n,saturation:e,lightness:s,alpha:a}){n/=360,e/=100,s/=100;let l=0,u=0,c=0;if(!e)l=u=c=s;else{const d=s<.5?s*(1+e):s+e-s*e,m=2*s-d;l=Dh(m,d,n+1/3),u=Dh(m,d,n),c=Dh(m,d,n-1/3)}return{red:Math.round(l*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:a}}function Pl(n,e){return s=>s>0?e:n}const Ve=(n,e,s)=>n+(e-n)*s,Mh=(n,e,s)=>{const a=n*n,l=s*(e*e-a)+a;return l<0?0:Math.sqrt(l)},x1=[sd,hs,ua],S1=n=>x1.find(e=>e.test(n));function Py(n){const e=S1(n);if(!e)return!1;let s=e.parse(n);return e===ua&&(s=_1(s)),s}const Hy=(n,e)=>{const s=Py(n),a=Py(e);if(!s||!a)return Pl(n,e);const l={...s};return u=>(l.red=Mh(s.red,a.red,u),l.green=Mh(s.green,a.green,u),l.blue=Mh(s.blue,a.blue,u),l.alpha=Ve(s.alpha,a.alpha,u),hs.transform(l))},ad=new Set(["none","hidden"]);function T1(n,e){return ad.has(n)?s=>s<=0?n:e:s=>s>=1?e:n}function E1(n,e){return s=>Ve(n,e,s)}function tf(n){return typeof n=="number"?E1:typeof n=="string"?Zd(n)?Pl:rt.test(n)?Hy:C1:Array.isArray(n)?xb:typeof n=="object"?rt.test(n)?Hy:A1:Pl}function xb(n,e){const s=[...n],a=s.length,l=n.map((u,c)=>tf(u)(u,e[c]));return u=>{for(let c=0;c<a;c++)s[c]=l[c](u);return s}}function A1(n,e){const s={...n,...e},a={};for(const l in s)n[l]!==void 0&&e[l]!==void 0&&(a[l]=tf(n[l])(n[l],e[l]));return l=>{for(const u in a)s[u]=a[u](l);return s}}function R1(n,e){const s=[],a={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],c=n.indexes[u][a[u]],d=n.values[c]??0;s[l]=d,a[u]++}return s}const C1=(n,e)=>{const s=wn.createTransformer(e),a=pa(n),l=pa(e);return a.indexes.var.length===l.indexes.var.length&&a.indexes.color.length===l.indexes.color.length&&a.indexes.number.length>=l.indexes.number.length?ad.has(n)&&!l.values.length||ad.has(e)&&!a.values.length?T1(n,e):qr(xb(R1(a,l),l.values),s):Pl(n,e)};function Sb(n,e,s){return typeof n=="number"&&typeof e=="number"&&typeof s=="number"?Ve(n,e,s):tf(n)(n,e)}const k1=n=>{const e=({timestamp:s})=>n(s);return{start:(s=!0)=>Pe.update(e,s),stop:()=>zi(e),now:()=>vt.isProcessing?vt.timestamp:Tt.now()}},Tb=(n,e,s=10)=>{let a="";const l=Math.max(Math.round(e/s),2);for(let u=0;u<l;u++)a+=Math.round(n(u/(l-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},Hl=2e4;function nf(n){let e=0;const s=50;let a=n.next(e);for(;!a.done&&e<Hl;)e+=s,a=n.next(e);return e>=Hl?1/0:e}function j1(n,e=100,s){const a=s({...n,keyframes:[0,e]}),l=Math.min(nf(a),Hl);return{type:"keyframes",ease:u=>a.next(l*u).value/e,duration:on(l)}}const Qe={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};function rd(n,e){return n*Math.sqrt(1-e*e)}const O1=12;function N1(n,e,s){let a=s;for(let l=1;l<O1;l++)a=a-n(a)/e(a);return a}const Uh=.001;function D1({duration:n=Qe.duration,bounce:e=Qe.bounce,velocity:s=Qe.velocity,mass:a=Qe.mass}){let l,u,c=1-e;c=Mn(Qe.minDamping,Qe.maxDamping,c),n=Mn(Qe.minDuration,Qe.maxDuration,on(n)),c<1?(l=p=>{const g=p*c,v=g*n,w=g-s,x=rd(p,c),S=Math.exp(-v);return Uh-w/x*S},u=p=>{const v=p*c*n,w=v*s+s,x=Math.pow(c,2)*Math.pow(p,2)*n,S=Math.exp(-v),A=rd(Math.pow(p,2),c);return(-l(p)+Uh>0?-1:1)*((w-x)*S)/A}):(l=p=>{const g=Math.exp(-p*n),v=(p-s)*n+1;return-Uh+g*v},u=p=>{const g=Math.exp(-p*n),v=(s-p)*(n*n);return g*v});const d=5/n,m=N1(l,u,d);if(n=Ft(n),isNaN(m))return{stiffness:Qe.stiffness,damping:Qe.damping,duration:n};{const p=Math.pow(m,2)*a;return{stiffness:p,damping:c*2*Math.sqrt(a*p),duration:n}}}const M1=["duration","bounce"],U1=["stiffness","damping","mass"];function $y(n,e){return e.some(s=>n[s]!==void 0)}function B1(n){let e={velocity:Qe.velocity,stiffness:Qe.stiffness,damping:Qe.damping,mass:Qe.mass,isResolvedFromDuration:!1,...n};if(!$y(n,U1)&&$y(n,M1))if(e.velocity=0,n.visualDuration){const s=n.visualDuration,a=2*Math.PI/(s*1.2),l=a*a,u=2*Mn(.05,1,1-(n.bounce||0))*Math.sqrt(l);e={...e,mass:Qe.mass,stiffness:l,damping:u}}else{const s=D1({...n,velocity:0});e={...e,...s,mass:Qe.mass},e.isResolvedFromDuration=!0}return e}function $l(n=Qe.visualDuration,e=Qe.bounce){const s=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:a,restDelta:l}=s;const u=s.keyframes[0],c=s.keyframes[s.keyframes.length-1],d={done:!1,value:u},{stiffness:m,damping:p,mass:g,duration:v,velocity:w,isResolvedFromDuration:x}=B1({...s,velocity:-on(s.velocity||0)}),S=w||0,A=p/(2*Math.sqrt(m*g)),k=c-u,C=on(Math.sqrt(m/g)),N=Math.abs(k)<5;a||(a=N?Qe.restSpeed.granular:Qe.restSpeed.default),l||(l=N?Qe.restDelta.granular:Qe.restDelta.default);let O,P,J,X,G,Z;if(A<1)J=rd(C,A),X=(S+A*C*k)/J,O=ne=>{const le=Math.exp(-A*C*ne);return c-le*(X*Math.sin(J*ne)+k*Math.cos(J*ne))},G=A*C*X+k*J,Z=A*C*k-X*J,P=ne=>Math.exp(-A*C*ne)*(G*Math.sin(J*ne)+Z*Math.cos(J*ne));else if(A===1){O=le=>c-Math.exp(-C*le)*(k+(S+C*k)*le);const ne=S+C*k;P=le=>Math.exp(-C*le)*(C*ne*le-S)}else{const ne=C*Math.sqrt(A*A-1);O=Re=>{const ke=Math.exp(-A*C*Re),L=Math.min(ne*Re,300);return c-ke*((S+A*C*k)*Math.sinh(L)+ne*k*Math.cosh(L))/ne};const le=(S+A*C*k)/ne,de=A*C*le-k*ne,je=A*C*k-le*ne;P=Re=>{const ke=Math.exp(-A*C*Re),L=Math.min(ne*Re,300);return ke*(de*Math.sinh(L)+je*Math.cosh(L))}}const ee={calculatedDuration:x&&v||null,velocity:ne=>Ft(P(ne)),next:ne=>{if(!x&&A<1){const de=Math.exp(-A*C*ne),je=Math.sin(J*ne),Re=Math.cos(J*ne),ke=c-de*(X*je+k*Re),L=Ft(de*(G*je+Z*Re));return d.done=Math.abs(L)<=a&&Math.abs(c-ke)<=l,d.value=d.done?c:ke,d}const le=O(ne);if(x)d.done=ne>=v;else{const de=Ft(P(ne));d.done=Math.abs(de)<=a&&Math.abs(c-le)<=l}return d.value=d.done?c:le,d},toString:()=>{const ne=Math.min(nf(ee),Hl),le=Tb(de=>ee.next(ne*de).value,ne,30);return ne+"ms "+le},toTransition:()=>{}};return ee}$l.applyToOptions=n=>{const e=j1(n,100,$l);return n.ease=e.ease,n.duration=Ft(e.duration),n.type="keyframes",n};const L1=5;function Eb(n,e,s){const a=Math.max(e-L1,0);return sb(s-n(a),e-a)}function od({keyframes:n,velocity:e=0,power:s=.8,timeConstant:a=325,bounceDamping:l=10,bounceStiffness:u=500,modifyTarget:c,min:d,max:m,restDelta:p=.5,restSpeed:g}){const v=n[0],w={done:!1,value:v},x=Z=>d!==void 0&&Z<d||m!==void 0&&Z>m,S=Z=>d===void 0?m:m===void 0||Math.abs(d-Z)<Math.abs(m-Z)?d:m;let A=s*e;const k=v+A,C=c===void 0?k:c(k);C!==k&&(A=C-v);const N=Z=>-A*Math.exp(-Z/a),O=Z=>C+N(Z),P=Z=>{const ee=N(Z),ne=O(Z);w.done=Math.abs(ee)<=p,w.value=w.done?C:ne};let J,X;const G=Z=>{x(w.value)&&(J=Z,X=$l({keyframes:[w.value,S(w.value)],velocity:Eb(O,Z,w.value),damping:l,stiffness:u,restDelta:p,restSpeed:g}))};return G(0),{calculatedDuration:null,next:Z=>{let ee=!1;return!X&&J===void 0&&(ee=!0,P(Z),G(Z)),J!==void 0&&Z>=J?X.next(Z-J):(!ee&&P(Z),w)}}}function z1(n,e,s){const a=[],l=s||Li.mix||Sb,u=n.length-1;for(let c=0;c<u;c++){let d=l(n[c],n[c+1]);if(e){const m=Array.isArray(e)?e[c]||ln:e;d=qr(m,d)}a.push(d)}return a}function V1(n,e,{clamp:s=!0,ease:a,mixer:l}={}){const u=n.length;if(Yd(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=n[0]===n[1];n[0]>n[u-1]&&(n=[...n].reverse(),e=[...e].reverse());const d=z1(e,a,l),m=d.length,p=g=>{if(c&&g<n[0])return e[0];let v=0;if(m>1)for(;v<n.length-2&&!(g<n[v+1]);v++);const w=jr(n[v],n[v+1],g);return d[v](w)};return s?g=>p(Mn(n[0],n[u-1],g)):p}function P1(n,e){const s=n[n.length-1];for(let a=1;a<=e;a++){const l=jr(0,e,a);n.push(Ve(s,1,l))}}function H1(n){const e=[0];return P1(e,n.length-1),e}function $1(n,e){return n.map(s=>s*e)}function q1(n,e){return n.map(()=>e||fb).splice(0,n.length-1)}function Sr({duration:n=300,keyframes:e,times:s,ease:a="easeInOut"}){const l=QS(a)?a.map(By):By(a),u={done:!1,value:e[0]},c=$1(s&&s.length===e.length?s:H1(e),n),d=V1(c,e,{ease:Array.isArray(l)?l:q1(e,l)});return{calculatedDuration:n,next:m=>(u.value=d(m),u.done=m>=n,u)}}const I1=n=>n!==null;function su(n,{repeat:e,repeatType:s="loop"},a,l=1){const u=n.filter(I1),d=l<0||e&&s!=="loop"&&e%2===1?0:u.length-1;return!d||a===void 0?u[d]:a}const G1={decay:od,inertia:od,tween:Sr,keyframes:Sr,spring:$l};function Ab(n){typeof n.type=="string"&&(n.type=G1[n.type])}class sf{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const K1=n=>n/100;class ql extends sf{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var a,l;const{motionValue:s}=this.options;s&&s.updatedAt!==Tt.now()&&this.tick(Tt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(l=(a=this.options).onStop)==null||l.call(a))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Ab(e);const{type:s=Sr,repeat:a=0,repeatDelay:l=0,repeatType:u,velocity:c=0}=e;let{keyframes:d}=e;const m=s||Sr;m!==Sr&&typeof d[0]!="number"&&(this.mixKeyframes=qr(K1,Sb(d[0],d[1])),d=[0,100]);const p=m({...e,keyframes:d});u==="mirror"&&(this.mirroredGenerator=m({...e,keyframes:[...d].reverse(),velocity:-c})),p.calculatedDuration===null&&(p.calculatedDuration=nf(p));const{calculatedDuration:g}=p;this.calculatedDuration=g,this.resolvedDuration=g+l,this.totalDuration=this.resolvedDuration*(a+1)-l,this.generator=p}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:a,totalDuration:l,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:d,calculatedDuration:m}=this;if(this.startTime===null)return a.next(0);const{delay:p=0,keyframes:g,repeat:v,repeatType:w,repeatDelay:x,type:S,onUpdate:A,finalKeyframe:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const C=this.currentTime-p*(this.playbackSpeed>=0?1:-1),N=this.playbackSpeed>=0?C<0:C>l;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let O=this.currentTime,P=a;if(v){const Z=Math.min(this.currentTime,l)/d;let ee=Math.floor(Z),ne=Z%1;!ne&&Z>=1&&(ne=1),ne===1&&ee--,ee=Math.min(ee,v+1),!!(ee%2)&&(w==="reverse"?(ne=1-ne,x&&(ne-=x/d)):w==="mirror"&&(P=c)),O=Mn(0,1,ne)*d}let J;N?(this.delayState.value=g[0],J=this.delayState):J=P.next(O),u&&!N&&(J.value=u(J.value));let{done:X}=J;!N&&m!==null&&(X=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const G=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&X);return G&&S!==od&&(J.value=su(g,this.options,k,this.speed)),A&&A(J.value),G&&this.finish(),J}then(e,s){return this.finished.then(e,s)}get duration(){return on(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+on(e)}get time(){return on(this.currentTime)}set time(e){e=Ft(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const s=this.generator.next(e).value;return Eb(a=>this.generator.next(a).value,e,s)}get speed(){return this.playbackSpeed}set speed(e){const s=this.playbackSpeed!==e;s&&this.driver&&this.updateTime(Tt.now()),this.playbackSpeed=e,s&&this.driver&&(this.time=on(this.currentTime))}play(){var l,u;if(this.isStopped)return;const{driver:e=k1,startTime:s}=this.options;this.driver||(this.driver=e(c=>this.tick(c))),(u=(l=this.options).onPlay)==null||u.call(l);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=s??a),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(Tt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(e=this.options).onComplete)==null||s.call(e)}cancel(){var e,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(e=this.options).onCancel)==null||s.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),e.observe(this)}}function F1(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const ds=n=>n*180/Math.PI,ld=n=>{const e=ds(Math.atan2(n[1],n[0]));return ud(e)},Y1={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:ld,rotateZ:ld,skewX:n=>ds(Math.atan(n[1])),skewY:n=>ds(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},ud=n=>(n=n%360,n<0&&(n+=360),n),qy=ld,Iy=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),Gy=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),X1={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Iy,scaleY:Gy,scale:n=>(Iy(n)+Gy(n))/2,rotateX:n=>ud(ds(Math.atan2(n[6],n[5]))),rotateY:n=>ud(ds(Math.atan2(-n[2],n[0]))),rotateZ:qy,rotate:qy,skewX:n=>ds(Math.atan(n[4])),skewY:n=>ds(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function cd(n){return n.includes("scale")?1:0}function hd(n,e){if(!n||n==="none")return cd(e);const s=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,l;if(s)a=X1,l=s;else{const d=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Y1,l=d}if(!l)return cd(e);const u=a[e],c=l[1].split(",").map(Q1);return typeof u=="function"?u(c):c[u]}const J1=(n,e)=>{const{transform:s="none"}=getComputedStyle(n);return hd(s,e)};function Q1(n){return parseFloat(n.trim())}const va=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ba=new Set([...va,"pathRotation"]),Ky=n=>n===ya||n===se,Z1=new Set(["x","y","z"]),W1=va.filter(n=>!Z1.has(n));function eT(n){const e=[];return W1.forEach(s=>{const a=n.getValue(s);a!==void 0&&(e.push([s,a.get()]),a.set(s.startsWith("scale")?1:0))}),e}const Bi={width:({x:n},{paddingLeft:e="0",paddingRight:s="0",boxSizing:a})=>{const l=n.max-n.min;return a==="border-box"?l:l-parseFloat(e)-parseFloat(s)},height:({y:n},{paddingTop:e="0",paddingBottom:s="0",boxSizing:a})=>{const l=n.max-n.min;return a==="border-box"?l:l-parseFloat(e)-parseFloat(s)},top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>hd(e,"x"),y:(n,{transform:e})=>hd(e,"y")};Bi.translateX=Bi.x;Bi.translateY=Bi.y;const ms=new Set;let dd=!1,fd=!1,md=!1;function Rb(){if(fd){const n=Array.from(ms).filter(a=>a.needsMeasurement),e=new Set(n.map(a=>a.element)),s=new Map;e.forEach(a=>{const l=eT(a);l.length&&(s.set(a,l),a.render())}),n.forEach(a=>a.measureInitialState()),e.forEach(a=>{a.render();const l=s.get(a);l&&l.forEach(([u,c])=>{var d;(d=a.getValue(u))==null||d.set(c)})}),n.forEach(a=>a.measureEndState()),n.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}fd=!1,dd=!1,ms.forEach(n=>n.complete(md)),ms.clear()}function Cb(){ms.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(fd=!0)})}function tT(){md=!0,Cb(),Rb(),md=!1}class af{constructor(e,s,a,l,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=a,this.motionValue=l,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(ms.add(this),dd||(dd=!0,Pe.read(Cb),Pe.resolveKeyframes(Rb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:a,motionValue:l}=this;if(e[0]===null){const u=l==null?void 0:l.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(a&&s){const d=a.readValue(s,c);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=c),l&&u===void 0&&l.set(e[0])}F1(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ms.delete(this)}cancel(){this.state==="scheduled"&&(ms.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const nT=n=>n.startsWith("--");function kb(n,e,s){nT(e)?n.style.setProperty(e,s):n.style[e]=s}const iT={};function jb(n,e){const s=ib(n);return()=>iT[e]??s()}const sT=jb(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ob=jb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),yr=([n,e,s,a])=>`cubic-bezier(${n}, ${e}, ${s}, ${a})`,Fy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:yr([0,.65,.55,1]),circOut:yr([.55,0,1,.45]),backIn:yr([.31,.01,.66,-.59]),backOut:yr([.33,1.53,.69,.99])};function Nb(n,e){if(n)return typeof n=="function"?Ob()?Tb(n,e):"ease-out":mb(n)?yr(n):Array.isArray(n)?n.map(s=>Nb(s,e)||Fy.easeOut):Fy[n]}function aT(n,e,s,{delay:a=0,duration:l=300,repeat:u=0,repeatType:c="loop",ease:d="easeOut",times:m}={},p=void 0){const g={[e]:s};m&&(g.offset=m);const v=Nb(d,l);Array.isArray(v)&&(g.easing=v);const w={delay:a,duration:l,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return p&&(w.pseudoElement=p),n.animate(g,w)}function Db(n){return typeof n=="function"&&"applyToOptions"in n}function rT({type:n,...e}){return Db(n)&&Ob()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Mb extends sf{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:s,name:a,keyframes:l,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:d,onComplete:m}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,Yd(typeof e.type!="string");const p=rT(e);this.animation=aT(s,a,l,p,u),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const g=su(l,this.options,d,this.speed);this.updateMotionValue&&this.updateMotionValue(g),kb(s,a,g),this.animation.cancel()}m==null||m(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,s;(s=(e=this.animation).finish)==null||s.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var s,a,l;const e=(s=this.options)==null?void 0:s.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((l=(a=this.animation).commitStyles)==null||l.call(a))}get duration(){var s,a;const e=((a=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:a.call(s).duration)||0;return on(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+on(e)}get time(){return on(Number(this.animation.currentTime)||0)}set time(e){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ft(e),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:s,rangeEnd:a,observe:l}){var u;return this.allowFlatten&&((u=this.animation.effect)==null||u.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&sT()?(this.animation.timeline=e,s&&(this.animation.rangeStart=s),a&&(this.animation.rangeEnd=a),ln):l(this)}}const Ub={anticipate:cb,backInOut:ub,circInOut:db};function oT(n){return n in Ub}function lT(n){typeof n.ease=="string"&&oT(n.ease)&&(n.ease=Ub[n.ease])}const Bh=10;class uT extends Mb{constructor(e){lT(e),Ab(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:a,onComplete:l,element:u,...c}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const d=new ql({...c,autoplay:!1}),m=Math.max(Bh,Tt.now()-this.startTime),p=Mn(0,Bh,m-Bh),g=d.sample(m).value,{name:v}=this.options;u&&v&&kb(u,v,g),s.setWithVelocity(d.sample(Math.max(0,m-p)).value,g,p),d.stop()}}const Yy=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(wn.test(n)||n==="0")&&!n.startsWith("url("));function cT(n){const e=n[0];if(n.length===1)return!0;for(let s=0;s<n.length;s++)if(n[s]!==e)return!0}function hT(n,e,s,a){const l=n[0];if(l===null)return!1;if(e==="display"||e==="visibility")return!0;const u=n[n.length-1],c=Yy(l,e),d=Yy(u,e);return!c||!d?!1:cT(n)||(s==="spring"||Db(s))&&a}function pd(n){n.duration=0,n.type="keyframes"}const Bb=new Set(["opacity","clipPath","filter","transform"]),dT=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function fT(n){for(let e=0;e<n.length;e++)if(typeof n[e]=="string"&&dT.test(n[e]))return!0;return!1}const mT=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),pT=ib(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function gT(n){var v;const{motionValue:e,name:s,repeatDelay:a,repeatType:l,damping:u,type:c,keyframes:d}=n;if(!(((v=e==null?void 0:e.owner)==null?void 0:v.current)instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:g}=e.owner.getProps();return pT()&&s&&(Bb.has(s)||mT.has(s)&&fT(d))&&(s!=="transform"||!g)&&!p&&!a&&l!=="mirror"&&u!==0&&c!=="inertia"}const yT=40;class vT extends sf{constructor({autoplay:e=!0,delay:s=0,type:a="keyframes",repeat:l=0,repeatDelay:u=0,repeatType:c="loop",keyframes:d,name:m,motionValue:p,element:g,...v}){var S;super(),this.stop=()=>{var A,k;this._animation&&(this._animation.stop(),(A=this.stopTimeline)==null||A.call(this)),(k=this.keyframeResolver)==null||k.cancel()},this.createdAt=Tt.now();const w={autoplay:e,delay:s,type:a,repeat:l,repeatDelay:u,repeatType:c,name:m,motionValue:p,element:g,...v},x=(g==null?void 0:g.KeyframeResolver)||af;this.keyframeResolver=new x(d,(A,k,C)=>this.onKeyframesResolved(A,k,w,!C),m,p,g),(S=this.keyframeResolver)==null||S.scheduleResolve()}onKeyframesResolved(e,s,a,l){var C,N;this.keyframeResolver=void 0;const{name:u,type:c,velocity:d,delay:m,isHandoff:p,onUpdate:g}=a;this.resolvedAt=Tt.now();let v=!0;hT(e,u,c,d)||(v=!1,(Li.instantAnimations||!m)&&(g==null||g(su(e,a,s))),e[0]=e[e.length-1],pd(a),a.repeat=0);const x={startTime:l?this.resolvedAt?this.resolvedAt-this.createdAt>yT?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...a,keyframes:e},S=v&&!p&&gT(x),A=(N=(C=x.motionValue)==null?void 0:C.owner)==null?void 0:N.current;let k;if(S)try{k=new uT({...x,element:A})}catch{k=new ql(x)}else k=new ql(x);k.finished.then(()=>{this.notifyFinished()}).catch(ln),this.pendingTimeline&&(this.stopTimeline=k.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=k}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),tT()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function Lb(n,e,s,a=0,l=1){const u=Array.from(n).sort((p,g)=>p.sortNodePosition(g)).indexOf(e),c=n.size,d=(c-1)*a;return typeof s=="function"?s(u,c):l===1?u*a:d-u*a}const Xy=30,bT=n=>!isNaN(parseFloat(n));class wT{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{var u;const l=Tt.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&((u=this.events.change)==null||u.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=Tt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bT(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new Xd);const a=this.events[e].add(s);return e==="change"?()=>{a(),Pe.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,a){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-a}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Tt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Xy)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Xy);return sb(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,s;(e=this.dependents)==null||e.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ga(n,e){return new wT(n,e)}function zb(n,e){if(n!=null&&n.inherit&&e){const{inherit:s,...a}=n;return{...e,...a}}return n}function rf(n,e){const s=(n==null?void 0:n[e])??(n==null?void 0:n.default)??n;return s!==n?zb(s,n):s}const _T={type:"spring",stiffness:500,damping:25,restSpeed:10},xT=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),ST={type:"keyframes",duration:.8},TT={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ET=(n,{keyframes:e})=>e.length>2?ST:ba.has(n)?n.startsWith("scale")?xT(e[1]):_T:TT,AT=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function RT(n){for(const e in n)if(!AT.has(e))return!0;return!1}const of=(n,e,s,a={},l,u)=>c=>{const d=rf(a,n)||{},m=d.delay||a.delay||0;let{elapsed:p=0}=a;p=p-Ft(m);const g={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-p,onUpdate:w=>{e.set(w),d.onUpdate&&d.onUpdate(w)},onComplete:()=>{c(),d.onComplete&&d.onComplete()},name:n,motionValue:e,element:u?void 0:l};RT(d)||Object.assign(g,ET(n,g)),g.duration&&(g.duration=Ft(g.duration)),g.repeatDelay&&(g.repeatDelay=Ft(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let v=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(pd(g),g.delay===0&&(v=!0)),(Li.instantAnimations||Li.skipAnimations||l!=null&&l.shouldSkipAnimations||d.skipAnimations)&&(v=!0,pd(g),g.delay=0),g.allowFlatten=!d.type&&!d.ease,v&&!u&&e.get()!==void 0){const w=su(g.keyframes,d);if(w!==void 0){Pe.update(()=>{g.onUpdate(w),g.onComplete()});return}}return d.isSync?new ql(g):new vT(g)},CT=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kT(n){const e=CT.exec(n);if(!e)return[,];const[,s,a,l]=e;return[`--${s??a}`,l]}function Vb(n,e,s=1){const[a,l]=kT(n);if(!a)return;const u=window.getComputedStyle(e).getPropertyValue(a);if(u){const c=u.trim();return eb(c)?parseFloat(c):c}return Zd(l)?Vb(l,e,s+1):l}function Jy(n){const e=[{},{}];return n==null||n.values.forEach((s,a)=>{e[0][a]=s.get(),e[1][a]=s.getVelocity()}),e}function lf(n,e,s,a){if(typeof e=="function"){const[l,u]=Jy(a);e=e(s!==void 0?s:n.custom,l,u)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[l,u]=Jy(a);e=e(s!==void 0?s:n.custom,l,u)}return e}function ps(n,e,s){const a=n.getProps();return lf(a,e,s!==void 0?s:a.custom,n)}const Pb=new Set(["width","height","top","left","right","bottom",...va]),gd=n=>Array.isArray(n);function jT(n,e,s){n.hasValue(e)?n.getValue(e).set(s):n.addValue(e,ga(s))}function OT(n){return gd(n)?n[n.length-1]||0:n}function NT(n,e){const s=ps(n,e);let{transitionEnd:a={},transition:l={},...u}=s||{};u={...u,...a};for(const c in u){const d=OT(u[c]);jT(n,c,d)}}const bt=n=>!!(n&&n.getVelocity);function DT(n){return!!(bt(n)&&n.add)}function yd(n,e){const s=n.getValue("willChange");if(DT(s))return s.add(e);if(!s&&Li.WillChange){const a=new Li.WillChange("auto");n.addValue("willChange",a),a.add(e)}}function uf(n){return n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const MT="framerAppearId",Hb="data-"+uf(MT);function $b(n){return n.props[Hb]}function UT({protectedKeys:n,needsAnimating:e},s){const a=n.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,a}function qb(n,e,{delay:s=0,transitionOverride:a,type:l}={}){let{transition:u,transitionEnd:c,...d}=e;const m=n.getDefaultTransition();u=u?zb(u,m):m;const p=u==null?void 0:u.reduceMotion,g=u==null?void 0:u.skipAnimations;a&&(u=a);const v=[],w=l&&n.animationState&&n.animationState.getState()[l],x=u==null?void 0:u.path;x&&x.animateVisualElement(n,d,u,s,v);for(const S in d){const A=n.getValue(S,n.latestValues[S]??null),k=d[S];if(k===void 0||w&&UT(w,S))continue;const C={delay:s,...rf(u||{},S)};g&&(C.skipAnimations=!0);const N=A.get();if(N!==void 0&&!A.isAnimating()&&!Array.isArray(k)&&k===N&&!C.velocity){Pe.update(()=>A.set(k));continue}let O=!1;if(window.MotionHandoffAnimation){const X=$b(n);if(X){const G=window.MotionHandoffAnimation(X,S,Pe);G!==null&&(C.startTime=G,O=!0)}}yd(n,S);const P=p??n.shouldReduceMotion;A.start(of(S,A,k,P&&Pb.has(S)?{type:!1}:C,n,O));const J=A.animation;J&&v.push(J)}if(c){const S=()=>Pe.update(()=>{c&&NT(n,c)});v.length?Promise.all(v).then(S):S()}return v}function vd(n,e,s={}){var m;const a=ps(n,e,s.type==="exit"?(m=n.presenceContext)==null?void 0:m.custom:void 0);let{transition:l=n.getDefaultTransition()||{}}=a||{};s.transitionOverride&&(l=s.transitionOverride);const u=a?()=>Promise.all(qb(n,a,s)):()=>Promise.resolve(),c=n.variantChildren&&n.variantChildren.size?(p=0)=>{const{delayChildren:g=0,staggerChildren:v,staggerDirection:w}=l;return BT(n,e,p,g,v,w,s)}:()=>Promise.resolve(),{when:d}=l;if(d){const[p,g]=d==="beforeChildren"?[u,c]:[c,u];return p().then(()=>g())}else return Promise.all([u(),c(s.delay)])}function BT(n,e,s=0,a=0,l=0,u=1,c){const d=[];for(const m of n.variantChildren)m.notify("AnimationStart",e),d.push(vd(m,e,{...c,delay:s+(typeof a=="function"?0:a)+Lb(n.variantChildren,m,a,l,u)}).then(()=>m.notify("AnimationComplete",e)));return Promise.all(d)}function LT(n,e,s={}){n.notify("AnimationStart",e);let a;if(Array.isArray(e)){const l=e.map(u=>vd(n,u,s));a=Promise.all(l)}else if(typeof e=="string")a=vd(n,e,s);else{const l=typeof e=="function"?ps(n,e,s.custom):e;a=Promise.all(qb(n,l,s))}return a.then(()=>{n.notify("AnimationComplete",e)})}const zT={test:n=>n==="auto",parse:n=>n},Ib=n=>e=>e.test(n),Gb=[ya,se,Dn,ii,c1,u1,zT],Qy=n=>Gb.find(Ib(n));function VT(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||nb(n):!0}const PT=new Set(["brightness","contrast","saturate","opacity"]);function HT(n){const[e,s]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[a]=s.match(Wd)||[];if(!a)return n;const l=s.replace(a,"");let u=PT.has(e)?1:0;return a!==s&&(u*=100),e+"("+u+l+")"}const $T=/\b([a-z-]*)\(.*?\)/gu,bd={...wn,getAnimatableNone:n=>{const e=n.match($T);return e?e.map(HT).join(" "):n}},wd={...wn,getAnimatableNone:n=>{const e=wn.parse(n);return wn.createTransformer(n)(e.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},Zy={...ya,transform:Math.round},qT={rotate:ii,pathRotation:ii,rotateX:ii,rotateY:ii,rotateZ:ii,scale:pl,scaleX:pl,scaleY:pl,scaleZ:pl,skew:ii,skewX:ii,skewY:ii,distance:se,translateX:se,translateY:se,translateZ:se,x:se,y:se,z:se,perspective:se,transformPerspective:se,opacity:Or,originX:zy,originY:zy,originZ:se},Il={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,...qT,zIndex:Zy,fillOpacity:Or,strokeOpacity:Or,numOctaves:Zy},IT={...Il,color:rt,backgroundColor:rt,outlineColor:rt,fill:rt,stroke:rt,borderColor:rt,borderTopColor:rt,borderRightColor:rt,borderBottomColor:rt,borderLeftColor:rt,filter:bd,WebkitFilter:bd,mask:wd,WebkitMask:wd},Kb=n=>IT[n],GT=new Set([bd,wd]);function Fb(n,e){let s=Kb(n);return GT.has(s)||(s=wn),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const KT=new Set(["auto","none","0"]);function FT(n,e,s){let a=0,l;for(;a<n.length&&!l;){const u=n[a];typeof u=="string"&&!KT.has(u)&&pa(u).values.length&&(l=n[a]),a++}if(l&&s)for(const u of e)n[u]=Fb(s,l)}class YT extends af{constructor(e,s,a,l,u){super(e,s,a,l,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:a}=this;if(!s||!s.current)return;super.readKeyframes();for(let g=0;g<e.length;g++){let v=e[g];if(typeof v=="string"&&(v=v.trim(),Zd(v))){const w=Vb(v,s.current);w!==void 0&&(e[g]=w),g===e.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!Pb.has(a)||e.length!==2)return;const[l,u]=e,c=Qy(l),d=Qy(u),m=Ly(l),p=Ly(u);if(m!==p&&Bi[a]){this.needsMeasurement=!0;return}if(c!==d)if(Ky(c)&&Ky(d))for(let g=0;g<e.length;g++){const v=e[g];typeof v=="string"&&(e[g]=parseFloat(v))}else Bi[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,a=[];for(let l=0;l<e.length;l++)(e[l]===null||VT(e[l]))&&a.push(l);a.length&&FT(e,a,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:a}=this;if(!e||!e.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Bi[a](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const l=s[s.length-1];l!==void 0&&e.getValue(a,l).jump(l,!1)}measureEndState(){var d;const{element:e,name:s,unresolvedKeyframes:a}=this;if(!e||!e.current)return;const l=e.getValue(s);l&&l.jump(this.measuredOrigin,!1);const u=a.length-1,c=a[u];a[u]=Bi[s](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),(d=this.removedTransforms)!=null&&d.length&&this.removedTransforms.forEach(([m,p])=>{e.getValue(m).set(p)}),this.resolveNoneKeyframes()}}const cf=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Yb(n,e,s){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let a=document;const l=(s==null?void 0:s[n])??a.querySelectorAll(n);return l?Array.from(l):[]}return Array.from(n).filter(a=>a!=null)}const _d=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function jl(n){return tb(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:hf}=pb(queueMicrotask,!1),mn={x:!1,y:!1};function Xb(){return mn.x||mn.y}function XT(n){return n==="x"||n==="y"?mn[n]?null:(mn[n]=!0,()=>{mn[n]=!1}):mn.x||mn.y?null:(mn.x=mn.y=!0,()=>{mn.x=mn.y=!1})}function Jb(n,e){const s=Yb(n),a=new AbortController,l={passive:!0,...e,signal:a.signal};return[s,l,()=>a.abort()]}function JT(n){return!(n.pointerType==="touch"||Xb())}function QT(n,e,s={}){const[a,l,u]=Jb(n,s);return a.forEach(c=>{let d=!1,m=!1,p;const g=()=>{c.removeEventListener("pointerleave",S)},v=k=>{p&&(p(k),p=void 0),g()},w=k=>{d=!1,window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),m&&(m=!1,v(k))},x=()=>{d=!0,window.addEventListener("pointerup",w,l),window.addEventListener("pointercancel",w,l)},S=k=>{if(k.pointerType!=="touch"){if(d){m=!0;return}v(k)}},A=k=>{if(!JT(k))return;m=!1;const C=e(c,k);typeof C=="function"&&(p=C,c.addEventListener("pointerleave",S,l))};c.addEventListener("pointerenter",A,l),c.addEventListener("pointerdown",x,l)}),u}const Qb=(n,e)=>e?n===e?!0:Qb(n,e.parentElement):!1,df=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,ZT=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function WT(n){return ZT.has(n.tagName)||n.isContentEditable===!0}const eE=new Set(["INPUT","SELECT","TEXTAREA"]);function tE(n){return eE.has(n.tagName)||n.isContentEditable===!0}const Ol=new WeakSet;function Wy(n){return e=>{e.key==="Enter"&&n(e)}}function Lh(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const nE=(n,e)=>{const s=n.currentTarget;if(!s)return;const a=Wy(()=>{if(Ol.has(s))return;Lh(s,"down");const l=Wy(()=>{Lh(s,"up")}),u=()=>Lh(s,"cancel");s.addEventListener("keyup",l,e),s.addEventListener("blur",u,e)});s.addEventListener("keydown",a,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",a),e)};function e0(n){return df(n)&&!Xb()}const t0=new WeakSet;function iE(n,e,s={}){const[a,l,u]=Jb(n,s),c=d=>{const m=d.currentTarget;if(!e0(d)||t0.has(d))return;Ol.add(m),s.stopPropagation&&t0.add(d);const p=e(m,d),g={...l,capture:!0},v=(S,A)=>{window.removeEventListener("pointerup",w,g),window.removeEventListener("pointercancel",x,g),Ol.has(m)&&Ol.delete(m),e0(S)&&typeof p=="function"&&p(S,{success:A})},w=S=>{v(S,m===window||m===document||s.useGlobalTarget||Qb(m,S.target))},x=S=>{v(S,!1)};window.addEventListener("pointerup",w,g),window.addEventListener("pointercancel",x,g)};return a.forEach(d=>{(s.useGlobalTarget?window:d).addEventListener("pointerdown",c,l),jl(d)&&(d.addEventListener("focus",p=>nE(p,l)),!WT(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),u}function ff(n){return tb(n)&&"ownerSVGElement"in n}const Nl=new WeakMap;let Di;const Zb=(n,e,s)=>(a,l)=>l&&l[0]?l[0][n+"Size"]:ff(a)&&"getBBox"in a?a.getBBox()[e]:a[s],sE=Zb("inline","width","offsetWidth"),aE=Zb("block","height","offsetHeight");function rE({target:n,borderBoxSize:e}){var s;(s=Nl.get(n))==null||s.forEach(a=>{a(n,{get width(){return sE(n,e)},get height(){return aE(n,e)}})})}function oE(n){n.forEach(rE)}function lE(){typeof ResizeObserver>"u"||(Di=new ResizeObserver(oE))}function uE(n,e){Di||lE();const s=Yb(n);return s.forEach(a=>{let l=Nl.get(a);l||(l=new Set,Nl.set(a,l)),l.add(e),Di==null||Di.observe(a)}),()=>{s.forEach(a=>{const l=Nl.get(a);l==null||l.delete(e),l!=null&&l.size||Di==null||Di.unobserve(a)})}}const Dl=new Set;let ca;function cE(){ca=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Dl.forEach(e=>e(n))},window.addEventListener("resize",ca)}function hE(n){return Dl.add(n),ca||cE(),()=>{Dl.delete(n),!Dl.size&&typeof ca=="function"&&(window.removeEventListener("resize",ca),ca=void 0)}}function n0(n,e){return typeof n=="function"?hE(n):uE(n,e)}function dE(n){return ff(n)&&n.tagName==="svg"}const fE=[...Gb,rt,wn],mE=n=>fE.find(Ib(n)),i0=()=>({translate:0,scale:1,origin:0,originPoint:0}),ha=()=>({x:i0(),y:i0()}),s0=()=>({min:0,max:0}),lt=()=>({x:s0(),y:s0()}),pE=new WeakMap;function au(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function Nr(n){return typeof n=="string"||Array.isArray(n)}const mf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],pf=["initial",...mf];function ru(n){return au(n.animate)||pf.some(e=>Nr(n[e]))}function Wb(n){return!!(ru(n)||n.variants)}function gE(n,e,s){for(const a in e){const l=e[a],u=s[a];if(bt(l))n.addValue(a,l);else if(bt(u))n.addValue(a,ga(l,{owner:n}));else if(u!==l)if(n.hasValue(a)){const c=n.getValue(a);c.liveStyle===!0?c.jump(l):c.hasAnimated||c.set(l)}else{const c=n.getStaticValue(a);n.addValue(a,ga(c!==void 0?c:l,{owner:n}))}}for(const a in s)e[a]===void 0&&n.removeValue(a);return e}const xd={current:null},ew={current:!1},yE=typeof window<"u";function vE(){if(ew.current=!0,!!yE)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>xd.current=n.matches;n.addEventListener("change",e),e()}else xd.current=!1}const a0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Gl={};function tw(n){Gl=n}function bE(){return Gl}class wE{scrapeMotionValuesFromProps(e,s,a){return{}}constructor({parent:e,props:s,presenceContext:a,reducedMotionConfig:l,skipAnimations:u,blockInitialAnimation:c,visualState:d},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=af,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,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 x=Tt.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Pe.render(this.render,!1,!0))};const{latestValues:p,renderState:g}=d;this.latestValues=p,this.baseTarget={...p},this.initialValues=s.initial?{...p}:{},this.renderState=g,this.parent=e,this.props=s,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=l,this.skipAnimationsConfig=u,this.options=m,this.blockInitialAnimation=!!c,this.isControllingVariants=ru(s),this.isVariantNode=Wb(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...w}=this.scrapeMotionValuesFromProps(s,{},this);for(const x in w){const S=w[x];p[x]!==void 0&&bt(S)&&S.set(p[x])}}mount(e){var s,a;if(this.hasBeenMounted)for(const l in this.initialValues)(s=this.values.get(l))==null||s.jump(this.initialValues[l]),this.latestValues[l]=this.initialValues[l];this.current=e,pE.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((l,u)=>this.bindToMotionValue(u,l)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(ew.current||vE(),this.shouldReduceMotion=xd.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(a=this.parent)==null||a.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),zi(this.notifyUpdate),zi(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const a=this.features[s];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,s){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),s.accelerate&&Bb.has(e)&&this.current instanceof HTMLElement){const{factory:c,keyframes:d,times:m,ease:p,duration:g}=s.accelerate,v=new Mb({element:this.current,name:e,keyframes:d,times:m,ease:p,duration:Ft(g)}),w=c(v);this.valueSubscriptions.set(e,()=>{w(),v.cancel()});return}const a=ba.has(e);a&&this.onBindTransform&&this.onBindTransform();const l=s.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&Pe.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;typeof window<"u"&&window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{l(),u&&u()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Gl){const s=Gl[e];if(!s)continue;const{isEnabled:a,Feature:l}=s;if(!this.features[e]&&l&&a(this.props)&&(this.features[e]=new l(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let a=0;a<a0.length;a++){const l=a0[a];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const u="on"+l,c=e[u];c&&(this.propEventSubscriptions[l]=this.on(l,c))}this.prevMotionValues=gE(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const a=this.values.get(e);s!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&s!==void 0&&(a=ga(s===null?void 0:s,{owner:this}),this.addValue(e,a)),a}readValue(e,s){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(eb(a)||nb(a))?a=parseFloat(a):!mE(a)&&wn.test(s)&&(a=Fb(e,s)),this.setBaseTarget(e,bt(a)?a.get():a)),bt(a)?a.get():a}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var u;const{initial:s}=this.props;let a;if(typeof s=="string"||typeof s=="object"){const c=lf(this.props,s,(u=this.presenceContext)==null?void 0:u.custom);c&&(a=c[e])}if(s&&a!==void 0)return a;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!bt(l)?l:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new Xd),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){hf.render(this.render)}}class nw extends wE{constructor(){super(...arguments),this.KeyframeResolver=YT}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){const a=e.style;return a?a[s]:void 0}removeValueFromRenderState(e,{vars:s,style:a}){delete s[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;bt(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Vi{constructor(e){this.isMounted=!1,this.node=e}update(){}}function iw({top:n,left:e,right:s,bottom:a}){return{x:{min:e,max:s},y:{min:n,max:a}}}function _E({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function xE(n,e){if(!e)return n;const s=e({x:n.left,y:n.top}),a=e({x:n.right,y:n.bottom});return{top:s.y,left:s.x,bottom:a.y,right:a.x}}function zh(n){return n===void 0||n===1}function Sd({scale:n,scaleX:e,scaleY:s}){return!zh(n)||!zh(e)||!zh(s)}function ls(n){return Sd(n)||sw(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function sw(n){return r0(n.x)||r0(n.y)}function r0(n){return n&&n!=="0%"}function Kl(n,e,s){const a=n-s,l=e*a;return s+l}function o0(n,e,s,a,l){return l!==void 0&&(n=Kl(n,l,a)),Kl(n,s,a)+e}function Td(n,e=0,s=1,a,l){n.min=o0(n.min,e,s,a,l),n.max=o0(n.max,e,s,a,l)}function aw(n,{x:e,y:s}){Td(n.x,e.translate,e.scale,e.originPoint),Td(n.y,s.translate,s.scale,s.originPoint)}const l0=.999999999999,u0=1.0000000000001;function SE(n,e,s,a=!1){var d;const l=s.length;if(!l)return;e.x=e.y=1;let u,c;for(let m=0;m<l;m++){u=s[m],c=u.projectionDelta;const{visualElement:p}=u.options;p&&p.props.style&&p.props.style.display==="contents"||(a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&(On(n.x,-u.scroll.offset.x),On(n.y,-u.scroll.offset.y)),c&&(e.x*=c.x.scale,e.y*=c.y.scale,aw(n,c)),a&&ls(u.latestValues)&&Ml(n,u.latestValues,(d=u.layout)==null?void 0:d.layoutBox))}e.x<u0&&e.x>l0&&(e.x=1),e.y<u0&&e.y>l0&&(e.y=1)}function On(n,e){n.min+=e,n.max+=e}function c0(n,e,s,a,l=.5){const u=Ve(n.min,n.max,l);Td(n,e,s,u,a)}function h0(n,e){return typeof n=="string"?parseFloat(n)/100*(e.max-e.min):n}function Ml(n,e,s){const a=s??n;c0(n.x,h0(e.x,a.x),e.scaleX,e.scale,e.originX),c0(n.y,h0(e.y,a.y),e.scaleY,e.scale,e.originY)}function rw(n,e){return iw(xE(n.getBoundingClientRect(),e))}function TE(n,e,s){const a=rw(n,s),{scroll:l}=e;return l&&(On(a.x,l.offset.x),On(a.y,l.offset.y)),a}const EE={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},AE=va.length;function RE(n,e,s){let a="",l=!0;for(let c=0;c<AE;c++){const d=va[c],m=n[d];if(m===void 0)continue;let p=!0;if(typeof m=="number")p=m===(d.startsWith("scale")?1:0);else{const g=parseFloat(m);p=d.startsWith("scale")?g===1:g===0}if(!p||s){const g=_d(m,Il[d]);if(!p){l=!1;const v=EE[d]||d;a+=`${v}(${g}) `}s&&(e[d]=g)}}const u=n.pathRotation;return u&&(l=!1,a+=`rotate(${_d(u,Il.pathRotation)}) `),a=a.trim(),s?a=s(e,l?"":a):l&&(a="none"),a}function gf(n,e,s){const{style:a,vars:l,transformOrigin:u}=n;let c=!1,d=!1;for(const m in e){const p=e[m];if(ba.has(m)){c=!0;continue}else if(yb(m)){l[m]=p;continue}else{const g=_d(p,Il[m]);m.startsWith("origin")?(d=!0,u[m]=g):a[m]=g}}if(e.transform||(c||s?a.transform=RE(e,n.transform,s):a.transform&&(a.transform="none")),d){const{originX:m="50%",originY:p="50%",originZ:g=0}=u;a.transformOrigin=`${m} ${p} ${g}`}}function ow(n,{style:e,vars:s},a,l){const u=n.style;let c;for(c in e)u[c]=e[c];l==null||l.applyProjectionStyles(u,a);for(c in s)u.setProperty(c,s[c])}function d0(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const pr={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(se.test(n))n=parseFloat(n);else return n;const s=d0(n,e.target.x),a=d0(n,e.target.y);return`${s}% ${a}%`}},CE={correct:(n,{treeScale:e,projectionDelta:s})=>{const a=n,l=wn.parse(n);if(l.length>5)return a;const u=wn.createTransformer(n),c=typeof l[0]!="number"?1:0,d=s.x.scale*e.x,m=s.y.scale*e.y;l[0+c]/=d,l[1+c]/=m;const p=Ve(d,m,.5);return typeof l[2+c]=="number"&&(l[2+c]/=p),typeof l[3+c]=="number"&&(l[3+c]/=p),u(l)}},Ed={borderRadius:{...pr,applyTo:[...cf]},borderTopLeftRadius:pr,borderTopRightRadius:pr,borderBottomLeftRadius:pr,borderBottomRightRadius:pr,boxShadow:CE};function lw(n,{layout:e,layoutId:s}){return ba.has(n)||n.startsWith("origin")||(e||s!==void 0)&&(!!Ed[n]||n==="opacity")}function yf(n,e,s){var c;const a=n.style,l=e==null?void 0:e.style,u={};if(!a)return u;for(const d in a)(bt(a[d])||l&&bt(l[d])||lw(d,n)||((c=s==null?void 0:s.getValue(d))==null?void 0:c.liveStyle)!==void 0)&&(u[d]=a[d]);return u}function kE(n){return window.getComputedStyle(n)}class jE extends nw{constructor(){super(...arguments),this.type="html",this.renderInstance=ow}readValueFromInstance(e,s){var a;if(ba.has(s))return(a=this.projection)!=null&&a.isProjecting?cd(s):J1(e,s);{const l=kE(e),u=(yb(s)?l.getPropertyValue(s):l[s])||0;return typeof u=="string"?u.trim():u}}measureInstanceViewportBox(e,{transformPagePoint:s}){return rw(e,s)}build(e,s,a){gf(e,s,a.transformTemplate)}scrapeMotionValuesFromProps(e,s,a){return yf(e,s,a)}}const OE={offset:"stroke-dashoffset",array:"stroke-dasharray"},NE={offset:"strokeDashoffset",array:"strokeDasharray"};function DE(n,e,s=1,a=0,l=!0){n.pathLength=1;const u=l?OE:NE;n[u.offset]=`${-a}`,n[u.array]=`${e} ${s}`}const ME=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function uw(n,{attrX:e,attrY:s,attrScale:a,pathLength:l,pathSpacing:u=1,pathOffset:c=0,...d},m,p,g){if(gf(n,d,p),m){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:v,style:w}=n;v.transform&&(w.transform=v.transform,delete v.transform),(w.transform||v.transformOrigin)&&(w.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),w.transform&&(w.transformBox=(g==null?void 0:g.transformBox)??"fill-box",delete v.transformBox);for(const x of ME)v[x]!==void 0&&(w[x]=v[x],delete v[x]);e!==void 0&&(v.x=e),s!==void 0&&(v.y=s),a!==void 0&&(v.scale=a),l!==void 0&&DE(v,l,u,c,!1)}const cw=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"]),hw=n=>typeof n=="string"&&n.toLowerCase()==="svg";function UE(n,e,s,a){ow(n,e,void 0,a);for(const l in e.attrs)n.setAttribute(cw.has(l)?l:uf(l),e.attrs[l])}function dw(n,e,s){const a=yf(n,e,s);for(const l in n)if(bt(n[l])||bt(e[l])){const u=va.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;a[u]=n[l]}return a}class BE extends nw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lt}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(ba.has(s)){const a=Kb(s);return a&&a.default||0}return s=cw.has(s)?s:uf(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,a){return dw(e,s,a)}build(e,s,a){uw(e,s,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,s,a,l){UE(e,s,a,l)}mount(e){this.isSVGTag=hw(e.tagName),super.mount(e)}}const LE=pf.length;function fw(n){if(!n)return;if(!n.isControllingVariants){const s=n.parent?fw(n.parent)||{}:{};return n.props.initial!==void 0&&(s.initial=n.props.initial),s}const e={};for(let s=0;s<LE;s++){const a=pf[s],l=n.props[a];(Nr(l)||l===!1)&&(e[a]=l)}return e}function mw(n,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==n.length)return!1;for(let a=0;a<s;a++)if(e[a]!==n[a])return!1;return!0}const zE=[...mf].reverse(),VE=mf.length;function PE(n){return e=>Promise.all(e.map(({animation:s,options:a})=>LT(n,s,a)))}function HE(n){let e=PE(n),s=f0(),a=!0,l=!1;const u=p=>(g,v)=>{var x;const w=ps(n,v,p==="exit"?(x=n.presenceContext)==null?void 0:x.custom:void 0);if(w){const{transition:S,transitionEnd:A,...k}=w;g={...g,...k,...A}}return g};function c(p){e=p(n)}function d(p){const{props:g}=n,v=fw(n.parent)||{},w=[],x=new Set;let S={},A=1/0;for(let C=0;C<VE;C++){const N=zE[C],O=s[N],P=g[N]!==void 0?g[N]:v[N],J=Nr(P),X=N===p?O.isActive:null;X===!1&&(A=C);let G=P===v[N]&&P!==g[N]&&J;if(G&&(a||l)&&n.manuallyAnimateOnMount&&(G=!1),O.protectedKeys={...S},!O.isActive&&X===null||!P&&!O.prevProp||au(P)||typeof P=="boolean")continue;if(N==="exit"&&O.isActive&&X!==!0){O.prevResolvedValues&&(S={...S,...O.prevResolvedValues});continue}const Z=$E(O.prevProp,P);let ee=Z||N===p&&O.isActive&&!G&&J||C>A&&J,ne=!1;const le=Array.isArray(P)?P:[P];let de=le.reduce(u(N),{});X===!1&&(de={});const{prevResolvedValues:je={}}=O,Re={...je,...de},ke=Y=>{ee=!0,x.has(Y)&&(ne=!0,x.delete(Y)),O.needsAnimating[Y]=!0;const I=n.getValue(Y);I&&(I.liveStyle=!1)};for(const Y in Re){const I=de[Y],oe=je[Y];if(S.hasOwnProperty(Y))continue;let E=!1;gd(I)&&gd(oe)?E=!mw(I,oe)||Z:E=I!==oe,E?I!=null?ke(Y):x.add(Y):I!==void 0&&x.has(Y)?ke(Y):O.protectedKeys[Y]=!0}O.prevProp=P,O.prevResolvedValues=de,O.isActive&&(S={...S,...de}),(a||l)&&n.blockInitialAnimation&&(ee=!1);const L=G&&Z;ee&&(!L||ne)&&w.push(...le.map(Y=>{const I={type:N};if(typeof Y=="string"&&(a||l)&&!L&&n.manuallyAnimateOnMount&&n.parent){const{parent:oe}=n,E=ps(oe,Y);if(oe.enteringChildren&&E){const{delayChildren:B}=E.transition||{};I.delay=Lb(oe.enteringChildren,n,B)}}return{animation:Y,options:I}}))}if(x.size){const C={};if(typeof g.initial!="boolean"){const N=ps(n,Array.isArray(g.initial)?g.initial[0]:g.initial);N&&N.transition&&(C.transition=N.transition)}x.forEach(N=>{const O=n.getBaseTarget(N),P=n.getValue(N);P&&(P.liveStyle=!0),C[N]=O??null}),w.push({animation:C})}let k=!!w.length;return a&&(g.initial===!1||g.initial===g.animate)&&!n.manuallyAnimateOnMount&&(k=!1),a=!1,l=!1,k?e(w):Promise.resolve()}function m(p,g){var w;if(s[p].isActive===g)return Promise.resolve();(w=n.variantChildren)==null||w.forEach(x=>{var S;return(S=x.animationState)==null?void 0:S.setActive(p,g)}),s[p].isActive=g;const v=d(p);for(const x in s)s[x].protectedKeys={};return v}return{animateChanges:d,setActive:m,setAnimateFunction:c,getState:()=>s,reset:()=>{s=f0(),l=!0}}}function $E(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!mw(e,n):!1}function as(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function f0(){return{animate:as(!0),whileInView:as(),whileHover:as(),whileTap:as(),whileDrag:as(),whileFocus:as(),exit:as()}}function Ad(n,e){n.min=e.min,n.max=e.max}function dn(n,e){Ad(n.x,e.x),Ad(n.y,e.y)}function m0(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}const pw=1e-4,qE=1-pw,IE=1+pw,gw=.01,GE=0-gw,KE=0+gw;function Et(n){return n.max-n.min}function FE(n,e,s){return Math.abs(n-e)<=s}function p0(n,e,s,a=.5){n.origin=a,n.originPoint=Ve(e.min,e.max,n.origin),n.scale=Et(s)/Et(e),n.translate=Ve(s.min,s.max,n.origin)-n.originPoint,(n.scale>=qE&&n.scale<=IE||isNaN(n.scale))&&(n.scale=1),(n.translate>=GE&&n.translate<=KE||isNaN(n.translate))&&(n.translate=0)}function Tr(n,e,s,a){p0(n.x,e.x,s.x,a?a.originX:void 0),p0(n.y,e.y,s.y,a?a.originY:void 0)}function g0(n,e,s,a=0){const l=a?Ve(s.min,s.max,a):s.min;n.min=l+e.min,n.max=n.min+Et(e)}function YE(n,e,s,a){g0(n.x,e.x,s.x,a==null?void 0:a.x),g0(n.y,e.y,s.y,a==null?void 0:a.y)}function y0(n,e,s,a=0){const l=a?Ve(s.min,s.max,a):s.min;n.min=e.min-l,n.max=n.min+Et(e)}function Fl(n,e,s,a){y0(n.x,e.x,s.x,a==null?void 0:a.x),y0(n.y,e.y,s.y,a==null?void 0:a.y)}function v0(n,e,s,a,l){return n-=e,n=Kl(n,1/s,a),l!==void 0&&(n=Kl(n,1/l,a)),n}function XE(n,e=0,s=1,a=.5,l,u=n,c=n){if(Dn.test(e)&&(e=parseFloat(e),e=Ve(c.min,c.max,e/100)-c.min),typeof e!="number")return;let d=Ve(u.min,u.max,a);n===u&&(d-=e),n.min=v0(n.min,e,s,d,l),n.max=v0(n.max,e,s,d,l)}function b0(n,e,[s,a,l],u,c){XE(n,e[s],e[a],e[l],e.scale,u,c)}const JE=["x","scaleX","originX"],QE=["y","scaleY","originY"];function w0(n,e,s,a){b0(n.x,e,JE,s?s.x:void 0,a?a.x:void 0),b0(n.y,e,QE,s?s.y:void 0,a?a.y:void 0)}function _0(n){return n.translate===0&&n.scale===1}function yw(n){return _0(n.x)&&_0(n.y)}function x0(n,e){return n.min===e.min&&n.max===e.max}function ZE(n,e){return x0(n.x,e.x)&&x0(n.y,e.y)}function S0(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function vw(n,e){return S0(n.x,e.x)&&S0(n.y,e.y)}function T0(n){return Et(n.x)/Et(n.y)}function E0(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}function kn(n){return[n("x"),n("y")]}function WE(n,e,s){let a="";const l=n.x.translate/e.x,u=n.y.translate/e.y,c=(s==null?void 0:s.z)||0;if((l||u||c)&&(a=`translate3d(${l}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:p,rotate:g,pathRotation:v,rotateX:w,rotateY:x,skewX:S,skewY:A}=s;p&&(a=`perspective(${p}px) ${a}`),g&&(a+=`rotate(${g}deg) `),v&&(a+=`rotate(${v}deg) `),w&&(a+=`rotateX(${w}deg) `),x&&(a+=`rotateY(${x}deg) `),S&&(a+=`skewX(${S}deg) `),A&&(a+=`skewY(${A}deg) `)}const d=n.x.scale*e.x,m=n.y.scale*e.y;return(d!==1||m!==1)&&(a+=`scale(${d}, ${m})`),a||"none"}const eA=cf.length,A0=n=>typeof n=="string"?parseFloat(n):n,R0=n=>typeof n=="number"||se.test(n);function tA(n,e,s,a,l,u){l?(n.opacity=Ve(0,s.opacity??1,nA(a)),n.opacityExit=Ve(e.opacity??1,0,iA(a))):u&&(n.opacity=Ve(e.opacity??1,s.opacity??1,a));for(let c=0;c<eA;c++){const d=cf[c];let m=C0(e,d),p=C0(s,d);if(m===void 0&&p===void 0)continue;m||(m=0),p||(p=0),m===0||p===0||R0(m)===R0(p)?(n[d]=Math.max(Ve(A0(m),A0(p),a),0),(Dn.test(p)||Dn.test(m))&&(n[d]+="%")):n[d]=p}(e.rotate||s.rotate)&&(n.rotate=Ve(e.rotate||0,s.rotate||0,a))}function C0(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const nA=bw(0,.5,hb),iA=bw(.5,.95,ln);function bw(n,e,s){return a=>a<n?0:a>e?1:s(jr(n,e,a))}function sA(n,e,s){const a=bt(n)?n:ga(n);return a.start(of("",a,e,s)),a.animation}function Dr(n,e,s,a={passive:!0}){return n.addEventListener(e,s,a),()=>n.removeEventListener(e,s,a)}const aA=(n,e)=>n.depth-e.depth;class rA{constructor(){this.children=[],this.isDirty=!1}add(e){Fd(this.children,e),this.isDirty=!0}remove(e){Vl(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(aA),this.isDirty=!1,this.children.forEach(e)}}function oA(n,e){const s=Tt.now(),a=({timestamp:l})=>{const u=l-s;u>=e&&(zi(a),n(u-e))};return Pe.setup(a,!0),()=>zi(a)}function Ul(n){return bt(n)?n.get():n}class lA{constructor(){this.members=[]}add(e){Fd(this.members,e);for(let s=this.members.length-1;s>=0;s--){const a=this.members[s];if(a===e||a===this.lead||a===this.prevLead)continue;const l=a.instance;(!l||l.isConnected===!1)&&!a.snapshot&&(Vl(this.members,a),a.unmount())}e.scheduleRender()}remove(e){if(Vl(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){var s;for(let a=this.members.indexOf(e)-1;a>=0;a--){const l=this.members[a];if(l.isPresent!==!1&&((s=l.instance)==null?void 0:s.isConnected)!==!1)return this.promote(l),!0}return!1}promote(e,s){var l;const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.updateSnapshot(),e.scheduleRender();const{layoutDependency:u}=a.options,{layoutDependency:c}=e.options;(u===void 0||u!==c)&&(e.resumeFrom=a,s&&(a.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),(l=e.root)!=null&&l.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var s,a,l,u,c;(a=(s=e.options).onExitComplete)==null||a.call(s),(c=(l=e.resumingFrom)==null?void 0:(u=l.options).onExitComplete)==null||c.call(u)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const Bl={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Vh=["","X","Y","Z"],uA=1e3;let cA=0;function Ph(n,e,s,a){const{latestValues:l}=e;l[n]&&(s[n]=l[n],e.setStaticValue(n,0),a&&(a[n]=0))}function ww(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const s=$b(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:l,layoutId:u}=n.options;window.MotionCancelOptimisedAnimation(s,"transform",Pe,!(l||u))}const{parent:a}=n;a&&!a.hasCheckedOptimisedAppear&&ww(a)}function _w({attachResizeListener:n,defaultParent:e,measureScroll:s,checkIsScrollRoot:a,resetTransform:l}){return class{constructor(c={},d=e==null?void 0:e()){this.id=cA++,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(fA),this.nodes.forEach(bA),this.nodes.forEach(wA),this.nodes.forEach(mA)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,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 m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new rA)}addEventListener(c,d){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Xd),this.eventHandlers.get(c).add(d)}notifyListeners(c,...d){const m=this.eventHandlers.get(c);m&&m.notify(...d)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=ff(c)&&!dE(c),this.instance=c;const{layoutId:d,layout:m,visualElement:p}=this.options;if(p&&!p.current&&p.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||d)&&(this.isLayoutDirty=!0),n){let g,v=0;const w=()=>this.root.updateBlockedByResize=!1;Pe.read(()=>{v=window.innerWidth}),n(c,()=>{const x=window.innerWidth;x!==v&&(v=x,this.root.updateBlockedByResize=!0,g&&g(),g=oA(w,250),Bl.hasAnimatedSinceResize&&(Bl.hasAnimatedSinceResize=!1,this.nodes.forEach(O0)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:v,hasRelativeLayoutChanged:w,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||p.getDefaultTransition()||EA,{onLayoutAnimationStart:A,onLayoutAnimationComplete:k}=p.getProps(),C=!this.targetLayout||!vw(this.targetLayout,x),N=!v&&w;if(this.options.layoutRoot||this.resumeFrom||N||v&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const O={...rf(S,"layout"),onPlay:A,onComplete:k};(p.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O),this.setAnimationOrigin(g,N,O.path)}else v||O0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),zi(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(_A),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ww(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const v=this.path[g];v.shouldResetTransform=!0,(typeof v.latestValues.x=="string"||typeof v.latestValues.y=="string")&&(v.isLayoutDirty=!0),v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:m}=this.options;if(d===void 0&&!m)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(gA),this.nodes.forEach(k0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(j0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yA),this.nodes.forEach(vA),this.nodes.forEach(hA),this.nodes.forEach(dA)):this.nodes.forEach(j0),this.clearAllSnapshots();const d=Tt.now();vt.delta=Mn(0,1e3/60,d-vt.timestamp),vt.timestamp=d,vt.isProcessing=!0,Oh.update.process(vt),Oh.preRender.process(vt),Oh.render.process(vt),vt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,hf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pA),this.sharedNodes.forEach(xA)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Pe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Pe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Et(this.snapshot.measuredBox.x)&&!Et(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 m=0;m<this.path.length;m++)this.path[m].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=lt()),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,c?c.layoutBox:void 0)}updateScroll(c="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(d=!1),d&&this.instance){const m=a(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!l)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!yw(this.projectionDelta),m=this.getTransformTemplate(),p=m?m(this.latestValues,""):void 0,g=p!==this.prevTransformTemplateValue;c&&this.instance&&(d||ls(this.latestValues)||g)&&(l(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const d=this.measurePageBox();let m=this.removeElementScroll(d);return c&&(m=this.removeTransform(m)),AA(m),{animationId:this.root.animationId,measuredBox:d,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var p;const{visualElement:c}=this.options;if(!c)return lt();const d=c.measureViewportBox();if(!(((p=this.scroll)==null?void 0:p.wasRoot)||this.path.some(RA))){const{scroll:g}=this.root;g&&(On(d.x,g.offset.x),On(d.y,g.offset.y))}return d}removeElementScroll(c){var m;const d=lt();if(dn(d,c),(m=this.scroll)!=null&&m.wasRoot)return d;for(let p=0;p<this.path.length;p++){const g=this.path[p],{scroll:v,options:w}=g;g!==this.root&&v&&w.layoutScroll&&(v.wasRoot&&dn(d,c),On(d.x,v.offset.x),On(d.y,v.offset.y))}return d}applyTransform(c,d=!1,m){var g,v;const p=m||lt();dn(p,c);for(let w=0;w<this.path.length;w++){const x=this.path[w];!d&&x.options.layoutScroll&&x.scroll&&x!==x.root&&(On(p.x,-x.scroll.offset.x),On(p.y,-x.scroll.offset.y)),ls(x.latestValues)&&Ml(p,x.latestValues,(g=x.layout)==null?void 0:g.layoutBox)}return ls(this.latestValues)&&Ml(p,this.latestValues,(v=this.layout)==null?void 0:v.layoutBox),p}removeTransform(c){var m;const d=lt();dn(d,c);for(let p=0;p<this.path.length;p++){const g=this.path[p];if(!ls(g.latestValues))continue;let v;g.instance&&(Sd(g.latestValues)&&g.updateSnapshot(),v=lt(),dn(v,g.measurePageBox())),w0(d,g.latestValues,(m=g.snapshot)==null?void 0:m.layoutBox,v)}return ls(this.latestValues)&&w0(d,this.latestValues),d}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.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!==vt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){var x;const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==d;if(!(c||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:v}=this.options;if(!this.layout||!(g||v))return;this.resolvedRelativeTargetAt=vt.timestamp;const w=this.getClosestProjectingParent();w&&this.linkedParentVersion!==w.layoutVersion&&!w.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&w&&w.layout?this.createRelativeTarget(w,this.layout.layoutBox,w.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=lt(),this.targetWithTransforms=lt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),YE(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):dn(this.target,this.layout.layoutBox),aw(this.target,this.targetDelta)):dn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?this.createRelativeTarget(w,this.target,w.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Sd(this.parent.latestValues)||sw(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,d,m){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lt(),this.relativeTargetOrigin=lt(),Fl(this.relativeTargetOrigin,d,m,this.options.layoutAnchor||void 0),dn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var S;const c=this.getLead(),d=!!this.resumingFrom||this!==c;let m=!0;if((this.isProjectionDirty||(S=this.parent)!=null&&S.isProjectionDirty)&&(m=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===vt.timestamp&&(m=!1),m)return;const{layout:p,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||g))return;dn(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,w=this.treeScale.y;SE(this.layoutCorrected,this.treeScale,this.path,d),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=lt());const{target:x}=c;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(m0(this.prevProjectionDelta.x,this.projectionDelta.x),m0(this.prevProjectionDelta.y,this.projectionDelta.y)),Tr(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==w||!E0(this.projectionDelta.x,this.prevProjectionDelta.x)||!E0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){var d;if((d=this.options.visualElement)==null||d.scheduleRender(),c){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ha(),this.projectionDelta=ha(),this.projectionDeltaWithTransform=ha()}setAnimationOrigin(c,d=!1,m){const p=this.snapshot,g=p?p.latestValues:{},v={...this.latestValues},w=ha();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const x=lt(),S=p?p.source:void 0,A=this.layout?this.layout.source:void 0,k=S!==A,C=this.getStack(),N=!C||C.members.length<=1,O=!!(k&&!N&&this.options.crossfade===!0&&!this.path.some(TA));this.animationProgress=0;let P;const J=m==null?void 0:m.interpolateProjection(c);this.mixTargetDelta=X=>{const G=X/1e3,Z=J==null?void 0:J(G);Z?(w.x.translate=Z.x,w.x.scale=Ve(c.x.scale,1,G),w.x.origin=c.x.origin,w.x.originPoint=c.x.originPoint,w.y.translate=Z.y,w.y.scale=Ve(c.y.scale,1,G),w.y.origin=c.y.origin,w.y.originPoint=c.y.originPoint):(N0(w.x,c.x,G),N0(w.y,c.y,G)),this.setTargetDelta(w),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fl(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),SA(this.relativeTarget,this.relativeTargetOrigin,x,G),P&&ZE(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=lt()),dn(P,this.relativeTarget)),k&&(this.animationValues=v,tA(v,g,this.latestValues,G,O,N)),Z&&Z.rotate!==void 0&&(this.animationValues||(this.animationValues=v),this.animationValues.pathRotation=Z.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=G},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){var d,m,p;this.notifyListeners("animationStart"),(d=this.currentAnimation)==null||d.stop(),(p=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||p.stop(),this.pendingAnimation&&(zi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Pe.update(()=>{Bl.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ga(0)),this.motionValue.jump(0,!1),this.currentAnimation=sA(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:g=>{this.mixTargetDelta(g),c.onUpdate&&c.onUpdate(g)},onComplete:()=>{c.onComplete&&c.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 c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(uA),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:d,target:m,layout:p,latestValues:g}=c;if(!(!d||!m||!p)){if(this!==c&&this.layout&&p&&xw(this.options.animationType,this.layout.layoutBox,p.layoutBox)){m=this.target||lt();const v=Et(this.layout.layoutBox.x);m.x.min=c.target.x.min,m.x.max=m.x.min+v;const w=Et(this.layout.layoutBox.y);m.y.min=c.target.y.min,m.y.max=m.y.min+w}dn(d,m),Ml(d,g),Tr(this.projectionDeltaWithTransform,this.layoutCorrected,d,g)}}registerSharedNode(c,d){this.sharedNodes.has(c)||this.sharedNodes.set(c,new lA),this.sharedNodes.get(c).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){var d;const{layoutId:c}=this.options;return c?((d=this.getStack())==null?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:c}=this.options;return c?(d=this.getStack())==null?void 0:d.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:d,preserveFollowOpacity:m}={}){const p=this.getStack();p&&p.promote(this,m),c&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let d=!1;const{latestValues:m}=c;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(d=!0),!d)return;const p={};m.z&&Ph("z",c,p,this.animationValues);for(let g=0;g<Vh.length;g++)Ph(`rotate${Vh[g]}`,c,p,this.animationValues),Ph(`skew${Vh[g]}`,c,p,this.animationValues);c.render();for(const g in p)c.setStaticValue(g,p[g]),this.animationValues&&(this.animationValues[g]=p[g]);c.scheduleRender()}applyProjectionStyles(c,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Ul(d==null?void 0:d.pointerEvents)||"",c.transform=m?m(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Ul(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!ls(this.latestValues)&&(c.transform=m?m({},""):"none",this.hasProjected=!1);return}c.visibility="";const g=p.animationValues||p.latestValues;this.applyTransformsToTarget();let v=WE(this.projectionDeltaWithTransform,this.treeScale,g);m&&(v=m(g,v)),c.transform=v;const{x:w,y:x}=this.projectionDelta;c.transformOrigin=`${w.origin*100}% ${x.origin*100}% 0`,p.animationValues?c.opacity=p===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:c.opacity=p===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const S in Ed){if(g[S]===void 0)continue;const{correct:A,applyTo:k,isCSSVariable:C}=Ed[S],N=v==="none"?g[S]:A(g[S],p);if(k){const O=k.length;for(let P=0;P<O;P++)c[k[P]]=N}else C?this.options.visualElement.renderState.vars[S]=N:c[S]=N}this.options.layoutId&&(c.pointerEvents=p===this?Ul(d==null?void 0:d.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>{var d;return(d=c.currentAnimation)==null?void 0:d.stop()}),this.root.nodes.forEach(k0),this.root.sharedNodes.clear()}}}function hA(n){n.updateLayout()}function dA(n){var s;const e=((s=n.resumeFrom)==null?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:l}=n.layout,{animationType:u}=n.options,c=e.source!==n.layout.source;if(u==="size")kn(v=>{const w=c?e.measuredBox[v]:e.layoutBox[v],x=Et(w);w.min=a[v].min,w.max=w.min+x});else if(u==="x"||u==="y"){const v=u==="x"?"y":"x";Ad(c?e.measuredBox[v]:e.layoutBox[v],a[v])}else xw(u,e.layoutBox,a)&&kn(v=>{const w=c?e.measuredBox[v]:e.layoutBox[v],x=Et(a[v]);w.max=w.min+x,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[v].max=n.relativeTarget[v].min+x)});const d=ha();Tr(d,a,e.layoutBox);const m=ha();c?Tr(m,n.applyTransform(l,!0),e.measuredBox):Tr(m,a,e.layoutBox);const p=!yw(d);let g=!1;if(!n.resumeFrom){const v=n.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:w,layout:x}=v;if(w&&x){const S=n.options.layoutAnchor||void 0,A=lt();Fl(A,e.layoutBox,w.layoutBox,S);const k=lt();Fl(k,a,x.layoutBox,S),vw(A,k)||(g=!0),v.options.layoutRoot&&(n.relativeTarget=k,n.relativeTargetOrigin=A,n.relativeParent=v)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:m,layoutDelta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:g})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function fA(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function mA(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function pA(n){n.clearSnapshot()}function k0(n){n.clearMeasurements()}function gA(n){n.isLayoutDirty=!0,n.updateLayout()}function j0(n){n.isLayoutDirty=!1}function yA(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function vA(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function O0(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function bA(n){n.resolveTargetDelta()}function wA(n){n.calcProjection()}function _A(n){n.resetSkewAndRotation()}function xA(n){n.removeLeadSnapshot()}function N0(n,e,s){n.translate=Ve(e.translate,0,s),n.scale=Ve(e.scale,1,s),n.origin=e.origin,n.originPoint=e.originPoint}function D0(n,e,s,a){n.min=Ve(e.min,s.min,a),n.max=Ve(e.max,s.max,a)}function SA(n,e,s,a){D0(n.x,e.x,s.x,a),D0(n.y,e.y,s.y,a)}function TA(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const EA={duration:.45,ease:[.4,0,.1,1]},M0=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),U0=M0("applewebkit/")&&!M0("chrome/")?Math.round:ln;function B0(n){n.min=U0(n.min),n.max=U0(n.max)}function AA(n){B0(n.x),B0(n.y)}function xw(n,e,s){return n==="position"||n==="preserve-aspect"&&!FE(T0(e),T0(s),.2)}function RA(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const CA=_w({attachResizeListener:(n,e)=>Dr(n,"resize",e),measureScroll:()=>{var n,e;return{x:document.documentElement.scrollLeft||((n=document.body)==null?void 0:n.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Hh={current:void 0},Sw=_w({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Hh.current){const n=new CA({});n.mount(window),n.setOptions({layoutScroll:!0}),Hh.current=n}return Hh.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),vf=V.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function L0(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function kA(...n){return e=>{let s=!1;const a=n.map(l=>{const u=L0(l,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let l=0;l<a.length;l++){const u=a[l];typeof u=="function"?u():L0(n[l],null)}}}}function jA(...n){return V.useCallback(kA(...n),n)}class OA extends V.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(jl(s)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=s.offsetParent,l=jl(a)&&a.offsetWidth||0,u=jl(a)&&a.offsetHeight||0,c=getComputedStyle(s),d=this.props.sizeRef.current;d.height=parseFloat(c.height),d.width=parseFloat(c.width),d.top=s.offsetTop,d.left=s.offsetLeft,d.right=l-d.width-d.left,d.bottom=u-d.height-d.top,d.direction=c.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function NA({children:n,isPresent:e,anchorX:s,anchorY:a,root:l,pop:u}){var w;const c=V.useId(),d=V.useRef(null),m=V.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:p}=V.useContext(vf),g=((w=n.props)==null?void 0:w.ref)??(n==null?void 0:n.ref),v=jA(d,g);return V.useInsertionEffect(()=>{const{width:x,height:S,top:A,left:k,right:C,bottom:N,direction:O}=m.current;if(e||u===!1||!d.current||!x||!S)return;const P=O==="rtl",J=s==="left"?P?`right: ${C}`:`left: ${k}`:P?`left: ${k}`:`right: ${C}`,X=a==="bottom"?`bottom: ${N}`:`top: ${A}`;d.current.dataset.motionPopId=c;const G=document.createElement("style");p&&(G.nonce=p);const Z=l??document.head;return Z.appendChild(G),G.sheet&&G.sheet.insertRule(`
[data-motion-pop-id="${c}"] {
position: absolute !important;
width: ${x}px !important;
height: ${S}px !important;
${J}px !important;
${X}px !important;
}
`),()=>{var ee;(ee=d.current)==null||ee.removeAttribute("data-motion-pop-id"),Z.contains(G)&&Z.removeChild(G)}},[e]),b.jsx(OA,{isPresent:e,childRef:d,sizeRef:m,pop:u,children:u===!1?n:V.cloneElement(n,{ref:v})})}const DA=({children:n,initial:e,isPresent:s,onExitComplete:a,custom:l,presenceAffectsLayout:u,mode:c,anchorX:d,anchorY:m,root:p})=>{const g=Gd(MA),v=V.useId(),w=V.useRef(s),x=V.useRef(a);Kd(()=>{w.current=s,x.current=a});let S=!0,A=V.useMemo(()=>(S=!1,{id:v,initial:e,isPresent:s,custom:l,onExitComplete:k=>{g.set(k,!0);for(const C of g.values())if(!C)return;a&&a()},register:k=>(g.set(k,!1),()=>{var C;g.delete(k),!w.current&&!g.size&&((C=x.current)==null||C.call(x))})}),[s,g,a]);return u&&S&&(A={...A}),V.useMemo(()=>{g.forEach((k,C)=>g.set(C,!1))},[s]),V.useEffect(()=>{!s&&!g.size&&a&&a()},[s]),n=b.jsx(NA,{pop:c==="popLayout",isPresent:s,anchorX:d,anchorY:m,root:p,children:n}),b.jsx(iu.Provider,{value:A,children:n})};function MA(){return new Map}function Tw(n=!0){const e=V.useContext(iu);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:a,register:l}=e,u=V.useId();V.useEffect(()=>{if(n)return l(u)},[n]);const c=V.useCallback(()=>n&&a&&a(u),[u,a,n]);return!s&&a?[!1,c]:[!0]}const gl=n=>n.key||"";function z0(n){const e=[];return V.Children.forEach(n,s=>{V.isValidElement(s)&&e.push(s)}),e}const cs=({children:n,custom:e,initial:s=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:u="sync",propagate:c=!1,anchorX:d="left",anchorY:m="top",root:p})=>{const[g,v]=Tw(c),w=V.useMemo(()=>z0(n),[n]),x=c&&!g?[]:w.map(gl),S=V.useRef(!0),A=V.useRef(w),k=Gd(()=>new Map),C=V.useRef(new Set),[N,O]=V.useState(w),[P,J]=V.useState(w);Kd(()=>{S.current=!1,A.current=w;for(let Z=0;Z<P.length;Z++){const ee=gl(P[Z]);x.includes(ee)?(k.delete(ee),C.current.delete(ee)):k.get(ee)!==!0&&k.set(ee,!1)}},[P,x.length,x.join("-")]);const X=[];if(w!==N){let Z=[...w];for(let ee=0;ee<P.length;ee++){const ne=P[ee],le=gl(ne);x.includes(le)||(Z.splice(ee,0,ne),X.push(ne))}return u==="wait"&&X.length&&(Z=X),J(z0(Z)),O(w),null}const{forceRender:G}=V.useContext(Id);return b.jsx(b.Fragment,{children:P.map(Z=>{const ee=gl(Z),ne=c&&!g?!1:w===P||x.includes(ee),le=()=>{if(C.current.has(ee))return;if(k.has(ee))C.current.add(ee),k.set(ee,!0);else return;let de=!0;k.forEach(je=>{je||(de=!1)}),de&&(G==null||G(),J(A.current),c&&(v==null||v()),a&&a())};return b.jsx(DA,{isPresent:ne,initial:!S.current||s?void 0:!1,custom:e,presenceAffectsLayout:l,mode:u,root:p,onExitComplete:ne?void 0:le,anchorX:d,anchorY:m,children:Z},ee)})})},Ew=V.createContext({strict:!1}),V0={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 P0=!1;function UA(){if(P0)return;const n={};for(const e in V0)n[e]={isEnabled:s=>V0[e].some(a=>!!s[a])};tw(n),P0=!0}function Aw(){return UA(),bE()}function BA(n){const e=Aw();for(const s in n)e[s]={...e[s],...n[s]};tw(e)}const LA=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","propagate","ignoreStrict","viewport"]);function Yl(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||LA.has(n)}let Rw=n=>!Yl(n);function zA(n){typeof n=="function"&&(Rw=e=>e.startsWith("on")?!Yl(e):n(e))}try{zA(require("@emotion/is-prop-valid").default)}catch{}function VA(n,e,s){const a={};for(const l in n)l==="values"&&typeof n.values=="object"||bt(n[l])||(Rw(l)||s===!0&&Yl(l)||!e&&!Yl(l)||n.draggable&&l.startsWith("onDrag"))&&(a[l]=n[l]);return a}const ou=V.createContext({});function PA(n,e){if(ru(n)){const{initial:s,animate:a}=n;return{initial:s===!1||Nr(s)?s:void 0,animate:Nr(a)?a:void 0}}return n.inherit!==!1?e:{}}function HA(n){const{initial:e,animate:s}=PA(n,V.useContext(ou));return V.useMemo(()=>({initial:e,animate:s}),[H0(e),H0(s)])}function H0(n){return Array.isArray(n)?n.join(" "):n}const bf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Cw(n,e,s){for(const a in e)!bt(e[a])&&!lw(a,s)&&(n[a]=e[a])}function $A({transformTemplate:n},e){return V.useMemo(()=>{const s=bf();return gf(s,e,n),Object.assign({},s.vars,s.style)},[e])}function qA(n,e){const s=n.style||{},a={};return Cw(a,s,n),Object.assign(a,$A(n,e)),a}function IA(n,e){const s={},a=qA(n,e);return n.drag&&n.dragListener!==!1&&(s.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(s.tabIndex=0),s.style=a,s}const kw=()=>({...bf(),attrs:{}});function GA(n,e,s,a){const l=V.useMemo(()=>{const u=kw();return uw(u,e,hw(a),n.transformTemplate,n.style),{...u.attrs,style:{...u.style}}},[e]);if(n.style){const u={};Cw(u,n.style,n),l.style={...u,...l.style}}return l}const KA=["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 wf(n){return typeof n!="string"||n.includes("-")?!1:!!(KA.indexOf(n)>-1||/[A-Z]/u.test(n))}function FA(n,e,s,{latestValues:a},l,u=!1,c){const m=(c??wf(n)?GA:IA)(e,a,l,n),p=VA(e,typeof n=="string",u),g=n!==V.Fragment?{...p,...m,ref:s}:{},{children:v}=e,w=V.useMemo(()=>bt(v)?v.get():v,[v]);return V.createElement(n,{...g,children:w})}function YA({scrapeMotionValuesFromProps:n,createRenderState:e},s,a,l){return{latestValues:XA(s,a,l,n),renderState:e()}}function XA(n,e,s,a){const l={},u=a(n,{});for(const w in u)l[w]=Ul(u[w]);let{initial:c,animate:d}=n;const m=ru(n),p=Wb(n);e&&p&&!m&&n.inherit!==!1&&(c===void 0&&(c=e.initial),d===void 0&&(d=e.animate));let g=s?s.initial===!1:!1;g=g||c===!1;const v=g?d:c;if(v&&typeof v!="boolean"&&!au(v)){const w=Array.isArray(v)?v:[v];for(let x=0;x<w.length;x++){const S=lf(n,w[x]);if(S){const{transitionEnd:A,transition:k,...C}=S;for(const N in C){let O=C[N];if(Array.isArray(O)){const P=g?O.length-1:0;O=O[P]}O!==null&&(l[N]=O)}for(const N in A)l[N]=A[N]}}}return l}const jw=n=>(e,s)=>{const a=V.useContext(ou),l=V.useContext(iu),u=()=>YA(n,e,a,l);return s?u():Gd(u)},JA=jw({scrapeMotionValuesFromProps:yf,createRenderState:bf}),QA=jw({scrapeMotionValuesFromProps:dw,createRenderState:kw}),ZA=Symbol.for("motionComponentSymbol");function WA(n,e,s){const a=V.useRef(s);V.useInsertionEffect(()=>{a.current=s});const l=V.useRef(null);return V.useCallback(u=>{var d;u&&((d=n.onMount)==null||d.call(n,u)),e&&(u?e.mount(u):e.unmount());const c=a.current;if(typeof c=="function")if(u){const m=c(u);typeof m=="function"&&(l.current=m)}else l.current?(l.current(),l.current=null):c(u);else c&&(c.current=u)},[e])}const Ow=V.createContext({});function aa(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function e2(n,e,s,a,l,u){var O,P;const{visualElement:c}=V.useContext(ou),d=V.useContext(Ew),m=V.useContext(iu),p=V.useContext(vf),g=p.reducedMotion,v=p.skipAnimations,w=V.useRef(null),x=V.useRef(!1);a=a||d.renderer,!w.current&&a&&(w.current=a(n,{visualState:e,parent:c,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:g,skipAnimations:v,isSVG:u}),x.current&&w.current&&(w.current.manuallyAnimateOnMount=!0));const S=w.current,A=V.useContext(Ow);S&&!S.projection&&l&&(S.type==="html"||S.type==="svg")&&t2(w.current,s,l,A);const k=V.useRef(!1);V.useInsertionEffect(()=>{S&&k.current&&S.update(s,m)});const C=s[Hb],N=V.useRef(!!C&&typeof window<"u"&&!((O=window.MotionHandoffIsComplete)!=null&&O.call(window,C))&&((P=window.MotionHasOptimisedAnimation)==null?void 0:P.call(window,C)));return Kd(()=>{x.current=!0,S&&(k.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),N.current&&S.animationState&&S.animationState.animateChanges())}),V.useEffect(()=>{S&&(!N.current&&S.animationState&&S.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var J;(J=window.MotionHandoffMarkAsComplete)==null||J.call(window,C)}),N.current=!1),S.enteringChildren=void 0)}),S}function t2(n,e,s,a){const{layoutId:l,layout:u,drag:c,dragConstraints:d,layoutScroll:m,layoutRoot:p,layoutAnchor:g,layoutCrossfade:v}=e;n.projection=new s(n.latestValues,e["data-framer-portal-id"]?void 0:Nw(n.parent)),n.projection.setOptions({layoutId:l,layout:u,alwaysMeasureLayout:!!c||d&&aa(d),visualElement:n,animationType:typeof u=="string"?u:"both",initialPromotionConfig:a,crossfade:v,layoutScroll:m,layoutRoot:p,layoutAnchor:g})}function Nw(n){if(n)return n.options.allowProjection!==!1?n.projection:Nw(n.parent)}function $h(n,{forwardMotionProps:e=!1,type:s}={},a,l){a&&BA(a);const u=s?s==="svg":wf(n),c=u?QA:JA;function d(p,g){let v;const w={...V.useContext(vf),...p,layoutId:n2(p)},{isStatic:x}=w,S=HA(p),A=c(p,x);if(!x&&typeof window<"u"){i2();const k=s2(w);v=k.MeasureLayout,S.visualElement=e2(n,A,w,l,k.ProjectionNode,u)}return b.jsxs(ou.Provider,{value:S,children:[v&&S.visualElement?b.jsx(v,{visualElement:S.visualElement,...w}):null,FA(n,p,WA(A,S.visualElement,g),A,x,e,u)]})}d.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const m=V.forwardRef(d);return m[ZA]=n,m}function n2({layoutId:n}){const e=V.useContext(Id).id;return e&&n!==void 0?e+"-"+n:n}function i2(n,e){V.useContext(Ew).strict}function s2(n){const e=Aw(),{drag:s,layout:a}=e;if(!s&&!a)return{};const l={...s,...a};return{MeasureLayout:s!=null&&s.isEnabled(n)||a!=null&&a.isEnabled(n)?l.MeasureLayout:void 0,ProjectionNode:l.ProjectionNode}}function a2(n,e){if(typeof Proxy>"u")return $h;const s=new Map,a=(u,c)=>$h(u,c,n,e),l=(u,c)=>a(u,c);return new Proxy(l,{get:(u,c)=>c==="create"?a:(s.has(c)||s.set(c,$h(c,void 0,n,e)),s.get(c))})}const r2=(n,e)=>e.isSVG??wf(n)?new BE(e):new jE(e,{allowProjection:n!==V.Fragment});class o2 extends Vi{constructor(e){super(e),e.animationState||(e.animationState=HE(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();au(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let l2=0;class u2 extends Vi{constructor(){super(...arguments),this.id=l2++,this.isExitComplete=!1}update(){var u;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;if(e&&a===!1){if(this.isExitComplete){const{initial:c,custom:d}=this.node.getProps();if(typeof c=="string"||typeof c=="object"&&c!==null&&!Array.isArray(c)){const m=ps(this.node,c,d);if(m){const{transition:p,transitionEnd:g,...v}=m;for(const w in v)(u=this.node.getValue(w))==null||u.jump(v[w])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const l=this.node.animationState.setActive("exit",!e);s&&!e&&l.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:e,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const c2={animation:{Feature:o2},exit:{Feature:u2}};function Kr(n){return{point:{x:n.pageX,y:n.pageY}}}const h2=n=>e=>df(e)&&n(e,Kr(e));function Er(n,e,s,a){return Dr(n,e,h2(s),a)}const Dw=({current:n})=>n?n.ownerDocument.defaultView:null,$0=(n,e)=>Math.abs(n-e);function d2(n,e){const s=$0(n.x,e.x),a=$0(n.y,e.y);return Math.sqrt(s**2+a**2)}const q0=new Set(["auto","scroll"]);class Mw{constructor(e,s,{transformPagePoint:a,contextWindow:l=window,dragSnapToOrigin:u=!1,distanceThreshold:c=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=S=>{this.handleScroll(S.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=yl(this.lastRawMoveEventInfo,this.transformPagePoint));const S=qh(this.lastMoveEventInfo,this.history),A=this.startEvent!==null,k=d2(S.offset,{x:0,y:0})>=this.distanceThreshold;if(!A&&!k)return;const{point:C}=S,{timestamp:N}=vt;this.history.push({...C,timestamp:N});const{onStart:O,onMove:P}=this.handlers;A||(O&&O(this.lastMoveEvent,S),this.startEvent=this.lastMoveEvent),P&&P(this.lastMoveEvent,S)},this.handlePointerMove=(S,A)=>{this.lastMoveEvent=S,this.lastRawMoveEventInfo=A,this.lastMoveEventInfo=yl(A,this.transformPagePoint),Pe.update(this.updatePoint,!0)},this.handlePointerUp=(S,A)=>{this.end();const{onEnd:k,onSessionEnd:C,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const O=qh(S.type==="pointercancel"?this.lastMoveEventInfo:yl(A,this.transformPagePoint),this.history);this.startEvent&&k&&k(S,O),C&&C(S,O)},!df(e))return;this.dragSnapToOrigin=u,this.handlers=s,this.transformPagePoint=a,this.distanceThreshold=c,this.contextWindow=l||window;const m=Kr(e),p=yl(m,this.transformPagePoint),{point:g}=p,{timestamp:v}=vt;this.history=[{...g,timestamp:v}];const{onSessionStart:w}=s;w&&w(e,qh(p,this.history));const x={passive:!0,capture:!0};this.removeListeners=qr(Er(this.contextWindow,"pointermove",this.handlePointerMove,x),Er(this.contextWindow,"pointerup",this.handlePointerUp,x),Er(this.contextWindow,"pointercancel",this.handlePointerUp,x)),d&&this.startScrollTracking(d)}startScrollTracking(e){let s=e.parentElement;for(;s;){const a=getComputedStyle(s);(q0.has(a.overflowX)||q0.has(a.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const s=this.scrollPositions.get(e);if(!s)return;const a=e===window,l=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},u={x:l.x-s.x,y:l.y-s.y};u.x===0&&u.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=u.x,this.lastMoveEventInfo.point.y+=u.y):this.history.length>0&&(this.history[0].x-=u.x,this.history[0].y-=u.y),this.scrollPositions.set(e,l),Pe.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),zi(this.updatePoint)}}function yl(n,e){return e?{point:e(n.point)}:n}function I0(n,e){return{x:n.x-e.x,y:n.y-e.y}}function qh({point:n},e){return{point:n,delta:I0(n,Uw(e)),offset:I0(n,f2(e)),velocity:m2(e,.1)}}function f2(n){return n[0]}function Uw(n){return n[n.length-1]}function m2(n,e){if(n.length<2)return{x:0,y:0};let s=n.length-1,a=null;const l=Uw(n);for(;s>=0&&(a=n[s],!(l.timestamp-a.timestamp>Ft(e)));)s--;if(!a)return{x:0,y:0};a===n[0]&&n.length>2&&l.timestamp-a.timestamp>Ft(e)*2&&(a=n[1]);const u=on(l.timestamp-a.timestamp);if(u===0)return{x:0,y:0};const c={x:(l.x-a.x)/u,y:(l.y-a.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function p2(n,{min:e,max:s},a){return e!==void 0&&n<e?n=a?Ve(e,n,a.min):Math.max(n,e):s!==void 0&&n>s&&(n=a?Ve(s,n,a.max):Math.min(n,s)),n}function G0(n,e,s){return{min:e!==void 0?n.min+e:void 0,max:s!==void 0?n.max+s-(n.max-n.min):void 0}}function g2(n,{top:e,left:s,bottom:a,right:l}){return{x:G0(n.x,s,l),y:G0(n.y,e,a)}}function K0(n,e){let s=e.min-n.min,a=e.max-n.max;return e.max-e.min<n.max-n.min&&([s,a]=[a,s]),{min:s,max:a}}function y2(n,e){return{x:K0(n.x,e.x),y:K0(n.y,e.y)}}function v2(n,e){let s=.5;const a=Et(n),l=Et(e);return l>a?s=jr(e.min,e.max-a,n.min):a>l&&(s=jr(n.min,n.max-l,e.min)),Mn(0,1,s)}function b2(n,e){const s={};return e.min!==void 0&&(s.min=e.min-n.min),e.max!==void 0&&(s.max=e.max-n.min),s}const Rd=.35;function w2(n=Rd){return n===!1?n=0:n===!0&&(n=Rd),{x:F0(n,"left","right"),y:F0(n,"top","bottom")}}function F0(n,e,s){return{min:Y0(n,e),max:Y0(n,s)}}function Y0(n,e){return typeof n=="number"?n:n[e]||0}const _2=new WeakMap;class x2{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:s=!1,distanceThreshold:a}={}){const{presenceContext:l}=this.visualElement;if(l&&l.isPresent===!1)return;const u=v=>{s&&this.snapToCursor(Kr(v).point),this.stopAnimation()},c=(v,w)=>{const{drag:x,dragPropagation:S,onDragStart:A}=this.getProps();if(x&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XT(x),!this.openDragLock))return;this.latestPointerEvent=v,this.latestPanInfo=w,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),kn(C=>{let N=this.getAxisMotionValue(C).get()||0;if(Dn.test(N)){const{projection:O}=this.visualElement;if(O&&O.layout){const P=O.layout.layoutBox[C];P&&(N=Et(P)*(parseFloat(N)/100))}}this.originPoint[C]=N}),A&&Pe.update(()=>A(v,w),!1,!0),yd(this.visualElement,"transform");const{animationState:k}=this.visualElement;k&&k.setActive("whileDrag",!0)},d=(v,w)=>{this.latestPointerEvent=v,this.latestPanInfo=w;const{dragPropagation:x,dragDirectionLock:S,onDirectionLock:A,onDrag:k}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:C}=w;if(S&&this.currentDirection===null){this.currentDirection=T2(C),this.currentDirection!==null&&A&&A(this.currentDirection);return}this.updateAxis("x",w.point,C),this.updateAxis("y",w.point,C),this.visualElement.render(),k&&Pe.update(()=>k(v,w),!1,!0)},m=(v,w)=>{this.latestPointerEvent=v,this.latestPanInfo=w,this.stop(v,w),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:v}=this.getProps();(v||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:g}=this.getProps();this.panSession=new Mw(e,{onSessionStart:u,onStart:c,onMove:d,onSessionEnd:m,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:Dw(this.visualElement),element:this.visualElement.current})}stop(e,s){const a=e||this.latestPointerEvent,l=s||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!l||!a)return;const{velocity:c}=l;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&Pe.postRender(()=>d(a,l))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,s,a){const{drag:l}=this.getProps();if(!a||!vl(e,l,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(c=p2(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){var u;const{dragConstraints:e,dragElastic:s}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(u=this.visualElement.projection)==null?void 0:u.layout,l=this.constraints;e&&aa(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=g2(a.layoutBox,e):this.constraints=!1,this.elastic=w2(s),l!==this.constraints&&!aa(e)&&a&&this.constraints&&!this.hasMutatedConstraints&&kn(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=b2(a.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!aa(e))return!1;const a=e.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;l.root&&(l.root.scroll=void 0,l.root.updateScroll());const u=TE(a,l.root,this.visualElement.getTransformPagePoint());let c=y2(l.layout.layoutBox,u);if(s){const d=s(_E(c));this.hasMutatedConstraints=!!d,d&&(c=iw(d))}return c}startAnimation(e){const{drag:s,dragMomentum:a,dragElastic:l,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:d}=this.getProps(),m=this.constraints||{},p=kn(g=>{if(!vl(g,s,this.currentDirection))return;let v=m&&m[g]||{};(c===!0||c===g)&&(v={min:0,max:0});const w=l?200:1e6,x=l?40:1e7,S={type:"inertia",velocity:a?e[g]:0,bounceStiffness:w,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...u,...v};return this.startAxisValueAnimation(g,S)});return Promise.all(p).then(d)}startAxisValueAnimation(e,s){const a=this.getAxisMotionValue(e);return yd(this.visualElement,e),a.start(of(e,a,0,s,this.visualElement,!1))}stopAnimation(){kn(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,l=this.visualElement.getProps()[s];return l||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){kn(s=>{const{drag:a}=this.getProps();if(!vl(s,a,this.currentDirection))return;const{projection:l}=this.visualElement,u=this.getAxisMotionValue(s);if(l&&l.layout){const{min:c,max:d}=l.layout.layoutBox[s],m=u.get()||0;u.set(e[s]-Ve(c,d,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:a}=this.visualElement;if(!aa(s)||!a||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};kn(c=>{const d=this.getAxisMotionValue(c);if(d&&this.constraints!==!1){const m=d.get();l[c]=v2({min:m,max:m},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),kn(c=>{if(!vl(c,e,null))return;const d=this.getAxisMotionValue(c),{min:m,max:p}=this.constraints[c];d.set(Ve(m,p,l[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_2.set(this.visualElement,this);const e=this.visualElement.current,s=Er(e,"pointerdown",p=>{const{drag:g,dragListener:v=!0}=this.getProps(),w=p.target,x=w!==e&&tE(w);g&&v&&!x&&this.start(p)});let a;const l=()=>{const{dragConstraints:p}=this.getProps();aa(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),a||(a=S2(e,p.current,()=>this.scalePositionWithinConstraints())))},{projection:u}=this.visualElement,c=u.addEventListener("measure",l);u&&!u.layout&&(u.root&&u.root.updateScroll(),u.updateLayout()),Pe.read(l);const d=Dr(window,"resize",()=>this.scalePositionWithinConstraints()),m=u.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:g})=>{this.isDragging&&g&&(kn(v=>{const w=this.getAxisMotionValue(v);w&&(this.originPoint[v]+=p[v].translate,w.set(w.get()+p[v].translate))}),this.visualElement.render())}));return()=>{d(),s(),c(),m&&m(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:a=!1,dragPropagation:l=!1,dragConstraints:u=!1,dragElastic:c=Rd,dragMomentum:d=!0}=e;return{...e,drag:s,dragDirectionLock:a,dragPropagation:l,dragConstraints:u,dragElastic:c,dragMomentum:d}}}function X0(n){let e=!0;return()=>{if(e){e=!1;return}n()}}function S2(n,e,s){const a=n0(n,X0(s)),l=n0(e,X0(s));return()=>{a(),l()}}function vl(n,e,s){return(e===!0||e===n)&&(s===null||s===n)}function T2(n,e=10){let s=null;return Math.abs(n.y)>e?s="y":Math.abs(n.x)>e&&(s="x"),s}class E2 extends Vi{constructor(e){super(e),this.removeGroupControls=ln,this.removeListeners=ln,this.controls=new x2(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ln}update(){const{dragControls:e}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};e!==s&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Ih=n=>(e,s)=>{n&&Pe.update(()=>n(e,s),!1,!0)};class A2 extends Vi{constructor(){super(...arguments),this.removePointerDownListener=ln}onPointerDown(e){this.session=new Mw(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Dw(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:a,onPanEnd:l}=this.node.getProps();return{onSessionStart:Ih(e),onStart:Ih(s),onMove:Ih(a),onEnd:(u,c)=>{delete this.session,l&&Pe.postRender(()=>l(u,c))}}}mount(){this.removePointerDownListener=Er(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Gh=!1;class R2 extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:a,layoutId:l}=this.props,{projection:u}=e;u&&(s.group&&s.group.add(u),a&&a.register&&l&&a.register(u),Gh&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Bl.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:a,drag:l,isPresent:u}=this.props,{projection:c}=a;return c&&(c.isPresent=u,e.layoutDependency!==s&&c.setOptions({...c.options,layoutDependency:s}),Gh=!0,l||e.layoutDependency!==s||s===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||Pe.postRender(()=>{const d=c.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:s}=this.props,{projection:a}=e;a&&(a.options.layoutAnchor=s,a.root.didUpdate(),hf.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:a}=this.props,{projection:l}=e;Gh=!0,l&&(l.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(l),a&&a.deregister&&a.deregister(l))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Bw(n){const[e,s]=Tw(),a=V.useContext(Id);return b.jsx(R2,{...n,layoutGroup:a,switchLayoutGroup:V.useContext(Ow),isPresent:e,safeToRemove:s})}const C2={pan:{Feature:A2},drag:{Feature:E2,ProjectionNode:Sw,MeasureLayout:Bw}};function J0(n,e,s){const{props:a}=n;n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",s==="Start");const l="onHover"+s,u=a[l];u&&Pe.postRender(()=>u(e,Kr(e)))}class k2 extends Vi{mount(){const{current:e}=this.node;e&&(this.unmount=QT(e,(s,a)=>(J0(this.node,a,"Start"),l=>J0(this.node,l,"End"))))}unmount(){}}class j2 extends Vi{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=qr(Dr(this.node.current,"focus",()=>this.onFocus()),Dr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Q0(n,e,s){const{props:a}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&a.whileTap&&n.animationState.setActive("whileTap",s==="Start");const l="onTap"+(s==="End"?"":s),u=a[l];u&&Pe.postRender(()=>u(e,Kr(e)))}class O2 extends Vi{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:s,propagate:a}=this.node.props;this.unmount=iE(e,(l,u)=>(Q0(this.node,u,"Start"),(c,{success:d})=>Q0(this.node,c,d?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const Cd=new WeakMap,Kh=new WeakMap,N2=n=>{const e=Cd.get(n.target);e&&e(n)},D2=n=>{n.forEach(N2)};function M2({root:n,...e}){const s=n||document;Kh.has(s)||Kh.set(s,{});const a=Kh.get(s),l=JSON.stringify(e);return a[l]||(a[l]=new IntersectionObserver(D2,{root:n,...e})),a[l]}function U2(n,e,s){const a=M2(e);return Cd.set(n,s),a.observe(n),()=>{Cd.delete(n),a.unobserve(n)}}const B2={some:0,all:1};class L2 extends Vi{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:e={}}=this.node.getProps(),{root:s,margin:a,amount:l="some",once:u}=e,c={root:s?s.current:void 0,rootMargin:a,threshold:typeof l=="number"?l:B2[l]},d=p=>{const{isIntersecting:g}=p;if(this.isInView===g||(this.isInView=g,u&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:w}=this.node.getProps(),x=g?v:w;x&&x(p)};this.stopObserver=U2(this.node.current,c,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(z2(e,s))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function z2({viewport:n={}},{viewport:e={}}={}){return s=>n[s]!==e[s]}const V2={inView:{Feature:L2},tap:{Feature:O2},focus:{Feature:j2},hover:{Feature:k2}},P2={layout:{ProjectionNode:Sw,MeasureLayout:Bw}},H2={...c2,...V2,...C2,...P2},$2=a2(H2,r2),bn=$2;/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q2=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I2=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,a)=>a?a.toUpperCase():s.toLowerCase()),Z0=n=>{const e=I2(n);return e.charAt(0).toUpperCase()+e.slice(1)},Lw=(...n)=>n.filter((e,s,a)=>!!e&&e.trim()!==""&&a.indexOf(e)===s).join(" ").trim(),G2=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var K2={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"};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F2=V.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:l="",children:u,iconNode:c,...d},m)=>V.createElement("svg",{ref:m,...K2,width:e,height:e,stroke:n,strokeWidth:a?Number(s)*24/Number(e):s,className:Lw("lucide",l),...!u&&!G2(d)&&{"aria-hidden":"true"},...d},[...c.map(([p,g])=>V.createElement(p,g)),...Array.isArray(u)?u:[u]]));/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const De=(n,e)=>{const s=V.forwardRef(({className:a,...l},u)=>V.createElement(F2,{ref:u,iconNode:e,className:Lw(`lucide-${q2(Z0(n))}`,`lucide-${n}`,a),...l}));return s.displayName=Z0(n),s};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y2=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],X2=De("arrow-left-right",Y2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Q2=De("arrow-right",J2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z2=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]],W0=De("banknote",Z2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W2=[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],eR=De("calendar-days",W2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tR=[["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"}]],nR=De("calendar",tR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sR=De("chevron-down",iR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aR=[["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"}]],rR=De("circle-alert",aR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_f=De("circle-check",oR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lR=[["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"}]],uR=De("circle-user",lR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cR=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zw=De("earth",cR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hR=[["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"}]],dR=De("external-link",hR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fR=[["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"}]],mR=De("eye",fR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pR=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Ll=De("file-spreadsheet",pR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gR=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Fh=De("file-text",gR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yR=[["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"}]],vR=De("funnel",yR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bR=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],wR=De("history",bR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Vw=De("info",_R);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kd=De("loader-circle",xR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SR=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],TR=De("lock-keyhole",SR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ER=[["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"}]],AR=De("log-out",ER);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const RR=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Pw=De("menu",RR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const CR=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],kR=De("play",CR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],OR=De("plus",jR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const NR=[["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"}]],DR=De("refresh-cw",NR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const MR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Hw=De("search",MR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UR=[["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"}]],ev=De("trash-2",UR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BR=[["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"}]],xf=De("triangle-alert",BR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LR=[["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"}]],tv=De("upload",LR);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Sf=De("x",zR),Mr=[{code:"GT",name:"Guatemala",flag:"/cruce-cuentas/gt-flag.png",currency:"GTQ",locale:"es-GT",enabled:!0},{code:"TT",name:"Trinidad y Tobago",flag:"/cruce-cuentas/tt-flag.png",currency:"TTD",locale:"en-TT",enabled:!0}];function nv(n){return Mr.find(e=>e.code===n)??Mr[0]}const VR="https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png";function PR({currentView:n,onViewChange:e,onNewCruce:s,isSidebarOpen:a=!1,onCloseSidebar:l,user:u,isAuthEnabled:c=!1,onLogout:d,country:m,onCountryChange:p,onChooseAnotherCountry:g}){const[v,w]=V.useState(!1),x=V.useRef(null);return V.useEffect(()=>{function S(A){x.current&&!x.current.contains(A.target)&&w(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),b.jsxs("aside",{className:`bg-neutral-100 h-screen w-64 fixed left-0 top-0 flex flex-col z-50 pb-6 min-h-screen font-sans transition-transform duration-300 md:translate-x-0 ${a?"translate-x-0":"-translate-x-full"}`,children:[b.jsx("div",{className:"absolute right-0 top-0 h-[80px] w-px bg-[#D0D0D0] pointer-events-none z-10 hidden md:block"}),b.jsx("div",{className:"absolute right-0 top-[84px] bottom-0 w-px bg-[#D0D0D0] pointer-events-none z-10 hidden md:block"}),b.jsxs("div",{className:"h-[84px] px-4 flex justify-between md:justify-center items-center bg-white border-b-4 border-[#6CC24A] relative",children:[b.jsx("img",{alt:"GomezLee Marketing logo",className:"h-10 object-contain selection:bg-transparent",src:VR}),b.jsx("button",{onClick:l,className:"md:hidden p-2 text-neutral-500 hover:text-neutral-800 transition-colors","aria-label":"Cerrar menú",children:b.jsx(Sf,{className:"w-5 h-5"})})]}),b.jsxs("div",{className:"px-4 pt-5",children:[b.jsxs("label",{className:"block",children:[b.jsxs("span",{className:"text-[9px] uppercase tracking-wider font-black text-neutral-400 flex items-center gap-1.5 mb-1.5",children:[b.jsx(zw,{className:"w-3.5 h-3.5"}),"País"]}),b.jsxs("div",{className:"relative",ref:x,children:[b.jsxs("button",{type:"button",onClick:()=>w(!v),className:"w-full border border-neutral-300 bg-white px-3 py-2 text-xs font-bold text-[#4F758B] focus:outline-none focus:border-[#4F758B] flex items-center justify-between transition-colors hover:bg-neutral-50",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("img",{src:m.flag,alt:"",className:"w-5 h-3.5 object-cover shadow-sm border border-neutral-200"}),b.jsx("span",{children:m.name})]}),b.jsx(sR,{className:`w-4 h-4 text-[#4F758B] transition-transform ${v?"rotate-180":""}`})]}),v&&b.jsx("ul",{className:"absolute left-0 right-0 top-full mt-1 bg-white border border-neutral-300 shadow-lg z-50 py-1",children:Mr.map(S=>b.jsx("li",{children:b.jsxs("button",{type:"button",disabled:!S.enabled,onClick:()=>{p(S.code),w(!1)},className:`w-full text-left px-3 py-2.5 text-xs font-bold flex items-center gap-2.5 transition-colors ${S.enabled?"hover:bg-neutral-100 text-[#4F758B]":"opacity-60 cursor-not-allowed text-neutral-500 bg-neutral-50"}`,children:[b.jsx("img",{src:S.flag,alt:"",className:"w-6 h-4 object-cover shadow-sm border border-neutral-200 bg-white flex-shrink-0"}),b.jsxs("span",{className:"min-w-0 text-left leading-tight",children:[b.jsx("span",{className:"block",children:S.name}),!S.enabled&&b.jsx("span",{className:"block mt-1 text-[10px] text-neutral-400 font-medium italic",children:"Próximamente"})]})]})},S.code))})]})]}),b.jsx("button",{type:"button",onClick:g,className:"mt-2 text-[9px] font-bold uppercase tracking-wider text-neutral-400 hover:text-[#4F758B]",children:"Ver países disponibles"})]}),b.jsx("nav",{className:"flex-1 flex flex-col mt-5",children:b.jsxs("ul",{className:"space-y-1",children:[b.jsx("li",{children:b.jsxs("button",{onClick:()=>e("cruce"),className:`w-full flex items-center gap-3 px-6 py-3.5 transition-all duration-150 text-left font-bold text-sm tracking-wide ${n==="cruce"?"bg-[#4F758B] text-white":"text-neutral-600 hover:bg-neutral-200 hover:text-neutral-800"}`,children:[b.jsx(X2,{className:`w-4 h-4 ${n==="cruce"?"text-[#6CC24A]":""}`}),b.jsx("span",{children:"Cruce de Cuentas"})]})}),b.jsx("li",{children:b.jsxs("button",{onClick:()=>e("historial"),className:`w-full flex items-center gap-3 px-6 py-3.5 transition-all duration-150 text-left font-bold text-sm tracking-wide ${n==="historial"?"bg-[#4F758B] text-white":"text-neutral-600 hover:bg-neutral-200 hover:text-neutral-800"}`,children:[b.jsx(wR,{className:`w-4 h-4 ${n==="historial"?"text-[#6CC24A]":""}`}),b.jsx("span",{children:"Reportes Históricos"})]})})]})}),b.jsxs("div",{className:"px-4 space-y-3 pt-4 border-t border-[#D0D0D0] bg-neutral-100",children:[u&&b.jsxs("div",{className:"border border-neutral-200 bg-white px-3 py-3 flex items-center gap-2",children:[b.jsx(uR,{className:"w-4 h-4 text-[#4F758B] flex-shrink-0"}),b.jsxs("div",{className:"min-w-0",children:[b.jsx("p",{className:"text-[11px] font-black text-neutral-700 truncate",title:u.name,children:u.name}),b.jsx("p",{className:"text-[9px] text-neutral-400 truncate",title:u.email,children:u.email})]})]}),b.jsxs("button",{onClick:s,className:"w-full bg-[#6CC24A] hover:bg-[#5bb03c] text-white py-3 px-4 font-bold text-xs uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-150 shadow-sm active:scale-98",children:[b.jsx(OR,{className:"w-4 h-4"}),b.jsx("span",{children:"Nuevo Cruce"})]}),c&&d&&b.jsxs("button",{onClick:d,className:"w-full border border-neutral-300 bg-white hover:bg-neutral-50 text-neutral-600 py-2.5 px-4 font-bold text-[11px] uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-150",children:[b.jsx(AR,{className:"w-4 h-4"}),b.jsx("span",{children:"Cerrar sesión"})]})]})]})}const $w=[{value:1,label:"Enero"},{value:2,label:"Febrero"},{value:3,label:"Marzo"},{value:4,label:"Abril"},{value:5,label:"Mayo"},{value:6,label:"Junio"},{value:7,label:"Julio"},{value:8,label:"Agosto"},{value:9,label:"Septiembre"},{value:10,label:"Octubre"},{value:11,label:"Noviembre"},{value:12,label:"Diciembre"}],iv=[{value:"quincena_15",label:"Quincena 15",description:"Del día 1 al 15 del mes."},{value:"quincena_30",label:"Quincena 30 / fin de mes",description:"Del día 16 al último día del mes."}],HR="https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-analizar-nomina";function $R(n){return n==="TT"?"https://agenteit.digitalcompass.agency/webhook/nominatt-bamboo-test":"https://agenteit.digitalcompass.agency/webhook/nominagt-bamboo-test"}function qR(){const n=new Date().getFullYear(),e=n-5,s=n+10;return Array.from({length:s-e+1},(a,l)=>e+l)}function IR(){const n=new Date,e=n.getDate();let s=n.getFullYear(),a=n.getMonth()+1,l="quincena_15";return e<=15&&(a-=1,l="quincena_30",a===0&&(a=12,s-=1)),{year:s,month:a,periodType:l}}function qw(n){return n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(2)} MB`}function sv(n){const e=n.name.toLowerCase();return e.endsWith(".xlsx")||e.endsWith(".xls")}function av(n){return n.name.toLowerCase().endsWith(".csv")}function rv(n){return Array.from(n).map(e=>({name:e.name,size:qw(e.size),type:"bank",rawFile:e}))}function bl(n,e,s){return`${n}-${String(e).padStart(2,"0")}-${String(s).padStart(2,"0")}`}function ov(n,e,s){var u;const a=new Date(n,e,0).getDate(),l=((u=$w.find(c=>c.value===e))==null?void 0:u.label)??"Mes";return s==="quincena_15"?{start:bl(n,e,1),end:bl(n,e,15),label:`${l} ${n} · Quincena 15`}:{start:bl(n,e,16),end:bl(n,e,a),label:`${l} ${n} · Quincena 30 / fin de mes`}}function Yh(n,e){return n==null||Number.isNaN(n)?"—":new Intl.NumberFormat(e.locale,{style:"currency",currency:e.currency,minimumFractionDigits:2}).format(n)}function Cn(n,e=0){const s=Number(n);return Number.isFinite(s)?s:e}function At(n){return n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function GR(n,e){const s=At(String(n??e??""));return s.includes("coincid")?"Coincidencia":s.includes("resuelto")?"Resuelto":s.includes("no encontrado")?"No encontrado":s.includes("pendiente")?"Pendiente revisión":s.includes("riesgo")||s.includes("discrep")||s.includes("mal digitada")?"Riesgo":e==="coincidencia"?"Coincidencia":e==="posible_cuenta_mal_digitada"||e==="discrepancia"?"Riesgo":"Pendiente revisión"}function Xh(n,e){for(const s of e){if(typeof n[s]=="number")return n[s];if(typeof n[s]=="string"&&n[s]!==""){const a=n[s].replace(/[Q,$\s]/g,"").replace(/,/g,""),l=Number(a);if(Number.isFinite(l))return l}}return null}function lv(n){return Array.isArray(n)?n.map((e,s)=>{const a=e,l=String(a.category??a.categoria??a.tipo??a.source??a.fuente??""),u=Xh(a,["amountPayroll","monto_nomina","payroll_amount","amount_payroll","montoNomina"]),c=Xh(a,["amountBank","monto_banco","bank_amount","amount_bank","montoBanco"]),d=Xh(a,["difference","diferencia","diff"]);return{id:String(a.id??a.employeeNumber??a.employee_number??a.account??a.cuenta??`row-${s+1}`),employee:String(a.employee??a.empleado??a.name??a.nombre??a.employee_name??"Sin nombre"),employeeNumber:String(a.employeeNumber??a.employee_number??a.codigo??""),account:a.account||a.cuenta||a.bank_account?String(a.account??a.cuenta??a.bank_account):void 0,amountPayroll:u,amountBank:c,difference:d??(u!==null&&c!==null?u-c:null),status:GR(a.status??a.estado,l),category:l,observation:String(a.observation??a.observacion??a.note??a.nota??a.comentario??""),source:a.source??a.fuente??l}}):[]}function KR(n){const s=(Array.isArray(n)?n[0]:n)??{},a=s.originalResponse??s.original_response??s.response??s,l=a.summary??a.resumen??s.summary??s.resumen??{},u=lv(a.rows??s.rows??a.resultados??s.resultados??[]),c=lv(a.bankWithoutBamboo??s.bankWithoutBamboo??a.banco_sin_bamboo_rows??s.banco_sin_bamboo_rows??[]).map(C=>({...C,category:C.category||"banco_sin_bamboo",source:"banco_sin_bamboo",status:C.status==="Coincidencia"?"Pendiente revisión":C.status})),d=new Map;[...u,...c].forEach((C,N)=>{const O=C.id||`${C.source??C.category??"row"}-${N}`;d.set(O,C)});const m=Array.from(d.values()),p=Cn(l.matches??l.coincidencias,u.filter(C=>C.status==="Coincidencia").length),g=Cn(l.discrepancies??l.discrepancias,u.filter(C=>{const N=At(String(C.category??C.source??""));return N.includes("discrepancia")||N.includes("posible_cuenta_mal_digitada")}).length),v=Cn(l.bankWithoutPayroll??l.bancoSinNomina??l.banco_sin_nomina,u.filter(C=>vr(C,"banco_sin_nomina")).length),w=Cn(l.bankWithoutBamboo??l.bancoSinBamboo??l.banco_sin_bamboo,c.length),x=Cn(l.payrollWithoutAccount??l.nominaSinCuenta??l.nomina_sin_cuenta),S=Cn(l.nameDifferences??l.diferenciasNombreBanco??l.diferencias_nombre_banco,u.filter(C=>At(String(C.category??"")).includes("diferencia_nombre_banco")).length),A=Cn(l.possibleWrongAccounts??l.posiblesCuentasMalDigitadas??l.posibles_cuentas_mal_digitadas,u.filter(C=>At(String(C.category??"")).includes("posible_cuenta_mal_digitada")).length),k=g+v+w+x+S;return{ok:!!(a.ok??s.ok??!0),executionId:a.executionId||a.execution_id||s.executionId||s.execution_id?String(a.executionId??a.execution_id??s.executionId??s.execution_id):void 0,reportUrl:a.reportUrl||a.report_url||s.reportUrl||s.report_url||s.google_sheet_url?String(a.reportUrl??a.report_url??s.reportUrl??s.report_url??s.google_sheet_url):void 0,summary:{matches:p,discrepancies:g,bankWithoutPayroll:v,bankWithoutBamboo:w,payrollWithoutAccount:x,nameDifferences:S,possibleWrongAccounts:A,totalPending:k,totalRows:m.length,totalPayroll:Cn(l.totalNomina??l.total_nomina,void 0),totalBank:Cn(l.totalBanco??l.total_banco,void 0),totalDifference:Cn(l.diferenciaTotal??l.diferencia_total,void 0)},rows:m,message:a.message||s.message?String(a.message??s.message):void 0}}function FR(n){return n==="Coincidencia"?"bg-emerald-50 text-emerald-800 border-emerald-200":n==="Resuelto"?"bg-blue-50 text-blue-800 border-blue-200":n==="No encontrado"?"bg-amber-50 text-amber-800 border-amber-200":n==="Pendiente revisión"?"bg-neutral-100 text-neutral-700 border-neutral-300":"bg-red-50 text-[#ba1a1a] border-red-200"}function uv(n){const e=At(String(n.category??n.source??"")),s=At(n.observation??"");return n.status==="Coincidencia"||e.includes("coincidencia")?90:e.includes("posible_cuenta_mal_digitada")||s.includes("mal digitada")?1:e.includes("discrepancia")||n.status==="Riesgo"?2:e.includes("banco_sin_bamboo")?3:e.includes("banco_sin_nomina")?4:e.includes("diferencia_nombre_banco")?5:e.includes("nomina_sin_cuenta")?6:n.status==="Pendiente revisión"?7:n.status==="No encontrado"?10:20}function YR(n){return[...n].sort((e,s)=>{const a=uv(e)-uv(s);return a!==0?a:e.employee.localeCompare(s.employee,"es")})}function XR(n){const e=At(String(n.category??n.source??""));return e.includes("discrepancia")||e.includes("posible_cuenta_mal_digitada")}function vr(n,e){return n.source===e||At(String(n.category??"")).includes(e)}function JR(n){const e=At(String(n??""));return e?e.includes("posible_cuenta_mal_digitada")?"Posible cuenta mal digitada":e.includes("banco_sin_bamboo")?"Banco sin Bamboo":e.includes("banco_sin_nomina")?"Banco sin nómina":e.includes("diferencia_nombre_banco")?"Diferencia nombre banco":e.includes("nomina_sin_cuenta")?"Nómina sin cuenta":e.includes("discrepancia")?"Discrepancia":e.includes("coincidencia")?"Coincidencia":String(n).replace(/_/g," "):"—"}function QR(n){const e=n instanceof Error?n.message:"";return e.includes("planillas del banco repetidas")?e:"No se pudo procesar el cruce. Verifica los archivos e intenta nuevamente."}function ZR(n){try{return new TextDecoder("windows-1252").decode(n)}catch{return new TextDecoder("utf-8").decode(n)}}function cv(n,e){let s=0,a=!1;for(let l=0;l<n.length;l+=1){const u=n[l];if(u==='"'){a&&n[l+1]==='"'?l+=1:a=!a;continue}!a&&u===e&&(s+=1)}return s}function Iw(n){return[",",";"," ","|"].reduce((s,a)=>cv(n,a)>cv(n,s)?a:s)}function hv(n,e=Iw(n)){const s=[];let a="",l=!1;for(let u=0;u<n.length;u+=1){const c=n[u];if(c==='"'){l&&n[u+1]==='"'?(a+='"',u+=1):l=!l;continue}if(c===e&&!l){s.push(a.trim()),a="";continue}a+=c}return s.push(a.trim()),s.map(u=>u.replace(/^\uFEFF/,"").trim())}function WR(n){const e=String(n??"").replace(/\D/g,"");return/^\d{1,20}$/.test(e)?e:null}function eC(n){const e=n.split(/\r?\n/).slice(0,120);for(const s of e.slice(0,25)){const l=At(s).match(/(?:consulta\s+(?:del\s+)?)?detalle\s+(?:del\s+)?envio\s+(\d{1,20})/);if(l!=null&&l[1])return l[1]}for(let s=0;s<e.length;s+=1){const a=e[s],l=Iw(a),d=hv(a,l).map(m=>At(m).trim()).findIndex(m=>m==="numero de envio"||m.includes("numero de envio"));if(!(d<0))for(let m=s+1;m<Math.min(s+8,e.length);m+=1){const p=e[m];if(!p.trim())continue;const g=hv(p,l),v=WR(g[d]);if(v)return v}}for(const s of e){const l=At(s).match(/numero\s+de\s+envio[^0-9]{0,40}(\d{1,20})/);if(l!=null&&l[1])return l[1]}return null}async function tC(n){const e=await n.arrayBuffer(),s=ZR(e);return eC(s)}async function nC(n){const e=new Map;for(const s of n){if(!s.rawFile)continue;const a=await tC(s.rawFile);if(!a)continue;const l=e.get(a)??[];l.push(s.name),e.set(a,l)}return Array.from(e.entries()).filter(([,s])=>s.length>1).map(([s,a])=>({shipmentNumber:s,fileNames:a}))}const iC={1:["enero","january","jan"],2:["febrero","february","feb"],3:["marzo","march","mar"],4:["abril","april","apr"],5:["mayo","may"],6:["junio","june","jun"],7:["julio","july","jul"],8:["agosto","august","aug"],9:["septiembre","setiembre","september","sep"],10:["octubre","october","oct"],11:["noviembre","november","nov"],12:["diciembre","december","dec"]};function sC(n){const e=At(n).replace(/[_\-.()]+/g," ").replace(/\s+/g," ").trim(),s=e.match(/\b(20\d{2})\b/),a=s?Number(s[1]):void 0;let l;for(const[c,d]of Object.entries(iC))if(d.some(m=>new RegExp(`\\b${m}\\b`,"i").test(e))){l=Number(c);break}let u;return/\b(?:1q|q1|quincena\s*15|primera\s+quincena)\b/.test(e)?u="quincena_15":/\b(?:2q|q2|quincena\s*30|segunda\s+quincena|fin\s+de\s+mes)\b/.test(e)?u="quincena_30":/\b15\b/.test(e)?u="quincena_15":/\b(?:30|31)\b/.test(e)&&(u="quincena_30"),{year:a,month:l,periodType:u}}function dv(n){const e=IR();try{const s=window.localStorage.getItem(`glm_cruce_period_${n}`);if(!s)return e;const a=JSON.parse(s);if(Number.isInteger(a.year)&&Number.isInteger(a.month)&&a.month>=1&&a.month<=12&&(a.periodType==="quincena_15"||a.periodType==="quincena_30"))return a}catch{}return e}async function aC(n,e){const s=sC(n);try{const a=await fetch(HR,{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify({fileName:n,country:e.code,countryName:e.name})});if(!a.ok)return s;const l=await a.json().catch(()=>null),u=(l==null?void 0:l.detected)??(l==null?void 0:l.result)??(l==null?void 0:l.analysis)??l??{},c=String(u.periodType??u.period_type??""),d=Number(u.year)||s.year,m=Number(u.month)||s.month,p=c==="quincena_15"||c==="quincena_30"?c:s.periodType;return{year:d,month:m,periodType:p,confidence:Number.isFinite(Number(u.confidence))?Number(u.confidence):void 0,requiresManualReview:!!(u.requiresManualReview??u.requires_manual_review??!1),source:String(u.source??"gemini")}}catch{return{...s,source:"local_fallback",requiresManualReview:!(Number.isInteger(s.year)&&Number.isInteger(s.month)&&(s.periodType==="quincena_15"||s.periodType==="quincena_30"))}}}function rC({onShowToast:n,uploadedPayroll:e,setUploadedPayroll:s,uploadedBankFiles:a,setUploadedBankFiles:l,isCruceExecuted:u,setIsCruceExecuted:c,response:d,setResponse:m,onOpenSidebar:p,operatorName:g,operatorEmail:v,resetToken:w=0,country:x}){const S=V.useMemo(()=>dv(x.code),[x.code]),[A,k]=V.useState(!1),[C,N]=V.useState(""),[O,P]=V.useState("todos"),[J,X]=V.useState(S.year),[G,Z]=V.useState(S.month),[ee,ne]=V.useState(S.periodType),[le,de]=V.useState(1),[je,Re]=V.useState(""),ke=`glm_cruce_period_${x.code}`,L=V.useRef(null),Q=V.useRef(null),Y=V.useMemo(()=>qR(),[]),I=V.useMemo(()=>ov(J,G,ee),[J,G,ee]),E=V.useMemo(()=>YR((d==null?void 0:d.rows)??[]),[d==null?void 0:d.rows]).filter(F=>{const ge=At(je.trim());return At(`${F.employee} ${F.employeeNumber} ${F.account??""} ${F.observation} ${F.category??""} ${F.source??""}`).includes(ge)?O==="discrepancias"?XR(F):O==="coincidencias"?F.status==="Coincidencia":O==="banco_sin_nomina"?vr(F,"banco_sin_nomina"):O==="banco_sin_bamboo"?vr(F,"banco_sin_bamboo"):O==="diferencia_nombre_banco"?vr(F,"diferencia_nombre_banco"):O==="nomina_sin_cuenta"?vr(F,"nomina_sin_cuenta"):!0:!1}),B=10,K=Math.max(1,Math.ceil(E.length/B)),W=E.slice((le-1)*B,le*B);V.useEffect(()=>{le>K&&de(K)},[le,K]);const he=V.useMemo(()=>{var F;return((F=iv.find(ge=>ge.value===ee))==null?void 0:F.description)??""},[ee]);V.useEffect(()=>{const F=dv(x.code);X(F.year),Z(F.month),ne(F.periodType),de(1),Re(""),P("todos")},[x.code]),V.useEffect(()=>{window.localStorage.setItem(ke,JSON.stringify({year:J,month:G,periodType:ee}))},[ke,J,G,ee]),V.useEffect(()=>{Re(""),P("todos"),de(1),N(""),k(!1),L.current&&(L.current.value=""),Q.current&&(Q.current.value="")},[w]);const ue=()=>{c(!1),m(null),de(1),Re(""),P("todos")},_e=async F=>{s({name:F.name,size:qw(F.size),type:"payroll",rawFile:F}),ue();const ge=await aC(F.name,x);if(Number.isInteger(ge.year)&&Number.isInteger(ge.month)&&(ge.periodType==="quincena_15"||ge.periodType==="quincena_30")){X(ge.year),Z(ge.month),ne(ge.periodType);const Bt=ov(ge.year,ge.month,ge.periodType);ge.requiresManualReview?n(`Nómina cargada. Período sugerido: ${Bt.label}. Confirma los datos antes de ejecutar.`,"info"):n(`Nómina cargada. Período detectado: ${Bt.label}.`,"success");return}n("Archivo de nómina cargado con éxito.","success")},qe=F=>{F.preventDefault()},He=async F=>{F.preventDefault();const ge=F.dataTransfer.files[0];ge&&(sv(ge)?await _e(ge):n("Formato inválido. Por favor carga un archivo Excel (.xlsx, .xls).","error"))},_n=F=>{F.preventDefault();const Fe=Array.from(F.dataTransfer.files).filter(av);if(Fe.length===0){n("Formato inválido. Por favor carga uno o varios archivos CSV (.csv).","error");return}l([...a,...rv(Fe)]),ue(),n(`${Fe.length} planilla(s) del banco cargada(s) con éxito.`,"success")},wt=async F=>{var Fe;const ge=(Fe=F.target.files)==null?void 0:Fe[0];ge&&(sv(ge)?await _e(ge):n("Formato inválido. Por favor carga un archivo Excel (.xlsx, .xls).","error"))},Yt=F=>{const ge=F.target.files;if(!ge||ge.length===0)return;const Fe=Array.from(ge).filter(av);if(Fe.length===0){n("Formato inválido. Por favor carga uno o varios archivos CSV (.csv).","error");return}l([...a,...rv(Fe)]),ue(),n(`${Fe.length} planilla(s) del banco cargada(s) con éxito.`,"success")},oi=F=>{l(a.filter((ge,Fe)=>Fe!==F)),Q.current&&(Q.current.value=""),ue(),n("Planilla de banco removida.","info")},dt=async()=>{if(!A){if(!J||!G||!ee){n("Debes seleccionar año, mes y tipo de cruce antes de ejecutar.","error");return}if(!(e!=null&&e.rawFile)){n("Debes cargar la nómina antes de ejecutar el cruce.","error");return}if(a.length===0||a.some(F=>!F.rawFile)){n("Debes cargar al menos una planilla del banco antes de ejecutar el cruce.","error");return}k(!0),N("Validando archivos..."),de(1);try{const F=await nC(a);if(F.length>0){const Me=F.map(Sn=>`Número de envío ${Sn.shipmentNumber}: ${Sn.fileNames.join(", ")}`).join(`
`);throw new Error(`Hay planillas del banco repetidas. Revisa los archivos cargados antes de continuar.
${Me}`)}const ge=$R(x.code);if(!ge)throw new Error("No se pudo procesar el cruce. El servicio de conciliación no está disponible.");const Fe={country:x.code,country_name:x.name,year:J,month:G,period_type:ee,period_label:I.label,period_start:I.start,period_end:I.end,payroll_file_name:e.name,bank_file_names:a.map(Me=>Me.name),requested_by_name:g,requested_by_email:v,auth_mode:"supabase_google",source_app:"portal-cruce-cuentas-glm"};N("Procesando cruce de cuentas...");const Bt=new FormData;Bt.append("metadata",JSON.stringify(Fe)),Object.entries(Fe).forEach(([Me,Sn])=>{Bt.append(Me,Array.isArray(Sn)?JSON.stringify(Sn):String(Sn))}),Bt.append("payroll_file",e.rawFile,e.name),a.forEach((Me,Sn)=>{Me.rawFile&&(Bt.append("bank_files",Me.rawFile,Me.name),Bt.append(`bank_file_${Sn+1}`,Me.rawFile,Me.name))});const Ln=await fetch(ge,{method:"POST",body:Bt});N("Generando reporte...");const xn=(Ln.headers.get("content-type")??"").includes("application/json")?await Ln.json():{ok:Ln.ok,message:await Ln.text()};if(!Ln.ok||(xn==null?void 0:xn.ok)===!1)throw new Error(typeof(xn==null?void 0:xn.message)=="string"?xn.message:"No se pudo procesar el cruce. Verifica los archivos e intenta nuevamente.");const Xr=KR(xn);m(Xr),c(!0),n(Xr.message||"Cruce procesado correctamente.","success"),setTimeout(()=>{const Me=document.getElementById("resultados-seccion");Me&&Me.scrollIntoView({behavior:"smooth",block:"start"})},150)}catch(F){const ge=QR(F);c(!1),m(null),n(ge,"error")}finally{k(!1),N("")}}},Pi=()=>{if(d!=null&&d.reportUrl){window.open(d.reportUrl,"_blank","noopener,noreferrer");return}n("El reporte aún no tiene un enlace disponible.","info")};return b.jsxs("div",{className:"flex-1 flex flex-col min-h-screen bg-neutral-50 text-neutral-800 font-sans",children:[b.jsxs("header",{className:"bg-white border-b-4 border-[#6CC24A] flex justify-between items-center w-full px-4 sm:px-8 h-[84px] sticky top-0 z-40 shadow-sm gap-x-4",children:[b.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[b.jsx("button",{onClick:p,className:"md:hidden p-2 -ml-2 text-neutral-600 hover:text-neutral-800 hover:bg-neutral-100 transition-colors flex-shrink-0","aria-label":"Abrir menú",children:b.jsx(Pw,{className:"w-6 h-6"})}),b.jsx("h1",{className:"text-xs sm:text-sm md:text-lg lg:text-2xl font-black text-[#4F758B] tracking-tight uppercase flex items-center gap-1.5 sm:gap-2 min-w-0",children:b.jsxs("span",{className:"truncate",children:["Cruce de Cuentas GLM - ",x.name]})})]}),b.jsx("div",{className:"flex-shrink-0 flex items-center","aria-label":`Bandera de ${x.name}`,children:b.jsx("div",{className:"border border-neutral-200 bg-white px-2.5 py-2 shadow-sm",children:b.jsx("img",{src:x.flag,alt:`Bandera de ${x.name}`,className:"h-5 sm:h-6 w-auto object-contain"})})})]}),b.jsxs("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 py-8 flex flex-col gap-8",children:[b.jsxs("section",{className:"bg-white border border-[#D0D0D0] p-5 shadow-sm",children:[b.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-5",children:b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx("div",{className:"bg-[#4F758B]/10 p-2 rounded-full",children:b.jsx(Vw,{className:"w-5 h-5 text-[#4F758B]"})}),b.jsx("div",{className:"pt-0.5",children:b.jsx("h2",{className:"text-sm font-black text-[#4F758B] uppercase tracking-wider leading-none",children:"Datos del cruce"})})]})}),b.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[b.jsxs("label",{className:"flex flex-col gap-1.5",children:[b.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Año"}),b.jsx("select",{value:J,onChange:F=>{X(Number(F.target.value)),ue()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:Y.map(F=>b.jsx("option",{value:F,children:F},F))})]}),b.jsxs("label",{className:"flex flex-col gap-1.5",children:[b.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Mes"}),b.jsx("select",{value:G,onChange:F=>{Z(Number(F.target.value)),ue()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:$w.map(F=>b.jsx("option",{value:F.value,children:F.label},F.value))})]}),b.jsxs("label",{className:"flex flex-col gap-1.5",children:[b.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Tipo de cruce"}),b.jsx("select",{value:ee,onChange:F=>{ne(F.target.value),ue()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:iv.map(F=>b.jsx("option",{value:F.value,children:F.label},F.value))})]})]}),b.jsxs("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-[1fr_auto] gap-3 items-center bg-[#4F758B]/5 border border-[#4F758B]/10 px-4 py-3",children:[b.jsxs("div",{className:"flex items-start gap-2 text-xs text-neutral-600",children:[b.jsx(eR,{className:"w-4 h-4 text-[#4F758B] mt-0.5 flex-shrink-0"}),b.jsxs("div",{children:[b.jsx("span",{className:"font-black text-[#4F758B]",children:"Período calculado:"})," ",I.start," al ",I.end,b.jsx("p",{className:"text-[10px] text-neutral-500 mt-0.5",children:he})]})]}),b.jsx("div",{className:"text-[10px] font-bold text-neutral-500 uppercase tracking-wider",children:I.label})]})]}),b.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[b.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-6 flex flex-col justify-between relative shadow-sm hover:shadow-md transition-shadow",children:[b.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-[#4F758B]"}),b.jsxs("div",{children:[b.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[b.jsx(Ll,{className:"w-5 h-5 text-[#4F758B]"}),b.jsx("h2",{className:"text-sm font-black text-neutral-800 uppercase tracking-wider",children:"1. Carga de Nómina"})]}),b.jsx("input",{type:"file",ref:L,onChange:wt,accept:".xlsx,.xls",className:"hidden"}),e?b.jsxs("div",{className:"border border-[#6CC24A]/30 bg-[#6CC24A]/5 p-5 flex items-center justify-between gap-3",children:[b.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[b.jsx(Ll,{className:"w-8 h-8 text-[#6CC24A] flex-shrink-0"}),b.jsxs("div",{className:"overflow-hidden",children:[b.jsx("p",{className:"text-xs font-bold text-neutral-700 truncate max-w-[300px]",title:e.name,children:e.name}),b.jsxs("p",{className:"text-[10px] text-neutral-400 font-mono mt-0.5",children:[e.size," • Excel"]})]})]}),b.jsx("button",{onClick:()=>{s(null),L.current&&(L.current.value=""),ue(),n("Nómina removida.","info")},className:"p-1.5 text-neutral-400 hover:text-red-500 hover:bg-neutral-100 transition-all rounded","aria-label":"Remover nómina",children:b.jsx(ev,{className:"w-4.5 h-4.5"})})]}):b.jsxs("div",{onDragOver:qe,onDrop:He,onClick:()=>{var F;return(F=L.current)==null?void 0:F.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-neutral-50 hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors flex flex-col items-center justify-center py-10 px-4 text-center cursor-pointer min-h-[190px]",children:[b.jsx(tv,{className:"w-8 h-8 text-neutral-300 mb-2"}),b.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre y suelte archivo Excel"}),b.jsx("p",{className:"text-[10px] text-neutral-400 mt-1 font-medium",children:"Formato .xlsx, .xls"}),b.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivo"})]})]})]}),b.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-6 flex flex-col justify-between relative shadow-sm hover:shadow-md transition-shadow",children:[b.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-[#4F758B]"}),b.jsxs("div",{children:[b.jsxs("div",{className:"flex items-center gap-2.5 mb-2",children:[b.jsx(Fh,{className:"w-5 h-5 text-[#4F758B]"}),b.jsx("h2",{className:"text-sm font-black text-neutral-800 uppercase tracking-wider",children:"2. Carga de Planillas del Banco"})]}),b.jsx("p",{className:"text-[11px] text-neutral-500 mb-4 leading-relaxed",children:"Puede subir múltiples archivos separados o un archivo consolidado del período."}),b.jsx("input",{type:"file",ref:Q,onChange:Yt,accept:".csv",multiple:!0,className:"hidden"}),b.jsxs("div",{onDragOver:qe,onDrop:_n,onClick:()=>{var F;return(F=Q.current)==null?void 0:F.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-neutral-50 hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors flex flex-col items-center justify-center py-8 px-4 text-center cursor-pointer min-h-[130px]",children:[b.jsx(tv,{className:"w-7 h-7 text-neutral-300 mb-2"}),b.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre y suelte archivo CSV"}),b.jsx("p",{className:"text-[10px] text-neutral-400 mt-1 font-medium",children:"Formato .csv"}),b.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivos"})]}),a.length>0&&b.jsx("div",{className:"mt-4 space-y-2 max-h-[140px] overflow-y-auto pr-1",children:a.map((F,ge)=>b.jsxs("div",{className:"border border-neutral-200 bg-neutral-50 px-3 py-2 flex items-center justify-between gap-3",children:[b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(Fh,{className:"w-4 h-4 text-[#4F758B] flex-shrink-0"}),b.jsxs("div",{className:"min-w-0",children:[b.jsx("p",{className:"text-[11px] font-bold text-neutral-700 truncate max-w-[260px]",title:F.name,children:F.name}),b.jsxs("p",{className:"text-[9px] text-neutral-400 font-mono",children:[F.size," • CSV"]})]})]}),b.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),oi(ge)},className:"p-1 text-neutral-400 hover:text-red-500 hover:bg-white rounded transition-colors","aria-label":"Remover planilla de banco",children:b.jsx(ev,{className:"w-3.5 h-3.5"})})]},`${F.name}-${ge}`))})]})]})]}),b.jsx("section",{className:"flex flex-col items-center gap-3",children:b.jsx("button",{onClick:dt,disabled:A,className:"w-full sm:w-auto min-w-[280px] bg-[#4F758B] hover:bg-[#41677b] disabled:bg-neutral-300 disabled:cursor-not-allowed text-white px-8 py-4 font-black text-sm uppercase tracking-wider shadow-md flex items-center justify-center gap-3 transition-all duration-150 active:scale-[0.99] border-l-4 border-[#6CC24A]",children:A?b.jsxs(b.Fragment,{children:[b.jsx(kd,{className:"w-5 h-5 animate-spin"}),b.jsx("span",{children:C||"Procesando cruce de cuentas..."})]}):b.jsxs(b.Fragment,{children:[b.jsx(kR,{className:"w-5 h-5"}),b.jsx("span",{children:"Ejecutar Cruce de Cuentas"})]})})}),b.jsx(cs,{children:u&&d&&b.jsxs(bn.section,{id:"resultados-seccion",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"flex flex-col gap-5 scroll-mt-28",children:[b.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4",children:[b.jsxs("div",{className:"bg-white border border-emerald-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-emerald-700",children:[b.jsx(_f,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Coincidencias"})]}),b.jsx("p",{className:"text-3xl font-black text-emerald-800 mt-2",children:d.summary.matches})]}),b.jsxs("div",{className:"bg-white border border-red-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-[#ba1a1a]",children:[b.jsx(xf,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Discrepancias"})]}),b.jsx("p",{className:"text-3xl font-black text-[#ba1a1a] mt-2",children:d.summary.discrepancies})]}),b.jsxs("div",{className:"bg-white border border-amber-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-amber-800",children:[b.jsx(W0,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Banco sin nómina"})]}),b.jsx("p",{className:"text-3xl font-black text-amber-800 mt-2",children:d.summary.bankWithoutPayroll})]}),b.jsxs("div",{className:"bg-white border border-orange-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-orange-800",children:[b.jsx(W0,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Banco sin Bamboo"})]}),b.jsx("p",{className:"text-3xl font-black text-orange-800 mt-2",children:d.summary.bankWithoutBamboo})]}),b.jsxs("div",{className:"bg-white border border-violet-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-violet-800",children:[b.jsx(Fh,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Diferencias nombre banco"})]}),b.jsx("p",{className:"text-3xl font-black text-violet-800 mt-2",children:d.summary.nameDifferences})]}),b.jsxs("div",{className:"bg-white border border-blue-200 p-4 shadow-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-blue-800",children:[b.jsx(Ll,{className:"w-5 h-5"}),b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Nómina sin cuenta"})]}),b.jsx("p",{className:"text-3xl font-black text-blue-800 mt-2",children:d.summary.payrollWithoutAccount})]})]}),b.jsxs("div",{className:"bg-white border border-[#D0D0D0] shadow-sm overflow-hidden",children:[b.jsxs("div",{className:"p-5 border-b border-neutral-200 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[b.jsxs("div",{children:[b.jsx("h2",{className:"text-lg font-black text-[#4F758B] uppercase tracking-tight",children:"Resultados del Cruce"}),b.jsx("p",{className:"text-[11px] text-neutral-500 mt-1",children:I.label})]}),b.jsx("div",{className:"flex flex-col sm:flex-row gap-2",children:b.jsxs("button",{onClick:Pi,disabled:!d.reportUrl,className:"inline-flex items-center justify-center gap-2 border border-[#4F758B] text-[#4F758B] hover:bg-[#4F758B] hover:text-white px-4 py-2 text-xs font-bold transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[b.jsx(dR,{className:"w-4 h-4"}),"Abrir Google Sheet"]})})]}),b.jsxs("div",{className:"p-4 border-b border-neutral-200 bg-neutral-50 flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[b.jsxs("div",{className:"relative w-full lg:max-w-sm",children:[b.jsx(Hw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-neutral-400"}),b.jsx("input",{type:"text",value:je,onChange:F=>{Re(F.target.value),de(1)},placeholder:"Buscar empleado, Employee Number o cuenta...",className:"w-full pl-9 pr-3 py-2 border border-[#D0D0D0] text-xs font-medium focus:outline-none focus:border-[#4F758B]"})]}),b.jsx("div",{className:"flex flex-wrap gap-2",children:[["todos","Todos"],["discrepancias","Discrepancias"],["coincidencias","Coincidencias"],["banco_sin_nomina","Banco sin nómina"],["banco_sin_bamboo","Banco sin Bamboo"],["diferencia_nombre_banco","Diferencias nombre banco"],["nomina_sin_cuenta","Nómina sin cuenta"]].map(([F,ge])=>b.jsx("button",{onClick:()=>{P(F),de(1)},className:`px-3 py-1.5 text-[10px] uppercase tracking-wider font-black border transition-colors ${O===F?"bg-[#4F758B] text-white border-[#4F758B]":"bg-white text-neutral-500 border-neutral-300 hover:border-[#4F758B] hover:text-[#4F758B]"}`,children:ge},F))})]}),b.jsx("div",{className:"overflow-x-auto",children:b.jsxs("table",{className:"w-full text-left border-collapse min-w-[960px] xl:min-w-full",children:[b.jsx("thead",{children:b.jsxs("tr",{className:"bg-[#4F758B] text-white text-xs font-bold uppercase tracking-wider",children:[b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Empleado"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Employee Number"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Cuenta"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-right",children:"Monto Nómina"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-right",children:"Monto Banco"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-right",children:"Diferencia"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Estado"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Categoría"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Observación"})]})}),b.jsx("tbody",{className:"divide-y divide-neutral-200 text-xs",children:W.length>0?W.map(F=>b.jsxs("tr",{className:"hover:bg-neutral-50 transition-colors",children:[b.jsx("td",{className:"py-3 px-3 xl:px-4 font-bold text-neutral-800",children:F.employee}),b.jsx("td",{className:"py-3 px-3 xl:px-4 font-mono text-neutral-600",children:F.employeeNumber||"—"}),b.jsx("td",{className:"py-3 px-3 xl:px-4 font-mono text-neutral-500",children:F.account??"—"}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-right font-mono text-neutral-700",children:Yh(F.amountPayroll,x)}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-right font-mono text-neutral-700",children:Yh(F.amountBank,x)}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-right font-mono text-neutral-700",children:Yh(F.difference,x)}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center",children:b.jsx("span",{className:`inline-block px-2.5 py-1 text-[9px] font-black uppercase tracking-wider border ${FR(F.status)}`,children:F.status})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-neutral-600 max-w-[180px] capitalize",children:JR(F.category??F.source)}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-neutral-600 max-w-[300px]",children:F.observation})]},F.id)):b.jsx("tr",{children:b.jsx("td",{colSpan:9,className:"py-12 text-center text-neutral-400 font-medium",children:"No hay resultados para el filtro seleccionado."})})})]})}),b.jsxs("div",{className:"p-4 border-t border-neutral-200 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs text-neutral-500",children:[b.jsxs("span",{children:["Mostrando ",W.length," de ",E.length," resultado(s)."]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("button",{onClick:()=>de(F=>Math.max(1,F-1)),disabled:le===1,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Anterior"}),b.jsxs("span",{className:"font-bold text-neutral-700",children:["Página ",le," de ",K]}),b.jsx("button",{onClick:()=>de(F=>Math.min(K,F+1)),disabled:le===K,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Siguiente"})]})]})]})]})})]})]})}function lu(n,e){var s={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(s[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,a=Object.getOwnPropertySymbols(n);l<a.length;l++)e.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(n,a[l])&&(s[a[l]]=n[a[l]]);return s}function oC(n,e,s,a){function l(u){return u instanceof s?u:new s(function(c){c(u)})}return new(s||(s=Promise))(function(u,c){function d(g){try{p(a.next(g))}catch(v){c(v)}}function m(g){try{p(a.throw(g))}catch(v){c(v)}}function p(g){g.done?u(g.value):l(g.value).then(d,m)}p((a=a.apply(n,e||[])).next())})}const lC=n=>n?(...e)=>n(...e):(...e)=>fetch(...e);class Tf extends Error{constructor(e,s="FunctionsError",a){super(e),this.name=s,this.context=a}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class uC extends Tf{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class fv extends Tf{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class mv extends Tf{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var jd;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(jd||(jd={}));class cC{constructor(e,{headers:s={},customFetch:a,region:l=jd.Any}={}){this.url=e,this.headers=s,this.region=l,this.fetch=lC(a)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return oC(this,arguments,void 0,function*(s,a={}){var l;let u,c;try{const{headers:d,method:m,body:p,signal:g,timeout:v}=a;let w={},{region:x}=a;x||(x=this.region);const S=new URL(`${this.url}/${s}`);x&&x!=="any"&&(w["x-region"]=x,S.searchParams.set("forceFunctionRegion",x));let A;const k=!!d&&Object.keys(d).some(X=>X.toLowerCase()==="content-type");p&&!k?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",A=p):typeof p=="string"?(w["Content-Type"]="text/plain",A=p):typeof FormData<"u"&&p instanceof FormData?A=p:(w["Content-Type"]="application/json",A=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?A=JSON.stringify(p):A=p;let C=g;v&&(c=new AbortController,u=setTimeout(()=>c.abort(),v),g?(C=c.signal,g.addEventListener("abort",()=>c.abort())):C=c.signal);const N=yield this.fetch(S.toString(),{method:m||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:A,signal:C}).catch(X=>{throw new uC(X)}),O=N.headers.get("x-relay-error");if(O&&O==="true")throw new fv(N);if(!N.ok)throw new mv(N);let P=((l=N.headers.get("Content-Type"))!==null&&l!==void 0?l:"text/plain").split(";")[0].trim(),J;return P==="application/json"?J=yield N.json():P==="application/octet-stream"||P==="application/pdf"?J=yield N.blob():P==="text/event-stream"?J=N:P==="multipart/form-data"?J=yield N.formData():J=yield N.text(),{data:J,error:null,response:N}}catch(d){return{data:null,error:d,response:d instanceof mv||d instanceof fv?d.context:void 0}}finally{u&&clearTimeout(u)}})}}const Gw=3,pv=n=>Math.min(1e3*2**n,3e4),hC=[520,503],Kw=["GET","HEAD","OPTIONS"];var gv=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function yv(n,e){return new Promise(s=>{if(e!=null&&e.aborted){s();return}const a=setTimeout(()=>{e==null||e.removeEventListener("abort",l),s()},n);function l(){clearTimeout(a),s()}e==null||e.addEventListener("abort",l)})}function dC(n,e,s,a){return!(!a||s>=Gw||!Kw.includes(n)||!hC.includes(e))}var fC=class{constructor(n){var e,s,a,l,u;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(s=n.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(a=n.shouldStripNulls)!==null&&a!==void 0?a:!1,this.urlLengthLimit=(l=n.urlLengthLimit)!==null&&l!==void 0?l:8e3,this.retryEnabled=(u=n.retry)!==null&&u!==void 0?u:!0,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}retry(n){return this.retryEnabled=n,this}then(n,e){var s=this;if(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"),this.shouldStripNulls){const c=this.headers.get("Accept");c==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!c||c==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const a=this.fetch;let u=(async()=>{let c=0;for(;;){const p={};s.headers.forEach((v,w)=>{p[w]=v}),c>0&&(p["X-Retry-Count"]=String(c));let g;try{g=await a(s.url.toString(),{method:s.method,headers:p,body:JSON.stringify(s.body,(v,w)=>typeof w=="bigint"?w.toString():w),signal:s.signal})}catch(v){if((v==null?void 0:v.name)==="AbortError"||(v==null?void 0:v.code)==="ABORT_ERR"||!Kw.includes(s.method))throw v;if(s.retryEnabled&&c<Gw){const w=pv(c);c++,await yv(w,s.signal);continue}throw v}if(dC(s.method,g.status,c,s.retryEnabled)){var d,m;const v=(d=(m=g.headers)===null||m===void 0?void 0:m.get("Retry-After"))!==null&&d!==void 0?d:null,w=v!==null?Math.max(0,parseInt(v,10)||0)*1e3:pv(c);await g.text(),c++,await yv(w,s.signal);continue}return await s.processResponse(g)}})();return this.shouldThrowOnError||(u=u.catch(c=>{var d;let m="",p="",g="";const v=c==null?void 0:c.cause;if(v){var w,x,S,A;const N=(w=v==null?void 0:v.message)!==null&&w!==void 0?w:"",O=(x=v==null?void 0:v.code)!==null&&x!==void 0?x:"";m=`${(S=c==null?void 0:c.name)!==null&&S!==void 0?S:"FetchError"}: ${c==null?void 0:c.message}`,m+=`
Caused by: ${(A=v==null?void 0:v.name)!==null&&A!==void 0?A:"Error"}: ${N}`,O&&(m+=` (${O})`),v!=null&&v.stack&&(m+=`
${v.stack}`)}else{var k;m=(k=c==null?void 0:c.stack)!==null&&k!==void 0?k:""}const C=this.url.toString().length;return(c==null?void 0:c.name)==="AbortError"||(c==null?void 0:c.code)==="ABORT_ERR"?(g="",p="Request was aborted (timeout or manual cancellation)",C>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${C} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((v==null?void 0:v.name)==="HeadersOverflowError"||(v==null?void 0:v.code)==="UND_ERR_HEADERS_OVERFLOW")&&(g="",p="HTTP headers exceeded server limits (typically 16KB)",C>this.urlLengthLimit&&(p+=`. Your request URL is ${C} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(d=c==null?void 0:c.name)!==null&&d!==void 0?d:"FetchError"}: ${c==null?void 0:c.message}`,details:m,hint:p,code:g},data:null,count:null,status:0,statusText:""}})),u.then(n,e)}async processResponse(n){var e=this;let s=null,a=null,l=null,u=n.status,c=n.statusText;if(n.ok){var d,m;if(e.method!=="HEAD"){var p;const w=await n.text();if(w!=="")if(e.headers.get("Accept")==="text/csv")a=w;else if(e.headers.get("Accept")&&(!((p=e.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text")))a=w;else try{a=JSON.parse(w)}catch{if(s={message:w},a=null,e.shouldThrowOnError)throw new gv({message:w,details:"",hint:"",code:""})}}const g=(d=e.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),v=(m=n.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");g&&v&&v.length>1&&(l=parseInt(v[1])),e.isMaybeSingle&&Array.isArray(a)&&(a.length>1?(s={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,l=null,u=406,c="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{const g=await n.text();try{s=JSON.parse(g),Array.isArray(s)&&n.status===404&&(a=[],s=null,u=200,c="OK")}catch{n.status===404&&g===""?(u=204,c="No Content"):s={message:g}}if(s&&e.shouldThrowOnError)throw new gv(s)}return{success:s===null,error:s,data:a,count:l,status:u,statusText:c}}returns(){return this}overrideTypes(){return this}},mC=class extends fC{throwOnError(){return super.throwOnError()}select(n){let e=!1;const s=(n??"*").split("").map(a=>/\s/.test(a)&&!e?"":(a==='"'&&(e=!e),a)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:s,foreignTable:a,referencedTable:l=a}={}){const u=l?`${l}.order`:"order",c=this.url.searchParams.get(u);return this.url.searchParams.set(u,`${c?`${c},`:""}${n}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:s=e}={}){const a=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(a,`${n}`),this}range(n,e,{foreignTable:s,referencedTable:a=s}={}){const l=typeof a>"u"?"offset":`${a}.offset`,u=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${n}`),this.url.searchParams.set(u,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:e=!1,settings:s=!1,buffers:a=!1,wal:l=!1,format:u="text"}={}){var c;const d=[n?"analyze":null,e?"verbose":null,s?"settings":null,a?"buffers":null,l?"wal":null].filter(Boolean).join("|"),m=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${u}; for="${m}"; options=${d};`),u==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const vv=new RegExp("[,()]");var ra=class extends mC{throwOnError(){return super.throwOnError()}eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){const s=Array.from(new Set(e)).map(a=>typeof a=="string"&&vv.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(n,`in.(${s})`),this}notIn(n,e){const s=Array.from(new Set(e)).map(a=>typeof a=="string"&&vv.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(n,`not.in.(${s})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:s,type:a}={}){let l="";a==="plain"?l="pl":a==="phrase"?l="ph":a==="websearch"&&(l="w");const u=s===void 0?"":`(${s})`;return this.url.searchParams.append(n,`${l}fts${u}.${e}`),this}match(n){return Object.entries(n).filter(([e,s])=>s!==void 0).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(n,e,s){return this.url.searchParams.append(n,`not.${e}.${s}`),this}or(n,{foreignTable:e,referencedTable:s=e}={}){const a=s?`${s}.or`:"or";return this.url.searchParams.append(a,`(${n})`),this}filter(n,e,s){return this.url.searchParams.append(n,`${e}.${s}`),this}},pC=class{constructor(n,{headers:e={},schema:s,fetch:a,urlLengthLimit:l=8e3,retry:u}){this.url=n,this.headers=new Headers(e),this.schema=s,this.fetch=a,this.urlLengthLimit=l,this.retry=u}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,e){const{head:s=!1,count:a}=e??{},l=s?"HEAD":"GET";let u=!1;const c=(n??"*").split("").map(p=>/\s/.test(p)&&!u?"":(p==='"'&&(u=!u),p)).join(""),{url:d,headers:m}=this.cloneRequestState();return d.searchParams.set("select",c),a&&m.append("Prefer",`count=${a}`),new ra({method:l,url:d,headers:m,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(n,{count:e,defaultToNull:s=!0}={}){var a;const l="POST",{url:u,headers:c}=this.cloneRequestState();if(e&&c.append("Prefer",`count=${e}`),s||c.append("Prefer","missing=default"),Array.isArray(n)){const d=n.reduce((m,p)=>m.concat(Object.keys(p)),[]);if(d.length>0){const m=[...new Set(d)].map(p=>`"${p}"`);u.searchParams.set("columns",m.join(","))}}return new ra({method:l,url:u,headers:c,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(n,{onConflict:e,ignoreDuplicates:s=!1,count:a,defaultToNull:l=!0}={}){var u;const c="POST",{url:d,headers:m}=this.cloneRequestState();if(m.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),a&&m.append("Prefer",`count=${a}`),l||m.append("Prefer","missing=default"),Array.isArray(n)){const p=n.reduce((g,v)=>g.concat(Object.keys(v)),[]);if(p.length>0){const g=[...new Set(p)].map(v=>`"${v}"`);d.searchParams.set("columns",g.join(","))}}return new ra({method:c,url:d,headers:m,schema:this.schema,body:n,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(n,{count:e}={}){var s;const a="PATCH",{url:l,headers:u}=this.cloneRequestState();return e&&u.append("Prefer",`count=${e}`),new ra({method:a,url:l,headers:u,schema:this.schema,body:n,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:n}={}){var e;const s="DELETE",{url:a,headers:l}=this.cloneRequestState();return n&&l.append("Prefer",`count=${n}`),new ra({method:s,url:a,headers:l,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Ur(n){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ur(n)}function gC(n,e){if(Ur(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,e);if(Ur(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yC(n){var e=gC(n,"string");return Ur(e)=="symbol"?e:e+""}function vC(n,e,s){return(e=yC(e))in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}function bv(n,e){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),s.push.apply(s,a)}return s}function wl(n){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?bv(Object(s),!0).forEach(function(a){vC(n,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):bv(Object(s)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))})}return n}var bC=class Fw{constructor(e,{headers:s={},schema:a,fetch:l,timeout:u,urlLengthLimit:c=8e3,retry:d}={}){this.url=e,this.headers=new Headers(s),this.schemaName=a,this.urlLengthLimit=c;const m=l??globalThis.fetch;u!==void 0&&u>0?this.fetch=(p,g)=>{const v=new AbortController,w=setTimeout(()=>v.abort(),u),x=g==null?void 0:g.signal;if(x){if(x.aborted)return clearTimeout(w),m(p,g);const S=()=>{clearTimeout(w),v.abort()};return x.addEventListener("abort",S,{once:!0}),m(p,wl(wl({},g),{},{signal:v.signal})).finally(()=>{clearTimeout(w),x.removeEventListener("abort",S)})}return m(p,wl(wl({},g),{},{signal:v.signal})).finally(()=>clearTimeout(w))}:this.fetch=m,this.retry=d}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new pC(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new Fw(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,s={},{head:a=!1,get:l=!1,count:u}={}){var c;let d;const m=new URL(`${this.url}/rpc/${e}`);let p;const g=x=>x!==null&&typeof x=="object"&&(!Array.isArray(x)||x.some(g)),v=a&&Object.values(s).some(g);v?(d="POST",p=s):a||l?(d=a?"HEAD":"GET",Object.entries(s).filter(([x,S])=>S!==void 0).map(([x,S])=>[x,Array.isArray(S)?`{${S.join(",")}}`:`${S}`]).forEach(([x,S])=>{m.searchParams.append(x,S)})):(d="POST",p=s);const w=new Headers(this.headers);return v?w.set("Prefer",u?`count=${u},return=minimal`:"return=minimal"):u&&w.set("Prefer",`count=${u}`),new ra({method:d,url:m,headers:w,schema:this.schemaName,body:p,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class wC{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const a=typeof global<"u"?global:void 0;if(a&&typeof a.WebSocket<"u")return{type:"native",wsConstructor:a.WebSocket};if(typeof globalThis<"u"&&typeof s.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"&&s.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const l=globalThis.process;if(l){const u=l.versions;if(u&&u.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let s=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(s+=`
Suggested solution: ${e.workaround}`),new Error(s)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const _C="2.110.2",xC=`realtime-js/${_C}`,SC="1.0.0",Yw="2.0.0",TC=Yw,EC=1e4,AC=100,Mi={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Xw={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Od={connecting:"connecting",closing:"closing",closed:"closed"};class RC{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let a=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(a))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,a;const l=(a=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&a!==void 0?a:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,l)}_encodeJsonUserBroadcastPush(e){var s,a;const l=(a=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&a!==void 0?a:{},c=new TextEncoder().encode(JSON.stringify(l)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(e,s,a){var l,u;const c=e.topic,d=(l=e.ref)!==null&&l!==void 0?l:"",m=(u=e.join_ref)!==null&&u!==void 0?u:"",p=e.payload.event,g=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(g).length===0?"":JSON.stringify(g);if(m.length>255)throw new Error(`joinRef length ${m.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`topic length ${c.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+m.length+d.length+c.length+p.length+v.length,x=new ArrayBuffer(this.HEADER_LENGTH+w);let S=new DataView(x),A=0;S.setUint8(A++,this.KINDS.userBroadcastPush),S.setUint8(A++,m.length),S.setUint8(A++,d.length),S.setUint8(A++,c.length),S.setUint8(A++,p.length),S.setUint8(A++,v.length),S.setUint8(A++,s),Array.from(m,C=>S.setUint8(A++,C.charCodeAt(0))),Array.from(d,C=>S.setUint8(A++,C.charCodeAt(0))),Array.from(c,C=>S.setUint8(A++,C.charCodeAt(0))),Array.from(p,C=>S.setUint8(A++,C.charCodeAt(0))),Array.from(v,C=>S.setUint8(A++,C.charCodeAt(0)));var k=new Uint8Array(x.byteLength+a.byteLength);return k.set(new Uint8Array(x),0),k.set(new Uint8Array(a),x.byteLength),k.buffer}decode(e,s){if(this._isArrayBuffer(e)){let a=this._binaryDecode(e);return s(a)}if(typeof e=="string"){const a=JSON.parse(e),[l,u,c,d,m]=a;return s({join_ref:l,ref:u,topic:c,event:d,payload:m})}return s({})}_binaryDecode(e){const s=new DataView(e),a=s.getUint8(0),l=new TextDecoder;switch(a){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,s,l)}}_decodeUserBroadcast(e,s,a){const l=s.getUint8(1),u=s.getUint8(2),c=s.getUint8(3),d=s.getUint8(4);let m=this.HEADER_LENGTH+4;const p=a.decode(e.slice(m,m+l));m=m+l;const g=a.decode(e.slice(m,m+u));m=m+u;const v=a.decode(e.slice(m,m+c));m=m+c;const w=e.slice(m,e.byteLength),x=d===this.JSON_ENCODING?JSON.parse(a.decode(w)):w,S={type:this.BROADCAST_EVENT,event:g,payload:x};return c>0&&(S.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:S}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([a])=>s.includes(a)))}}var $e;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})($e||($e={}));const wv=(n,e,s={})=>{var a;const l=(a=s.skipTypes)!==null&&a!==void 0?a:[];return e?Object.keys(e).reduce((u,c)=>(u[c]=CC(c,n,e,l),u),{}):{}},CC=(n,e,s,a)=>{const l=e.find(d=>d.name===n),u=l==null?void 0:l.type,c=s[n];return u&&!a.includes(u)?Jw(u,c):Nd(c)},Jw=(n,e)=>{if(n.charAt(0)==="_"){const s=n.slice(1,n.length);return NC(e,s)}switch(n){case $e.bool:return kC(e);case $e.float4:case $e.float8:case $e.int2:case $e.int4:case $e.int8:case $e.numeric:case $e.oid:return jC(e);case $e.json:case $e.jsonb:return OC(e);case $e.timestamp:return DC(e);case $e.abstime:case $e.date:case $e.daterange:case $e.int4range:case $e.int8range:case $e.money:case $e.reltime:case $e.text:case $e.time:case $e.timestamptz:case $e.timetz:case $e.tsrange:case $e.tstzrange:return Nd(e);default:return Nd(e)}},Nd=n=>n,kC=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},jC=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},OC=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},NC=(n,e)=>{if(typeof n!="string")return n;const s=n.length-1,a=n[s];if(n[0]==="{"&&a==="}"){let u;const c=n.slice(1,s);try{u=JSON.parse("["+c+"]")}catch{u=c?c.split(","):[]}return u.map(d=>Jw(e,d))}return n},DC=n=>typeof n=="string"?n.replace(" ","T"):n,Qw=n=>{const e=new URL(n);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Ar=n=>typeof n=="function"?n:function(){return n},MC=typeof self<"u"?self:null,oa=typeof window<"u"?window:null,jn=MC||oa||globalThis,UC="2.0.0",BC=1e4,LC=1e3,Nn={connecting:0,open:1,closing:2,closed:3},Mt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},si={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Dd={longpoll:"longpoll",websocket:"websocket"},zC={complete:4},Md="base64url.bearer.phx.",_l=class{constructor(n,e,s,a){this.channel=n,this.event=e,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=a,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(n){this.timeout=n,this.reset(),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()}))}receive(n,e){return this.hasReceived(n)&&e(this.receivedResp.response),this.recHooks.push({status:n,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:n,response:e,_ref:s}){this.recHooks.filter(a=>a.status===n).forEach(a=>a.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,n=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=n,this.matchReceive(n)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(n){return this.receivedResp&&this.receivedResp.status===n}trigger(n,e){this.channel.trigger(this.refEvent,{status:n,response:e})}},Zw=class{constructor(n,e){this.callback=n,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},VC=class{constructor(n,e,s){this.state=Mt.closed,this.topic=n,this.params=Ar(e||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new _l(this,si.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Zw(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Mt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this.joinPush.receive("error",a=>{this.state=Mt.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,a),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Mt.closed,this.socket.remove(this)}),this.onError(a=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,a),this.isJoining()&&this.joinPush.reset(),this.state=Mt.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new _l(this,si.leave,Ar({}),this.timeout).send(),this.state=Mt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(si.reply,(a,l)=>{this.trigger(this.replyEventName(l),a)})}join(n=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=n,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(n=>n.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Mt.closed,this.bindings=[]}onClose(n){this.on(si.close,n)}onError(n){return this.on(si.error,e=>n(e))}on(n,e){let s=this.bindingRef++;return this.bindings.push({event:n,ref:s,callback:e}),s}off(n,e){this.bindings=this.bindings.filter(s=>!(s.event===n&&(typeof e>"u"||e===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(n,e,s=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${n}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let a=new _l(this,n,function(){return e},s);return this.canPush()?a.send():(a.startTimeout(),this.pushBuffer.push(a)),a}leave(n=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Mt.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(si.close,"leave")},s=new _l(this,si.leave,Ar({}),n);return s.receive("ok",()=>e()).receive("timeout",()=>e()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(n,e,s){return e}filterBindings(n,e,s){return!0}isMember(n,e,s,a){return this.topic!==n?!1:a&&a!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:n,event:e,payload:s,joinRef:a}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(n=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Mt.joining,this.joinPush.resend(n))}trigger(n,e,s,a){let l=this.onMessage(n,e,s,a);if(e&&!l)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let u=this.bindings.filter(c=>c.event===n&&this.filterBindings(c,e,s));for(let c=0;c<u.length;c++)u[c].callback(l,s,a||this.joinRef())}replyEventName(n){return`chan_reply_${n}`}isClosed(){return this.state===Mt.closed}isErrored(){return this.state===Mt.errored}isJoined(){return this.state===Mt.joined}isJoining(){return this.state===Mt.joining}isLeaving(){return this.state===Mt.leaving}},Xl=class{static request(n,e,s,a,l,u,c){if(jn.XDomainRequest){let d=new jn.XDomainRequest;return this.xdomainRequest(d,n,e,a,l,u,c)}else if(jn.XMLHttpRequest){let d=new jn.XMLHttpRequest;return this.xhrRequest(d,n,e,s,a,l,u,c)}else{if(jn.fetch&&jn.AbortController)return this.fetchRequest(n,e,s,a,l,u,c);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(n,e,s,a,l,u,c){let d={method:n,headers:s,body:a},m=null;return l&&(m=new AbortController,setTimeout(()=>m.abort(),l),d.signal=m.signal),jn.fetch(e,d).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>c&&c(p)).catch(p=>{p.name==="AbortError"&&u?u():c&&c(null)}),m}static xdomainRequest(n,e,s,a,l,u,c){return n.timeout=l,n.open(e,s),n.onload=()=>{let d=this.parseJSON(n.responseText);c&&c(d)},u&&(n.ontimeout=u),n.onprogress=()=>{},n.send(a),n}static xhrRequest(n,e,s,a,l,u,c,d){n.open(e,s,!0),n.timeout=u;for(let[m,p]of Object.entries(a))n.setRequestHeader(m,p);return n.onerror=()=>d&&d(null),n.onreadystatechange=()=>{if(n.readyState===zC.complete&&d){let m=this.parseJSON(n.responseText);d(m)}},c&&(n.ontimeout=c),n.send(l),n}static parseJSON(n){if(!n||n==="")return null;try{return JSON.parse(n)}catch{return console&&console.log("failed to parse JSON response",n),null}}static serialize(n,e){let s=[];for(var a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=e?`${e}[${a}]`:a,u=n[a];typeof u=="object"?s.push(this.serialize(u,l)):s.push(encodeURIComponent(l)+"="+encodeURIComponent(u))}return s.join("&")}static appendParams(n,e){if(Object.keys(e).length===0)return n;let s=n.match(/\?/)?"&":"?";return`${n}${s}${this.serialize(e)}`}},PC=n=>{let e="",s=new Uint8Array(n),a=s.byteLength;for(let l=0;l<a;l++)e+=String.fromCharCode(s[l]);return btoa(e)},ea=class{constructor(n,e){e&&e.length===2&&e[1].startsWith(Md)&&(this.authToken=atob(e[1].slice(Md.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(n),this.readyState=Nn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(n){return n.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Dd.websocket),"$1/"+Dd.longpoll)}endpointURL(){return Xl.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(n,e,s){this.close(n,e,s),this.readyState=Nn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Nn.open||this.readyState===Nn.connecting}poll(){const n={Accept:"application/json"};this.authToken&&(n["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",n,null,()=>this.ontimeout(),e=>{if(e){var{status:s,token:a,messages:l}=e;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=a}else s=0;switch(s){case 200:l.forEach(u=>{setTimeout(()=>this.onmessage({data:u}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Nn.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(n){typeof n!="string"&&(n=PC(n)),this.currentBatch?this.currentBatch.push(n):this.awaitingBatchAck?this.batchBuffer.push(n):(this.currentBatch=[n],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(n){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},n.join(`
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(n,e,s){for(let l of this.reqs)l.abort();this.readyState=Nn.closed;let a=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:n,reason:e,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",a)):this.onclose(a)}ajax(n,e,s,a,l){let u,c=()=>{this.reqs.delete(u),a()};u=Xl.request(n,this.endpointURL(),e,s,this.timeout,c,d=>{this.reqs.delete(u),this.isActive()&&l(d)}),this.reqs.add(u)}},HC=class br{constructor(e,s={}){let a=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(a.state,l=>{let{onJoin:u,onLeave:c,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=br.syncState(this.state,l,u,c),this.pendingDiffs.forEach(m=>{this.state=br.syncDiff(this.state,m,u,c)}),this.pendingDiffs=[],d()}),this.channel.on(a.diff,l=>{let{onJoin:u,onLeave:c,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(l):(this.state=br.syncDiff(this.state,l,u,c),d())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return br.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,s,a,l){let u=this.clone(e),c={},d={};return this.map(u,(m,p)=>{s[m]||(d[m]=p)}),this.map(s,(m,p)=>{let g=u[m];if(g){let v=p.metas.map(A=>A.phx_ref),w=g.metas.map(A=>A.phx_ref),x=p.metas.filter(A=>w.indexOf(A.phx_ref)<0),S=g.metas.filter(A=>v.indexOf(A.phx_ref)<0);x.length>0&&(c[m]=p,c[m].metas=x),S.length>0&&(d[m]=this.clone(g),d[m].metas=S)}else c[m]=p}),this.syncDiff(u,{joins:c,leaves:d},a,l)}static syncDiff(e,s,a,l){let{joins:u,leaves:c}=this.clone(s);return a||(a=function(){}),l||(l=function(){}),this.map(u,(d,m)=>{let p=e[d];if(e[d]=this.clone(m),p){let g=e[d].metas.map(w=>w.phx_ref),v=p.metas.filter(w=>g.indexOf(w.phx_ref)<0);e[d].metas.unshift(...v)}a(d,p,m)}),this.map(c,(d,m)=>{let p=e[d];if(!p)return;let g=m.metas.map(v=>v.phx_ref);p.metas=p.metas.filter(v=>g.indexOf(v.phx_ref)<0),l(d,p,m),p.metas.length===0&&delete e[d]}),e}static list(e,s){return s||(s=function(a,l){return l}),this.map(e,(a,l)=>s(a,l))}static map(e,s){return Object.getOwnPropertyNames(e).map(a=>s(a,e[a]))}static clone(e){return JSON.parse(JSON.stringify(e))}},xl={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(n,e){if(n.payload.constructor===ArrayBuffer)return e(this.binaryEncode(n));{let s=[n.join_ref,n.ref,n.topic,n.event,n.payload];return e(JSON.stringify(s))}},decode(n,e){if(n.constructor===ArrayBuffer)return e(this.binaryDecode(n));{let[s,a,l,u,c]=JSON.parse(n);return e({join_ref:s,ref:a,topic:l,event:u,payload:c})}},binaryEncode(n){let{join_ref:e,ref:s,event:a,topic:l,payload:u}=n,c=this.META_LENGTH+e.length+s.length+l.length+a.length,d=new ArrayBuffer(this.HEADER_LENGTH+c),m=new DataView(d),p=0;m.setUint8(p++,this.KINDS.push),m.setUint8(p++,e.length),m.setUint8(p++,s.length),m.setUint8(p++,l.length),m.setUint8(p++,a.length),Array.from(e,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(s,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(l,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(a,v=>m.setUint8(p++,v.charCodeAt(0)));var g=new Uint8Array(d.byteLength+u.byteLength);return g.set(new Uint8Array(d),0),g.set(new Uint8Array(u),d.byteLength),g.buffer},binaryDecode(n){let e=new DataView(n),s=e.getUint8(0),a=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(n,e,a);case this.KINDS.reply:return this.decodeReply(n,e,a);case this.KINDS.broadcast:return this.decodeBroadcast(n,e,a)}},decodePush(n,e,s){let a=e.getUint8(1),l=e.getUint8(2),u=e.getUint8(3),c=this.HEADER_LENGTH+this.META_LENGTH-1,d=s.decode(n.slice(c,c+a));c=c+a;let m=s.decode(n.slice(c,c+l));c=c+l;let p=s.decode(n.slice(c,c+u));c=c+u;let g=n.slice(c,n.byteLength);return{join_ref:d,ref:null,topic:m,event:p,payload:g}},decodeReply(n,e,s){let a=e.getUint8(1),l=e.getUint8(2),u=e.getUint8(3),c=e.getUint8(4),d=this.HEADER_LENGTH+this.META_LENGTH,m=s.decode(n.slice(d,d+a));d=d+a;let p=s.decode(n.slice(d,d+l));d=d+l;let g=s.decode(n.slice(d,d+u));d=d+u;let v=s.decode(n.slice(d,d+c));d=d+c;let w=n.slice(d,n.byteLength),x={status:v,response:w};return{join_ref:m,ref:p,topic:g,event:si.reply,payload:x}},decodeBroadcast(n,e,s){let a=e.getUint8(1),l=e.getUint8(2),u=this.HEADER_LENGTH+2,c=s.decode(n.slice(u,u+a));u=u+a;let d=s.decode(n.slice(u,u+l));u=u+l;let m=n.slice(u,n.byteLength);return{join_ref:null,ref:null,topic:c,event:d,payload:m}}},$C=class{constructor(n,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||BC,this.transport=e.transport||jn.WebSocket||ea,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=jn&&jn.sessionStorage}catch{}this.sessionStore=e.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=xl.encode.bind(xl),this.defaultDecoder=xl.decode.bind(xl),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==ea?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let a=null;oa&&oa.addEventListener&&(oa.addEventListener("pagehide",l=>{this.conn&&(this.disconnect(),a=this.connectClock)}),oa.addEventListener("pageshow",l=>{a===this.connectClock&&(a=null,this.connect())}),oa.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=l=>e.rejoinAfterMs?e.rejoinAfterMs(l):[1e3,2e3,5e3][l-1]||1e4,this.reconnectAfterMs=l=>e.reconnectAfterMs?e.reconnectAfterMs(l):[10,50,100,150,200,250,500,1e3,2e3][l-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(l,u,c)=>{console.log(`${l}: ${u}`,c)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Ar(e.params||{}),this.endPoint=`${n}/${Dd.websocket}`,this.vsn=e.vsn||UC,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Zw(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return ea}replaceTransport(n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=n}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let n=Xl.appendParams(Xl.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return n.charAt(0)!=="/"?n:n.charAt(1)==="/"?`${this.protocol()}:${n}`:`${this.protocol()}://${location.host}${n}`}disconnect(n,e,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,n&&n()},e,s)}connect(n){n&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Ar(n)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ea?this.connectWithFallback(ea,this.longPollFallbackMs):this.transportConnect())}log(n,e,s){this.logger&&this.logger(n,e,s)}hasLogger(){return this.logger!==null}onOpen(n){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,n]),e}onClose(n){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,n]),e}onError(n){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,n]),e}onMessage(n){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,n]),e}onHeartbeat(n){this.heartbeatCallback=n}ping(n){if(!this.isConnected())return!1;let e=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let a=this.onMessage(l=>{l.ref===e&&(this.off([a]),n(Date.now()-s))});return!0}transportName(n){switch(n){case ea:return"LongPoll";default:return n.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let n;this.authToken&&(n=["phoenix",`${Md}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),n),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(n){return this.sessionStore&&this.sessionStore.getItem(n)}storeSession(n,e){this.sessionStore&&this.sessionStore.setItem(n,e)}connectWithFallback(n,e=2500){clearTimeout(this.fallbackTimer);let s=!1,a=!0,l,u,c=this.transportName(n),d=m=>{this.log("transport",`falling back to ${c}...`,m),this.off([l,u]),a=!1,this.replaceTransport(n),this.transportConnect()};if(this.getSession(`phx:fallback:${c}`))return d("memorized");this.fallbackTimer=setTimeout(d,e),u=this.onError(m=>{this.log("transport","error",m),a&&!s&&(clearTimeout(this.fallbackTimer),d(m))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!a){let m=this.transportName(n);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${m}`,"true"),this.log("transport",`established ${m} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(d,e),this.ping(m=>{this.log("transport","connected to primary after",m),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&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.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),LC,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(n,e,s){if(!this.conn)return n&&n();const a=this.conn;this.waitForBufferDone(a,()=>{e?a.close(e,s||""):a.close(),this.waitForSocketClosed(a,()=>{this.conn===a&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),n&&n()})})}waitForBufferDone(n,e,s=1){if(s===5||!n.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(n,e,s+1)},150*s)}waitForSocketClosed(n,e,s=1){if(s===5||n.readyState===Nn.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(n,e,s+1)},150*s)}onConnClose(n){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",n),this.triggerChanError(n),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",n)}onConnError(n){this.hasLogger()&&this.log("transport","error",n);let e=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",n,e,s),(e===this.transport||s>0)&&this.triggerChanError(n)}triggerChanError(n){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(si.error,n)})}connectionState(){switch(this.conn&&this.conn.readyState){case Nn.connecting:return"connecting";case Nn.open:return"open";case Nn.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(n){this.off(n.stateChangeRefs),this.channels=this.channels.filter(e=>e!==n)}off(n){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([s])=>n.indexOf(s)===-1)}channel(n,e={}){let s=new VC(n,e,this);return this.channels.push(s),s}push(n){if(this.hasLogger()){let{topic:e,event:s,payload:a,ref:l,join_ref:u}=n;this.log("push",`${e} ${s} (${u}, ${l})`,a)}this.isConnected()?this.encode(n,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(n,e=>this.conn.send(e)))}makeRef(){let n=this.ref+1;return n===this.ref?this.ref=0:this.ref=n,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),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.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(n=>n()),this.sendBuffer=[])}onConnMessage(n){this.decode(n.data,e=>{let{topic:s,event:a,payload:l,ref:u,join_ref:c}=e;if(u&&u===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(l.status==="ok"?"ok":"error",d)}catch(m){this.log("error","error in heartbeat callback",m)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${l.status||""} ${s} ${a} ${u&&"("+u+")"||""}`.trim(),l);for(let d=0;d<this.channels.length;d++){const m=this.channels[d];m.isMember(s,a,l,c)&&m.trigger(a,l,u,c)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(n,...e){try{this.stateChangeCallbacks[n].forEach(([s,a])=>{try{a(...e)}catch(l){this.log("error",`error in ${n} callback`,l)}})}catch(s){this.log("error",`error triggering ${n} callbacks`,s)}}leaveOpenTopic(n){let e=this.channels.find(s=>s.topic===n&&(s.isJoined()||s.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${n}"`),e.leave())}};class Rr{constructor(e,s){const a=IC(s);this.presence=new HC(e.getChannel(),a),this.presence.onJoin((l,u,c)=>{const d=Rr.onJoinPayload(l,u,c);e.getChannel().trigger("presence",d)}),this.presence.onLeave((l,u,c)=>{const d=Rr.onLeavePayload(l,u,c);e.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rr.transformState(this.presence.state)}static transformState(e){return e=qC(e),Object.getOwnPropertyNames(e).reduce((s,a)=>{const l=e[a];return s[a]=zl(l),s},{})}static onJoinPayload(e,s,a){const l=_v(s),u=zl(a);return{event:"join",key:e,currentPresences:l,newPresences:u}}static onLeavePayload(e,s,a){const l=_v(s),u=zl(a);return{event:"leave",key:e,currentPresences:l,leftPresences:u}}}function zl(n){return n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function qC(n){return JSON.parse(JSON.stringify(n))}function IC(n){return(n==null?void 0:n.events)&&{events:n.events}}function _v(n){return n!=null&&n.metas?zl(n):[]}var xv;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(xv||(xv={}));class GC{get state(){return this.presenceAdapter.state}constructor(e,s){this.channel=e,this.presenceAdapter=new Rr(this.channel.channelAdapter,s)}}function KC(n){if(n instanceof Error)return n;if(typeof n=="string")return new Error(n);if(n&&typeof n=="object"){const e=n;if(typeof e.code=="number"){const s=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${s}`,{cause:n})}return new Error("channel error: transport failure",{cause:n})}return new Error("channel error: connection lost")}class FC{constructor(e,s,a){const l=YC(a);this.channel=e.getSocket().channel(s,l),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,s){return this.channel.on(e,s)}off(e,s){this.channel.off(e,s)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,s,a){let l;try{l=this.channel.push(e,s,a)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>AC){const u=this.channel.pushBuffer.shift();u.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${u.event}`,u.payload())}return l}updateJoinPayload(e){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),e)}canPush(){return this.socket.isConnected()&&this.state===Mi.joined}isJoined(){return this.state===Mi.joined}isJoining(){return this.state===Mi.joining}isClosed(){return this.state===Mi.closed}isLeaving(){return this.state===Mi.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function YC(n){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config)}}const XC=/[,()"\\]/,JC=n=>XC.test(n)||n!==n.trim(),QC=n=>`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Sv=n=>{const e=n===null?"null":String(n);return JC(e)?QC(e):e},ZC=n=>n===null?"null":String(n),WC=(n,e)=>{if(n==="in"){const s=Array.isArray(e)?e:[e];if(s.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(s)).map(l=>Sv(l)).join(",")})`}return n==="is"?`is.${ZC(e)}`:`${n}.${Sv(e)}`};class ek{constructor(){this.filters=[]}add(e,s,a,l=!1){const u=l?"not.":"";return this.filters.push(`${e}=${u}${WC(s,a)}`),this}eq(e,s){return this.add(e,"eq",s)}neq(e,s){return this.add(e,"neq",s)}gt(e,s){return this.add(e,"gt",s)}gte(e,s){return this.add(e,"gte",s)}lt(e,s){return this.add(e,"lt",s)}lte(e,s){return this.add(e,"lte",s)}in(e,s){return this.add(e,"in",s)}like(e,s){return this.add(e,"like",s)}ilike(e,s){return this.add(e,"ilike",s)}match(e,s){return this.add(e,"match",s)}imatch(e,s){return this.add(e,"imatch",s)}is(e,s){return this.add(e,"is",s)}isDistinct(e,s){return this.add(e,"isdistinct",s)}not(e,s,a){return this.add(e,s,a,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var Tv;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Tv||(Tv={}));var da;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(da||(da={}));var ai;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(ai||(ai={}));class Cr{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,s={config:{}},a){var l,u;if(this.topic=e,this.params=s,this.socket=a,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new FC(this.socket.socketAdapter,e,this.params),this.presence=new GC(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Qw(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((u=(l=this.params.config)===null||l===void 0?void 0:l.broadcast)===null||u===void 0)&&u.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,s=this.timeout){var a,l,u;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:c,presence:d,private:m}}=this.params,p=(l=(a=this.bindings.postgres_changes)===null||a===void 0?void 0:a.map(x=>x.filter))!==null&&l!==void 0?l:[],g=!!this.bindings[da.PRESENCE]&&this.bindings[da.PRESENCE].length>0||((u=this.params.config.presence)===null||u===void 0?void 0:u.enabled)===!0,v={},w={broadcast:c,presence:Object.assign(Object.assign({},d),{enabled:g}),postgres_changes:p,private:m};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(x=>{e==null||e(ai.CHANNEL_ERROR,KC(x))}),this._onClose(()=>e==null?void 0:e(ai.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:x})=>{if(this.socket._isManualToken()||this.socket.setAuth(),x===void 0){e==null||e(ai.SUBSCRIBED);return}this._updatePostgresBindings(x,e)}).receive("error",x=>{this.state=Mi.errored;const S=Object.values(x).join(", ")||"error";e==null||e(ai.CHANNEL_ERROR,new Error(S,{cause:x}))}).receive("timeout",()=>{e==null||e(ai.TIMED_OUT)})}return this}_updatePostgresBindings(e,s){var a;const l=this.bindings.postgres_changes,u=(a=l==null?void 0:l.length)!==null&&a!==void 0?a:0,c=[];for(let d=0;d<u;d++){const m=l[d],{filter:{event:p,schema:g,table:v,filter:w}}=m,x=e&&e[d];if(x&&x.event===p&&Cr.isFilterValueEqual(x.schema,g)&&Cr.isFilterValueEqual(x.table,v)&&Cr.isFilterValueEqual(x.filter,w))c.push(Object.assign(Object.assign({},m),{id:x.id}));else{this.unsubscribe(),this.state=Mi.errored,s==null||s(ai.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=c,this.state!=Mi.errored&&s&&s(ai.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,a){const l=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),u=e===da.PRESENCE||e===da.POSTGRES_CHANGES;if(l&&u)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,s,a)}async httpSend(e,s,a={}){var l;if(s==null)return Promise.reject(new Error("Payload is required for httpSend()"));const u=s instanceof ArrayBuffer||ArrayBuffer.isView(s),c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":u?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d=new URL(this.broadcastEndpointURL);d.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&d.searchParams.set("private","true");const m={method:"POST",headers:c,body:u?s:JSON.stringify(s)},p=await this._fetchWithTimeout(d.toString(),m,(l=a.timeout)!==null&&l!==void 0?l:this.timeout);if(p.status===202)return{success:!0};if(p.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let g=p.statusText;try{const v=await p.json();g=v.error||v.message||g}catch{}return Promise.reject(new Error(g))}async send(e,s={}){var a,l;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:u,payload:c}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:u,payload:c,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,m,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);return await((l=p.body)===null||l===void 0?void 0:l.cancel()),p.ok?"ok":"error"}catch(p){return p instanceof Error&&p.name==="AbortError"?"timed out":"error"}}else return new Promise(u=>{var c,d,m;const p=this.channelAdapter.push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((m=(d=(c=this.params)===null||c===void 0?void 0:c.config)===null||d===void 0?void 0:d.broadcast)===null||m===void 0)&&m.ack)&&u("ok"),p.receive("ok",()=>u("ok")),p.receive("error",()=>u("error")),p.receive("timeout",()=>u("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(s=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,s,a){const l=new AbortController,u=setTimeout(()=>l.abort(),a),c=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:l.signal}));return clearTimeout(u),c}_on(e,s,a){const l=e.toLocaleLowerCase(),u=s==null?void 0:s.filter;(u instanceof ek||typeof u=="object"&&u!==null&&typeof u.build=="function")&&(s=Object.assign(Object.assign({},s),{filter:u.build()}));const c=this.channelAdapter.on(e,a),d={type:l,filter:s,callback:a,ref:c};return this.bindings[l]?this.bindings[l].push(d):this.bindings[l]=[d],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,s,a)=>{var l,u,c,d,m,p,g;const v=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(v,a))return!1;const w=(l=this.bindings[v])===null||l===void 0?void 0:l.find(x=>x.ref===e.ref);if(!w)return!0;if(["broadcast","presence","postgres_changes"].includes(v))if("id"in w){const x=w.id,S=(u=w.filter)===null||u===void 0?void 0:u.event;return x&&((c=s.ids)===null||c===void 0?void 0:c.includes(x))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((d=s.data)===null||d===void 0?void 0:d.type.toLocaleLowerCase()))}else{const x=(p=(m=w==null?void 0:w.filter)===null||m===void 0?void 0:m.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return x==="*"||x===((g=s==null?void 0:s.event)===null||g===void 0?void 0:g.toLocaleLowerCase())}else return w.type.toLocaleLowerCase()===v})}_notThisChannelEvent(e,s){const{close:a,error:l,leave:u,join:c}=Xw;return s&&[a,l,u,c].includes(e)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,s,a)=>{if(typeof s=="object"&&"ids"in s){const l=s.data,{schema:u,table:c,commit_timestamp:d,type:m,errors:p}=l;return Object.assign(Object.assign({},{schema:u,table:c,commit_timestamp:d,eventType:m,new:{},old:{},errors:p}),this._getPayloadRecords(l))}return s})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in e.bindings)for(const a of e.bindings[s])this._on(a.type,a.filter,a.callback)}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=wv(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=wv(e.columns,e.old_record)),s}}class tk{constructor(e,s){this.socket=new $C(e,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,s,a,l=1e4){return new Promise(u=>{setTimeout(()=>u("timeout"),l),this.socket.disconnect(()=>{e(),u("ok")},s,a)})}push(e){this.socket.push(e)}log(e,s,a){this.socket.log(e,s,a)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Od.connecting}isDisconnecting(){return this.socket.connectionState()==Od.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Ev={HEARTBEAT_INTERVAL:25e3},nk=[1e3,2e3,5e3,1e4],ik=1e4;function sk(){const n=new Map;return{get length(){return n.size},clear(){n.clear()},getItem(e){return n.has(e)?n.get(e):null},key(e){var s;return(s=Array.from(n.keys())[e])!==null&&s!==void 0?s:null},removeItem(e){n.delete(e)},setItem(e,s){n.set(e,String(s))}}}function ak(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return sk()}const rk=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class ok{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,s){var a;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new RC,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=u=>u?(...c)=>u(...c):(...c)=>fetch(...c),!(!((a=s==null?void 0:s.params)===null||a===void 0)&&a.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey;const l=this._initializeOptions(s);this.socketAdapter=new tk(e,l),this.httpEndpoint=Qw(e),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const s=e.message;throw new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,s)}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return s==="ok"&&e.teardown(),s}async removeAllChannels(){const e=this.channels.map(async a=>{const l=await a.unsubscribe();return a.teardown(),l}),s=await Promise.all(e);return await this.disconnect(),s}log(e,s,a){this.socketAdapter.log(e,s,a)}connectionState(){return this.socketAdapter.connectionState()||Od.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,s={config:{}}){const a=`realtime:${e}`,l=this.getChannels().find(u=>u.topic===a);if(l)return l;{const u=new Cr(`realtime:${e}`,s,this);return this._cancelPendingDisconnect(),this.channels.push(u),u}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let s,a=!1;if(e)s=e,a=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(l){this.log("error","Error fetching access token from callback",l),s=this.accessTokenValue}else s=this.accessTokenValue;a?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(l=>{const u={access_token:s,version:xC};s&&l.updateJoinPayload(u),l.joinedOnce&&l.channelAdapter.isJoined()&&l.channelAdapter.push(Xw.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(s,a)=>{s!=="disconnected"&&(s=="sent"&&this._setAuthSafely(),e&&e(s,a))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let s;if(e)s=e;else{const a=new Blob([rk],{type:"application/javascript"});s=URL.createObjectURL(a)}return s}_initializeOptions(e){var s,a,l,u,c,d,m,p,g,v,w,x;this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null;const S={};S.timeout=(l=e==null?void 0:e.timeout)!==null&&l!==void 0?l:EC,S.heartbeatIntervalMs=(u=e==null?void 0:e.heartbeatIntervalMs)!==null&&u!==void 0?u:Ev.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(c=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&c!==void 0?c:2*((d=e==null?void 0:e.heartbeatIntervalMs)!==null&&d!==void 0?d:Ev.HEARTBEAT_INTERVAL),S.transport=(m=e==null?void 0:e.transport)!==null&&m!==void 0?m:wC.getWebSocketConstructor(),S.params=e==null?void 0:e.params,S.logger=e==null?void 0:e.logger,S.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),S.sessionStorage=(p=e==null?void 0:e.sessionStorage)!==null&&p!==void 0?p:ak(),S.reconnectAfterMs=(g=e==null?void 0:e.reconnectAfterMs)!==null&&g!==void 0?g:(N=>nk[N-1]||ik);let A,k;const C=(v=e==null?void 0:e.vsn)!==null&&v!==void 0?v:TC;switch(C){case SC:A=(N,O)=>O(JSON.stringify(N)),k=(N,O)=>O(JSON.parse(N));break;case Yw:A=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${S.vsn}`)}if(S.vsn=C,S.encode=(w=e==null?void 0:e.encode)!==null&&w!==void 0?w:A,S.decode=(x=e==null?void 0:e.decode)!==null&&x!==void 0?x:k,S.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,S.params=Object.assign(Object.assign({},S.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,S.autoSendHeartbeat=!this.worker}return S}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Br=class extends Error{constructor(n,e){var s;super(n),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((s=e.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function lk(n,e,s){const a=new URL(e,n);if(s)for(const[l,u]of Object.entries(s))u!==void 0&&a.searchParams.set(l,u);return a.toString()}async function uk(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function ck(n){const e=n.fetchImpl??globalThis.fetch;return{async request({method:s,path:a,query:l,body:u,headers:c}){const d=lk(n.baseUrl,a,l),m=await uk(n.auth),p=await e(d,{method:s,headers:{...u?{"Content-Type":"application/json"}:{},...m,...c},body:u?JSON.stringify(u):void 0}),g=await p.text(),v=(p.headers.get("content-type")||"").includes("application/json"),w=v&&g?JSON.parse(g):g;if(!p.ok){const x=v?w:void 0,S=x==null?void 0:x.error;throw new Br((S==null?void 0:S.message)??`Request failed with status ${p.status}`,{status:p.status,icebergType:S==null?void 0:S.type,icebergCode:S==null?void 0:S.code,details:x})}return{status:p.status,headers:p.headers,data:w}}}}function Sl(n){return n.join("")}var hk=class{constructor(n,e=""){this.client=n,this.prefix=e}async listNamespaces(n){const e=n?{parent:Sl(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(a=>({namespace:a}))}async createNamespace(n,e){const s={namespace:n.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Sl(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Sl(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Sl(n.namespace)}`}),!0}catch(e){if(e instanceof Br&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(n,e){try{return await this.createNamespace(n,e)}catch(s){if(s instanceof Br&&s.status===409)return;throw s}}};function ta(n){return n.join("")}var dk=class{constructor(n,e="",s){this.client=n,this.prefix=e,this.accessDelegation=s}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables`})).data.identifiers}async createTable(n,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(n,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables/${n.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(n,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(n){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables/${n.name}`,headers:e})).data.metadata}async tableExists(n){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ta(n.namespace)}/tables/${n.name}`,headers:e}),!0}catch(s){if(s instanceof Br&&s.status===404)return!1;throw s}}async createTableIfNotExists(n,e){try{return await this.createTable(n,e)}catch(s){if(s instanceof Br&&s.status===409)return await this.loadTable({namespace:n.namespace,name:e.name});throw s}}},fk=class{constructor(n){var a;let e="v1";n.catalogName&&(e+=`/${n.catalogName}`);const s=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=ck({baseUrl:s,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=(a=n.accessDelegation)==null?void 0:a.join(","),this.namespaceOps=new hk(this.client,e),this.tableOps=new dk(this.client,e,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,e){return this.namespaceOps.createNamespace(n,e)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,e){return this.tableOps.createTable(n,e)}async updateTable(n,e){return this.tableOps.updateTable(n,e)}async dropTable(n,e){await this.tableOps.dropTable(n,e)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,e){return this.namespaceOps.createNamespaceIfNotExists(n,e)}async createTableIfNotExists(n,e){return this.tableOps.createTableIfNotExists(n,e)}};function Lr(n){"@babel/helpers - typeof";return Lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lr(n)}function mk(n,e){if(Lr(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,e);if(Lr(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function pk(n){var e=mk(n,"string");return Lr(e)=="symbol"?e:e+""}function gk(n,e,s){return(e=pk(e))in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}function Av(n,e){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),s.push.apply(s,a)}return s}function fe(n){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Av(Object(s),!0).forEach(function(a){gk(n,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):Av(Object(s)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))})}return n}var uu=class extends Error{constructor(n,e="storage",s,a){super(n),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function cu(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var Ud=class extends uu{constructor(n,e,s,a="storage"){super(n,a,e,s),this.name=a==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=s}toJSON(){return fe({},super.toJSON())}},Ww=class extends uu{constructor(n,e,s="storage"){super(n,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Jl(n,e,s){const a=fe({},n),l=e.toLowerCase();for(const u of Object.keys(a))u.toLowerCase()===l&&delete a[u];return a[l]=s,a}function yk(n){const e={};for(const[s,a]of Object.entries(n))e[s.toLowerCase()]=a;return e}const vk=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),bk=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Bd=n=>{if(Array.isArray(n))return n.map(s=>Bd(s));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([s,a])=>{const l=s.replace(/([-_][a-z])/gi,u=>u.toUpperCase().replace(/[-_]/g,""));e[l]=Bd(a)}),e},wk=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n),Rv=n=>{if(typeof n=="object"&&n!==null){const e=n;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const s=e.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(n)},_k=async(n,e,s,a)=>{if(n!==null&&typeof n=="object"&&"json"in n&&typeof n.json=="function"){const l=n;let u=parseInt(String(l.status),10);Number.isFinite(u)||(u=500),l.json().then(c=>{const d=(c==null?void 0:c.statusCode)||(c==null?void 0:c.code)||u+"";e(new Ud(Rv(c),u,d,a))}).catch(()=>{const c=u+"";e(new Ud(l.statusText||`HTTP ${u} error`,u,c,a))})}else e(new Ww(Rv(n),n,a))},xk=(n,e,s,a)=>{const l={method:n,headers:(e==null?void 0:e.headers)||{}};if(n==="GET"||n==="HEAD"||!a)return fe(fe({},l),s);if(bk(a)){var u;const c=(e==null?void 0:e.headers)||{};let d;for(const[m,p]of Object.entries(c))m.toLowerCase()==="content-type"&&(d=p);l.headers=Jl(c,"Content-Type",(u=d)!==null&&u!==void 0?u:"application/json"),l.body=JSON.stringify(a)}else l.body=a;return e!=null&&e.duplex&&(l.duplex=e.duplex),fe(fe({},l),s)};async function gr(n,e,s,a,l,u,c){return new Promise((d,m)=>{n(s,xk(e,a,l,u)).then(p=>{if(!p.ok)throw p;if(a!=null&&a.noResolveJson)return p;if(c==="vectors"){const g=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!g||!g.includes("application/json"))return{}}return p.json()}).then(p=>d(p)).catch(p=>_k(p,m,a,c))})}function e_(n="storage"){return{get:async(e,s,a,l)=>gr(e,"GET",s,a,l,void 0,n),post:async(e,s,a,l,u)=>gr(e,"POST",s,l,u,a,n),put:async(e,s,a,l,u)=>gr(e,"PUT",s,l,u,a,n),head:async(e,s,a,l)=>gr(e,"HEAD",s,fe(fe({},a),{},{noResolveJson:!0}),l,void 0,n),remove:async(e,s,a,l,u)=>gr(e,"DELETE",s,l,u,a,n)}}const Sk=e_("storage"),{get:zr,post:yn,put:Ld,head:Tk,remove:Vr}=Sk,Kt=e_("vectors");var wa=class{constructor(n,e={},s,a="storage"){this.shouldThrowOnError=!1,this.url=n,this.headers=yk(e),this.fetch=vk(s),this.namespace=a}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=Jl(this.headers,n,e),this}async handleOperation(n){var e=this;try{return{data:await n(),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(cu(s))return{data:null,error:s};throw s}}};let t_;t_=Symbol.toStringTag;var Ek=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[t_]="StreamDownloadBuilder",this.promise=null}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(cu(e))return{data:null,error:e};throw e}}};let n_;n_=Symbol.toStringTag;var Ak=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[n_]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ek(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(cu(e))return{data:null,error:e};throw e}}};const Jh={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Cv={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Rk=class extends wa{constructor(n,e={},s,a){super(n,e,a,"storage"),this.bucketId=s}async uploadOrUpdate(n,e,s,a){var l=this;return l.handleOperation(async()=>{let u;const c=fe(fe({},Cv),a);let d=fe(fe({},l.headers),n==="POST"&&{"x-upsert":String(c.upsert)});const m=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),m&&u.append("metadata",l.encodeMetadata(m)),u.append("",s)):typeof FormData<"u"&&s instanceof FormData?(u=s,u.has("cacheControl")||u.append("cacheControl",c.cacheControl),m&&!u.has("metadata")&&u.append("metadata",l.encodeMetadata(m))):(u=s,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType,m&&(d["x-metadata"]=l.toBase64(l.encodeMetadata(m))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!c.duplex&&(c.duplex="half")),a!=null&&a.headers)for(const[w,x]of Object.entries(a.headers))d=Jl(d,w,x);const p=l._removeEmptyFolders(e),g=l._getFinalPath(p),v=await(n=="PUT"?Ld:yn)(l.fetch,`${l.url}/object/${g}`,u,fe({headers:d},c!=null&&c.duplex?{duplex:c.duplex}:{}));return{path:p,id:v.Id,fullPath:v.Key}})}async upload(n,e,s){return this.uploadOrUpdate("POST",n,e,s)}async uploadToSignedUrl(n,e,s,a){var l=this;const u=l._removeEmptyFolders(n),c=l._getFinalPath(u),d=new URL(l.url+`/object/upload/sign/${c}`);return d.searchParams.set("token",e),l.handleOperation(async()=>{let m;const p=fe(fe({},Cv),a);let g=fe(fe({},l.headers),{"x-upsert":String(p.upsert)});const v=p.metadata;if(typeof Blob<"u"&&s instanceof Blob?(m=new FormData,m.append("cacheControl",p.cacheControl),v&&m.append("metadata",l.encodeMetadata(v)),m.append("",s)):typeof FormData<"u"&&s instanceof FormData?(m=s,m.has("cacheControl")||m.append("cacheControl",p.cacheControl),v&&!m.has("metadata")&&m.append("metadata",l.encodeMetadata(v))):(m=s,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType,v&&(g["x-metadata"]=l.toBase64(l.encodeMetadata(v))),(typeof ReadableStream<"u"&&m instanceof ReadableStream||m&&typeof m=="object"&&"pipe"in m&&typeof m.pipe=="function")&&!p.duplex&&(p.duplex="half")),a!=null&&a.headers)for(const[w,x]of Object.entries(a.headers))g=Jl(g,w,x);return{path:u,fullPath:(await Ld(l.fetch,d.toString(),m,fe({headers:g},p!=null&&p.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(n,e){var s=this;return s.handleOperation(async()=>{let a=s._getFinalPath(n);const l=fe({},s.headers);e!=null&&e.upsert&&(l["x-upsert"]="true");const u=await yn(s.fetch,`${s.url}/object/upload/sign/${a}`,{},{headers:l}),c=new URL(s.url+u.url),d=c.searchParams.get("token");if(!d)throw new uu("No token returned by API");return{signedUrl:c.toString(),path:n,token:d}})}async update(n,e,s){return this.uploadOrUpdate("PUT",n,e,s)}async move(n,e,s){var a=this;return a.handleOperation(async()=>await yn(a.fetch,`${a.url}/object/move`,{bucketId:a.bucketId,sourceKey:n,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:a.headers}))}async copy(n,e,s){var a=this;return a.handleOperation(async()=>({path:(await yn(a.fetch,`${a.url}/object/copy`,{bucketId:a.bucketId,sourceKey:n,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:a.headers})).Key}))}async createSignedUrl(n,e,s){var a=this;return a.handleOperation(async()=>{let l=a._getFinalPath(n);const u=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let c=await yn(a.fetch,`${a.url}/object/sign/${l}`,fe({expiresIn:e},u?{transform:s.transform}:{}),{headers:a.headers});const d=new URLSearchParams;s!=null&&s.download&&d.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&d.set("cacheNonce",String(s.cacheNonce));const m=d.toString();return{signedUrl:encodeURI(`${a.url}${c.signedURL}${m?`&${m}`:""}`)}})}async createSignedUrls(n,e,s){var a=this;return a.handleOperation(async()=>{const l=await yn(a.fetch,`${a.url}/object/sign/${a.bucketId}`,{expiresIn:e,paths:n},{headers:a.headers}),u=new URLSearchParams;s!=null&&s.download&&u.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&u.set("cacheNonce",String(s.cacheNonce));const c=u.toString();return l.map(d=>fe(fe({},d),{},{signedUrl:d.signedURL?encodeURI(`${a.url}${d.signedURL}${c?`&${c}`:""}`):null}))})}download(n,e,s){const a=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",l=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(l,e.transform),(e==null?void 0:e.cacheNonce)!=null&&l.set("cacheNonce",String(e.cacheNonce));const u=l.toString(),c=this._getFinalPath(n),d=()=>zr(this.fetch,`${this.url}/${a}/${c}${u?`?${u}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new Ak(d,this.shouldThrowOnError)}async info(n){var e=this;const s=e._getFinalPath(n);return e.handleOperation(async()=>Bd(await zr(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})))}async exists(n){var e=this;const s=e._getFinalPath(n);try{return await Tk(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(l){if(e.shouldThrowOnError)throw l;if(cu(l)){var a;const u=l instanceof Ud?l.status:l instanceof Ww?(a=l.originalError)===null||a===void 0?void 0:a.status:void 0;if(u!==void 0&&[400,404].includes(u))return{data:!1,error:l}}throw l}}getPublicUrl(n,e){const s=this._getFinalPath(n),a=new URLSearchParams;e!=null&&e.download&&a.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(a,e.transform),(e==null?void 0:e.cacheNonce)!=null&&a.set("cacheNonce",String(e.cacheNonce));const l=a.toString(),u=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${u}/public/${s}`)+(l?`?${l}`:"")}}}async remove(n){var e=this;return e.handleOperation(async()=>await Vr(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:n},{headers:e.headers}))}async purgeCache(n,e,s){var a=this;return a.handleOperation(async()=>{const l=a._getFinalPath(n),u=new URLSearchParams;e!=null&&e.transformations&&u.set("transformations","true");const c=u.toString();return await Vr(a.fetch,`${a.url}/cdn/${l}${c?`?${c}`:""}`,{},{headers:a.headers},s)})}async list(n,e,s){var a=this;return a.handleOperation(async()=>{const l=e!=null&&e.sortBy?fe(fe({},Jh.sortBy),e.sortBy):Jh.sortBy,u=fe(fe(fe({},Jh),e),{},{sortBy:l,prefix:n||""});return await yn(a.fetch,`${a.url}/object/list/${a.bucketId}`,u,{headers:a.headers},s)})}async listV2(n,e){var s=this;return s.handleOperation(async()=>{const a=fe({},n);return await yn(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,a,{headers:s.headers},e)})}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(n,e){return e.width&&n.set("width",e.width.toString()),e.height&&n.set("height",e.height.toString()),e.resize&&n.set("resize",e.resize),e.format&&n.set("format",e.format),e.quality&&n.set("quality",e.quality.toString()),n}};const Ck="2.110.2",Fr={"X-Client-Info":`storage-js/${Ck}`};var kk=class extends wa{constructor(n,e={},s,a){const l=new URL(n);a!=null&&a.useNewHostname&&/supabase\.(co|in|red)$/.test(l.hostname)&&!l.hostname.includes("storage.supabase.")&&(l.hostname=l.hostname.replace("supabase.","storage.supabase."));const u=l.href.replace(/\/$/,""),c=fe(fe({},Fr),e);super(u,c,s,"storage")}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const s=e.listBucketOptionsToQueryString(n);return await zr(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers})})}async getBucket(n){var e=this;return e.handleOperation(async()=>await zr(e.fetch,`${e.url}/bucket/${n}`,{headers:e.headers}))}async createBucket(n,e={public:!1}){var s=this;return s.handleOperation(async()=>await yn(s.fetch,`${s.url}/bucket`,{id:n,name:n,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async updateBucket(n,e){var s=this;return s.handleOperation(async()=>await Ld(s.fetch,`${s.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(n){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket/${n}/empty`,{},{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await Vr(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}async purgeBucketCache(n,e,s){var a=this;return a.handleOperation(async()=>{const l=new URLSearchParams;e!=null&&e.transformations&&l.set("transformations","true");const u=l.toString();return await Vr(a.fetch,`${a.url}/cdn/${n}${u?`?${u}`:""}`,{},{headers:a.headers},s)})}listBucketOptionsToQueryString(n){const e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},jk=class extends wa{constructor(n,e={},s){const a=n.replace(/\/$/,""),l=fe(fe({},Fr),e);super(a,l,s,"storage")}async createBucket(n){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket`,{name:n},{headers:e.headers}))}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const s=new URLSearchParams;(n==null?void 0:n.limit)!==void 0&&s.set("limit",n.limit.toString()),(n==null?void 0:n.offset)!==void 0&&s.set("offset",n.offset.toString()),n!=null&&n.sortColumn&&s.set("sortColumn",n.sortColumn),n!=null&&n.sortOrder&&s.set("sortOrder",n.sortOrder),n!=null&&n.search&&s.set("search",n.search);const a=s.toString(),l=a?`${e.url}/bucket?${a}`:`${e.url}/bucket`;return await zr(e.fetch,l,{headers:e.headers})})}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await Vr(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}from(n){var e=this;if(!wk(n))throw new uu("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const s=new fk({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),a=this.shouldThrowOnError;return new Proxy(s,{get(l,u){const c=l[u];return typeof c!="function"?c:async(...d)=>{try{return{data:await c.apply(l,d),error:null}}catch(m){if(a)throw m;return{data:null,error:m}}}}})}},Ok=class extends wa{constructor(n,e={},s){const a=n.replace(/\/$/,""),l=fe(fe({},Fr),{},{"Content-Type":"application/json"},e);super(a,l,s,"vectors")}async createIndex(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/CreateIndex`,n,{headers:e.headers})||{})}async getIndex(n,e){var s=this;return s.handleOperation(async()=>await Kt.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:s.headers}))}async listIndexes(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/ListIndexes`,n,{headers:e.headers}))}async deleteIndex(n,e){var s=this;return s.handleOperation(async()=>await Kt.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:s.headers})||{})}},Nk=class extends wa{constructor(n,e={},s){const a=n.replace(/\/$/,""),l=fe(fe({},Fr),{},{"Content-Type":"application/json"},e);super(a,l,s,"vectors")}async putVectors(n){var e=this;if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/PutVectors`,n,{headers:e.headers})||{})}async getVectors(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/GetVectors`,n,{headers:e.headers}))}async listVectors(n){var e=this;if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/ListVectors`,n,{headers:e.headers}))}async queryVectors(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/QueryVectors`,n,{headers:e.headers}))}async deleteVectors(n){var e=this;if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/DeleteVectors`,n,{headers:e.headers})||{})}},Dk=class extends wa{constructor(n,e={},s){const a=n.replace(/\/$/,""),l=fe(fe({},Fr),{},{"Content-Type":"application/json"},e);super(a,l,s,"vectors")}async createBucket(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}async getBucket(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:n},{headers:e.headers}))}async listBuckets(n={}){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/ListVectorBuckets`,n,{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await Kt.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}},Mk=class extends Dk{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new Uk(this.url,this.headers,n,this.fetch)}async createBucket(n){var e=()=>super.createBucket,s=this;return e().call(s,n)}async getBucket(n){var e=()=>super.getBucket,s=this;return e().call(s,n)}async listBuckets(n={}){var e=()=>super.listBuckets,s=this;return e().call(s,n)}async deleteBucket(n){var e=()=>super.deleteBucket,s=this;return e().call(s,n)}},Uk=class extends Ok{constructor(n,e,s,a){super(n,e,a),this.vectorBucketName=s}async createIndex(n){var e=()=>super.createIndex,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(n={}){var e=()=>super.listIndexes,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(n){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,n)}async deleteIndex(n){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,n)}index(n){return new Bk(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},Bk=class extends Nk{constructor(n,e,s,a,l){super(n,e,l),this.vectorBucketName=s,this.indexName=a}async putVectors(n){var e=()=>super.putVectors,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(n){var e=()=>super.getVectors,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(n={}){var e=()=>super.listVectors,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(n){var e=()=>super.queryVectors,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(n){var e=()=>super.deleteVectors,s=this;return e().call(s,fe(fe({},n),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},Lk=class extends kk{constructor(n,e={},s,a){super(n,e,s,a)}from(n){return new Rk(this.url,this.headers,n,this.fetch)}get vectors(){return new Mk(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new jk(this.url+"/iceberg",this.headers,this.fetch)}};const i_="2.110.2",ri=30*1e3,wr=3,Qh=wr*ri,zk=2*ri,Vk="http://localhost:9999",Pk="supabase.auth.token",Hk={"X-Client-Info":`gotrue-js/${i_}`},zd="X-Supabase-Api-Version",s_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},$k=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,qk=600*1e3;class Pr extends Error{constructor(e,s,a){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=a}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function te(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class Ik extends Pr{constructor(e,s,a){super(e,s,a),this.name="AuthApiError",this.status=s,this.code=a}}function Gk(n){return te(n)&&n.name==="AuthApiError"}class vn extends Pr{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class Bn extends Pr{constructor(e,s,a,l){super(e,a,l),this.name=s,this.status=a}}class ht extends Bn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Tl(n){return te(n)&&n.name==="AuthSessionMissingError"}class na extends Bn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class El extends Bn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Al extends Bn{constructor(e,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Kk(n){return te(n)&&n.name==="AuthImplicitGrantRedirectError"}class kv extends Bn{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Fk extends Bn{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 Vd extends Bn{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function jv(n){return te(n)&&n.name==="AuthRetryableFetchError"}class Ov extends Bn{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function Yk(n){return te(n)&&n.name==="AuthRefreshDiscardedError"}class Nv extends Bn{constructor(e,s,a){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=a}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Ql extends Bn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Zl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Dv=`
\r=`.split(""),Xk=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<Dv.length;e+=1)n[Dv[e].charCodeAt(0)]=-2;for(let e=0;e<Zl.length;e+=1)n[Zl[e].charCodeAt(0)]=e;return n})();function Mv(n,e,s){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const a=e.queue>>e.queuedBits-6&63;s(Zl[a]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const a=e.queue>>e.queuedBits-6&63;s(Zl[a]),e.queuedBits-=6}}function a_(n,e,s){const a=Xk[n];if(a>-1)for(e.queue=e.queue<<6|a,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(a===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Uv(n){const e=[],s=c=>{e.push(String.fromCodePoint(c))},a={utf8seq:0,codepoint:0},l={queue:0,queuedBits:0},u=c=>{Zk(c,a,s)};for(let c=0;c<n.length;c+=1)a_(n.charCodeAt(c),l,u);return e.join("")}function Jk(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function Qk(n,e){for(let s=0;s<n.length;s+=1){let a=n.charCodeAt(s);if(a>55295&&a<=56319){const l=(a-55296)*1024&65535;a=(n.charCodeAt(s+1)-56320&65535|l)+65536,s+=1}Jk(a,e)}}function Zk(n,e,s){if(e.utf8seq===0){if(n<=127){s(n);return}for(let a=1;a<6;a+=1)if((n>>7-a&1)===0){e.utf8seq=a;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function fa(n){const e=[],s={queue:0,queuedBits:0},a=l=>{e.push(l)};for(let l=0;l<n.length;l+=1)a_(n.charCodeAt(l),s,a);return new Uint8Array(e)}function Wk(n){const e=[];return Qk(n,s=>e.push(s)),new Uint8Array(e)}function fs(n){const e=[],s={queue:0,queuedBits:0},a=l=>{e.push(l)};return n.forEach(l=>Mv(l,s,a)),Mv(null,s,a),e.join("")}function ej(n){return Math.round(Date.now()/1e3)+n}function tj(){return Symbol("auth-callback")}const xt=()=>typeof window<"u"&&typeof document<"u",rs={tested:!1,writable:!1},r_=()=>{if(!xt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(rs.tested)return rs.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),rs.tested=!0,rs.writable=!0}catch{rs.tested=!0,rs.writable=!1}return rs.writable};function nj(n){const e={},s=new URL(n);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((l,u)=>{e[u]=l})}catch{}return s.searchParams.forEach((a,l)=>{e[l]=a}),e}const o_=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),ij=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",la=async(n,e,s)=>{await n.setItem(e,JSON.stringify(s))},fn=async(n,e)=>{const s=await n.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return null}},et=async(n,e)=>{await n.removeItem(e)};class hu{constructor(){this.promise=new hu.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}hu.promiseConstructor=Promise;function Rl(n){const e=n.split(".");if(e.length!==3)throw new Ql("Invalid JWT structure");for(let a=0;a<e.length;a++)if(!$k.test(e[a]))throw new Ql("JWT not in base64url format");return{header:JSON.parse(Uv(e[0])),payload:JSON.parse(Uv(e[1])),signature:fa(e[2]),raw:{header:e[0],payload:e[1]}}}async function sj(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function aj(n,e){return new Promise((a,l)=>{(async()=>{for(let u=0;u<1/0;u++)try{const c=await n(u);if(!e(u,null,c)){a(c);return}}catch(c){if(!e(u,c)){l(c);return}}})()})}function rj(n){return("0"+n.toString(16)).substr(-2)}function oj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",a=s.length;let l="";for(let u=0;u<56;u++)l+=s.charAt(Math.floor(Math.random()*a));return l}return crypto.getRandomValues(e),Array.from(e,rj).join("")}async function lj(n){const s=new TextEncoder().encode(n),a=await crypto.subtle.digest("SHA-256",s),l=new Uint8Array(a);return Array.from(l).map(u=>String.fromCharCode(u)).join("")}async function uj(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const s=await lj(n);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function os(n,e,s=!1){const a=oj();let l=a;s&&(l+="/recovery"),await la(n,`${e}-code-verifier`,l);const u=await uj(a);return[u,a===u?"plain":"s256"]}const cj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function hj(n){const e=n.headers.get(zd);if(!e||!e.match(cj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function dj(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function fj(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const mj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ni(n){if(!mj.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function pn(n){if(!n.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Zh(){const n={};return new Proxy(n,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const a=s.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function pj(n,e){return new Proxy(n,{get:(s,a,l)=>{if(a==="__isInsecureUserWarningProxy")return!0;if(typeof a=="symbol"){const u=a.toString();if(u==="Symbol(Symbol.toPrimitive)"||u==="Symbol(Symbol.toStringTag)"||u==="Symbol(util.inspect.custom)"||u==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,a,l)}return!e.value&&typeof a=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(s,a,l)}})}function Bv(n){return JSON.parse(JSON.stringify(n))}const us=n=>{if(typeof n=="object"&&n!==null){const e=n;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(n)},gj=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function Lv(n){var e;if(!ij(n))throw new Vd(us(n),0);if(gj.includes(n.status))throw new Vd(us(n),n.status);let s;try{s=await n.json()}catch(u){throw new vn(us(u),u)}let a;const l=hj(n);if(l&&l.getTime()>=s_["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?a=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(a=s.error_code),a){if(a==="weak_password")throw new Nv(us(s),n.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(a==="session_not_found")throw new ht}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((u,c)=>u&&typeof c=="string",!0))throw new Nv(us(s),n.status,s.weak_password.reasons);throw new Ik(us(s),n.status||500,a)}const yj=(n,e,s,a)=>{const l={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"?l:(l.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),l.body=JSON.stringify(a),Object.assign(Object.assign({},l),s))};async function ae(n,e,s,a){var l;const u=Object.assign({},a==null?void 0:a.headers);u[zd]||(u[zd]=s_["2024-01-01"].name),a!=null&&a.jwt&&(u.Authorization=`Bearer ${a.jwt}`);const c=(l=a==null?void 0:a.query)!==null&&l!==void 0?l:{};a!=null&&a.redirectTo&&(c.redirect_to=a.redirectTo);const d=Object.keys(c).length?"?"+new URLSearchParams(c).toString():"",m=await vj(n,e,s+d,{headers:u,noResolveJson:a==null?void 0:a.noResolveJson},{},a==null?void 0:a.body);return a!=null&&a.xform?a==null?void 0:a.xform(m):{data:Object.assign({},m),error:null}}async function vj(n,e,s,a,l,u){const c=yj(e,a,l,u);let d;try{d=await n(s,Object.assign({},c))}catch(m){throw console.error(m),new Vd(us(m),0)}if(d.ok||await Lv(d),a!=null&&a.noResolveJson)return d;try{return await d.json()}catch(m){await Lv(m)}}function rn(n){var e;let s=null;_j(n)&&(s=Object.assign({},n),n.expires_at||(s.expires_at=ej(n.expires_in)));const a=(e=n.user)!==null&&e!==void 0?e:typeof(n==null?void 0:n.id)=="string"?n:null;return{data:{session:s,user:a},error:null}}function zv(n){const e=rn(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0)&&(e.data.weak_password=n.weak_password),e}function Ui(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function bj(n){return{data:n,error:null}}function wj(n){const{action_link:e,email_otp:s,hashed_token:a,redirect_to:l,verification_type:u}=n,c=lu(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:s,hashed_token:a,redirect_to:l,verification_type:u},m=Object.assign({},c);return{data:{properties:d,user:m},error:null}}function Vv(n){return n}function _j(n){return!!n.access_token&&!!n.refresh_token&&!!n.expires_in}const Wh=["global","local","others"];class xj{constructor({url:e="",headers:s={},fetch:a,experimental:l}){this.url=e,this.headers=s,this.fetch=o_(a),this.experimental=l??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,s=Wh[0]){if(Wh.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Wh.join(", ")}`);try{return await ae(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(a){if(te(a))return{data:null,error:a};throw a}}async inviteUserByEmail(e,s={}){try{return await ae(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Ui})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async generateLink(e){try{const{options:s}=e,a=lu(e,["options"]),l=Object.assign(Object.assign({},a),s);return"newEmail"in a&&(l.new_email=a==null?void 0:a.newEmail,delete l.newEmail),await ae(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:l,headers:this.headers,xform:wj,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(te(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await ae(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ui})}catch(s){if(te(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,a,l,u,c,d,m;try{const p={nextPage:null,lastPage:0,total:0},g=await ae(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:"",per_page:(u=(l=e==null?void 0:e.perPage)===null||l===void 0?void 0:l.toString())!==null&&u!==void 0?u:""},xform:Vv});if(g.error)throw g.error;const v=await g.json(),w=(c=g.headers.get("x-total-count"))!==null&&c!==void 0?c:0,x=(m=(d=g.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&m!==void 0?m:[];return x.length>0&&(x.forEach(S=>{const A=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(S.split(";")[1].split("=")[1]);p[`${k}Page`]=A}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(te(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){ni(e);try{return await ae(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ui})}catch(s){if(te(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){ni(e);try{return await ae(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:Ui})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async deleteUser(e,s=!1){ni(e);try{return await ae(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:Ui})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async _listFactors(e){ni(e.userId);try{const{data:s,error:a}=await ae(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:l=>({data:{factors:l},error:null})});return{data:s,error:a}}catch(s){if(te(s))return{data:null,error:s};throw s}}async _deleteFactor(e){ni(e.userId),ni(e.id);try{return{data:await ae(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(te(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,a,l,u,c,d,m;try{const p={nextPage:null,lastPage:0,total:0},g=await ae(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:"",per_page:(u=(l=e==null?void 0:e.perPage)===null||l===void 0?void 0:l.toString())!==null&&u!==void 0?u:""},xform:Vv});if(g.error)throw g.error;const v=await g.json(),w=(c=g.headers.get("x-total-count"))!==null&&c!==void 0?c:0,x=(m=(d=g.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&m!==void 0?m:[];return x.length>0&&(x.forEach(S=>{const A=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(S.split(";")[1].split("=")[1]);p[`${k}Page`]=A}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(te(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await ae(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await ae(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await ae(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(te(a))return{data:null,error:a};throw a}}async _deleteOAuthClient(e){try{return await ae(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(te(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await ae(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _listCustomProviders(e){try{const s={};return e!=null&&e.type&&(s.type=e.type),await ae(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:a=>{var l;return{data:{providers:(l=a==null?void 0:a.providers)!==null&&l!==void 0?l:[]},error:null}}})}catch(s){if(te(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(e){try{return await ae(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _getCustomProvider(e){try{return await ae(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _updateCustomProvider(e,s){try{return await ae(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:s,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(te(a))return{data:null,error:a};throw a}}async _deleteCustomProvider(e){try{return await ae(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(te(s))return{data:null,error:s};throw s}}async _adminListPasskeys(e){pn(this.experimental),ni(e.userId);try{return await ae(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(te(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(e){pn(this.experimental),ni(e.userId),ni(e.passkeyId);try{return await ae(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(te(s))return{data:null,error:s};throw s}}}function Pv(n={}){return{getItem:e=>n[e]||null,setItem:(e,s)=>{n[e]=s},removeItem:e=>{delete n[e]}}}globalThis&&r_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class Sj extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function Tj(){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 l_(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function Ej(n){return parseInt(n,16)}function Aj(n){const e=new TextEncoder().encode(n);return"0x"+Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}function Rj(n){var e;const{chainId:s,domain:a,expirationTime:l,issuedAt:u=new Date,nonce:c,notBefore:d,requestId:m,resources:p,scheme:g,uri:v,version:w}=n;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!a)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(c&&c.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${c}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=n.statement)===null||e===void 0)&&e.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const x=l_(n.address),S=g?`${g}://${a}`:a,A=n.statement?`${n.statement}
`:"",k=`${S} wants you to sign in with your Ethereum account:
${x}
${A}`;let C=`URI: ${v}
Version: ${w}
Chain ID: ${s}${c?`
Nonce: ${c}`:""}
Issued At: ${u.toISOString()}`;if(l&&(C+=`
Expiration Time: ${l.toISOString()}`),d&&(C+=`
Not Before: ${d.toISOString()}`),m&&(C+=`
Request ID: ${m}`),p){let N=`
Resources:`;for(const O of p){if(!O||typeof O!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${O}`);N+=`
- ${O}`}C+=N}return`${k}
${C}`}class at extends Error{constructor({message:e,code:s,cause:a,name:l}){var u;super(e,{cause:a}),this.__isWebAuthnError=!0,this.name=(u=l??(a instanceof Error?a.name:void 0))!==null&&u!==void 0?u:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Wl extends at{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function Cj({error:n,options:e}){var s,a,l;const{publicKey:u}=e;if(!u)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((s=u.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new at({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(e.mediation==="conditional"&&((a=u.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new at({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((l=u.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new at({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new at({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new at({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return u.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new at({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new at({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const c=window.location.hostname;if(u_(c)){if(u.rp.id!==c)return new at({message:`The RP ID "${u.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(u.user.id.byteLength<1||u.user.id.byteLength>64)return new at({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function kj({error:n,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new at({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const a=window.location.hostname;if(u_(a)){if(s.rpId!==a)return new at({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class jj{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Pd=new jj;function Hv(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:e,user:s,excludeCredentials:a}=n,l=lu(n,["challenge","user","excludeCredentials"]),u=fa(e).buffer,c=Object.assign(Object.assign({},s),{id:fa(s.id).buffer}),d=Object.assign(Object.assign({},l),{challenge:u,user:c});if(a&&a.length>0){d.excludeCredentials=new Array(a.length);for(let m=0;m<a.length;m++){const p=a[m];d.excludeCredentials[m]=Object.assign(Object.assign({},p),{id:fa(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return d}function $v(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:e,allowCredentials:s}=n,a=lu(n,["challenge","allowCredentials"]),l=fa(e).buffer,u=Object.assign(Object.assign({},a),{challenge:l});if(s&&s.length>0){u.allowCredentials=new Array(s.length);for(let c=0;c<s.length;c++){const d=s[c];u.allowCredentials[c]=Object.assign(Object.assign({},d),{id:fa(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return u}function qv(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const s=n;return{id:n.id,rawId:n.id,response:{attestationObject:fs(new Uint8Array(n.response.attestationObject)),clientDataJSON:fs(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Iv(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const s=n,a=n.getClientExtensionResults(),l=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:fs(new Uint8Array(l.authenticatorData)),clientDataJSON:fs(new Uint8Array(l.clientDataJSON)),signature:fs(new Uint8Array(l.signature)),userHandle:l.userHandle?fs(new Uint8Array(l.userHandle)):void 0},type:"public-key",clientExtensionResults:a,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function u_(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function eu(){var n,e;return!!(xt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator==null?void 0:navigator.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function c_(n){try{const e=await navigator.credentials.create(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Wl("Browser returned unexpected credential type",e)}:{data:null,error:new Wl("Empty credential response",e)}}catch(e){return{data:null,error:Cj({error:e,options:n})}}}async function h_(n){try{const e=await navigator.credentials.get(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Wl("Browser returned unexpected credential type",e)}:{data:null,error:new Wl("Empty credential response",e)}}catch(e){return{data:null,error:kj({error:e,options:n})}}}const Oj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Nj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function tu(...n){const e=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),s=l=>l instanceof ArrayBuffer||ArrayBuffer.isView(l),a={};for(const l of n)if(l)for(const u in l){const c=l[u];if(c!==void 0)if(Array.isArray(c))a[u]=c;else if(s(c))a[u]=c;else if(e(c)){const d=a[u];e(d)?a[u]=tu(d,c):a[u]=tu(c)}else a[u]=c}return a}function Dj(n,e){return tu(Oj,n,e||{})}function Mj(n,e){return tu(Nj,n,e||{})}class Uj{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:a,signal:l},u){var c;try{const{data:d,error:m}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!d)return{data:null,error:m};const p=l??Pd.createNewAbortSignal();if(d.webauthn.type==="create"){const{user:g}=d.webauthn.credential_options.publicKey;if(!g.name){const v=a;if(v)g.name=`${g.id}:${v}`;else{const x=(await this.client.getUser()).data.user,S=((c=x==null?void 0:x.user_metadata)===null||c===void 0?void 0:c.name)||(x==null?void 0:x.email)||(x==null?void 0:x.id)||"User";g.name=`${g.id}:${S}`}}g.displayName||(g.displayName=g.name)}switch(d.webauthn.type){case"create":{const g=Dj(d.webauthn.credential_options.publicKey,u==null?void 0:u.create),{data:v,error:w}=await c_({publicKey:g,signal:p});return v?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:v}},error:null}:{data:null,error:w}}case"request":{const g=Mj(d.webauthn.credential_options.publicKey,u==null?void 0:u.request),{data:v,error:w}=await h_(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:g,signal:p}));return v?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:v}},error:null}:{data:null,error:w}}}}catch(d){return te(d)?{data:null,error:d}:{data:null,error:new vn("Unexpected error in challenge",d)}}}async _verify({challengeId:e,factorId:s,webauthn:a}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:a})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},u){if(!s)return{data:null,error:new Pr("rpId is required for WebAuthn authentication")};try{if(!eu())return{data:null,error:new vn("Browser does not support WebAuthn",null)};const{data:c,error:d}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:a},signal:l},{request:u});if(!c)return{data:null,error:d};const{webauthn:m}=c;return this._verify({factorId:e,challengeId:c.challengeId,webauthn:{type:m.type,rpId:s,rpOrigins:a,credential_response:m.credential_response}})}catch(c){return te(c)?{data:null,error:c}:{data:null,error:new vn("Unexpected error in authenticate",c)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},u){if(!s)return{data:null,error:new Pr("rpId is required for WebAuthn registration")};try{if(!eu())return{data:null,error:new vn("Browser does not support WebAuthn",null)};const{data:c,error:d}=await this._enroll({friendlyName:e});if(!c)return await this.client.mfa.listFactors().then(g=>{var v;return(v=g.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g==null?void 0:g.id}):void 0),{data:null,error:d};const{data:m,error:p}=await this._challenge({factorId:c.id,friendlyName:c.friendly_name,webauthn:{rpId:s,rpOrigins:a},signal:l},{create:u});return m?this._verify({factorId:c.id,challengeId:m.challengeId,webauthn:{rpId:s,rpOrigins:a,type:m.webauthn.type,credential_response:m.webauthn.credential_response}}):{data:null,error:p}}catch(c){return te(c)?{data:null,error:c}:{data:null,error:new vn("Unexpected error in register",c)}}}}Tj();const Bj={url:Vk,storageKey:Pk,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Hk,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},ia={};class Hr{get jwks(){var e,s;return(s=(e=ia[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){ia[this.storageKey]=Object.assign(Object.assign({},ia[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=ia[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ia[this.storageKey]=Object.assign(Object.assign({},ia[this.storageKey]),{cachedAt:e})}constructor(e){var s,a,l;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const u=Object.assign(Object.assign({},Bj),e);if(this.storageKey=u.storageKey,this.instanceID=(s=Hr.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Hr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&xt()){const c=`${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(c),this.logDebugMessages&&console.trace(c)}if(this.persistSession=u.persistSession,this.autoRefreshToken=u.autoRefreshToken,this.experimental=(a=u.experimental)!==null&&a!==void 0?a:{},this.admin=new xj({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=o_(u.fetch),this.detectSessionInUrl=u.detectSessionInUrl,this.flowType=u.flowType,this.hasCustomAuthorizationHeader=u.hasCustomAuthorizationHeader,this.throwOnError=u.throwOnError,this.lockAcquireTimeout=u.lockAcquireTimeout,u.lock!=null&&(this.lock=u.lock),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 Uj(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.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(u.storage?this.storage=u.storage:r_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Pv(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=Pv(this.memoryStorage)),xt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(c){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",c)}(l=this.broadcastChannel)===null||l===void 0||l.addEventListener("message",async c=>{this._debug("received broadcast notification from other tab or client",c),(c.data.event==="TOKEN_REFRESHED"||c.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(c.data.event,c.data.session,!1)}catch(d){this._debug("#broadcastChannel","error",d)}})}u.skipAutoInitialize||this.initialize().catch(c=>{this._debug("#initialize()","error",c)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${i_}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){var e;if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())();const s=await this.initializePromise,a=(e=this._pendingInitNotifications)!==null&&e!==void 0?e:[];this._pendingInitNotifications=null;for(const l of a)await this._notifyAllSubscribers(l.event,l.session,l.broadcast);return s}async _initialize(){var e;try{let s={},a="none";if(xt()&&(s=nj(window.location.href),this._isImplicitGrantCallback(s)?a="implicit":await this._isPKCECallback(s)&&(a="pkce")),xt()&&this.detectSessionInUrl&&a!=="none"){const{data:l,error:u}=await this._getSessionFromURL(s,a);if(u){if(this._debug("#_initialize()","error detecting session from URL",u),Kk(u)){const m=(e=u.details)===null||e===void 0?void 0:e.code;if(m==="identity_already_exists"||m==="identity_not_found"||m==="single_identity_not_deletable")return{error:u}}return{error:u}}const{session:c,redirectType:d}=l;return this._debug("#_initialize()","detected session in URL",c,"redirect type",d),await this._saveSession(c),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",c):await this._notifyAllSubscribers("SIGNED_IN",c)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return te(s)?this._returnResult({error:s}):this._returnResult({error:new vn("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,a,l;try{const u=await ae(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(a=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:(l=e==null?void 0:e.options)===null||l===void 0?void 0:l.captchaToken}},xform:rn}),{data:c,error:d}=u;if(d||!c)return this._returnResult({data:{user:null,session:null},error:d});const m=c.session,p=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(u){if(te(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signUp(e){var s,a,l;try{let u;if("email"in e){const{email:g,password:v,options:w}=e;let x=null,S=null;this.flowType==="pkce"&&([x,S]=await os(this.storage,this.storageKey)),u=await ae(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:g,password:v,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:x,code_challenge_method:S},xform:rn})}else if("phone"in e){const{phone:g,password:v,options:w}=e;u=await ae(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:v,data:(a=w==null?void 0:w.data)!==null&&a!==void 0?a:{},channel:(l=w==null?void 0:w.channel)!==null&&l!==void 0?l:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:rn})}else throw new El("You must provide either an email or phone number and a password");const{data:c,error:d}=u;if(d||!c)return await et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const m=c.session,p=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(u){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signInWithPassword(e){try{let s;if("email"in e){const{email:u,password:c,options:d}=e;s=await ae(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:u,password:c,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:zv})}else if("phone"in e){const{phone:u,password:c,options:d}=e;s=await ae(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:u,password:c,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:zv})}else throw new El("You must provide either an email or phone number and a password");const{data:a,error:l}=s;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a||!a.session||!a.user){const u=new na;return this._returnResult({data:{user:null,session:null},error:u})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign({user:a.user,session:a.session},a.weak_password?{weakPassword:a.weak_password}:null),error:l})}catch(s){if(te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,a,l,u;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:(u=e.options)===null||u===void 0?void 0:u.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,a,l,u,c,d,m,p,g,v,w;let x,S;if("message"in e)x=e.message,S=e.signature;else{const{chain:A,wallet:k,statement:C,options:N}=e;let O;if(xt())if(typeof k=="object")O=k;else{const ee=window;if("ethereum"in ee&&typeof ee.ethereum=="object"&&"request"in ee.ethereum&&typeof ee.ethereum.request=="function")O=ee.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(N!=null&&N.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=k}const P=new URL((s=N==null?void 0:N.url)!==null&&s!==void 0?s:window.location.href),J=await O.request({method:"eth_requestAccounts"}).then(ee=>ee).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!J||J.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const X=l_(J[0]);let G=(a=N==null?void 0:N.signInWithEthereum)===null||a===void 0?void 0:a.chainId;if(!G){const ee=await O.request({method:"eth_chainId"});G=Ej(ee)}const Z={domain:P.host,address:X,statement:C,uri:P.href,version:"1",chainId:G,nonce:(l=N==null?void 0:N.signInWithEthereum)===null||l===void 0?void 0:l.nonce,issuedAt:(c=(u=N==null?void 0:N.signInWithEthereum)===null||u===void 0?void 0:u.issuedAt)!==null&&c!==void 0?c:new Date,expirationTime:(d=N==null?void 0:N.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(m=N==null?void 0:N.signInWithEthereum)===null||m===void 0?void 0:m.notBefore,requestId:(p=N==null?void 0:N.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=N==null?void 0:N.signInWithEthereum)===null||g===void 0?void 0:g.resources};x=Rj(Z),S=await O.request({method:"personal_sign",params:[Aj(x),X]})}try{const{data:A,error:k}=await ae(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:x,signature:S},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:rn});if(k)throw k;if(!A||!A.session||!A.user){const C=new na;return this._returnResult({data:{user:null,session:null},error:C})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:k})}catch(A){if(te(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async signInWithSolana(e){var s,a,l,u,c,d,m,p,g,v,w,x;let S,A;if("message"in e)S=e.message,A=e.signature;else{const{chain:k,wallet:C,statement:N,options:O}=e;let P;if(xt())if(typeof C=="object")P=C;else{const X=window;if("solana"in X&&typeof X.solana=="object"&&("signIn"in X.solana&&typeof X.solana.signIn=="function"||"signMessage"in X.solana&&typeof X.solana.signMessage=="function"))P=X.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 C!="object"||!(O!=null&&O.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=C}const J=new URL((s=O==null?void 0:O.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in P&&P.signIn){const X=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},O==null?void 0:O.signInWithSolana),{version:"1",domain:J.host,uri:J.href}),N?{statement:N}:null));let G;if(Array.isArray(X)&&X[0]&&typeof X[0]=="object")G=X[0];else if(X&&typeof X=="object"&&"signedMessage"in X&&"signature"in X)G=X;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in G&&"signature"in G&&(typeof G.signedMessage=="string"||G.signedMessage instanceof Uint8Array)&&G.signature instanceof Uint8Array)S=typeof G.signedMessage=="string"?G.signedMessage:new TextDecoder().decode(G.signedMessage),A=G.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${J.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...N?["",N,""]:[""],"Version: 1",`URI: ${J.href}`,`Issued At: ${(l=(a=O==null?void 0:O.signInWithSolana)===null||a===void 0?void 0:a.issuedAt)!==null&&l!==void 0?l:new Date().toISOString()}`,...!((u=O==null?void 0:O.signInWithSolana)===null||u===void 0)&&u.notBefore?[`Not Before: ${O.signInWithSolana.notBefore}`]:[],...!((c=O==null?void 0:O.signInWithSolana)===null||c===void 0)&&c.expirationTime?[`Expiration Time: ${O.signInWithSolana.expirationTime}`]:[],...!((d=O==null?void 0:O.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${O.signInWithSolana.chainId}`]:[],...!((m=O==null?void 0:O.signInWithSolana)===null||m===void 0)&&m.nonce?[`Nonce: ${O.signInWithSolana.nonce}`]:[],...!((p=O==null?void 0:O.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${O.signInWithSolana.requestId}`]:[],...!((v=(g=O==null?void 0:O.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||v===void 0)&&v.length?["Resources",...O.signInWithSolana.resources.map(G=>`- ${G}`)]:[]].join(`
`);const X=await P.signMessage(new TextEncoder().encode(S),"utf8");if(!X||!(X instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");A=X}}try{const{data:k,error:C}=await ae(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:fs(A)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(x=e.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:rn});if(C)throw C;if(!k||!k.session||!k.user){const N=new na;return this._returnResult({data:{user:null,session:null},error:N})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:C})}catch(k){if(te(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const s=await fn(this.storage,`${this.storageKey}-code-verifier`),[a,l]=(s??"").split("/");try{if(!a&&this.flowType==="pkce")throw new Fk;const{data:u,error:c}=await ae(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:a},xform:rn});if(await et(this.storage,`${this.storageKey}-code-verifier`),c)throw c;if(!u||!u.session||!u.user){const d=new na;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers(l==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u.session)),this._returnResult({data:Object.assign(Object.assign({},u),{redirectType:l??null}),error:c})}catch(u){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(u))return this._returnResult({data:{user:null,session:null,redirectType:null},error:u});throw u}}async signInWithIdToken(e){try{const{options:s,provider:a,token:l,access_token:u,nonce:c}=e,d=await ae(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:a,id_token:l,access_token:u,nonce:c,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:rn}),{data:m,error:p}=d;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m||!m.session||!m.user){const g=new na;return this._returnResult({data:{user:null,session:null},error:g})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:m,error:p})}catch(s){if(te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,a,l,u,c;try{if("email"in e){const{email:d,options:m}=e;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await os(this.storage,this.storageKey));const{error:v}=await ae(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(s=m==null?void 0:m.data)!==null&&s!==void 0?s:{},create_user:(a=m==null?void 0:m.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:m==null?void 0:m.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:m}=e,{data:p,error:g}=await ae(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(l=m==null?void 0:m.data)!==null&&l!==void 0?l:{},create_user:(u=m==null?void 0:m.shouldCreateUser)!==null&&u!==void 0?u:!0,gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},channel:(c=m==null?void 0:m.channel)!==null&&c!==void 0?c:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:g})}throw new El("You must provide either an email or phone number.")}catch(d){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var s,a;try{let l,u;"options"in e&&(l=(s=e.options)===null||s===void 0?void 0:s.redirectTo,u=(a=e.options)===null||a===void 0?void 0:a.captchaToken);const{data:c,error:d}=await ae(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:u}}),redirectTo:l,xform:rn});if(d)throw d;if(!c)throw new Error("An error occurred on token verification.");const m=c.session,p=c.user;return m!=null&&m.access_token&&(await this._saveSession(m),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(l){if(te(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(e){var s,a,l,u,c;try{let d=null,m=null;this.flowType==="pkce"&&([d,m]=await os(this.storage,this.storageKey));const p=await ae(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(a=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&a!==void 0?a:void 0}),!((l=e==null?void 0:e.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:m}),headers:this.headers,xform:bj});return!((u=p.data)===null||u===void 0)&&u.url&&xt()&&!(!((c=e.options)===null||c===void 0)&&c.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(d){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:a}=e;if(a)throw a;if(!s)throw new ht;const{error:l}=await ae(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(e){if(te(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:a,type:l,options:u}=e;let c=null,d=null;this.flowType==="pkce"&&([c,d]=await os(this.storage,this.storageKey));const{error:m}=await ae(this.fetch,"POST",s,{headers:this.headers,body:{email:a,type:l,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:c,code_challenge_method:d},redirectTo:u==null?void 0:u.emailRedirectTo});return m&&await et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m})}else if("phone"in e){const{phone:a,type:l,options:u}=e,{data:c,error:d}=await ae(this.fetch,"POST",s,{headers:this.headers,body:{phone:a,type:l,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:d})}throw new El("You must provide either an email or phone number and a type")}catch(s){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await a,await s()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const a=s();for(this.pendingInLock.push((async()=>{try{await a}catch{}})()),await a;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.length)}return await a}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await fn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const a=e.expires_at?e.expires_at*1e3-Date.now()<Qh:!1;if(this._debug("#__loadSession()",`session has${a?"":" not"} expired`,"expires_at",e.expires_at),!a){if(this.userStorage){const c=await fn(this.userStorage,this.storageKey+"-user");c!=null&&c.user?e.user=c.user:e.user=Zh()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const c={value:this.suppressGetSessionWarning};e.user=pj(e.user,c),c.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);if(u){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const d=await fn(this.storage,this.storageKey);if(d&&d.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:u})}return this._returnResult({data:{session:l},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let s;return this.lock!=null?s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):s=await this._getUser(),s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await ae(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ui}):await this._useSession(async s=>{var a,l,u;const{data:c,error:d}=s;if(d)throw d;return!(!((a=c.session)===null||a===void 0)&&a.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ht}:await ae(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(u=(l=c.session)===null||l===void 0?void 0:l.access_token)!==null&&u!==void 0?u:void 0,xform:Ui})})}catch(s){if(te(s))return Tl(s)&&(await this._removeSession(),await et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s)):await this._updateUser(e,s)}async _updateUser(e,s={}){try{return await this._useSession(async a=>{const{data:l,error:u}=a;if(u)throw u;if(!l.session)throw new ht;const c=l.session;let d=null,m=null;this.flowType==="pkce"&&e.email!=null&&([d,m]=await os(this.storage,this.storageKey));const{data:p,error:g}=await ae(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:m}),jwt:c.access_token,xform:Ui});if(g)throw g;return c.user=p.user,await this._saveSession(c),await this._notifyAllSubscribers("USER_UPDATED",c),this._returnResult({data:{user:c.user},error:null})})}catch(a){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ht;const s=Date.now()/1e3;let a=s,l=!0,u=null;const{payload:c}=Rl(e.access_token);if(c.exp&&(a=c.exp,l=a<=s),l){const{data:d,error:m}=await this._callRefreshToken(e.refresh_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!d)return{data:{user:null,session:null},error:null};u=d}else{const{data:d,error:m}=await this._getUser(e.access_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});u={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:a-s,expires_at:a},await this._saveSession(u),await this._notifyAllSubscribers("SIGNED_IN",u)}return this._returnResult({data:{user:u.user,session:u},error:null})}catch(s){if(te(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async s=>{var a;if(!e){const{data:c,error:d}=s;if(d)throw d;e=(a=c.session)!==null&&a!==void 0?a:void 0}if(!(e!=null&&e.refresh_token))throw new ht;const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{user:null,session:null},error:u}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){var a;try{if(!xt())throw new Al("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Al(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new kv("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Al("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new kv("No code detected.");const{data:O,error:P}=await this._exchangeCodeForSession(e.code);if(P)throw P;const J=new URL(window.location.href);return J.searchParams.delete("code"),window.history.replaceState(window.history.state,"",J.toString()),{data:{session:O.session,redirectType:(a=O.redirectType)!==null&&a!==void 0?a:null},error:null}}const{provider_token:l,provider_refresh_token:u,access_token:c,refresh_token:d,expires_in:m,expires_at:p,token_type:g}=e;if(!c||!m||!d||!g)throw new Al("No session defined in URL");const v=Math.round(Date.now()/1e3),w=parseInt(m);let x=v+w;p&&(x=parseInt(p));const S=x-v;S*1e3<=ri&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${w}s`);const A=x-w;v-A>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",A,x,v):v-A<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",A,x,v);const{data:k,error:C}=await this._getUser(c);if(C)throw C;const N={provider_token:l,provider_refresh_token:u,access_token:c,expires_in:w,expires_at:x,refresh_token:d,token_type:g,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:N,redirectType:e.type},error:null})}catch(l){if(te(l))return this._returnResult({data:{session:null,redirectType:null},error:l});throw l}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const s=await fn(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var a;const l=async()=>{await this._removeSession(),await et(this.storage,`${this.storageKey}-code-verifier`)},{data:u,error:c}=s;if(c&&!Tl(c))return this._returnResult({error:c});const d=(a=u.session)===null||a===void 0?void 0:a.access_token;if(d){const{error:m}=await this.admin.signOut(d,e);if(m&&!(Gk(m)&&(m.status===404||m.status===401||m.status===403)||Tl(m)))return e!=="others"&&await l(),this._returnResult({error:m})}return e!=="others"&&await l(),this._returnResult({error:null})})}onAuthStateChange(e){const s=tj(),a={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,a),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)}):await this._emitInitialSession(s)))(),{data:{subscription:a}}}async _emitInitialSession(e){return await this._useSession(async s=>{var a,l;try{const{data:{session:u},error:c}=s;if(c)throw c;await((a=this.stateChangeEmitters.get(e))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",u)),this._debug("INITIAL_SESSION","callback id",e,"session",u)}catch(u){await((l=this.stateChangeEmitters.get(e))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",u),Tl(u)?console.warn(u):console.error(u)}})}async resetPasswordForEmail(e,s={}){let a=null,l=null;this.flowType==="pkce"&&([a,l]=await os(this.storage,this.storageKey,!0));try{return await ae(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:a,code_challenge_method:l,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(u){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(u))return this._returnResult({data:null,error:u});throw u}}async getUserIdentities(){var e;try{const{data:s,error:a}=await this.getUser();if(a)throw a;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:a,error:l}=await this._useSession(async u=>{var c,d,m,p,g;const{data:v,error:w}=u;if(w)throw w;const x=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(c=e.options)===null||c===void 0?void 0:c.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(m=e.options)===null||m===void 0?void 0:m.queryParams,skipBrowserRedirect:!0});return await ae(this.fetch,"GET",x,{headers:this.headers,jwt:(g=(p=v.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(l)throw l;return xt()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(a==null?void 0:a.url),this._returnResult({data:{provider:e.provider,url:a==null?void 0:a.url},error:null})}catch(a){if(te(a))return this._returnResult({data:{provider:e.provider,url:null},error:a});throw a}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var a;try{const{error:l,data:{session:u}}=s;if(l)throw l;const{options:c,provider:d,token:m,access_token:p,nonce:g}=e,v=await ae(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(a=u==null?void 0:u.access_token)!==null&&a!==void 0?a:void 0,body:{provider:d,id_token:m,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:rn}),{data:w,error:x}=v;return x?this._returnResult({data:{user:null,session:null},error:x}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new na}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:x}))}catch(l){if(await et(this.storage,`${this.storageKey}-code-verifier`),te(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var a,l;const{data:u,error:c}=s;if(c)throw c;return await ae(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(l=(a=u.session)===null||a===void 0?void 0:a.access_token)!==null&&l!==void 0?l:void 0})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s="#_refreshAccessToken()";this._debug(s,"begin");try{const a=Date.now();return await aj(async l=>(l>0&&await sj(200*Math.pow(2,l-1)),this._debug(s,"refreshing attempt",l),await ae(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rn})),(l,u)=>{const c=200*Math.pow(2,l);return u&&jv(u)&&Date.now()+c-a<ri})}catch(a){if(this._debug(s,"error",a),te(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const a=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",a),xt()&&!s.skipBrowserRedirect&&window.location.assign(a),{data:{provider:e,url:a},error:null}}async _recoverAndRefresh(){var e,s;const a="#_recoverAndRefresh()";this._debug(a,"begin");try{const l=await fn(this.storage,this.storageKey);if(l&&this.userStorage){let c=await fn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!c&&(c={user:l.user},await la(this.userStorage,this.storageKey+"-user",c)),l.user=(e=c==null?void 0:c.user)!==null&&e!==void 0?e:Zh()}else if(l&&!l.user&&!l.user){const c=await fn(this.storage,this.storageKey+"-user");c&&(c!=null&&c.user)?(l.user=c.user,await et(this.storage,this.storageKey+"-user"),await la(this.storage,this.storageKey,l)):l.user=Zh()}if(this._debug(a,"session from storage",l),!this._isValidSession(l)){this._debug(a,"session is not valid"),l!==null&&await this._removeSession();return}const u=((s=l.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<Qh;if(this._debug(a,`session has${u?"":" not"} expired with margin of ${Qh}s`),u){if(this.autoRefreshToken&&l.refresh_token){const{error:c}=await this._callRefreshToken(l.refresh_token);c&&(Yk(c)?this._debug(a,"refresh discarded by commit guard",c):this._debug(a,"refresh failed",c))}}else if(l.user&&l.user.__isUserNotAvailableProxy===!0)try{const{data:c,error:d}=await this._getUser(l.access_token);!d&&(c!=null&&c.user)?(l.user=c.user,await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)):this._debug(a,"could not get user data, skipping SIGNED_IN notification")}catch(c){console.error("Error getting user data:",c),this._debug(a,"error getting user data, skipping SIGNED_IN notification",c)}else await this._notifyAllSubscribers("SIGNED_IN",l)}catch(l){this._debug(a,"error",l),console.error(l);return}finally{this._debug(a,"end")}}async _callRefreshToken(e){var s,a;if(!e)throw new ht;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const l="#_callRefreshToken()";this._debug(l,"begin");try{this.refreshingDeferred=new hu;const u=await fn(this.storage,this.storageKey),{data:c,error:d}=await this._refreshAccessToken(e);if(d)throw d;if(!c.session)throw new ht;const m=await fn(this.storage,this.storageKey);if(u!==null&&(m===null||m.refresh_token!==u.refresh_token)){this._debug(l,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:m?"replaced":"cleared"});const w={data:null,error:new Ov};return this.refreshingDeferred.resolve(w),w}const g=this._sessionRemovalEpoch;if(await this._saveSession(c.session),this._sessionRemovalEpoch!==g){this._debug(l,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await et(this.storage,this.storageKey),this.userStorage&&await et(this.userStorage,this.storageKey+"-user");const w={data:null,error:new Ov};return this.refreshingDeferred.resolve(w),w}await this._notifyAllSubscribers("TOKEN_REFRESHED",c.session);const v={data:c.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(v),v}catch(u){if(this._debug(l,"error",u),te(u)){const c={data:null,error:u};if(!jv(u)){const d=await fn(this.storage,this.storageKey);!!(d!=null&&d.expires_at&&d.expires_at*1e3>Date.now())?this._debug(l,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:c,expiresAt:Date.now()+zk},(s=this.refreshingDeferred)===null||s===void 0||s.resolve(c),c}throw(a=this.refreshingDeferred)===null||a===void 0||a.reject(u),u}finally{this.refreshingDeferred=null,this._debug(l,"end")}}async _notifyAllSubscribers(e,s,a=!0){if(this._pendingInitNotifications!==null&&a){this._pendingInitNotifications.push({event:e,session:s,broadcast:a});return}const l=`#_notifyAllSubscribers(${e})`;this._debug(l,"begin",s,`broadcast = ${a}`);try{this.broadcastChannel&&a&&this.broadcastChannel.postMessage({event:e,session:s});const u=[],c=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,s)}catch(m){u.push(m)}});if(await Promise.all(c),u.length>0){for(let d=0;d<u.length;d+=1)console.error(u[d]);throw u[0]}}finally{this._debug(l,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await et(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),a=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!a&&s.user&&await la(this.userStorage,this.storageKey+"-user",{user:s.user});const l=Object.assign({},s);delete l.user;const u=Bv(l);await la(this.storage,this.storageKey,u)}else{const l=Bv(s);await la(this.storage,this.storageKey,l)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await et(this.storage,this.storageKey),await et(this.storage,this.storageKey+"-code-verifier"),await et(this.storage,this.storageKey+"-user"),this.userStorage&&await et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&xt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ri);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async s=>{const{data:{session:a}}=s;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((a.expires_at*1e3-e)/ri);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${ri}ms, refresh threshold is ${wr} ticks`),l<=wr&&await this._callRefreshToken(a.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof Sj)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async s=>{const{data:{session:a}}=s;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((a.expires_at*1e3-e)/ri);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${ri}ms, refresh threshold is ${wr} ticks`),l<=wr&&await this._callRefreshToken(a.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!xt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;if(this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(s,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,s,a){const l=[`provider=${encodeURIComponent(s)}`];if(a!=null&&a.redirectTo&&l.push(`redirect_to=${encodeURIComponent(a.redirectTo)}`),a!=null&&a.scopes&&l.push(`scopes=${encodeURIComponent(a.scopes)}`),this.flowType==="pkce"){const[u,c]=await os(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(u)}`,code_challenge_method:`${encodeURIComponent(c)}`});l.push(d.toString())}if(a!=null&&a.queryParams){const u=new URLSearchParams(a.queryParams);l.push(u.toString())}return a!=null&&a.skipBrowserRedirect&&l.push(`skip_http_redirect=${a.skipBrowserRedirect}`),`${e}?${l.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var a;const{data:l,error:u}=s;return u?this._returnResult({data:null,error:u}):await ae(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(a=l==null?void 0:l.session)===null||a===void 0?void 0:a.access_token})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var a,l;const{data:u,error:c}=s;if(c)return this._returnResult({data:null,error:c});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:m,error:p}=await ae(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(a=u==null?void 0:u.session)===null||a===void 0?void 0:a.access_token});return p?this._returnResult({data:null,error:p}):(e.factorType==="totp"&&m.type==="totp"&&(!((l=m==null?void 0:m.totp)===null||l===void 0)&&l.qr_code)&&(m.totp.qr_code=`data:image/svg+xml;utf-8,${m.totp.qr_code}`),this._returnResult({data:m,error:null}))})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){const s=async()=>{try{return await this._useSession(async a=>{var l;const{data:u,error:c}=a;if(c)return this._returnResult({data:null,error:c});const d=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?qv(e.webauthn.credential_response):Iv(e.webauthn.credential_response)})}:{code:e.code}),{data:m,error:p}=await ae(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:d,headers:this.headers,jwt:(l=u==null?void 0:u.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+m.expires_in},m)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",m),this._returnResult({data:m,error:p}))})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,s):s()}async _challenge(e){const s=async()=>{try{return await this._useSession(async a=>{var l;const{data:u,error:c}=a;if(c)return this._returnResult({data:null,error:c});const d=await ae(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(l=u==null?void 0:u.session)===null||l===void 0?void 0:l.access_token});if(d.error)return d;const{data:m}=d;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:Hv(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:$v(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,s):s()}async _challengeAndVerify(e){const{data:s,error:a}=await this._challenge({factorId:e.factorId});return a?this._returnResult({data:null,error:a}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:a}=await this.getUser();if(a)return{data:null,error:a};const l={all:[],phone:[],totp:[],webauthn:[]};for(const u of(e=s==null?void 0:s.factors)!==null&&e!==void 0?e:[])l.all.push(u),u.status==="verified"&&l[u.factor_type].push(u);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(e){var s,a,l,u;if(e)try{const{payload:x}=Rl(e);let S=null;x.aal&&(S=x.aal);let A=S;const{data:{user:k},error:C}=await this.getUser(e);if(C)return this._returnResult({data:null,error:C});((a=(s=k==null?void 0:k.factors)===null||s===void 0?void 0:s.filter(P=>P.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(A="aal2");const O=x.amr||[];return{data:{currentLevel:S,nextLevel:A,currentAuthenticationMethods:O},error:null}}catch(x){if(te(x))return this._returnResult({data:null,error:x});throw x}const{data:{session:c},error:d}=await this.getSession();if(d)return this._returnResult({data:null,error:d});if(!c)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:m}=Rl(c.access_token);let p=null;m.aal&&(p=m.aal);let g=p;((u=(l=c.user.factors)===null||l===void 0?void 0:l.filter(x=>x.status==="verified"))!==null&&u!==void 0?u:[]).length>0&&(g="aal2");const w=m.amr||[];return{data:{currentLevel:p,nextLevel:g,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:a},error:l}=s;return l?this._returnResult({data:null,error:l}):a?await ae(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:a.access_token,xform:u=>({data:u,error:null})}):this._returnResult({data:null,error:new ht})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async a=>{const{data:{session:l},error:u}=a;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new ht});const c=await ae(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return c.data&&c.data.redirect_url&&xt()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(e,s){try{return await this._useSession(async a=>{const{data:{session:l},error:u}=a;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new ht});const c=await ae(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return c.data&&c.data.redirect_url&&xt()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:a}=e;return a?this._returnResult({data:null,error:a}):s?await ae(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new ht})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:a},error:l}=s;return l?this._returnResult({data:null,error:l}):a?(await ae(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ht})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let a=s.keys.find(d=>d.kid===e);if(a)return a;const l=Date.now();if(a=this.jwks.keys.find(d=>d.kid===e),a&&this.jwks_cached_at+qk>l)return a;const{data:u,error:c}=await ae(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(c)throw c;return!u.keys||u.keys.length===0||(this.jwks=u,this.jwks_cached_at=l,a=u.keys.find(d=>d.kid===e),!a)?null:a}async getClaims(e,s={}){try{let a=e;if(!a){const{data:x,error:S}=await this.getSession();if(S||!x.session)return this._returnResult({data:null,error:S});a=x.session.access_token}const{header:l,payload:u,signature:c,raw:{header:d,payload:m}}=Rl(a);if(!(s!=null&&s.allowExpired))try{dj(u.exp)}catch(x){throw new Ql(x instanceof Error?x.message:"JWT validation failed")}const p=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!p){const{error:x}=await this.getUser(a);if(x)throw x;return{data:{claims:u,header:l,signature:c},error:null}}const g=fj(l.alg),v=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,v,c,Wk(`${d}.${m}`)))throw new Ql("Invalid JWT signature");return{data:{claims:u,header:l,signature:c},error:null}}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async signInWithPasskey(e){var s,a,l;pn(this.experimental);try{if(!eu())return this._returnResult({data:null,error:new vn("Browser does not support WebAuthn",null)});const{data:u,error:c}=await this._startPasskeyAuthentication({options:{captchaToken:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}});if(c||!u)return this._returnResult({data:null,error:c});const d=$v(u.options),m=(l=(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.signal)!==null&&l!==void 0?l:Pd.createNewAbortSignal(),{data:p,error:g}=await h_({publicKey:d,signal:m});if(g||!p)return this._returnResult({data:null,error:g??new vn("WebAuthn ceremony failed",null)});const v=Iv(p);return this._verifyPasskeyAuthentication({challengeId:u.challenge_id,credential:v})}catch(u){if(te(u))return this._returnResult({data:null,error:u});throw u}}async registerPasskey(e){var s,a;pn(this.experimental);try{if(!eu())return this._returnResult({data:null,error:new vn("Browser does not support WebAuthn",null)});const{data:l,error:u}=await this._startPasskeyRegistration();if(u||!l)return this._returnResult({data:null,error:u});const c=Hv(l.options),d=(a=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&a!==void 0?a:Pd.createNewAbortSignal(),{data:m,error:p}=await c_({publicKey:c,signal:d});if(p||!m)return this._returnResult({data:null,error:p??new vn("WebAuthn ceremony failed",null)});const g=qv(m);return this._verifyPasskeyRegistration({challengeId:l.challenge_id,credential:g})}catch(l){if(te(l))return this._returnResult({data:null,error:l});throw l}}async _startPasskeyRegistration(){pn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:a}=e;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new ht});const{data:l,error:u}=await ae(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){pn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:a},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new ht});const{data:u,error:c}=await ae(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:a.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:u,error:null})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(e){var s;pn(this.experimental);try{const{data:a,error:l}=await ae(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}}});return l?this._returnResult({data:null,error:l}):this._returnResult({data:a,error:null})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyAuthentication(e){pn(this.experimental);try{const{data:s,error:a}=await ae(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:rn});return a?this._returnResult({data:null,error:a}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){pn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:a}=e;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new ht});const{data:l,error:u}=await ae(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:c=>({data:c,error:null})});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){pn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:a},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new ht});const{data:u,error:c}=await ae(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:a.access_token,body:{friendly_name:e.friendlyName}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:u,error:null})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(e){pn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:a},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new ht});const{error:u}=await ae(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:a.access_token,noResolveJson:!0});return u?this._returnResult({data:null,error:u}):this._returnResult({data:null,error:null})})}catch(s){if(te(s))return this._returnResult({data:null,error:s});throw s}}}Hr.nextInstanceID={};const Lj=Hr,zj="2.110.2";let _r="",nu;if(typeof Deno<"u"){var ed;_r="deno",nu=(ed=Deno.version)===null||ed===void 0?void 0:ed.deno}else if(typeof document<"u")_r="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")_r="react-native";else{var td;_r="node",nu=typeof process<"u"?(td=process.version)===null||td===void 0?void 0:td.replace(/^v/,""):void 0}const d_=[`runtime=${_r}`];nu&&d_.push(`runtime-version=${nu}`);const Vj={"X-Client-Info":`supabase-js/${zj}; ${d_.join("; ")}`},Pj={headers:Vj},Hj={schema:"public"},$j={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},qj={},Ij={enabled:!1,respectSamplingDecision:!0};function Gj(n,e,s,a){function l(u){return u instanceof s?u:new s(function(c){c(u)})}return new(s||(s=Promise))(function(u,c){function d(g){try{p(a.next(g))}catch(v){c(v)}}function m(g){try{p(a.throw(g))}catch(v){c(v)}}function p(g){g.done?u(g.value):l(g.value).then(d,m)}p((a=a.apply(n,[])).next())})}let nd=null;const Kj="@opentelemetry/api";function Fj(){return nd===null&&(nd=import(Kj).catch(()=>null)),nd}function Yj(){return Gj(this,void 0,void 0,function*(){try{const n=yield Fj();if(!n||!n.propagation||!n.context)return null;const e={};n.propagation.inject(n.context.active(),e);const s=e.traceparent;return s?{traceparent:s,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function Xj(n){if(!n||typeof n!="string")return null;const e=n.split("-");if(e.length!==4)return null;const[s,a,l,u]=e;if(s.length!==2||a.length!==32||l.length!==16||u.length!==2)return null;const c=/^[0-9a-f]+$/i;return!c.test(s)||!c.test(a)||!c.test(l)||!c.test(u)||a==="00000000000000000000000000000000"||l==="0000000000000000"?null:{version:s,traceId:a,parentId:l,traceFlags:u,isSampled:(parseInt(u,16)&1)===1}}function Jj(n,e){if(!n||!e||e.length===0)return!1;let s;if(n instanceof URL)s=n;else try{s=new URL(n)}catch{return!1}for(const a of e)try{if(typeof a=="string"){if(Qj(s.hostname,a))return!0}else if(a instanceof RegExp){if(a.test(s.hostname))return!0}else if(typeof a=="function"&&a(s))return!0}catch{continue}return!1}function Qj(n,e){if(e===n)return!0;if(e.startsWith("*.")){const s=e.slice(2);if(n.endsWith(s)&&(n===s||n.endsWith("."+s)))return!0}return!1}function Zj(n){const e=[];try{const s=new URL(n);e.push(s.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function $r(n){"@babel/helpers - typeof";return $r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$r(n)}function Wj(n,e){if($r(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,e);if($r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function eO(n){var e=Wj(n,"string");return $r(e)=="symbol"?e:e+""}function tO(n,e,s){return(e=eO(e))in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}function Gv(n,e){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),s.push.apply(s,a)}return s}function Je(n){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Gv(Object(s),!0).forEach(function(a){tO(n,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):Gv(Object(s)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))})}return n}const nO=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),iO=()=>Headers,sO=(n,e,s,a,l)=>{const u=nO(a),c=iO(),d=(l==null?void 0:l.enabled)===!0,m=(l==null?void 0:l.respectSamplingDecision)!==!1,p=d?Zj(e):null;return async(g,v)=>{var w;const x=(w=await s())!==null&&w!==void 0?w:n;let S=new c(v==null?void 0:v.headers);if(S.has("apikey")||S.set("apikey",n),S.has("Authorization")||S.set("Authorization",`Bearer ${x}`),p){const A=await aO(g,p,m);A&&(A.traceparent&&!S.has("traceparent")&&S.set("traceparent",A.traceparent),A.tracestate&&!S.has("tracestate")&&S.set("tracestate",A.tracestate),A.baggage&&!S.has("baggage")&&S.set("baggage",A.baggage))}return u(g,Je(Je({},v),{},{headers:S}))}};async function aO(n,e,s){if(!Jj(typeof n=="string"||n instanceof URL?n:n.url,e))return null;const a=await Yj();if(!a||!a.traceparent)return null;if(s){const l=Xj(a.traceparent);if(l&&!l.isSampled)return null}return a}function Kv(n){return typeof n=="boolean"?{enabled:n}:n}function rO(n){return n.endsWith("/")?n:n+"/"}function oO(n,e){var s,a,l,u,c,d;const{db:m,auth:p,realtime:g,global:v}=n,{db:w,auth:x,realtime:S,global:A}=e,k=Kv(n.tracePropagation),C=Kv(e.tracePropagation),N={db:Je(Je({},w),m),auth:Je(Je({},x),p),realtime:Je(Je({},S),g),storage:{},global:Je(Je(Je({},A),v),{},{headers:Je(Je({},(s=A==null?void 0:A.headers)!==null&&s!==void 0?s:{}),(a=v==null?void 0:v.headers)!==null&&a!==void 0?a:{})}),tracePropagation:{enabled:(l=(u=k==null?void 0:k.enabled)!==null&&u!==void 0?u:C==null?void 0:C.enabled)!==null&&l!==void 0?l:!1,respectSamplingDecision:(c=(d=k==null?void 0:k.respectSamplingDecision)!==null&&d!==void 0?d:C==null?void 0:C.respectSamplingDecision)!==null&&c!==void 0?c:!0},accessToken:async()=>""};return n.accessToken?N.accessToken=n.accessToken:delete N.accessToken,N}function lO(n){const e=n==null?void 0:n.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(rO(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var uO=class extends Lj{constructor(n){super(n)}},cO=class{constructor(n,e,s){var a,l;this.supabaseUrl=n,this.supabaseKey=e;const u=lO(n);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const c=`sb-${u.hostname.split(".")[0]}-auth-token`,d={db:Hj,realtime:qj,auth:Je(Je({},$j),{},{storageKey:c}),global:Pj,tracePropagation:Ij},m=oO(s??{},d);if(this.settings=m,this.storageKey=(a=m.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(l=m.global.headers)!==null&&l!==void 0?l:{},m.accessToken)this.accessToken=m.accessToken,this.auth=new Proxy({},{get:(g,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=m.auth)!==null&&p!==void 0?p:{},this.headers,m.global.fetch)}this.fetch=sO(e,n,this._getAccessToken.bind(this),m.global.fetch,m.tracePropagation),this.realtime=this._initRealtimeClient(Je({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},m.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(g=>this.realtime.setAuth(g)).catch(g=>console.warn("Failed to set initial Realtime auth token:",g)),this.rest=new bC(new URL("rest/v1",u).href,{headers:this.headers,schema:m.db.schema,fetch:this.fetch,timeout:m.db.timeout,urlLengthLimit:m.db.urlLengthLimit}),this.storage=new Lk(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),m.accessToken||this._listenForAuthEvents()}get functions(){return new cC(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,s)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,e,s;if(n.accessToken)return await n.accessToken();const{data:a}=await n.auth.getSession();return(e=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:s,storage:a,userStorage:l,storageKey:u,flowType:c,lock:d,debug:m,throwOnError:p,experimental:g,lockAcquireTimeout:v,skipAutoInitialize:w},x,S){const A={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new uO({url:this.authUrl.href,headers:Je(Je({},A),x),storageKey:u,autoRefreshToken:n,persistSession:e,detectSessionInUrl:s,storage:a,userStorage:l,flowType:c,lock:d,debug:m,throwOnError:p,experimental:g,fetch:S,lockAcquireTimeout:v,skipAutoInitialize:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new ok(this.realtimeUrl.href,Je(Je({},n),{},{params:Je(Je({},{apikey:this.supabaseKey}),n==null?void 0:n.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,e)=>{this._handleTokenChanged(n,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(n,e,s){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const hO=(n,e,s)=>new cO(n,e,s);function dO(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const e=n.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=20:!1}dO()&&console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const fO="https://dbit.digitalcompass.agency",f_="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",kr=!!f_,Ut=kr?hO(fO,f_,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}):null;function mO(){return new URL("/cruce-cuentas/",window.location.origin).toString()}const Cl=10;function pO(n){return n==="TT"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-tt-historicos":"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-historicos"}function gO(n){return n==="TT"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-tt-marcar-resuelto":"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-marcar-resuelto"}function gn(n){const e=Number(n);return Number.isFinite(e)?e:0}function yO(n,e){if(!n)return"";const s=new Date(String(n));return Number.isNaN(s.getTime())?String(n).slice(0,10):s.toLocaleDateString(e,{year:"numeric",month:"2-digit",day:"2-digit"})}function Hd(n,e){if(!n)return"";const s=new Date(String(n));return Number.isNaN(s.getTime())?String(n):s.toLocaleString(e,{dateStyle:"short",timeStyle:"short"})}function vO(n){return String(n??"").toLowerCase().includes("resuelto")?"Resuelto":"Pendiente revisión"}function Fv(n,e){const s=n,a=!Array.isArray(s)&&s?s:{};return(Array.isArray(s)?s:Array.isArray(a.reports)?a.reports:[]).map((u,c)=>{const d=u,m=gn(d.discrepancias??d.discrepancies),p=gn(d.bancoSinNomina??d.banco_sin_nomina??d.bankWithoutPayroll),g=gn(d.bancoSinBamboo??d.banco_sin_bamboo??d.bankWithoutBamboo),v=gn(d.nominaSinCuenta??d.nomina_sin_cuenta??d.payrollWithoutAccount),w=gn(d.diferenciasNombreBanco??d.diferencias_nombre_banco??d.nameDifferences),x=m+p+g+v+w,S=String(d.country??d.pais??d.country_code??e.code).toUpperCase(),A=Array.isArray(d.archivosBanco)?d.archivosBanco.map(String):Array.isArray(d.bank_file_names)?d.bank_file_names.map(String):[],k=d.fechaEjecucion??d.ejecutado_en??d.created_at;return{id:String(d.id??`reporte-${c+1}`),country:S==="TT"?"TT":"GT",date:yO(d.fecha??d.period_end??k,e.locale),executionDate:Hd(k,e.locale),period:String(d.periodo??d.period_label??d.period??"Período no especificado"),payrollFile:String(d.archivoNomina??d.payroll_file_name??d.payrollFile??""),bankFiles:A,matches:gn(d.coincidencias??d.matches),discrepancies:m,bankWithoutPayroll:p,bankWithoutBamboo:g,payrollWithoutAccount:v,nameDifferences:w,totalPending:x,totalPayroll:gn(d.totalNomina??d.total_nomina),totalBank:gn(d.totalBanco??d.total_banco),totalDifference:gn(d.diferenciaTotal??d.diferencia_total),status:vO(d.estado??d.status??d.estadoLabel),reportUrl:d.reportUrl||d.report_url?String(d.reportUrl??d.report_url):void 0,spreadsheetId:d.spreadsheetId||d.spreadsheet_id?String(d.spreadsheetId??d.spreadsheet_id):void 0,executedBy:d.ejecutadoPorNombre||d.ejecutado_por_nombre?String(d.ejecutadoPorNombre??d.ejecutado_por_nombre):void 0,executedByEmail:d.ejecutadoPorEmail||d.ejecutado_por_email?String(d.ejecutadoPorEmail??d.ejecutado_por_email):void 0,resolvedBy:d.resueltoPorNombre||d.resuelto_por_nombre?String(d.resueltoPorNombre??d.resuelto_por_nombre):void 0,resolvedByEmail:d.resueltoPorEmail||d.resuelto_por_email?String(d.resueltoPorEmail??d.resuelto_por_email):void 0,resolvedAt:Hd(d.resueltoEn??d.resuelto_en,e.locale),resolutionComment:d.comentarioResolucion||d.comentario_resolucion?String(d.comentarioResolucion??d.comentario_resolucion):void 0,_sortTime:new Date(String(k??d.period_end??"")).getTime()||0}}).filter(u=>u.country===e.code).sort((u,c)=>c._sortTime-u._sortTime).map(({_sortTime:u,...c})=>c)}function bO(n){return n==="Resuelto"?"bg-blue-50 text-blue-800 border-blue-200":"bg-amber-50 text-amber-800 border-amber-200"}function wO(n){return n==="Resuelto"?"RESUELTO":"PENDIENTE REVISIÓN"}function _O({onShowToast:n,onOpenSidebar:e,operatorName:s,operatorEmail:a,country:l}){const[u,c]=V.useState(""),[d,m]=V.useState("todos"),[p,g]=V.useState([]),[v,w]=V.useState(1),[x,S]=V.useState(!1),[A,k]=V.useState(!1),[C,N]=V.useState(""),[O,P]=V.useState(null),[J,X]=V.useState(""),[G,Z]=V.useState(0),[ee,ne]=V.useState(0),le=V.useRef(0),de=V.useRef(null),je=Math.max(1,Math.ceil(ee/Cl)),Re=p;V.useEffect(()=>{w(1)},[u,d,l.code]),V.useEffect(()=>{v>je&&w(je)},[v,je]);const ke=async()=>{var B;const I=++le.current;(B=de.current)==null||B.abort();const oe=new AbortController;de.current=oe;const E=()=>le.current===I&&!oe.signal.aborted;S(!0),N("");try{if(Ut){const wt=d==="pendiente"?"pendiente_revision":d==="resuelto"?"resuelto":null,{data:Yt,error:oi}=await Ut.rpc("cruce_cuentas_get_historicos",{p_country:l.code,p_page:v,p_page_size:Cl,p_search:u.trim()||null,p_status:wt});if(!E())return;if(!oi&&Yt){const dt=Array.isArray(Yt)?Yt[0]:Yt,Pi=Fv(dt,l),F=gn(dt==null?void 0:dt.total),ge=gn((dt==null?void 0:dt.filtered_total)??F);g(Pi),Z(F),ne(ge);return}}if(!E())return;const K=pO(l.code);if(!K)throw new Error(`No está configurado el origen histórico de ${l.name}.`);const W=new URL(K);W.searchParams.set("country",l.code);const he=await fetch(W.toString(),{method:"GET",signal:oe.signal}),ue=await he.json().catch(()=>null);if(!E())return;if(!he.ok||(ue==null?void 0:ue.ok)===!1)throw new Error("No se pudieron cargar los reportes históricos.");const _e=Fv(ue,l),qe=u.trim().toLowerCase(),He=_e.filter(wt=>{const Yt=d==="todos"||d==="pendiente"&&wt.status==="Pendiente revisión"||d==="resuelto"&&wt.status==="Resuelto",oi=!qe||wt.period.toLowerCase().includes(qe)||wt.payrollFile.toLowerCase().includes(qe)||wt.id.toLowerCase().includes(qe)||(wt.resolvedBy??"").toLowerCase().includes(qe)||(wt.executedBy??"").toLowerCase().includes(qe);return Yt&&oi});if(!E())return;const _n=(v-1)*Cl;g(He.slice(_n,_n+Cl)),Z(_e.length),ne(He.length)}catch(K){if(!E()||K instanceof DOMException&&K.name==="AbortError")return;g([]),Z(0),ne(0),N(K instanceof Error?K.message:"No se pudieron cargar los reportes históricos. Intenta nuevamente."),n("No se pudieron cargar los reportes históricos.","error")}finally{E()&&(S(!1),de.current===oe&&(de.current=null))}};V.useEffect(()=>{const I=window.setTimeout(()=>{ke()},u.trim()?300:0);return()=>{var oe;window.clearTimeout(I),le.current+=1,(oe=de.current)==null||oe.abort(),de.current=null}},[l.code,v,u,d]);const L=I=>{if(I.reportUrl){window.open(I.reportUrl,"_blank","noopener,noreferrer");return}n("Este reporte aún no tiene un Google Sheet disponible.","info")},Q=I=>{if(I.status==="Resuelto"){n("Este reporte ya fue marcado como resuelto.","info");return}P(I),X("")},Y=async()=>{if(!O)return;const I=J.trim();if(I.length<10){n("Debes escribir un comentario de resolución más descriptivo.","error");return}const oe=gO(l.code);if(!oe){n(`La resolución de reportes para ${l.name} estará disponible próximamente.`,"info");return}k(!0);try{const E=await fetch(oe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reportId:O.id,comentarioResolucion:I,resueltoPorNombre:s,resueltoPorEmail:a,country:l.code,countryName:l.name})}),B=await E.json().catch(()=>null);if(!E.ok||(B==null?void 0:B.ok)===!1){const he=Array.isArray(B==null?void 0:B.errors)?B.errors.join(`
`):(B==null?void 0:B.message)||"No se pudo marcar el reporte como resuelto.";throw new Error(he)}const K=B.report??{},W=Hd(K.resueltoEn??new Date().toISOString(),l.locale);g(he=>he.map(ue=>ue.id===O.id?{...ue,status:"Resuelto",resolvedBy:String(K.resueltoPorNombre??s),resolvedByEmail:String(K.resueltoPorEmail??a),resolvedAt:W,resolutionComment:String(K.comentarioResolucion??I)}:ue)),P(null),X(""),n("Reporte marcado como resuelto correctamente.","success")}catch(E){const B=E instanceof Error?E.message:"No se pudo marcar el reporte como resuelto.";n(B,"error")}finally{k(!1)}};return b.jsxs("div",{className:"flex-1 flex flex-col min-h-screen bg-neutral-50 text-neutral-800 font-sans",children:[b.jsxs("header",{className:"bg-white border-b-4 border-[#6CC24A] flex justify-between items-center w-full px-4 sm:px-8 h-[84px] sticky top-0 z-40 shadow-sm gap-x-4",children:[b.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[b.jsx("button",{onClick:e,className:"md:hidden p-2 -ml-2 text-neutral-600 hover:text-neutral-800 hover:bg-neutral-100 transition-colors flex-shrink-0","aria-label":"Abrir menú",children:b.jsx(Pw,{className:"w-6 h-6"})}),b.jsx("h1",{className:"text-xs sm:text-sm md:text-lg lg:text-2xl font-black text-[#4F758B] tracking-tight uppercase flex items-center gap-1.5 sm:gap-2 min-w-0",children:b.jsxs("span",{className:"truncate",children:["Reportes Históricos - ",l.name]})})]}),b.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[b.jsx("div",{className:"hidden sm:flex items-center border border-neutral-200 bg-white px-2.5 py-2 shadow-sm","aria-label":`Bandera de ${l.name}`,children:b.jsx("img",{src:l.flag,alt:`Bandera de ${l.name}`,className:"h-5 sm:h-6 w-auto object-contain"})}),b.jsxs("button",{onClick:ke,disabled:x,className:"hidden sm:inline-flex items-center gap-2 border border-[#4F758B]/20 text-[#4F758B] px-3 py-2 text-xs font-bold hover:border-[#4F758B]/50 disabled:opacity-50",children:[b.jsx(DR,{className:`w-4 h-4 ${x?"animate-spin":""}`}),"Actualizar"]})]})]}),b.jsxs("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 py-8 flex flex-col gap-6",children:[b.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-4 flex flex-col lg:flex-row items-center justify-between gap-4 shadow-sm",children:[b.jsxs("div",{className:"relative w-full lg:max-w-md",children:[b.jsx(Hw,{className:"absolute left-3.5 top-1/2 transform -translate-y-1/2 text-neutral-400 w-4 h-4"}),b.jsx("input",{type:"text",placeholder:"Buscar por período, reporte, archivo o resolutor...",value:u,onChange:I=>c(I.target.value),className:"w-full pl-10 pr-4 py-2 border border-[#D0D0D0] text-xs font-medium placeholder-neutral-400 focus:outline-none focus:border-[#4F758B] transition-colors"})]}),b.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 w-full lg:w-auto",children:[b.jsx("div",{className:"flex flex-wrap gap-2",children:[["todos","Todos"],["pendiente","Pendiente revisión"],["resuelto","Resuelto"]].map(([I,oe])=>b.jsx("button",{onClick:()=>m(I),className:`px-3 py-1.5 text-[10px] uppercase tracking-wider font-black border transition-colors ${d===I?"bg-[#4F758B] text-white border-[#4F758B]":"bg-white text-neutral-500 border-neutral-300 hover:border-[#4F758B] hover:text-[#4F758B]"}`,children:oe},I))}),b.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-neutral-500",children:[b.jsx(vR,{className:"w-4 h-4 text-neutral-400"}),b.jsxs("span",{children:["Mostrando: ",ee," de ",G," reportes"]})]})]})]}),C&&b.jsxs("div",{className:"border border-red-200 bg-red-50 text-[#ba1a1a] px-4 py-3 text-xs font-bold flex items-center gap-2",children:[b.jsx(xf,{className:"w-4 h-4"}),C]}),b.jsxs("div",{className:"bg-white border border-[#D0D0D0] shadow-sm overflow-hidden",children:[b.jsx("div",{className:"overflow-x-auto",children:b.jsxs("table",{className:"w-full text-left border-collapse min-w-[960px] xl:min-w-full",children:[b.jsx("thead",{children:b.jsxs("tr",{className:"bg-[#4F758B] text-white text-xs font-bold uppercase tracking-wider",children:[b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Fecha"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Período"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Archivo de Nómina"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Coincidencias"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Banco sin Bamboo"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Pendientes"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Estado"}),b.jsx("th",{className:"py-3 px-3 xl:px-4",children:"Resuelto por"}),b.jsx("th",{className:"py-3 px-3 xl:px-4 text-center",children:"Acciones"})]})}),b.jsx("tbody",{className:"divide-y divide-neutral-200 text-xs",children:x?b.jsx("tr",{children:b.jsx("td",{colSpan:9,className:"py-12 text-center text-neutral-400 font-medium",children:b.jsxs("div",{className:"inline-flex items-center gap-2",children:[b.jsx(kd,{className:"w-4 h-4 animate-spin"}),"Cargando reportes históricos..."]})})}):Re.length>0?Re.map(I=>b.jsxs(bn.tr,{initial:{opacity:0},animate:{opacity:1},className:"hover:bg-neutral-50/70 transition-colors",children:[b.jsx("td",{className:"py-3 px-3 xl:px-4 font-medium text-neutral-700",children:b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(nR,{className:"w-4 h-4 text-neutral-400"}),b.jsxs("div",{children:[b.jsx("span",{children:I.date}),I.executionDate&&b.jsx("p",{className:"text-[9px] text-neutral-400 mt-0.5",children:I.executionDate})]})]})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 font-bold text-[#4F758B]",children:I.period}),b.jsx("td",{className:"py-3 px-3 xl:px-4 font-mono text-neutral-500 truncate max-w-[260px]",title:I.payrollFile,children:b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(Ll,{className:"w-4 h-4 text-neutral-400 flex-shrink-0"}),b.jsx("span",{className:"truncate",children:I.payrollFile||"No especificado"})]})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center font-black text-emerald-800",children:I.matches}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center",children:b.jsx("span",{className:`inline-block min-w-8 px-2.5 py-1 text-[10px] font-black border ${I.bankWithoutBamboo>0?"bg-orange-50 text-orange-800 border-orange-200":"bg-neutral-50 text-neutral-400 border-neutral-200"}`,children:I.bankWithoutBamboo})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center",children:b.jsx("span",{className:`inline-block px-2.5 py-1 text-[10px] font-bold border ${I.totalPending>0?"bg-red-50 text-[#ba1a1a] border-red-200":"bg-emerald-50 text-emerald-800 border-emerald-200"}`,children:I.totalPending===0?"Sin pendientes":`${I.totalPending} pendiente${I.totalPending>1?"s":""}`})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center",children:b.jsx("span",{className:`inline-block px-2.5 py-1 text-[9px] uppercase font-black tracking-wider border ${bO(I.status)}`,children:wO(I.status)})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-neutral-600 max-w-[220px]",children:I.resolvedBy?b.jsxs("div",{title:I.resolutionComment||"",children:[b.jsx("p",{className:"font-bold text-neutral-700 truncate",children:I.resolvedBy}),b.jsx("p",{className:"text-[10px] text-neutral-400",children:I.resolvedAt})]}):b.jsx("span",{className:"text-neutral-400",children:"Pendiente"})}),b.jsx("td",{className:"py-3 px-3 xl:px-4 text-center",children:b.jsxs("div",{className:"flex justify-center gap-2",children:[b.jsxs("button",{onClick:()=>L(I),className:"inline-flex items-center gap-1.5 text-[#4F758B] hover:text-[#3d6378] font-bold text-xs border border-[#4F758B]/20 hover:border-[#4F758B]/50 px-3 py-1.5 bg-white hover:bg-neutral-50 transition-colors",children:[b.jsx(mR,{className:"w-3.5 h-3.5"}),b.jsx("span",{children:"Ver"})]}),b.jsxs("button",{onClick:()=>Q(I),disabled:I.status==="Resuelto",className:"inline-flex items-center gap-1.5 text-emerald-700 hover:text-emerald-800 font-bold text-xs border border-emerald-200 hover:border-emerald-400 px-3 py-1.5 bg-emerald-50 hover:bg-emerald-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[b.jsx(_f,{className:"w-3.5 h-3.5"}),b.jsx("span",{children:I.status==="Resuelto"?"Resuelto":"Marcar resuelto"})]})]})})]},I.id)):b.jsx("tr",{children:b.jsx("td",{colSpan:9,className:"py-12 text-center text-neutral-400 font-medium",children:"No se encontraron reportes históricos."})})})]})}),b.jsxs("div",{className:"p-4 border-t border-neutral-200 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs text-neutral-500",children:[b.jsxs("span",{children:["Mostrando ",Re.length," de ",ee," reporte(s)."]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("button",{onClick:()=>w(I=>Math.max(1,I-1)),disabled:v===1,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Anterior"}),b.jsxs("span",{className:"font-bold text-neutral-700",children:["Página ",v," de ",je]}),b.jsx("button",{onClick:()=>w(I=>Math.min(je,I+1)),disabled:v===je,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Siguiente"})]})]})]})]}),b.jsx(cs,{children:O&&b.jsx(bn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/45 px-4",children:b.jsxs(bn.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},className:"w-full max-w-lg bg-white border border-[#D0D0D0] shadow-xl",children:[b.jsxs("div",{className:"border-b border-neutral-200 px-5 py-4 flex items-center justify-between",children:[b.jsxs("div",{children:[b.jsx("h2",{className:"text-base font-black text-[#4F758B] uppercase tracking-tight",children:"Marcar reporte como resuelto"}),b.jsx("p",{className:"text-xs text-neutral-500 mt-1",children:O.period})]}),b.jsx("button",{onClick:()=>P(null),disabled:A,className:"p-2 text-neutral-400 hover:text-neutral-700 disabled:opacity-50","aria-label":"Cerrar",children:b.jsx(Sf,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"p-5 space-y-4",children:[b.jsx("div",{className:"bg-amber-50 border border-amber-200 text-amber-800 p-3 text-xs leading-relaxed",children:"Antes de resolver, confirma que las diferencias fueron revisadas y explica cómo se cerró el caso."}),b.jsxs("label",{className:"block",children:[b.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black text-neutral-500",children:"Comentario de resolución"}),b.jsx("textarea",{value:J,onChange:I=>X(I.target.value),placeholder:"Ejemplo: Se corrigió la cuenta bancaria en nómina y se validó contra el banco.",className:"mt-2 w-full min-h-[130px] border border-[#D0D0D0] px-3 py-2 text-sm focus:outline-none focus:border-[#4F758B]"})]})]}),b.jsxs("div",{className:"border-t border-neutral-200 px-5 py-4 flex justify-end gap-3",children:[b.jsx("button",{onClick:()=>P(null),disabled:A,className:"border border-neutral-300 bg-white px-4 py-2 text-xs font-bold text-neutral-600 hover:bg-neutral-50 disabled:opacity-50",children:"Cancelar"}),b.jsxs("button",{onClick:Y,disabled:A,className:"bg-[#4F758B] hover:bg-[#41677b] text-white px-4 py-2 text-xs font-black uppercase tracking-wider disabled:opacity-50 inline-flex items-center gap-2",children:[A&&b.jsx(kd,{className:"w-4 h-4 animate-spin"}),"Confirmar resolución"]})]})]})})})]})}function id({message:n,type:e,onClose:s}){V.useEffect(()=>{const u=setTimeout(()=>{s()},2e3);return()=>clearTimeout(u)},[s]);const a={success:"bg-[#6CC24A] text-white border-l-4 border-emerald-700",error:"bg-[#ba1a1a] text-white border-l-4 border-red-800",info:"bg-[#4F758B] text-white border-l-4 border-slate-700"},l={success:_f,error:rR,info:Vw}[e];return b.jsx("div",{className:"fixed bottom-6 right-6 z-50 max-w-sm w-full",children:b.jsxs(bn.div,{initial:{opacity:0,y:30,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},className:`flex items-center gap-3 p-4 shadow-lg rounded-md border border-neutral-200/10 ${a[e]}`,children:[b.jsx("span",{className:"flex-shrink-0",children:b.jsx(l,{className:"w-5 h-5"})}),b.jsx("div",{className:"flex-1 font-medium text-sm leading-tight pr-2",children:n}),b.jsx("button",{onClick:s,className:"flex-shrink-0 hover:bg-white/20 p-1 rounded transition-colors text-white",children:b.jsx(Sf,{className:"w-4 h-4"})})]})})}function xO({onShowToast:n}){const[e,s]=V.useState(!1),a=async()=>{if(!kr||!Ut){n("El acceso con Google aún no está disponible. Contacta a IT.","error");return}s(!0);const{error:l}=await Ut.auth.signInWithOAuth({provider:"google",options:{redirectTo:mO(),queryParams:{access_type:"offline",prompt:"select_account"}}});l&&(s(!1),n("No se pudo iniciar sesión con Google. Intenta nuevamente.","error"))};return b.jsxs("div",{className:"min-h-screen w-full flex flex-col justify-between bg-[#F5F5F5] relative overflow-hidden font-sans",children:[b.jsx("div",{className:"h-1.5 w-full bg-[#4F758B]"}),b.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:b.jsxs(bn.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"w-full max-w-md bg-white border border-[#D0D0D0] p-8 shadow-xl flex flex-col items-center gap-6",children:[b.jsx("div",{className:"w-full flex justify-center py-2",children:b.jsx("img",{alt:"Logo GOMEZLEE MARKETING",className:"h-14 object-contain",src:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png",referrerPolicy:"no-referrer"})}),b.jsx("div",{className:"text-center w-full",children:b.jsx("h1",{className:"text-2xl font-bold text-[#4F758B] tracking-tight",children:"Portal de Cruce de Cuentas GLM"})}),b.jsx("button",{onClick:a,disabled:e||!kr,className:"w-full relative overflow-hidden flex items-center justify-center gap-3 bg-[#6CC24A] hover:bg-[#5bb03c] disabled:bg-neutral-300 disabled:cursor-not-allowed text-white font-semibold py-3.5 px-6 transition-all duration-150 transform active:scale-[0.99] select-none text-sm tracking-wide",children:e?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),b.jsx("span",{children:"Redirigiendo a Google..."})]}):b.jsxs(b.Fragment,{children:[b.jsxs("svg",{className:"w-5 h-5 flex-shrink-0 fill-current text-white",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),b.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),b.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),b.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),b.jsx("span",{children:"Continuar con Google"})]})}),!kr&&b.jsxs("div",{className:"w-full flex items-start gap-2 border border-amber-200 bg-amber-50 px-3 py-2 text-[11px] text-amber-800 leading-relaxed",children:[b.jsx(xf,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),b.jsx("span",{children:"El acceso con Google está pendiente de activación."})]})]})})]})}const SO="https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png";function TO({onSelect:n}){return b.jsxs("div",{className:"min-h-screen bg-[#F5F5F5] flex flex-col font-sans",children:[b.jsx("div",{className:"h-1.5 bg-[#6CC24A]"}),b.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-10",children:b.jsxs(bn.section,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},className:"w-full max-w-3xl bg-white border border-[#D0D0D0] shadow-xl p-6 sm:p-9",children:[b.jsx("img",{src:SO,alt:"GomezLee Marketing",className:"h-14 object-contain mb-7"}),b.jsxs("div",{className:"flex items-start gap-3 mb-7",children:[b.jsx("div",{className:"bg-[#4F758B]/10 p-2.5 rounded-full",children:b.jsx(zw,{className:"w-5 h-5 text-[#4F758B]"})}),b.jsxs("div",{children:[b.jsx("h1",{className:"text-xl sm:text-2xl font-black text-[#4F758B] uppercase tracking-tight",children:"Selecciona el país"}),b.jsx("p",{className:"text-sm text-neutral-500 mt-1",children:"El portal cargará las reglas, la moneda y los reportes correspondientes."})]})]}),b.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Mr.map(e=>b.jsxs("button",{type:"button",disabled:!e.enabled,onClick:()=>e.enabled&&n(e.code),className:`text-left border p-5 transition-all min-h-[150px] flex flex-col justify-between ${e.enabled?"border-[#4F758B]/30 hover:border-[#4F758B] hover:shadow-md bg-white":"border-neutral-200 bg-neutral-50 cursor-not-allowed opacity-70"}`,children:[b.jsxs("div",{className:"flex items-start justify-between gap-3",children:[b.jsx("img",{src:e.flag,alt:"",className:"w-12 h-8 sm:w-16 sm:h-10 object-cover shadow-sm border border-neutral-200","aria-hidden":"true"}),e.enabled?b.jsx(Q2,{className:"w-5 h-5 text-[#6CC24A]"}):b.jsx(TR,{className:"w-4 h-4 text-neutral-400"})]}),b.jsxs("div",{children:[b.jsx("p",{className:"font-black text-[#4F758B] uppercase tracking-wide",children:e.name}),b.jsx("p",{className:"text-xs text-neutral-500 mt-1",children:e.enabled?`Moneda ${e.currency}`:"Próximamente"})]})]},e.code))})]})})]})}const EO="cruce_cuentas_mi_acceso",Yv=2;function m_(n){return(n??"").trim().toLowerCase()}function AO(n){return Array.isArray(n)?Array.from(new Set(n.map(e=>String(e??"").trim().toUpperCase()).filter(Boolean))):[]}function RO(n){const e=Array.isArray(n)?n[0]:n;if(!e||typeof e!="object")throw new Error("Supabase no devolvió una respuesta válida al comprobar el acceso.");return{ok:e.ok===!0,authenticated:e.autenticado===!0,authorized:e.autorizado===!0,email:m_(typeof e.email=="string"?e.email:""),name:typeof e.nombre=="string"?e.nombre.trim():"",active:e.activo===!0,appAccess:e.acceso_app===!0,historyAccess:e.acceso_historicos===!0,receivesGeneratedReports:e.recibe_reportes_generados===!0,receivesResolvedEmails:e.recibe_correos_resuelto===!0,countries:AO(e.paises),reason:typeof e.motivo=="string"?e.motivo.trim():""}}function CO(n){return new Promise(e=>window.setTimeout(e,n))}async function kO(){if(!Ut)throw new Error("Supabase no está configurado.");let n=null;for(let s=1;s<=Yv;s+=1){const{data:a,error:l}=await Ut.rpc(EO);if(!l)return RO(a);n=l,s<Yv&&await CO(300)}const e=n&&typeof n=="object"&&"message"in n?String(n.message??""):"";throw new Error(e||"No se pudo validar el acceso del usuario en Supabase.")}const jO="glm_cruce_cuentas_tab_state",OO=1,Un="drafts",Xv="glm_cruce_cuentas_tab_session_id",p_=1,NO=10080*60*1e3;let sa=null,ma=Promise.resolve(),Jv=null;function Qv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`}function Ef(){try{const n=window.sessionStorage.getItem(Xv);if(n)return n;const e=Qv();return window.sessionStorage.setItem(Xv,e),e}catch{return Jv??(Jv=Qv()),Jv}}function Af(){return sa||(sa=new Promise((n,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB no está disponible en este navegador."));return}const s=indexedDB.open(jO,OO);s.onupgradeneeded=()=>{const a=s.result;a.objectStoreNames.contains(Un)||a.createObjectStore(Un,{keyPath:"sessionId"})},s.onsuccess=()=>n(s.result),s.onerror=()=>e(s.error??new Error("No se pudo abrir IndexedDB.")),s.onblocked=()=>e(new Error("La base local está bloqueada por otra pestaña."))}),sa.catch(()=>{sa=null}),sa)}function DO(n){return new Promise((e,s)=>{n.onsuccess=()=>e(n.result),n.onerror=()=>s(n.error??new Error("Falló una operación local."))})}function du(n){return new Promise((e,s)=>{n.oncomplete=()=>e(),n.onerror=()=>s(n.error??new Error("Falló la transacción local.")),n.onabort=()=>s(n.error??new Error("La transacción local fue cancelada."))})}function MO(n){if(!n||typeof n!="object")return!1;const e=n;return e.version===p_&&typeof e.sessionId=="string"&&typeof e.updatedAt=="number"&&(e.currentView==="cruce"||e.currentView==="historial")&&Array.isArray(e.uploadedBankFiles)&&typeof e.isCruceExecuted=="boolean"}async function UO(n,e){const s=Date.now()-NO,a=n.transaction(Un,"readwrite"),l=du(a),c=a.objectStore(Un).openCursor();await new Promise((d,m)=>{c.onsuccess=()=>{const p=c.result;if(!p){d();return}const g=p.value;g.sessionId!==e&&typeof g.updatedAt=="number"&&g.updatedAt<s&&p.delete(),p.continue()},c.onerror=()=>m(c.error??new Error("No se pudieron limpiar borradores antiguos."))}),await l}async function BO(){const n=Ef();try{const e=await Af(),s=e.transaction(Un,"readonly"),a=du(s),l=await DO(s.objectStore(Un).get(n));return await a,UO(e,n).catch(()=>{}),MO(l)?l:null}catch{return null}}function LO(n){const e=Ef(),s={...n,version:p_,sessionId:e,updatedAt:Date.now()};return ma=ma.catch(()=>{}).then(async()=>{const l=(await Af()).transaction(Un,"readwrite"),u=du(l);l.objectStore(Un).put(s),await u}).catch(()=>{}),ma}function Zv(){const n=Ef();return ma=ma.catch(()=>{}).then(async()=>{const s=(await Af()).transaction(Un,"readwrite"),a=du(s);s.objectStore(Un).delete(n),await a}).catch(()=>{}),ma}const Wv=!0,$d="glm_cruce_selected_country",zO={name:"Isaac Aracena",email:"iaracena@gomezleemarketing.com"};function VO(n){const e=(n==null?void 0:n.user_metadata)??{},s=e.full_name||e.name||e.display_name;if(s)return String(s);const a=String((n==null?void 0:n.email)??"Usuario GLM");return a.includes("@")?a.split("@")[0]:a}function PO(){try{const n=window.localStorage.getItem($d),e=Mr.find(s=>s.code===n&&s.enabled);return(e==null?void 0:e.code)??null}catch{return null}}function HO(){const[n,e]=V.useState("cruce"),[s,a]=V.useState(!1),[l,u]=V.useState(null),[c,d]=V.useState([]),[m,p]=V.useState(!1),[g,v]=V.useState(null),[w,x]=V.useState(0),[S,A]=V.useState(()=>PO()),[k,C]=V.useState(null),[N,O]=V.useState(Wv),[P,J]=V.useState(!1),[X,G]=V.useState(null),Z=V.useRef(0),ee=V.useMemo(()=>kr&&Ut,[]),ne=S?nv(S):null,le=(Y,I)=>{G({message:Y,type:I})};V.useEffect(()=>{if(!ee||!Ut){O(!1);return}let Y=!0;const I=async B=>{const K=++Z.current;if(!(B!=null&&B.email)){Y&&K===Z.current&&C(null);return}try{const W=await kO();if(!Y||K!==Z.current)return;const he=m_(B.email),ue=!!W.email&&W.email===he;if(!W.ok||!W.authenticated||!W.authorized||!W.active||!W.appAccess||!ue){C(null),le(W.reason||"Tu usuario no tiene acceso autorizado a este módulo.","error"),Ut.auth.signOut();return}C({name:W.name||VO(B),email:he})}catch(W){if(!Y||K!==Z.current)return;console.error("No se pudo validar el acceso en Supabase:",W),C(null),le("No se pudo validar tu acceso en Supabase. Intenta iniciar sesión nuevamente.","error"),Ut.auth.signOut()}};(async()=>{var B;try{const{data:K,error:W}=await Ut.auth.getSession();if(W)throw W;if(!Y)return;await I((B=K.session)==null?void 0:B.user)}catch(K){if(!Y)return;console.error("No se pudo recuperar la sesión de Supabase:",K),C(null),le("No se pudo recuperar tu sesión. Intenta iniciar sesión nuevamente.","error")}finally{Y&&O(!1)}})();const{data:E}=Ut.auth.onAuthStateChange((B,K)=>{if(Y){if(K!=null&&K.user){window.setTimeout(()=>{Y&&I(K.user)},0);return}B==="SIGNED_OUT"&&(Z.current+=1,C(null),O(!1))}});return()=>{Y=!1,Z.current+=1,E.subscription.unsubscribe()}},[ee]),V.useEffect(()=>{let Y=!0;return(async()=>{const oe=await BO();Y&&(oe&&(!S||oe.countryCode===S?(oe.countryCode&&A(oe.countryCode),e(oe.currentView),u(oe.uploadedPayroll),d(oe.uploadedBankFiles),p(oe.isCruceExecuted),v(oe.cruceResponse)):await Zv()),Y&&J(!0))})(),()=>{Y=!1}},[]),V.useEffect(()=>{P&&LO({countryCode:S,currentView:n,uploadedPayroll:l,uploadedBankFiles:c,isCruceExecuted:m,cruceResponse:g})},[P,S,n,l,c,m,g]);const de=()=>{u(null),d([]),p(!1),v(null),x(Y=>Y+1)},je=async()=>{await Zv(),Ut&&await Ut.auth.signOut(),C(null),A(null),window.localStorage.removeItem($d),de(),e("cruce"),le("Sesión cerrada correctamente.","success")},Re=()=>{de(),e("cruce"),le("Nuevo cruce iniciado.","success")},ke=Y=>{const I=nv(Y);if(!I.enabled){le(`${I.name} estará disponible próximamente.`,"info");return}S&&S!==Y&&de(),A(Y),window.localStorage.setItem($d,Y),e("cruce"),a(!1)},L=()=>{A(null),a(!1)};if(N)return b.jsx("div",{className:"min-h-screen bg-[#F5F5F5] flex items-center justify-center text-[#4F758B] font-black uppercase tracking-wider",children:"Validando acceso..."});if(!k)return b.jsxs(b.Fragment,{children:[b.jsx(xO,{onShowToast:le}),b.jsx(cs,{children:X&&b.jsx(id,{message:X.message,type:X.type,onClose:()=>G(null)})})]});if(!ne)return b.jsxs(b.Fragment,{children:[b.jsx(TO,{onSelect:ke}),b.jsx(cs,{children:X&&b.jsx(id,{message:X.message,type:X.type,onClose:()=>G(null)})})]});const Q=k??zO;return b.jsxs("div",{className:"min-h-screen bg-[#F5F5F5] selection:bg-[#6CC24A] selection:text-white antialiased font-sans flex flex-col",children:[b.jsxs(bn.div,{initial:{opacity:0},animate:{opacity:1},className:"min-h-screen flex w-full relative overflow-x-hidden",children:[b.jsx(cs,{children:s&&b.jsx(bn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>a(!1),className:"fixed inset-0 bg-black/45 z-45 md:hidden"},"backdrop")}),b.jsx(PR,{currentView:n,onViewChange:Y=>{e(Y),a(!1)},onNewCruce:()=>{Re(),a(!1)},isSidebarOpen:s,onCloseSidebar:()=>a(!1),user:Q,isAuthEnabled:Wv,onLogout:je,country:ne,onCountryChange:ke,onChooseAnotherCountry:L}),b.jsx("div",{className:"pl-0 md:pl-64 flex-1 flex flex-col w-full min-h-screen transition-all duration-300",children:b.jsx(cs,{mode:"wait",children:n==="cruce"?b.jsx(bn.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"flex-1 flex flex-col",children:b.jsx(rC,{onShowToast:le,uploadedPayroll:l,setUploadedPayroll:u,uploadedBankFiles:c,setUploadedBankFiles:d,isCruceExecuted:m,setIsCruceExecuted:p,response:g,setResponse:v,onOpenSidebar:()=>a(!0),operatorName:Q.name,operatorEmail:Q.email,resetToken:w,country:ne})},`view-cruce-${ne.code}`):b.jsx(bn.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"flex-1 flex flex-col",children:b.jsx(_O,{onShowToast:le,onOpenSidebar:()=>a(!0),operatorName:Q.name,operatorEmail:Q.email,country:ne})},`view-history-${ne.code}`)})})]},`interface-${ne.code}`),b.jsx(cs,{children:X&&b.jsx(id,{message:X.message,type:X.type,onClose:()=>G(null)})})]})}IS.createRoot(document.getElementById("root")).render(b.jsx(V.StrictMode,{children:b.jsx(HO,{})}));