const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalHome-BWb2gJcK.js","assets/ExperimentalHome-DQdVee5n.css","assets/BlogPage-BdLxmWg8.js","assets/blogArticles-D04Ysz0s.js","assets/BlogSidebar-BrClO7X4.js","assets/user-BvXIAUch.js","assets/BlogArticle-C6glRbDJ.js","assets/blogAuthors-B_BhA8O5.js","assets/NotFoundPage-B1RKt2Fy.js","assets/BlogCategory-DMpPCWoT.js","assets/BlogTag-CY2LIrMN.js","assets/BlogAuthor-VQaC9iof.js"])))=>i.map(i=>d[i]);
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Ag=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ef(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tf={exports:{}},ao={},rf={exports:{}},Q={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var bi=Symbol.for("react.element"),Tg=Symbol.for("react.portal"),Rg=Symbol.for("react.fragment"),Pg=Symbol.for("react.strict_mode"),Og=Symbol.for("react.profiler"),zg=Symbol.for("react.provider"),Ig=Symbol.for("react.context"),$g=Symbol.for("react.forward_ref"),Dg=Symbol.for("react.suspense"),Lg=Symbol.for("react.memo"),Fg=Symbol.for("react.lazy"),Mu=Symbol.iterator;function Ug(e){return e===null||typeof e!="object"?null:(e=Mu&&e[Mu]||e["@@iterator"],typeof e=="function"?e:null)}var nf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sf=Object.assign,af={};function os(e,t,r){this.props=e,this.context=t,this.refs=af,this.updater=r||nf}os.prototype.isReactComponent={};os.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};os.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function of(){}of.prototype=os.prototype;function Rc(e,t,r){this.props=e,this.context=t,this.refs=af,this.updater=r||nf}var Pc=Rc.prototype=new of;Pc.constructor=Rc;sf(Pc,os.prototype);Pc.isPureReactComponent=!0;var Hu=Array.isArray,lf=Object.prototype.hasOwnProperty,Oc={current:null},cf={key:!0,ref:!0,__self:!0,__source:!0};function uf(e,t,r){var n,s={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)lf.call(t,n)&&!cf.hasOwnProperty(n)&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:bi,type:e,key:i,ref:a,props:s,_owner:Oc.current}}function Bg(e,t){return{$$typeof:bi,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function zc(e){return typeof e=="object"&&e!==null&&e.$$typeof===bi}function Mg(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var qu=/\/+/g;function zo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Mg(""+e.key):t.toString(36)}function ia(e,t,r,n,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case bi:case Tg:a=!0}}if(a)return a=e,s=s(a),e=n===""?"."+zo(a,0):n,Hu(s)?(r="",e!=null&&(r=e.replace(qu,"$&/")+"/"),ia(s,t,r,"",function(u){return u})):s!=null&&(zc(s)&&(s=Bg(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(qu,"$&/")+"/")+e)),t.push(s)),1;if(a=0,n=n===""?".":n+":",Hu(e))for(var l=0;l<e.length;l++){i=e[l];var c=n+zo(i,l);a+=ia(i,t,r,c,s)}else if(c=Ug(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=n+zo(i,l++),a+=ia(i,t,r,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Ri(e,t,r){if(e==null)return e;var n=[],s=0;return ia(e,n,"","",function(i){return t.call(r,i,s++)}),n}function Hg(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ge={current:null},aa={transition:null},qg={ReactCurrentDispatcher:Ge,ReactCurrentBatchConfig:aa,ReactCurrentOwner:Oc};function df(){throw Error("act(...) is not supported in production builds of React.")}Q.Children={map:Ri,forEach:function(e,t,r){Ri(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Ri(e,function(){t++}),t},toArray:function(e){return Ri(e,function(t){return t})||[]},only:function(e){if(!zc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Q.Component=os;Q.Fragment=Rg;Q.Profiler=Og;Q.PureComponent=Rc;Q.StrictMode=Pg;Q.Suspense=Dg;Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qg;Q.act=df;Q.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=sf({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Oc.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)lf.call(t,c)&&!cf.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:bi,type:e.type,key:s,ref:i,props:n,_owner:a}};Q.createContext=function(e){return e={$$typeof:Ig,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:zg,_context:e},e.Consumer=e};Q.createElement=uf;Q.createFactory=function(e){var t=uf.bind(null,e);return t.type=e,t};Q.createRef=function(){return{current:null}};Q.forwardRef=function(e){return{$$typeof:$g,render:e}};Q.isValidElement=zc;Q.lazy=function(e){return{$$typeof:Fg,_payload:{_status:-1,_result:e},_init:Hg}};Q.memo=function(e,t){return{$$typeof:Lg,type:e,compare:t===void 0?null:t}};Q.startTransition=function(e){var t=aa.transition;aa.transition={};try{e()}finally{aa.transition=t}};Q.unstable_act=df;Q.useCallback=function(e,t){return Ge.current.useCallback(e,t)};Q.useContext=function(e){return Ge.current.useContext(e)};Q.useDebugValue=function(){};Q.useDeferredValue=function(e){return Ge.current.useDeferredValue(e)};Q.useEffect=function(e,t){return Ge.current.useEffect(e,t)};Q.useId=function(){return Ge.current.useId()};Q.useImperativeHandle=function(e,t,r){return Ge.current.useImperativeHandle(e,t,r)};Q.useInsertionEffect=function(e,t){return Ge.current.useInsertionEffect(e,t)};Q.useLayoutEffect=function(e,t){return Ge.current.useLayoutEffect(e,t)};Q.useMemo=function(e,t){return Ge.current.useMemo(e,t)};Q.useReducer=function(e,t,r){return Ge.current.useReducer(e,t,r)};Q.useRef=function(e){return Ge.current.useRef(e)};Q.useState=function(e){return Ge.current.useState(e)};Q.useSyncExternalStore=function(e,t,r){return Ge.current.useSyncExternalStore(e,t,r)};Q.useTransition=function(){return Ge.current.useTransition()};Q.version="18.3.1";rf.exports=Q;var _=rf.exports;const Wg=ef(_);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Vg=_,Kg=Symbol.for("react.element"),Gg=Symbol.for("react.fragment"),Jg=Object.prototype.hasOwnProperty,Yg=Vg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qg={key:!0,ref:!0,__self:!0,__source:!0};function hf(e,t,r){var n,s={},i=null,a=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(n in t)Jg.call(t,n)&&!Qg.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:Kg,type:e,key:i,ref:a,props:s,_owner:Yg.current}}ao.Fragment=Gg;ao.jsx=hf;ao.jsxs=hf;tf.exports=ao;var o=tf.exports,bl={},ff={exports:{}},ut={},pf={exports:{}},mf={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(O,U){var L=O.length;O.push(U);e:for(;0<L;){var G=L-1>>>1,B=O[G];if(0<s(B,U))O[G]=U,O[L]=B,L=G;else break e}}function r(O){return O.length===0?null:O[0]}function n(O){if(O.length===0)return null;var U=O[0],L=O.pop();if(L!==U){O[0]=L;e:for(var G=0,B=O.length,I=B>>>1;G<I;){var D=2*(G+1)-1,xe=O[D],re=D+1,ue=O[re];if(0>s(xe,L))re<B&&0>s(ue,xe)?(O[G]=ue,O[re]=L,G=re):(O[G]=xe,O[D]=L,G=D);else if(re<B&&0>s(ue,L))O[G]=ue,O[re]=L,G=re;else break e}}return U}function s(O,U){var L=O.sortIndex-U.sortIndex;return L!==0?L:O.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,w=!1,m=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(O){for(var U=r(u);U!==null;){if(U.callback===null)n(u);else if(U.startTime<=O)n(u),U.sortIndex=U.expirationTime,t(c,U);else break;U=r(u)}}function E(O){if(m=!1,x(O),!w)if(r(c)!==null)w=!0,W(T);else{var U=r(u);U!==null&&V(E,U.startTime-O)}}function T(O,U){w=!1,m&&(m=!1,y(R),R=-1),p=!0;var L=f;try{for(x(U),h=r(c);h!==null&&(!(h.expirationTime>U)||O&&!C());){var G=h.callback;if(typeof G=="function"){h.callback=null,f=h.priorityLevel;var B=G(h.expirationTime<=U);U=e.unstable_now(),typeof B=="function"?h.callback=B:h===r(c)&&n(c),x(U)}else n(c);h=r(c)}if(h!==null)var I=!0;else{var D=r(u);D!==null&&V(E,D.startTime-U),I=!1}return I}finally{h=null,f=L,p=!1}}var S=!1,A=null,R=-1,b=5,v=-1;function C(){return!(e.unstable_now()-v<b)}function j(){if(A!==null){var O=e.unstable_now();v=O;var U=!0;try{U=A(!0,O)}finally{U?N():(S=!1,A=null)}}else S=!1}var N;if(typeof g=="function")N=function(){g(j)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,z=P.port2;P.port1.onmessage=j,N=function(){z.postMessage(null)}}else N=function(){k(j,0)};function W(O){A=O,S||(S=!0,N())}function V(O,U){R=k(function(){O(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_continueExecution=function(){w||p||(w=!0,W(T))},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(O){switch(f){case 1:case 2:case 3:var U=3;break;default:U=f}var L=f;f=U;try{return O()}finally{f=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,U){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var L=f;f=O;try{return U()}finally{f=L}},e.unstable_scheduleCallback=function(O,U,L){var G=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?G+L:G):L=G,O){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=L+B,O={id:d++,callback:U,priorityLevel:O,startTime:L,expirationTime:B,sortIndex:-1},L>G?(O.sortIndex=L,t(u,O),r(c)===null&&O===r(u)&&(m?(y(R),R=-1):m=!0,V(E,L-G))):(O.sortIndex=B,t(c,O),w||p||(w=!0,W(T))),O},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(O){var U=f;return function(){var L=f;f=U;try{return O.apply(this,arguments)}finally{f=L}}}})(mf);pf.exports=mf;var Xg=pf.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Zg=_,ct=Xg;function $(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var gf=new Set,Ks={};function mn(e,t){Xn(e,t),Xn(e+"Capture",t)}function Xn(e,t){for(Ks[e]=t,e=0;e<t.length;e++)gf.add(t[e])}var cr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_l=Object.prototype.hasOwnProperty,e0=/^[: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]*$/,Wu={},Vu={};function t0(e){return _l.call(Vu,e)?!0:_l.call(Wu,e)?!1:e0.test(e)?Vu[e]=!0:(Wu[e]=!0,!1)}function r0(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function n0(e,t,r,n){if(t===null||typeof t>"u"||r0(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Je(e,t,r,n,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Fe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Fe[e]=new Je(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Fe[t]=new Je(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Fe[e]=new Je(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Fe[e]=new Je(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Fe[e]=new Je(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Fe[e]=new Je(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Fe[e]=new Je(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Fe[e]=new Je(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Fe[e]=new Je(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ic=/[\-:]([a-z])/g;function $c(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ic,$c);Fe[t]=new Je(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ic,$c);Fe[t]=new Je(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ic,$c);Fe[t]=new Je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Fe[e]=new Je(e,1,!1,e.toLowerCase(),null,!1,!1)});Fe.xlinkHref=new Je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Fe[e]=new Je(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dc(e,t,r,n){var s=Fe.hasOwnProperty(t)?Fe[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(n0(t,r,s,n)&&(r=null),n||s===null?t0(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var mr=Zg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Pi=Symbol.for("react.element"),Rn=Symbol.for("react.portal"),Pn=Symbol.for("react.fragment"),Lc=Symbol.for("react.strict_mode"),kl=Symbol.for("react.profiler"),yf=Symbol.for("react.provider"),vf=Symbol.for("react.context"),Fc=Symbol.for("react.forward_ref"),Sl=Symbol.for("react.suspense"),jl=Symbol.for("react.suspense_list"),Uc=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),xf=Symbol.for("react.offscreen"),Ku=Symbol.iterator;function ps(e){return e===null||typeof e!="object"?null:(e=Ku&&e[Ku]||e["@@iterator"],typeof e=="function"?e:null)}var ve=Object.assign,Io;function Es(e){if(Io===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Io=t&&t[1]||""}return`
`+Io+e}var $o=!1;function Do(e,t){if(!e||$o)return"";$o=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=n.stack.split(`
`),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{$o=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Es(e):""}function s0(e){switch(e.tag){case 5:return Es(e.type);case 16:return Es("Lazy");case 13:return Es("Suspense");case 19:return Es("SuspenseList");case 0:case 2:case 15:return e=Do(e.type,!1),e;case 11:return e=Do(e.type.render,!1),e;case 1:return e=Do(e.type,!0),e;default:return""}}function El(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pn:return"Fragment";case Rn:return"Portal";case kl:return"Profiler";case Lc:return"StrictMode";case Sl:return"Suspense";case jl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case vf:return(e.displayName||"Context")+".Consumer";case yf:return(e._context.displayName||"Context")+".Provider";case Fc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Uc:return t=e.displayName||null,t!==null?t:El(e.type)||"Memo";case wr:t=e._payload,e=e._init;try{return El(e(t))}catch{}}return null}function i0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return El(t);case 8:return t===Lc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Lr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function a0(e){var t=wf(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Oi(e){e._valueTracker||(e._valueTracker=a0(e))}function bf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=wf(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ba(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Cl(e,t){var r=t.checked;return ve({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Gu(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Lr(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _f(e,t){t=t.checked,t!=null&&Dc(e,"checked",t,!1)}function Nl(e,t){_f(e,t);var r=Lr(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Al(e,t.type,r):t.hasOwnProperty("defaultValue")&&Al(e,t.type,Lr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ju(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Al(e,t,r){(t!=="number"||ba(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Cs=Array.isArray;function qn(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Lr(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Tl(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error($(91));return ve({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Yu(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error($(92));if(Cs(r)){if(1<r.length)throw Error($(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Lr(r)}}function kf(e,t){var r=Lr(t.value),n=Lr(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Qu(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Sf(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Sf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var zi,jf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(zi=zi||document.createElement("div"),zi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=zi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gs(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var zs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},o0=["Webkit","ms","Moz","O"];Object.keys(zs).forEach(function(e){o0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zs[t]=zs[e]})});function Ef(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||zs.hasOwnProperty(e)&&zs[e]?(""+t).trim():t+"px"}function Cf(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Ef(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var l0=ve({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pl(e,t){if(t){if(l0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error($(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error($(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error($(61))}if(t.style!=null&&typeof t.style!="object")throw Error($(62))}}function Ol(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zl=null;function Bc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Il=null,Wn=null,Vn=null;function Xu(e){if(e=Si(e)){if(typeof Il!="function")throw Error($(280));var t=e.stateNode;t&&(t=ho(t),Il(e.stateNode,e.type,t))}}function Nf(e){Wn?Vn?Vn.push(e):Vn=[e]:Wn=e}function Af(){if(Wn){var e=Wn,t=Vn;if(Vn=Wn=null,Xu(e),t)for(e=0;e<t.length;e++)Xu(t[e])}}function Tf(e,t){return e(t)}function Rf(){}var Lo=!1;function Pf(e,t,r){if(Lo)return e(t,r);Lo=!0;try{return Tf(e,t,r)}finally{Lo=!1,(Wn!==null||Vn!==null)&&(Rf(),Af())}}function Js(e,t){var r=e.stateNode;if(r===null)return null;var n=ho(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error($(231,t,typeof r));return r}var $l=!1;if(cr)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){$l=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{$l=!1}function c0(e,t,r,n,s,i,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var Is=!1,_a=null,ka=!1,Dl=null,u0={onError:function(e){Is=!0,_a=e}};function d0(e,t,r,n,s,i,a,l,c){Is=!1,_a=null,c0.apply(u0,arguments)}function h0(e,t,r,n,s,i,a,l,c){if(d0.apply(this,arguments),Is){if(Is){var u=_a;Is=!1,_a=null}else throw Error($(198));ka||(ka=!0,Dl=u)}}function gn(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function Of(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Zu(e){if(gn(e)!==e)throw Error($(188))}function f0(e){var t=e.alternate;if(!t){if(t=gn(e),t===null)throw Error($(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return Zu(s),e;if(i===n)return Zu(s),t;i=i.sibling}throw Error($(188))}if(r.return!==n.return)r=s,n=i;else{for(var a=!1,l=s.child;l;){if(l===r){a=!0,r=s,n=i;break}if(l===n){a=!0,n=s,r=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===r){a=!0,r=i,n=s;break}if(l===n){a=!0,n=i,r=s;break}l=l.sibling}if(!a)throw Error($(189))}}if(r.alternate!==n)throw Error($(190))}if(r.tag!==3)throw Error($(188));return r.stateNode.current===r?e:t}function zf(e){return e=f0(e),e!==null?If(e):null}function If(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=If(e);if(t!==null)return t;e=e.sibling}return null}var $f=ct.unstable_scheduleCallback,ed=ct.unstable_cancelCallback,p0=ct.unstable_shouldYield,m0=ct.unstable_requestPaint,Se=ct.unstable_now,g0=ct.unstable_getCurrentPriorityLevel,Mc=ct.unstable_ImmediatePriority,Df=ct.unstable_UserBlockingPriority,Sa=ct.unstable_NormalPriority,y0=ct.unstable_LowPriority,Lf=ct.unstable_IdlePriority,oo=null,Vt=null;function v0(e){if(Vt&&typeof Vt.onCommitFiberRoot=="function")try{Vt.onCommitFiberRoot(oo,e,void 0,(e.current.flags&128)===128)}catch{}}var Rt=Math.clz32?Math.clz32:b0,x0=Math.log,w0=Math.LN2;function b0(e){return e>>>=0,e===0?32:31-(x0(e)/w0|0)|0}var Ii=64,$i=4194304;function Ns(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ja(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var l=a&~s;l!==0?n=Ns(l):(i&=a,i!==0&&(n=Ns(i)))}else a=r&~s,a!==0?n=Ns(a):i!==0&&(n=Ns(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Rt(t),s=1<<r,n|=e[r],t&=~s;return n}function _0(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function k0(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Rt(i),l=1<<a,c=s[a];c===-1?(!(l&r)||l&n)&&(s[a]=_0(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Ll(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ff(){var e=Ii;return Ii<<=1,!(Ii&4194240)&&(Ii=64),e}function Fo(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function _i(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rt(t),e[t]=r}function S0(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-Rt(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function Hc(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Rt(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var se=0;function Uf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bf,qc,Mf,Hf,qf,Fl=!1,Di=[],Tr=null,Rr=null,Pr=null,Ys=new Map,Qs=new Map,_r=[],j0="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 submit".split(" ");function td(e,t){switch(e){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Rr=null;break;case"mouseover":case"mouseout":Pr=null;break;case"pointerover":case"pointerout":Ys.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qs.delete(t.pointerId)}}function gs(e,t,r,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Si(t),t!==null&&qc(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function E0(e,t,r,n,s){switch(t){case"focusin":return Tr=gs(Tr,e,t,r,n,s),!0;case"dragenter":return Rr=gs(Rr,e,t,r,n,s),!0;case"mouseover":return Pr=gs(Pr,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return Ys.set(i,gs(Ys.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,Qs.set(i,gs(Qs.get(i)||null,e,t,r,n,s)),!0}return!1}function Wf(e){var t=Qr(e.target);if(t!==null){var r=gn(t);if(r!==null){if(t=r.tag,t===13){if(t=Of(r),t!==null){e.blockedOn=t,qf(e.priority,function(){Mf(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oa(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Ul(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);zl=n,r.target.dispatchEvent(n),zl=null}else return t=Si(r),t!==null&&qc(t),e.blockedOn=r,!1;t.shift()}return!0}function rd(e,t,r){oa(e)&&r.delete(t)}function C0(){Fl=!1,Tr!==null&&oa(Tr)&&(Tr=null),Rr!==null&&oa(Rr)&&(Rr=null),Pr!==null&&oa(Pr)&&(Pr=null),Ys.forEach(rd),Qs.forEach(rd)}function ys(e,t){e.blockedOn===t&&(e.blockedOn=null,Fl||(Fl=!0,ct.unstable_scheduleCallback(ct.unstable_NormalPriority,C0)))}function Xs(e){function t(s){return ys(s,e)}if(0<Di.length){ys(Di[0],e);for(var r=1;r<Di.length;r++){var n=Di[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Tr!==null&&ys(Tr,e),Rr!==null&&ys(Rr,e),Pr!==null&&ys(Pr,e),Ys.forEach(t),Qs.forEach(t),r=0;r<_r.length;r++)n=_r[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<_r.length&&(r=_r[0],r.blockedOn===null);)Wf(r),r.blockedOn===null&&_r.shift()}var Kn=mr.ReactCurrentBatchConfig,Ea=!0;function N0(e,t,r,n){var s=se,i=Kn.transition;Kn.transition=null;try{se=1,Wc(e,t,r,n)}finally{se=s,Kn.transition=i}}function A0(e,t,r,n){var s=se,i=Kn.transition;Kn.transition=null;try{se=4,Wc(e,t,r,n)}finally{se=s,Kn.transition=i}}function Wc(e,t,r,n){if(Ea){var s=Ul(e,t,r,n);if(s===null)Jo(e,t,n,Ca,r),td(e,n);else if(E0(s,e,t,r,n))n.stopPropagation();else if(td(e,n),t&4&&-1<j0.indexOf(e)){for(;s!==null;){var i=Si(s);if(i!==null&&Bf(i),i=Ul(e,t,r,n),i===null&&Jo(e,t,n,Ca,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else Jo(e,t,n,null,r)}}var Ca=null;function Ul(e,t,r,n){if(Ca=null,e=Bc(n),e=Qr(e),e!==null)if(t=gn(e),t===null)e=null;else if(r=t.tag,r===13){if(e=Of(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ca=e,null}function Vf(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(g0()){case Mc:return 1;case Df:return 4;case Sa:case y0:return 16;case Lf:return 536870912;default:return 16}default:return 16}}var Cr=null,Vc=null,la=null;function Kf(){if(la)return la;var e,t=Vc,r=t.length,n,s="value"in Cr?Cr.value:Cr.textContent,i=s.length;for(e=0;e<r&&t[e]===s[e];e++);var a=r-e;for(n=1;n<=a&&t[r-n]===s[i-n];n++);return la=s.slice(e,1<n?1-n:void 0)}function ca(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Li(){return!0}function nd(){return!1}function dt(e){function t(r,n,s,i,a){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Li:nd,this.isPropagationStopped=nd,this}return ve(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Li)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Li)},persist:function(){},isPersistent:Li}),t}var ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kc=dt(ls),ki=ve({},ls,{view:0,detail:0}),T0=dt(ki),Uo,Bo,vs,lo=ve({},ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==vs&&(vs&&e.type==="mousemove"?(Uo=e.screenX-vs.screenX,Bo=e.screenY-vs.screenY):Bo=Uo=0,vs=e),Uo)},movementY:function(e){return"movementY"in e?e.movementY:Bo}}),sd=dt(lo),R0=ve({},lo,{dataTransfer:0}),P0=dt(R0),O0=ve({},ki,{relatedTarget:0}),Mo=dt(O0),z0=ve({},ls,{animationName:0,elapsedTime:0,pseudoElement:0}),I0=dt(z0),$0=ve({},ls,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),D0=dt($0),L0=ve({},ls,{data:0}),id=dt(L0),F0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},U0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},B0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function M0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=B0[e])?!!t[e]:!1}function Gc(){return M0}var H0=ve({},ki,{key:function(e){if(e.key){var t=F0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ca(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?U0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gc,charCode:function(e){return e.type==="keypress"?ca(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ca(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),q0=dt(H0),W0=ve({},lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=dt(W0),V0=ve({},ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gc}),K0=dt(V0),G0=ve({},ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),J0=dt(G0),Y0=ve({},lo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Q0=dt(Y0),X0=[9,13,27,32],Jc=cr&&"CompositionEvent"in window,$s=null;cr&&"documentMode"in document&&($s=document.documentMode);var Z0=cr&&"TextEvent"in window&&!$s,Gf=cr&&(!Jc||$s&&8<$s&&11>=$s),od=" ",ld=!1;function Jf(e,t){switch(e){case"keyup":return X0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var On=!1;function ey(e,t){switch(e){case"compositionend":return Yf(t);case"keypress":return t.which!==32?null:(ld=!0,od);case"textInput":return e=t.data,e===od&&ld?null:e;default:return null}}function ty(e,t){if(On)return e==="compositionend"||!Jc&&Jf(e,t)?(e=Kf(),la=Vc=Cr=null,On=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Gf&&t.locale!=="ko"?null:t.data;default:return null}}var ry={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 cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ry[e.type]:t==="textarea"}function Qf(e,t,r,n){Nf(n),t=Na(t,"onChange"),0<t.length&&(r=new Kc("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Ds=null,Zs=null;function ny(e){lp(e,0)}function co(e){var t=$n(e);if(bf(t))return e}function sy(e,t){if(e==="change")return t}var Xf=!1;if(cr){var Ho;if(cr){var qo="oninput"in document;if(!qo){var ud=document.createElement("div");ud.setAttribute("oninput","return;"),qo=typeof ud.oninput=="function"}Ho=qo}else Ho=!1;Xf=Ho&&(!document.documentMode||9<document.documentMode)}function dd(){Ds&&(Ds.detachEvent("onpropertychange",Zf),Zs=Ds=null)}function Zf(e){if(e.propertyName==="value"&&co(Zs)){var t=[];Qf(t,Zs,e,Bc(e)),Pf(ny,t)}}function iy(e,t,r){e==="focusin"?(dd(),Ds=t,Zs=r,Ds.attachEvent("onpropertychange",Zf)):e==="focusout"&&dd()}function ay(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return co(Zs)}function oy(e,t){if(e==="click")return co(t)}function ly(e,t){if(e==="input"||e==="change")return co(t)}function cy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zt=typeof Object.is=="function"?Object.is:cy;function ei(e,t){if(zt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!_l.call(t,s)||!zt(e[s],t[s]))return!1}return!0}function hd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fd(e,t){var r=hd(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=hd(r)}}function ep(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ep(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tp(){for(var e=window,t=ba();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ba(e.document)}return t}function Yc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function uy(e){var t=tp(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&ep(r.ownerDocument.documentElement,r)){if(n!==null&&Yc(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!e.extend&&i>n&&(s=n,n=i,i=s),s=fd(r,i);var a=fd(r,n);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var dy=cr&&"documentMode"in document&&11>=document.documentMode,zn=null,Bl=null,Ls=null,Ml=!1;function pd(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ml||zn==null||zn!==ba(n)||(n=zn,"selectionStart"in n&&Yc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ls&&ei(Ls,n)||(Ls=n,n=Na(Bl,"onSelect"),0<n.length&&(t=new Kc("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=zn)))}function Fi(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var In={animationend:Fi("Animation","AnimationEnd"),animationiteration:Fi("Animation","AnimationIteration"),animationstart:Fi("Animation","AnimationStart"),transitionend:Fi("Transition","TransitionEnd")},Wo={},rp={};cr&&(rp=document.createElement("div").style,"AnimationEvent"in window||(delete In.animationend.animation,delete In.animationiteration.animation,delete In.animationstart.animation),"TransitionEvent"in window||delete In.transitionend.transition);function uo(e){if(Wo[e])return Wo[e];if(!In[e])return e;var t=In[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in rp)return Wo[e]=t[r];return e}var np=uo("animationend"),sp=uo("animationiteration"),ip=uo("animationstart"),ap=uo("transitionend"),op=new Map,md="abort auxClick 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(" ");function Br(e,t){op.set(e,t),mn(t,[e])}for(var Vo=0;Vo<md.length;Vo++){var Ko=md[Vo],hy=Ko.toLowerCase(),fy=Ko[0].toUpperCase()+Ko.slice(1);Br(hy,"on"+fy)}Br(np,"onAnimationEnd");Br(sp,"onAnimationIteration");Br(ip,"onAnimationStart");Br("dblclick","onDoubleClick");Br("focusin","onFocus");Br("focusout","onBlur");Br(ap,"onTransitionEnd");Xn("onMouseEnter",["mouseout","mouseover"]);Xn("onMouseLeave",["mouseout","mouseover"]);Xn("onPointerEnter",["pointerout","pointerover"]);Xn("onPointerLeave",["pointerout","pointerover"]);mn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));mn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));mn("onBeforeInput",["compositionend","keypress","textInput","paste"]);mn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));mn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));mn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var As="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(" "),py=new Set("cancel close invalid load scroll toggle".split(" ").concat(As));function gd(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,h0(n,t,void 0,e),e.currentTarget=null}function lp(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var a=n.length-1;0<=a;a--){var l=n[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;gd(s,l,u),i=c}else for(a=0;a<n.length;a++){if(l=n[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;gd(s,l,u),i=c}}}if(ka)throw e=Dl,ka=!1,Dl=null,e}function de(e,t){var r=t[Kl];r===void 0&&(r=t[Kl]=new Set);var n=e+"__bubble";r.has(n)||(cp(t,e,2,!1),r.add(n))}function Go(e,t,r){var n=0;t&&(n|=4),cp(r,e,n,t)}var Ui="_reactListening"+Math.random().toString(36).slice(2);function ti(e){if(!e[Ui]){e[Ui]=!0,gf.forEach(function(r){r!=="selectionchange"&&(py.has(r)||Go(r,!1,e),Go(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ui]||(t[Ui]=!0,Go("selectionchange",!1,t))}}function cp(e,t,r,n){switch(Vf(t)){case 1:var s=N0;break;case 4:s=A0;break;default:s=Wc}r=s.bind(null,t,r,e),s=void 0,!$l||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function Jo(e,t,r,n,s){var i=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=n.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Qr(l),a===null)return;if(c=a.tag,c===5||c===6){n=i=a;continue e}l=l.parentNode}}n=n.return}Pf(function(){var u=i,d=Bc(r),h=[];e:{var f=op.get(e);if(f!==void 0){var p=Kc,w=e;switch(e){case"keypress":if(ca(r)===0)break e;case"keydown":case"keyup":p=q0;break;case"focusin":w="focus",p=Mo;break;case"focusout":w="blur",p=Mo;break;case"beforeblur":case"afterblur":p=Mo;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":p=sd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=P0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=K0;break;case np:case sp:case ip:p=I0;break;case ap:p=J0;break;case"scroll":p=T0;break;case"wheel":p=Q0;break;case"copy":case"cut":case"paste":p=D0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=ad}var m=(t&4)!==0,k=!m&&e==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var g=u,x;g!==null;){x=g;var E=x.stateNode;if(x.tag===5&&E!==null&&(x=E,y!==null&&(E=Js(g,y),E!=null&&m.push(ri(g,E,x)))),k)break;g=g.return}0<m.length&&(f=new p(f,w,null,r,d),h.push({event:f,listeners:m}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==zl&&(w=r.relatedTarget||r.fromElement)&&(Qr(w)||w[ur]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(w=r.relatedTarget||r.toElement,p=u,w=w?Qr(w):null,w!==null&&(k=gn(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(p=null,w=u),p!==w)){if(m=sd,E="onMouseLeave",y="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(m=ad,E="onPointerLeave",y="onPointerEnter",g="pointer"),k=p==null?f:$n(p),x=w==null?f:$n(w),f=new m(E,g+"leave",p,r,d),f.target=k,f.relatedTarget=x,E=null,Qr(d)===u&&(m=new m(y,g+"enter",w,r,d),m.target=x,m.relatedTarget=k,E=m),k=E,p&&w)t:{for(m=p,y=w,g=0,x=m;x;x=bn(x))g++;for(x=0,E=y;E;E=bn(E))x++;for(;0<g-x;)m=bn(m),g--;for(;0<x-g;)y=bn(y),x--;for(;g--;){if(m===y||y!==null&&m===y.alternate)break t;m=bn(m),y=bn(y)}m=null}else m=null;p!==null&&yd(h,f,p,m,!1),w!==null&&k!==null&&yd(h,k,w,m,!0)}}e:{if(f=u?$n(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=sy;else if(cd(f))if(Xf)T=ly;else{T=ay;var S=iy}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=oy);if(T&&(T=T(e,u))){Qf(h,T,r,d);break e}S&&S(e,f,u),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&Al(f,"number",f.value)}switch(S=u?$n(u):window,e){case"focusin":(cd(S)||S.contentEditable==="true")&&(zn=S,Bl=u,Ls=null);break;case"focusout":Ls=Bl=zn=null;break;case"mousedown":Ml=!0;break;case"contextmenu":case"mouseup":case"dragend":Ml=!1,pd(h,r,d);break;case"selectionchange":if(dy)break;case"keydown":case"keyup":pd(h,r,d)}var A;if(Jc)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else On?Jf(e,r)&&(R="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(R="onCompositionStart");R&&(Gf&&r.locale!=="ko"&&(On||R!=="onCompositionStart"?R==="onCompositionEnd"&&On&&(A=Kf()):(Cr=d,Vc="value"in Cr?Cr.value:Cr.textContent,On=!0)),S=Na(u,R),0<S.length&&(R=new id(R,e,null,r,d),h.push({event:R,listeners:S}),A?R.data=A:(A=Yf(r),A!==null&&(R.data=A)))),(A=Z0?ey(e,r):ty(e,r))&&(u=Na(u,"onBeforeInput"),0<u.length&&(d=new id("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=A))}lp(h,t)})}function ri(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Na(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Js(e,r),i!=null&&n.unshift(ri(e,i,s)),i=Js(e,t),i!=null&&n.push(ri(e,i,s))),e=e.return}return n}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yd(e,t,r,n,s){for(var i=t._reactName,a=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=Js(r,i),c!=null&&a.unshift(ri(r,c,l))):s||(c=Js(r,i),c!=null&&a.push(ri(r,c,l)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var my=/\r\n?/g,gy=/\u0000|\uFFFD/g;function vd(e){return(typeof e=="string"?e:""+e).replace(my,`
`).replace(gy,"")}function Bi(e,t,r){if(t=vd(t),vd(e)!==t&&r)throw Error($(425))}function Aa(){}var Hl=null,ql=null;function Wl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vl=typeof setTimeout=="function"?setTimeout:void 0,yy=typeof clearTimeout=="function"?clearTimeout:void 0,xd=typeof Promise=="function"?Promise:void 0,vy=typeof queueMicrotask=="function"?queueMicrotask:typeof xd<"u"?function(e){return xd.resolve(null).then(e).catch(xy)}:Vl;function xy(e){setTimeout(function(){throw e})}function Yo(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Xs(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Xs(t)}function Or(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function wd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var cs=Math.random().toString(36).slice(2),Wt="__reactFiber$"+cs,ni="__reactProps$"+cs,ur="__reactContainer$"+cs,Kl="__reactEvents$"+cs,wy="__reactListeners$"+cs,by="__reactHandles$"+cs;function Qr(e){var t=e[Wt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[ur]||r[Wt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=wd(e);e!==null;){if(r=e[Wt])return r;e=wd(e)}return t}e=r,r=e.parentNode}return null}function Si(e){return e=e[Wt]||e[ur],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function $n(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error($(33))}function ho(e){return e[ni]||null}var Gl=[],Dn=-1;function Mr(e){return{current:e}}function he(e){0>Dn||(e.current=Gl[Dn],Gl[Dn]=null,Dn--)}function ce(e,t){Dn++,Gl[Dn]=e.current,e.current=t}var Fr={},We=Mr(Fr),et=Mr(!1),on=Fr;function Zn(e,t){var r=e.type.contextTypes;if(!r)return Fr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function tt(e){return e=e.childContextTypes,e!=null}function Ta(){he(et),he(We)}function bd(e,t,r){if(We.current!==Fr)throw Error($(168));ce(We,t),ce(et,r)}function up(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error($(108,i0(e)||"Unknown",s));return ve({},r,n)}function Ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fr,on=We.current,ce(We,e),ce(et,et.current),!0}function _d(e,t,r){var n=e.stateNode;if(!n)throw Error($(169));r?(e=up(e,t,on),n.__reactInternalMemoizedMergedChildContext=e,he(et),he(We),ce(We,e)):he(et),ce(et,r)}var nr=null,fo=!1,Qo=!1;function dp(e){nr===null?nr=[e]:nr.push(e)}function _y(e){fo=!0,dp(e)}function Hr(){if(!Qo&&nr!==null){Qo=!0;var e=0,t=se;try{var r=nr;for(se=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}nr=null,fo=!1}catch(s){throw nr!==null&&(nr=nr.slice(e+1)),$f(Mc,Hr),s}finally{se=t,Qo=!1}}return null}var Ln=[],Fn=0,Pa=null,Oa=0,ft=[],pt=0,ln=null,sr=1,ir="";function Gr(e,t){Ln[Fn++]=Oa,Ln[Fn++]=Pa,Pa=e,Oa=t}function hp(e,t,r){ft[pt++]=sr,ft[pt++]=ir,ft[pt++]=ln,ln=e;var n=sr;e=ir;var s=32-Rt(n)-1;n&=~(1<<s),r+=1;var i=32-Rt(t)+s;if(30<i){var a=s-s%5;i=(n&(1<<a)-1).toString(32),n>>=a,s-=a,sr=1<<32-Rt(t)+s|r<<s|n,ir=i+e}else sr=1<<i|r<<s|n,ir=e}function Qc(e){e.return!==null&&(Gr(e,1),hp(e,1,0))}function Xc(e){for(;e===Pa;)Pa=Ln[--Fn],Ln[Fn]=null,Oa=Ln[--Fn],Ln[Fn]=null;for(;e===ln;)ln=ft[--pt],ft[pt]=null,ir=ft[--pt],ft[pt]=null,sr=ft[--pt],ft[pt]=null}var lt=null,at=null,pe=!1,At=null;function fp(e,t){var r=mt(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function kd(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,lt=e,at=Or(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,lt=e,at=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=ln!==null?{id:sr,overflow:ir}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=mt(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,lt=e,at=null,!0):!1;default:return!1}}function Jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yl(e){if(pe){var t=at;if(t){var r=t;if(!kd(e,t)){if(Jl(e))throw Error($(418));t=Or(r.nextSibling);var n=lt;t&&kd(e,t)?fp(n,r):(e.flags=e.flags&-4097|2,pe=!1,lt=e)}}else{if(Jl(e))throw Error($(418));e.flags=e.flags&-4097|2,pe=!1,lt=e}}}function Sd(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;lt=e}function Mi(e){if(e!==lt)return!1;if(!pe)return Sd(e),pe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wl(e.type,e.memoizedProps)),t&&(t=at)){if(Jl(e))throw pp(),Error($(418));for(;t;)fp(e,t),t=Or(t.nextSibling)}if(Sd(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error($(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){at=Or(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}at=null}}else at=lt?Or(e.stateNode.nextSibling):null;return!0}function pp(){for(var e=at;e;)e=Or(e.nextSibling)}function es(){at=lt=null,pe=!1}function Zc(e){At===null?At=[e]:At.push(e)}var ky=mr.ReactCurrentBatchConfig;function xs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error($(309));var n=r.stateNode}if(!n)throw Error($(147,e));var s=n,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error($(284));if(!r._owner)throw Error($(290,e))}return e}function Hi(e,t){throw e=Object.prototype.toString.call(t),Error($(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function jd(e){var t=e._init;return t(e._payload)}function mp(e){function t(y,g){if(e){var x=y.deletions;x===null?(y.deletions=[g],y.flags|=16):x.push(g)}}function r(y,g){if(!e)return null;for(;g!==null;)t(y,g),g=g.sibling;return null}function n(y,g){for(y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function s(y,g){return y=Dr(y,g),y.index=0,y.sibling=null,y}function i(y,g,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<g?(y.flags|=2,g):x):(y.flags|=2,g)):(y.flags|=1048576,g)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,g,x,E){return g===null||g.tag!==6?(g=sl(x,y.mode,E),g.return=y,g):(g=s(g,x),g.return=y,g)}function c(y,g,x,E){var T=x.type;return T===Pn?d(y,g,x.props.children,E,x.key):g!==null&&(g.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===wr&&jd(T)===g.type)?(E=s(g,x.props),E.ref=xs(y,g,x),E.return=y,E):(E=ga(x.type,x.key,x.props,null,y.mode,E),E.ref=xs(y,g,x),E.return=y,E)}function u(y,g,x,E){return g===null||g.tag!==4||g.stateNode.containerInfo!==x.containerInfo||g.stateNode.implementation!==x.implementation?(g=il(x,y.mode,E),g.return=y,g):(g=s(g,x.children||[]),g.return=y,g)}function d(y,g,x,E,T){return g===null||g.tag!==7?(g=nn(x,y.mode,E,T),g.return=y,g):(g=s(g,x),g.return=y,g)}function h(y,g,x){if(typeof g=="string"&&g!==""||typeof g=="number")return g=sl(""+g,y.mode,x),g.return=y,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Pi:return x=ga(g.type,g.key,g.props,null,y.mode,x),x.ref=xs(y,null,g),x.return=y,x;case Rn:return g=il(g,y.mode,x),g.return=y,g;case wr:var E=g._init;return h(y,E(g._payload),x)}if(Cs(g)||ps(g))return g=nn(g,y.mode,x,null),g.return=y,g;Hi(y,g)}return null}function f(y,g,x,E){var T=g!==null?g.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return T!==null?null:l(y,g,""+x,E);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Pi:return x.key===T?c(y,g,x,E):null;case Rn:return x.key===T?u(y,g,x,E):null;case wr:return T=x._init,f(y,g,T(x._payload),E)}if(Cs(x)||ps(x))return T!==null?null:d(y,g,x,E,null);Hi(y,x)}return null}function p(y,g,x,E,T){if(typeof E=="string"&&E!==""||typeof E=="number")return y=y.get(x)||null,l(g,y,""+E,T);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Pi:return y=y.get(E.key===null?x:E.key)||null,c(g,y,E,T);case Rn:return y=y.get(E.key===null?x:E.key)||null,u(g,y,E,T);case wr:var S=E._init;return p(y,g,x,S(E._payload),T)}if(Cs(E)||ps(E))return y=y.get(x)||null,d(g,y,E,T,null);Hi(g,E)}return null}function w(y,g,x,E){for(var T=null,S=null,A=g,R=g=0,b=null;A!==null&&R<x.length;R++){A.index>R?(b=A,A=null):b=A.sibling;var v=f(y,A,x[R],E);if(v===null){A===null&&(A=b);break}e&&A&&v.alternate===null&&t(y,A),g=i(v,g,R),S===null?T=v:S.sibling=v,S=v,A=b}if(R===x.length)return r(y,A),pe&&Gr(y,R),T;if(A===null){for(;R<x.length;R++)A=h(y,x[R],E),A!==null&&(g=i(A,g,R),S===null?T=A:S.sibling=A,S=A);return pe&&Gr(y,R),T}for(A=n(y,A);R<x.length;R++)b=p(A,y,R,x[R],E),b!==null&&(e&&b.alternate!==null&&A.delete(b.key===null?R:b.key),g=i(b,g,R),S===null?T=b:S.sibling=b,S=b);return e&&A.forEach(function(C){return t(y,C)}),pe&&Gr(y,R),T}function m(y,g,x,E){var T=ps(x);if(typeof T!="function")throw Error($(150));if(x=T.call(x),x==null)throw Error($(151));for(var S=T=null,A=g,R=g=0,b=null,v=x.next();A!==null&&!v.done;R++,v=x.next()){A.index>R?(b=A,A=null):b=A.sibling;var C=f(y,A,v.value,E);if(C===null){A===null&&(A=b);break}e&&A&&C.alternate===null&&t(y,A),g=i(C,g,R),S===null?T=C:S.sibling=C,S=C,A=b}if(v.done)return r(y,A),pe&&Gr(y,R),T;if(A===null){for(;!v.done;R++,v=x.next())v=h(y,v.value,E),v!==null&&(g=i(v,g,R),S===null?T=v:S.sibling=v,S=v);return pe&&Gr(y,R),T}for(A=n(y,A);!v.done;R++,v=x.next())v=p(A,y,R,v.value,E),v!==null&&(e&&v.alternate!==null&&A.delete(v.key===null?R:v.key),g=i(v,g,R),S===null?T=v:S.sibling=v,S=v);return e&&A.forEach(function(j){return t(y,j)}),pe&&Gr(y,R),T}function k(y,g,x,E){if(typeof x=="object"&&x!==null&&x.type===Pn&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Pi:e:{for(var T=x.key,S=g;S!==null;){if(S.key===T){if(T=x.type,T===Pn){if(S.tag===7){r(y,S.sibling),g=s(S,x.props.children),g.return=y,y=g;break e}}else if(S.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===wr&&jd(T)===S.type){r(y,S.sibling),g=s(S,x.props),g.ref=xs(y,S,x),g.return=y,y=g;break e}r(y,S);break}else t(y,S);S=S.sibling}x.type===Pn?(g=nn(x.props.children,y.mode,E,x.key),g.return=y,y=g):(E=ga(x.type,x.key,x.props,null,y.mode,E),E.ref=xs(y,g,x),E.return=y,y=E)}return a(y);case Rn:e:{for(S=x.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===x.containerInfo&&g.stateNode.implementation===x.implementation){r(y,g.sibling),g=s(g,x.children||[]),g.return=y,y=g;break e}else{r(y,g);break}else t(y,g);g=g.sibling}g=il(x,y.mode,E),g.return=y,y=g}return a(y);case wr:return S=x._init,k(y,g,S(x._payload),E)}if(Cs(x))return w(y,g,x,E);if(ps(x))return m(y,g,x,E);Hi(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,g!==null&&g.tag===6?(r(y,g.sibling),g=s(g,x),g.return=y,y=g):(r(y,g),g=sl(x,y.mode,E),g.return=y,y=g),a(y)):r(y,g)}return k}var ts=mp(!0),gp=mp(!1),za=Mr(null),Ia=null,Un=null,eu=null;function tu(){eu=Un=Ia=null}function ru(e){var t=za.current;he(za),e._currentValue=t}function Ql(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Gn(e,t){Ia=e,eu=Un=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ze=!0),e.firstContext=null)}function yt(e){var t=e._currentValue;if(eu!==e)if(e={context:e,memoizedValue:t,next:null},Un===null){if(Ia===null)throw Error($(308));Un=e,Ia.dependencies={lanes:0,firstContext:e}}else Un=Un.next=e;return t}var Xr=null;function nu(e){Xr===null?Xr=[e]:Xr.push(e)}function yp(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,nu(t)):(r.next=s.next,s.next=r),t.interleaved=r,dr(e,n)}function dr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var br=!1;function su(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ar(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function zr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,te&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,dr(e,r)}return s=n.interleaved,s===null?(t.next=t,nu(n)):(t.next=s.next,s.next=t),n.interleaved=t,dr(e,r)}function ua(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Hc(e,r)}}function Ed(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?s=i=t:i=i.next=t}else s=i=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function $a(e,t,r,n){var s=e.updateQueue;br=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;a=0,d=u=c=null,l=i;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var w=e,m=l;switch(f=t,p=r,m.tag){case 1:if(w=m.payload,typeof w=="function"){h=w.call(p,h,f);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=m.payload,f=typeof w=="function"?w.call(p,h,f):w,f==null)break e;h=ve({},h,f);break e;case 2:br=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,a|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);un|=a,e.lanes=a,e.memoizedState=h}}function Cd(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error($(191,s));s.call(n)}}}var ji={},Kt=Mr(ji),si=Mr(ji),ii=Mr(ji);function Zr(e){if(e===ji)throw Error($(174));return e}function iu(e,t){switch(ce(ii,t),ce(si,e),ce(Kt,ji),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Rl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Rl(t,e)}he(Kt),ce(Kt,t)}function rs(){he(Kt),he(si),he(ii)}function xp(e){Zr(ii.current);var t=Zr(Kt.current),r=Rl(t,e.type);t!==r&&(ce(si,e),ce(Kt,r))}function au(e){si.current===e&&(he(Kt),he(si))}var ge=Mr(0);function Da(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Xo=[];function ou(){for(var e=0;e<Xo.length;e++)Xo[e]._workInProgressVersionPrimary=null;Xo.length=0}var da=mr.ReactCurrentDispatcher,Zo=mr.ReactCurrentBatchConfig,cn=0,ye=null,Ne=null,ze=null,La=!1,Fs=!1,ai=0,Sy=0;function Be(){throw Error($(321))}function lu(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!zt(e[r],t[r]))return!1;return!0}function cu(e,t,r,n,s,i){if(cn=i,ye=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,da.current=e===null||e.memoizedState===null?Ny:Ay,e=r(n,s),Fs){i=0;do{if(Fs=!1,ai=0,25<=i)throw Error($(301));i+=1,ze=Ne=null,t.updateQueue=null,da.current=Ty,e=r(n,s)}while(Fs)}if(da.current=Fa,t=Ne!==null&&Ne.next!==null,cn=0,ze=Ne=ye=null,La=!1,t)throw Error($(300));return e}function uu(){var e=ai!==0;return ai=0,e}function Mt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ze===null?ye.memoizedState=ze=e:ze=ze.next=e,ze}function vt(){if(Ne===null){var e=ye.alternate;e=e!==null?e.memoizedState:null}else e=Ne.next;var t=ze===null?ye.memoizedState:ze.next;if(t!==null)ze=t,Ne=e;else{if(e===null)throw Error($(310));Ne=e,e={memoizedState:Ne.memoizedState,baseState:Ne.baseState,baseQueue:Ne.baseQueue,queue:Ne.queue,next:null},ze===null?ye.memoizedState=ze=e:ze=ze.next=e}return ze}function oi(e,t){return typeof t=="function"?t(e):t}function el(e){var t=vt(),r=t.queue;if(r===null)throw Error($(311));r.lastRenderedReducer=e;var n=Ne,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var l=a=null,c=null,u=i;do{var d=u.lane;if((cn&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,a=n):c=c.next=h,ye.lanes|=d,un|=d}u=u.next}while(u!==null&&u!==i);c===null?a=n:c.next=l,zt(n,t.memoizedState)||(Ze=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,ye.lanes|=i,un|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function tl(e){var t=vt(),r=t.queue;if(r===null)throw Error($(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,i=t.memoizedState;if(s!==null){r.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);zt(i,t.memoizedState)||(Ze=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function wp(){}function bp(e,t){var r=ye,n=vt(),s=t(),i=!zt(n.memoizedState,s);if(i&&(n.memoizedState=s,Ze=!0),n=n.queue,du(Sp.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||ze!==null&&ze.memoizedState.tag&1){if(r.flags|=2048,li(9,kp.bind(null,r,n,s,t),void 0,null),Ie===null)throw Error($(349));cn&30||_p(r,t,s)}return s}function _p(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ye.updateQueue,t===null?(t={lastEffect:null,stores:null},ye.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function kp(e,t,r,n){t.value=r,t.getSnapshot=n,jp(t)&&Ep(e)}function Sp(e,t,r){return r(function(){jp(t)&&Ep(e)})}function jp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!zt(e,r)}catch{return!0}}function Ep(e){var t=dr(e,1);t!==null&&Pt(t,e,1,-1)}function Nd(e){var t=Mt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:oi,lastRenderedState:e},t.queue=e,e=e.dispatch=Cy.bind(null,ye,e),[t.memoizedState,e]}function li(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ye.updateQueue,t===null?(t={lastEffect:null,stores:null},ye.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function Cp(){return vt().memoizedState}function ha(e,t,r,n){var s=Mt();ye.flags|=e,s.memoizedState=li(1|t,r,void 0,n===void 0?null:n)}function po(e,t,r,n){var s=vt();n=n===void 0?null:n;var i=void 0;if(Ne!==null){var a=Ne.memoizedState;if(i=a.destroy,n!==null&&lu(n,a.deps)){s.memoizedState=li(t,r,i,n);return}}ye.flags|=e,s.memoizedState=li(1|t,r,i,n)}function Ad(e,t){return ha(8390656,8,e,t)}function du(e,t){return po(2048,8,e,t)}function Np(e,t){return po(4,2,e,t)}function Ap(e,t){return po(4,4,e,t)}function Tp(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rp(e,t,r){return r=r!=null?r.concat([e]):null,po(4,4,Tp.bind(null,t,e),r)}function hu(){}function Pp(e,t){var r=vt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&lu(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Op(e,t){var r=vt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&lu(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function zp(e,t,r){return cn&21?(zt(r,t)||(r=Ff(),ye.lanes|=r,un|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ze=!0),e.memoizedState=r)}function jy(e,t){var r=se;se=r!==0&&4>r?r:4,e(!0);var n=Zo.transition;Zo.transition={};try{e(!1),t()}finally{se=r,Zo.transition=n}}function Ip(){return vt().memoizedState}function Ey(e,t,r){var n=$r(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$p(e))Dp(t,r);else if(r=yp(e,t,r,n),r!==null){var s=Ke();Pt(r,e,n,s),Lp(r,t,n)}}function Cy(e,t,r){var n=$r(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($p(e))Dp(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,r);if(s.hasEagerState=!0,s.eagerState=l,zt(l,a)){var c=t.interleaved;c===null?(s.next=s,nu(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=yp(e,t,s,n),r!==null&&(s=Ke(),Pt(r,e,n,s),Lp(r,t,n))}}function $p(e){var t=e.alternate;return e===ye||t!==null&&t===ye}function Dp(e,t){Fs=La=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Lp(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Hc(e,r)}}var Fa={readContext:yt,useCallback:Be,useContext:Be,useEffect:Be,useImperativeHandle:Be,useInsertionEffect:Be,useLayoutEffect:Be,useMemo:Be,useReducer:Be,useRef:Be,useState:Be,useDebugValue:Be,useDeferredValue:Be,useTransition:Be,useMutableSource:Be,useSyncExternalStore:Be,useId:Be,unstable_isNewReconciler:!1},Ny={readContext:yt,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Ad,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ha(4194308,4,Tp.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ha(4194308,4,e,t)},useInsertionEffect:function(e,t){return ha(4,2,e,t)},useMemo:function(e,t){var r=Mt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Mt();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=Ey.bind(null,ye,e),[n.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:Nd,useDebugValue:hu,useDeferredValue:function(e){return Mt().memoizedState=e},useTransition:function(){var e=Nd(!1),t=e[0];return e=jy.bind(null,e[1]),Mt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ye,s=Mt();if(pe){if(r===void 0)throw Error($(407));r=r()}else{if(r=t(),Ie===null)throw Error($(349));cn&30||_p(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,Ad(Sp.bind(null,n,i,e),[e]),n.flags|=2048,li(9,kp.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Mt(),t=Ie.identifierPrefix;if(pe){var r=ir,n=sr;r=(n&~(1<<32-Rt(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=ai++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Sy++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ay={readContext:yt,useCallback:Pp,useContext:yt,useEffect:du,useImperativeHandle:Rp,useInsertionEffect:Np,useLayoutEffect:Ap,useMemo:Op,useReducer:el,useRef:Cp,useState:function(){return el(oi)},useDebugValue:hu,useDeferredValue:function(e){var t=vt();return zp(t,Ne.memoizedState,e)},useTransition:function(){var e=el(oi)[0],t=vt().memoizedState;return[e,t]},useMutableSource:wp,useSyncExternalStore:bp,useId:Ip,unstable_isNewReconciler:!1},Ty={readContext:yt,useCallback:Pp,useContext:yt,useEffect:du,useImperativeHandle:Rp,useInsertionEffect:Np,useLayoutEffect:Ap,useMemo:Op,useReducer:tl,useRef:Cp,useState:function(){return tl(oi)},useDebugValue:hu,useDeferredValue:function(e){var t=vt();return Ne===null?t.memoizedState=e:zp(t,Ne.memoizedState,e)},useTransition:function(){var e=tl(oi)[0],t=vt().memoizedState;return[e,t]},useMutableSource:wp,useSyncExternalStore:bp,useId:Ip,unstable_isNewReconciler:!1};function Et(e,t){if(e&&e.defaultProps){t=ve({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Xl(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:ve({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var mo={isMounted:function(e){return(e=e._reactInternals)?gn(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Ke(),s=$r(e),i=ar(n,s);i.payload=t,r!=null&&(i.callback=r),t=zr(e,i,s),t!==null&&(Pt(t,e,s,n),ua(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Ke(),s=$r(e),i=ar(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=zr(e,i,s),t!==null&&(Pt(t,e,s,n),ua(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Ke(),n=$r(e),s=ar(r,n);s.tag=2,t!=null&&(s.callback=t),t=zr(e,s,n),t!==null&&(Pt(t,e,n,r),ua(t,e,n))}};function Td(e,t,r,n,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,a):t.prototype&&t.prototype.isPureReactComponent?!ei(r,n)||!ei(s,i):!0}function Fp(e,t,r){var n=!1,s=Fr,i=t.contextType;return typeof i=="object"&&i!==null?i=yt(i):(s=tt(t)?on:We.current,n=t.contextTypes,i=(n=n!=null)?Zn(e,s):Fr),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=mo,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Rd(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&mo.enqueueReplaceState(t,t.state,null)}function Zl(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},su(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=yt(i):(i=tt(t)?on:We.current,s.context=Zn(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Xl(e,t,i,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&mo.enqueueReplaceState(s,s.state,null),$a(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ns(e,t){try{var r="",n=t;do r+=s0(n),n=n.return;while(n);var s=r}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function rl(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function ec(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Ry=typeof WeakMap=="function"?WeakMap:Map;function Up(e,t,r){r=ar(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Ba||(Ba=!0,uc=n),ec(e,t)},r}function Bp(e,t,r){r=ar(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){ec(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){ec(e,t),typeof n!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function Pd(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Ry;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=Wy.bind(null,e,t,r),t.then(e,e))}function Od(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function zd(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=ar(-1,1),t.tag=2,zr(r,t,1))),r.lanes|=1),e)}var Py=mr.ReactCurrentOwner,Ze=!1;function Ve(e,t,r,n){t.child=e===null?gp(t,null,r,n):ts(t,e.child,r,n)}function Id(e,t,r,n,s){r=r.render;var i=t.ref;return Gn(t,s),n=cu(e,t,r,n,i,s),r=uu(),e!==null&&!Ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,hr(e,t,s)):(pe&&r&&Qc(t),t.flags|=1,Ve(e,t,n,s),t.child)}function $d(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!wu(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,Mp(e,t,i,n,s)):(e=ga(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:ei,r(a,n)&&e.ref===t.ref)return hr(e,t,s)}return t.flags|=1,e=Dr(i,n),e.ref=t.ref,e.return=t,t.child=e}function Mp(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(ei(i,n)&&e.ref===t.ref)if(Ze=!1,t.pendingProps=n=i,(e.lanes&s)!==0)e.flags&131072&&(Ze=!0);else return t.lanes=e.lanes,hr(e,t,s)}return tc(e,t,r,n,s)}function Hp(e,t,r){var n=t.pendingProps,s=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ce(Mn,st),st|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ce(Mn,st),st|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,ce(Mn,st),st|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,ce(Mn,st),st|=n;return Ve(e,t,s,r),t.child}function qp(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function tc(e,t,r,n,s){var i=tt(r)?on:We.current;return i=Zn(t,i),Gn(t,s),r=cu(e,t,r,n,i,s),n=uu(),e!==null&&!Ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,hr(e,t,s)):(pe&&n&&Qc(t),t.flags|=1,Ve(e,t,r,s),t.child)}function Dd(e,t,r,n,s){if(tt(r)){var i=!0;Ra(t)}else i=!1;if(Gn(t,s),t.stateNode===null)fa(e,t),Fp(t,r,n),Zl(t,r,n,s),n=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=r.contextType;typeof u=="object"&&u!==null?u=yt(u):(u=tt(r)?on:We.current,u=Zn(t,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==n||c!==u)&&Rd(t,a,n,u),br=!1;var f=t.memoizedState;a.state=f,$a(t,n,a,s),c=t.memoizedState,l!==n||f!==c||et.current||br?(typeof d=="function"&&(Xl(t,r,d,n),c=t.memoizedState),(l=br||Td(t,r,l,n,f,c,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=u,n=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,vp(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Et(t.type,l),a.props=u,h=t.pendingProps,f=a.context,c=r.contextType,typeof c=="object"&&c!==null?c=yt(c):(c=tt(r)?on:We.current,c=Zn(t,c));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==h||f!==c)&&Rd(t,a,n,c),br=!1,f=t.memoizedState,a.state=f,$a(t,n,a,s);var w=t.memoizedState;l!==h||f!==w||et.current||br?(typeof p=="function"&&(Xl(t,r,p,n),w=t.memoizedState),(u=br||Td(t,r,u,n,f,w,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,w,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,w,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=w),a.props=n,a.state=w,a.context=c,n=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return rc(e,t,r,n,i,s)}function rc(e,t,r,n,s,i){qp(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return s&&_d(t,r,!1),hr(e,t,i);n=t.stateNode,Py.current=t;var l=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=ts(t,e.child,null,i),t.child=ts(t,null,l,i)):Ve(e,t,l,i),t.memoizedState=n.state,s&&_d(t,r,!0),t.child}function Wp(e){var t=e.stateNode;t.pendingContext?bd(e,t.pendingContext,t.pendingContext!==t.context):t.context&&bd(e,t.context,!1),iu(e,t.containerInfo)}function Ld(e,t,r,n,s){return es(),Zc(s),t.flags|=256,Ve(e,t,r,n),t.child}var nc={dehydrated:null,treeContext:null,retryLane:0};function sc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Vp(e,t,r){var n=t.pendingProps,s=ge.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ce(ge,s&1),e===null)return Yl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=n.children,e=n.fallback,i?(n=t.mode,i=t.child,a={mode:"hidden",children:a},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=vo(a,n,0,null),e=nn(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=sc(r),t.memoizedState=nc,e):fu(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Oy(e,t,a,n,l,s,r);if(i){i=n.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(a&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=Dr(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Dr(l,i):(i=nn(i,a,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,a=e.child.memoizedState,a=a===null?sc(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=nc,n}return i=e.child,e=i.sibling,n=Dr(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function fu(e,t){return t=vo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function qi(e,t,r,n){return n!==null&&Zc(n),ts(t,e.child,null,r),e=fu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oy(e,t,r,n,s,i,a){if(r)return t.flags&256?(t.flags&=-257,n=rl(Error($(422))),qi(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=vo({mode:"visible",children:n.children},s,0,null),i=nn(i,s,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&ts(t,e.child,null,a),t.child.memoizedState=sc(a),t.memoizedState=nc,i);if(!(t.mode&1))return qi(e,t,a,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error($(419)),n=rl(i,n,void 0),qi(e,t,a,n)}if(l=(a&e.childLanes)!==0,Ze||l){if(n=Ie,n!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,dr(e,s),Pt(n,e,s,-1))}return xu(),n=rl(Error($(421))),qi(e,t,a,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=Vy.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,at=Or(s.nextSibling),lt=t,pe=!0,At=null,e!==null&&(ft[pt++]=sr,ft[pt++]=ir,ft[pt++]=ln,sr=e.id,ir=e.overflow,ln=t),t=fu(t,n.children),t.flags|=4096,t)}function Fd(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Ql(e.return,t,r)}function nl(e,t,r,n,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function Kp(e,t,r){var n=t.pendingProps,s=n.revealOrder,i=n.tail;if(Ve(e,t,n.children,r),n=ge.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fd(e,r,t);else if(e.tag===19)Fd(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ce(ge,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&Da(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),nl(t,!1,s,r,i);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Da(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}nl(t,!0,r,null,i);break;case"together":nl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fa(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function hr(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),un|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error($(153));if(t.child!==null){for(e=t.child,r=Dr(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Dr(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function zy(e,t,r){switch(t.tag){case 3:Wp(t),es();break;case 5:xp(t);break;case 1:tt(t.type)&&Ra(t);break;case 4:iu(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;ce(za,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(ce(ge,ge.current&1),t.flags|=128,null):r&t.child.childLanes?Vp(e,t,r):(ce(ge,ge.current&1),e=hr(e,t,r),e!==null?e.sibling:null);ce(ge,ge.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return Kp(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ce(ge,ge.current),n)break;return null;case 22:case 23:return t.lanes=0,Hp(e,t,r)}return hr(e,t,r)}var Gp,ic,Jp,Yp;Gp=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};ic=function(){};Jp=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Zr(Kt.current);var i=null;switch(r){case"input":s=Cl(e,s),n=Cl(e,n),i=[];break;case"select":s=ve({},s,{value:void 0}),n=ve({},n,{value:void 0}),i=[];break;case"textarea":s=Tl(e,s),n=Tl(e,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Aa)}Pl(r,n);var a;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(a in l)l.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ks.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(r||(r={}),r[a]=c[a])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ks.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&de("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Yp=function(e,t,r,n){r!==n&&(t.flags|=4)};function ws(e,t){if(!pe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Me(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Iy(e,t,r){var n=t.pendingProps;switch(Xc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Me(t),null;case 1:return tt(t.type)&&Ta(),Me(t),null;case 3:return n=t.stateNode,rs(),he(et),he(We),ou(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Mi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,At!==null&&(fc(At),At=null))),ic(e,t),Me(t),null;case 5:au(t);var s=Zr(ii.current);if(r=t.type,e!==null&&t.stateNode!=null)Jp(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error($(166));return Me(t),null}if(e=Zr(Kt.current),Mi(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[Wt]=t,n[ni]=i,e=(t.mode&1)!==0,r){case"dialog":de("cancel",n),de("close",n);break;case"iframe":case"object":case"embed":de("load",n);break;case"video":case"audio":for(s=0;s<As.length;s++)de(As[s],n);break;case"source":de("error",n);break;case"img":case"image":case"link":de("error",n),de("load",n);break;case"details":de("toggle",n);break;case"input":Gu(n,i),de("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},de("invalid",n);break;case"textarea":Yu(n,i),de("invalid",n)}Pl(r,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&Bi(n.textContent,l,e),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Bi(n.textContent,l,e),s=["children",""+l]):Ks.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&de("scroll",n)}switch(r){case"input":Oi(n),Ju(n,i,!0);break;case"textarea":Oi(n),Qu(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Aa)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Sf(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[Wt]=t,e[ni]=n,Gp(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ol(r,n),r){case"dialog":de("cancel",e),de("close",e),s=n;break;case"iframe":case"object":case"embed":de("load",e),s=n;break;case"video":case"audio":for(s=0;s<As.length;s++)de(As[s],e);s=n;break;case"source":de("error",e),s=n;break;case"img":case"image":case"link":de("error",e),de("load",e),s=n;break;case"details":de("toggle",e),s=n;break;case"input":Gu(e,n),s=Cl(e,n),de("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=ve({},n,{value:void 0}),de("invalid",e);break;case"textarea":Yu(e,n),s=Tl(e,n),de("invalid",e);break;default:s=n}Pl(r,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Cf(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&jf(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Gs(e,c):typeof c=="number"&&Gs(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ks.hasOwnProperty(i)?c!=null&&i==="onScroll"&&de("scroll",e):c!=null&&Dc(e,i,c,a))}switch(r){case"input":Oi(e),Ju(e,n,!1);break;case"textarea":Oi(e),Qu(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Lr(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?qn(e,!!n.multiple,i,!1):n.defaultValue!=null&&qn(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Aa)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Me(t),null;case 6:if(e&&t.stateNode!=null)Yp(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error($(166));if(r=Zr(ii.current),Zr(Kt.current),Mi(t)){if(n=t.stateNode,r=t.memoizedProps,n[Wt]=t,(i=n.nodeValue!==r)&&(e=lt,e!==null))switch(e.tag){case 3:Bi(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Bi(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Wt]=t,t.stateNode=n}return Me(t),null;case 13:if(he(ge),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(pe&&at!==null&&t.mode&1&&!(t.flags&128))pp(),es(),t.flags|=98560,i=!1;else if(i=Mi(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error($(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error($(317));i[Wt]=t}else es(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Me(t),i=!1}else At!==null&&(fc(At),At=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ge.current&1?Ae===0&&(Ae=3):xu())),t.updateQueue!==null&&(t.flags|=4),Me(t),null);case 4:return rs(),ic(e,t),e===null&&ti(t.stateNode.containerInfo),Me(t),null;case 10:return ru(t.type._context),Me(t),null;case 17:return tt(t.type)&&Ta(),Me(t),null;case 19:if(he(ge),i=t.memoizedState,i===null)return Me(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)ws(i,!1);else{if(Ae!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Da(e),a!==null){for(t.flags|=128,ws(i,!1),n=a.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return ce(ge,ge.current&1|2),t.child}e=e.sibling}i.tail!==null&&Se()>ss&&(t.flags|=128,n=!0,ws(i,!1),t.lanes=4194304)}else{if(!n)if(e=Da(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),ws(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!pe)return Me(t),null}else 2*Se()-i.renderingStartTime>ss&&r!==1073741824&&(t.flags|=128,n=!0,ws(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Se(),t.sibling=null,r=ge.current,ce(ge,n?r&1|2:r&1),t):(Me(t),null);case 22:case 23:return vu(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?st&1073741824&&(Me(t),t.subtreeFlags&6&&(t.flags|=8192)):Me(t),null;case 24:return null;case 25:return null}throw Error($(156,t.tag))}function $y(e,t){switch(Xc(t),t.tag){case 1:return tt(t.type)&&Ta(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rs(),he(et),he(We),ou(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return au(t),null;case 13:if(he(ge),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error($(340));es()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return he(ge),null;case 4:return rs(),null;case 10:return ru(t.type._context),null;case 22:case 23:return vu(),null;case 24:return null;default:return null}}var Wi=!1,qe=!1,Dy=typeof WeakSet=="function"?WeakSet:Set,M=null;function Bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){_e(e,t,n)}else r.current=null}function ac(e,t,r){try{r()}catch(n){_e(e,t,n)}}var Ud=!1;function Ly(e,t){if(Hl=Ea,e=tp(),Yc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,l=-1,c=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(l=a+s),h!==i||n!==0&&h.nodeType!==3||(c=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++u===s&&(l=a),f===i&&++d===n&&(c=a),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(ql={focusedElem:e,selectionRange:r},Ea=!1,M=t;M!==null;)if(t=M,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,M=e;else for(;M!==null;){t=M;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var m=w.memoizedProps,k=w.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:Et(t.type,m),k);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(E){_e(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,M=e;break}M=t.return}return w=Ud,Ud=!1,w}function Us(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&ac(t,r,i)}s=s.next}while(s!==n)}}function go(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function oc(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Qp(e){var t=e.alternate;t!==null&&(e.alternate=null,Qp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wt],delete t[ni],delete t[Kl],delete t[wy],delete t[by])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Xp(e){return e.tag===5||e.tag===3||e.tag===4}function Bd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lc(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Aa));else if(n!==4&&(e=e.child,e!==null))for(lc(e,t,r),e=e.sibling;e!==null;)lc(e,t,r),e=e.sibling}function cc(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(cc(e,t,r),e=e.sibling;e!==null;)cc(e,t,r),e=e.sibling}var $e=null,Nt=!1;function vr(e,t,r){for(r=r.child;r!==null;)Zp(e,t,r),r=r.sibling}function Zp(e,t,r){if(Vt&&typeof Vt.onCommitFiberUnmount=="function")try{Vt.onCommitFiberUnmount(oo,r)}catch{}switch(r.tag){case 5:qe||Bn(r,t);case 6:var n=$e,s=Nt;$e=null,vr(e,t,r),$e=n,Nt=s,$e!==null&&(Nt?(e=$e,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):$e.removeChild(r.stateNode));break;case 18:$e!==null&&(Nt?(e=$e,r=r.stateNode,e.nodeType===8?Yo(e.parentNode,r):e.nodeType===1&&Yo(e,r),Xs(e)):Yo($e,r.stateNode));break;case 4:n=$e,s=Nt,$e=r.stateNode.containerInfo,Nt=!0,vr(e,t,r),$e=n,Nt=s;break;case 0:case 11:case 14:case 15:if(!qe&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&ac(r,t,a),s=s.next}while(s!==n)}vr(e,t,r);break;case 1:if(!qe&&(Bn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){_e(r,t,l)}vr(e,t,r);break;case 21:vr(e,t,r);break;case 22:r.mode&1?(qe=(n=qe)||r.memoizedState!==null,vr(e,t,r),qe=n):vr(e,t,r);break;default:vr(e,t,r)}}function Md(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Dy),t.forEach(function(n){var s=Ky.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function kt(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:$e=l.stateNode,Nt=!1;break e;case 3:$e=l.stateNode.containerInfo,Nt=!0;break e;case 4:$e=l.stateNode.containerInfo,Nt=!0;break e}l=l.return}if($e===null)throw Error($(160));Zp(i,a,s),$e=null,Nt=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){_e(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)em(t,e),t=t.sibling}function em(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(kt(t,e),Ut(e),n&4){try{Us(3,e,e.return),go(3,e)}catch(m){_e(e,e.return,m)}try{Us(5,e,e.return)}catch(m){_e(e,e.return,m)}}break;case 1:kt(t,e),Ut(e),n&512&&r!==null&&Bn(r,r.return);break;case 5:if(kt(t,e),Ut(e),n&512&&r!==null&&Bn(r,r.return),e.flags&32){var s=e.stateNode;try{Gs(s,"")}catch(m){_e(e,e.return,m)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&_f(s,i),Ol(l,a);var u=Ol(l,i);for(a=0;a<c.length;a+=2){var d=c[a],h=c[a+1];d==="style"?Cf(s,h):d==="dangerouslySetInnerHTML"?jf(s,h):d==="children"?Gs(s,h):Dc(s,d,h,u)}switch(l){case"input":Nl(s,i);break;case"textarea":kf(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?qn(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?qn(s,!!i.multiple,i.defaultValue,!0):qn(s,!!i.multiple,i.multiple?[]:"",!1))}s[ni]=i}catch(m){_e(e,e.return,m)}}break;case 6:if(kt(t,e),Ut(e),n&4){if(e.stateNode===null)throw Error($(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(m){_e(e,e.return,m)}}break;case 3:if(kt(t,e),Ut(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Xs(t.containerInfo)}catch(m){_e(e,e.return,m)}break;case 4:kt(t,e),Ut(e);break;case 13:kt(t,e),Ut(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(gu=Se())),n&4&&Md(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(qe=(u=qe)||d,kt(t,e),qe=u):kt(t,e),Ut(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(M=e,d=e.child;d!==null;){for(h=M=d;M!==null;){switch(f=M,p=f.child,f.tag){case 0:case 11:case 14:case 15:Us(4,f,f.return);break;case 1:Bn(f,f.return);var w=f.stateNode;if(typeof w.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(m){_e(n,r,m)}}break;case 5:Bn(f,f.return);break;case 22:if(f.memoizedState!==null){qd(h);continue}}p!==null?(p.return=f,M=p):qd(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Ef("display",a))}catch(m){_e(e,e.return,m)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(m){_e(e,e.return,m)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:kt(t,e),Ut(e),n&4&&Md(e);break;case 21:break;default:kt(t,e),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Xp(r)){var n=r;break e}r=r.return}throw Error($(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Gs(s,""),n.flags&=-33);var i=Bd(e);cc(e,i,s);break;case 3:case 4:var a=n.stateNode.containerInfo,l=Bd(e);lc(e,l,a);break;default:throw Error($(161))}}catch(c){_e(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fy(e,t,r){M=e,tm(e)}function tm(e,t,r){for(var n=(e.mode&1)!==0;M!==null;){var s=M,i=s.child;if(s.tag===22&&n){var a=s.memoizedState!==null||Wi;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||qe;l=Wi;var u=qe;if(Wi=a,(qe=c)&&!u)for(M=s;M!==null;)a=M,c=a.child,a.tag===22&&a.memoizedState!==null?Wd(s):c!==null?(c.return=a,M=c):Wd(s);for(;i!==null;)M=i,tm(i),i=i.sibling;M=s,Wi=l,qe=u}Hd(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,M=i):Hd(e)}}function Hd(e){for(;M!==null;){var t=M;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:qe||go(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!qe)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:Et(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Cd(t,i,n);break;case 3:var a=t.updateQueue;if(a!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Cd(t,a,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Xs(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error($(163))}qe||t.flags&512&&oc(t)}catch(f){_e(t,t.return,f)}}if(t===e){M=null;break}if(r=t.sibling,r!==null){r.return=t.return,M=r;break}M=t.return}}function qd(e){for(;M!==null;){var t=M;if(t===e){M=null;break}var r=t.sibling;if(r!==null){r.return=t.return,M=r;break}M=t.return}}function Wd(e){for(;M!==null;){var t=M;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{go(4,t)}catch(c){_e(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){_e(t,s,c)}}var i=t.return;try{oc(t)}catch(c){_e(t,i,c)}break;case 5:var a=t.return;try{oc(t)}catch(c){_e(t,a,c)}}}catch(c){_e(t,t.return,c)}if(t===e){M=null;break}var l=t.sibling;if(l!==null){l.return=t.return,M=l;break}M=t.return}}var Uy=Math.ceil,Ua=mr.ReactCurrentDispatcher,pu=mr.ReactCurrentOwner,gt=mr.ReactCurrentBatchConfig,te=0,Ie=null,Ee=null,Le=0,st=0,Mn=Mr(0),Ae=0,ci=null,un=0,yo=0,mu=0,Bs=null,Xe=null,gu=0,ss=1/0,Zt=null,Ba=!1,uc=null,Ir=null,Vi=!1,Nr=null,Ma=0,Ms=0,dc=null,pa=-1,ma=0;function Ke(){return te&6?Se():pa!==-1?pa:pa=Se()}function $r(e){return e.mode&1?te&2&&Le!==0?Le&-Le:ky.transition!==null?(ma===0&&(ma=Ff()),ma):(e=se,e!==0||(e=window.event,e=e===void 0?16:Vf(e.type)),e):1}function Pt(e,t,r,n){if(50<Ms)throw Ms=0,dc=null,Error($(185));_i(e,r,n),(!(te&2)||e!==Ie)&&(e===Ie&&(!(te&2)&&(yo|=r),Ae===4&&kr(e,Le)),rt(e,n),r===1&&te===0&&!(t.mode&1)&&(ss=Se()+500,fo&&Hr()))}function rt(e,t){var r=e.callbackNode;k0(e,t);var n=ja(e,e===Ie?Le:0);if(n===0)r!==null&&ed(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&ed(r),t===1)e.tag===0?_y(Vd.bind(null,e)):dp(Vd.bind(null,e)),vy(function(){!(te&6)&&Hr()}),r=null;else{switch(Uf(n)){case 1:r=Mc;break;case 4:r=Df;break;case 16:r=Sa;break;case 536870912:r=Lf;break;default:r=Sa}r=cm(r,rm.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function rm(e,t){if(pa=-1,ma=0,te&6)throw Error($(327));var r=e.callbackNode;if(Jn()&&e.callbackNode!==r)return null;var n=ja(e,e===Ie?Le:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Ha(e,n);else{t=n;var s=te;te|=2;var i=sm();(Ie!==e||Le!==t)&&(Zt=null,ss=Se()+500,rn(e,t));do try{Hy();break}catch(l){nm(e,l)}while(!0);tu(),Ua.current=i,te=s,Ee!==null?t=0:(Ie=null,Le=0,t=Ae)}if(t!==0){if(t===2&&(s=Ll(e),s!==0&&(n=s,t=hc(e,s))),t===1)throw r=ci,rn(e,0),kr(e,n),rt(e,Se()),r;if(t===6)kr(e,n);else{if(s=e.current.alternate,!(n&30)&&!By(s)&&(t=Ha(e,n),t===2&&(i=Ll(e),i!==0&&(n=i,t=hc(e,i))),t===1))throw r=ci,rn(e,0),kr(e,n),rt(e,Se()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error($(345));case 2:Jr(e,Xe,Zt);break;case 3:if(kr(e,n),(n&130023424)===n&&(t=gu+500-Se(),10<t)){if(ja(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){Ke(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Vl(Jr.bind(null,e,Xe,Zt),t);break}Jr(e,Xe,Zt);break;case 4:if(kr(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var a=31-Rt(n);i=1<<a,a=t[a],a>s&&(s=a),n&=~i}if(n=s,n=Se()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Uy(n/1960))-n,10<n){e.timeoutHandle=Vl(Jr.bind(null,e,Xe,Zt),n);break}Jr(e,Xe,Zt);break;case 5:Jr(e,Xe,Zt);break;default:throw Error($(329))}}}return rt(e,Se()),e.callbackNode===r?rm.bind(null,e):null}function hc(e,t){var r=Bs;return e.current.memoizedState.isDehydrated&&(rn(e,t).flags|=256),e=Ha(e,t),e!==2&&(t=Xe,Xe=r,t!==null&&fc(t)),e}function fc(e){Xe===null?Xe=e:Xe.push.apply(Xe,e)}function By(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!zt(i(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function kr(e,t){for(t&=~mu,t&=~yo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Rt(t),n=1<<r;e[r]=-1,t&=~n}}function Vd(e){if(te&6)throw Error($(327));Jn();var t=ja(e,0);if(!(t&1))return rt(e,Se()),null;var r=Ha(e,t);if(e.tag!==0&&r===2){var n=Ll(e);n!==0&&(t=n,r=hc(e,n))}if(r===1)throw r=ci,rn(e,0),kr(e,t),rt(e,Se()),r;if(r===6)throw Error($(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Jr(e,Xe,Zt),rt(e,Se()),null}function yu(e,t){var r=te;te|=1;try{return e(t)}finally{te=r,te===0&&(ss=Se()+500,fo&&Hr())}}function dn(e){Nr!==null&&Nr.tag===0&&!(te&6)&&Jn();var t=te;te|=1;var r=gt.transition,n=se;try{if(gt.transition=null,se=1,e)return e()}finally{se=n,gt.transition=r,te=t,!(te&6)&&Hr()}}function vu(){st=Mn.current,he(Mn)}function rn(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,yy(r)),Ee!==null)for(r=Ee.return;r!==null;){var n=r;switch(Xc(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ta();break;case 3:rs(),he(et),he(We),ou();break;case 5:au(n);break;case 4:rs();break;case 13:he(ge);break;case 19:he(ge);break;case 10:ru(n.type._context);break;case 22:case 23:vu()}r=r.return}if(Ie=e,Ee=e=Dr(e.current,null),Le=st=t,Ae=0,ci=null,mu=yo=un=0,Xe=Bs=null,Xr!==null){for(t=0;t<Xr.length;t++)if(r=Xr[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=s,n.next=a}r.pending=n}Xr=null}return e}function nm(e,t){do{var r=Ee;try{if(tu(),da.current=Fa,La){for(var n=ye.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}La=!1}if(cn=0,ze=Ne=ye=null,Fs=!1,ai=0,pu.current=null,r===null||r.return===null){Ae=1,ci=t,Ee=null;break}e:{var i=e,a=r.return,l=r,c=t;if(t=Le,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Od(a);if(p!==null){p.flags&=-257,zd(p,a,l,i,t),p.mode&1&&Pd(i,u,t),t=p,c=u;var w=t.updateQueue;if(w===null){var m=new Set;m.add(c),t.updateQueue=m}else w.add(c);break e}else{if(!(t&1)){Pd(i,u,t),xu();break e}c=Error($(426))}}else if(pe&&l.mode&1){var k=Od(a);if(k!==null){!(k.flags&65536)&&(k.flags|=256),zd(k,a,l,i,t),Zc(ns(c,l));break e}}i=c=ns(c,l),Ae!==4&&(Ae=2),Bs===null?Bs=[i]:Bs.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=Up(i,c,t);Ed(i,y);break e;case 1:l=c;var g=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ir===null||!Ir.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var E=Bp(i,l,t);Ed(i,E);break e}}i=i.return}while(i!==null)}am(r)}catch(T){t=T,Ee===r&&r!==null&&(Ee=r=r.return);continue}break}while(!0)}function sm(){var e=Ua.current;return Ua.current=Fa,e===null?Fa:e}function xu(){(Ae===0||Ae===3||Ae===2)&&(Ae=4),Ie===null||!(un&268435455)&&!(yo&268435455)||kr(Ie,Le)}function Ha(e,t){var r=te;te|=2;var n=sm();(Ie!==e||Le!==t)&&(Zt=null,rn(e,t));do try{My();break}catch(s){nm(e,s)}while(!0);if(tu(),te=r,Ua.current=n,Ee!==null)throw Error($(261));return Ie=null,Le=0,Ae}function My(){for(;Ee!==null;)im(Ee)}function Hy(){for(;Ee!==null&&!p0();)im(Ee)}function im(e){var t=lm(e.alternate,e,st);e.memoizedProps=e.pendingProps,t===null?am(e):Ee=t,pu.current=null}function am(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=$y(r,t),r!==null){r.flags&=32767,Ee=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ae=6,Ee=null;return}}else if(r=Iy(r,t,st),r!==null){Ee=r;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Ae===0&&(Ae=5)}function Jr(e,t,r){var n=se,s=gt.transition;try{gt.transition=null,se=1,qy(e,t,r,n)}finally{gt.transition=s,se=n}return null}function qy(e,t,r,n){do Jn();while(Nr!==null);if(te&6)throw Error($(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error($(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(S0(e,i),e===Ie&&(Ee=Ie=null,Le=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Vi||(Vi=!0,cm(Sa,function(){return Jn(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=gt.transition,gt.transition=null;var a=se;se=1;var l=te;te|=4,pu.current=null,Ly(e,r),em(r,e),uy(ql),Ea=!!Hl,ql=Hl=null,e.current=r,Fy(r),m0(),te=l,se=a,gt.transition=i}else e.current=r;if(Vi&&(Vi=!1,Nr=e,Ma=s),i=e.pendingLanes,i===0&&(Ir=null),v0(r.stateNode),rt(e,Se()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(Ba)throw Ba=!1,e=uc,uc=null,e;return Ma&1&&e.tag!==0&&Jn(),i=e.pendingLanes,i&1?e===dc?Ms++:(Ms=0,dc=e):Ms=0,Hr(),null}function Jn(){if(Nr!==null){var e=Uf(Ma),t=gt.transition,r=se;try{if(gt.transition=null,se=16>e?16:e,Nr===null)var n=!1;else{if(e=Nr,Nr=null,Ma=0,te&6)throw Error($(331));var s=te;for(te|=4,M=e.current;M!==null;){var i=M,a=i.child;if(M.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(M=u;M!==null;){var d=M;switch(d.tag){case 0:case 11:case 15:Us(8,d,i)}var h=d.child;if(h!==null)h.return=d,M=h;else for(;M!==null;){d=M;var f=d.sibling,p=d.return;if(Qp(d),d===u){M=null;break}if(f!==null){f.return=p,M=f;break}M=p}}}var w=i.alternate;if(w!==null){var m=w.child;if(m!==null){w.child=null;do{var k=m.sibling;m.sibling=null,m=k}while(m!==null)}}M=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,M=a;else e:for(;M!==null;){if(i=M,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Us(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,M=y;break e}M=i.return}}var g=e.current;for(M=g;M!==null;){a=M;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,M=x;else e:for(a=g;M!==null;){if(l=M,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:go(9,l)}}catch(T){_e(l,l.return,T)}if(l===a){M=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,M=E;break e}M=l.return}}if(te=s,Hr(),Vt&&typeof Vt.onPostCommitFiberRoot=="function")try{Vt.onPostCommitFiberRoot(oo,e)}catch{}n=!0}return n}finally{se=r,gt.transition=t}}return!1}function Kd(e,t,r){t=ns(r,t),t=Up(e,t,1),e=zr(e,t,1),t=Ke(),e!==null&&(_i(e,1,t),rt(e,t))}function _e(e,t,r){if(e.tag===3)Kd(e,e,r);else for(;t!==null;){if(t.tag===3){Kd(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Ir===null||!Ir.has(n))){e=ns(r,e),e=Bp(t,e,1),t=zr(t,e,1),e=Ke(),t!==null&&(_i(t,1,e),rt(t,e));break}}t=t.return}}function Wy(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Ke(),e.pingedLanes|=e.suspendedLanes&r,Ie===e&&(Le&r)===r&&(Ae===4||Ae===3&&(Le&130023424)===Le&&500>Se()-gu?rn(e,0):mu|=r),rt(e,t)}function om(e,t){t===0&&(e.mode&1?(t=$i,$i<<=1,!($i&130023424)&&($i=4194304)):t=1);var r=Ke();e=dr(e,t),e!==null&&(_i(e,t,r),rt(e,r))}function Vy(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),om(e,r)}function Ky(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error($(314))}n!==null&&n.delete(t),om(e,r)}var lm;lm=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||et.current)Ze=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Ze=!1,zy(e,t,r);Ze=!!(e.flags&131072)}else Ze=!1,pe&&t.flags&1048576&&hp(t,Oa,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;fa(e,t),e=t.pendingProps;var s=Zn(t,We.current);Gn(t,r),s=cu(null,t,n,e,s,r);var i=uu();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tt(n)?(i=!0,Ra(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,su(t),s.updater=mo,t.stateNode=s,s._reactInternals=t,Zl(t,n,e,r),t=rc(null,t,n,!0,i,r)):(t.tag=0,pe&&i&&Qc(t),Ve(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(fa(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=Jy(n),e=Et(n,e),s){case 0:t=tc(null,t,n,e,r);break e;case 1:t=Dd(null,t,n,e,r);break e;case 11:t=Id(null,t,n,e,r);break e;case 14:t=$d(null,t,n,Et(n.type,e),r);break e}throw Error($(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Et(n,s),tc(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Et(n,s),Dd(e,t,n,s,r);case 3:e:{if(Wp(t),e===null)throw Error($(387));n=t.pendingProps,i=t.memoizedState,s=i.element,vp(e,t),$a(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=ns(Error($(423)),t),t=Ld(e,t,n,r,s);break e}else if(n!==s){s=ns(Error($(424)),t),t=Ld(e,t,n,r,s);break e}else for(at=Or(t.stateNode.containerInfo.firstChild),lt=t,pe=!0,At=null,r=gp(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(es(),n===s){t=hr(e,t,r);break e}Ve(e,t,n,r)}t=t.child}return t;case 5:return xp(t),e===null&&Yl(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Wl(n,s)?a=null:i!==null&&Wl(n,i)&&(t.flags|=32),qp(e,t),Ve(e,t,a,r),t.child;case 6:return e===null&&Yl(t),null;case 13:return Vp(e,t,r);case 4:return iu(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ts(t,null,n,r):Ve(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Et(n,s),Id(e,t,n,s,r);case 7:return Ve(e,t,t.pendingProps,r),t.child;case 8:return Ve(e,t,t.pendingProps.children,r),t.child;case 12:return Ve(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,ce(za,n._currentValue),n._currentValue=a,i!==null)if(zt(i.value,a)){if(i.children===s.children&&!et.current){t=hr(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=ar(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),Ql(i.return,r,t),l.lanes|=r;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error($(341));a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),Ql(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ve(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Gn(t,r),s=yt(s),n=n(s),t.flags|=1,Ve(e,t,n,r),t.child;case 14:return n=t.type,s=Et(n,t.pendingProps),s=Et(n.type,s),$d(e,t,n,s,r);case 15:return Mp(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Et(n,s),fa(e,t),t.tag=1,tt(n)?(e=!0,Ra(t)):e=!1,Gn(t,r),Fp(t,n,s),Zl(t,n,s,r),rc(null,t,n,!0,e,r);case 19:return Kp(e,t,r);case 22:return Hp(e,t,r)}throw Error($(156,t.tag))};function cm(e,t){return $f(e,t)}function Gy(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mt(e,t,r,n){return new Gy(e,t,r,n)}function wu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jy(e){if(typeof e=="function")return wu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fc)return 11;if(e===Uc)return 14}return 2}function Dr(e,t){var r=e.alternate;return r===null?(r=mt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function ga(e,t,r,n,s,i){var a=2;if(n=e,typeof e=="function")wu(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pn:return nn(r.children,s,i,t);case Lc:a=8,s|=8;break;case kl:return e=mt(12,r,t,s|2),e.elementType=kl,e.lanes=i,e;case Sl:return e=mt(13,r,t,s),e.elementType=Sl,e.lanes=i,e;case jl:return e=mt(19,r,t,s),e.elementType=jl,e.lanes=i,e;case xf:return vo(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yf:a=10;break e;case vf:a=9;break e;case Fc:a=11;break e;case Uc:a=14;break e;case wr:a=16,n=null;break e}throw Error($(130,e==null?e:typeof e,""))}return t=mt(a,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function nn(e,t,r,n){return e=mt(7,e,n,t),e.lanes=r,e}function vo(e,t,r,n){return e=mt(22,e,n,t),e.elementType=xf,e.lanes=r,e.stateNode={isHidden:!1},e}function sl(e,t,r){return e=mt(6,e,null,t),e.lanes=r,e}function il(e,t,r){return t=mt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Yy(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fo(0),this.expirationTimes=Fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fo(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function bu(e,t,r,n,s,i,a,l,c){return e=new Yy(e,t,r,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=mt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},su(i),e}function Qy(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Rn,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function um(e){if(!e)return Fr;e=e._reactInternals;e:{if(gn(e)!==e||e.tag!==1)throw Error($(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error($(171))}if(e.tag===1){var r=e.type;if(tt(r))return up(e,r,t)}return t}function dm(e,t,r,n,s,i,a,l,c){return e=bu(r,n,!0,e,s,i,a,l,c),e.context=um(null),r=e.current,n=Ke(),s=$r(r),i=ar(n,s),i.callback=t??null,zr(r,i,s),e.current.lanes=s,_i(e,s,n),rt(e,n),e}function xo(e,t,r,n){var s=t.current,i=Ke(),a=$r(s);return r=um(r),t.context===null?t.context=r:t.pendingContext=r,t=ar(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=zr(s,t,a),e!==null&&(Pt(e,s,a,i),ua(e,s,a)),a}function qa(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Gd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function _u(e,t){Gd(e,t),(e=e.alternate)&&Gd(e,t)}function Xy(){return null}var hm=typeof reportError=="function"?reportError:function(e){console.error(e)};function ku(e){this._internalRoot=e}wo.prototype.render=ku.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error($(409));xo(e,t,null,null)};wo.prototype.unmount=ku.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dn(function(){xo(null,e,null,null)}),t[ur]=null}};function wo(e){this._internalRoot=e}wo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hf();e={blockedOn:null,target:e,priority:t};for(var r=0;r<_r.length&&t!==0&&t<_r[r].priority;r++);_r.splice(r,0,e),r===0&&Wf(e)}};function Su(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function bo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Jd(){}function Zy(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=qa(a);i.call(u)}}var a=dm(t,n,e,0,null,!1,!1,"",Jd);return e._reactRootContainer=a,e[ur]=a.current,ti(e.nodeType===8?e.parentNode:e),dn(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=qa(c);l.call(u)}}var c=bu(e,0,!1,null,null,!1,!1,"",Jd);return e._reactRootContainer=c,e[ur]=c.current,ti(e.nodeType===8?e.parentNode:e),dn(function(){xo(t,c,r,n)}),c}function _o(e,t,r,n,s){var i=r._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=qa(a);l.call(c)}}xo(t,a,e,s)}else a=Zy(r,t,e,s,n);return qa(a)}Bf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Ns(t.pendingLanes);r!==0&&(Hc(t,r|1),rt(t,Se()),!(te&6)&&(ss=Se()+500,Hr()))}break;case 13:dn(function(){var n=dr(e,1);if(n!==null){var s=Ke();Pt(n,e,1,s)}}),_u(e,1)}};qc=function(e){if(e.tag===13){var t=dr(e,134217728);if(t!==null){var r=Ke();Pt(t,e,134217728,r)}_u(e,134217728)}};Mf=function(e){if(e.tag===13){var t=$r(e),r=dr(e,t);if(r!==null){var n=Ke();Pt(r,e,t,n)}_u(e,t)}};Hf=function(){return se};qf=function(e,t){var r=se;try{return se=e,t()}finally{se=r}};Il=function(e,t,r){switch(t){case"input":if(Nl(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=ho(n);if(!s)throw Error($(90));bf(n),Nl(n,s)}}}break;case"textarea":kf(e,r);break;case"select":t=r.value,t!=null&&qn(e,!!r.multiple,t,!1)}};Tf=yu;Rf=dn;var ev={usingClientEntryPoint:!1,Events:[Si,$n,ho,Nf,Af,yu]},bs={findFiberByHostInstance:Qr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tv={bundleType:bs.bundleType,version:bs.version,rendererPackageName:bs.rendererPackageName,rendererConfig:bs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:mr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zf(e),e===null?null:e.stateNode},findFiberByHostInstance:bs.findFiberByHostInstance||Xy,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ki=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ki.isDisabled&&Ki.supportsFiber)try{oo=Ki.inject(tv),Vt=Ki}catch{}}ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ev;ut.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Su(t))throw Error($(200));return Qy(e,t,null,r)};ut.createRoot=function(e,t){if(!Su(e))throw Error($(299));var r=!1,n="",s=hm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=bu(e,1,!1,null,null,r,!1,n,s),e[ur]=t.current,ti(e.nodeType===8?e.parentNode:e),new ku(t)};ut.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error($(188)):(e=Object.keys(e).join(","),Error($(268,e)));return e=zf(t),e=e===null?null:e.stateNode,e};ut.flushSync=function(e){return dn(e)};ut.hydrate=function(e,t,r){if(!bo(t))throw Error($(200));return _o(null,e,t,!0,r)};ut.hydrateRoot=function(e,t,r){if(!Su(e))throw Error($(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",a=hm;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=dm(t,null,e,1,r??null,s,!1,i,a),e[ur]=t.current,ti(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new wo(t)};ut.render=function(e,t,r){if(!bo(t))throw Error($(200));return _o(null,e,t,!1,r)};ut.unmountComponentAtNode=function(e){if(!bo(e))throw Error($(40));return e._reactRootContainer?(dn(function(){_o(null,null,e,!1,function(){e._reactRootContainer=null,e[ur]=null})}),!0):!1};ut.unstable_batchedUpdates=yu;ut.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!bo(r))throw Error($(200));if(e==null||e._reactInternals===void 0)throw Error($(38));return _o(e,t,r,!1,n)};ut.version="18.3.1-next-f1338f8080-20240426";function fm(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fm)}catch(e){console.error(e)}}fm(),ff.exports=ut;var rv=ff.exports,Yd=rv;bl.createRoot=Yd.createRoot,bl.hydrateRoot=Yd.hydrateRoot;/**
 * react-router v7.18.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var ju=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,pm=/^[\\/]{2}/;function nv(e,t){return t+e.replace(/\\/g,"/")}var Qd="popstate";function Xd(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function sv(e={}){function t(n,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:a,search:l,hash:c}=i||n.location;return pc("",{pathname:a,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,s){return typeof s=="string"?s:ui(s)}return av(t,r,null,e)}function Te(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iv(){return Math.random().toString(36).substring(2,10)}function Zd(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function pc(e,t,r=null,n,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ei(t):t,state:r,key:t&&t.key||n||iv(),mask:s}}function ui({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ei(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function av(e,t,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,l="POP",c=null,u=d();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function d(){return(a.state||{idx:null}).idx}function h(){l="POP";let k=d(),y=k==null?null:k-u;u=k,c&&c({action:l,location:m.location,delta:y})}function f(k,y){l="PUSH";let g=Xd(k)?k:pc(m.location,k,y);u=d()+1;let x=Zd(g,u),E=m.createHref(g.mask||g);try{a.pushState(x,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;s.location.assign(E)}i&&c&&c({action:l,location:m.location,delta:1})}function p(k,y){l="REPLACE";let g=Xd(k)?k:pc(m.location,k,y);u=d();let x=Zd(g,u),E=m.createHref(g.mask||g);a.replaceState(x,"",E),i&&c&&c({action:l,location:m.location,delta:0})}function w(k){return ov(s,k)}let m={get action(){return l},get location(){return e(s,a)},listen(k){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Qd,h),c=k,()=>{s.removeEventListener(Qd,h),c=null}},createHref(k){return t(s,k)},createURL:w,encodeLocation(k){let y=w(k);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(k){return a.go(k)}};return m}function ov(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),Te(n,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:ui(t);return s=s.replace(/ $/,"%20"),!r&&pm.test(s)&&(s=n+s),new URL(s,n)}function mm(e,t,r="/"){return lv(e,t,r,!1)}function lv(e,t,r,n,s){let i=typeof t=="string"?Ei(t):t,a=fr(i.pathname||"/",r);if(a==null)return null;let l=cv(e),c=null,u=wv(a);for(let d=0;c==null&&d<l.length;++d)c=xv(l[d],u,n);return c}function cv(e){let t=gm(e);return uv(t),t}function gm(e,t=[],r=[],n="",s=!1){let i=(a,l,c=s,u)=>{let d={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&c)return;Te(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let h=Ot([n,d.relativePath]),f=r.concat(d);a.children&&a.children.length>0&&(Te(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),gm(a.children,t,f,h,c)),!(a.path==null&&!a.index)&&t.push({path:h,score:yv(h,a.index),routesMeta:f.map((p,w)=>{let[m,k]=xm(p.relativePath,p.caseSensitive,w===f.length-1);return{...p,matcher:m,compiledParams:k}})})};return e.forEach((a,l)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,l);else for(let u of ym(a.path))i(a,l,!0,u)}),t}function ym(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let a=ym(n.join("/")),l=[];return l.push(...a.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function uv(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:vv(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var dv=/^:[\w-]+$/,hv=3,fv=2,pv=1,mv=10,gv=-2,eh=e=>e==="*";function yv(e,t){let r=e.split("/"),n=r.length;return r.some(eh)&&(n+=gv),t&&(n+=fv),r.filter(s=>!eh(s)).reduce((s,i)=>s+(dv.test(i)?hv:i===""?pv:mv),n)}function vv(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function xv(e,t,r=!1){let{routesMeta:n}=e,s={},i="/",a=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",h={path:c.relativePath,caseSensitive:c.caseSensitive,end:u},f=c.matcher&&c.compiledParams?vm(h,d,c.matcher,c.compiledParams):Wa(h,d),p=c.route;if(!f&&u&&r&&!n[n.length-1].route.index&&(f=Wa({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!f)return null;Object.assign(s,f.params),a.push({params:s,pathname:Ot([i,f.pathname]),pathnameBase:kv(Ot([i,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(i=Ot([i,f.pathnameBase]))}return a}function Wa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=xm(e.path,e.caseSensitive,e.end);return vm(e,t,r,n)}function vm(e,t,r,n){let s=t.match(r);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,{paramName:d,isOptional:h},f)=>{if(d==="*"){let w=l[f]||"";a=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const p=l[f];return h&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:e}}function xm(e,t=!1,r=!0){Gt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c,u,d)=>{if(n.push({paramName:l,isOptional:c!=null}),c){let h=d.charAt(u+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function wv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Gt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function fr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function bv(e,t="/"){let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Ei(e):e,i;return r?(r=bm(r),r.startsWith("/")?i=th(r.substring(1),"/"):i=th(r,t)):i=t,{pathname:i,search:Sv(n),hash:jv(s)}}function th(e,t){let r=Va(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function al(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _v(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function wm(e){let t=_v(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function Eu(e,t,r,n=!1){let s;typeof e=="string"?s=Ei(e):(s={...e},Te(!s.pathname||!s.pathname.includes("?"),al("?","pathname","search",s)),Te(!s.pathname||!s.pathname.includes("#"),al("#","pathname","hash",s)),Te(!s.search||!s.search.includes("#"),al("#","search","hash",s)));let i=e===""||s.pathname==="",a=i?"/":s.pathname,l;if(a==null)l=r;else{let h=t.length-1;if(!n&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?t[h]:"/"}let c=bv(s,l),u=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var bm=e=>e.replace(/[\\/]{2,}/g,"/"),Ot=e=>bm(e.join("/")),Va=e=>e.replace(/\/+$/,""),kv=e=>Va(e).replace(/^\/*/,"/"),Sv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,jv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ev=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Cv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Nv(e){let t=e.map(r=>r.route.path).filter(Boolean);return Ot(t)||"/"}var _m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function km(e,t){let r=e;if(typeof r!="string"||!ju.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,s=!1;if(_m)try{let i=new URL(window.location.href),a=pm.test(r)?new URL(nv(r,i.protocol)):new URL(r),l=fr(a.pathname,t);a.origin===i.origin&&l!=null?r=l+a.search+a.hash:s=!0}catch{Gt(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sm=["POST","PUT","PATCH","DELETE"];new Set(Sm);var Av=["GET",...Sm];new Set(Av);var Tv=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Rv(e){try{return Tv.includes(new URL(e).protocol)}catch{return!1}}var us=_.createContext(null);us.displayName="DataRouter";var ko=_.createContext(null);ko.displayName="DataRouterState";var jm=_.createContext(!1);function Pv(){return _.useContext(jm)}var Em=_.createContext({isTransitioning:!1});Em.displayName="ViewTransition";var Ov=_.createContext(new Map);Ov.displayName="Fetchers";var zv=_.createContext(null);zv.displayName="Await";var wt=_.createContext(null);wt.displayName="Navigation";var So=_.createContext(null);So.displayName="Location";var gr=_.createContext({outlet:null,matches:[],isDataRoute:!1});gr.displayName="Route";var Cu=_.createContext(null);Cu.displayName="RouteError";var Cm="REACT_ROUTER_ERROR",Iv="REDIRECT",$v="ROUTE_ERROR_RESPONSE";function Dv(e){if(e.startsWith(`${Cm}:${Iv}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Lv(e){if(e.startsWith(`${Cm}:${$v}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ev(t.status,t.statusText,t.data)}catch{}}function Fv(e,{relative:t}={}){Te(Ci(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=_.useContext(wt),{hash:s,pathname:i,search:a}=Ni(e,{relative:t}),l=i;return r!=="/"&&(l=i==="/"?r:Ot([r,i])),n.createHref({pathname:l,search:a,hash:s})}function Ci(){return _.useContext(So)!=null}function $t(){return Te(Ci(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(So).location}var Nm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Am(e){_.useContext(wt).static||_.useLayoutEffect(e)}function Tm(){let{isDataRoute:e}=_.useContext(gr);return e?Xv():Uv()}function Uv(){Te(Ci(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(us),{basename:t,navigator:r}=_.useContext(wt),{matches:n}=_.useContext(gr),{pathname:s}=$t(),i=JSON.stringify(wm(n)),a=_.useRef(!1);return Am(()=>{a.current=!0}),_.useCallback((c,u={})=>{if(Gt(a.current,Nm),!a.current)return;if(typeof c=="number"){r.go(c);return}let d=Eu(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Ot([t,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[t,r,i,s,e])}_.createContext(null);function Ni(e,{relative:t}={}){let{matches:r}=_.useContext(gr),{pathname:n}=$t(),s=JSON.stringify(wm(r));return _.useMemo(()=>Eu(e,JSON.parse(s),n,t==="path"),[e,s,n,t])}function Bv(e,t,r){Te(Ci(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=_.useContext(wt),{matches:s}=_.useContext(gr),i=s[s.length-1],a=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let k=u&&u.path||"";Pm(l,!u||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let d=$t(),h;h=d;let f=h.pathname||"/",p=f;if(c!=="/"){let k=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(k=>Object.assign(k,{route:r.manifest[k.route.id]||k.route})):mm(e,{pathname:p});return Gt(u||w!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Gt(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),Vv(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},a,k.params),pathname:Ot([c,n.encodeLocation?n.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?c:Ot([c,n.encodeLocation?n.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,r)}function Mv(){let e=Qv(),t=Cv(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:i},"ErrorBoundary")," or"," ",_.createElement("code",{style:i},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),r?_.createElement("pre",{style:s},r):null,a)}var Hv=_.createElement(Mv,null),Rm=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Lv(e.digest);r&&(e=r)}let t=e!==void 0?_.createElement(gr.Provider,{value:this.props.routeContext},_.createElement(Cu.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(qv,{error:e},t):t}};Rm.contextType=jm;var ol=new WeakMap;function qv({children:e,error:t}){let{basename:r}=_.useContext(wt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=Dv(t.digest);if(n){let s=ol.get(t);if(s)throw s;let i=km(n.location,r),a=i.absoluteURL||i.to;if(Rv(a))throw new Error("Invalid redirect location");if(_m&&!ol.get(t))if(i.isExternal||n.reloadDocument)window.location.href=a;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw ol.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a}`})}}return e}function Wv({routeContext:e,match:t,children:r}){let n=_.useContext(us);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(gr.Provider,{value:e},r)}function Vv(e,t=[],r){let n=r==null?void 0:r.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,i=n==null?void 0:n.errors;if(i!=null){let d=s.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);Te(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let a=!1,l=-1;if(r&&n){a=n.renderFallback;for(let d=0;d<s.length;d++){let h=s[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=d),h.route.id){let{loaderData:f,errors:p}=n,w=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!p||p[h.route.id]===void 0);if(h.route.lazy||w){r.isStatic&&(a=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=r==null?void 0:r.onError,u=n&&c?(d,h)=>{var f,p;c(d,{location:n.location,params:((p=(f=n.matches)==null?void 0:f[0])==null?void 0:p.params)??{},pattern:Nv(n.matches),errorInfo:h})}:void 0;return s.reduceRight((d,h,f)=>{let p,w=!1,m=null,k=null;n&&(p=i&&h.route.id?i[h.route.id]:void 0,m=h.route.errorElement||Hv,a&&(l<0&&f===0?(Pm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):l===f&&(w=!0,k=h.route.hydrateFallbackElement||null)));let y=t.concat(s.slice(0,f+1)),g=()=>{let x;return p?x=m:w?x=k:h.route.Component?x=_.createElement(h.route.Component,null):h.route.element?x=h.route.element:x=d,_.createElement(Wv,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:x})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?_.createElement(Rm,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:u}):g()},null)}function Nu(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Kv(e){let t=_.useContext(us);return Te(t,Nu(e)),t}function Gv(e){let t=_.useContext(ko);return Te(t,Nu(e)),t}function Jv(e){let t=_.useContext(gr);return Te(t,Nu(e)),t}function Au(e){let t=Jv(e),r=t.matches[t.matches.length-1];return Te(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Yv(){return Au("useRouteId")}function Qv(){var n;let e=_.useContext(Cu),t=Gv("useRouteError"),r=Au("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function Xv(){let{router:e}=Kv("useNavigate"),t=Au("useNavigate"),r=_.useRef(!1);return Am(()=>{r.current=!0}),_.useCallback(async(s,i={})=>{Gt(r.current,Nm),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var rh={};function Pm(e,t,r){!t&&!rh[e]&&(rh[e]=!0,Gt(!1,r))}_.memo(Zv);function Zv({routes:e,manifest:t,future:r,state:n,isStatic:s,onError:i}){return Bv(e,void 0,{manifest:t,state:n,isStatic:s,onError:i})}function ex({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:s,static:i=!1,useTransitions:a}){Te(!Ci(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=_.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:a,future:{}}),[l,s,i,a]);typeof r=="string"&&(r=Ei(r));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:p="default",mask:w}=r,m=_.useMemo(()=>{let k=fr(u,l);return k==null?null:{location:{pathname:k,search:d,hash:h,state:f,key:p,mask:w},navigationType:n}},[l,u,d,h,f,p,n,w]);return Gt(m!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:_.createElement(wt.Provider,{value:c},_.createElement(So.Provider,{children:t,value:m}))}var ya="get",va="application/x-www-form-urlencoded";function jo(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function tx(e){return jo(e)&&e.tagName.toLowerCase()==="button"}function rx(e){return jo(e)&&e.tagName.toLowerCase()==="form"}function nx(e){return jo(e)&&e.tagName.toLowerCase()==="input"}function sx(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ix(e,t){return e.button===0&&(!t||t==="_self")&&!sx(e)}var Gi=null;function ax(){if(Gi===null)try{new FormData(document.createElement("form"),0),Gi=!1}catch{Gi=!0}return Gi}var ox=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ll(e){return e!=null&&!ox.has(e)?(Gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${va}"`),null):e}function lx(e,t){let r,n,s,i,a;if(rx(e)){let l=e.getAttribute("action");n=l?fr(l,t):null,r=e.getAttribute("method")||ya,s=ll(e.getAttribute("enctype"))||va,i=new FormData(e)}else if(tx(e)||nx(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(n=c?fr(c,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ya,s=ll(e.getAttribute("formenctype"))||ll(l.getAttribute("enctype"))||va,i=new FormData(l,e),!ax()){let{name:u,type:d,value:h}=e;if(d==="image"){let f=u?`${u}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else u&&i.append(u,h)}}else{if(jo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ya,n=null,s=va,a=e}return i&&s==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:s,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Tu(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Om(e,t,r,n){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${n}`:s.pathname=`${s.pathname}.${n}`:s.pathname==="/"?s.pathname=`_root.${n}`:t&&fr(s.pathname,t)==="/"?s.pathname=`${Va(t)}/_root.${n}`:s.pathname=`${Va(s.pathname)}.${n}`,s}async function cx(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ux(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function dx(e,t,r){let n=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let a=await cx(i,r);return a.links?a.links():[]}return[]}));return mx(n.flat(1).filter(ux).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function nh(e,t,r,n,s,i){let a=(c,u)=>r[u]?c.route.id!==r[u].route.id:!0,l=(c,u)=>{var d;return r[u].pathname!==c.pathname||((d=r[u].route.path)==null?void 0:d.endsWith("*"))&&r[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>a(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var h;let d=n.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(a(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function hx(e,t,{includeHydrateFallback:r}={}){return fx(e.map(n=>{let s=t.routes[n.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function fx(e){return[...new Set(e)]}function px(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function mx(e,t){let r=new Set;return new Set(t),e.reduce((n,s)=>{let i=JSON.stringify(px(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function Ru(){let e=_.useContext(us);return Tu(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gx(){let e=_.useContext(ko);return Tu(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Pu=_.createContext(void 0);Pu.displayName="FrameworkContext";function Eo(){let e=_.useContext(Pu);return Tu(e,"You must render this element inside a <HydratedRouter> element"),e}function yx(e,t){let r=_.useContext(Pu),[n,s]=_.useState(!1),[i,a]=_.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:h}=t,f=_.useRef(null);_.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let m=y=>{y.forEach(g=>{a(g.isIntersecting)})},k=new IntersectionObserver(m,{threshold:.5});return f.current&&k.observe(f.current),()=>{k.disconnect()}}},[e]),_.useEffect(()=>{if(n){let m=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(m)}}},[n]);let p=()=>{s(!0)},w=()=>{s(!1),a(!1)};return r?e!=="intent"?[i,f,{}]:[i,f,{onFocus:_s(l,p),onBlur:_s(c,w),onMouseEnter:_s(u,p),onMouseLeave:_s(d,w),onTouchStart:_s(h,p)}]:[!1,f,{}]}function _s(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function vx({page:e,...t}){let r=Pv(),{nonce:n}=Eo(),{router:s}=Ru(),i=_.useMemo(()=>mm(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&n&&(t={...t,nonce:n}),r?_.createElement(wx,{page:e,matches:i,...t}):_.createElement(bx,{page:e,matches:i,...t})):null}function xx(e){let{manifest:t,routeModules:r}=Eo(),[n,s]=_.useState([]);return _.useEffect(()=>{let i=!1;return dx(e,t,r).then(a=>{i||s(a)}),()=>{i=!0}},[e,t,r]),n}function wx({page:e,matches:t,...r}){let n=$t(),{future:s}=Eo(),{basename:i}=Ru(),a=_.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let l=Om(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,e,n,t]);return _.createElement(_.Fragment,null,a.map(l=>_.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function bx({page:e,matches:t,...r}){let n=$t(),{future:s,manifest:i,routeModules:a}=Eo(),{basename:l}=Ru(),{loaderData:c,matches:u}=gx(),d=_.useMemo(()=>nh(e,t,u,i,n,"data"),[e,t,u,i,n]),h=_.useMemo(()=>nh(e,t,u,i,n,"assets"),[e,t,u,i,n]),f=_.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let m=new Set,k=!1;if(t.forEach(g=>{var E;let x=i.routes[g.route.id];!x||!x.hasLoader||(!d.some(T=>T.route.id===g.route.id)&&g.route.id in c&&((E=a[g.route.id])!=null&&E.shouldRevalidate)||x.hasClientLoader?k=!0:m.add(g.route.id))}),m.size===0)return[];let y=Om(e,l,s.v8_trailingSlashAwareDataRequests,"data");return k&&m.size>0&&y.searchParams.set("_routes",t.filter(g=>m.has(g.route.id)).map(g=>g.route.id).join(",")),[y.pathname+y.search]},[l,s.v8_trailingSlashAwareDataRequests,c,n,i,d,t,e,a]),p=_.useMemo(()=>hx(h,i),[h,i]),w=xx(h);return _.createElement(_.Fragment,null,f.map(m=>_.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),p.map(m=>_.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),w.map(({key:m,link:k})=>_.createElement("link",{key:m,nonce:r.nonce,...k,crossOrigin:k.crossOrigin??r.crossOrigin})))}function _x(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var kx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{kx&&(window.__reactRouterVersion="7.18.1")}catch{}function Sx({basename:e,children:t,useTransitions:r,window:n}){let s=_.useRef();s.current==null&&(s.current=sv({window:n,v5Compat:!0}));let i=s.current,[a,l]=_.useState({action:i.action,location:i.location}),c=_.useCallback(u=>{r===!1?l(u):_.startTransition(()=>l(u))},[r]);return _.useLayoutEffect(()=>i.listen(c),[i,c]),_.createElement(ex,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,useTransitions:r})}var zm=_.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,mask:l,state:c,target:u,to:d,preventScrollReset:h,viewTransition:f,defaultShouldRevalidate:p,...w},m){let{basename:k,navigator:y,useTransitions:g}=_.useContext(wt),x=typeof d=="string"&&ju.test(d),E=km(d,k);d=E.to;let T=Fv(d,{relative:s}),S=$t(),A=null;if(l){let z=Eu(l,[],S.mask?S.mask.pathname:"/",!0);k!=="/"&&(z.pathname=z.pathname==="/"?k:Ot([k,z.pathname])),A=y.createHref(z)}let[R,b,v]=yx(n,w),C=Nx(d,{replace:a,mask:l,state:c,target:u,preventScrollReset:h,relative:s,viewTransition:f,defaultShouldRevalidate:p,useTransitions:g});function j(z){t&&t(z),z.defaultPrevented||C(z)}let N=!(E.isExternal||i),P=_.createElement("a",{...w,...v,href:(N?A:void 0)||E.absoluteURL||T,onClick:N?j:t,ref:_x(m,b),target:u,"data-discover":!x&&r==="render"?"true":void 0});return R&&!x?_.createElement(_.Fragment,null,P,_.createElement(vx,{page:T})):P});zm.displayName="Link";var jx=_.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:l,children:c,...u},d){let h=Ni(a,{relative:u.relative}),f=$t(),p=_.useContext(ko),{navigator:w,basename:m}=_.useContext(wt),k=p!=null&&Ox(h)&&l===!0,y=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,g=f.pathname,x=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;r||(g=g.toLowerCase(),x=x?x.toLowerCase():null,y=y.toLowerCase()),x&&m&&(x=fr(x,m)||x);const E=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let T=g===y||!s&&g.startsWith(y)&&g.charAt(E)==="/",S=x!=null&&(x===y||!s&&x.startsWith(y)&&x.charAt(y.length)==="/"),A={isActive:T,isPending:S,isTransitioning:k},R=T?t:void 0,b;typeof n=="function"?b=n(A):b=[n,T?"active":null,S?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let v=typeof i=="function"?i(A):i;return _.createElement(zm,{...u,"aria-current":R,className:b,ref:d,style:v,to:a,viewTransition:l},typeof c=="function"?c(A):c)});jx.displayName="NavLink";var Ex=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:s,state:i,method:a=ya,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f,...p},w)=>{let{useTransitions:m}=_.useContext(wt),k=Rx(),y=Px(l,{relative:u}),g=a.toLowerCase()==="get"?"get":"post",x=typeof l=="string"&&ju.test(l),E=T=>{if(c&&c(T),T.defaultPrevented)return;T.preventDefault();let S=T.nativeEvent.submitter,A=(S==null?void 0:S.getAttribute("formmethod"))||a,R=()=>k(S||T.currentTarget,{fetcherKey:t,method:A,navigate:r,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f});m&&r!==!1?_.startTransition(()=>R()):R()};return _.createElement("form",{ref:w,method:g,action:y,onSubmit:n?c:E,...p,"data-discover":!x&&e==="render"?"true":void 0})});Ex.displayName="Form";function Cx(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Im(e){let t=_.useContext(us);return Te(t,Cx(e)),t}function Nx(e,{target:t,replace:r,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:l,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Tm(),h=$t(),f=Ni(e,{relative:a});return _.useCallback(p=>{if(ix(p,t)){p.preventDefault();let w=r!==void 0?r:ui(h)===ui(f),m=()=>d(e,{replace:w,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:l,defaultShouldRevalidate:c});u?_.startTransition(()=>m()):m()}},[h,d,f,r,n,s,t,e,i,a,l,c,u])}var Ax=0,Tx=()=>`__${String(++Ax)}__`;function Rx(){let{router:e}=Im("useSubmit"),{basename:t}=_.useContext(wt),r=Yv(),n=e.fetch,s=e.navigate;return _.useCallback(async(i,a={})=>{let{action:l,method:c,encType:u,formData:d,body:h}=lx(i,t);if(a.navigate===!1){let f=a.fetcherKey||Tx();await n(f,r,a.action||l,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||c,formEncType:a.encType||u,flushSync:a.flushSync})}else await s(a.action||l,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||c,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,s,t,r])}function Px(e,{relative:t}={}){let{basename:r}=_.useContext(wt),n=_.useContext(gr);Te(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...Ni(e||".",{relative:t})},a=$t();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(h=>h).forEach(h=>l.append("index",h));let d=l.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Ot([r,i.pathname])),ui(i)}function Ox(e,{relative:t}={}){let r=_.useContext(Em);Te(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Im("useViewTransitionState"),s=Ni(e,{relative:t});if(!r.isTransitioning)return!1;let i=fr(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=fr(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Wa(s.pathname,a)!=null||Wa(s.pathname,i)!=null}const zx="modulepreload",Ix=function(e){return"/"+e},sh={},yn=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=Ix(c),c in sh)return;sh[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":zx,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $x=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$m=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var Dx={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.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lx=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...l},c)=>_.createElement("svg",{ref:c,...Dx,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:$m("lucide",s),...l},[...a.map(([u,d])=>_.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const K=(e,t)=>{const r=_.forwardRef(({className:n,...s},i)=>_.createElement(Lx,{ref:i,iconNode:t,className:$m(`lucide-${$x(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fx=K("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ux=K("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/**
 * @license lucide-react v0.383.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=K("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ai=K("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bx=K("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sn=K("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dm=K("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lm=K("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ou=K("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const is=K("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hn=K("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zu=K("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fm=K("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Um=K("FileText",[["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"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mc=K("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ih=K("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mx=K("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hx=K("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fn=K("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Co=K("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qx=K("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wx=K("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const It=K("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ah=K("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vx=K("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jt=K("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kx=K("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gx=K("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jx=K("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const di=K("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Iu=K("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bm=K("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yx=K("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const No=K("RefreshCw",[["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"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const as=K("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qx=K("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xx=K("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hs=K("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.383.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=K("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ka=K("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mm=K("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zx=K("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hm=K("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ga=K("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.383.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=K("TriangleAlert",[["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"}]]);/**
 * @license lucide-react v0.383.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=K("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ja=K("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qm=K("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xt=K("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.383.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wm=K("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var Vm={exports:{}};/* @license
Papa Parse
v5.5.4
https://github.com/mholt/PapaParse
License: MIT
*/(function(e,t){((r,n)=>{e.exports=n()})(Ag,function r(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},s,i=!n.document&&!!n.postMessage,a=n.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(b){return b.charCodeAt(0)===65279?b.slice(1):b}function h(b){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(v){var C=S(v);C.chunkSize=parseInt(C.chunkSize),v.step||v.chunk||(C.chunkSize=null),this._handle=new k(C),(this._handle.streamer=this)._config=C}).call(this,b),this.parseChunk=function(v,C){var j=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<j){let P=this._config.newline;P||(N=this._config.quoteChar||'"',P=this._handle.guessLineEndings(v,N)),v=[...v.split(P).slice(j)].join(P)}this.isFirstChunk&&R(this._config.beforeFirstChunk)&&(N=this._config.beforeFirstChunk(v))!==void 0&&(v=N),this.isFirstChunk=!1,this._halted=!1;var j=this._partialLine+v,N=(this._partialLine="",this._handle.parse(j,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(v=N.meta.cursor,j=(this._finished||(this._partialLine=j.substring(v-this._baseIndex),this._baseIndex=v),N&&N.data&&(this._rowCount+=N.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),a)n.postMessage({results:N,workerId:u.WORKER_ID,finished:j});else if(R(this._config.chunk)&&!C){if(this._config.chunk(N,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=N=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(N.data),this._completeResults.errors=this._completeResults.errors.concat(N.errors),this._completeResults.meta=N.meta),this._completed||!j||!R(this._config.complete)||N&&N.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),j||N&&N.meta.paused||this._nextChunk(),N}this._halted=!0},this._sendError=function(v){R(this._config.error)?this._config.error(v):a&&this._config.error&&n.postMessage({workerId:u.WORKER_ID,error:v,finished:!1})}}function f(b){var v;(b=b||{}).chunkSize||(b.chunkSize=u.RemoteChunkSize),h.call(this,b),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(C){this._input=C,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(v=new XMLHttpRequest,this._config.withCredentials&&(v.withCredentials=this._config.withCredentials),i||(v.onload=A(this._chunkLoaded,this),v.onerror=A(this._chunkError,this)),v.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var C,j=this._config.downloadRequestHeaders;for(C in j)v.setRequestHeader(C,j[C])}var N;this._config.chunkSize&&(N=this._start+this._config.chunkSize-1,v.setRequestHeader("Range","bytes="+this._start+"-"+N));try{v.send(this._config.downloadRequestBody)}catch(P){this._chunkError(P.message)}i&&v.status===0&&this._chunkError()}},this._chunkLoaded=function(){v.readyState===4&&(v.status<200||400<=v.status?this._chunkError():(this._start+=this._config.chunkSize||v.responseText.length,this._finished=!this._config.chunkSize||this._start>=(C=>(C=C.getResponseHeader("Content-Range"))!==null?parseInt(C.substring(C.lastIndexOf("/")+1)):-1)(v),this.parseChunk(v.responseText)))},this._chunkError=function(C){C=v.statusText||C,this._sendError(new Error(C))}}function p(b){(b=b||{}).chunkSize||(b.chunkSize=u.LocalChunkSize),h.call(this,b);var v,C,j=typeof FileReader<"u";this.stream=function(N){this._input=N,C=N.slice||N.webkitSlice||N.mozSlice,j?((v=new FileReader).onload=A(this._chunkLoaded,this),v.onerror=A(this._chunkError,this)):v=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var N=this._input,P=(this._config.chunkSize&&(P=Math.min(this._start+this._config.chunkSize,this._input.size),N=C.call(N,this._start,P)),v.readAsText(N,this._config.encoding));j||this._chunkLoaded({target:{result:P}})},this._chunkLoaded=function(N){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(N.target.result)},this._chunkError=function(){this._sendError(v.error)}}function w(b){var v;h.call(this,b=b||{}),this.stream=function(C){return v=C,this._nextChunk()},this._nextChunk=function(){var C,j;if(!this._finished)return C=this._config.chunkSize,v=C?(j=v.substring(0,C),v.substring(C)):(j=v,""),this._finished=!v,this.parseChunk(j)}}function m(b){h.call(this,b=b||{});var v=[],C=!0,j=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(N){this._input=N,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){j&&v.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),v.length?this.parseChunk(v.shift()):C=!0},this._streamData=A(function(N){try{v.push(typeof N=="string"?N:N.toString(this._config.encoding)),C&&(C=!1,this._checkIsFinished(),this.parseChunk(v.shift()))}catch(P){this._streamError(P)}},this),this._streamError=A(function(N){this._streamCleanUp(),this._sendError(N)},this),this._streamEnd=A(function(){this._streamCleanUp(),j=!0,this._streamData("")},this),this._streamCleanUp=A(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function k(b){var v,C,j,N,P=Math.pow(2,53),z=-P,W=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,V=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,O=this,U=0,L=0,G=!1,B=!1,I=[],D={data:[],errors:[],meta:{}};function xe(ee){return b.skipEmptyLines==="greedy"?ee.join("").trim()==="":ee.length===1&&ee[0].length===0}function re(){if(D&&j&&(bt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),j=!1),b.skipEmptyLines&&(D.data=D.data.filter(function(J){return!xe(J)})),ue()){let J=function(fe,Ce){fe=d(fe),R(b.transformHeader)&&(fe=b.transformHeader(fe,Ce)),I.push(fe)};if(D)if(Array.isArray(D.data[0])){for(var ee=0;ue()&&ee<D.data.length;ee++)D.data[ee].forEach(J);D.data.splice(0,1)}else D.data.forEach(J)}function X(J,fe){for(var Ce=b.header?{}:[],ie=0;ie<J.length;ie++){var ae=ie,Z=J[ie],Z=((_t,Y)=>(me=>(b.dynamicTypingFunction&&b.dynamicTyping[me]===void 0&&(b.dynamicTyping[me]=b.dynamicTypingFunction(me)),(b.dynamicTyping[me]||b.dynamicTyping)===!0))(_t)?Y==="true"||Y==="TRUE"||Y!=="false"&&Y!=="FALSE"&&((me=>{if(W.test(me)&&(me=parseFloat(me),z<me&&me<P))return 1})(Y)?parseFloat(Y):V.test(Y)?new Date(Y):Y===""?null:Y):Y)(ae=b.header?ie>=I.length?"__parsed_extra":I[ie]:ae,Z=b.transform?b.transform(Z,ae):Z);ae==="__parsed_extra"?(Ce[ae]=Ce[ae]||[],Ce[ae].push(Z)):Ce[ae]=Z}return b.header&&(ie>I.length?bt("FieldMismatch","TooManyFields","Too many fields: expected "+I.length+" fields but parsed "+ie,L+fe):ie<I.length&&bt("FieldMismatch","TooFewFields","Too few fields: expected "+I.length+" fields but parsed "+ie,L+fe)),Ce}var we;D&&(b.header||b.dynamicTyping||b.transform)&&(we=1,!D.data.length||Array.isArray(D.data[0])?(D.data=D.data.map(X),we=D.data.length):D.data=X(D.data,0),b.header&&D.meta&&(D.meta.fields=I),L+=we)}function ue(){return b.header&&I.length===0}function bt(ee,X,we,J){ee={type:ee,code:X,message:we},J!==void 0&&(ee.row=J),D.errors.push(ee)}R(b.step)&&(N=b.step,b.step=function(ee){D=ee,ue()?re():(re(),D.data.length!==0&&(U+=ee.data.length,b.preview&&U>b.preview?C.abort():(D.data=D.data[0],N(D,O))))}),this.parse=function(ee,X,we){var J=b.quoteChar||'"',J=(b.newline||(b.newline=this.guessLineEndings(ee,J)),j=!1,b.delimiter?R(b.delimiter)&&(b.delimiter=b.delimiter(ee),D.meta.delimiter=b.delimiter):((J=((fe,Ce,ie,ae,Z)=>{var _t,Y,me,yr;Z=Z||[",","	","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var xn=0;xn<Z.length;xn++){for(var Dt,hs=Z[xn],Ue=0,Lt=0,Pe=0,Ye=(me=void 0,new g({comments:ae,delimiter:hs,newline:Ce,preview:10}).parse(fe)),Qt=0;Qt<Ye.data.length;Qt++)ie&&xe(Ye.data[Qt])?Pe++:(Dt=Ye.data[Qt].length,Lt+=Dt,me===void 0?me=Dt:0<Dt&&(Ue+=Math.abs(Dt-me),me=Dt));0<Ye.data.length&&(Lt/=Ye.data.length-Pe),(Y===void 0||Ue<=Y)&&(yr===void 0||yr<Lt)&&1.99<Lt&&(Y=Ue,_t=hs,yr=Lt)}return{successful:!!(b.delimiter=_t),bestDelimiter:_t}})(ee,b.newline,b.skipEmptyLines,b.comments,b.delimitersToGuess)).successful?b.delimiter=J.bestDelimiter:(j=!0,b.delimiter=u.DefaultDelimiter),D.meta.delimiter=b.delimiter),S(b));return b.preview&&b.header&&J.preview++,v=ee,C=new g(J),D=C.parse(v,X,we),re(),G?{meta:{paused:!0}}:D||{meta:{paused:!1}}},this.paused=function(){return G},this.pause=function(){G=!0,C.abort(),v=R(b.chunk)?"":v.substring(C.getCharIndex())},this.resume=function(){O.streamer._halted?(G=!1,O.streamer.parseChunk(v,!0)):setTimeout(O.resume,3)},this.aborted=function(){return B},this.abort=function(){B=!0,C.abort(),D.meta.aborted=!0,R(b.complete)&&b.complete(D),v=""},this.guessLineEndings=function(fe,J){fe=fe.substring(0,1048576);var J=new RegExp(y(J)+"([^]*?)"+y(J),"gm"),we=(fe=fe.replace(J,"")).split("\r"),J=fe.split(`
`),fe=1<J.length&&J[0].length<we[0].length;if(we.length===1||fe)return`
`;for(var Ce=0,ie=0;ie<we.length;ie++)we[ie][0]===`
`&&Ce++;return Ce>=we.length/2?`\r
`:"\r"}}function y(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(b){var v=(b=b||{}).delimiter,C=b.newline,j=b.comments,N=b.step,P=b.preview,z=b.fastMode,W=null,V=!1,O=b.quoteChar==null?'"':b.quoteChar,U=O;if(b.escapeChar!==void 0&&(U=b.escapeChar),(typeof v!="string"||-1<u.BAD_DELIMITERS.indexOf(v))&&(v=","),j===v)throw new Error("Comment character same as delimiter");j===!0?j="#":(typeof j!="string"||-1<u.BAD_DELIMITERS.indexOf(j))&&(j=!1),C!==`
`&&C!=="\r"&&C!==`\r
`&&(C=`
`);var L=0,G=!1;this.parse=function(B,I,D){if(typeof B!="string")throw new Error("Input must be a string");var xe=B.length,re=v.length,ue=C.length,bt=j.length,ee=R(N),X=[],we=[],J=[],fe=L=0;if(!B)return Ue();if(z||z!==!1&&B.indexOf(O)===-1){for(var Ce=B.split(C),ie=0;ie<Ce.length;ie++){if(J=Ce[ie],L+=J.length,ie!==Ce.length-1)L+=C.length;else if(D)return Ue();if(!j||J.substring(0,bt)!==j){if(ee){if(X=[],yr(J.split(v)),Lt(),G)return Ue()}else yr(J.split(v));if(P&&P<=ie)return X=X.slice(0,P),Ue(!0)}}return Ue()}for(var ae=B.indexOf(v,L),Z=B.indexOf(C,L),_t=new RegExp(y(U)+y(O),"g"),Y=B.indexOf(O,L);;)if(B[L]===O)for(Y=L,L++;;){if((Y=B.indexOf(O,Y+1))===-1)return D||we.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:L}),Dt();if(Y===xe-1)return Dt(B.substring(L,Y).replace(_t,O));if(O===U&&B[Y+1]===U)Y++;else if(O===U||Y===0||B[Y-1]!==U){ae!==-1&&ae<Y+1&&(ae=B.indexOf(v,Y+1));var me=xn((Z=Z!==-1&&Z<Y+1?B.indexOf(C,Y+1):Z)===-1?ae:Math.min(ae,Z));if(B.substr(Y+1+me,re)===v){J.push(B.substring(L,Y).replace(_t,O)),B[L=Y+1+me+re]!==O&&(Y=B.indexOf(O,L)),ae=B.indexOf(v,L),Z=B.indexOf(C,L);break}if(me=xn(Z),B.substring(Y+1+me,Y+1+me+ue)===C){if(J.push(B.substring(L,Y).replace(_t,O)),hs(Y+1+me+ue),ae=B.indexOf(v,L),Y=B.indexOf(O,L),ee&&(Lt(),G))return Ue();if(P&&X.length>=P)return Ue(!0);break}we.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:L}),Y++}}else if(j&&J.length===0&&B.substring(L,L+bt)===j){if(Z===-1)return Ue();L=Z+ue,Z=B.indexOf(C,L),ae=B.indexOf(v,L)}else if(ae!==-1&&(ae<Z||Z===-1))J.push(B.substring(L,ae)),L=ae+re,ae=B.indexOf(v,L);else{if(Z===-1)break;if(J.push(B.substring(L,Z)),hs(Z+ue),ee&&(Lt(),G))return Ue();if(P&&X.length>=P)return Ue(!0)}return Dt();function yr(Pe){X.push(Pe),fe=L}function xn(Pe){var Ye=0;return Ye=Pe!==-1&&(Pe=B.substring(Y+1,Pe))&&Pe.trim()===""?Pe.length:Ye}function Dt(Pe){return D||(Pe===void 0&&(Pe=B.substring(L)),J.push(Pe),L=xe,yr(J),ee&&Lt()),Ue()}function hs(Pe){L=Pe,yr(J),J=[],Z=B.indexOf(C,L)}function Ue(Pe){if(b.header&&!I&&X.length&&!V){var Ye=X[0],Qt=Object.create(null),Oo=new Set(Ye);let Uu=!1;for(let wn=0;wn<Ye.length;wn++){let Ft=d(Ye[wn]);if(Qt[Ft=R(b.transformHeader)?b.transformHeader(Ft,wn):Ft]){let fs,Bu=Qt[Ft];for(;fs=Ft+"_"+Bu,Bu++,Oo.has(fs););Oo.add(fs),Ye[wn]=fs,Qt[Ft]++,Uu=!0,(W=W===null?{}:W)[fs]=Ft}else Qt[Ft]=1,Ye[wn]=Ft;Oo.add(Ft)}Uu&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:X,errors:we,meta:{delimiter:v,linebreak:C,aborted:G,truncated:!!Pe,cursor:fe+(I||0),renamedHeaders:W}}}function Lt(){N(Ue()),X=[],we=[]}},this.abort=function(){G=!0},this.getCharIndex=function(){return L}}function x(b){var v=b.data,C=l[v.workerId],j=!1;if(v.error)C.userError(v.error,v.file);else if(v.results&&v.results.data){var N={abort:function(){j=!0,E(v.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(R(C.userStep)){for(var P=0;P<v.results.data.length&&(C.userStep({data:v.results.data[P],errors:v.results.errors,meta:v.results.meta},N),!j);P++);delete v.results}else R(C.userChunk)&&(C.userChunk(v.results,N,v.file),delete v.results)}v.finished&&!j&&E(v.workerId,v.results)}function E(b,v){var C=l[b];R(C.userComplete)&&C.userComplete(v),C.terminate(),delete l[b]}function T(){throw new Error("Not implemented.")}function S(b){if(typeof b!="object"||b===null)return b;var v,C=Array.isArray(b)?[]:{};for(v in b)C[v]=S(b[v]);return C}function A(b,v){return function(){b.apply(v,arguments)}}function R(b){return typeof b=="function"}return u.parse=function(b,v){var C=(v=v||{}).dynamicTyping||!1;if(R(C)&&(v.dynamicTypingFunction=C,C={}),v.dynamicTyping=C,v.transform=!!R(v.transform)&&v.transform,!v.worker||!u.WORKERS_SUPPORTED)return C=null,u.NODE_STREAM_INPUT,typeof b=="string"?(b=d(b),C=new(v.download?f:w)(v)):b.readable===!0&&R(b.read)&&R(b.on)?C=new m(v):(n.File&&b instanceof File||b instanceof Object)&&(C=new p(v)),C.stream(b);(C=(()=>{var j;return!!u.WORKERS_SUPPORTED&&(j=(()=>{var N=n.URL||n.webkitURL||null,P=r.toString();return u.BLOB_URL||(u.BLOB_URL=N.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",P,")();"],{type:"text/javascript"})))})(),(j=new n.Worker(j)).onmessage=x,j.id=c++,l[j.id]=j)})()).userStep=v.step,C.userChunk=v.chunk,C.userComplete=v.complete,C.userError=v.error,v.step=R(v.step),v.chunk=R(v.chunk),v.complete=R(v.complete),v.error=R(v.error),delete v.worker,C.postMessage({input:b,config:v,workerId:C.id})},u.unparse=function(b,v){var C=!1,j=!0,N=",",P=`\r
`,z='"',W=z+z,V=!1,O=null,U=!1,L=((()=>{if(typeof v=="object"){if(typeof v.delimiter!="string"||u.BAD_DELIMITERS.filter(function(I){return v.delimiter.indexOf(I)!==-1}).length||(N=v.delimiter),typeof v.quotes!="boolean"&&typeof v.quotes!="function"&&!Array.isArray(v.quotes)||(C=v.quotes),typeof v.skipEmptyLines!="boolean"&&typeof v.skipEmptyLines!="string"||(V=v.skipEmptyLines),typeof v.newline=="string"&&(P=v.newline),typeof v.quoteChar=="string"&&(z=v.quoteChar,W=z+z),typeof v.header=="boolean"&&(j=v.header),Array.isArray(v.columns)){if(v.columns.length===0)throw new Error("Option columns is empty");O=v.columns}v.escapeChar!==void 0&&(W=v.escapeChar+z),v.escapeFormulae instanceof RegExp?U=v.escapeFormulae:typeof v.escapeFormulae=="boolean"&&v.escapeFormulae&&(U=/^[=+\-@\t\r].*$/)}})(),new RegExp(y(z),"g"));if(typeof b=="string"&&(b=JSON.parse(b)),Array.isArray(b)){if(!b.length||Array.isArray(b[0]))return G(null,b,V);if(typeof b[0]=="object")return G(O||Object.keys(b[0]),b,V)}else if(typeof b=="object")return typeof b.data=="string"&&(b.data=JSON.parse(b.data)),Array.isArray(b.data)&&(b.fields||(b.fields=b.meta&&b.meta.fields||O),b.fields||(b.fields=Array.isArray(b.data[0])?b.fields:typeof b.data[0]=="object"?Object.keys(b.data[0]):[]),Array.isArray(b.data[0])||typeof b.data[0]=="object"||(b.data=[b.data])),G(b.fields||[],b.data||[],V);throw new Error("Unable to serialize unrecognized input");function G(I,D,xe){var re="",ue=(typeof I=="string"&&(I=JSON.parse(I)),typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(I)&&0<I.length),bt=!Array.isArray(D[0]);if(ue&&j){for(var ee=0;ee<I.length;ee++)0<ee&&(re+=N),re+=B(I[ee],ee);0<D.length&&(re+=P)}for(var X=0;X<D.length;X++){var we=(ue?I:D[X]).length,J=!1,fe=ue?Object.keys(D[X]).length===0:D[X].length===0;if(xe&&!ue&&(J=xe==="greedy"?D[X].join("").trim()==="":D[X].length===1&&D[X][0].length===0),xe==="greedy"&&ue){for(var Ce=[],ie=0;ie<we;ie++){var ae=bt?I[ie]:ie;Ce.push(D[X][ae])}J=Ce.join("").trim()===""}if(!J){for(var Z=0;Z<we;Z++){0<Z&&!fe&&(re+=N);var _t=ue&&bt?I[Z]:Z;re+=B(D[X][_t],Z)}X<D.length-1&&(!xe||0<we&&!fe)&&(re+=P)}}return re}function B(I,D){var xe,re,ue;return I==null?"":I.constructor===Date?JSON.stringify(I).slice(1,25):(ue=!1,U&&typeof I=="string"&&U.test(I)&&(I="'"+I,ue=!0),re=(xe=I.toString()).replace(L,W),(ue=ue||C===!0||typeof C=="function"&&C(I,D)||Array.isArray(C)&&C[D]||((bt,ee)=>{for(var X=0;X<ee.length;X++)if(-1<bt.indexOf(ee[X]))return!0;return!1})(re,u.BAD_DELIMITERS)||-1<re.indexOf(N)||-1<xe.indexOf(z)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?z+re+z:re)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!n.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=g,u.ParserHandle=k,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=w,u.ReadableStreamStreamer=m,n.jQuery&&((s=n.jQuery).fn.parse=function(b){var v=b.config||{},C=[];return this.each(function(P){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var z=0;z<this.files.length;z++)C.push({file:this.files[z],inputElem:this,instanceConfig:s.extend({},v)})}),j(),this;function j(){if(C.length===0)R(b.complete)&&b.complete();else{var P,z,W,V,O=C[0];if(R(b.before)){var U=b.before(O.file,O.inputElem);if(typeof U=="object"){if(U.action==="abort")return P="AbortError",z=O.file,W=O.inputElem,V=U.reason,void(R(b.error)&&b.error({name:P},z,W,V));if(U.action==="skip")return void N();typeof U.config=="object"&&(O.instanceConfig=s.extend(O.instanceConfig,U.config))}else if(U==="skip")return void N()}var L=O.instanceConfig.complete;O.instanceConfig.complete=function(G){R(L)&&L(G,O.file,O.inputElem),N()},u.parse(O.file,O.instanceConfig)}}function N(){C.splice(0,1),j()}}),a&&(n.onmessage=function(b){b=b.data,u.WORKER_ID===void 0&&b&&(u.WORKER_ID=b.workerId),typeof b.input=="string"?n.postMessage({workerId:u.WORKER_ID,results:u.parse(b.input,b.config),finished:!0}):(n.File&&b.input instanceof File||b.input instanceof Object)&&(b=u.parse(b.input,b.config))&&n.postMessage({workerId:u.WORKER_ID,results:b,finished:!0})}),(f.prototype=Object.create(h.prototype)).constructor=f,(p.prototype=Object.create(h.prototype)).constructor=p,(w.prototype=Object.create(w.prototype)).constructor=w,(m.prototype=Object.create(h.prototype)).constructor=m,u})})(Vm);var ew=Vm.exports;const tw=ef(ew);function Ao(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function rw(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(d){try{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}const nw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class $u extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class sw extends $u{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class oh extends $u{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class lh extends $u{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var gc;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(gc||(gc={}));class iw{constructor(t,{headers:r={},customFetch:n,region:s=gc.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=nw(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return rw(this,arguments,void 0,function*(r,n={}){var s;let i,a;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=n;let f={},{region:p}=n;p||(p=this.region);const w=new URL(`${this.url}/${r}`);p&&p!=="any"&&(f["x-region"]=p,w.searchParams.set("forceFunctionRegion",p));let m;const k=!!l&&Object.keys(l).some(S=>S.toLowerCase()==="content-type");u&&!k?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",m=u):typeof u=="string"?(f["Content-Type"]="text/plain",m=u):typeof FormData<"u"&&u instanceof FormData?m=u:(f["Content-Type"]="application/json",m=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?m=JSON.stringify(u):m=u;let y=d;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),d?(y=a.signal,d.addEventListener("abort",()=>a.abort())):y=a.signal);const g=yield this.fetch(w.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),l),body:m,signal:y}).catch(S=>{throw new sw(S)}),x=g.headers.get("x-relay-error");if(x&&x==="true")throw new oh(g);if(!g.ok)throw new lh(g);let E=((s=g.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),T;return E==="application/json"?T=yield g.json():E==="application/octet-stream"||E==="application/pdf"?T=yield g.blob():E==="text/event-stream"?T=g:E==="multipart/form-data"?T=yield g.formData():T=yield g.text(),{data:T,error:null,response:g}}catch(l){return{data:null,error:l,response:l instanceof lh||l instanceof oh?l.context:void 0}}finally{i&&clearTimeout(i)}})}}const Km=3,ch=e=>Math.min(1e3*2**e,3e4),aw=[520,503],Gm=["GET","HEAD","OPTIONS"];var uh=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function dh(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",s),r()},e);function s(){clearTimeout(n),r()}t==null||t.addEventListener("abort",s)})}function ow(e,t,r,n){return!(!n||r>=Km||!Gm.includes(e)||!aw.includes(t))}var lw=class{constructor(e){var t,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.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(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=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 a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const u={};r.headers.forEach((h,f)=>{u[f]=h}),a>0&&(u["X-Retry-Count"]=String(a));let d;try{d=await n(r.url.toString(),{method:r.method,headers:u,body:JSON.stringify(r.body,(h,f)=>typeof f=="bigint"?f.toString():f),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Gm.includes(r.method))throw h;if(r.retryEnabled&&a<Km){const f=ch(a);a++,await dh(f,r.signal);continue}throw h}if(ow(r.method,d.status,a,r.retryEnabled)){var l,c;const h=(l=(c=d.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:ch(a);await d.text(),a++,await dh(f,r.signal);continue}return await r.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var l;let c="",u="",d="";const h=a==null?void 0:a.cause;if(h){var f,p,w,m;const g=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",x=(p=h==null?void 0:h.code)!==null&&p!==void 0?p:"";c=`${(w=a==null?void 0:a.name)!==null&&w!==void 0?w:"FetchError"}: ${a==null?void 0:a.message}`,c+=`

Caused by: ${(m=h==null?void 0:h.name)!==null&&m!==void 0?m:"Error"}: ${g}`,x&&(c+=` (${x})`),h!=null&&h.stack&&(c+=`
${h.stack}`)}else{var k;c=(k=a==null?void 0:a.stack)!==null&&k!==void 0?k:""}const y=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(d="",u="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${y} 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.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",u="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(u+=`. Your request URL is ${y} 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:`${(l=a==null?void 0:a.name)!==null&&l!==void 0?l:"FetchError"}: ${a==null?void 0:a.message}`,details:c,hint:u,code:d},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let r=null,n=null,s=null,i=e.status,a=e.statusText;if(e.ok){var l,c;if(t.method!=="HEAD"){var u;const f=await e.text();if(f!=="")if(t.headers.get("Accept")==="text/csv")n=f;else if(t.headers.get("Accept")&&(!((u=t.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text")))n=f;else try{n=JSON.parse(f)}catch{if(r={message:f},n=null,t.shouldThrowOnError)throw new uh({message:f,details:"",hint:"",code:""})}}const d=(l=t.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),h=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");d&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const d=await e.text();try{r=JSON.parse(d),Array.isArray(r)&&e.status===404&&(n=[],r=null,i=200,a="OK")}catch{e.status===404&&d===""?(i=204,a="No Content"):r={message:d}}if(r&&t.shouldThrowOnError)throw new uh(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},cw=class extends lw{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var a;const l=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const hh=new RegExp("[,()]");var Cn=class extends cw{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&hh.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&hh.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},uw=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:n}=t??{},s=r?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",a),n&&c.append("Prefer",`count=${n}`),new Cn({method:s,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),r||a.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);i.searchParams.set("columns",c.join(","))}}return new Cn({method:s,url:i,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const a="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);l.searchParams.set("columns",d.join(","))}}return new Cn({method:a,url:l,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Cn({method:n,url:s,headers:i,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Cn({method:r,url:n,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function hi(e){"@babel/helpers - typeof";return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hi(e)}function dw(e,t){if(hi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hw(e){var t=dw(e,"string");return hi(t)=="symbol"?t:t+""}function fw(e,t,r){return(t=hw(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ji(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fh(Object(r),!0).forEach(function(n){fw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var pw=class Jm{constructor(t,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:a=8e3,retry:l}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=a;const c=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(u,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),i),p=d==null?void 0:d.signal;if(p){if(p.aborted)return clearTimeout(f),c(u,d);const w=()=>{clearTimeout(f),h.abort()};return p.addEventListener("abort",w,{once:!0}),c(u,Ji(Ji({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",w)})}return c(u,Ji(Ji({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=c,this.retry=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new uw(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new Jm(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:n=!1,get:s=!1,count:i}={}){var a;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),h=n&&Object.values(r).some(d);h?(l="POST",u=r):n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([p,w])=>w!==void 0).map(([p,w])=>[p,Array.isArray(w)?`{${w.join(",")}}`:`${w}`]).forEach(([p,w])=>{c.searchParams.append(p,w)})):(l="POST",u=r);const f=new Headers(this.headers);return h?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new Cn({method:l,url:c,headers:f,schema:this.schemaName,body:u,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class mw{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.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"&&r.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.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 t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`

Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const gw="2.110.2",yw=`realtime-js/${gw}`,vw="1.0.0",Ym="2.0.0",xw=Ym,ww=1e4,bw=100,Sr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Qm={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},yc={connecting:"connecting",closing:"closing",closed:"closed"};class _w{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,r,n){var s,i;const a=t.topic,l=(s=t.ref)!==null&&s!==void 0?s:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+a.length+u.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let w=new DataView(p),m=0;w.setUint8(m++,this.KINDS.userBroadcastPush),w.setUint8(m++,c.length),w.setUint8(m++,l.length),w.setUint8(m++,a.length),w.setUint8(m++,u.length),w.setUint8(m++,h.length),w.setUint8(m++,r),Array.from(c,y=>w.setUint8(m++,y.charCodeAt(0))),Array.from(l,y=>w.setUint8(m++,y.charCodeAt(0))),Array.from(a,y=>w.setUint8(m++,y.charCodeAt(0))),Array.from(u,y=>w.setUint8(m++,y.charCodeAt(0))),Array.from(h,y=>w.setUint8(m++,y.charCodeAt(0)));var k=new Uint8Array(p.byteLength+n.byteLength);return k.set(new Uint8Array(p),0),k.set(new Uint8Array(n),p.byteLength),k.buffer}decode(t,r){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return r(n)}if(typeof t=="string"){const n=JSON.parse(t),[s,i,a,l,c]=n;return r({join_ref:s,ref:i,topic:a,event:l,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,s)}}_decodeUserBroadcast(t,r,n){const s=r.getUint8(1),i=r.getUint8(2),a=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(t.slice(c,c+s));c=c+s;const d=n.decode(t.slice(c,c+i));c=c+i;const h=n.decode(t.slice(c,c+a));c=c+a;const f=t.slice(c,t.byteLength),p=l===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,w={type:this.BROADCAST_EVENT,event:d,payload:p};return a>0&&(w.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:w}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>r.includes(n)))}}var oe;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(oe||(oe={}));const ph=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,a)=>(i[a]=kw(a,e,t,s),i),{}):{}},kw=(e,t,r,n)=>{const s=t.find(l=>l.name===e),i=s==null?void 0:s.type,a=r[e];return i&&!n.includes(i)?Xm(i,a):vc(a)},Xm=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Cw(t,r)}switch(e){case oe.bool:return Sw(t);case oe.float4:case oe.float8:case oe.int2:case oe.int4:case oe.int8:case oe.numeric:case oe.oid:return jw(t);case oe.json:case oe.jsonb:return Ew(t);case oe.timestamp:return Nw(t);case oe.abstime:case oe.date:case oe.daterange:case oe.int4range:case oe.int8range:case oe.money:case oe.reltime:case oe.text:case oe.time:case oe.timestamptz:case oe.timetz:case oe.tsrange:case oe.tstzrange:return vc(t);default:return vc(t)}},vc=e=>e,Sw=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},jw=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Ew=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Cw=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let i;const a=e.slice(1,r);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(l=>Xm(t,l))}return e},Nw=e=>typeof e=="string"?e.replace(" ","T"):e,Zm=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var qs=e=>typeof e=="function"?e:function(){return e},Aw=typeof self<"u"?self:null,Nn=typeof window<"u"?window:null,Ht=Aw||Nn||globalThis,Tw="2.0.0",Rw=1e4,Pw=1e3,qt={connecting:0,open:1,closing:2,closed:3},Qe={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},er={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},xc={longpoll:"longpoll",websocket:"websocket"},Ow={complete:4},wc="base64url.bearer.phx.",Yi=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,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(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}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,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},eg=class{constructor(e,t){this.callback=e,this.timerCalc=t,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))}},zw=class{constructor(e,t,r){this.state=Qe.closed,this.topic=e,this.params=qs(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Yi(this,er.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new eg(()=>{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=Qe.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Qe.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Qe.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Qe.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 Yi(this,er.leave,qs({}),this.timeout).send(),this.state=Qe.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(er.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=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=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Qe.closed,this.bindings=[]}onClose(e){this.on(er.close,e)}onError(e){return this.on(er.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Yi(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Qe.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(er.close,"leave")},r=new Yi(this,er.leave,qs({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Qe.joining,this.joinPush.resend(e))}trigger(e,t,r,n){let s=this.onMessage(e,t,r,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,r));for(let a=0;a<i.length;a++)i[a].callback(s,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Qe.closed}isErrored(){return this.state===Qe.errored}isJoined(){return this.state===Qe.joined}isJoining(){return this.state===Qe.joining}isLeaving(){return this.state===Qe.leaving}},Ya=class{static request(e,t,r,n,s,i,a){if(Ht.XDomainRequest){let l=new Ht.XDomainRequest;return this.xdomainRequest(l,e,t,n,s,i,a)}else if(Ht.XMLHttpRequest){let l=new Ht.XMLHttpRequest;return this.xhrRequest(l,e,t,r,n,s,i,a)}else{if(Ht.fetch&&Ht.AbortController)return this.fetchRequest(e,t,r,n,s,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,n,s,i,a){let l={method:e,headers:r,body:n},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),l.signal=c.signal),Ht.fetch(t,l).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>a&&a(u)).catch(u=>{u.name==="AbortError"&&i?i():a&&a(null)}),c}static xdomainRequest(e,t,r,n,s,i,a){return e.timeout=s,e.open(t,r),e.onload=()=>{let l=this.parseJSON(e.responseText);a&&a(l)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,i,a,l){e.open(t,r,!0),e.timeout=i;for(let[c,u]of Object.entries(n))e.setRequestHeader(c,u);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===Ow.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},a&&(e.ontimeout=a),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},Iw=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)},_n=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(wc)&&(this.authToken=atob(t[1].slice(wc.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(e),this.readyState=qt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+xc.websocket),"$1/"+xc.longpoll)}endpointURL(){return Ya.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=qt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===qt.open||this.readyState===qt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:n,messages:s}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=qt.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 ${r}`)}})}send(e){typeof e!="string"&&(e=Iw(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let s of this.reqs)s.abort();this.readyState=qt.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,s){let i,a=()=>{this.reqs.delete(i),n()};i=Ya.request(e,this.endpointURL(),t,r,this.timeout,a,l=>{this.reqs.delete(i),this.isActive()&&s(l)}),this.reqs.add(i)}},$w=class Ts{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ts.syncState(this.state,s,i,a),this.pendingDiffs.forEach(c=>{this.state=Ts.syncDiff(this.state,c,i,a)}),this.pendingDiffs=[],l()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Ts.syncDiff(this.state,s,i,a),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Ts.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,n,s){let i=this.clone(t),a={},l={};return this.map(i,(c,u)=>{r[c]||(l[c]=u)}),this.map(r,(c,u)=>{let d=i[c];if(d){let h=u.metas.map(m=>m.phx_ref),f=d.metas.map(m=>m.phx_ref),p=u.metas.filter(m=>f.indexOf(m.phx_ref)<0),w=d.metas.filter(m=>h.indexOf(m.phx_ref)<0);p.length>0&&(a[c]=u,a[c].metas=p),w.length>0&&(l[c]=this.clone(d),l[c].metas=w)}else a[c]=u}),this.syncDiff(i,{joins:a,leaves:l},n,s)}static syncDiff(t,r,n,s){let{joins:i,leaves:a}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(l,c)=>{let u=t[l];if(t[l]=this.clone(c),u){let d=t[l].metas.map(f=>f.phx_ref),h=u.metas.filter(f=>d.indexOf(f.phx_ref)<0);t[l].metas.unshift(...h)}n(l,u,c)}),this.map(a,(l,c)=>{let u=t[l];if(!u)return;let d=c.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(l,u,c),u.metas.length===0&&delete t[l]}),t}static list(t,r){return r||(r=function(n,s){return s}),this.map(t,(n,s)=>r(n,s))}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},Qi={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,s,i,a]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:s,payload:i}=e,a=this.META_LENGTH+t.length+r.length+s.length+n.length,l=new ArrayBuffer(this.HEADER_LENGTH+a),c=new DataView(l),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,r.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(r,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(l.byteLength+i.byteLength);return d.set(new Uint8Array(l),0),d.set(new Uint8Array(i),l.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,l=r.decode(e.slice(a,a+n));a=a+n;let c=r.decode(e.slice(a,a+s));a=a+s;let u=r.decode(e.slice(a,a+i));a=a+i;let d=e.slice(a,e.byteLength);return{join_ref:l,ref:null,topic:c,event:u,payload:d}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(l,l+n));l=l+n;let u=r.decode(e.slice(l,l+s));l=l+s;let d=r.decode(e.slice(l,l+i));l=l+i;let h=r.decode(e.slice(l,l+a));l=l+a;let f=e.slice(l,e.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:er.reply,payload:p}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(e.slice(i,i+n));i=i+n;let l=r.decode(e.slice(i,i+s));i=i+s;let c=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:l,payload:c}}},Dw=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Rw,this.transport=t.transport||Ht.WebSocket||_n,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Ht&&Ht.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Qi.encode.bind(Qi),this.defaultDecoder=Qi.decode.bind(Qi),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==_n?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Nn&&Nn.addEventListener&&(Nn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Nn.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Nn.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,a)=>{console.log(`${s}: ${i}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=qs(t.params||{}),this.endPoint=`${e}/${xc.websocket}`,this.vsn=t.vsn||Tw,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new eg(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return _n}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Ya.appendParams(Ya.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=qs(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==_n?this.connectWithFallback(_n,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(s=>{s.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){switch(e){case _n:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${wc}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,a=this.transportName(e),l=c=>{this.log("transport",`falling back to ${a}...`,c),this.off([s,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),i=this.onError(c=>{this.log("transport","error",c),n&&!r&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),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(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Pw,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===qt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(er.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case qt.connecting:return"connecting";case qt.open:return"open";case qt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new zw(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}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(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:n,payload:s,ref:i,join_ref:a}=t;if(i&&i===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(r,n,s,a)&&c.trigger(n,s,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Ws{constructor(t,r){const n=Fw(r);this.presence=new $w(t.getChannel(),n),this.presence.onJoin((s,i,a)=>{const l=Ws.onJoinPayload(s,i,a);t.getChannel().trigger("presence",l)}),this.presence.onLeave((s,i,a)=>{const l=Ws.onLeavePayload(s,i,a);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ws.transformState(this.presence.state)}static transformState(t){return t=Lw(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=xa(s),r},{})}static onJoinPayload(t,r,n){const s=mh(r),i=xa(n);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,r,n){const s=mh(r),i=xa(n);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function xa(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function Lw(e){return JSON.parse(JSON.stringify(e))}function Fw(e){return(e==null?void 0:e.events)&&{events:e.events}}function mh(e){return e!=null&&e.metas?xa(e):[]}var gh;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(gh||(gh={}));class Uw{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new Ws(this.channel.channelAdapter,r)}}function Bw(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const r=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${r}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class Mw{constructor(t,r,n){const s=Hw(n);this.channel=t.getSocket().channel(r,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,n){let s;try{s=this.channel.push(t,r,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>bw){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===Sr.joined}isJoined(){return this.state===Sr.joined}isJoining(){return this.state===Sr.joining}isClosed(){return this.state===Sr.closed}isLeaving(){return this.state===Sr.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Hw(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}const qw=/[,()"\\]/,Ww=e=>qw.test(e)||e!==e.trim(),Vw=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,yh=e=>{const t=e===null?"null":String(e);return Ww(t)?Vw(t):t},Kw=e=>e===null?"null":String(e),Gw=(e,t)=>{if(e==="in"){const r=Array.isArray(t)?t:[t];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(s=>yh(s)).join(",")})`}return e==="is"?`is.${Kw(t)}`:`${e}.${yh(t)}`};class Jw{constructor(){this.filters=[]}add(t,r,n,s=!1){const i=s?"not.":"";return this.filters.push(`${t}=${i}${Gw(r,n)}`),this}eq(t,r){return this.add(t,"eq",r)}neq(t,r){return this.add(t,"neq",r)}gt(t,r){return this.add(t,"gt",r)}gte(t,r){return this.add(t,"gte",r)}lt(t,r){return this.add(t,"lt",r)}lte(t,r){return this.add(t,"lte",r)}in(t,r){return this.add(t,"in",r)}like(t,r){return this.add(t,"like",r)}ilike(t,r){return this.add(t,"ilike",r)}match(t,r){return this.add(t,"match",r)}imatch(t,r){return this.add(t,"imatch",r)}is(t,r){return this.add(t,"is",r)}isDistinct(t,r){return this.add(t,"isdistinct",r)}not(t,r,n){return this.add(t,r,n,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var vh;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(vh||(vh={}));var Hn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Hn||(Hn={}));var tr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(tr||(tr={}));class Vs{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}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(t,r={config:{}},n){var s,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Mw(this.socket.socketAdapter,t,this.params),this.presence=new Uw(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Zm(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:l,private:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[Hn.PRESENCE]&&this.bindings[Hn.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>{t==null||t(tr.CHANNEL_ERROR,Bw(p))}),this._onClose(()=>t==null?void 0:t(tr.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t(tr.SUBSCRIBED);return}this._updatePostgresBindings(p,t)}).receive("error",p=>{this.state=Sr.errored;const w=Object.values(p).join(", ")||"error";t==null||t(tr.CHANNEL_ERROR,new Error(w,{cause:p}))}).receive("timeout",()=>{t==null||t(tr.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,a=[];for(let l=0;l<i;l++){const c=s[l],{filter:{event:u,schema:d,table:h,filter:f}}=c,p=t&&t[l];if(p&&p.event===u&&Vs.isFilterValueEqual(p.schema,d)&&Vs.isFilterValueEqual(p.table,h)&&Vs.isFilterValueEqual(p.filter,f))a.push(Object.assign(Object.assign({},c),{id:p.id}));else{this.unsubscribe(),this.state=Sr.errored,r==null||r(tr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=Sr.errored&&r&&r(tr.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Hn.PRESENCE||t===Hn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,r,n)}async httpSend(t,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i=r instanceof ArrayBuffer||ArrayBuffer.isView(r),a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":i?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l=new URL(this.broadcastEndpointURL);l.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(t)}`,this.private&&l.searchParams.set("private","true");const c={method:"POST",headers:a,body:i?r:JSON.stringify(r)},u=await this._fetchWithTimeout(l.toString(),c,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(u.status===202)return{success:!0};if(u.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 d=u.statusText;try{const h=await u.json();d=h.error||h.message||d}catch{}return Promise.reject(new Error(d))}async send(t,r={}){var n,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u instanceof Error&&u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,l,c;const u=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),a}_on(t,r,n){const s=t.toLocaleLowerCase(),i=r==null?void 0:r.filter;(i instanceof Jw||typeof i=="object"&&i!==null&&typeof i.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:i.build()}));const a=this.channelAdapter.on(t,n),l={type:s,filter:r,callback:n,ref:a};return this.bindings[s]?this.bindings[s].push(l):this.bindings[s]=[l],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,n)=>{var s,i,a,l,c,u,d;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const f=(s=this.bindings[h])===null||s===void 0?void 0:s.find(p=>p.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const p=f.id,w=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((a=r.ids)===null||a===void 0?void 0:a.includes(p))&&(w==="*"||(w==null?void 0:w.toLocaleLowerCase())===((l=r.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const p=(u=(c=f==null?void 0:f.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return p==="*"||p===((d=r==null?void 0:r.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,r){const{close:n,error:s,leave:i,join:a}=Qm;return r&&[n,s,i,a].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:a,commit_timestamp:l,type:c,errors:u}=s;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:l,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const n of t.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=ph(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=ph(t.columns,t.old_record)),r}}class Yw{constructor(t,r){this.socket=new Dw(t,r)}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(t){this.socket.heartbeatCallback=t}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(t,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},r,n)})}push(t){this.socket.push(t)}log(t,r,n){this.socket.log(t,r,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==yc.connecting}isDisconnecting(){return this.socket.connectionState()==yc.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const xh={HEARTBEAT_INTERVAL:25e3},Qw=[1e3,2e3,5e3,1e4],Xw=1e4;function Zw(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var r;return(r=Array.from(e.keys())[t])!==null&&r!==void 0?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}function eb(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Zw()}const tb=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class rb{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(t,r){var n;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 _w,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new Yw(t,s),this.httpEndpoint=Zm(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),r}async removeAllChannels(){const t=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(t);return await this.disconnect(),r}log(t,r,n){this.socketAdapter.log(t,r,n)}connectionState(){return this.socketAdapter.connectionState()||yc.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new Vs(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.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(t=null){let r,n=!1;if(t)r=t,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:yw};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Qm.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,n)=>{r!=="disconnected"&&(r=="sent"&&this._setAuthSafely(),t&&t(r,n))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([tb],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,i,a,l,c,u,d,h,f,p;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const w={};w.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:ww,w.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:xh.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:xh.HEARTBEAT_INTERVAL),w.transport=(c=t==null?void 0:t.transport)!==null&&c!==void 0?c:mw.getWebSocketConstructor(),w.params=t==null?void 0:t.params,w.logger=t==null?void 0:t.logger,w.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),w.sessionStorage=(u=t==null?void 0:t.sessionStorage)!==null&&u!==void 0?u:eb(),w.reconnectAfterMs=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:g=>Qw[g-1]||Xw;let m,k;const y=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:xw;switch(y){case vw:m=(g,x)=>x(JSON.stringify(g)),k=(g,x)=>x(JSON.parse(g));break;case Ym:m=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${w.vsn}`)}if(w.vsn=y,w.encode=(f=t==null?void 0:t.encode)!==null&&f!==void 0?f:m,w.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:k,w.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,w.params=Object.assign(Object.assign({},w.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,w.autoSendHeartbeat=!this.worker}return w}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var fi=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function nb(e,t,r){const n=new URL(t,e);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function sb(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function ib(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:a}){const l=nb(e.baseUrl,n,s),c=await sb(e.auth),u=await t(l,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...c,...a},body:i?JSON.stringify(i):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!u.ok){const p=h?f:void 0,w=p==null?void 0:p.error;throw new fi((w==null?void 0:w.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:w==null?void 0:w.type,icebergCode:w==null?void 0:w.code,details:p})}return{status:u.status,headers:u.headers,data:f}}}}function Xi(e){return e.join("")}var ab=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Xi(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Xi(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xi(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Xi(e.namespace)}`}),!0}catch(t){if(t instanceof fi&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof fi&&r.status===409)return;throw r}}};function kn(e){return e.join("")}var ob=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${kn(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof fi&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof fi&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},lb=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=ib({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new ab(this.client,t),this.tableOps=new ob(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function pi(e){"@babel/helpers - typeof";return pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pi(e)}function cb(e,t){if(pi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ub(e){var t=cb(e,"string");return pi(t)=="symbol"?t:t+""}function db(e,t,r){return(t=ub(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wh(Object(r),!0).forEach(function(n){db(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var To=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Ro(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var bc=class extends To{constructor(e,t,r,n="storage"){super(e,n,t,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return q({},super.toJSON())}},tg=class extends To{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Qa(e,t,r){const n=q({},e),s=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function hb(e){const t={};for(const[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}const fb=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),pb=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},_c=e=>{if(Array.isArray(e))return e.map(r=>_c(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=_c(n)}),t},mb=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),bh=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const r=t.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(e)},gb=async(e,t,r,n)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(a=>{const l=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new bc(bh(a),i,l,n))}).catch(()=>{const a=i+"";t(new bc(s.statusText||`HTTP ${i} error`,i,a,n))})}else t(new tg(bh(e),e,n))},yb=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return q(q({},s),r);if(pb(n)){var i;const a=(t==null?void 0:t.headers)||{};let l;for(const[c,u]of Object.entries(a))c.toLowerCase()==="content-type"&&(l=u);s.headers=Qa(a,"Content-Type",(i=l)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return t!=null&&t.duplex&&(s.duplex=t.duplex),q(q({},s),r)};async function ks(e,t,r,n,s,i,a){return new Promise((l,c)=>{e(r,yb(t,n,s,i)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(a==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>gb(u,c,n,a))})}function rg(e="storage"){return{get:async(t,r,n,s)=>ks(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>ks(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>ks(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>ks(t,"HEAD",r,q(q({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>ks(t,"DELETE",r,s,i,n,e)}}const vb=rg("storage"),{get:mi,post:Ct,put:kc,head:xb,remove:gi}=vb,it=rg("vectors");var ds=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=hb(t),this.fetch=fb(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Qa(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Ro(r))return{data:null,error:r};throw r}}};let ng;ng=Symbol.toStringTag;var wb=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[ng]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ro(t))return{data:null,error:t};throw t}}};let sg;sg=Symbol.toStringTag;var bb=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[sg]="BlobDownloadBuilder",this.promise=null}asStream(){return new wb(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ro(t))return{data:null,error:t};throw t}}};const cl={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},_h={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var _b=class extends ds{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var s=this;return s.handleOperation(async()=>{let i;const a=q(q({},_h),n);let l=q(q({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",s.encodeMetadata(c)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),c&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(c))):(i=r,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,c&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))l=Qa(l,f,p);const u=s._removeEmptyFolders(t),d=s._getFinalPath(u),h=await(e=="PUT"?kc:Ct)(s.fetch,`${s.url}/object/${d}`,i,q({headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const i=s._removeEmptyFolders(e),a=s._getFinalPath(i),l=new URL(s.url+`/object/upload/sign/${a}`);return l.searchParams.set("token",t),s.handleOperation(async()=>{let c;const u=q(q({},_h),n);let d=q(q({},s.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),h&&c.append("metadata",s.encodeMetadata(h)),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),h&&!c.has("metadata")&&c.append("metadata",s.encodeMetadata(h))):(c=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))d=Qa(d,f,p);return{path:i,fullPath:(await kc(s.fetch,l.toString(),c,q({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=q({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await Ct(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+i.url),l=a.searchParams.get("token");if(!l)throw new To("No token returned by API");return{signedUrl:a.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await Ct(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await Ct(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let a=await Ct(n.fetch,`${n.url}/object/sign/${s}`,q({expiresIn:t},i?{transform:r.transform}:{}),{headers:n.headers});const l=new URLSearchParams;r!=null&&r.download&&l.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&l.set("cacheNonce",String(r.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await Ct(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const a=i.toString();return s.map(l=>q(q({},l),{},{signedUrl:l.signedURL?encodeURI(`${n.url}${l.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,r){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),a=this._getFinalPath(e),l=()=>mi(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new bb(l,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>_c(await mi(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await xb(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(Ro(s)){var n;const i=s instanceof bc?s.status:s instanceof tg?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const s=n.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await gi(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const s=n._getFinalPath(e),i=new URLSearchParams;t!=null&&t.transformations&&i.set("transformations","true");const a=i.toString();return await gi(n.fetch,`${n.url}/cdn/${s}${a?`?${a}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const s=t!=null&&t.sortBy?q(q({},cl.sortBy),t.sortBy):cl.sortBy,i=q(q(q({},cl),t),{},{sortBy:s,prefix:e||""});return await Ct(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=q({},e);return await Ct(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const kb="2.110.2",Ti={"X-Client-Info":`storage-js/${kb}`};var Sb=class extends ds{constructor(e,t={},r,n){const s=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),a=q(q({},Ti),t);super(i,a,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await mi(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await mi(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await Ct(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await kc(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Ct(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await gi(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const s=new URLSearchParams;t!=null&&t.transformations&&s.set("transformations","true");const i=s.toString();return await gi(n.fetch,`${n.url}/cdn/${e}${i?`?${i}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},jb=class extends ds{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=q(q({},Ti),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Ct(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await mi(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await gi(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!mb(e))throw new To("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new lb({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const a=s[i];return typeof a!="function"?a:async(...l)=>{try{return{data:await a.apply(s,l),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}},Eb=class extends ds{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=q(q({},Ti),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await it.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await it.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},Cb=class extends ds{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=q(q({},Ti),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Nb=class extends ds{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=q(q({},Ti),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await it.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Ab=class extends Nb{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Tb(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},Tb=class extends Eb{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new Rb(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Rb=class extends Cb{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,q(q({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Pb=class extends Sb{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new _b(this.url,this.headers,e,this.fetch)}get vectors(){return new Ab(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new jb(this.url+"/iceberg",this.headers,this.fetch)}};const ig="2.110.2",rr=30*1e3,Rs=3,ul=Rs*rr,Ob=2*rr,zb="http://localhost:9999",Ib="supabase.auth.token",$b={"X-Client-Info":`gotrue-js/${ig}`},Sc="X-Supabase-Api-Version",ag={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Db=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Lb=10*60*1e3;class yi extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function F(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Fb extends yi{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function Ub(e){return F(e)&&e.name==="AuthApiError"}class Tt extends yi{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class Yt extends yi{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class Oe extends Yt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Zi(e){return F(e)&&e.name==="AuthSessionMissingError"}class Sn extends Yt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ea extends Yt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ta extends Yt{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Bb(e){return F(e)&&e.name==="AuthImplicitGrantRedirectError"}class kh extends Yt{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Mb extends Yt{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 jc extends Yt{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Sh(e){return F(e)&&e.name==="AuthRetryableFetchError"}class jh extends Yt{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,"AuthRefreshDiscardedError",409,void 0)}}function Hb(e){return F(e)&&e.name==="AuthRefreshDiscardedError"}class Eh extends Yt{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Xa extends Yt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Za="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Ch=` 	
\r=`.split(""),qb=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Ch.length;t+=1)e[Ch[t].charCodeAt(0)]=-2;for(let t=0;t<Za.length;t+=1)e[Za[t].charCodeAt(0)]=t;return e})();function Nh(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(Za[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(Za[n]),t.queuedBits-=6}}function og(e,t,r){const n=qb[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function Ah(e){const t=[],r=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{Kb(a,n,r)};for(let a=0;a<e.length;a+=1)og(e.charCodeAt(a),s,i);return t.join("")}function Wb(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function Vb(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}Wb(n,t)}}function Kb(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function Yn(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)og(e.charCodeAt(s),r,n);return new Uint8Array(t)}function Gb(e){const t=[];return Vb(e,r=>t.push(r)),new Uint8Array(t)}function en(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>Nh(s,r,n)),Nh(null,r,n),t.join("")}function Jb(e){return Math.round(Date.now()/1e3)+e}function Yb(){return Symbol("auth-callback")}const He=()=>typeof window<"u"&&typeof document<"u",Wr={tested:!1,writable:!1},lg=()=>{if(!He())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Wr.tested)return Wr.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Wr.tested=!0,Wr.writable=!0}catch{Wr.tested=!0,Wr.writable=!1}return Wr.writable};function Qb(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const cg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Xb=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",An=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},St=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ke=async(e,t)=>{await e.removeItem(t)};class Po{constructor(){this.promise=new Po.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}Po.promiseConstructor=Promise;function ra(e){const t=e.split(".");if(t.length!==3)throw new Xa("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!Db.test(t[n]))throw new Xa("JWT not in base64url format");return{header:JSON.parse(Ah(t[0])),payload:JSON.parse(Ah(t[1])),signature:Yn(t[2]),raw:{header:t[0],payload:t[1]}}}async function Zb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function e1(e,t){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await e(i);if(!t(i,null,a)){n(a);return}}catch(a){if(!t(i,a)){s(a);return}}})()})}function t1(e){return("0"+e.toString(16)).substr(-2)}function r1(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,t1).join("")}async function n1(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function s1(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const r=await n1(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Vr(e,t,r=!1){const n=r1();let s=n;r&&(s+="/recovery"),await An(e,`${t}-code-verifier`,s);const i=await s1(n);return[i,n===i?"plain":"s256"]}const i1=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function a1(e){const t=e.headers.get(Sc);if(!t||!t.match(i1))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function o1(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function l1(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const c1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Xt(e){if(!c1.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function jt(e){if(!e.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 dl(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function u1(e,t){return new Proxy(e,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!t.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(r,n,s)}})}function Th(e){return JSON.parse(JSON.stringify(e))}const Yr=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},d1=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function Rh(e){var t;if(!Xb(e))throw new jc(Yr(e),0);if(d1.includes(e.status))throw new jc(Yr(e),e.status);let r;try{r=await e.json()}catch(i){throw new Tt(Yr(i),i)}let n;const s=a1(e);if(s&&s.getTime()>=ag["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new Eh(Yr(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Oe}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new Eh(Yr(r),e.status,r.weak_password.reasons);throw new Fb(Yr(r),e.status||500,n)}const h1=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function H(e,t,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[Sc]||(i[Sc]=ag["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await f1(e,t,r+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function f1(e,t,r,n,s,i){const a=h1(t,n,s,i);let l;try{l=await e(r,Object.assign({},a))}catch(c){throw console.error(c),new jc(Yr(c),0)}if(l.ok||await Rh(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await Rh(c)}}function ht(e){var t;let r=null;g1(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=Jb(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:typeof(e==null?void 0:e.id)=="string"?e:null;return{data:{session:r,user:n},error:null}}function Ph(e){const t=ht(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function jr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function p1(e){return{data:e,error:null}}function m1(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e,a=Ao(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},a);return{data:{properties:l,user:c},error:null}}function Oh(e){return e}function g1(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const hl=["global","local","others"];class y1{constructor({url:t="",headers:r={},fetch:n,experimental:s}){this.url=t,this.headers=r,this.fetch=cg(n),this.experimental=s??{},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(t,r=hl[0]){if(hl.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${hl.join(", ")}`);try{return await H(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(F(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await H(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:jr})}catch(n){if(F(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=Ao(t,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await H(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:m1,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(F(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await H(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:jr})}catch(r){if(F(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,i,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await H(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Oh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(w=>{const m=parseInt(w.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(w.split(";")[1].split("=")[1]);u[`${k}Page`]=m}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(F(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Xt(t);try{return await H(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:jr})}catch(r){if(F(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Xt(t);try{return await H(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:jr})}catch(n){if(F(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){Xt(t);try{return await H(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:jr})}catch(n){if(F(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Xt(t.userId);try{const{data:r,error:n}=await H(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(F(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Xt(t.userId),Xt(t.id);try{return{data:await H(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(F(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,i,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await H(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Oh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(w=>{const m=parseInt(w.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(w.split(";")[1].split("=")[1]);u[`${k}Page`]=m}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(F(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await H(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await H(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await H(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(F(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await H(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(F(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await H(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await H(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(F(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await H(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await H(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await H(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(F(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await H(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(F(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){jt(this.experimental),Xt(t.userId);try{return await H(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(F(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){jt(this.experimental),Xt(t.userId),Xt(t.passkeyId);try{return await H(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(F(r))return{data:null,error:r};throw r}}}function zh(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}globalThis&&lg()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class v1 extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}function x1(){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 ug(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function w1(e){return parseInt(e,16)}function b1(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function _1(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:f}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=ug(e.address),w=d?`${d}://${n}`:n,m=e.statement?`${e.statement}
`:"",k=`${w} wants you to sign in with your Ethereum account:
${p}

${m}`;let y=`URI: ${h}
Version: ${f}
Chain ID: ${r}${a?`
Nonce: ${a}`:""}
Issued At: ${i.toISOString()}`;if(s&&(y+=`
Expiration Time: ${s.toISOString()}`),l&&(y+=`
Not Before: ${l.toISOString()}`),c&&(y+=`
Request ID: ${c}`),u){let g=`
Resources:`;for(const x of u){if(!x||typeof x!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${x}`);g+=`
- ${x}`}y+=g}return`${k}
${y}`}class je extends Error{constructor({message:t,code:r,cause:n,name:s}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class eo extends je{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function k1({error:e,options:t}){var r,n,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new je({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new je({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new je({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new je({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new je({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new je({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new je({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new je({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(dg(a)){if(i.rp.id!==a)return new je({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new je({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new je({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new je({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new je({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function S1({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new je({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new je({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(dg(n)){if(r.rpId!==n)return new je({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new je({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new je({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new je({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class j1{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Ec=new j1;function Ih(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,s=Ao(e,["challenge","user","excludeCredentials"]),i=Yn(t).buffer,a=Object.assign(Object.assign({},r),{id:Yn(r.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:i,user:a});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const u=n[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:Yn(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function $h(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=Ao(e,["challenge","allowCredentials"]),s=Yn(t).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let a=0;a<r.length;a++){const l=r[a];i.allowCredentials[a]=Object.assign(Object.assign({},l),{id:Yn(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function Dh(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:en(new Uint8Array(e.response.attestationObject)),clientDataJSON:en(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Lh(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,n=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:en(new Uint8Array(s.authenticatorData)),clientDataJSON:en(new Uint8Array(s.clientDataJSON)),signature:en(new Uint8Array(s.signature)),userHandle:s.userHandle?en(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function dg(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function to(){var e,t;return!!(He()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function hg(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new eo("Browser returned unexpected credential type",t)}:{data:null,error:new eo("Empty credential response",t)}}catch(t){return{data:null,error:k1({error:t,options:e})}}}async function fg(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new eo("Browser returned unexpected credential type",t)}:{data:null,error:new eo("Empty credential response",t)}}catch(t){return{data:null,error:S1({error:t,options:e})}}}const E1={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},C1={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function ro(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of e)if(s)for(const i in s){const a=s[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(r(a))n[i]=a;else if(t(a)){const l=n[i];t(l)?n[i]=ro(l,a):n[i]=ro(a)}else n[i]=a}return n}function N1(e,t){return ro(E1,e,t||{})}function A1(e,t){return ro(C1,e,t||{})}class T1{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:s},i){var a;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!l)return{data:null,error:c};const u=s??Ec.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:d}=l.webauthn.credential_options.publicKey;if(!d.name){const h=n;if(h)d.name=`${d.id}:${h}`;else{const p=(await this.client.getUser()).data.user,w=((a=p==null?void 0:p.user_metadata)===null||a===void 0?void 0:a.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";d.name=`${d.id}:${w}`}}d.displayName||(d.displayName=d.name)}switch(l.webauthn.type){case"create":{const d=N1(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:f}=await hg({publicKey:d,signal:u});return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const d=A1(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:f}=await fg(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:d,signal:u}));return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(l){return F(l)?{data:null,error:l}:{data:null,error:new Tt("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new yi("rpId is required for WebAuthn authentication")};try{if(!to())return{data:null,error:new Tt("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!a)return{data:null,error:l};const{webauthn:c}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(a){return F(a)?{data:null,error:a}:{data:null,error:new Tt("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new yi("rpId is required for WebAuthn registration")};try{if(!to())return{data:null,error:new Tt("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(d=>{var h;return(h=d.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===t&&f.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return c?this._verify({factorId:a.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(a){return F(a)?{data:null,error:a}:{data:null,error:new Tt("Unexpected error in register",a)}}}}x1();const R1={url:zb,storageKey:Ib,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:$b,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},jn={};class vi{get jwks(){var t,r;return(r=(t=jn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){jn[this.storageKey]=Object.assign(Object.assign({},jn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=jn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){jn[this.storageKey]=Object.assign(Object.assign({},jn[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,s;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 i=Object.assign(Object.assign({},R1),t);if(this.storageKey=i.storageKey,this.instanceID=(r=vi.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,vi.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&He()){const a=`${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(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=(n=i.experimental)!==null&&n!==void 0?n:{},this.admin=new y1({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=cg(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock!=null&&(this.lock=i.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 T1(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?(i.storage?this.storage=i.storage:lg()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=zh(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=zh(this.memoryStorage)),He()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),(a.data.event==="TOKEN_REFRESHED"||a.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ig}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){var t;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 r=await this.initializePromise,n=(t=this._pendingInitNotifications)!==null&&t!==void 0?t:[];this._pendingInitNotifications=null;for(const s of n)await this._notifyAllSubscribers(s.event,s.session,s.broadcast);return r}async _initialize(){var t;try{let r={},n="none";if(He()&&(r=Qb(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),He()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Bb(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return F(r)?this._returnResult({error:r}):this._returnResult({error:new Tt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const i=await H(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:ht}),{data:a,error:l}=i;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(F(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,n,s;try{let i;if("email"in t){const{email:d,password:h,options:f}=t;let p=null,w=null;this.flowType==="pkce"&&([p,w]=await Vr(this.storage,this.storageKey)),i=await H(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:w},xform:ht})}else if("phone"in t){const{phone:d,password:h,options:f}=t;i=await H(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:ht})}else throw new ea("You must provide either an email or phone number and a password");const{data:a,error:l}=i;if(l||!a)return await ke(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let r;if("email"in t){const{email:i,password:a,options:l}=t;r=await H(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Ph})}else if("phone"in t){const{phone:i,password:a,options:l}=t;r=await H(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Ph})}else throw new ea("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new Sn;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(F(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t)):this._exchangeCodeForSession(t)}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,n,s,i,a,l,c,u,d,h,f;let p,w;if("message"in t)p=t.message,w=t.signature;else{const{chain:m,wallet:k,statement:y,options:g}=t;let x;if(He())if(typeof k=="object")x=k;else{const b=window;if("ethereum"in b&&typeof b.ethereum=="object"&&"request"in b.ethereum&&typeof b.ethereum.request=="function")x=b.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"||!(g!=null&&g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=k}const E=new URL((r=g==null?void 0:g.url)!==null&&r!==void 0?r:window.location.href),T=await x.request({method:"eth_requestAccounts"}).then(b=>b).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=ug(T[0]);let A=(n=g==null?void 0:g.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!A){const b=await x.request({method:"eth_chainId"});A=w1(b)}const R={domain:E.host,address:S,statement:y,uri:E.href,version:"1",chainId:A,nonce:(s=g==null?void 0:g.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=g==null?void 0:g.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(l=g==null?void 0:g.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=g==null?void 0:g.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=g==null?void 0:g.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=g==null?void 0:g.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=_1(R),w=await x.request({method:"personal_sign",params:[b1(p),S]})}try{const{data:m,error:k}=await H(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:w},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ht});if(k)throw k;if(!m||!m.session||!m.user){const y=new Sn;return this._returnResult({data:{user:null,session:null},error:y})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:k})}catch(m){if(F(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(t){var r,n,s,i,a,l,c,u,d,h,f,p;let w,m;if("message"in t)w=t.message,m=t.signature;else{const{chain:k,wallet:y,statement:g,options:x}=t;let E;if(He())if(typeof y=="object")E=y;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))E=S.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 y!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=y}const T=new URL((r=x==null?void 0:x.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in E&&E.signIn){const S=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},x==null?void 0:x.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),g?{statement:g}:null));let A;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")A=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)A=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in A&&"signature"in A&&(typeof A.signedMessage=="string"||A.signedMessage instanceof Uint8Array)&&A.signature instanceof Uint8Array)w=typeof A.signedMessage=="string"?A.signedMessage:new TextDecoder().decode(A.signedMessage),m=A.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");w=[`${T.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(s=(n=x==null?void 0:x.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=x==null?void 0:x.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${x.signInWithSolana.notBefore}`]:[],...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((l=x==null?void 0:x.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${x.signInWithSolana.chainId}`]:[],...!((c=x==null?void 0:x.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${x.signInWithSolana.nonce}`]:[],...!((u=x==null?void 0:x.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${x.signInWithSolana.requestId}`]:[],...!((h=(d=x==null?void 0:x.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...x.signInWithSolana.resources.map(A=>`- ${A}`)]:[]].join(`
`);const S=await E.signMessage(new TextEncoder().encode(w),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=S}}try{const{data:k,error:y}=await H(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:w,signature:en(m)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:ht});if(y)throw y;if(!k||!k.session||!k.user){const g=new Sn;return this._returnResult({data:{user:null,session:null},error:g})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:y})}catch(k){if(F(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(t){const r=await St(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new Mb;const{data:i,error:a}=await H(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:ht});if(await ke(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const l=new Sn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:a})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:i,nonce:a}=t,l=await H(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ht}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new Sn;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(F(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,s,i,a;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Vr(this.storage,this.storageKey));const{error:h}=await H(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await H(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(a=c==null?void 0:c.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new ea("You must provide either an email or phone number.")}catch(l){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,n;try{let s,i;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:l}=await H(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ht});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");const c=a.session,u=a.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(F(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,i,a;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Vr(this.storage,this.storageKey));const u=await H(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:p1});return!((i=u.data)===null||i===void 0)&&i.url&&He()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(l))return this._returnResult({data:null,error:l});throw l}}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 t=>{const{data:{session:r},error:n}=t;if(n)throw n;if(!r)throw new Oe;const{error:s}=await H(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(F(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:s,options:i}=t;let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Vr(this.storage,this.storageKey));const{error:c}=await H(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken},code_challenge:a,code_challenge_method:l},redirectTo:i==null?void 0:i.emailRedirectTo});return c&&await ke(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c})}else if("phone"in t){const{phone:n,type:s,options:i}=t,{data:a,error:l}=await H(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l})}throw new ea("You must provide either an email or phone number and a type")}catch(r){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async t=>t)):await this._useSession(async t=>t)}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}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 t=null;const r=await St(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<ul:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await St(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=dl()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=u1(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);if(i){if(!!(t.expires_at&&t.expires_at*1e3>Date.now())){const l=await St(this.storage,this.storageKey);if(l&&l.refresh_token===t.refresh_token)return this._returnResult({data:{session:t},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await H(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:jr}):await this._useSession(async r=>{var n,s,i;const{data:a,error:l}=r;if(l)throw l;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Oe}:await H(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:jr})})}catch(r){if(F(r))return Zi(r)&&(await this._removeSession(),await ke(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r)):await this._updateUser(t,r)}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new Oe;const a=s.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Vr(this.storage,this.storageKey));const{data:u,error:d}=await H(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:a.access_token,xform:jr});if(d)throw d;return a.user=u.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(t){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t)):await this._setSession(t)}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Oe;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:a}=ra(t.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(F(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t)):await this._refreshSession(t)}async _refreshSession(t){try{return await this._useSession(async r=>{var n;if(!t){const{data:a,error:l}=r;if(l)throw l;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Oe;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(F(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var n;try{if(!He())throw new ta("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ta(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new kh("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ta("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new kh("No code detected.");const{data:x,error:E}=await this._exchangeCodeForSession(t.code);if(E)throw E;const T=new URL(window.location.href);return T.searchParams.delete("code"),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:x.session,redirectType:(n=x.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:l,expires_in:c,expires_at:u,token_type:d}=t;if(!a||!c||!l||!d)throw new ta("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(c);let p=h+f;u&&(p=parseInt(u));const w=p-h;w*1e3<=rr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${w}s, should have been closer to ${f}s`);const m=p-f;h-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,p,h):h-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,p,h);const{data:k,error:y}=await this._getUser(a);if(y)throw y;const g={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:p,refresh_token:l,token_type:d,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:t.type},error:null})}catch(s){if(F(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error||t.error_description||t.error_code)}async _isPKCECallback(t){const r=await St(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t)):await this._signOut(t)}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const s=async()=>{await this._removeSession(),await ke(this.storage,`${this.storageKey}-code-verifier`)},{data:i,error:a}=r;if(a&&!Zi(a))return this._returnResult({error:a});const l=(n=i.session)===null||n===void 0?void 0:n.access_token;if(l){const{error:c}=await this.admin.signOut(l,t);if(c&&!(Ub(c)&&(c.status===404||c.status===401||c.status===403)||Zi(c)))return t!=="others"&&await s(),this._returnResult({error:c})}return t!=="others"&&await s(),this._returnResult({error:null})})}onAuthStateChange(t){const r=Yb(),n={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:a}=r;if(a)throw a;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),Zi(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Vr(this.storage,this.storageKey,!0));try{return await H(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var a,l,c,u,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await H(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return He()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(F(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:a,provider:l,token:c,access_token:u,nonce:d}=t,h=await H(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ht}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Sn}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await ke(this.storage,`${this.storageKey}-code-verifier`),F(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)throw a;return await H(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const n=Date.now();return await e1(async s=>(s>0&&await Zb(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await H(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ht})),(s,i)=>{const a=200*Math.pow(2,s);return i&&Sh(i)&&Date.now()+a-n<rr})}catch(n){if(this._debug(r,"error",n),F(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",n),He()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await St(this.storage,this.storageKey);if(s&&this.userStorage){let a=await St(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await An(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:dl()}else if(s&&!s.user&&!s.user){const a=await St(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await ke(this.storage,this.storageKey+"-user"),await An(this.storage,this.storageKey,s)):s.user=dl()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<ul;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${ul}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(Hb(a)?this._debug(n,"refresh discarded by commit guard",a):this._debug(n,"refresh failed",a))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:l}=await this._getUser(s.access_token);!l&&(a!=null&&a.user)?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var r,n;if(!t)throw new Oe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===t&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const s="#_callRefreshToken()";this._debug(s,"begin");try{this.refreshingDeferred=new Po;const i=await St(this.storage,this.storageKey),{data:a,error:l}=await this._refreshAccessToken(t);if(l)throw l;if(!a.session)throw new Oe;const c=await St(this.storage,this.storageKey);if(i!==null&&(c===null||c.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:c?"replaced":"cleared"});const f={data:null,error:new jh};return this.refreshingDeferred.resolve(f),f}const d=this._sessionRemovalEpoch;if(await this._saveSession(a.session),this._sessionRemovalEpoch!==d){this._debug(s,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await ke(this.storage,this.storageKey),this.userStorage&&await ke(this.userStorage,this.storageKey+"-user");const f={data:null,error:new jh};return this.refreshingDeferred.resolve(f),f}await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const h={data:a.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(h),h}catch(i){if(this._debug(s,"error",i),F(i)){const a={data:null,error:i};if(!Sh(i)){const l=await St(this.storage,this.storageKey);!!(l!=null&&l.expires_at&&l.expires_at*1e3>Date.now())?this._debug(s,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:t,result:a,expiresAt:Date.now()+Ob},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,r,n=!0){if(this._pendingInitNotifications!==null&&n){this._pendingInitNotifications.push({event:t,session:r,broadcast:n});return}const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:r});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}catch(c){i.push(c)}});if(await Promise.all(a),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await ke(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await An(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=Th(s);await An(this.storage,this.storageKey,i)}else{const s=Th(r);await An(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ke(this.storage,this.storageKey),await ke(this.storage,this.storageKey+"-code-verifier"),await ke(this.storage,this.storageKey+"-user"),this.userStorage&&await ke(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&He()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),rr);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var t;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(t=this.broadcastChannel)===null||t===void 0||t.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 t=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-t)/rr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${rr}ms, refresh threshold is ${Rs} ticks`),s<=Rs&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof v1)this._debug("auto refresh token tick lock not available");else throw t}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const t=Date.now();try{await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-t)/rr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${rr}ms, refresh threshold is ${Rs} ticks`),s<=Rs&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!He()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!t)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await Vr(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await H(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await H(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Dh(t.webauthn.credential_response):Lh(t.webauthn.credential_response)})}:{code:t.code}),{data:c,error:u}=await H(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+c.expires_in},c)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",c),this._returnResult({data:c,error:u}))})}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(t){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=await H(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:c}=l;if(c.type!=="webauthn")return{data:c,error:null};switch(c.webauthn.type){case"create":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:Ih(c.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:$h(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,i;if(t)try{const{payload:p}=ra(t);let w=null;p.aal&&(w=p.aal);let m=w;const{data:{user:k},error:y}=await this.getUser(t);if(y)return this._returnResult({data:null,error:y});((n=(r=k==null?void 0:k.factors)===null||r===void 0?void 0:r.filter(E=>E.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(m="aal2");const x=p.amr||[];return{data:{currentLevel:w,nextLevel:m,currentAuthenticationMethods:x},error:null}}catch(p){if(F(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:a},error:l}=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=ra(a.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((i=(s=a.user.factors)===null||s===void 0?void 0:s.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const f=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await H(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Oe})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Oe});const a=await H(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&He()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Oe});const a=await H(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&He()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await H(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Oe})})}catch(t){if(F(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await H(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Oe})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(l=>l.kid===t);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===t),n&&this.jwks_cached_at+Lb>s)return n;const{data:i,error:a}=await H(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:p,error:w}=await this.getSession();if(w||!p.session)return this._returnResult({data:null,error:w});n=p.session.access_token}const{header:s,payload:i,signature:a,raw:{header:l,payload:c}}=ra(n);if(!(r!=null&&r.allowExpired))try{o1(i.exp)}catch(p){throw new Xa(p instanceof Error?p.message:"JWT validation failed")}const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:a},error:null}}const d=l1(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,Gb(`${l}.${c}`)))throw new Xa("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var r,n,s;jt(this.experimental);try{if(!to())return this._returnResult({data:null,error:new Tt("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const l=$h(i.options),c=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:Ec.createNewAbortSignal(),{data:u,error:d}=await fg({publicKey:l,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new Tt("WebAuthn ceremony failed",null)});const h=Lh(u);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(F(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var r,n;jt(this.experimental);try{if(!to())return this._returnResult({data:null,error:new Tt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const a=Ih(s.options),l=(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Ec.createNewAbortSignal(),{data:c,error:u}=await hg({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Tt("WebAuthn ceremony failed",null)});const d=Dh(c);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(F(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){jt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Oe});const{data:s,error:i}=await H(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(F(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){jt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Oe});const{data:i,error:a}=await H(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;jt(this.experimental);try{const{data:n,error:s}=await H(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(F(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){jt(this.experimental);try{const{data:r,error:n}=await H(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:ht});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){jt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Oe});const{data:s,error:i}=await H(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(F(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){jt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Oe});const{data:i,error:a}=await H(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){jt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Oe});const{error:i}=await H(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(F(r))return this._returnResult({data:null,error:r});throw r}}}vi.nextInstanceID={};const P1=vi,O1="2.110.2";let Ps="",no;if(typeof Deno<"u"){var fl;Ps="deno",no=(fl=Deno.version)===null||fl===void 0?void 0:fl.deno}else if(typeof document<"u")Ps="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Ps="react-native";else{var pl;Ps="node",no=typeof process<"u"?(pl=process.version)===null||pl===void 0?void 0:pl.replace(/^v/,""):void 0}const pg=[`runtime=${Ps}`];no&&pg.push(`runtime-version=${no}`);const z1={"X-Client-Info":`supabase-js/${O1}; ${pg.join("; ")}`},I1={headers:z1},$1={schema:"public"},D1={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},L1={},F1={enabled:!1,respectSamplingDecision:!0};function U1(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(d){try{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(e,[])).next())})}let ml=null;const B1="@opentelemetry/api";function M1(){return ml===null&&(ml=import(B1).catch(()=>null)),ml}function H1(){return U1(this,void 0,void 0,function*(){try{const e=yield M1();if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const r=t.traceparent;return r?{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function q1(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,n,s,i]=t;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const a=/^[0-9a-f]+$/i;return!a.test(r)||!a.test(n)||!a.test(s)||!a.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function W1(e,t){if(!e||!t||t.length===0)return!1;let r;if(e instanceof URL)r=e;else try{r=new URL(e)}catch{return!1}for(const n of t)try{if(typeof n=="string"){if(V1(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function V1(e,t){if(t===e)return!0;if(t.startsWith("*.")){const r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}function K1(e){const t=[];try{const r=new URL(e);t.push(r.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function xi(e){"@babel/helpers - typeof";return xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xi(e)}function G1(e,t){if(xi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(xi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J1(e){var t=G1(e,"string");return xi(t)=="symbol"?t:t+""}function Y1(e,t,r){return(t=J1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function be(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fh(Object(r),!0).forEach(function(n){Y1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const Q1=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),X1=()=>Headers,Z1=(e,t,r,n,s)=>{const i=Q1(n),a=X1(),l=(s==null?void 0:s.enabled)===!0,c=(s==null?void 0:s.respectSamplingDecision)!==!1,u=l?K1(t):null;return async(d,h)=>{var f;const p=(f=await r())!==null&&f!==void 0?f:e;let w=new a(h==null?void 0:h.headers);if(w.has("apikey")||w.set("apikey",e),w.has("Authorization")||w.set("Authorization",`Bearer ${p}`),u){const m=await e_(d,u,c);m&&(m.traceparent&&!w.has("traceparent")&&w.set("traceparent",m.traceparent),m.tracestate&&!w.has("tracestate")&&w.set("tracestate",m.tracestate),m.baggage&&!w.has("baggage")&&w.set("baggage",m.baggage))}return i(d,be(be({},h),{},{headers:w}))}};async function e_(e,t,r){if(!W1(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const n=await H1();if(!n||!n.traceparent)return null;if(r){const s=q1(n.traceparent);if(s&&!s.isSampled)return null}return n}function Uh(e){return typeof e=="boolean"?{enabled:e}:e}function t_(e){return e.endsWith("/")?e:e+"/"}function r_(e,t){var r,n,s,i,a,l;const{db:c,auth:u,realtime:d,global:h}=e,{db:f,auth:p,realtime:w,global:m}=t,k=Uh(e.tracePropagation),y=Uh(t.tracePropagation),g={db:be(be({},f),c),auth:be(be({},p),u),realtime:be(be({},w),d),storage:{},global:be(be(be({},m),h),{},{headers:be(be({},(r=m==null?void 0:m.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=k==null?void 0:k.enabled)!==null&&i!==void 0?i:y==null?void 0:y.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(a=(l=k==null?void 0:k.respectSamplingDecision)!==null&&l!==void 0?l:y==null?void 0:y.respectSamplingDecision)!==null&&a!==void 0?a:!0},accessToken:async()=>""};return e.accessToken?g.accessToken=e.accessToken:delete g.accessToken,g}function n_(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t_(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var s_=class extends P1{constructor(e){super(e)}},i_=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const i=n_(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:$1,realtime:L1,auth:be(be({},D1),{},{storageKey:a}),global:I1,tracePropagation:F1},c=r_(r??{},l);if(this.settings=c,this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=Z1(t,e,this._getAccessToken.bind(this),c.global.fetch,c.tracePropagation),this.realtime=this._initRealtimeClient(be({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new pw(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new Pb(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new iw(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:a,lock:l,debug:c,throwOnError:u,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:f},p,w){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new s_({url:this.authUrl.href,headers:be(be({},m),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:l,debug:c,throwOnError:u,experimental:d,fetch:w,lockAcquireTimeout:h,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new rb(this.realtimeUrl.href,be(be({},e),{},{params:be(be({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const a_=(e,t,r)=>new i_(e,t,r);function o_(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}o_()&&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 mg="https://udmfeelrxeoahrzkxmlk.supabase.co",gg="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVkbWZlZWxyeGVvYWhyemt4bWxrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM0NTYxMzYsImV4cCI6MjA5OTAzMjEzNn0.gu2A5wZAbVPN2GFKFNVILnjmqUrDm_Xv9xMCqTnItC0",l_=mg.includes("your-project")||gg.includes("your-anon"),ne=!l_;ne||console.info("[TvSeriesArchive] Running in Preview Mode — no real Supabase project connected. Products, orders, and admin sign-in are stored locally in this browser only. Add real VITE_SUPABASE_URL / VITE_SUPABASE_ANON_KEY (see .env.example) to go live.");const le=a_(ne?mg:"https://placeholder.supabase.co",ne?gg:"placeholder-anon-key");function Er(e,t){try{const r=localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}function tn(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(r){console.warn("localStorage write failed",e,r)}}const pn=["Western","Sitcom","Drama","Crime","Mystery","Sci-Fi","Kids","Animation","British TV","Soap Opera","Mini Series","Classic TV"],wi=["1950s","1960s","1970s","1980s","1990s","2000s"],Cc={Western:["#4A2A17","#C6A15B"],Sitcom:["#5A1E27","#E8C77E"],Drama:["#20232B","#C6A15B"],Crime:["#1B1E2A","#8C6B3F"],Mystery:["#241C2B","#9B7B49"],"Sci-Fi":["#0E2A2E","#6FBFAE"],Kids:["#2B2416","#E8C77E"],Animation:["#33231A","#E0A86A"],"British TV":["#241E1A","#B7935A"],"Soap Opera":["#3A1620","#D9A441"],"Mini Series":["#1E1B24","#A98550"],"Classic TV":["#221C14","#C6A15B"]},so=["rings","diagonal","dots","sunburst"];function yg(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function vg(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t}function xg(){return`zc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}function c_(){return`ZA-${new Date().getFullYear()}${String(Math.floor(Math.random()*9e4)+1e4)}`}function lr(e){const t=(e.title||"Untitled").trim(),r=(e.genres&&e.genres.length?e.genres:["Classic TV"]).filter(c=>typeof c=="string"),n=pn.includes(r[0])?r[0]:"Classic TV",s=Number(e.seasons)||1,i=e.digitalPrice!=null?Number(e.digitalPrice):s<=5?29:s<=9?35:40,a=e.usbPrice!=null?Number(e.usbPrice):s<=5?129:s<=9?149:169,l=e.id||xg();return{id:l,slug:e.slug||yg(`${t} complete series`),title:t,displayTitle:e.displayTitle||`${t} — Complete Series Collection`,years:e.years||"",genres:r,country:e.country||"USA",language:e.language||"English",decades:e.decades&&e.decades.length?e.decades:["1950s"],seasons:s,episodes:Number(e.episodes)||0,cast:e.cast||[],shortDesc:e.shortDesc||`Buy "${t}" complete series — ${s} season${s>1?"s":""}${e.years?` (${e.years})`:""} as digital download (lifetime Google Drive link) or USB edition with fast express shipping worldwide.`,longDesc:e.longDesc||`Own the complete "${t}" TV series — the full collection of ${e.episodes?`${e.episodes} episodes across `:""}${s} season${s>1?"s":""}${e.years?` (${e.years})`:""}.

Choose your format:
• **Digital Download** — receive a lifetime Google Drive link. Stream or download instantly to any device: laptop, tablet, phone, or smart TV. No expiry, no subscription. Yours forever.
• **USB Edition** — we ship via express courier worldwide. Plug into any USB port: TV, PC, Mac, media player, car entertainment. No internet needed. Play anywhere, anytime.

${r.join(", ")} fans will love this definitive ${e.country||"USA"} series. ${(e.decades||[]).length?`A timeless ${e.decades.join(", ")} classic,`:""} perfect for collectors and binge-watchers alike.`,quality:e.quality||"Standard-definition, cleaned and restored",isHD:!!e.isHD,compatibility:e.compatibility||"Digital: your lifetime Google Drive link works on any device with internet — laptops, tablets, phones, smart TVs. USB: plays seamlessly on any USB-compatible TV, PC, Mac, projector, car system, or media player. No region locks, no special software required.",tags:e.tags||[...r,...e.decades||[],e.country||"USA","digital download","USB","complete series","tv series collection","streaming","buy online","dvd collection","watch online","all episodes"].map(c=>String(c).toLowerCase()),seoTitle:e.seoTitle||`${t} Complete Series ${e.years?`(${e.years}) `:""}| Watch Online, Buy DVD, Digital Download & USB | TvSeriesArchive`,seoDescription:e.seoDescription||`Where to watch ${t} complete series ${e.years?`(${e.years})`:""}? Buy digital download, USB, or DVD collection. ${r.slice(0,2).join(", ")}. Instant stream or play offline on any device.`,palette:Cc[n]||["#221C14","#C6A15B"],pattern:so[vg(l)%so.length],coverUrl:e.coverUrl||null,deliveryLink:e.deliveryLink||null,formats:{digital:{available:e.digitalAvailable!==!1,price:i},usb:{available:e.usbAvailable!==!1,price:a}},rating:e.rating!=null?Number(e.rating):4.5,reviewCount:e.reviewCount!=null?Number(e.reviewCount):0,bestSeller:!!e.bestSeller,newArrival:e.newArrival!==!1,limited:!!e.limited,hiddenGem:!!e.hiddenGem,createdAt:e.createdAt||Date.now(),aiConfidence:e.aiConfidence!=null?Number(e.aiConfidence):null,needsReview:!!e.needsReview,enabled:e.enabled!==!1}}function Bh(e){const t=pn.includes((e.genres||[])[0])?e.genres[0]:"Classic TV";return{id:e.id,slug:e.slug,title:e.title,displayTitle:e.display_title||e.title,years:e.years||"",genres:e.genres||[],country:e.country||"USA",language:e.language||"English",decades:e.decades||[],seasons:e.seasons||1,episodes:e.episodes||0,cast:e.cast||[],shortDesc:e.short_desc||"",longDesc:e.long_desc||e.short_desc||"",quality:e.quality||"Standard-definition, cleaned",isHD:!!e.is_hd,compatibility:e.compatibility||"",tags:e.tags||[],seoTitle:e.seo_title||"",seoDescription:e.seo_description||"",palette:Cc[t]||Cc["Classic TV"],pattern:so[vg(e.id)%so.length],coverUrl:e.cover_url||null,deliveryLink:e.delivery_link||null,formats:{digital:{available:e.digital_available!==!1,price:Number(e.digital_price)||0},usb:{available:e.usb_available!==!1,price:Number(e.usb_price)||0}},rating:e.rating!=null?Number(e.rating):4.5,reviewCount:e.review_count||0,bestSeller:!!e.best_seller,newArrival:!!e.new_arrival,limited:!!e.limited,hiddenGem:!!e.hidden_gem,createdAt:e.created_at?new Date(e.created_at).getTime():Date.now(),aiConfidence:e.ai_confidence,needsReview:!!e.needs_review,enabled:e.enabled!==!1}}function Mh(e){return{id:e.id,slug:e.slug,title:e.title,display_title:e.displayTitle,years:e.years,genres:e.genres,country:e.country,language:e.language,decades:e.decades,seasons:e.seasons,episodes:e.episodes,cast:e.cast,short_desc:e.shortDesc,long_desc:e.longDesc,quality:e.quality,is_hd:e.isHD,compatibility:e.compatibility,tags:e.tags,seo_title:e.seoTitle,seo_description:e.seoDescription,cover_url:e.coverUrl,delivery_link:e.deliveryLink||null,digital_price:e.formats.digital.price,digital_available:e.formats.digital.available,usb_price:e.formats.usb.price,usb_available:e.formats.usb.available,rating:e.rating,review_count:e.reviewCount,best_seller:e.bestSeller,new_arrival:e.newArrival,limited:e.limited,hidden_gem:e.hiddenGem,ai_confidence:e.aiConfidence,needs_review:e.needsReview,enabled:e.enabled}}function Hh(e){return{id:e.id,number:e.number,createdAt:e.created_at?new Date(e.created_at).getTime():Date.now(),status:e.status,customer:{name:e.customer_name,email:e.customer_email,phone:e.customer_phone},billing:e.billing,shipping:e.shipping,notes:e.notes,coupon:e.coupon,items:e.items||[],subtotal:Number(e.subtotal)||0,shippingCost:Number(e.access_links&&e.access_links._shipping_cost||0),discount:Number(e.discount)||0,total:Number(e.total)||0,tracking:e.tracking,accessLinks:e.access_links||{}}}function u_(e){return{id:e.id,number:e.number,created_at:new Date(e.createdAt).toISOString(),status:e.status,customer_name:e.customer.name,customer_email:e.customer.email,customer_phone:e.customer.phone,billing:e.billing,shipping:e.shipping,notes:e.notes,coupon:e.coupon,items:e.items,subtotal:e.subtotal,discount:e.discount,total:e.total,tracking:e.tracking,access_links:{...e.accessLinks||{},_shipping_cost:e.shippingCost||0}}}const wg="za-demo-products",bg="za-demo-orders",_g="za-demo-settings";function Tn(){return Er(wg,[])}function Os(e){tn(wg,e)}function Bt(){return Er(bg,[])}function xr(e){tn(bg,e)}function d_(e){return Er(_g,e)}function h_(e){tn(_g,e)}const f_=[{title:"Frontier Skies",genres:["Western"],decades:["1960s"],seasons:6},{title:"Harbor Lights",genres:["Drama"],decades:["1970s"],seasons:4}],p_=["Frontier Skies","Harbor Lights","Midnight Precinct","The Larkspur House","Silver Static","Copper County","Willow Creek Junction","Sterling Manor"];async function m_(){const e=Tn();if(e.length>0&&!(e.some(s=>p_.includes(s.title))||e.some(s=>s.coverUrl==null)))return null;const t=Date.now();let r;try{const n=await fetch("/seed-products.json");if(!n.ok)throw new Error(`HTTP ${n.status}`);r=(await n.json()).map((i,a)=>lr({...i,createdAt:t-a*36e5}))}catch{r=f_.map((n,s)=>lr({title:n.title,genres:n.genres.filter(i=>pn.includes(i)),decades:n.decades.filter(i=>wi.includes(i)),seasons:n.seasons,episodes:n.seasons*12,country:"USA",shortDesc:"Sample listing — use scripts/generateProducts.mjs to build your real catalog.",rating:4.5,reviewCount:10,createdAt:t-s*36e5,needsReview:!1}))}Os(r)}const kg=_.createContext(null),Re=()=>_.useContext(kg),qh={payoneerEmail:"payments@tvseriesarchive.com",supportEmail:"support@tvseriesarchive.com",currency:"USD"},gl="za-my-orders-index";function yl(e,{orderId:t,email:r}){fetch("/api/send-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e,orderId:t,email:r})}).catch(n=>console.warn("Email notification failed (non-blocking):",n))}function g_(e){return{digitalPrice:e.formats.digital.price,usbPrice:e.formats.usb.price,digitalAvailable:e.formats.digital.available,usbAvailable:e.formats.usb.available}}function y_({children:e}){const[t,r]=_.useState([]),[n,s]=_.useState([]),[i,a]=_.useState([]),[l,c]=_.useState([]),[u,d]=_.useState(qh),[h,f]=_.useState(()=>Er("za-wishlist",[])),[p,w]=_.useState(()=>Er("za-recent-searches",[])),[m,k]=_.useState(()=>Er("za-cart",[])),[y,g]=_.useState(!1),[x,E]=_.useState(null);_.useEffect(()=>{tn("za-wishlist",h)},[h]),_.useEffect(()=>{tn("za-recent-searches",p)},[p]),_.useEffect(()=>{tn("za-cart",m)},[m]);async function T(){if(!ne){const z=Tn().filter(W=>W.enabled&&!W.needsReview).map(W=>({...W,deliveryLink:null})).sort((W,V)=>V.createdAt-W.createdAt);r(z);return}let j=[],N=0;const P=1e3;for(;;){const z=N*P,W=z+P-1,{data:V,error:O}=await le.from("public_products").select("*").order("created_at",{ascending:!1}).range(z,W);if(O){E(O.message);return}if(!V||V.length===0||(j=j.concat(V),V.length<P))break;N++}r(j.map(Bh))}async function S(){if(!ne){s([...Tn()].sort((z,W)=>W.createdAt-z.createdAt));return}let j=[],N=0;const P=1e3;for(;;){const z=N*P,W=z+P-1,{data:V,error:O}=await le.from("products").select("*").order("created_at",{ascending:!1}).range(z,W);if(O){E(O.message);return}if(!V||V.length===0||(j=j.concat(V),V.length<P))break;N++}s(j.map(Bh))}async function A(){if(!ne){a([...Bt()].sort((P,z)=>z.createdAt-P.createdAt));return}const{data:j,error:N}=await le.from("orders").select("*").order("created_at",{ascending:!1});if(N){E(N.message);return}a((j||[]).map(Hh))}async function R(){if(!ne){d(d_(qh));return}const{data:j,error:N}=await le.from("settings").select("*").eq("id",1).maybeSingle();if(N){E(N.message);return}j&&d({payoneerEmail:j.payoneer_email,supportEmail:j.support_email,currency:j.currency||"USD"})}async function b(j,N){if(!ne)return Bt().find(V=>V.id===j&&V.customer.email.trim().toLowerCase()===(N||"").trim().toLowerCase())||null;const{data:P,error:z}=await le.rpc("get_my_order",{p_order_id:j,p_email:N});return z||!P||P.length===0?null:Hh(P[0])}async function v(){const j=Er(gl,[]),N=[];for(const P of j){const z=await b(P.id,P.email);z&&N.push(z)}N.sort((P,z)=>z.createdAt-P.createdAt),c(N)}_.useEffect(()=>{(async()=>(ne||await m_(),await Promise.all([T(),R()]),g(!0)))()},[]);const C={products:t,adminProducts:n,orders:i,myOrders:l,settings:u,wishlist:h,recentSearches:p,cartItems:m,loaded:y,error:x,refreshProducts:T,refreshAdminProducts:S,refreshOrders:A,refreshMyOrders:v,lookupOrder:b,async setSettings(j){if(d(j),!ne){h_(j);return}const{error:N}=await le.from("settings").update({payoneer_email:j.payoneerEmail,support_email:j.supportEmail,currency:j.currency}).eq("id",1);N&&E(N.message)},async upsertProducts(j){const N=j.map(W=>lr(W));if(!ne){const W=Tn();N.forEach(V=>{const O=W.findIndex(U=>U.slug===V.slug);O>=0?W[O]={...V,id:W[O].id}:W.push(V)}),Os(W),await Promise.all([T(),S()]);return}const P=N.map(Mh),{error:z}=await le.from("products").upsert(P,{onConflict:"slug"});if(z){E(z.message);return}await Promise.all([T(),S()])},async updateProduct(j,N){const P=n.find(V=>V.id===j)||t.find(V=>V.id===j);if(!P)return;const z=lr({...P,...g_(P),...N,id:j});if(!ne){const V=Tn(),O=V.findIndex(U=>U.id===j);O>=0?V[O]=z:V.push(z),Os(V),await Promise.all([T(),S()]);return}const{error:W}=await le.from("products").update(Mh(z)).eq("id",j);if(W){E(W.message);return}await Promise.all([T(),S()])},async deleteProducts(j){if(!ne){Os(Tn().filter(P=>!j.includes(P.id))),await Promise.all([T(),S()]);return}const{error:N}=await le.from("products").delete().in("id",j);if(N){E(N.message);return}await Promise.all([T(),S()])},async replaceAllProducts(j){if(!ne){Os(j),await Promise.all([T(),S()]);return}const N=j.map(z=>z.id),P=n.filter(z=>!N.includes(z.id)).map(z=>z.id);P.length&&await le.from("products").delete().in("id",P),await Promise.all([T(),S()])},toggleWishlist(j){f(N=>N.includes(j)?N.filter(P=>P!==j):[...N,j])},pushRecentSearch(j){w(N=>[j,...N.filter(P=>P!==j)].slice(0,5))},addToCart(j,N){k(P=>[...P,{productId:j.id,format:N,price:j.formats[N].price}])},removeFromCart(j){k(N=>N.filter((P,z)=>z!==j))},clearCart(){k([])},async placeOrder(j){if(!ne)xr([j,...Bt()]);else{const{error:P}=await le.from("orders").insert(u_(j));if(P)throw E(P.message),P}k([]);const N=Er(gl,[]);tn(gl,[{id:j.id,email:j.customer.email},...N].slice(0,50)),yl("pending_payment",{orderId:j.id,email:j.customer.email})},async reportPaid(j){if(!ne){xr(Bt().map(z=>z.id===j?{...z,status:"payment_reported"}:z)),await A();return}const{error:N}=await le.from("orders").update({status:"payment_reported"}).eq("id",j);if(N){E(N.message);return}await A();const P=i.find(z=>z.id===j);P&&yl("payment_reported",{orderId:j,email:P.customer.email})},async markPaid(j){if(!ne){xr(Bt().map(P=>P.id===j?{...P,status:"paid"}:P)),await A();return}const{error:N}=await le.from("orders").update({status:"paid"}).eq("id",j);if(N){E(N.message);return}await A()},async approveAccess(j){const N=i.find(z=>z.id===j);if(!N)return;const P={};if(N.items.forEach(z=>{if(z.format!=="digital")return;const W=n.find(V=>V.id===z.productId);P[z.productId]=(W==null?void 0:W.deliveryLink)||"(No delivery link set on this product yet — add one in Admin > Products.)"}),!ne)xr(Bt().map(z=>z.id===j?{...z,status:"access_granted",accessLinks:P}:z));else{const{error:z}=await le.from("orders").update({status:"access_granted",access_links:P}).eq("id",j);if(z){E(z.message);return}}await A(),yl("access_granted",{orderId:j,email:N.customer.email})},async markShipped(j,N){if(!ne){xr(Bt().map(z=>z.id===j?{...z,status:"shipped",tracking:N}:z)),await A();return}const{error:P}=await le.from("orders").update({status:"shipped",tracking:N}).eq("id",j);if(P){E(P.message);return}await A()},async markCompleted(j){if(!ne){xr(Bt().map(P=>P.id===j?{...P,status:"completed"}:P)),await A();return}const{error:N}=await le.from("orders").update({status:"completed"}).eq("id",j);if(N){E(N.message);return}await A()},async cancelOrder(j){if(!ne){xr(Bt().map(P=>P.id===j?{...P,status:"cancelled"}:P)),await A();return}const{error:N}=await le.from("orders").update({status:"cancelled"}).eq("id",j);if(N){E(N.message);return}await A()},async refundOrder(j){if(!ne){xr(Bt().map(P=>P.id===j?{...P,status:"refunded"}:P)),await A();return}const{error:N}=await le.from("orders").update({status:"refunded"}).eq("id",j);if(N){E(N.message);return}await A()}};return o.jsx(kg.Provider,{value:C,children:e})}const Nc="za-demo-admin-session",v_="tvseriesarchive-preview";let Sg=typeof sessionStorage<"u"&&sessionStorage.getItem(Nc)==="1";const Ac=new Set;function Wh(e){Sg=e,Ac.forEach(t=>t(e))}function jg(){const[e,t]=_.useState(null),[r,n]=_.useState(!0),[s,i]=_.useState(Sg);return _.useEffect(()=>{if(!ne)return n(!1),Ac.add(i),()=>Ac.delete(i);le.auth.getSession().then(({data:l})=>{t(l.session),n(!1)});const{data:a}=le.auth.onAuthStateChange((l,c)=>t(c));return()=>a.subscription.unsubscribe()},[]),{session:e,loading:r,isAdmin:ne?!!e:s,isDemoMode:!ne,signIn:async(a,l)=>ne?le.auth.signInWithPassword({email:a,password:l}):l===v_?(sessionStorage.setItem(Nc,"1"),Wh(!0),{error:null}):{error:{message:"Incorrect preview password."}},signOut:async()=>{if(!ne){sessionStorage.removeItem(Nc),Wh(!1);return}return le.auth.signOut()}}}function x_(){const{signIn:e,isDemoMode:t}=jg(),[r,n]=_.useState(""),[s,i]=_.useState(""),[a,l]=_.useState(""),[c,u]=_.useState(!1),d=async h=>{h.preventDefault(),u(!0),l("");const{error:f}=await e(r,s);f&&l(f.message||"Sign-in failed. Check your email and password."),u(!1)};return o.jsx("div",{className:"max-w-sm mx-auto px-4 py-20",children:o.jsxs("div",{className:"za-card rounded-2xl p-6",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(Ja,{size:20,className:"za-gold"}),o.jsx("span",{className:"za-display text-lg",children:"TvSeriesArchive Admin"})]}),o.jsxs("p",{className:"text-xs za-ink-dim mb-5 flex items-center gap-1.5",children:[o.jsx(ah,{size:12})," ",t?"Preview Mode — local admin session":"Staff sign-in required"]}),t&&o.jsxs("div",{className:"za-surface2 rounded-lg px-3 py-2.5 mb-4 text-xs za-ink-dim leading-relaxed",children:["No real Supabase project connected yet, so this is a local-only preview session (this browser only, not real security). Default password: ",o.jsx("span",{className:"za-display text-current",children:"tvseriesarchive-preview"})," — change it via ",o.jsx("span",{className:"za-display text-current",children:"VITE_ADMIN_DEMO_PASSWORD"})," in ",o.jsx("span",{className:"za-display text-current",children:".env"}),"."]}),o.jsxs("form",{onSubmit:d,className:"flex flex-col gap-3",children:[!t&&o.jsx("input",{className:"za-input",type:"email",placeholder:"Email",value:r,onChange:h=>n(h.target.value),required:!0}),o.jsx("input",{className:"za-input",type:"password",placeholder:"Password",value:s,onChange:h=>i(h.target.value),required:!0,autoFocus:t}),a&&o.jsxs("p",{className:"text-xs za-warn flex items-center gap-1.5",children:[o.jsx(pr,{size:12})," ",a]}),o.jsxs("button",{type:"submit",disabled:c,className:"za-focus za-bg-gold text-[#141118] rounded-full py-2.5 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60",children:[c?o.jsx(It,{size:14,className:"za-spin"}):o.jsx(ah,{size:14})," Sign In"]})]}),!t&&o.jsx("p",{className:"text-[11px] za-ink-dim mt-4 leading-relaxed",children:"No account yet? Create one in your Supabase project under Authentication → Users → Add user."})]})})}function w_({children:e}){const{loading:t,isAdmin:r,signOut:n,isDemoMode:s}=jg();return t?o.jsxs("div",{className:"flex items-center justify-center py-24 za-ink-dim text-sm gap-2",children:[o.jsx(It,{size:16,className:"za-spin"})," Checking admin session…"]}):r?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between max-w-7xl mx-auto px-4 sm:px-6 pt-4",children:[s?o.jsx("span",{className:"text-xs za-warn",children:"Preview Mode — data is stored locally in this browser only"}):o.jsx("span",{}),o.jsxs("button",{onClick:n,className:"za-focus text-xs za-ink-dim hover:text-current flex items-center gap-1.5",children:[o.jsx(Vx,{size:12})," Sign out"]})]}),e]}):o.jsx(x_,{})}class Vh extends _.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){console.error("ErrorBoundary caught:",t,r)}render(){return this.state.hasError?this.props.fallback||o.jsx("div",{className:"za-card rounded-xl p-12 text-center za-ink-dim min-h-[40vh] flex items-center justify-center",children:o.jsxs("div",{children:[o.jsx("p",{className:"text-lg za-display mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-sm",children:"Please try refreshing the page."})]})}):this.props.children}}const b_=3*1024*1024;function __({onUploaded:e}){const[t,r]=_.useState("idle"),[n,s]=_.useState(""),i=async a=>{var f;const l=(f=a.target.files)==null?void 0:f[0];if(!l)return;if(r("uploading"),s(""),!ne){if(l.size>b_){r("error"),s("Image is too large for local preview (max 3MB). Use a smaller file, or a hosted image URL instead.");return}const p=new FileReader;p.onerror=()=>{r("error"),s("Couldn't read that file — try a different image.")},p.onload=()=>{e(p.result),r("done")},p.readAsDataURL(l);return}const c=l.name.replace(/[^a-zA-Z0-9.]/g,"-"),u=`${Date.now()}-${c}`,{error:d}=await le.storage.from("covers").upload(u,l,{upsert:!1,cacheControl:"3600"});if(d){r("error"),s(d.message);return}const{data:h}=le.storage.from("covers").getPublicUrl(u);e(h.publicUrl),r("done")};return o.jsxs("div",{children:[o.jsxs("label",{className:"za-focus inline-flex items-center gap-2 za-surface2 rounded-lg px-3 py-2 text-xs cursor-pointer w-fit",children:[t==="uploading"?o.jsx(It,{size:13,className:"za-spin"}):t==="done"?o.jsx(De,{size:13,className:"za-ok"}):o.jsx(qm,{size:13}),t==="uploading"?"Uploading…":t==="done"?"Uploaded":"Upload Image",o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:i})]}),!ne&&t==="idle"&&o.jsx("p",{className:"text-[11px] za-ink-dim mt-1",children:"Preview Mode: stored locally in this browser (max 3MB)."}),t==="error"&&o.jsxs("p",{className:"text-[11px] za-warn mt-1 flex items-center gap-1",children:[o.jsx(pr,{size:11})," ",n]})]})}const Eg=_.createContext(null),Du=()=>_.useContext(Eg),k_=2800,na=10,S_=1800,Kh=10,sa=["Good Choice!","Great Pick!","Nice Taste!","Excellent!","Love This One!","Solid Pick!","You'll Love It!","Archive Worthy!","Collector's Choice!","Well Chosen!","Instant Classic!","Now We're Talking!"];function j_(e,t,r,n,s){const i=1-e;return{x:i**3*t.x+3*i**2*e*r.x+3*i*e**2*n.x+e**3*s.x,y:i**3*t.y+3*i**2*e*r.y+3*i*e**2*n.y+e**3*s.y}}function E_(e){return e<.5?2*e*e:-1+(4-2*e)*e}function C_({start:e,end:t,coverStyle:r,onDone:n}){const s=_.useRef(null),i=_.useRef([]),a=_.useRef([]),l=_.useRef(),c=_.useRef(null),u=t.x-e.x,d={x:e.x+u*.2,y:e.y-180},h={x:e.x+u*.8,y:t.y-260};return _.useEffect(()=>{const f=s.current,p=f.querySelector(".za-fly-item"),w=f.querySelector(".za-fly-package"),m=f.querySelector(".za-pkg-fold"),k=f.querySelector(".za-pkg-tape-h"),y=f.querySelector(".za-pkg-tape-v"),g=f.querySelector(".za-pkg-lid");if(!f)return;function x(E){c.current==null&&(c.current=E);const T=E-c.current,S=Math.min(T/k_,1),A=E_(S),R=j_(A,e,d,h,t);i.current=[...i.current,R].slice(-na);const b=Math.max(0,Math.min(1,(A-.18)/.55)),v=540+A*180,C=Math.max(1-A*.55,.4)*1.15,j=Math.sin(T*.003)*(1-A)*8,N=Math.sin(A*Math.PI*2)*2.5,P=b<.5?1:Math.max(0,1-(b-.5)*2.5),z=b>.2?Math.min(1,(b-.2)/.5):0,W=b>.25?Math.min(1,(b-.25)/.35):0,V=b>.5?Math.min(1,(b-.5)/.25):0,O=b>.4?Math.min(1,(b-.4)/.2):0,U=(1-W)*60;f.style.transform=`translate(${R.x-23}px, ${R.y-27}px) rotate(${v}deg) scale(${C})`,f.style.filter=`blur(${N}px)`,p&&(p.style.opacity=P),w&&(w.style.opacity=z,w.style.transform=`translateY(${U}px)`),m&&(m.style.opacity=W),k&&(k.style.opacity=O),y&&(y.style.opacity=O),g&&(g.style.opacity=V,g.style.transform=`translateY(${(1-V)*-12}px)`);const L=i.current;for(let G=0;G<na;G++){const B=a.current[G];if(B)if(G<L.length){const I=L[G],D=G/na,xe=Math.sin(G*2.3)*.5+.5;B.style.display="block",B.style.transform=`translate(${I.x-3-xe*5}px, ${I.y-3-xe*5+j*D}px) scale(${.08+D*.5})`,B.style.opacity=D*(.3+b*.3)*(.6+xe*.4),B.style.width=B.style.height=`${6+xe*10}px`}else B.style.display="none"}S<1?l.current=requestAnimationFrame(x):n()}return l.current=requestAnimationFrame(x),()=>cancelAnimationFrame(l.current)},[]),o.jsxs("div",{ref:s,className:"za-fly-wrapper",style:{position:"fixed",zIndex:200,pointerEvents:"none",willChange:"transform",left:0,top:0},children:[Array.from({length:na}).map((f,p)=>o.jsx("div",{ref:w=>{w&&(a.current[p]=w)},className:"za-fly-trail",style:{position:"fixed",zIndex:199,borderRadius:"50%",pointerEvents:"none",background:"radial-gradient(circle, rgba(109,74,255,0.8), rgba(63,140,255,0) 70%)",filter:"blur(2px)",willChange:"transform",boxShadow:"0 0 10px 3px rgba(109,74,255,0.3)",display:"none"}},p)),o.jsx("div",{className:"za-fly-item",style:{...r,position:"absolute",inset:0,width:46,height:54,borderRadius:9,backgroundSize:"cover",backgroundPosition:"center",boxShadow:"0 0 22px 5px rgba(109,74,255,0.50), 0 8px 18px rgba(0,0,0,0.45)",willChange:"opacity"}}),o.jsxs("div",{className:"za-fly-package",style:{position:"absolute",inset:0,width:46,height:54,borderRadius:4,background:"linear-gradient(160deg, #6D4AFF, #7B5CFF, #3F8CFF)",boxShadow:"0 0 22px 5px rgba(109,74,255,0.50), 0 8px 18px rgba(0,0,0,0.45)",border:"1.5px solid rgba(0,0,0,0.15)",overflow:"hidden",willChange:"opacity, transform"},children:[o.jsx("div",{className:"za-pkg-fold",style:{position:"absolute",bottom:0,left:0,right:0,height:"100%",background:"repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 1px, transparent 1px, transparent 7px)"}}),o.jsx("div",{className:"za-pkg-tape za-pkg-tape-h",style:{position:"absolute",top:"50%",left:0,right:0,height:5,transform:"translateY(-50%)",background:"rgba(255,255,255,0.25)"}}),o.jsx("div",{className:"za-pkg-tape za-pkg-tape-v",style:{position:"absolute",left:"50%",top:0,bottom:0,width:5,transform:"translateX(-50%)",background:"rgba(255,255,255,0.25)"}}),o.jsx("div",{className:"za-pkg-lid",style:{position:"absolute",top:-5,left:-2,right:-2,height:8,background:"linear-gradient(160deg, #6D4AFF, #7B5CFF)",borderRadius:"2px 2px 0 0",border:"1.5px solid rgba(0,0,0,0.1)",borderBottom:"none",willChange:"opacity, transform"}})]})]})}function vl({x:e,y:t,baseColor:r}){const[n,s]=_.useState([]),[i,a]=_.useState([]);return _.useEffect(()=>{const l=Array.from({length:Kh},(d,h)=>{const f=h/Kh*360+Math.random()*18,p=30+Math.random()*70;return{id:h,dx:Math.cos(f*Math.PI/180)*p,dy:Math.sin(f*Math.PI/180)*p,size:2+Math.random()*6,delay:Math.random()*40}});s(l);const c=Array.from({length:6},(d,h)=>{const f=h/6*360+15;return{id:`s${h}`,dx:Math.cos(f*Math.PI/180)*50,dy:Math.sin(f*Math.PI/180)*50-20,delay:Math.random()*30}});a(c);const u=setTimeout(()=>{s([]),a([])},800);return()=>clearTimeout(u)},[]),o.jsxs(o.Fragment,{children:[n.map(l=>o.jsx("div",{className:"za-fly-particle",style:{left:e,top:t,"--dx":`${l.dx}px`,"--dy":`${l.dy}px`,"--size":`${l.size}px`,"--color":r,"--delay":`${l.delay}ms`}},l.id)),i.map(l=>o.jsx("div",{className:"za-fly-spark",style:{left:e,top:t,"--dx":`${l.dx}px`,"--dy":`${l.dy}px`,"--color":r,"--delay":`${l.delay}ms`}},l.id))]})}function N_({x:e,y:t,text:r,onDone:n}){const[s,i]=_.useState(!1);return _.useEffect(()=>{const a=setTimeout(()=>i(!0),50),l=setTimeout(n,S_);return()=>{clearTimeout(a),clearTimeout(l)}},[]),o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"za-fly-text",style:{left:e,top:t-28},children:r}),s&&o.jsxs(o.Fragment,{children:[o.jsx(vl,{x:e,y:t-40,baseColor:"#FF6B6B"}),o.jsx(vl,{x:e,y:t-40,baseColor:"#FFD93D"}),o.jsx(vl,{x:e,y:t-40,baseColor:"#4D96FF"})]})]})}function A_({arrivals:e,count:t,onClick:r}){const[n,s]=_.useState(!1),i=_.useRef(0);return _.useEffect(()=>{if(e>i.current){s(!0);const a=setTimeout(()=>s(!1),500);return i.current=e,()=>clearTimeout(a)}},[e]),o.jsxs("div",{className:`za-cart-target ${n?"za-cart-bump":""}`,onClick:r,children:[o.jsxs("svg",{className:"za-cart-icon",viewBox:"0 0 28 32",fill:"none",children:[o.jsx("rect",{x:"2",y:"10",width:"24",height:"18",rx:"3",stroke:"currentColor",strokeWidth:"1.6",fill:"none"}),o.jsx("path",{d:"M6 10V7C6 4.5 8 3 10.5 3H17.5C20 3 22 4.5 22 7V10",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"}),o.jsx("line",{x1:"4",y1:"14",x2:"24",y2:"14",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.jsx("rect",{x:"10",y:"3",width:"8",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("circle",{cx:"14",cy:"20",r:"2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]}),t>0&&o.jsx("div",{className:"za-cart-badge",children:t})]})}function Gh({onLand:e,onCartClick:t,cartCount:r=0,children:n}){const[s,i]=_.useState([]),[a,l]=_.useState([]),[c,u]=_.useState(0),d=_.useRef(0),h=_.useRef(-1),f=_.useCallback((m,k)=>{if(!m)return;const y=m.getBoundingClientRect(),g=window.innerWidth-50,x=window.innerHeight-112,E=++d.current,T={x:y.left+y.width/2,y:y.top+y.height/2},S={x:g,y:x};i(b=>[...b,{id:E,start:T,end:S,coverStyle:k}]);let A=Math.floor(Math.random()*sa.length);sa.length>1&&A===h.current&&(A=(A+1)%sa.length),h.current=A;const R=`t${E}`;l(b=>[...b,{id:R,x:T.x,y:T.y,text:sa[A]}])},[]),p=_.useCallback(m=>{i(k=>k.filter(y=>y.id!==m)),u(k=>k+1),e==null||e()},[e]),w=_.useCallback(m=>{l(k=>k.filter(y=>y.id!==m))},[]);return o.jsxs(Eg.Provider,{value:f,children:[n,a.map(m=>o.jsx(N_,{x:m.x,y:m.y,text:m.text,onDone:()=>w(m.id)},m.id)),s.map(m=>o.jsx(C_,{start:m.start,end:m.end,coverStyle:m.coverStyle,onDone:()=>p(m.id)},m.id)),o.jsx(A_,{arrivals:c,count:r,onClick:t})]})}const an="TvSeriesArchive",ot="https://tvseriesarchive.com",Lu="TvSeriesArchive — premium digital and USB archive for complete TV series collections. Westerns, sitcoms, dramas, crime, sci-fi, and more. Instant download or USB delivery worldwide.";function nt(e,t,r){if(r==null||r==="")return;let n=document.head.querySelector(`meta[${e}="${t}"]`);n||(n=document.createElement("meta"),n.setAttribute(e,t),document.head.appendChild(n)),n.setAttribute("content",r)}function T_(e){let t=document.head.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e)}function Ar(e,t="za-jsonld"){let r=document.getElementById(t);if(!e){r&&r.remove();return}r||(r=document.createElement("script"),r.type="application/ld+json",r.id=t,document.head.appendChild(r)),r.textContent=JSON.stringify(e)}const R_={"@context":"https://schema.org","@type":"Organization",name:an,url:ot,logo:`${ot}/logo.png`,description:Lu,sameAs:[]},P_={"@context":"https://schema.org","@type":"WebSite",name:an,url:ot,description:Lu,potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${ot}/listing?q={search_term_string}`},"query-input":"required name=search_term_string"}};function O_(){_.useEffect(()=>(Ar(R_,"za-org"),Ar(P_,"za-website"),()=>{Ar(null,"za-org"),Ar(null,"za-website")}),[])}function vn({title:e,description:t,path:r="/",image:n,keywords:s,jsonLd:i,noindex:a=!1,jsonLdExtra:l,robots:c}={}){_.useEffect(()=>{const u=e?`${e} | ${an}`:`${an} — Complete TV Series Collections, Worldwide Delivery`,d=t||Lu,h=`${ot}${r}`;return document.title=u,nt("name","description",d),s&&nt("name","keywords",s),nt("name","robots",c||(a?"noindex, nofollow":"index, follow")),nt("property","og:site_name",an),nt("property","og:title",u),nt("property","og:description",d),nt("property","og:type",n?"product":"website"),nt("property","og:url",h),n&&nt("property","og:image",n),nt("name","twitter:card",n?"summary_large_image":"summary"),nt("name","twitter:title",u),nt("name","twitter:description",d),n&&nt("name","twitter:image",n),T_(h),Ar(i,"page"),l&&l.forEach((f,p)=>Ar(f,`extra-${p}`)),()=>{Ar(null,"page"),l&&l.forEach((f,p)=>Ar(null,`extra-${p}`))}},[e,t,r,n,s,i,a,l,c])}function kk(e){return{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url?`${ot}${t.url}`:void 0}))}}function Sk(e){return{"@context":"https://schema.org","@type":"Article",headline:e.title,description:e.excerpt,author:{"@type":"Person",name:e.author},datePublished:e.publishedDate,dateModified:e.updatedDate||e.publishedDate,publisher:{"@type":"Organization",name:an,url:ot},mainEntityOfPage:{"@type":"WebPage","@id":`${ot}/blog/${e.slug}`}}}const jk=`${ot}/og-fallback.png`,z_=_.lazy(()=>yn(()=>import("./ExperimentalHome-BWb2gJcK.js"),__vite__mapDeps([0,1]))),I_=_.lazy(()=>yn(()=>import("./BlogPage-BdLxmWg8.js"),__vite__mapDeps([2,3,4,5]))),$_=_.lazy(()=>yn(()=>import("./BlogArticle-C6glRbDJ.js"),__vite__mapDeps([6,3,7,8,5]))),D_=_.lazy(()=>yn(()=>import("./BlogCategory-DMpPCWoT.js"),__vite__mapDeps([9,3,4,8,5]))),L_=_.lazy(()=>yn(()=>import("./BlogTag-CY2LIrMN.js"),__vite__mapDeps([10,3,4,8,5]))),F_=_.lazy(()=>yn(()=>import("./BlogAuthor-VQaC9iof.js"),__vite__mapDeps([11,3,7,4,8]))),U_=_.lazy(()=>yn(()=>import("./NotFoundPage-B1RKt2Fy.js"),[]));function B_(e,t={}){switch(e){case"home":return"/";case"listing":{const r=new URLSearchParams;t.genre&&r.set("genre",t.genre),t.decade&&r.set("decade",t.decade),t.format&&r.set("format",t.format),t.sort&&r.set("sort",t.sort),t.query&&r.set("q",t.query),t.wishlistOnly&&r.set("wishlist","1");const n=r.toString();return`/collections${n?`?${n}`:""}`}case"detail":return`/show/${encodeURIComponent(t.slug||"")}`;case"checkout":return"/checkout";case"confirmation":{const r=new URLSearchParams;return t.email&&r.set("email",t.email),`/order-confirmation/${encodeURIComponent(t.orderId||"")}?${r.toString()}`}case"myorders":return"/my-orders";case"trust":return`/pages/${encodeURIComponent(t.page||"contact")}`;case"blog":{const r=new URLSearchParams;t.page&&t.page>1&&r.set("page",t.page),t.query&&r.set("q",t.query);const n=r.toString();return`/blog${n?`?${n}`:""}`}case"blog-article":return`/blog/${encodeURIComponent(t.slug||"")}`;case"blog-category":return`/blog/category/${encodeURIComponent(t.slug||"")}`;case"blog-tag":return`/blog/tag/${encodeURIComponent(t.slug||"")}`;case"blog-author":return`/blog/author/${encodeURIComponent(t.slug||"")}`;case"notfound":return"/404";case"admin":return"/zqx!";case"designlab":return"/design-lab";default:return"/"}}function M_(e,t){const r=new URLSearchParams(t);if(e==="/")return{view:"home",params:{}};if(e==="/collections")return{view:"listing",params:{genre:r.get("genre")||void 0,decade:r.get("decade")||void 0,format:r.get("format")||void 0,sort:r.get("sort")||void 0,query:r.get("q")||void 0,wishlistOnly:r.get("wishlist")==="1"}};const n=e.match(/^\/show\/([^/]+)$/);if(n)return{view:"detail",params:{slug:decodeURIComponent(n[1])}};if(e==="/checkout")return{view:"checkout",params:{}};const s=e.match(/^\/order-confirmation\/([^/]+)$/);if(s)return{view:"confirmation",params:{orderId:decodeURIComponent(s[1]),email:r.get("email")||""}};if(e==="/my-orders")return{view:"myorders",params:{}};if(e==="/blog")return{view:"blog",params:{page:Number(r.get("page"))||1,query:r.get("q")||void 0}};const i=e.match(/^\/blog\/category\/([^/]+)$/);if(i)return{view:"blog-category",params:{slug:decodeURIComponent(i[1])}};const a=e.match(/^\/blog\/tag\/([^/]+)$/);if(a)return{view:"blog-tag",params:{slug:decodeURIComponent(a[1])}};const l=e.match(/^\/blog\/author\/([^/]+)$/);if(l)return{view:"blog-author",params:{slug:decodeURIComponent(l[1])}};const c=e.match(/^\/blog\/([^/]+)$/);if(c)return{view:"blog-article",params:{slug:decodeURIComponent(c[1])}};const u=e.match(/^\/pages\/([^/]+)$/);return u?{view:"trust",params:{page:u[1]}}:e==="/zqx!"?{view:"admin",params:{}}:e==="/design-lab"?{view:"designlab",params:{}}:e==="/404"?{view:"notfound",params:{}}:{view:"notfound",params:{}}}const H_=["Columbo","Western","1980s","British Sitcoms","Falcon Crest","Sci-Fi"],xl=24,wl=20,q_={dark:{"--bg":"#050711","--bg-1":"#080B17","--bg-2":"#0B1020","--surface":"#0E1222","--surface-1":"#12172A","--surface-2":"rgba(15,19,38,0.78)","--ink":"#F7F8FC","--ink-dim":"#A7ABC0","--ink-muted":"#70768F","--purple":"#6D4AFF","--purple-light":"#7B5CFF","--blue":"#3F8CFF","--blue-light":"#36C5FF","--pink":"#D946EF","--green":"#42D392","--amber":"#FFB800","--line":"rgba(255,255,255,0.10)","--line-active":"rgba(109,74,255,0.65)","--shadow-card":"0 18px 45px rgba(0,0,0,0.30)","--shadow-neon":"0 0 0 1px rgba(109,74,255,0.35), 0 18px 50px rgba(67,50,180,0.20)","--shadow-btn":"0 10px 30px rgba(109,74,255,0.30)","--glass":"rgba(12,16,32,0.75)","--glass-line":"rgba(255,255,255,0.10)","--ok":"#42D392","--warn":"#FFB800"},light:{"--bg":"#FAF6EC","--surface":"#FFFFFF","--surface2":"#F3ECDA","--ink":"#211C14","--ink-dim":"#736A57","--gold":"#A9812F","--gold-bright":"#8C6B23","--wine":"#7A2732","--line":"#E6DCC3","--shadow":"rgba(90,70,30,0.15)","--glass":"rgba(255,255,255,0.5)","--glass-line":"rgba(120,100,60,0.18)","--ok":"#3E7D49","--warn":"#A15F1E"}};function Jh(){return o.jsx("style",{children:`
      @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=Sora:wght@400;600;700&display=swap');
      .za-root{ background:var(--bg); color:var(--ink); font-family:'Inter','Manrope','Archivo',sans-serif; transition:background .3s ease,color .3s ease; }
      .za-display{ font-family:'Space Grotesk','Sora','Manrope',sans-serif; }
      .za-surface{ background:var(--surface); } .za-surface2{ background:var(--surface-1); }
      .za-ink-dim{ color:var(--ink-dim); } .za-gold{ color:var(--purple); } .za-bg-gold{ background:linear-gradient(135deg,#6D4AFF,#7B5CFF,#3F8CFF); }
      .za-border{ border-color:var(--line); } .za-wine{ background:linear-gradient(135deg,#6D4AFF,#3F8CFF); }
      .za-ok{ color:var(--ok); } .za-warn{ color:var(--warn); }
      .za-shadow{ box-shadow:var(--shadow-card); }
      .za-glass{ background:var(--glass); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); border:1px solid var(--glass-line); }
      .za-card{ background:var(--surface); border:1px solid var(--line); transition:transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease; }
      .za-card-hover:hover{ transform:translateY(-5px); box-shadow:var(--shadow-neon); }
      .za-neon-card{ background:var(--surface); border:1px solid rgba(255,255,255,0.06); transition:all .3s cubic-bezier(.2,.8,.2,1); }
      .za-neon-card:hover{ transform:translateY(-5px); border-color:rgba(109,74,255,0.5); box-shadow:var(--shadow-neon); }
      .za-focus:focus-visible{ outline:2px solid var(--purple); outline-offset:2px; border-radius:6px; }
      ::selection{ background:var(--purple); color:#fff; }
      .za-input{ background:var(--surface-1); border:1px solid var(--line); border-radius:10px; padding:9px 12px; font-size:14px; color:var(--ink); outline:none; width:100%; }
      .za-input:focus{ border-color:var(--purple); box-shadow:0 0 0 3px rgba(109,74,255,0.15); }
      .za-btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius:13px; font-family:'Space Grotesk',sans-serif; transition:all .25s cubic-bezier(.34,1.56,.64,1); cursor:pointer; }
      .za-btn-primary{ background:linear-gradient(135deg,#6D4AFF,#7B5CFF,#3F8CFF); color:#fff; box-shadow:0 10px 30px rgba(109,74,255,0.30); padding:16px 28px; font-size:15px; font-weight:600; letter-spacing:0.02em; }
      .za-btn-primary:hover{ transform:translateY(-2px); box-shadow:0 15px 40px rgba(109,74,255,0.45); }
      .za-btn-secondary{ background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.12); color:var(--ink); padding:14px 24px; font-size:14px; backdrop-filter:blur(8px); }
      .za-btn-secondary:hover{ border-color:rgba(109,74,255,0.5); background:rgba(109,74,255,0.1); }
      .za-hero{ position:relative; background:linear-gradient(135deg, #050711 0%, #0B1020 55%, #080B17 100%); }
      .za-grain{ position:absolute; inset:0; pointer-events:none; opacity:0.45; mix-blend-mode:overlay;
        background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/></svg>");
        animation: za-grain-shift 1.2s steps(4) infinite; }
      @keyframes za-grain-shift{ 0%{transform:translate(0,0)} 25%{transform:translate(-2%,1%)} 50%{transform:translate(1%,-2%)} 75%{transform:translate(-1%,-1%)} 100%{transform:translate(0,0)} }
      .za-crt{ position:absolute; inset:0; pointer-events:none; opacity:0.18;
        background:repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0px, transparent 1px, transparent 3px);
        animation: za-crt-scroll 9s linear infinite; }
      @keyframes za-crt-scroll{ from{ background-position-y:0 } to{ background-position-y:900px } }
      .za-orb{ position:absolute; border-radius:50%; filter:blur(80px); opacity:0.30; pointer-events:none; }
      .za-orb-1{ width:380px; height:380px; background:#6D4AFF; top:-100px; left:-5%; animation: za-float-1 18s ease-in-out infinite; }
      .za-orb-2{ width:300px; height:300px; background:#3F8CFF; bottom:-80px; right:5%; animation: za-float-2 20s ease-in-out infinite; }
      @keyframes za-float-1{ 0%,100%{ transform:translate(0,0) scale(1)} 50%{ transform:translate(40px,50px) scale(1.05)} }
      @keyframes za-float-2{ 0%,100%{ transform:translate(0,0) scale(1)} 50%{ transform:translate(-30px,-35px) scale(1.08)} }
      .za-marquee-track{ animation: za-marquee 30s linear infinite; }
      @keyframes za-marquee{ from{ transform:translateX(0);} to{ transform:translateX(-50%);} }
      .za-pat-rings{ background-image: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.10) 0, rgba(255,255,255,0.10) 2px, transparent 3px, transparent 22px); }
      .za-pat-diagonal{ background-image: repeating-linear-gradient(115deg, rgba(109,74,255,0.08) 0 2px, transparent 2px 18px); }
      .za-pat-dots{ background-image: radial-gradient(rgba(109,74,255,0.12) 1.2px, transparent 1.2px); background-size:14px 14px; }
      .za-pat-sunburst{ background-image: conic-gradient(from 0deg, rgba(63,140,255,0.08) 0deg 8deg, transparent 8deg 20deg); }
      .za-skeleton{ background:linear-gradient(90deg, var(--surface-1) 25%, var(--line) 37%, var(--surface-1) 63%); background-size:400% 100%; animation:za-shimmer 1.4s ease infinite; }
      @keyframes za-shimmer{ 0%{background-position:100% 50%} 100%{background-position:0 50%} }
      .za-toast{ animation: za-toast-in .35s cubic-bezier(.2,.8,.2,1); }
      @keyframes za-toast-in{ from{ opacity:0; transform:translateY(12px) scale(.97);} to{ opacity:1; transform:translateY(0) scale(1);} }
      .za-fade-view{ animation: za-fadeUp .45s ease both; }
      @keyframes za-fadeUp{ from{ opacity:0; transform:translateY(10px);} to{ opacity:1; transform:translateY(0);} }
      .za-quick-overlay{ opacity:0; transform:translateY(8px); transition:opacity .25s ease, transform .25s ease; pointer-events:none; }
      .group:hover .za-quick-overlay, .za-quick-overlay:focus-within{ opacity:1; transform:translateY(0); pointer-events:auto; }
      .za-spin{ animation: za-spin 1s linear infinite; } @keyframes za-spin{ to{ transform:rotate(360deg); } }
      .za-fly-wrapper{ position:fixed; z-index:200; pointer-events:none; will-change:transform,left,top,filter; }
      .za-fly-wrapper .za-fly-item{ position:absolute; inset:0; width:46px; height:54px; border-radius:9px;
        background-size:cover; background-position:center; box-shadow:0 0 22px 5px rgba(109,74,255,0.50), 0 8px 18px rgba(0,0,0,0.45);
        transition:opacity 0.08s ease; }
      .za-fly-trail{ position:fixed; z-index:199; border-radius:50%; pointer-events:none;
        background:radial-gradient(circle, rgba(109,74,255,0.8), rgba(63,140,255,0) 70%);
        filter:blur(2px); will-change:transform,left,top;
        box-shadow:0 0 10px 3px rgba(109,74,255,0.3); }
      .za-fly-package{ position:absolute; inset:0; width:46px; height:54px; border-radius:4px; pointer-events:none;
        background:linear-gradient(160deg, #6D4AFF, #7B5CFF, #3F8CFF); box-shadow:0 0 22px 5px rgba(109,74,255,0.50), 0 8px 18px rgba(0,0,0,0.45);
        border:1.5px solid rgba(0,0,0,0.15); overflow:hidden; }
      .za-pkg-fold{ position:absolute; bottom:0; left:0; right:0; height:100%;
        background:repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 1px, transparent 1px, transparent 7px); }
      .za-pkg-lid{ position:absolute; top:-5px; left:-2px; right:-2px; height:8px;
        background:linear-gradient(160deg, #6D4AFF, #7B5CFF); border-radius:2px 2px 0 0;
        border:1.5px solid rgba(0,0,0,0.1); border-bottom:none; transition:transform 0.1s ease, opacity 0.1s ease; }
      .za-pkg-tape{ position:absolute; background:rgba(255,255,255,0.25); transition:opacity 0.08s ease; }
      .za-pkg-tape-h{ top:50%; left:0; right:0; height:5px; transform:translateY(-50%); }
      .za-pkg-tape-v{ left:50%; top:0; bottom:0; width:5px; transform:translateX(-50%); }
      @keyframes za-cart-bump{ 0%{ transform:scale(1); } 30%{ transform:scale(1.35); } 55%{ transform:scale(0.9); } 100%{ transform:scale(1); } }
      .za-cart-target{ position:fixed; z-index:250; bottom:90px; right:28px; width:44px; height:44px;
        cursor:pointer;
        background:rgba(12,16,32,0.8); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
        border:1px solid rgba(109,74,255,0.3); border-radius:14px;
        display:flex; align-items:center; justify-content:center;
        box-shadow:0 8px 32px rgba(0,0,0,0.3), 0 0 20px rgba(109,74,255,0.15);
        transition:transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s ease; }
      .za-cart-target.za-cart-bump{ transform:scale(1.15); box-shadow:0 8px 40px rgba(109,74,255,0.3), inset 0 1px 0 rgba(255,255,255,0.15); }
      .za-cart-icon{ width:22px; height:24px; color:#6D4AFF; filter:drop-shadow(0 0 6px rgba(109,74,255,0.4)); }
      .za-cart-badge{ position:absolute; top:-4px; right:-4px; width:18px; height:18px;
        background:linear-gradient(135deg,#6D4AFF,#3F8CFF); color:#fff; font-size:9px; font-weight:700;
        font-family:'Space Grotesk',sans-serif; border-radius:50%;
        display:flex; align-items:center; justify-content:center;
        box-shadow:0 0 10px rgba(109,74,255,0.5); }
      .za-fly-text{ position:fixed; z-index:210; pointer-events:none; white-space:nowrap;
        font-family:'Space Grotesk',sans-serif; font-weight:900; font-size:25px;
        letter-spacing:0.04em; color:#fff;
        text-shadow:
          0 0 20px rgba(109,74,255,0.8), 0 2px 8px rgba(0,0,0,0.3);
        animation: za-fly-text 1800ms cubic-bezier(.2,.8,.2,1) forwards; }
      @keyframes za-fly-text{
        0%{ opacity:0; transform:translate(-50%,-50%) scale(0.15) translateY(12px); filter:blur(4px); }
        10%{ opacity:1; transform:translate(-50%,-50%) scale(1.35) translateY(-2px); filter:blur(0); }
        25%{ opacity:1; transform:translate(-50%,-50%) scale(1) translateY(-10px); }
        100%{ opacity:0; transform:translate(-50%,-50%) scale(0.8) translateY(-95px); filter:blur(2px); }
      }
      .za-fly-particle{ position:fixed; z-index:197; width:var(--size); height:var(--size); border-radius:50%;
        pointer-events:none; background:var(--color); animation: za-particle-burst 700ms ease-out var(--delay) forwards; opacity:0;
        box-shadow:0 0 8px 3px var(--color); }
      @keyframes za-particle-burst{
        0%{ opacity:0; transform:translate(0,0) scale(0.5); }
        12%{ opacity:1; transform:translate(calc(var(--dx)*0.25),calc(var(--dy)*0.25)) scale(1.5); }
        100%{ opacity:0; transform:translate(var(--dx),var(--dy)) scale(0.1); }
      }
      .za-fly-spark{ position:fixed; z-index:196; width:3px; height:14px; border-radius:2px;
        pointer-events:none; background:var(--color); animation: za-spark-burst 500ms ease-out var(--delay) forwards; opacity:0;
        box-shadow:0 0 10px 4px var(--color); }
      @keyframes za-spark-burst{
        0%{ opacity:0; transform:translate(0,0) rotate(0deg) scaleY(0); }
        20%{ opacity:1; transform:translate(calc(var(--dx)*0.4),calc(var(--dy)*0.4)) rotate(45deg) scaleY(1); }
        100%{ opacity:0; transform:translate(var(--dx),var(--dy)) rotate(90deg) scaleY(0.2); }
      }
      .blog-content h2{ font-family:'Space Grotesk','Sora','Manrope',sans-serif; font-size:1.5rem; margin-top:2rem; margin-bottom:0.75rem; line-height:1.2; color:var(--ink); }
      .blog-content h3{ font-family:'Space Grotesk','Sora','Manrope',sans-serif; font-size:1.2rem; margin-top:1.5rem; margin-bottom:0.5rem; line-height:1.3; color:var(--ink); }
      .blog-content p{ color:var(--ink-dim); line-height:1.75; margin-bottom:1rem; font-size:0.95rem; }
      .blog-content ul,.blog-content ol{ color:var(--ink-dim); line-height:1.75; margin-bottom:1rem; padding-left:1.5rem; font-size:0.95rem; }
      .blog-content li{ margin-bottom:0.35rem; }
      .blog-content strong{ color:var(--ink); }
      .blog-content a{ color:var(--purple); text-decoration:underline; }
      .blog-content a:hover{ opacity:0.8; }
      @media (prefers-reduced-motion: reduce){
        .za-marquee-track,.za-grain,.za-crt,.za-orb-1,.za-orb-2,.za-skeleton,.za-fade-view{ animation:none !important; }
      }
    `})}function Fu(e,t){_.useEffect(()=>{const r=n=>{!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t])}async function W_(e){const t=await fetch("/api/enrich",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({titles:e})}),r=await t.json();if(!t.ok)throw new Error(r.error||"Enrichment request failed");if(!Array.isArray(r.result))throw new Error("Unexpected response shape from /api/enrich");return r.result}function V_(e,t={}){const r=Number(e.confidence)||0;return lr({...t,title:e.title||e.input||t.title,years:e.years||t.years||"",genres:(e.genres||[]).filter(n=>pn.includes(n)),country:e.country||t.country||"USA",language:e.language||"English",decades:(e.decades||[]).filter(n=>wi.includes(n)),seasons:e.seasons||t.seasons||1,episodes:e.episodes||t.episodes||0,cast:Array.isArray(e.cast)?e.cast.slice(0,3):[],shortDesc:e.shortDesc||t.shortDesc,aiConfidence:r,needsReview:r<75})}function wa(e){if(e.coverUrl)return{backgroundImage:`url(${e.coverUrl})`};const[t,r]=e.palette;return{background:`linear-gradient(155deg, ${t}, ${r})`}}function qr({product:e,className:t="",eager:r=!1}){if(e.coverUrl)return o.jsx("img",{src:e.coverUrl,alt:`${e.displayTitle} — Complete TV Series Collection`,loading:r?"eager":"lazy",className:`object-cover ${t}`});const[n,s]=e.palette;return o.jsxs("div",{className:`za-pat-${e.pattern} relative flex flex-col justify-end overflow-hidden ${t}`,style:{background:`linear-gradient(155deg, ${n}, ${s}22 70%, ${n})`},children:[o.jsx(mc,{size:16,style:{color:s},strokeWidth:1.5,className:"absolute left-3 top-1/2 -translate-y-1/2 z-10"}),o.jsx("span",{className:"za-display text-[10px] tracking-[0.2em] uppercase absolute right-3 top-1/2 -translate-y-1/2 z-10",style:{color:s},children:e.decades[0]}),o.jsxs("div",{className:"p-3 relative z-10",children:[o.jsx("p",{className:"za-display text-lg leading-tight",style:{color:"#F7F8FC"},children:e.title}),o.jsx("p",{className:"text-[11px] tracking-wide mt-1",style:{color:s},children:e.years})]})]})}function io({value:e,size:t=13}){const r=Math.round(e);return o.jsx("div",{className:"flex items-center gap-0.5","aria-label":`${e.toFixed(1)} / 5`,children:[1,2,3,4,5].map(n=>o.jsx(Mm,{size:t,strokeWidth:1.5,className:n<=r?"text-[#FFB800]":"za-ink-dim",fill:n<=r?"currentColor":"none"},n))})}function K_(e){const t=[];return e.newArrival&&t.push({label:"New",tone:"gold"}),e.bestSeller&&t.push({label:"Best Seller",tone:"wine"}),e.reviewCount>60&&t.push({label:"Popular",tone:"neutral"}),e.limited&&t.push({label:"Limited",tone:"wine"}),e.isHD||t.push({label:"DVD Quality",tone:"neutral"}),t.slice(0,3)}function G_({label:e,tone:t}){const r=t==="gold"?"bg-gradient-to-r from-purple-500/20 to-blue-500/20 text-purple-300 border border-purple-500/30":t==="wine"?"za-wine text-white":"za-glass";return o.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded-full ${r}`,children:e})}function J_({product:e,onOpen:t,onQuickView:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i}=Re();Du();const a=s.includes(e.id);return o.jsxs("div",{className:"group za-neon-card rounded-[17px] overflow-hidden flex flex-col cursor-pointer relative",onClick:()=>t(e.slug),children:[o.jsxs("div",{className:"relative overflow-hidden",children:[o.jsx("div",{className:"transition-transform duration-500 group-hover:scale-[1.06] aspect-[4/5]",children:o.jsx(qr,{product:e,className:"w-full h-full"})}),o.jsx("div",{className:"absolute top-2 left-2 flex flex-col gap-1 items-start z-20",children:K_(e).map(l=>o.jsx(G_,{...l},l.label))}),o.jsx("button",{onClick:l=>{l.stopPropagation(),i(e.id)},"aria-label":"Toggle wishlist",className:"za-focus absolute top-2 right-2 z-20 p-1.5 rounded-full bg-black/40 backdrop-blur-sm border border-white/10",children:o.jsx(Co,{size:14,className:a?"text-purple-400":"text-white/70",fill:a?"currentColor":"none"})}),o.jsxs("div",{className:"za-quick-overlay absolute bottom-0 left-0 right-0 p-3 flex gap-2 z-20",children:[o.jsxs("button",{onClick:l=>{l.stopPropagation(),r(e)},className:"za-focus bg-white/10 backdrop-blur-md flex-1 flex items-center justify-center gap-1.5 rounded-lg py-2.5 text-xs text-white/90 border border-white/10 hover:bg-white/20",children:[o.jsx(Fm,{size:13})," Quick View"]}),o.jsxs("button",{onClick:l=>{l.stopPropagation(),n(e,l.currentTarget)},className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white flex-1 flex items-center justify-center gap-1.5 rounded-lg py-2.5 text-xs shadow-lg shadow-purple-500/20",children:[o.jsx(or,{size:13})," Add"]})]})]}),o.jsxs("div",{className:"p-4 flex flex-col gap-1.5 flex-1",children:[o.jsx("h3",{className:"za-display text-sm leading-snug truncate",children:e.displayTitle}),o.jsxs("p",{className:"text-xs za-ink-dim",children:[e.years,e.years&&" · ",e.genres[0]]}),o.jsx("div",{className:"flex items-center gap-2 mt-0.5",children:o.jsx(io,{value:e.rating})}),o.jsxs("div",{className:"flex items-center justify-between mt-auto pt-2",children:[o.jsxs("div",{className:"flex gap-1.5",children:[e.formats.digital.available&&o.jsxs("span",{className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-purple-300/80",children:[o.jsx(hn,{size:10})," Digital"]}),e.formats.usb.available&&o.jsxs("span",{className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-blue-300/80",children:[o.jsx(fn,{size:10})," USB"]})]}),o.jsxs("span",{className:"za-display text-sm text-purple-400",children:["$",e.formats.digital.price.toFixed(2),"+"]})]})]})]})}function Y_(){return o.jsxs("div",{className:"rounded-[17px] overflow-hidden bg-[#0E1222] border border-[rgba(255,255,255,0.06)]",children:[o.jsx("div",{className:"za-skeleton aspect-[4/5] w-full"}),o.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[o.jsx("div",{className:"za-skeleton h-4 w-4/5 rounded"}),o.jsx("div",{className:"za-skeleton h-3 w-3/5 rounded"})]})]})}function Cg({items:e,onOpen:t,onQuickView:r,onShowAddMenu:n,loading:s}){return s?o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5",children:Array.from({length:5}).map((i,a)=>o.jsx(Y_,{},a))}):o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5",children:e.map(i=>o.jsx(J_,{product:i,onOpen:t,onQuickView:r,onShowAddMenu:n},i.id))})}function En({eyebrow:e,title:t,action:r,onAction:n}){return o.jsxs("div",{className:"flex items-end justify-between mb-5",children:[o.jsxs("div",{children:[e&&o.jsx("p",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-blue-400 text-xs uppercase tracking-[0.2em] mb-1 font-semibold",children:e}),o.jsx("h2",{className:"za-display text-[28px] sm:text-[36px] text-white",children:t})]}),r&&o.jsxs("button",{onClick:n,className:"za-focus text-sm za-ink-dim hover:text-white flex items-center gap-1 shrink-0 hover:drop-shadow-[0_0_8px_rgba(109,74,255,0.4)]",children:[r," ",o.jsx(sn,{size:15})]})]})}function Q_({onNavigateDetail:e,onRunSearch:t}){const{products:r,recentSearches:n,pushRecentSearch:s}=Re(),[i,a]=_.useState(""),[l,c]=_.useState(!1),[u,d]=_.useState(-1),h=_.useRef(null);Fu(h,()=>c(!1));const f=_.useMemo(()=>{if(!i)return[];const m=i.toLowerCase(),k=[];for(const y of r)if(y.enabled&&(y.title.toLowerCase().includes(m)||y.genres.some(g=>g.toLowerCase().includes(m))||y.cast.some(g=>g.toLowerCase().includes(m))||y.years.includes(m))&&(k.push(y),k.length>=6))break;return k},[i,r]),p=(m,k)=>{s(m),c(!1),a(""),k?e(k):t(m)},w=m=>{l&&(m.key==="ArrowDown"&&(m.preventDefault(),d(k=>Math.min(k+1,f.length-1))),m.key==="ArrowUp"&&(m.preventDefault(),d(k=>Math.max(k-1,0))),m.key==="Enter"&&(m.preventDefault(),u>=0&&f[u]?p(f[u].title,f[u].slug):i&&p(i)),m.key==="Escape"&&c(!1))};return o.jsxs("div",{ref:h,className:"relative w-full",children:[o.jsxs("div",{className:"flex items-center bg-white/5 border border-white/[0.08] rounded-full px-4 py-2.5 gap-2",children:[o.jsx(as,{size:16,className:"text-[#70768F] shrink-0"}),o.jsx("input",{value:i,onFocus:()=>c(!0),onChange:m=>{a(m.target.value),d(-1)},onKeyDown:w,placeholder:"Search titles, cast, genre, or decade…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white"}),i&&o.jsx("button",{onClick:()=>a(""),className:"za-focus",children:o.jsx(xt,{size:14,className:"text-[#70768F]"})})]}),l&&o.jsx("div",{className:"absolute top-full mt-2 left-0 right-0 bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[17px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] overflow-hidden z-50 max-h-[70vh] overflow-y-auto",children:i.length===0?o.jsxs("div",{className:"p-4",children:[o.jsxs("p",{className:"text-[11px] uppercase tracking-widest text-[#70768F] mb-2 flex items-center gap-1.5",children:[o.jsx(Ga,{size:12})," Trending Searches"]}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:H_.map(m=>o.jsx("button",{onClick:()=>p(m),className:"za-focus bg-white/5 rounded-full px-3 py-1.5 text-xs text-[#A7ABC0] hover:bg-gradient-to-r hover:from-purple-500/20 hover:to-blue-500/20 hover:text-white transition-all",children:m},m))}),n.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-[11px] uppercase tracking-widest text-[#70768F] mb-2 flex items-center gap-1.5",children:[o.jsx(Ou,{size:12})," Recent Searches"]}),o.jsx("div",{className:"flex flex-col",children:n.map(m=>o.jsx("button",{onClick:()=>p(m),className:"za-focus text-left px-2 py-1.5 rounded hover:bg-white/5 text-sm text-[#A7ABC0] hover:text-white",children:m},m))})]})]}):f.length===0?o.jsxs("div",{className:"p-6 text-sm text-[#70768F] text-center",children:['No matches for "',i,'" — try a genre, decade, or actor.']}):o.jsx("div",{className:"py-2",children:f.map((m,k)=>o.jsxs("button",{onMouseDown:()=>p(m.title,m.slug),className:`za-focus w-full text-left px-3 py-2 flex items-center gap-3 ${u===k?"bg-white/5":"hover:bg-white/5"}`,children:[o.jsx(qr,{product:m,className:"w-10 h-12 shrink-0 rounded-lg"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"za-display text-sm truncate text-white",children:m.title}),o.jsxs("p",{className:"text-xs text-[#70768F]",children:[m.years," · ",m.genres[0]]})]})]},m.id))})})]})}function X_({onNav:e}){const{products:t}=Re(),[r,n]=_.useState(!1),s=_.useRef(null);Fu(s,()=>n(!1));const i=_.useMemo(()=>[...t].filter(a=>a.enabled).sort((a,l)=>l.rating*Math.log(l.reviewCount+2)-a.rating*Math.log(a.reviewCount+2)).slice(0,10),[t]);return o.jsxs("div",{ref:s,className:"relative",children:[o.jsxs("button",{onClick:()=>n(a=>!a),className:`za-focus hover:text-white transition-colors flex items-center gap-1 ${r?"text-white":"text-[#A7ABC0]"}`,children:[o.jsx(Ga,{size:14})," Top 10 ",o.jsx(Ai,{size:13,className:`transition-transform ${r?"rotate-180":""}`})]}),r&&o.jsxs("div",{className:"absolute top-full right-0 mt-2 w-80 bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[17px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] overflow-hidden z-50 max-h-[70vh] overflow-y-auto",children:[o.jsxs("div",{className:"p-3 border-b border-[rgba(255,255,255,0.06)] flex items-center gap-1.5 text-[11px] uppercase tracking-widest text-[#70768F]",children:[o.jsx(Ga,{size:12})," Top 10 Right Now"]}),o.jsxs("div",{className:"py-1",children:[i.map((a,l)=>o.jsxs("button",{onClick:()=>{n(!1),e("detail",{slug:a.slug})},className:"za-focus w-full text-left px-3 py-2 flex items-center gap-3 hover:bg-white/5",children:[o.jsx("span",{className:"za-display text-lg text-transparent bg-clip-text bg-gradient-to-br from-purple-400 to-blue-400 w-5 shrink-0 text-center",children:l+1}),o.jsx(qr,{product:a,className:"w-9 h-11 shrink-0 rounded-lg"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"za-display text-sm truncate text-white",children:a.title}),o.jsxs("p",{className:"text-xs text-[#70768F]",children:[a.years," · ",a.genres[0]]})]})]},a.id)),i.length===0&&o.jsx("p",{className:"px-3 py-4 text-sm text-[#70768F]",children:"No titles yet."})]}),o.jsx("button",{onClick:()=>{n(!1),e("listing",{sort:"popularity"})},className:"za-focus w-full text-center py-2.5 text-xs text-purple-400 border-t border-[rgba(255,255,255,0.06)] hover:bg-white/5",children:"See all popular titles"})]})]})}function Z_({theme:e,setTheme:t,onNav:r,currentView:n}){const{wishlist:s}=Re(),[i,a]=_.useState(!1);return o.jsx("header",{className:"sticky top-0 z-40 za-glass border-b border-[rgba(255,255,255,0.06)]",children:o.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12",children:[o.jsxs("div",{className:"flex items-center justify-between h-16 gap-4",children:[o.jsxs("button",{onClick:()=>r("home"),className:"exp-logo",children:[o.jsx("img",{src:"/logo.webp",alt:"TvSeriesArchive",style:{height:38,width:"auto",borderRadius:6}}),o.jsxs("span",{className:"exp-logo-text",children:["TvSeries",o.jsx("span",{children:"Archive"})]})]}),o.jsxs("nav",{className:"hidden lg:flex items-center gap-8 text-sm text-[#A7ABC0]",children:[o.jsxs("button",{onClick:()=>r("home"),className:`za-focus relative hover:text-white transition-colors ${n==="home"?"text-white":""}`,children:["Home",n==="home"&&o.jsx("span",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-6 h-0.5 bg-purple-500 rounded-full shadow-[0_0_8px_rgba(109,74,255,0.6)]"})]}),o.jsxs("button",{onClick:()=>r("listing",{sort:"popularity"}),className:`za-focus relative hover:text-white transition-colors ${n==="listing"?"text-white":""}`,children:["TV Series",n==="listing"&&o.jsx("span",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-6 h-0.5 bg-purple-500 rounded-full shadow-[0_0_8px_rgba(109,74,255,0.6)]"})]}),o.jsx("button",{onClick:()=>r("listing",{format:"digital"}),className:"za-focus hover:text-white transition-colors",children:"Digital Collections"}),o.jsx("button",{onClick:()=>r("listing",{format:"usb"}),className:"za-focus hover:text-white transition-colors",children:"USB Collections"}),o.jsx("button",{onClick:()=>r("blog"),className:`za-focus hover:text-white transition-colors ${n==="blog"||n&&n.startsWith("blog-")?"text-white":""}`,children:"Blog"}),o.jsxs("button",{onClick:()=>r("listing",{sort:"newest"}),className:"za-focus hover:text-white transition-colors flex items-center gap-1",children:[o.jsx(Ka,{size:13})," New Arrivals"]}),o.jsx(X_,{onNav:r})]}),o.jsx("div",{className:"flex-1 hidden lg:block max-w-md mx-4",children:o.jsx(Q_,{onNavigateDetail:l=>r("detail",{slug:l}),onRunSearch:l=>r("listing",{q:l})})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>r("listing",{wishlistOnly:!0}),className:"za-focus relative p-2 rounded-full hover:bg-white/5","aria-label":"Wishlist",children:[o.jsx(Co,{size:18,className:"text-[#A7ABC0] hover:text-white transition-colors"}),s.length>0&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 bg-gradient-to-r from-purple-500 to-blue-500 text-white text-[9px] w-4 h-4 rounded-full flex items-center justify-center font-semibold shadow-[0_0_8px_rgba(109,74,255,0.5)]",children:s.length})]}),o.jsx("button",{onClick:()=>t(e==="dark"?"light":"dark"),className:"za-focus p-2 rounded-full hover:bg-white/5","aria-label":"Toggle theme",children:e==="dark"?o.jsx(Zx,{size:18,className:"text-[#A7ABC0]"}):o.jsx(Jx,{size:18,className:"text-[#A7ABC0]"})}),o.jsx("button",{onClick:()=>{a(!0),setTimeout(()=>{var l;return(l=document.getElementById("mob-search"))==null?void 0:l.focus()},100)},className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Search",children:o.jsx(as,{size:18,className:"text-[#A7ABC0]"})}),o.jsx("button",{onClick:()=>a(l=>!l),className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Menu",children:i?o.jsx(xt,{size:18,className:"text-[#A7ABC0]"}):o.jsx(Kx,{size:18,className:"text-[#A7ABC0]"})})]})]}),i&&o.jsxs("div",{className:"lg:hidden pb-4 flex flex-col gap-1 text-sm bg-[rgba(12,16,32,0.95)] backdrop-blur-lg border border-[rgba(255,255,255,0.06)] rounded-[13px] p-3 mb-3",children:[o.jsxs("div",{className:"flex items-center bg-white/5 border border-white/[0.08] rounded-full px-3 py-2 gap-2 mb-2",children:[o.jsx(as,{size:14,className:"text-[#70768F] shrink-0"}),o.jsx("input",{id:"mob-search",placeholder:"Search titles, cast, genre…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white",onKeyDown:l=>{if(l.key==="Enter"){const c=l.target.value.trim();c&&(r("listing",{query:c}),a(!1))}}})]}),[["home","Home"],["listing","TV Series"],["listing_digital","Digital Collections"],["listing_usb","USB Collections"],["blog","Blog"],["listing_newest","New Arrivals"],["myorders","My Orders"]].map(([l,c])=>o.jsx("button",{onClick:()=>{l==="listing_digital"?r("listing",{format:"digital"}):l==="listing_usb"?r("listing",{format:"usb"}):l==="listing_newest"?r("listing",{sort:"newest"}):r(l),a(!1)},className:"za-focus text-left px-3 py-2.5 rounded-lg hover:bg-white/5 text-[#A7ABC0] hover:text-white transition-colors",children:c},l)),o.jsxs("button",{onClick:()=>{r("listing",{sort:"popularity"}),a(!1)},className:"za-focus text-left px-3 py-2.5 rounded-lg hover:bg-white/5 text-purple-400 flex items-center gap-1.5",children:[o.jsx(Ga,{size:14})," Top 10"]})]})]})})}function ek({onNav:e}){const t=[["contact","Contact"],["faq","FAQ"],["delivery","Delivery Information"],["digitalAccess","Digital Download"],["digitalCollections","Digital Explained"],["usbCollections","USB Explained"],["refund","Refund Policy"],["archiveRequest","Archive Request"],["privacy","Privacy Policy"],["terms","Terms of Service"]];return o.jsxs("footer",{className:"bg-[#050711] border-t border-[rgba(255,255,255,0.06)] mt-8",children:[o.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12 py-14 grid sm:grid-cols-2 lg:grid-cols-5 gap-10",children:[o.jsxs("div",{className:"lg:col-span-1",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsx("img",{src:"/logo.webp",alt:"TvSeriesArchive",style:{height:34,width:"auto",borderRadius:5}}),o.jsxs("span",{className:"exp-logo-text",style:{fontSize:16},children:["TvSeries",o.jsx("span",{children:"Archive"})]})]}),o.jsx("p",{className:"text-sm text-[#70768F] leading-relaxed",children:"A premium digital and USB archive for classic TV series and film collections."})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Shop"}),o.jsxs("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:[o.jsx("li",{children:o.jsx("button",{onClick:()=>e("listing",{format:"digital"}),className:"za-focus hover:text-purple-400 transition-colors",children:"Digital Collections"})}),o.jsx("li",{children:o.jsx("button",{onClick:()=>e("listing",{format:"usb"}),className:"za-focus hover:text-purple-400 transition-colors",children:"USB Collections"})}),o.jsx("li",{children:o.jsx("button",{onClick:()=>e("listing"),className:"za-focus hover:text-purple-400 transition-colors",children:"All Categories"})})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Account"}),o.jsxs("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:[o.jsx("li",{children:o.jsx("button",{onClick:()=>e("myorders"),className:"za-focus hover:text-purple-400 transition-colors",children:"My Orders"})}),o.jsx("li",{children:o.jsx("button",{onClick:()=>e("listing",{wishlistOnly:!0}),className:"za-focus hover:text-purple-400 transition-colors",children:"Wishlist"})})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Help"}),o.jsx("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:t.slice(0,5).map(([r,n])=>o.jsx("li",{children:o.jsx("button",{onClick:()=>e("trust",{page:r}),className:"za-focus hover:text-purple-400 transition-colors",children:n})},r))})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Policies"}),o.jsx("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:t.slice(5).map(([r,n])=>o.jsx("li",{children:o.jsx("button",{onClick:()=>e("trust",{page:r}),className:"za-focus hover:text-purple-400 transition-colors",children:n})},r))})]})]}),o.jsxs("div",{className:"border-t border-[rgba(255,255,255,0.06)] py-6 text-center text-xs text-[#70768F]",children:[o.jsxs("div",{children:["© ",new Date().getFullYear()," TvSeriesArchive. All rights reserved."]}),o.jsx("div",{className:"mt-1 opacity-50",style:{fontSize:10},children:"This product uses the TMDB API but is not endorsed or certified by TMDB."})]})]})}function Ss({label:e,checked:t,onChange:r,count:n}){return o.jsxs("label",{className:"za-focus flex items-center justify-between gap-2 py-1.5 cursor-pointer text-sm text-[#A7ABC0]",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",checked:t,onChange:r,className:"accent-purple-500"}),e]}),typeof n=="number"&&o.jsx("span",{className:"text-[#70768F] text-xs",children:n})]})}function js({title:e,children:t,defaultOpen:r=!0}){const[n,s]=_.useState(r);return o.jsxs("div",{className:"py-3 border-b border-[rgba(255,255,255,0.06)]",children:[o.jsxs("button",{onClick:()=>s(i=>!i),className:"za-focus w-full flex items-center justify-between mb-1",children:[o.jsx("span",{className:"za-display text-sm text-white",children:e}),o.jsx(Ai,{size:14,className:`text-[#70768F] transition-transform ${n?"rotate-180":""}`})]}),n&&o.jsx("div",{children:t})]})}function tk({onNav:e,initialFilters:t,onQuickView:r,onShowAddMenu:n}){const{products:s,wishlist:i,loaded:a}=Re(),[l,c]=_.useState({genre:t.genre?[t.genre]:[],decade:t.decade?[t.decade]:[],country:[],language:[],format:t.format?[t.format]:[]}),[u,d]=_.useState(t.sort||"popularity"),[h,f]=_.useState(t.query||""),[p,w]=_.useState(xl),[m,k]=_.useState(!1),y=!!t.wishlistOnly,g=$t(),x=y?"My Wishlist":t.genre?`${t.genre} TV Series`:t.decade?`${t.decade} TV Series`:t.format?`${t.format==="digital"?"Digital":"USB"} Collections`:"All Collections";vn({title:x,description:`Browse ${x.toLowerCase()} — complete classic TV series collections, available on Digital and USB, delivered worldwide.`,path:`${g.pathname}${g.search}`,noindex:!!(t.query||y)});const E=_.useMemo(()=>s.filter(v=>v.enabled),[s]),T=_.useMemo(()=>Array.from(new Set(E.map(v=>v.country))).sort(),[E]),S=_.useMemo(()=>Array.from(new Set(E.map(v=>v.language))).sort(),[E]),A=_.useMemo(()=>{const v=h.toLowerCase();let C=E.filter(j=>!(y&&!i.includes(j.id)||l.genre.length&&!l.genre.some(N=>j.genres.includes(N))||l.decade.length&&!l.decade.some(N=>j.decades.includes(N))||l.country.length&&!l.country.includes(j.country)||l.language.length&&!l.language.includes(j.language)||l.format.length&&!l.format.some(N=>{var P;return(P=j.formats[N])==null?void 0:P.available})||v&&!`${j.title} ${j.genres.join(" ")} ${j.cast.join(" ")} ${j.country} ${j.decades.join(" ")} ${j.years}`.toLowerCase().includes(v)));switch(u){case"az":C.sort((j,N)=>j.title.localeCompare(N.title));break;case"newest":C.sort((j,N)=>N.createdAt-j.createdAt);break;case"price-asc":C.sort((j,N)=>j.formats.digital.price-N.formats.digital.price);break;case"price-desc":C.sort((j,N)=>N.formats.digital.price-j.formats.digital.price);break;default:C.sort((j,N)=>N.reviewCount+(N.bestSeller?1e3:0)-(j.reviewCount+(j.bestSeller?1e3:0)))}return C},[E,l,u,h,y,i]);_.useEffect(()=>{w(xl)},[l,u,h]);const R=A.slice(0,p),b=o.jsxs("aside",{className:"w-full lg:w-64 shrink-0",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("h3",{className:"za-display text-lg flex items-center gap-2 text-white",children:[o.jsx(ih,{size:16})," Filters"]}),o.jsx("button",{onClick:()=>c({genre:[],decade:[],country:[],language:[],format:[]}),className:"za-focus text-xs text-[#70768F] hover:text-white",children:"Clear"})]}),o.jsx(js,{title:"Format",children:["digital","usb"].map(v=>o.jsx(Ss,{label:v==="digital"?"Digital":"USB",checked:l.format.includes(v),onChange:()=>c(C=>({...C,format:C.format.includes(v)?C.format.filter(j=>j!==v):[...C.format,v]}))},v))}),o.jsx(js,{title:"Genre",children:pn.map(v=>o.jsx(Ss,{label:v,checked:l.genre.includes(v),onChange:()=>c(C=>({...C,genre:C.genre.includes(v)?C.genre.filter(j=>j!==v):[...C.genre,v]}))},v))}),o.jsx(js,{title:"Decade",children:wi.map(v=>o.jsx(Ss,{label:v,checked:l.decade.includes(v),onChange:()=>c(C=>({...C,decade:C.decade.includes(v)?C.decade.filter(j=>j!==v):[...C.decade,v]}))},v))}),o.jsx(js,{title:"Country",defaultOpen:!1,children:T.map(v=>o.jsx(Ss,{label:v,checked:l.country.includes(v),onChange:()=>c(C=>({...C,country:C.country.includes(v)?C.country.filter(j=>j!==v):[...C.country,v]}))},v))}),o.jsx(js,{title:"Language",defaultOpen:!1,children:S.map(v=>o.jsx(Ss,{label:v,checked:l.language.includes(v),onChange:()=>c(C=>({...C,language:C.language.includes(v)?C.language.filter(j=>j!==v):[...C.language,v]}))},v))})]});return o.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12 py-8 sm:py-10",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-4",children:[o.jsx("button",{onClick:()=>e("home"),className:"za-focus hover:text-white",children:"Home"}),o.jsx(sn,{size:12}),o.jsx("span",{className:"text-white/60",children:y?"My Wishlist":"Collections"})]}),o.jsxs("div",{className:"flex items-center justify-between mb-6",children:[o.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white",children:y?"My Wishlist":"All Collections"}),o.jsxs("button",{onClick:()=>k(!0),className:"za-focus lg:hidden bg-white/5 border border-white/10 rounded-full px-4 py-2 text-sm flex items-center gap-1.5 text-[#A7ABC0]",children:[o.jsx(ih,{size:14})," Filter"]})]}),o.jsxs("div",{className:"flex gap-8",children:[o.jsx("div",{className:"hidden lg:block",children:b}),m&&o.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>k(!1)}),o.jsxs("div",{className:"absolute right-0 top-0 bottom-0 w-80 max-w-[85%] bg-[#0E1222] border-l border-[rgba(255,255,255,0.06)] p-5 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"za-display text-lg text-white",children:"Filters"}),o.jsx("button",{onClick:()=>k(!1),className:"za-focus p-1",children:o.jsx(xt,{size:18,className:"text-[#A7ABC0]"})})]}),b,o.jsxs("button",{onClick:()=>k(!1),className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full py-2.5 text-sm za-display mt-4 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:["Show ",A.length," Results"]})]})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5",children:[o.jsxs("div",{className:"flex items-center bg-white/5 border border-white/[0.08] rounded-full px-4 py-2.5 gap-2 max-w-sm",children:[o.jsx(as,{size:15,className:"text-[#70768F] shrink-0"}),o.jsx("input",{value:h,onChange:v=>f(v.target.value),placeholder:"Search within results…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsxs("span",{className:"text-[#70768F]",children:[A.length," results"]}),o.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"za-focus bg-white/5 border border-white/10 rounded-full px-4 py-2 text-sm outline-none text-white appearance-none cursor-pointer",children:[o.jsx("option",{value:"popularity",className:"bg-[#0E1222]",children:"Popularity"}),o.jsx("option",{value:"newest",className:"bg-[#0E1222]",children:"Newest"}),o.jsx("option",{value:"az",className:"bg-[#0E1222]",children:"A–Z"}),o.jsx("option",{value:"price-asc",className:"bg-[#0E1222]",children:"Price: Low to High"}),o.jsx("option",{value:"price-desc",className:"bg-[#0E1222]",children:"Price: High to Low"})]})]})]}),A.length===0?o.jsx("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-10 text-center text-[#70768F]",children:a?"No collections match these filters. Try clearing a few.":"Loading collections…"}):o.jsxs(o.Fragment,{children:[o.jsx(Cg,{items:R,onOpen:v=>e("detail",{slug:v}),onQuickView:r,onShowAddMenu:n}),p<A.length&&o.jsx("div",{className:"text-center mt-8",children:o.jsxs("button",{onClick:()=>w(v=>v+xl),className:"za-focus bg-white/5 border border-white/10 rounded-full px-6 py-3 text-sm text-[#A7ABC0] hover:border-purple-500/50 hover:text-white transition-all",children:["Load More (",A.length-p," remaining)"]})})]})]})]})]})}function Kr({label:e,value:t}){return!t&&t!==0?null:o.jsxs("div",{className:"flex justify-between py-2.5 border-b border-[rgba(255,255,255,0.06)] text-sm",children:[o.jsx("span",{className:"text-[#70768F]",children:e}),o.jsx("span",{className:"za-display text-right text-white",children:t})]})}function Ng({product:e,format:t,setFormat:r}){const n=["digital","usb"].filter(i=>e.formats[i].available),s=n.indexOf(t);return o.jsxs("div",{className:`relative bg-white/5 rounded-lg p-0.5 grid gap-0.5 ${n.length===2?"grid-cols-2":"grid-cols-1"}`,children:[n.length===2&&o.jsx("div",{className:"absolute top-0.5 bottom-0.5 rounded-md bg-gradient-to-r from-purple-500 to-blue-500 transition-transform duration-300",style:{width:"calc(50% - 2px)",transform:`translateX(${s*100}%)`,left:2}}),n.map(i=>{const a=t===i;return o.jsxs("button",{onClick:()=>r(i),className:`za-focus relative z-10 rounded-md p-2 text-left transition-colors ${a&&n.length===2?"text-white":""} ${a&&n.length===1?"bg-gradient-to-r from-purple-500 to-blue-500 text-white":"text-[#A7ABC0]"}`,children:[o.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wide mb-0.5",children:[i==="digital"?o.jsx(hn,{size:11}):o.jsx(fn,{size:11}),i==="digital"?"Digital":"USB"]}),o.jsxs("p",{className:"za-display text-sm",children:["$",e.formats[i].price.toFixed(2)]})]},i)})]})}function rk({format:e}){const t=e==="digital"?[{icon:is,title:"Order Placed",desc:"Payoneer instructions shown & emailed."},{icon:di,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:Jt,title:"Access Sent",desc:"Your download link arrives by email."},{icon:De,title:"Delivered",desc:"Watch anytime."}]:[{icon:is,title:"Order Placed",desc:"Payoneer instructions shown & emailed."},{icon:di,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:Ur,title:"USB Shipped",desc:"Tracking number added to your order."},{icon:De,title:"Delivered",desc:"Plug in and start watching."}];return o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.map((r,n)=>o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"bg-gradient-to-r from-purple-500 to-blue-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-[11px] za-display",children:n+1}),o.jsx(r.icon,{size:15,className:"text-purple-400"})]}),o.jsx("p",{className:"za-display text-sm text-white",children:r.title}),o.jsx("p",{className:"text-xs text-[#70768F] mt-1 leading-snug",children:r.desc})]},r.title))})}function nk({slug:e,onNav:t,onShowAddMenu:r,onQuickView:n}){const s=Re(),i=Du(),{products:a,wishlist:l,toggleWishlist:c,loaded:u}=s,d=a.find(I=>I.slug===e),[h,f]=_.useState(d!=null&&d.formats.digital.available?"digital":"usb"),[p,w]=_.useState(""),m=_.useRef(null),[k,y]=_.useState(0),[g,x]=_.useState([]),[E,T]=_.useState(""),[S,A]=_.useState(5),[R,b]=_.useState(""),[v,C]=_.useState(""),[j,N]=_.useState("idle"),[P,z]=_.useState("");_.useEffect(()=>{if(!d){x([]);return}fetch(`https://udmfeelrxeoahrzkxmlk.supabase.co/rest/v1/reviews?product_id=eq.${d.id}&order=created_at.desc&limit=10`,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVkbWZlZWxyeGVvYWhyemt4bWxrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM0NTYxMzYsImV4cCI6MjA5OTAzMjEzNn0.gu2A5wZAbVPN2GFKFNVILnjmqUrDm_Xv9xMCqTnItC0",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVkbWZlZWxyeGVvYWhyemt4bWxrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM0NTYxMzYsImV4cCI6MjA5OTAzMjEzNn0.gu2A5wZAbVPN2GFKFNVILnjmqUrDm_Xv9xMCqTnItC0"}}).then(I=>I.json()).then(x).catch(()=>x([]))},[d==null?void 0:d.id]);const W=async()=>{if(E.trim()){N("verifying"),z("");try{const{data:I,error:D}=await le.rpc("can_review",{p_email:E.trim(),p_product_id:d.id});if(D)throw D;I?(N("verified"),C(E.trim().split("@")[0]),z("")):(N("error"),z("No paid order found for this email and product. Make sure you use the email you placed the order with."))}catch{N("error"),z("Could not verify. Try again later.")}}},V=async()=>{if(!(!R.trim()||S<1)){N("submitting"),z("");try{const{data:I,error:D}=await le.rpc("submit_review",{p_product_id:d.id,p_author:v.trim()||E.trim().split("@")[0],p_rating:S,p_text:R.trim(),p_email:E.trim()});if(D)throw D;I.error?(N("error"),z(I.error)):(N("success"),z("Review submitted! Thank you."),b(""),A(5),setTimeout(()=>{N("idle"),z(""),T("")},3e3))}catch{N("error"),z("Could not submit review. Try again.")}}},O=()=>{N("idle"),z(""),T(""),b(""),C(""),A(5)},U=_.useMemo(()=>d?a.filter(I=>I.enabled&&I.id!==d.id&&I.genres.some(D=>d.genres.includes(D))).slice(0,4):[],[a,d]);if(vn({title:d==null?void 0:d.seoTitle,description:d==null?void 0:d.seoDescription,path:`/show/${e}`,image:(d==null?void 0:d.coverUrl)||void 0,noindex:!d,keywords:d?`${d.title}, ${d.genres.join(", ")}, ${d.decades.join(", ")}, buy ${d.title} tv series, ${d.title} complete series`:void 0,jsonLd:d?{"@context":"https://schema.org","@graph":[{"@type":"Product",name:d.displayTitle,description:d.shortDesc,image:d.coverUrl||void 0,brand:{"@type":"Brand",name:an},offers:[...d.formats.digital.available?[{"@type":"Offer",url:`${ot}/show/${d.slug}`,priceCurrency:"USD",price:d.formats.digital.price.toFixed(2),availability:d.enabled?"https://schema.org/InStock":"https://schema.org/OutOfStock",itemCondition:"https://schema.org/NewCondition",priceValidUntil:"2027-12-31",name:"Digital Download",description:"Instant download link delivered by email after payment.",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",returnPolicyCategory:"https://schema.org/MerchantReturnNotPermitted"}}]:[],...d.formats.usb.available?[{"@type":"Offer",url:`${ot}/show/${d.slug}`,priceCurrency:"USD",price:d.formats.usb.price.toFixed(2),availability:d.enabled?"https://schema.org/InStock":"https://schema.org/OutOfStock",itemCondition:"https://schema.org/NewCondition",priceValidUntil:"2027-12-31",name:"USB Drive",description:"Physical USB drive shipped to your door worldwide.",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",returnPolicyCategory:"https://schema.org/MerchantReturnNotPermitted"},shippingDetails:{"@type":"OfferShippingDetails",shippingDestination:{"@type":"DefinedRegion",addressCountry:"WW"}}}]:[]],aggregateRating:{"@type":"AggregateRating",ratingValue:(d.rating||0).toFixed(1),reviewCount:Math.min(d.reviewCount||0,50)},...d.reviewCount>0?{review:[{"@type":"Review",reviewRating:{"@type":"Rating",ratingValue:(d.rating||0).toFixed(1)},author:{"@type":"Person",name:"TvSeriesArchive Customer"}}]}:{}},{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:ot},{"@type":"ListItem",position:2,name:d.genres[0],item:`${ot}/collections?genre=${encodeURIComponent(d.genres[0])}`},{"@type":"ListItem",position:3,name:d.title}]},{"@type":"FAQPage",mainEntity:[{"@type":"Question",name:"How will I receive this?",acceptedAnswer:{"@type":"Answer",text:h==="digital"?"After payment is confirmed, a download link is emailed to you.":"The USB ships to your delivery address; you'll get a tracking number by email once it's on its way."}},{"@type":"Question",name:"What's the video quality?",acceptedAnswer:{"@type":"Answer",text:d.quality}},{"@type":"Question",name:"What can I play this on?",acceptedAnswer:{"@type":"Answer",text:d.compatibility}},{"@type":"Question",name:"Do you accept returns?",acceptedAnswer:{"@type":"Answer",text:"Digital products aren't refundable once the download link is sent. USB items can be replaced if damaged in transit."}}]}]}:null}),!d)return u?o.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-24 text-center za-fade-view",children:[o.jsx("h1",{className:"za-display text-3xl mb-3",children:"Series not found"}),o.jsx("p",{className:"za-ink-dim mb-6",children:"We couldn't find that title — it may have been removed, or the link is incorrect."}),o.jsx("button",{onClick:()=>t("listing"),className:"za-focus za-bg-gold text-[#141118] rounded-full px-6 py-3 text-sm za-display",children:"Browse Collections"})]}):o.jsx("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center za-ink-dim",children:"Loading…"});const L=[`Complete run — all ${d.seasons} seasons, ${d.episodes} episodes in one collection`,d.isHD?"HD-quality remastered video for the best viewing experience":"Cleaned and restored standard-definition video",d.cast.length?`Starring ${d.cast.slice(0,3).join(", ")}${d.cast.length>3?" and more":""}`:null,d.genres.includes("Western")||d.genres.includes("Classic TV")?"A prized addition to any classic TV collector's library":null,`Rated ${d.rating.toFixed(1)} stars by collectors`].filter(Boolean),G={digital:[{icon:Jt,text:"Instant access — download link sent to your email"},{icon:Hx,text:"Watch on any device: computer, tablet, phone, smart TV"},{icon:Ka,text:"No physical storage needed — your library lives in the cloud"},{icon:zu,text:`Best value at $${d.formats.digital.price.toFixed(2)}`}],usb:[{icon:fn,text:"Plug & play — works in any TV, laptop, or media player with a USB port"},{icon:Hs,text:"Physical backup — your collection can't be lost or deleted"},{icon:Iu,text:"Beautiful shelf display for the dedicated collector"},{icon:Ur,text:"Tracked worldwide shipping with replacement guarantee"}]},B=[{q:"How will I receive this?",a:h==="digital"?"After payment is confirmed, a download link is emailed to you.":"The USB ships to your delivery address; you'll get a tracking number by email once it's on its way."},{q:"What's the video quality?",a:d.quality},{q:"What can I play this on?",a:d.compatibility},{q:"Do you accept returns?",a:"Digital products aren't refundable once the download link is sent. USB items can be replaced if damaged in transit."}];return o.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12 py-8 sm:py-10 za-fade-view",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-6 flex-wrap",children:[o.jsx("button",{onClick:()=>t("home"),className:"za-focus hover:text-white",children:"Home"}),o.jsx(sn,{size:12}),o.jsx("button",{onClick:()=>t("listing",{genre:d.genres[0]}),className:"za-focus hover:text-white",children:d.genres[0]}),o.jsx(sn,{size:12}),d.decades[0]&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>t("listing",{decade:d.decades[0]}),className:"za-focus hover:text-white",children:d.decades[0]}),o.jsx(sn,{size:12})]}),o.jsx("span",{className:"text-white/60",children:d.displayTitle})]}),o.jsxs("div",{className:"grid lg:grid-cols-[340px_1fr] gap-8 items-start",children:[o.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[o.jsx(qr,{product:d,className:"w-full aspect-[3/4] rounded-[17px]",eager:!0}),o.jsxs("div",{className:"mt-6 hidden lg:block bg-gradient-to-r from-purple-500/5 to-blue-500/5 rounded-[17px] p-5 border border-[rgba(255,255,255,0.06)]",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-2 flex items-center gap-2",children:[o.jsx(mc,{size:16,className:"text-purple-400"})," About This Collection"]}),o.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:d.longDesc})]})]}),o.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[d.needsReview&&o.jsxs("div",{className:"mb-3 inline-flex items-center gap-1.5 text-[11px] bg-white/5 border border-white/10 rounded-full px-3 py-1 text-[#70768F]",children:[o.jsx(Ka,{size:11})," Metadata auto-generated by AI"]}),o.jsx("h1",{className:"za-display text-3xl sm:text-4xl leading-tight text-white",children:d.displayTitle}),o.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[o.jsx(io,{value:d.rating}),o.jsx("span",{className:"text-sm text-[#70768F]",children:d.rating.toFixed(1)})]}),o.jsx("p",{className:"text-[#A7ABC0] mt-4 leading-relaxed",children:d.shortDesc}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[14px] p-4",children:[o.jsx("p",{className:"za-display text-xs text-white mb-2 uppercase tracking-wider",children:"Choose Format"}),o.jsx(Ng,{product:d,format:h,setFormat:f}),o.jsx("div",{className:"flex items-center gap-2 mt-3 text-[11px] text-[#70768F]",children:h==="digital"?o.jsxs(o.Fragment,{children:[o.jsx(Jt,{size:12})," Email access after payment"]}):o.jsxs(o.Fragment,{children:[o.jsx(Ur,{size:12})," Worldwide shipping, tracked"]})}),o.jsxs("button",{onClick:I=>{d.formats[h].available&&(i(I.currentTarget,wa(d)),s.addToCart(d,h),w(`Added "${d.title}" (${h==="digital"?"Digital":"USB"}) to cart`),clearTimeout(m.current),m.current=setTimeout(()=>w(""),2200))},className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[11px] py-2.5 text-xs za-display mt-3 flex items-center justify-center gap-2 shadow-[0_8px_25px_rgba(109,74,255,0.25)] hover:shadow-[0_12px_35px_rgba(109,74,255,0.35)] transition-all",children:[o.jsx(or,{size:15})," Add to Cart — $",d.formats[h].price.toFixed(2)]}),o.jsxs("button",{onClick:()=>c(d.id),className:"za-focus w-full border border-[rgba(255,255,255,0.10)] rounded-[13px] py-2.5 text-sm mt-2 flex items-center justify-center gap-2 text-[#A7ABC0] hover:text-white transition-colors",children:[o.jsx(Co,{size:14,className:l.includes(d.id)?"text-purple-400":"",fill:l.includes(d.id)?"currentColor":"none"}),l.includes(d.id)?"In Wishlist":"Add to Wishlist"]})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx(Kr,{label:"Years",value:d.years}),o.jsx(Kr,{label:"Genre",value:d.genres.join(", ")}),o.jsx(Kr,{label:"Country",value:d.country}),o.jsx(Kr,{label:"Language",value:d.language}),o.jsx(Kr,{label:"Seasons",value:d.seasons}),o.jsx(Kr,{label:"Episodes",value:d.episodes||null}),o.jsx(Kr,{label:"Quality",value:d.quality})]}),d.cast.length>0&&o.jsxs("div",{className:"mt-6 lg:block hidden bg-gradient-to-r from-purple-500/5 to-blue-500/5 rounded-[17px] p-5 border border-[rgba(255,255,255,0.06)]",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[o.jsx(Ja,{size:16,className:"text-purple-400"})," Cast"]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((I,D)=>o.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:I},D)),d.cast.length>10&&o.jsxs("span",{className:"text-xs text-[#70768F] self-center",children:["+",d.cast.length-10," more"]})]})]})]}),o.jsxs("div",{className:"lg:hidden bg-gradient-to-r from-purple-500/5 to-blue-500/5 rounded-[17px] p-5 border border-[rgba(255,255,255,0.06)]",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-2 flex items-center gap-2",children:[o.jsx(mc,{size:16,className:"text-purple-400"})," About This Collection"]}),o.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:d.longDesc}),d.cast.length>0&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-[rgba(255,255,255,0.06)]",children:[o.jsxs("h3",{className:"za-display text-sm text-white mb-2 flex items-center gap-2",children:[o.jsx(Ja,{size:13,className:"text-purple-400"})," Cast"]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((I,D)=>o.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:I},D)),d.cast.length>10&&o.jsxs("span",{className:"text-xs text-[#70768F] self-center",children:["+",d.cast.length-10," more"]})]})]})]})]}),L.length>0&&o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"Collector's Choice",title:"Why Collectors Love This Series"}),o.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:L.map((I,D)=>o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-4 flex items-start gap-3",children:[o.jsx("span",{className:"bg-gradient-to-r from-purple-500 to-blue-500 text-white w-7 h-7 rounded-full flex items-center justify-center text-xs za-display shrink-0 mt-0.5",children:D+1}),o.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:I})]},D))})]}),o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"Which Format?",title:"Digital Collection vs USB Collection"}),o.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[d.formats.digital.available&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(hn,{size:18,className:"text-purple-400"}),o.jsx("h3",{className:"za-display text-lg text-white",children:"Digital Collection"})]}),o.jsxs("p",{className:"text-sm text-[#70768F] mb-4 leading-relaxed",children:["$",d.formats.digital.price.toFixed(2)," · Instant download link delivered by email after payment."]}),o.jsx("ul",{className:"flex flex-col gap-2",children:G.digital.map((I,D)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[o.jsx(De,{size:14,className:"text-purple-400 shrink-0 mt-0.5"}),o.jsx("span",{children:I.text})]},D))}),o.jsxs("button",{onClick:I=>{d.formats.digital.available&&(i(I.currentTarget,wa(d)),s.addToCart(d,"digital"),w(`Added "${d.title}" (Digital) to cart`),clearTimeout(m.current),m.current=setTimeout(()=>w(""),2200))},className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[11px] py-2.5 text-xs za-display mt-4 flex items-center justify-center gap-2 shadow-[0_8px_25px_rgba(109,74,255,0.25)] hover:shadow-[0_12px_35px_rgba(109,74,255,0.35)] transition-all",children:[o.jsx(or,{size:14})," Buy Digital — $",d.formats.digital.price.toFixed(2)]})]}),d.formats.usb.available&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(fn,{size:18,className:"text-blue-400"}),o.jsx("h3",{className:"za-display text-lg text-white",children:"USB Collection"})]}),o.jsxs("p",{className:"text-sm text-[#70768F] mb-4 leading-relaxed",children:["$",d.formats.usb.price.toFixed(2)," · Physical USB drive shipped to your door, worldwide."]}),o.jsx("ul",{className:"flex flex-col gap-2",children:G.usb.map((I,D)=>o.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[o.jsx(De,{size:14,className:"text-blue-400 shrink-0 mt-0.5"}),o.jsx("span",{children:I.text})]},D))}),o.jsxs("button",{onClick:I=>{d.formats.usb.available&&(i(I.currentTarget,wa(d)),s.addToCart(d,"usb"),w(`Added "${d.title}" (USB) to cart`),clearTimeout(m.current),m.current=setTimeout(()=>w(""),2200))},className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[11px] py-2.5 text-xs za-display mt-4 flex items-center justify-center gap-2 shadow-[0_8px_25px_rgba(109,74,255,0.25)] hover:shadow-[0_12px_35px_rgba(109,74,255,0.35)] transition-all",children:[o.jsx(or,{size:14})," Buy USB — $",d.formats.usb.price.toFixed(2)]})]})]})]}),o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"How It Works",title:"Delivery Timeline"}),o.jsx(rk,{format:h})]}),o.jsxs("div",{className:"grid lg:grid-cols-3 gap-10 mt-14",children:[o.jsxs("div",{className:"lg:col-span-2",children:[o.jsx("h2",{className:"za-display text-2xl text-white mb-3",children:"Frequently Asked Questions"}),o.jsx("div",{className:"divide-y divide-[rgba(255,255,255,0.06)]",children:B.map((I,D)=>o.jsxs("div",{className:"py-4",children:[o.jsxs("button",{onClick:()=>y(k===D?-1:D),className:"za-focus w-full flex items-center justify-between text-left",children:[o.jsx("span",{className:"za-display text-[15px] text-white",children:I.q}),o.jsx(Ai,{size:16,className:`text-[#70768F] transition-transform ${k===D?"rotate-180":""}`})]}),k===D&&o.jsx("p",{className:"text-sm text-[#A7ABC0] mt-2.5 leading-relaxed pr-6",children:I.a})]},D))})]}),o.jsxs("div",{children:[o.jsx("h2",{className:"za-display text-xl text-white mb-3",children:"Compatibility"}),o.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-4",children:d.compatibility})]})]}),console.log("REVIEWS_WILL_RENDER",g.length),g.length>0&&o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"Reviews",title:`What Collectors Say About ${d.title}`}),o.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:g.map(I=>o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(io,{value:I.rating}),o.jsx("span",{className:"text-xs text-[#70768F]",children:I.author})]}),o.jsxs("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:['"',I.text,'"']})]},I.id))})]}),o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"Review",title:"Write a Review"}),o.jsx("p",{className:"text-sm text-[#70768F] mb-4",children:"Purchased this collection? Verify your email and leave a review."}),j==="success"?o.jsxs("div",{className:"bg-green-500/10 border border-green-500/30 rounded-[13px] p-4 text-sm text-green-400 flex items-center gap-2",children:[o.jsx(De,{size:16})," ",P]}):j==="verified"?o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 max-w-lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("span",{className:"text-xs text-[#70768F]",children:"Verified"}),o.jsx("button",{onClick:O,className:"text-xs text-purple-400 hover:text-purple-300",children:"Change"})]}),o.jsxs("div",{className:"mb-3",children:[o.jsx("label",{className:"text-[11px] text-[#70768F] block mb-1",children:"Display name"}),o.jsx("input",{value:v,onChange:I=>C(I.target.value),className:"w-full bg-white/5 border border-[rgba(255,255,255,0.10)] rounded-[11px] px-3 py-2 text-sm text-white placeholder-[#70768F] outline-none focus:border-purple-500/50"})]}),o.jsx("div",{className:"flex items-center gap-1 mb-4",children:[1,2,3,4,5].map(I=>o.jsx("button",{onClick:()=>A(I),className:"za-focus p-0.5",children:o.jsx(Mm,{size:22,className:I<=S?"text-[#FFB800] fill-[#FFB800]":"text-[#70768F]"})},I))}),o.jsx("textarea",{value:R,onChange:I=>b(I.target.value),placeholder:"Share your experience with this collection...",className:"w-full bg-white/5 border border-[rgba(255,255,255,0.10)] rounded-[11px] p-3 text-sm text-white placeholder-[#70768F] resize-none h-24 outline-none focus:border-purple-500/50 mb-3"}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("button",{onClick:V,disabled:j==="submitting"||!R.trim(),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[11px] px-5 py-2 text-xs za-display flex items-center gap-2 disabled:opacity-40",children:[j==="submitting"?o.jsx(It,{size:14,className:"animate-spin"}):o.jsx(Qx,{size:14}),j==="submitting"?"Submitting...":"Submit Review"]}),P&&o.jsx("span",{className:"text-xs text-red-400",children:P})]})]}):o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 max-w-lg",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{value:E,onChange:I=>T(I.target.value),type:"email",placeholder:"Enter your order email",className:"flex-1 bg-white/5 border border-[rgba(255,255,255,0.10)] rounded-[11px] px-3 py-2 text-sm text-white placeholder-[#70768F] outline-none focus:border-purple-500/50"}),o.jsxs("button",{onClick:W,disabled:j==="verifying"||!E.trim(),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[11px] px-4 py-2 text-xs za-display flex items-center gap-2 disabled:opacity-40",children:[j==="verifying"?o.jsx(It,{size:14,className:"animate-spin"}):o.jsx(De,{size:14}),j==="verifying"?"Checking...":"Verify"]})]}),P&&o.jsx("p",{className:"text-xs text-red-400 mt-2",children:P}),j==="error"&&o.jsx("button",{onClick:()=>N("idle"),className:"text-xs text-purple-400 mt-1 hover:text-purple-300",children:"Try again"})]})]}),U.length>0&&o.jsxs("div",{className:"mt-14",children:[o.jsx(En,{eyebrow:"Related",title:`More ${d.genres[0]} Collections You'll Love`}),o.jsxs("p",{className:"text-sm text-[#70768F] mb-4",children:["If you enjoyed ",o.jsx("strong",{className:"text-white",children:d.title}),", explore these similar collections from the ",d.decades[0]," ",d.genres[0]," era — all complete series with the same archive quality."]}),o.jsx(Cg,{items:U,onOpen:I=>t("detail",{slug:I}),onQuickView:n,onShowAddMenu:r})]}),o.jsx(Tc,{message:p})]})}function Yh({open:e,onClose:t,onCheckout:r}){const{cartItems:n,removeFromCart:s,products:i}=Re(),a=_.useRef(null);Fu(a,()=>e&&t());const l=n.map(u=>({...u,product:i.find(d=>d.id===u.productId)})).filter(u=>u.product),c=l.reduce((u,d)=>u+d.price,0);return o.jsxs("div",{className:`fixed inset-0 z-[60] ${e?"":"pointer-events-none"}`,children:[o.jsx("div",{className:`absolute inset-0 bg-black/60 transition-opacity ${e?"opacity-100":"opacity-0"}`}),o.jsxs("div",{ref:a,className:`absolute right-0 top-0 bottom-0 w-full max-w-sm bg-[#0E1222] border-l border-[rgba(255,255,255,0.06)] p-5 overflow-y-auto transition-transform duration-300 ${e?"translate-x-0":"translate-x-full"}`,children:[o.jsxs("div",{className:"flex items-center justify-between mb-5",children:[o.jsxs("h3",{className:"za-display text-xl text-white flex items-center gap-2",children:[o.jsx(or,{size:18,className:"text-purple-400"})," Your Cart"]}),o.jsx("button",{onClick:t,className:"za-focus p-1",children:o.jsx(xt,{size:18,className:"text-[#A7ABC0]"})})]}),l.length===0?o.jsx("p",{className:"text-sm text-[#70768F]",children:"Your cart is empty. Add a collection to get started."}):o.jsxs("div",{className:"flex flex-col gap-3",children:[l.map((u,d)=>o.jsxs("div",{className:"flex gap-3 bg-white/5 border border-[rgba(255,255,255,0.06)] rounded-[13px] p-3",children:[o.jsx(qr,{product:u.product,className:"w-12 h-14 shrink-0 rounded-lg"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"za-display text-sm truncate text-white",children:u.product.title}),o.jsx("p",{className:"text-xs text-[#70768F] capitalize",children:u.format}),o.jsxs("p",{className:"za-display text-sm text-purple-400 mt-1",children:["$",u.price.toFixed(2)]})]}),o.jsxs("button",{onClick:()=>s(d),className:"za-focus text-[#70768F] hover:text-red-400 flex items-center gap-1 text-xs",children:[o.jsx(xt,{size:12})," Remove"]})]},d)),o.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-[rgba(255,255,255,0.06)]",children:[o.jsx("span",{className:"za-display text-white",children:"Total"}),o.jsxs("span",{className:"za-display text-purple-400 text-lg",children:["$",c.toFixed(2)]})]}),o.jsxs("button",{onClick:()=>{t(),r()},className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[13px] py-3.5 text-sm za-display mt-2 flex items-center justify-center gap-2 shadow-[0_10px_30px_rgba(109,74,255,0.30)] hover:shadow-[0_15px_40px_rgba(109,74,255,0.45)] transition-all",children:["Proceed to Checkout ",o.jsx(Fx,{size:15})]})]})]})]})}function Qh({target:e,onClose:t,showToast:r}){const n=Re(),s=Du(),[i,a]=_.useState(null);if(!e)return null;const{product:l,element:c}=e,u=()=>{!i||!l.formats[i].available||(s(c,wa(l)),n.addToCart(l,i),r(`Added "${l.title}" (${i==="digital"?"Digital":"USB"}) to cart`),t())};return o.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",onClick:t,children:[o.jsx("div",{className:"absolute inset-0 bg-black/60"}),o.jsxs("div",{className:"relative bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[22px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] max-w-sm w-full overflow-hidden",onClick:d=>d.stopPropagation(),children:[o.jsxs("div",{className:"p-5 border-b border-[rgba(255,255,255,0.06)] flex items-center justify-between",children:[o.jsx("h3",{className:"za-display text-lg text-white",children:"Choose Format"}),o.jsx("button",{onClick:t,className:"za-focus p-1",children:o.jsx(xt,{size:18,className:"text-[#A7ABC0]"})})]}),o.jsxs("div",{className:"p-4 flex flex-col gap-3",children:[l.formats.digital.available&&o.jsxs("button",{onClick:()=>a("digital"),className:`za-focus bg-white/5 border rounded-[17px] p-4 flex items-center justify-between gap-3 transition-all text-left ${i==="digital"?"border-purple-500/50 bg-purple-500/10 shadow-[0_0_20px_rgba(109,74,255,0.10)]":"border-[rgba(255,255,255,0.06)] hover:bg-white/10"}`,children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500/20 to-blue-500/20 border border-purple-500/30 flex items-center justify-center",children:o.jsx(hn,{size:18,className:"text-purple-400"})}),o.jsxs("div",{children:[o.jsx("p",{className:"za-display text-sm text-white",children:"Digital Download"}),o.jsxs("p",{className:"text-[11px] text-[#70768F]",children:["Instant access",l.isHD?" · HD quality":""]})]})]}),o.jsxs("span",{className:"za-display text-purple-400 text-lg shrink-0",children:["$",l.formats.digital.price.toFixed(2)]})]}),l.formats.usb.available&&o.jsxs("button",{onClick:()=>a("usb"),className:`za-focus bg-white/5 border rounded-[17px] p-4 flex items-center justify-between gap-3 transition-all text-left ${i==="usb"?"border-purple-500/50 bg-purple-500/10 shadow-[0_0_20px_rgba(109,74,255,0.10)]":"border-[rgba(255,255,255,0.06)] hover:bg-white/10"}`,children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/5 border border-white/10 flex items-center justify-center",children:o.jsx(fn,{size:18,className:"text-blue-400"})}),o.jsxs("div",{children:[o.jsx("p",{className:"za-display text-sm text-white",children:"USB Drive"}),o.jsx("p",{className:"text-[11px] text-[#70768F]",children:"Physical copy · Shipped worldwide"})]})]}),o.jsxs("span",{className:"za-display text-blue-400 text-lg shrink-0",children:["$",l.formats.usb.price.toFixed(2)]})]})]}),o.jsx("div",{className:"p-4 pt-0",children:o.jsxs("button",{onClick:u,disabled:!i,className:`za-focus w-full rounded-[13px] py-3.5 text-sm za-display flex items-center justify-center gap-2 transition-all ${i?"bg-gradient-to-r from-purple-500 to-blue-500 text-white shadow-[0_10px_30px_rgba(109,74,255,0.30)]":"bg-white/5 text-[#70768F] cursor-not-allowed"}`,children:[o.jsx(or,{size:15})," Add to Cart ",i?`— $${l.formats[i].price.toFixed(2)}`:""]})})]})]})}function Xh({product:e,onClose:t,onOpenFull:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i}=Re(),[a,l]=_.useState("digital");return e?o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:t}),o.jsxs("div",{className:"relative bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[22px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] max-w-2xl w-full grid sm:grid-cols-2 overflow-hidden max-h-[85vh]",children:[o.jsx("button",{onClick:t,className:"za-focus absolute top-3 right-3 bg-black/40 backdrop-blur-sm border border-white/10 rounded-full p-1.5 z-10",children:o.jsx(xt,{size:16,className:"text-white"})}),o.jsx(qr,{product:e,className:"w-full h-full min-h-[220px]",eager:!0}),o.jsxs("div",{className:"p-5 overflow-y-auto",children:[o.jsx("h3",{className:"za-display text-2xl leading-tight text-white",children:e.displayTitle}),o.jsx("div",{className:"flex items-center gap-2 mt-2",children:o.jsx(io,{value:e.rating})}),o.jsx("p",{className:"text-sm text-[#A7ABC0] mt-3 leading-relaxed",children:e.shortDesc}),o.jsx("div",{className:"mt-4",children:o.jsx(Ng,{product:e,format:a,setFormat:l})}),o.jsxs("button",{onClick:c=>{n(e,c.currentTarget),t()},className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[13px] py-3 text-sm za-display mt-4 flex items-center justify-center gap-2 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(or,{size:14})," Add to Cart — $",e.formats[a].price.toFixed(2)]}),o.jsxs("div",{className:"flex gap-2 mt-2",children:[o.jsxs("button",{onClick:()=>i(e.id),className:"za-focus flex-1 border border-[rgba(255,255,255,0.10)] rounded-[13px] py-2 text-sm text-[#A7ABC0] flex items-center justify-center gap-1.5 hover:text-white transition-colors",children:[o.jsx(Co,{size:13,className:s.includes(e.id)?"text-purple-400":"",fill:s.includes(e.id)?"currentColor":"none"})," Wishlist"]}),o.jsx("button",{onClick:()=>{t(),r(e.slug)},className:"za-focus flex-1 bg-white/5 border border-white/10 rounded-[13px] py-2 text-sm text-[#A7ABC0]",children:"Full Page"})]})]})]})]}):null}function Tc({message:e}){return e?o.jsx("div",{className:"fixed bottom-5 left-1/2 -translate-x-1/2 z-[70] za-toast",children:o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-3 text-sm flex items-center gap-2 shadow-[0_18px_45px_rgba(0,0,0,0.30)]",children:[o.jsx(De,{size:14,className:"text-purple-400"})," ",o.jsx("span",{className:"text-white",children:e})]})}):null}function sk({onNav:e}){const{cartItems:t,products:r,settings:n,placeOrder:s,removeFromCart:i}=Re();vn({title:"Checkout",path:"/checkout",noindex:!0});const a=t.map(b=>({...b,product:r.find(v=>v.id===b.productId)})).filter(b=>b.product),l=a.some(b=>b.format==="usb"),c=a.reduce((b,v)=>b+v.price,0),u={AU:40,NZ:40},d=19.99,[h,f]=_.useState({name:"",email:"",phone:"",billing:"",shipping:"",city:"",postalCode:"",country:"",notes:"",coupon:""}),[p,w]=_.useState({}),[m,k]=_.useState(!1),y=b=>v=>f(C=>({...C,[b]:v.target.value})),g=_.useRef(null),x=l?u[h.country]||d:0,E=h.coupon.trim().toUpperCase()==="ARCHIVE10",T=E?c*.1:0,S=c+x-T,A=()=>{var v;const b={};return h.name.trim()||(b.name="Please enter your full name."),/^\S+@\S+\.\S+$/.test(h.email)||(b.email="Please enter a valid email address."),l&&!h.shipping.trim()&&(b.shipping="A shipping address is required for USB orders."),l&&!h.city.trim()&&(b.city="City is required."),l&&!h.postalCode.trim()&&(b.postalCode="Postal code is required."),l&&!h.country&&(b.country="Please select your country for shipping calculation."),w(b),Object.keys(b).length>0&&((v=g.current)==null||v.scrollIntoView({behavior:"smooth",block:"start"})),Object.keys(b).length===0},R=async()=>{if(!A())return;k(!0);const b=l?`${h.shipping.trim()}, ${h.city.trim()}, ${h.postalCode.trim()}, ${h.country}`:"",v={id:xg(),number:c_(),createdAt:Date.now(),status:"pending_payment",customer:{name:h.name.trim(),email:h.email.trim(),phone:h.phone.trim()},billing:b,shipping:b,notes:h.notes.trim(),coupon:E?"ARCHIVE10":null,items:a.map(C=>({productId:C.product.id,title:C.product.displayTitle,format:C.format,price:C.price})),subtotal:c,shippingCost:x,discount:T,total:S,tracking:null,accessLinks:{}};try{await s(v),e("confirmation",{orderId:v.id,email:v.customer.email})}catch{k(!1),alert("We couldn't place your order — please try again in a moment.")}};return a.length===0?o.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[o.jsx(or,{size:40,className:"text-[#70768F] mx-auto mb-4"}),o.jsx("h1",{className:"za-display text-2xl mb-2 text-white",children:"Your cart is empty"}),o.jsx("p",{className:"text-[#70768F] text-sm mb-6",children:"Add a collection to your cart before checking out."}),o.jsx("button",{onClick:()=>e("listing"),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-6 py-3 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Browse Collections"})]}):o.jsxs("div",{className:"max-w-4xl mx-auto px-5 sm:px-8 lg:px-12 py-8 sm:py-10 pb-28 sm:pb-10 za-fade-view",children:[o.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white mb-8",children:"Checkout"}),o.jsxs("div",{className:"grid lg:grid-cols-[1fr_380px] gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-5",children:[o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-4 flex items-center gap-2",children:[o.jsx(or,{size:16,className:"text-purple-400"})," Order Summary"]}),o.jsx("div",{className:"flex flex-col gap-3",children:a.map((b,v)=>o.jsxs("div",{className:"flex gap-4 items-start pb-3 border-b border-[rgba(255,255,255,0.06)] last:border-0 last:pb-0",children:[o.jsx(qr,{product:b.product,className:"w-16 h-20 shrink-0 rounded-lg",eager:!0}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"za-display text-sm text-white leading-snug",children:b.product.title}),o.jsxs("p",{className:"text-xs text-[#70768F] mt-1",children:[b.product.years," · ",b.product.genres[0]]}),o.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.jsxs("span",{className:"flex items-center gap-1 text-[11px] px-2 py-1 rounded bg-white/5 text-purple-300/80 capitalize",children:[b.format==="digital"?o.jsx(hn,{size:11}):o.jsx(fn,{size:11})," ",b.format]}),o.jsxs("span",{className:"text-purple-400 za-display text-sm",children:["$",b.price.toFixed(2)]})]})]}),o.jsx("button",{onClick:()=>{i(v),a.length<=1&&e("home")},className:"text-[#70768F] hover:text-red-400 transition-colors p-1 shrink-0",title:"Remove item",children:o.jsx(xt,{size:14})})]},v))})]}),o.jsxs("div",{ref:g,className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Contact Details"}),o.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("input",{className:"za-input",placeholder:"Full name *",value:h.name,onChange:y("name")}),p.name&&o.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:p.name})]}),o.jsxs("div",{children:[o.jsx("input",{className:"za-input",type:"email",placeholder:"Email address *",value:h.email,onChange:y("email")}),p.email&&o.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:p.email})]}),o.jsx("input",{className:"za-input sm:col-span-2",placeholder:"Phone (optional, for WhatsApp updates)",value:h.phone,onChange:y("phone")})]})]}),l&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("h2",{className:"za-display text-lg mb-1 flex items-center gap-2 text-white",children:[o.jsx(Ur,{size:16,className:"text-purple-400"})," Shipping"]}),o.jsx("p",{className:"text-xs text-[#70768F] mb-3",children:"Required — your cart contains a USB collection."}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("textarea",{className:"za-input",rows:2,placeholder:"Street address *",value:h.shipping,onChange:y("shipping")}),p.shipping&&o.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:p.shipping}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx("input",{className:"za-input",placeholder:"City *",value:h.city,onChange:y("city")}),o.jsx("input",{className:"za-input",placeholder:"Postal code *",value:h.postalCode,onChange:y("postalCode")})]}),o.jsxs("div",{children:[o.jsxs("select",{className:"za-input",value:h.country,onChange:y("country"),children:[o.jsx("option",{value:"",children:"Select country *"}),o.jsx("option",{value:"US",children:"United States — $19.99"}),o.jsx("option",{value:"GB",children:"United Kingdom — $19.99"}),o.jsx("option",{value:"CA",children:"Canada — $19.99"}),o.jsx("option",{value:"AU",children:"Australia — $40.00"}),o.jsx("option",{value:"NZ",children:"New Zealand — $40.00"}),o.jsx("option",{value:"DE",children:"Germany — $19.99"}),o.jsx("option",{value:"FR",children:"France — $19.99"}),o.jsx("option",{value:"OTHER",children:"Other — $19.99"})]}),p.country&&o.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:p.country})]})]})]}),!l&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 flex items-center gap-3",children:[o.jsx(Jt,{size:18,className:"text-purple-400 shrink-0"}),o.jsx("p",{className:"text-sm text-[#A7ABC0]",children:"Digital orders don't require an address — your access link is delivered to your email above once payment is confirmed."})]}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Order Notes"}),o.jsx("textarea",{className:"za-input",rows:2,placeholder:"Anything we should know? (optional)",value:h.notes,onChange:y("notes")})]})]}),o.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Payment Summary"}),o.jsxs("div",{className:"mt-5 pt-4 border-t border-[rgba(255,255,255,0.06)]",children:[o.jsx("div",{className:"flex gap-2 mb-4",children:o.jsx("input",{className:"za-input",placeholder:"Coupon code",value:h.coupon,onChange:y("coupon")})}),h.coupon&&o.jsx("p",{className:`text-xs -mt-3 mb-4 ${E?"text-[#42D392]":"text-[#FFB800]"}`,children:E?"ARCHIVE10 applied — 10% off.":"This code isn't valid."}),o.jsxs("div",{className:"flex flex-col gap-1.5 text-sm text-[#A7ABC0]",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Subtotal"}),o.jsxs("span",{className:"text-white",children:["$",c.toFixed(2)]})]}),T>0&&o.jsxs("div",{className:"flex justify-between text-[#42D392]",children:[o.jsx("span",{children:"Discount (10%)"}),o.jsxs("span",{children:["−$",T.toFixed(2)]})]}),l&&o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Shipping"}),o.jsxs("span",{className:"text-white",children:["$",x.toFixed(2)]})]}),o.jsxs("div",{className:"flex justify-between za-display text-xl pt-1.5 text-white",children:[o.jsx("span",{children:"Total"}),o.jsxs("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-blue-400",children:["$",S.toFixed(2)]})]})]}),o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-4 mt-4 text-xs text-[#70768F] leading-relaxed",children:[o.jsxs("p",{className:"flex items-center gap-1.5 mb-1 za-display text-white text-sm",children:[o.jsx(is,{size:13,className:"text-purple-400"})," Payment by Payoneer"]}),"After placing your order you'll receive Payoneer payment instructions. Your order is processed once the payment is confirmed by our team."]})]})]}),o.jsxs("div",{className:"hidden sm:block mt-4",children:[o.jsxs("button",{onClick:R,disabled:m,className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[13px] py-3.5 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60 shadow-[0_10px_30px_rgba(109,74,255,0.30)] hover:shadow-[0_15px_40px_rgba(109,74,255,0.45)] transition-all",children:[m?o.jsx(It,{size:15,className:"za-spin"}):o.jsx(Hs,{size:15})," Place Order — $",S.toFixed(2)]}),o.jsxs("p",{className:"text-[11px] text-[#70768F] text-center mt-3 flex items-center justify-center gap-1",children:[o.jsx(Hs,{size:11})," Your details are only used to process this order."]})]})]})]}),o.jsx("div",{className:"sm:hidden fixed bottom-0 left-0 right-0 z-40 bg-[#0E1222] border-t border-[rgba(255,255,255,0.06)] p-3",children:o.jsxs("button",{onClick:R,disabled:m,className:"za-focus w-full bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-[13px] py-3.5 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[m?o.jsx(It,{size:15,className:"za-spin"}):o.jsx(Hs,{size:15})," Place Order — $",S.toFixed(2)]})})]})}function ik({orderId:e,email:t,onNav:r}){const{settings:n,lookupOrder:s}=Re(),[i,a]=_.useState(null),[l,c]=_.useState(!0),[u,d]=_.useState(!1);if(vn({title:"Order Confirmation",path:`/order-confirmation/${e}`,noindex:!0}),_.useEffect(()=>{let p=!0;return(async()=>{const w=await s(e,t);p&&(a(w),c(!1))})(),()=>{p=!1}},[e,t]),l)return o.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center za-ink-dim flex items-center justify-center gap-2",children:[o.jsx(It,{size:16,className:"za-spin"})," Loading your order…"]});if(!i)return o.jsx("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center za-ink-dim",children:"Order not found."});const h=i.status==="access_granted"||i.status==="completed",f=i.items.filter(p=>p.format==="digital");return o.jsxs("div",{className:"max-w-3xl mx-auto px-5 sm:px-8 py-12 za-fade-view",children:[o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-r from-purple-500 to-blue-500 flex items-center justify-center mx-auto mb-4 shadow-[0_0_30px_rgba(109,74,255,0.30)]",children:o.jsx(De,{size:26,className:"text-white"})}),o.jsx("h1",{className:"za-display text-3xl text-white",children:"Order placed"}),o.jsxs("p",{className:"text-[#A7ABC0] text-sm mt-2",children:["Order ",o.jsx("span",{className:"za-display text-purple-400",children:i.number})," · A confirmation was sent to ",i.customer.email]})]}),i.status==="pending_payment"&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[o.jsx(is,{size:16,className:"text-purple-400"})," Payment Link Sent"]}),o.jsxs("div",{className:"text-sm text-[#A7ABC0] leading-relaxed space-y-3",children:[o.jsxs("p",{children:["A personalized ",o.jsx("strong",{className:"text-white",children:"Payoneer"})," payment link has been sent to ",o.jsx("strong",{className:"text-white",children:i.customer.email}),". Please check your inbox (and spam folder) for the payment instructions."]}),o.jsxs("p",{className:"pl-4",children:["• Once you complete the payment via Payoneer, your ",o.jsx("strong",{className:"text-white",children:"digital access link will be delivered instantly by email"})," — no waiting."]}),f.length===0&&o.jsx("p",{className:"pl-4",children:"• For USB orders, your collection will be prepared for shipping as soon as the payment is confirmed."}),o.jsx("p",{className:"text-xs text-[#70768F] mt-4",children:"You can track your order status anytime on the My Orders page. Need help? Reply to the email you received or contact us."})]})]}),!h&&!["pending_payment","cancelled","refunded"].includes(i.status)&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5 flex items-center gap-3",children:[o.jsx(di,{size:20,className:"text-purple-400 shrink-0"}),o.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["Your payment has been confirmed. ",f.length>0&&"Digital access links will appear here as soon as our team approves them."]})]}),i.status==="cancelled"&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5 flex items-center gap-3",children:[o.jsx(pr,{size:20,className:"text-[#FFB800] shrink-0"}),o.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["This order was cancelled. Contact ",n.supportEmail," if you believe this is a mistake."]})]}),i.status==="refunded"&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5 flex items-center gap-3",children:[o.jsx(No,{size:20,className:"text-[#FFB800] shrink-0"}),o.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["This order has been refunded. Contact ",n.supportEmail," with any questions."]})]}),h&&f.length>0&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[o.jsx(Jt,{size:16,className:"text-[#42D392]"})," Your Digital Download"]}),o.jsx("div",{className:"flex flex-col gap-2",children:f.map(p=>o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 text-sm",children:[o.jsx("p",{className:"za-display text-white mb-1",children:p.title}),o.jsx("a",{href:i.accessLinks[p.productId],target:"_blank",rel:"noreferrer",className:"text-purple-400 break-all underline",children:i.accessLinks[p.productId]})]},p.productId))})]}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-8",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-3",children:"Order Summary"}),i.items.map((p,w)=>o.jsxs("div",{className:"flex justify-between text-sm py-1.5",children:[o.jsxs("span",{className:"text-[#A7ABC0]",children:[p.title," ",o.jsxs("span",{className:"capitalize",children:["(",p.format,")"]})]}),o.jsxs("span",{className:"text-white",children:["$",p.price.toFixed(2)]})]},w)),i.shippingCost>0&&o.jsxs("div",{className:"flex justify-between text-sm py-1.5",children:[o.jsx("span",{className:"text-[#A7ABC0]",children:"Shipping"}),o.jsxs("span",{className:"text-white",children:["$",i.shippingCost.toFixed(2)]})]}),o.jsxs("div",{className:"border-t border-[rgba(255,255,255,0.06)] mt-2 pt-2 flex justify-between za-display text-white",children:[o.jsx("span",{children:"Total"}),o.jsxs("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-blue-400",children:["$",i.total.toFixed(2)]})]})]}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsx("button",{onClick:()=>r("myorders"),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-6 py-3 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Track My Order"}),o.jsx("button",{onClick:()=>r("listing"),className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-6 py-3 text-sm text-[#A7ABC0] hover:text-white transition-colors",children:"Keep Browsing"})]})]})}const Qn={pending_payment:{label:"Payment Pending",icon:is,tone:"text-[#FFB800]"},payment_reported:{label:"Payment Reported: Awaiting Confirmation",icon:Ou,tone:"text-purple-400"},paid:{label:"Paid",icon:di,tone:"text-purple-400"},access_granted:{label:"Digital Download Ready",icon:Jt,tone:"text-[#42D392]"},shipped:{label:"Shipped",icon:Ur,tone:"text-purple-400"},completed:{label:"Completed",icon:De,tone:"text-[#42D392]"},cancelled:{label:"Cancelled",icon:xt,tone:"text-[#FFB800]"},refunded:{label:"Refunded",icon:No,tone:"text-[#FFB800]"}};function ak({onNav:e}){const{myOrders:t,settings:r,refreshMyOrders:n}=Re(),[s,i]=_.useState(!0);return vn({title:"My Orders",path:"/my-orders",noindex:!0}),_.useEffect(()=>{(async()=>(await n(),i(!1)))()},[]),s?o.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center text-[#70768F] flex items-center justify-center gap-2",children:[o.jsx(It,{size:16,className:"za-spin"})," Loading your orders…"]}):t.length===0?o.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[o.jsx(Lm,{size:40,className:"text-[#70768F] mx-auto mb-4"}),o.jsx("h1",{className:"za-display text-2xl mb-2 text-white",children:"No orders yet"}),o.jsx("p",{className:"text-[#A7ABC0] text-sm mb-6",children:"Orders you place in this browser will appear here with their payment and delivery status."}),o.jsx("button",{onClick:()=>e("listing"),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-6 py-3 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Browse Collections"})]}):o.jsxs("div",{className:"max-w-4xl mx-auto px-5 sm:px-8 py-10 za-fade-view",children:[o.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white mb-8",children:"My Orders"}),o.jsx("div",{className:"flex flex-col gap-4",children:t.map(a=>{const l=Qn[a.status]||Qn.pending_payment,c=a.status==="access_granted"||a.status==="completed",u=a.items.filter(d=>d.format==="digital");return o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"za-display text-white",children:a.number}),o.jsxs("p",{className:"text-xs text-[#70768F]",children:[new Date(a.createdAt).toLocaleDateString()," · ",a.items.length," item",a.items.length>1?"s":""," · $",a.total.toFixed(2)]})]}),o.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${l.tone}`,children:[o.jsx(l.icon,{size:15})," ",l.label]})]}),o.jsx("div",{className:"text-sm text-[#A7ABC0]",children:a.items.map((d,h)=>o.jsxs("p",{children:[d.title," ",o.jsxs("span",{className:"capitalize",children:["(",d.format,")"]})]},h))}),a.status==="pending_payment"&&o.jsx("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs text-[#70768F]",children:o.jsx("p",{children:"A payment link has been sent to your email. Please check your inbox and follow the instructions to complete your payment. Your digital download link will be sent by email once payment is confirmed and approved."})}),!c&&u.length>0&&!["pending_payment","cancelled","refunded"].includes(a.status)&&o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs text-[#70768F] flex items-center gap-2",children:[o.jsx(Ou,{size:13})," Your digital download is pending approval."]}),c&&u.map(d=>o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs flex flex-col gap-1",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-white",children:[o.jsx(Jt,{size:13,className:"text-[#42D392]"})," ",d.title]}),o.jsx("a",{href:a.accessLinks[d.productId],target:"_blank",rel:"noreferrer",className:"text-purple-400 underline break-all",children:a.accessLinks[d.productId]})]},d.productId)),a.tracking&&o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs flex items-center gap-2 text-[#70768F]",children:[o.jsx(Ur,{size:13,className:"text-purple-400"})," Tracking number: ",o.jsx("span",{className:"za-display text-white",children:a.tracking})]})]},a.id)})})]})}const Zh={contact:{title:"Contact Us",icon:Jt,intro:"Have a question about an order, a product, or anything else? We're happy to help.",sections:[{heading:"Support email",body:"Email us at support@tvseriesarchive.com for order questions, delivery issues, or general inquiries — we typically reply within one business day.",email:"support@tvseriesarchive.com"},{heading:"WhatsApp",body:"For faster responses on order status or payment confirmation, WhatsApp is the quickest way to reach our team."},{heading:"Before you write",body:"If your question is about an order, please have your order number ready (found in your confirmation email and on the My Orders page) — it helps us respond faster."}]},faq:{title:"Frequently Asked Questions",icon:Dm,intro:"Common questions about ordering, delivery, and downloads.",faqs:[{q:"What's the difference between Digital and USB?",a:"Digital is a private Google Drive download link sent by email once your payment is confirmed and approved. USB is a physical drive preloaded with the full collection, shipped to your address."},{q:"How do I pay?",a:"We use a manual Payoneer payment flow: you place your order, receive Payoneer payment instructions, and our team confirms your payment before processing the order."},{q:"How long until I get my digital download link?",a:"Once payment is confirmed, our team reviews and approves the order: a manual step that keeps every link secure. This typically happens within one business day."},{q:"How long does USB shipping take?",a:"Every USB order ships express, worldwide, arriving in up to 5 business days. You'll receive a tracking number by email once your order ships."},{q:"Can I get a refund?",a:"See our Refund Policy page for the full details on digital and USB orders."},{q:"Is my payment information safe?",a:"We never ask for or store card details. Payment is handled directly through Payoneer, and our team only confirms receipt on our end."}]},refund:{title:"Refund Policy",icon:No,intro:"We want you to be happy with your order. Here's exactly how refunds work for each format.",sections:[{heading:"Digital orders",body:"Once your download link has been approved and sent, the order is considered delivered and is not eligible for a refund, since the content has been made available to you. If the link was never sent (for example, your order was cancelled before approval), a full refund applies."},{heading:"USB orders",body:"If a USB order arrives damaged, defective, or doesn't match what was ordered, contact us within 14 days of delivery for a replacement or refund. Orders that are cancelled before shipping are fully refundable."},{heading:"How refunds are processed",body:"Refunds are issued back through Payoneer, matching your original payment method. Processing times depend on Payoneer and may take several business days."},{heading:"Requesting a refund",body:"Contact us with your order number and the reason for the request — see the Contact page."}]},privacy:{title:"Privacy Policy",icon:Hs,intro:"This page explains what information we collect and how it's used.",sections:[{heading:"What we collect",body:"At checkout, we collect your name, email, and phone (optional) for every order. A mailing address is only collected when your order includes a USB item — digital-only orders don't require one. This information is used only to process and deliver your order."},{heading:"How it's stored",body:"Order information is stored securely in our database. Payment is handled entirely by Payoneer — we do not collect or store card numbers or bank details."},{heading:"Who can see it",body:"Order details are only visible to our admin team and to you, by looking up your own order with your order number and the email you used at checkout."},{heading:"Cookies and analytics",body:"We may use basic, privacy-respecting analytics to understand site traffic. We do not sell customer data to third parties."},{heading:"Your rights",body:"You can request a copy of your data or ask us to delete it by contacting support — see the Contact page."}]},terms:{title:"Terms of Service",icon:Um,intro:"By placing an order with TvSeriesArchive, you agree to the following terms.",sections:[{heading:"Products",body:"We sell classic TV series collections in Digital Download and/or USB format, as described on each product page. Product descriptions, cast, and years are prepared to be accurate but are provided as reference information, not a guarantee of completeness of every episode or season."},{heading:"Orders and payment",body:"Orders are processed manually after payment via Payoneer is confirmed by our team. We reserve the right to cancel an order if payment cannot be verified."},{heading:"Delivery",body:"Digital download links are sent after manual review and approval, and USB items are shipped after payment confirmation. See Delivery Information for details."},{heading:"Acceptable use",body:"Digital and USB content is provided for personal, non-commercial viewing. Redistribution or resale of delivered content is not permitted."},{heading:"Changes",body:"We may update these terms from time to time; the current version is always available on this page."}]},delivery:{title:"Delivery Information",icon:Ur,intro:"How and when you'll receive your order, for both formats.",sections:[{heading:"Digital orders",body:"After you place a digital order, you'll receive Payoneer payment instructions. Once payment is confirmed and your order is manually reviewed and approved, your private Google Drive download link is sent to your email and made visible on your My Orders page. This review step protects both you and us, and typically takes place within one business day of payment confirmation."},{heading:"USB orders",body:"USB collections are prepared after payment is confirmed, then shipped express, worldwide, arriving in up to 5 business days. A tracking number is emailed to you as soon as your order ships."},{heading:"Order status",body:"You can check the status of any order at any time on the My Orders page, using your order number and the email you used at checkout."}]},digitalCollections:{title:"Digital Downloads: How It Works",icon:hn,intro:"Everything you need to know about our digital downloads: what you get, how delivery works, and why they're yours for life.",sections:[{heading:"What are Digital Downloads?",body:"A Digital Download gives you lifetime ownership of a complete classic TV series through a private Google Drive folder, organized by season and episode. No apps, no subscriptions, no recurring fees. Download the files to keep forever, or stream them straight from the folder."},{heading:"How delivery works",body:"Place your order and complete payment through Payoneer. Once confirmed, we prepare your private Google Drive link and send it to your email and your My Orders page, usually within one business day. From there, stream your series online or download it to keep, whenever you're ready."},{heading:"What you get",body:"Every Digital Download includes the complete series: all seasons and episodes as they originally aired, in the best quality available. Files are named and organized so you can pick up right where you left off. Many series include original air dates, cast information, and episode guides alongside the video files."},{heading:"Yours for life, no expiry",body:"Your download link never expires. As long as it stays active, which we maintain, you can come back months or years later and grab your collection again. If a link ever goes down, contact us and we'll send you a fresh one."},{heading:"No subscriptions, no DRM",body:"This isn't a streaming subscription. Pay once and own the download. Files are standard video formats (MP4/MKV) that play on any device: computer, tablet, phone, or smart TV. No proprietary software, no DRM restrictions."},{heading:"How is it different from USB?",body:"Digital downloads skip the shipping wait entirely. USB is a physical flash drive shipped to your door. The content is identical either way, just the delivery method differs. See our USB Collections page for physical delivery details."}]},usbCollections:{title:"USB Collections: Physical Delivery",icon:fn,intro:"How our USB flash drive collections work: what's included, shipping, and quality.",devices:[{icon:Ja,label:"Smart TVs"},{icon:qx,label:"PC & Mac"},{icon:Ux,label:"Car stereos"},{icon:Mx,label:"Game consoles"},{icon:Gx,label:"Media players"}],sections:[{heading:"What are USB Collections?",body:"USB Collections are complete classic TV series delivered on a high-quality USB flash drive. Each drive contains the full series, every season and every episode, organized, labeled, and ready to play. Just plug into any compatible device and start watching."},{heading:"What's included on the USB",body:"Each USB drive contains the complete series in high-quality video format (MP4/MKV), organized in folders by season with clear episode numbering. You also get an episode guide, original air dates, and cast information. Drives are formatted FAT32/exFAT, compatible with Windows, Mac, Linux, and most smart TVs."},{heading:"Shipping and delivery",body:"Every USB order ships express, worldwide, arriving in up to 5 business days. Once your payment is confirmed, we prepare your drive and ship it with a tracking number emailed straight to you: no separate express upgrade to pay for, it's included on every order."},{heading:"Quality and playback",body:"Video quality ranges from standard definition to HD depending on the source material. Everything plays on any device: computer, laptop, tablet, smart TV, game console, car stereo, or USB media player. No internet connection needed after it arrives: perfect for offline viewing anywhere."},{heading:"How is it different from a Digital Download?",body:"A USB is a physical item shipped to your address, ready to use the moment it arrives, no internet required. A Digital Download is a private Google Drive link sent by email once approved. Same complete series either way, just a different way to get it."},{heading:"Care and handling",body:"USB drives are standard consumer-grade flash drives. Handle with care: avoid extreme temperatures, moisture, and physical damage. We recommend backing up the files to your computer or an external hard drive for long-term preservation."}]},archiveRequest:{title:"Special Archive Request",icon:as,intro:"Don't see the series you're looking for? Tell us what you want and we'll track it down.",sections:[{heading:"How it works",body:"If you're looking for a specific classic TV series that isn't in our catalog yet, you can submit a Special Archive Request. Our team searches for, acquires, and prepares the series — then adds it to the archive just for you. You get first access when it's ready."},{heading:"What we can find",body:"We specialize in classic TV from the 1950s through early 2000s — American, British, Australian, and more. If it aired on television and isn't easily available on streaming platforms, there's a good chance we can find it. Rare, obscure, or forgotten series are our specialty."},{heading:"What we need from you",body:"The more detail you provide, the better our chances: the full series title, approximate years it aired, country of origin, genre, any networks or production companies, and anything else you remember. Even a vague description can help us identify it."},{heading:"Pricing and availability",body:"Pricing for archive requests depends on rarity and availability. We'll research the series first and provide a quote before proceeding — no obligation. Delivery can be digital, USB, or both, at standard pricing once the series is added."},{heading:"How to submit a request",body:"Contact us through the Contact page with as much detail as possible about the series. Include your name and email so we can follow up. We'll respond within a few business days with our findings and a quote."},{heading:"Already in the catalog?",body:"Before submitting a request, use the search bar or browse by genre/decade. There's a good chance we already have what you're looking for — with over 1,200 series in the archive."}]},digitalAccess:{title:"Digital Download: How It Works",icon:hn,intro:"Own your favorite classic TV series for life. A Digital Download delivers the complete series straight to your own private Google Drive folder: stream it instantly online or download it to keep, with no subscriptions and no expiry.",sections:[{heading:"What is a Digital Download?",body:"Every Digital Download unlocks a complete classic TV series through your own private Google Drive folder, organized cleanly by season and episode. Watch it straight from the folder on any device, or download the files to your computer, tablet, or phone to build a permanent, offline archive. The choice is yours."},{heading:"How delivery works",body:"Place your order and complete payment through Payoneer. Once confirmed, we prepare your private Google Drive link and send it to your email and your My Orders page, usually within one business day. From that moment, your archive is yours: stream it or download it, any time you like."},{heading:"Why collectors choose digital",body:"No shipping wait, no subscription, no recurring fees. Pay once and own the complete series for life. Stream it on your laptop, tablet, phone, or smart TV, or download it to keep forever, whether you want it online or safely stored offline."},{heading:"Yours forever, no expiry",body:"Your Google Drive link never expires. Come back next month or in five years and your collection is still there. If a link ever goes down, just contact us and we'll send you a fresh one right away."}]}};function ok({pageKey:e,onNav:t}){const r=Zh[e]||Zh.contact,n=r.icon,s=e==="faq"&&r.faqs?{"@context":"https://schema.org","@type":"FAQPage",mainEntity:r.faqs.map(i=>({"@type":"Question",name:i.q,acceptedAnswer:{"@type":"Answer",text:i.a}}))}:null;return vn({title:r.title,description:r.intro,path:`/pages/${e||"contact"}`,jsonLd:s}),o.jsxs("div",{className:"max-w-3xl mx-auto px-5 sm:px-8 py-12 za-fade-view",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-6",children:[o.jsx("button",{onClick:()=>t("home"),className:"za-focus hover:text-white",children:"Home"}),o.jsx(sn,{size:12}),o.jsx("span",{className:"text-white/60",children:r.title})]}),o.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[o.jsx(n,{size:22,className:"text-purple-400",strokeWidth:1.5}),o.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white",children:r.title})]}),o.jsx("p",{className:"text-[#A7ABC0] mb-8",children:r.intro}),r.devices&&o.jsx("div",{className:"flex flex-wrap gap-3 mb-8",children:r.devices.map(({icon:i,label:a})=>o.jsxs("div",{className:"flex items-center gap-2 bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-full px-4 py-2 text-xs text-[#A7ABC0]",children:[o.jsx(i,{size:14,className:"text-purple-400"})," ",a]},a))}),r.faqs?o.jsx("div",{className:"divide-y divide-[rgba(255,255,255,0.06)]",children:r.faqs.map((i,a)=>o.jsx(lk,{q:i.q,a:i.a},a))}):o.jsx("div",{className:"flex flex-col gap-6",children:r.sections.map(i=>o.jsxs("div",{children:[o.jsx("h2",{className:"za-display text-lg text-white mb-1.5",children:i.heading}),o.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:i.body}),i.email&&o.jsx("a",{href:`mailto:${i.email}`,className:"inline-block mt-2 za-focus text-purple-400 underline text-sm hover:text-purple-300 transition-colors",children:i.email})]},i.heading))}),o.jsxs("div",{className:"mt-10 bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 flex items-center gap-3",children:[o.jsx(Dm,{size:18,className:"text-purple-400 shrink-0"}),o.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["Still have a question? ",o.jsx("button",{onClick:()=>t("trust",{page:"contact"}),className:"za-focus text-purple-400 underline",children:"Contact us"}),"."]})]})]})}function lk({q:e,a:t}){const[r,n]=_.useState(!1);return o.jsxs("div",{className:"py-4",children:[o.jsxs("button",{onClick:()=>n(s=>!s),className:"za-focus w-full flex items-center justify-between text-left",children:[o.jsx("span",{className:"za-display text-[15px] text-white",children:e}),o.jsx(Ai,{size:16,className:`text-[#70768F] transition-transform ${r?"rotate-180":""}`})]}),r&&o.jsx("p",{className:"text-sm text-[#A7ABC0] mt-2.5 leading-relaxed pr-6",children:t})]})}function ck({tab:e,setTab:t,children:r}){const n=[["dashboard","Dashboard",Wx],["products","Products",Iu],["import","Bulk Import",qm],["orders","Orders",Lm],["settings","Settings",Xx]];return o.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12 py-8 za-fade-view",children:[o.jsx("h1",{className:"za-display text-3xl text-white mb-6",children:"Admin Panel"}),o.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 mb-6 border-b border-[rgba(255,255,255,0.06)]",children:n.map(([s,i,a])=>o.jsxs("button",{onClick:()=>t(s),className:`za-focus flex items-center gap-1.5 text-sm px-4 py-2.5 rounded-t-lg whitespace-nowrap transition-colors ${e===s?"bg-white/5 text-purple-400 border-b-2 border-purple-500":"text-[#70768F] hover:text-white"}`,children:[o.jsx(a,{size:15})," ",i]},s))}),r]})}function uk({setTab:e}){const{adminProducts:t,orders:r}=Re(),n=t.filter(c=>c.enabled),s=t.filter(c=>c.needsReview),i=r.filter(c=>c.status==="pending_payment"),a=r.filter(c=>!["pending_payment","cancelled","refunded"].includes(c.status)).reduce((c,u)=>c+u.total,0),l=[{label:"Products (live)",value:`${n.length} / ${t.length}`,icon:Iu,onClick:()=>e("products")},{label:"Needs Review",value:s.length,icon:pr,onClick:()=>e("products"),warn:s.length>0},{label:"Orders Awaiting Payment",value:i.length,icon:is,onClick:()=>e("orders"),warn:i.length>0},{label:"Confirmed Revenue",value:`$${a.toFixed(2)}`,icon:zu,onClick:()=>e("orders")}];return o.jsxs("div",{children:[o.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:l.map(c=>o.jsxs("button",{onClick:c.onClick,className:"za-focus bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 text-left hover:border-purple-500/30 transition-all group",children:[o.jsx(c.icon,{size:18,className:c.warn?"text-[#FFB800]":"text-purple-400"}),o.jsx("p",{className:"za-display text-2xl mt-2 text-white",children:c.value}),o.jsx("p",{className:"text-xs text-[#70768F] mt-1",children:c.label})]},c.label))}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-3",children:"Latest Orders"}),r.length===0?o.jsx("p",{className:"text-sm text-[#70768F]",children:"No orders yet."}):o.jsx("div",{className:"flex flex-col divide-y divide-[rgba(255,255,255,0.06)]",children:r.slice(0,5).map(c=>{const u=Qn[c.status];return o.jsxs("div",{className:"flex items-center justify-between py-2.5 text-sm",children:[o.jsx("span",{className:"za-display text-white",children:c.number}),o.jsx("span",{className:"text-[#70768F]",children:c.customer.name}),o.jsxs("span",{className:"text-white",children:["$",c.total.toFixed(2)]}),o.jsxs("span",{className:`flex items-center gap-1 ${u.tone}`,children:[o.jsx(u.icon,{size:13})," ",u.label]})]},c.id)})})]})]})}function dk({product:e,onClose:t,onSave:r}){const[n,s]=_.useState({title:e.title,displayTitle:e.displayTitle,years:e.years,genres:e.genres.join(", "),country:e.country,language:e.language,decades:e.decades.join(", "),seasons:e.seasons,episodes:e.episodes,cast:e.cast.join(", "),shortDesc:e.shortDesc,quality:e.quality,digitalPrice:e.formats.digital.price,usbPrice:e.formats.usb.price,digitalAvailable:e.formats.digital.available,usbAvailable:e.formats.usb.available,coverUrl:e.coverUrl||"",enabled:e.enabled,needsReview:e.needsReview,bestSeller:e.bestSeller,limited:e.limited,isHD:e.isHD,deliveryLink:e.deliveryLink||""}),i=c=>u=>s(d=>({...d,[c]:u.target.type==="checkbox"?u.target.checked:u.target.value})),a=()=>{r({title:n.title,displayTitle:n.displayTitle,years:n.years,genres:n.genres.split(",").map(c=>c.trim()).filter(Boolean),country:n.country,language:n.language,decades:n.decades.split(",").map(c=>c.trim()).filter(Boolean),seasons:Number(n.seasons)||1,episodes:Number(n.episodes)||0,cast:n.cast.split(",").map(c=>c.trim()).filter(Boolean),shortDesc:n.shortDesc,quality:n.quality,digitalPrice:Number(n.digitalPrice),usbPrice:Number(n.usbPrice),digitalAvailable:n.digitalAvailable,usbAvailable:n.usbAvailable,coverUrl:n.coverUrl.trim()||null,enabled:n.enabled,needsReview:n.needsReview,bestSeller:n.bestSeller,limited:n.limited,isHD:n.isHD,deliveryLink:n.deliveryLink.trim()||null}),t()},l=({label:c,children:u})=>o.jsxs("label",{className:"flex flex-col gap-1 text-xs za-ink-dim",children:[c,u]});return o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:t}),o.jsxs("div",{className:"relative bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[22px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] max-w-2xl w-full p-6 max-h-[88vh] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"za-display text-xl text-white",children:"Edit Product"}),o.jsx("button",{onClick:t,className:"za-focus p-1",children:o.jsx(xt,{size:18,className:"text-[#A7ABC0]"})})]}),e.aiConfidence!=null&&o.jsxs("div",{className:`rounded-[13px] px-3 py-2 mb-4 text-xs flex items-center gap-2 bg-white/5 ${e.needsReview?"text-[#FFB800]":"text-[#42D392]"}`,children:[o.jsx(Ka,{size:13})," AI confidence: ",e.aiConfidence,"% ",e.needsReview&&"— flagged for review"]}),o.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[o.jsx(l,{label:"Title",children:o.jsx("input",{className:"za-input",value:n.title,onChange:i("title")})}),o.jsx(l,{label:"Display Title",children:o.jsx("input",{className:"za-input",value:n.displayTitle,onChange:i("displayTitle")})}),o.jsx(l,{label:"Years (e.g. 1958–1963)",children:o.jsx("input",{className:"za-input",value:n.years,onChange:i("years")})}),o.jsx(l,{label:"Genres (comma separated)",children:o.jsx("input",{className:"za-input",value:n.genres,onChange:i("genres")})}),o.jsx(l,{label:"Country",children:o.jsx("input",{className:"za-input",value:n.country,onChange:i("country")})}),o.jsx(l,{label:"Language",children:o.jsx("input",{className:"za-input",value:n.language,onChange:i("language")})}),o.jsx(l,{label:"Decades (comma separated)",children:o.jsx("input",{className:"za-input",value:n.decades,onChange:i("decades")})}),o.jsx(l,{label:"Cast (comma separated)",children:o.jsx("input",{className:"za-input",value:n.cast,onChange:i("cast")})}),o.jsx(l,{label:"Seasons",children:o.jsx("input",{className:"za-input",type:"number",value:n.seasons,onChange:i("seasons")})}),o.jsx(l,{label:"Episodes",children:o.jsx("input",{className:"za-input",type:"number",value:n.episodes,onChange:i("episodes")})}),o.jsx(l,{label:"Digital Price ($)",children:o.jsx("input",{className:"za-input",type:"text",inputMode:"decimal",defaultValue:n.digitalPrice,onChange:c=>s(u=>({...u,digitalPrice:c.target.value}))})}),o.jsx(l,{label:"USB Price ($)",children:o.jsx("input",{className:"za-input",type:"text",inputMode:"decimal",defaultValue:n.usbPrice,onChange:c=>s(u=>({...u,usbPrice:c.target.value}))})}),o.jsx(l,{label:"Quality",children:o.jsx("input",{className:"za-input",value:n.quality,onChange:i("quality")})}),o.jsx(l,{label:"Cover Image URL (optional — auto cover used if empty)",children:o.jsx("input",{className:"za-input",value:n.coverUrl,onChange:i("coverUrl"),placeholder:"https://…"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsx("p",{className:"text-xs text-[#70768F] mb-1",children:"Or upload an image directly (stored in Supabase, fills the URL field above)"}),o.jsx(__,{onUploaded:c=>s(u=>({...u,coverUrl:c}))})]}),o.jsxs("label",{className:"flex flex-col gap-1 text-xs text-[#70768F] mt-4",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-[#FFB800]",children:[o.jsx(pr,{size:11})," Delivery Link (private — never shown to customers until an order is approved)"]}),o.jsx("input",{className:"za-input",value:n.deliveryLink,onChange:i("deliveryLink"),placeholder:"Google Drive link"})]}),o.jsxs("label",{className:"flex flex-col gap-1 text-xs text-[#70768F] mt-3",children:["Short Description",o.jsx("textarea",{className:"za-input",rows:2,value:n.shortDesc,onChange:i("shortDesc")})]}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 mt-4 text-sm text-[#A7ABC0]",children:[["digitalAvailable","Digital"],["usbAvailable","USB"],["enabled","Visible in store"],["needsReview","Needs review"],["bestSeller","Best Seller"],["limited","Limited"],["isHD","HD"]].map(([c,u])=>o.jsxs("label",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",checked:n[c],onChange:i(c),className:"accent-purple-500"}),u]},c))}),o.jsxs("div",{className:"flex gap-2 justify-end mt-6",children:[o.jsx("button",{onClick:t,className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-2.5 text-sm text-[#A7ABC0]",children:"Cancel"}),o.jsx("button",{onClick:a,className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Save Changes"})]})]})]})}function hk({count:e,onClose:t,onApply:r}){const[n,s]=_.useState("both"),[i,a]=_.useState("percent"),[l,c]=_.useState("");return o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:t}),o.jsxs("div",{className:"relative bg-[#0E1222] border border-[rgba(255,255,255,0.10)] rounded-[22px] shadow-[0_18px_45px_rgba(0,0,0,0.30)] max-w-md w-full p-6",children:[o.jsx("h3",{className:"za-display text-xl text-white mb-1",children:"Bulk Price Update"}),o.jsxs("p",{className:"text-xs text-[#70768F] mb-4",children:["Applies to ",e," selected product",e>1?"s":"","."]}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsxs("select",{className:"za-input",value:n,onChange:u=>s(u.target.value),children:[o.jsx("option",{value:"both",className:"bg-[#0E1222]",children:"Digital + USB prices"}),o.jsx("option",{value:"digital",className:"bg-[#0E1222]",children:"Digital price only"}),o.jsx("option",{value:"usb",className:"bg-[#0E1222]",children:"USB price only"})]}),o.jsxs("select",{className:"za-input",value:i,onChange:u=>a(u.target.value),children:[o.jsx("option",{value:"percent",className:"bg-[#0E1222]",children:"Change by percentage (e.g. 10 or -10)"}),o.jsx("option",{value:"amount",className:"bg-[#0E1222]",children:"Change by amount in $ (e.g. 2 or -2)"}),o.jsx("option",{value:"set",className:"bg-[#0E1222]",children:"Set exact price in $"})]}),o.jsx("input",{className:"za-input",type:"number",step:"0.01",placeholder:"Value",value:l,onChange:u=>c(u.target.value)})]}),o.jsxs("div",{className:"flex gap-2 justify-end mt-5",children:[o.jsx("button",{onClick:t,className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-2.5 text-sm text-[#A7ABC0]",children:"Cancel"}),o.jsx("button",{onClick:()=>{l!==""&&(r(n,i,Number(l)),t())},className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Apply"})]})]})]})}function fk(){const{adminProducts:e,updateProduct:t,deleteProducts:r}=Re(),[n,s]=_.useState(""),[i,a]=_.useState(!1),[l,c]=_.useState(0),[u,d]=_.useState([]),[h,f]=_.useState(null),[p,w]=_.useState(!1),m=_.useMemo(()=>{const S=n.toLowerCase();return e.filter(A=>!(i&&!A.needsReview||S&&!`${A.title} ${A.genres.join(" ")} ${A.years}`.toLowerCase().includes(S))).sort((A,R)=>R.createdAt-A.createdAt)},[e,n,i]),k=Math.max(1,Math.ceil(m.length/wl)),y=m.slice(l*wl,(l+1)*wl);_.useEffect(()=>{c(0)},[n,i]);const g=S=>d(A=>A.includes(S)?A.filter(R=>R!==S):[...A,S]),x=y.length>0&&y.every(S=>u.includes(S.id)),E=()=>d(S=>x?S.filter(A=>!y.some(R=>R.id===A)):[...new Set([...S,...y.map(A=>A.id)])]),T=(S,A,R)=>{u.forEach(b=>{const v=e.find(j=>j.id===b);if(!v)return;const C=j=>A==="percent"?Math.max(.5,j*(1+R/100)):A==="amount"?Math.max(.5,j+R):Math.max(.5,R);t(b,{digitalPrice:S!=="usb"?Number(C(v.formats.digital.price).toFixed(2)):v.formats.digital.price,usbPrice:S!=="digital"?Number(C(v.formats.usb.price).toFixed(2)):v.formats.usb.price})}),d([])};return o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[o.jsxs("div",{className:"flex items-center bg-white/5 border border-white/[0.08] rounded-full px-4 py-2.5 gap-2 flex-1 min-w-[200px] max-w-sm",children:[o.jsx(as,{size:15,className:"text-[#70768F] shrink-0"}),o.jsx("input",{value:n,onChange:S=>s(S.target.value),placeholder:"Search products…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white"})]}),o.jsxs("label",{className:"flex items-center gap-2 text-sm text-[#A7ABC0]",children:[o.jsx("input",{type:"checkbox",checked:i,onChange:S=>a(S.target.checked),className:"accent-purple-500"})," Needs review only"]}),o.jsxs("span",{className:"text-xs text-[#70768F] ml-auto",children:[m.length," products"]})]}),u.length>0&&o.jsxs("div",{className:"bg-white/5 rounded-[17px] px-4 py-2.5 mb-4 flex flex-wrap items-center gap-3 text-sm text-[#A7ABC0]",children:[o.jsxs("span",{className:"za-display text-white",children:[u.length," selected"]}),o.jsxs("button",{onClick:()=>w(!0),className:"za-focus flex items-center gap-1.5 hover:text-purple-400 transition-colors",children:[o.jsx(zu,{size:14})," Bulk price"]}),o.jsxs("button",{onClick:()=>{u.forEach(S=>t(S,{enabled:!0})),d([])},className:"za-focus flex items-center gap-1.5 hover:text-purple-400 transition-colors",children:[o.jsx(Fm,{size:14})," Enable"]}),o.jsxs("button",{onClick:()=>{u.forEach(S=>t(S,{enabled:!1})),d([])},className:"za-focus flex items-center gap-1.5 hover:text-purple-400 transition-colors",children:[o.jsx(xt,{size:14})," Disable"]}),o.jsxs("button",{onClick:()=>{u.forEach(S=>t(S,{needsReview:!1})),d([])},className:"za-focus flex items-center gap-1.5 hover:text-purple-400 transition-colors",children:[o.jsx(De,{size:14})," Approve"]}),o.jsxs("button",{onClick:()=>{window.confirm(`Delete ${u.length} products? This cannot be undone.`)&&(r(u),d([]))},className:"za-focus flex items-center gap-1.5 text-[#FFB800]",children:[o.jsx(Hm,{size:14})," Delete"]})]}),o.jsx("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] overflow-hidden overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm min-w-[720px]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"bg-white/5 text-left text-xs text-[#70768F]",children:[o.jsx("th",{className:"p-3",children:o.jsx("input",{type:"checkbox",checked:x,onChange:E,className:"accent-purple-500"})}),o.jsx("th",{className:"p-3",children:"Product"}),o.jsx("th",{className:"p-3",children:"Genre"}),o.jsx("th",{className:"p-3",children:"Digital"}),o.jsx("th",{className:"p-3",children:"USB"}),o.jsx("th",{className:"p-3",children:"Status"}),o.jsx("th",{className:"p-3",children:"AI"}),o.jsx("th",{className:"p-3"})]})}),o.jsx("tbody",{className:"divide-y divide-[rgba(255,255,255,0.06)]",children:y.map(S=>o.jsxs("tr",{className:S.enabled?"text-white":"opacity-50 text-white",children:[o.jsx("td",{className:"p-3",children:o.jsx("input",{type:"checkbox",checked:u.includes(S.id),onChange:()=>g(S.id),className:"accent-purple-500"})}),o.jsx("td",{className:"p-3",children:o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(qr,{product:S,className:"w-9 h-11 shrink-0 rounded-lg"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"za-display truncate max-w-[200px]",children:S.title}),o.jsx("p",{className:"text-xs text-[#70768F]",children:S.years})]})]})}),o.jsx("td",{className:"p-3 text-[#A7ABC0]",children:S.genres[0]}),o.jsx("td",{className:"p-3",children:S.formats.digital.available?`$${S.formats.digital.price.toFixed(2)}`:"—"}),o.jsx("td",{className:"p-3",children:S.formats.usb.available?`$${S.formats.usb.price.toFixed(2)}`:"—"}),o.jsx("td",{className:"p-3",children:S.needsReview?o.jsxs("span",{className:"text-[#FFB800] flex items-center gap-1 text-xs",children:[o.jsx(pr,{size:12})," Review"]}):S.enabled?o.jsxs("span",{className:"text-[#42D392] flex items-center gap-1 text-xs",children:[o.jsx(De,{size:12})," Live"]}):o.jsx("span",{className:"text-[#70768F] text-xs",children:"Hidden"})}),o.jsx("td",{className:"p-3 text-xs text-[#70768F]",children:S.aiConfidence!=null?`${S.aiConfidence}%`:"—"}),o.jsx("td",{className:"p-3",children:o.jsx("button",{onClick:()=>f(S),className:"za-focus p-1.5 rounded hover:bg-white/5 text-[#A7ABC0] hover:text-white transition-colors",children:o.jsx(Bm,{size:14})})})]},S.id))})]})}),k>1&&o.jsxs("div",{className:"flex items-center justify-center gap-3 mt-4 text-sm",children:[o.jsx("button",{disabled:l===0,onClick:()=>c(S=>S-1),className:"za-focus bg-white/5 border border-white/10 rounded-full p-2 disabled:opacity-40 text-[#A7ABC0]",children:o.jsx(Bx,{size:15})}),o.jsxs("span",{className:"text-[#70768F]",children:["Page ",l+1," of ",k]}),o.jsx("button",{disabled:l>=k-1,onClick:()=>c(S=>S+1),className:"za-focus bg-white/5 border border-white/10 rounded-full p-2 disabled:opacity-40 text-[#A7ABC0]",children:o.jsx(sn,{size:15})})]}),h&&o.jsx(dk,{product:h,onClose:()=>f(null),onSave:S=>t(h.id,S)}),p&&o.jsx(hk,{count:u.length,onClose:()=>w(!1),onApply:T})]})}function pk({setTab:e}){const{upsertProducts:t,adminProducts:r}=Re(),[n,s]=_.useState([]),[i,a]=_.useState(""),[l,c]=_.useState("idle"),[u,d]=_.useState({done:0,total:0,failed:0}),[h,f]=_.useState([]),p=_.useRef(null),w=_.useRef(!1),m=_.useMemo(()=>new Set(r.map(S=>S.slug)),[r]),k=S=>{tw.parse(S,{header:!0,skipEmptyLines:!0,complete:A=>{const R=A.data.map(b=>{const v={};return Object.keys(b).forEach(C=>{v[C.trim().toLowerCase().replace(/\s+/g,"_")]=String(b[C]).trim()}),{title:v.title||v.name||v.series||"",years:v.years||v.year||void 0,digitalPrice:v.digital_price?Number(v.digital_price):void 0,usbPrice:v.usb_price?Number(v.usb_price):void 0,coverUrl:v.image_url||v.cover_url||void 0,country:v.country||void 0,deliveryLink:v.delivery_link||void 0}}).filter(b=>b.title);s(R),c(R.length?"ready":"idle")},error:()=>c("idle")})},y=()=>{const S=i.split(`
`).map(A=>A.trim()).filter(Boolean).map(A=>({title:A}));s(S),S.length&&c("ready")},g=n.filter(S=>m.has(yg(`${S.title} complete series`))).length,x=async()=>{c("enriching"),w.current=!1;const S=[];d({done:0,total:n.length,failed:0});const A=5;for(let R=0;R<n.length&&!w.current;R+=A){const b=n.slice(R,R+A);try{const v=await W_(b.map(C=>C.title));b.forEach((C,j)=>{const N=v[j];S.push(N?V_(N,C):lr({...C,needsReview:!0,aiConfidence:0}))})}catch(v){console.error("Enrichment batch failed:",v),b.forEach(C=>S.push(lr({...C,needsReview:!0,aiConfidence:0}))),d(C=>({...C,failed:C.failed+b.length}))}d(v=>({...v,done:Math.min(R+A,n.length)})),f([...S])}await t(S),f(S),c("done")},E=async()=>{const S=n.map(A=>lr({...A,needsReview:!0,aiConfidence:null}));await t(S),f(S),c("done")},T=()=>{s([]),a(""),f([]),c("idle"),p.current&&(p.current.value="")};return o.jsxs("div",{className:"max-w-3xl",children:[l==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-1 flex items-center gap-2",children:[o.jsx(Um,{size:17,className:"text-purple-400"})," Upload CSV"]}),o.jsxs("p",{className:"text-xs text-[#70768F] mb-4 leading-relaxed",children:["Only a ",o.jsx("span",{className:"za-display text-white",children:"title"})," column is required. Optional columns: years, digital_price, usb_price, country, delivery_link, image_url. Everything else is filled automatically by AI enrichment."]}),o.jsx("input",{ref:p,type:"file",accept:".csv,.txt",onChange:S=>S.target.files[0]&&k(S.target.files[0]),className:"za-focus text-sm file:bg-gradient-to-r file:from-purple-500 file:to-blue-500 file:text-white file:border-0 file:rounded-full file:px-4 file:py-2 file:mr-3 file:text-sm file:cursor-pointer"})]}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-1 flex items-center gap-2",children:[o.jsx(Bm,{size:16,className:"text-purple-400"})," Or paste titles"]}),o.jsx("p",{className:"text-xs text-[#70768F] mb-3",children:"One series title per line."}),o.jsx("textarea",{className:"za-input",rows:6,placeholder:`The Rifleman
Gunsmoke
Dallas`,value:i,onChange:S=>a(S.target.value)}),o.jsx("button",{onClick:y,disabled:!i.trim(),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display mt-3 disabled:opacity-50 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Load Titles"})]})]}),l==="ready"&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-2",children:[n.length," titles loaded"]}),g>0&&o.jsxs("p",{className:"text-xs text-[#FFB800] mb-2 flex items-center gap-1.5",children:[o.jsx(pr,{size:13})," ",g," title",g>1?"s":""," already exist in your catalog — they will be updated, not duplicated."]}),o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 max-h-48 overflow-y-auto text-sm text-[#A7ABC0] mb-4",children:[n.slice(0,50).map((S,A)=>o.jsx("p",{children:S.title},A)),n.length>50&&o.jsxs("p",{className:"za-display mt-1 text-white",children:["…and ",n.length-50," more"]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("button",{onClick:x,className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display flex items-center gap-2 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(Wm,{size:14})," Enrich with AI & Import"]}),o.jsx("button",{onClick:E,className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-2.5 text-sm text-[#A7ABC0]",children:"Import Without AI (mark all for review)"}),o.jsx("button",{onClick:T,className:"za-focus text-[#70768F] text-sm px-3",children:"Cancel"})]})]}),l==="enriching"&&o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[o.jsx(It,{size:17,className:"za-spin text-purple-400"})," Enriching metadata…"]}),o.jsx("div",{className:"bg-white/5 rounded-full h-2 overflow-hidden mb-2",children:o.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-blue-500 h-full transition-all duration-300",style:{width:`${u.done/Math.max(u.total,1)*100}%`}})}),o.jsxs("p",{className:"text-xs text-[#70768F]",children:[u.done," / ",u.total," processed",u.failed>0&&` · ${u.failed} fell back to "needs review"`]}),o.jsx("button",{onClick:()=>{w.current=!0},className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-4 py-2 text-xs text-[#A7ABC0] mt-4",children:"Stop (keeps what's done so far)"})]}),l==="done"&&o.jsxs("div",{children:[o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-2 flex items-center gap-2",children:[o.jsx(De,{size:17,className:"text-[#42D392]"})," Import complete"]}),o.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center mt-3",children:[o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3",children:[o.jsx("p",{className:"za-display text-xl text-white",children:h.length}),o.jsx("p",{className:"text-xs text-[#70768F]",children:"Imported"})]}),o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3",children:[o.jsx("p",{className:"za-display text-xl text-[#42D392]",children:h.filter(S=>!S.needsReview).length}),o.jsx("p",{className:"text-xs text-[#70768F]",children:"Auto-approved"})]}),o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3",children:[o.jsx("p",{className:"za-display text-xl text-[#FFB800]",children:h.filter(S=>S.needsReview).length}),o.jsx("p",{className:"text-xs text-[#70768F]",children:"Needs review"})]})]})]}),o.jsx("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] overflow-hidden mb-5 max-h-80 overflow-y-auto",children:h.map(S=>o.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-[rgba(255,255,255,0.06)] text-sm text-white",children:[o.jsxs("span",{className:"truncate",children:[S.title," ",o.jsx("span",{className:"text-[#70768F] text-xs",children:S.years})]}),S.needsReview?o.jsxs("span",{className:"text-[#FFB800] text-xs flex items-center gap-1",children:[o.jsx(pr,{size:12})," Review (",S.aiConfidence!=null?`${S.aiConfidence}%`:"no AI",")"]}):o.jsxs("span",{className:"text-[#42D392] text-xs flex items-center gap-1",children:[o.jsx(De,{size:12})," ",S.aiConfidence,"%"]})]},S.id))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>e("products"),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:"Review in Products"}),o.jsx("button",{onClick:T,className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-2.5 text-sm text-[#A7ABC0]",children:"Import More"})]})]})]})}function mk(){const{orders:e,adminProducts:t,markPaid:r,approveAccess:n,markShipped:s,markCompleted:i,cancelOrder:a,refundOrder:l}=Re(),[c,u]=_.useState("all"),[d,h]=_.useState(null),[f,p]=_.useState(""),w=c==="all"?e:e.filter(m=>m.status===c);return o.jsxs("div",{children:[o.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 mb-5",children:["all",...Object.keys(Qn)].map(m=>o.jsx("button",{onClick:()=>u(m),className:`za-focus rounded-full px-3.5 py-1.5 text-xs whitespace-nowrap transition-all ${c===m?"bg-gradient-to-r from-purple-500 to-blue-500 text-white":"bg-white/5 text-[#70768F] hover:text-white"}`,children:m==="all"?`All (${e.length})`:`${Qn[m].label} (${e.filter(k=>k.status===m).length})`},m))}),w.length===0?o.jsx("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-10 text-center text-[#70768F] text-sm",children:"No orders here yet. Orders placed at checkout appear in this list."}):o.jsx("div",{className:"flex flex-col gap-3",children:w.map(m=>{const k=Qn[m.status],y=d===m.id,g=m.items.some(S=>S.format==="digital"),x=m.items.some(S=>S.format==="usb"),E=!["completed","cancelled","refunded"].includes(m.status),T=["paid","access_granted","shipped","completed"].includes(m.status);return o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] overflow-hidden",children:[o.jsxs("button",{onClick:()=>{h(y?null:m.id),p(m.tracking||"")},className:"za-focus w-full flex flex-wrap items-center justify-between gap-2 p-4 text-left",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"za-display text-white",children:[m.number," ",o.jsxs("span",{className:"text-[#70768F] text-xs font-sans",children:["· ",m.customer.name]})]}),o.jsxs("p",{className:"text-xs text-[#70768F]",children:[new Date(m.createdAt).toLocaleString()," · $",m.total.toFixed(2)]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${k.tone}`,children:[o.jsx(k.icon,{size:14})," ",k.label]}),o.jsx(Ai,{size:15,className:`text-[#70768F] transition-transform ${y?"rotate-180":""}`})]})]}),y&&o.jsxs("div",{className:"border-t border-[rgba(255,255,255,0.06)] p-4 text-sm text-white",children:[o.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mb-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-[#70768F] uppercase tracking-wide mb-1",children:"Customer"}),o.jsx("p",{className:"text-white",children:m.customer.name}),o.jsx("p",{className:"text-[#A7ABC0]",children:m.customer.email}),m.customer.phone&&o.jsx("p",{className:"text-[#A7ABC0]",children:m.customer.phone})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-[#70768F] uppercase tracking-wide mb-1",children:"Address"}),m.shipping?o.jsx("p",{className:"text-[#A7ABC0]",children:m.shipping}):o.jsx("p",{className:"text-[#70768F]",children:"— (digital order, no address collected)"})]})]}),o.jsx("p",{className:"text-xs text-[#70768F] uppercase tracking-wide mb-1",children:"Items"}),m.items.map((S,A)=>{const R=t.find(b=>b.id===S.productId);return o.jsxs("div",{className:"flex justify-between py-1",children:[o.jsxs("span",{children:[S.title," ",o.jsxs("span",{className:"text-[#70768F] capitalize",children:["(",S.format,")"]}),S.format==="digital"&&(R!=null&&R.deliveryLink?o.jsxs("span",{className:"text-[#42D392] text-xs ml-2 flex items-center gap-1 inline-flex",children:[o.jsx(De,{size:11})," link on file"]}):o.jsxs("span",{className:"text-[#FFB800] text-xs ml-2 flex items-center gap-1 inline-flex",children:[o.jsx(pr,{size:11})," no delivery link set"]}))]}),o.jsxs("span",{className:"text-white",children:["$",S.price.toFixed(2)]})]},A)}),m.notes&&o.jsxs("p",{className:"bg-white/5 rounded-[13px] p-2.5 mt-2 text-xs text-[#A7ABC0]",children:["Note: ",m.notes]}),m.shippingCost>0&&o.jsxs("p",{className:"text-xs mt-1 text-[#A7ABC0]",children:["Shipping: $",m.shippingCost.toFixed(2)]}),m.coupon&&o.jsxs("p",{className:"text-[#42D392] text-xs mt-1",children:["Coupon ",m.coupon," applied (−$",m.discount.toFixed(2),")"]}),gk(m),m.status==="paid"&&x&&o.jsx("div",{className:"mt-3",children:o.jsx("input",{className:"za-input",placeholder:"Tracking number (required to mark shipped)",value:f,onChange:S=>p(S.target.value)})}),o.jsxs("div",{className:"flex flex-wrap gap-2 mt-4",children:[m.status==="pending_payment"&&o.jsxs("button",{onClick:()=>r(m.id),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white za-display rounded-full px-4 py-2 text-xs flex items-center gap-1.5 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(di,{size:13})," Mark as Paid"]}),m.status==="paid"&&g&&o.jsxs("button",{onClick:()=>n(m.id),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white za-display rounded-full px-4 py-2 text-xs flex items-center gap-1.5 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(Jt,{size:13})," Approve Digital Access"]}),m.status==="paid"&&x&&o.jsxs("button",{onClick:()=>f.trim()&&s(m.id,f.trim()),disabled:!f.trim(),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white za-display rounded-full px-4 py-2 text-xs flex items-center gap-1.5 disabled:opacity-40 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(Ur,{size:13})," Mark as Shipped"]}),["access_granted","shipped"].includes(m.status)&&o.jsxs("button",{onClick:()=>i(m.id),className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white za-display rounded-full px-4 py-2 text-xs flex items-center gap-1.5 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[o.jsx(De,{size:13})," Mark Completed"]}),T&&o.jsxs("button",{onClick:()=>window.confirm("Mark this order as refunded?")&&l(m.id),className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-4 py-2 text-xs flex items-center gap-1.5 text-[#A7ABC0]",children:[o.jsx(No,{size:13})," Refund"]}),E&&o.jsxs("button",{onClick:()=>window.confirm("Reject / cancel this order? This cannot be undone.")&&a(m.id),className:"za-focus border border-[rgba(255,255,255,0.10)] text-[#FFB800] rounded-full px-4 py-2 text-xs flex items-center gap-1.5",children:[o.jsx(xt,{size:13})," Reject / Cancel Order"]})]})]})]},m.id)})})]})}function gk(e){if(e.status!=="access_granted"&&e.status!=="completed")return null;const t=e.items.filter(r=>r.format==="digital");return t.length===0?null:o.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-2 text-xs flex flex-col gap-1",children:[o.jsxs("p",{className:"za-display text-white flex items-center gap-1.5",children:[o.jsx(Jt,{size:12,className:"text-[#42D392]"})," Delivery links sent to customer"]}),t.map(r=>{var n;return o.jsxs("p",{className:"text-[#A7ABC0] break-all",children:[r.title,": ",(n=e.accessLinks)==null?void 0:n[r.productId]]},r.productId)})]})}const yk=["Golden","Midnight","Silver","Crimson","Coastal","Frontier","Harbor","Willow","Copper","Sterling"],vk=["Valley","Precinct","Ranch","Court","Boulevard","Junction","Manor","County","Files","Heights"];function xk(){const{settings:e,setSettings:t,adminProducts:r,replaceAllProducts:n,upsertProducts:s}=Re(),[i,a]=_.useState(e),[l,c]=_.useState(!1),[u,d]=_.useState(!1);_.useEffect(()=>{a(e)},[e]);const h=async()=>{d(!0);const w=Date.now(),m=[];for(let k=0;k<1e3;k++){const y=pn[k%pn.length],g=wi[k%wi.length],x=1950+k%55;m.push(lr({id:`stress-${k}`,title:`${yk[k%10]} ${vk[Math.floor(k/10)%10]} ${Math.floor(k/100)+1}`,years:`${x}–${x+3+k%6}`,genres:[y],decades:[g],seasons:1+k%12,episodes:12+k%200,shortDesc:`A ${y.toLowerCase()} series from the ${g} — demo catalog entry for performance testing.`,rating:3.8+k%12*.1,reviewCount:k%150,createdAt:w-k*6e4,newArrival:k<20,bestSeller:k%37===0}))}await s(m),d(!1)},f=async()=>{await n(r.filter(w=>!w.id.startsWith("stress-")))},p=r.filter(w=>w.id.startsWith("stress-")).length;return o.jsxs("div",{className:"max-w-xl flex flex-col gap-5",children:[o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6",children:[o.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Payment & Contact"}),o.jsxs("label",{className:"flex flex-col gap-1 text-xs text-[#70768F] mb-3",children:["Payoneer payment email (shown to customers at checkout)",o.jsx("input",{className:"za-input",value:i.payoneerEmail,onChange:w=>a({...i,payoneerEmail:w.target.value})})]}),o.jsxs("label",{className:"flex flex-col gap-1 text-xs text-[#70768F] mb-4",children:["Support email",o.jsx("input",{className:"za-input",value:i.supportEmail,onChange:w=>a({...i,supportEmail:w.target.value})})]}),o.jsx("button",{onClick:async()=>{await t(i),c(!0),setTimeout(()=>c(!1),1500)},className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display flex items-center gap-2 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:l?o.jsxs(o.Fragment,{children:[o.jsx(De,{size:14})," Saved"]}):"Save Settings"})]}),o.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6",children:[o.jsxs("h2",{className:"za-display text-lg text-white mb-1 flex items-center gap-2",children:[o.jsx(Wm,{size:16,className:"text-purple-400"})," 1,000-Product Stress Test"]}),o.jsx("p",{className:"text-xs text-[#70768F] mb-4 leading-relaxed",children:"Generates 1,000 demo products in Supabase (no AI calls) so you can verify that search, filters, pagination, and the admin table stay fast at full catalog size. Remove them any time — your real products are untouched."}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:h,disabled:u,className:"za-focus bg-gradient-to-r from-purple-500 to-blue-500 text-white rounded-full px-5 py-2.5 text-sm za-display flex items-center gap-2 disabled:opacity-60 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:[u?o.jsx(It,{size:14,className:"za-spin"}):o.jsx(Yx,{size:14})," Generate 1,000 Products"]}),p>0&&o.jsxs("button",{onClick:f,className:"za-focus border border-[rgba(255,255,255,0.10)] rounded-full px-5 py-2.5 text-sm text-[#A7ABC0] flex items-center gap-2",children:[o.jsx(Hm,{size:14})," Remove ",p," Test Products"]})]})]})]})}function wk(){const[e,t]=_.useState("dashboard"),{refreshAdminProducts:r,refreshOrders:n}=Re();return vn({title:"Admin",path:"/zqx!",noindex:!0}),_.useEffect(()=>{r(),n()},[]),o.jsxs(ck,{tab:e,setTab:t,children:[e==="dashboard"&&o.jsx(uk,{setTab:t}),e==="products"&&o.jsx(fk,{}),e==="import"&&o.jsx(pk,{setTab:t}),e==="orders"&&o.jsx(mk,{}),e==="settings"&&o.jsx(xk,{})]})}function bk(){O_();const e=Re(),[t,r]=_.useState("dark"),n=$t(),s=Tm(),{view:i,params:a}=_.useMemo(()=>M_(n.pathname,n.search),[n.pathname,n.search]),[l,c]=_.useState(null),[u,d]=_.useState(!1),[h,f]=_.useState(""),p=_.useRef(null),[w,m]=_.useState(null),k=(x,E={})=>{s(B_(x,E)),window.scrollTo({top:0,behavior:"smooth"})},y=x=>{f(x),clearTimeout(p.current),p.current=setTimeout(()=>f(""),2200)},g=(x,E)=>m({product:x,element:E});return i==="home"||i==="designlab"?o.jsxs(Gh,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:[o.jsx(Jh,{}),o.jsx(_.Suspense,{fallback:o.jsx("div",{className:"min-h-[80vh]"}),children:o.jsx(z_,{onNav:k,onQuickView:c,onShowAddMenu:g})}),o.jsx(Xh,{product:l,onClose:()=>c(null),onOpenFull:x=>k("detail",{slug:x}),onShowAddMenu:g}),o.jsx(Qh,{target:w,onClose:()=>m(null),showToast:y}),o.jsx(Yh,{open:u,onClose:()=>d(!1),onCheckout:()=>k("checkout")}),o.jsx(Tc,{message:h})]}):o.jsx(Gh,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:o.jsxs("div",{className:"za-root min-h-screen",style:q_[t],children:[o.jsx(Jh,{}),o.jsx(Z_,{theme:t,setTheme:r,onNav:k,currentView:i}),o.jsxs("div",{className:"za-fade-view min-h-[60vh]",children:[i==="listing"&&o.jsx(tk,{onNav:k,initialFilters:a,onQuickView:c,onShowAddMenu:g}),i==="detail"&&o.jsx(nk,{slug:a.slug,onNav:k,onShowAddMenu:g,onQuickView:c}),i==="checkout"&&o.jsx(sk,{onNav:k}),i==="confirmation"&&o.jsx(ik,{orderId:a.orderId,email:a.email,onNav:k}),i==="myorders"&&o.jsx(ak,{onNav:k}),o.jsx(Vh,{children:o.jsxs(_.Suspense,{fallback:o.jsx("div",{className:"min-h-[60vh]"}),children:[i==="blog"&&o.jsx(I_,{onNav:k,params:a}),i==="blog-article"&&o.jsx($_,{slug:a.slug,onNav:k}),i==="blog-category"&&o.jsx(D_,{slug:a.slug,onNav:k}),i==="blog-tag"&&o.jsx(L_,{slug:a.slug,onNav:k}),i==="blog-author"&&o.jsx(F_,{slug:a.slug,onNav:k})]})}),i==="trust"&&o.jsx(ok,{pageKey:a.page,onNav:k}),i==="admin"&&o.jsx(w_,{children:o.jsx(wk,{})}),o.jsx(Vh,{children:o.jsx(_.Suspense,{fallback:o.jsx("div",{className:"min-h-[60vh]"}),children:i==="notfound"&&o.jsx(U_,{onNav:k})})})]},i+(a.slug||"")+(a.orderId||"")),o.jsx(ek,{onNav:k}),o.jsx(Xh,{product:l,onClose:()=>c(null),onOpenFull:x=>k("detail",{slug:x}),onShowAddMenu:g}),o.jsx(Qh,{target:w,onClose:()=>m(null),showToast:y}),o.jsx(Yh,{open:u,onClose:()=>d(!1),onCheckout:()=>k("checkout")}),o.jsx(Tc,{message:h})]})})}function _k(){return o.jsx(y_,{children:o.jsx(bk,{})})}bl.createRoot(document.getElementById("root")).render(o.jsx(Wg.StrictMode,{children:o.jsx(Sx,{children:o.jsx(_k,{})})}));export{Fx as A,Sk as B,Ou as C,hn as D,Fm as E,mc as F,Hx as G,Co as H,qx as L,Kx as M,jk as O,Iu as P,as as S,Ja as T,xt as X,Wm as Z,Mm as a,Ka as b,K as c,or as d,fn as e,Hs as f,Ux as g,Mx as h,Bx as i,o as j,sn as k,Ga as l,wi as m,ah as n,Dm as o,Ai as p,Jt as q,_ as r,Tm as s,Hm as t,Re as u,Du as v,wa as w,vn as x,kk as y,ot as z};