const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalHome-CfL01DMg.js","assets/zap-BOWfBHXL.js","assets/chevron-left-gvJJnVst.js","assets/ExperimentalHome-K5pHkITU.css","assets/BlogPage-CIV9xHsc.js","assets/blogArticles-BAZZJV05.js","assets/BlogSidebar-B030IrU_.js","assets/user-DuiZEl38.js","assets/BlogArticle-45haRgeK.js","assets/blogAuthors-B_BhA8O5.js","assets/NotFoundPage-BWhm3F0b.js","assets/arrow-left-Cc2TLHEr.js","assets/BlogCategory-Cviidj3n.js","assets/BlogTag-Bb6dKUFG.js","assets/BlogAuthor-BqesC73k.js","assets/AdminPanel-DcrwZpga.js","assets/copy-CRALaHf3.js","assets/QuizPlay-BfCz12Xt.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 Ik=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Eh={exports:{}},za={},Ch={exports:{}},V={};/**
* @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 Hs=Symbol.for("react.element"),Km=Symbol.for("react.portal"),Gm=Symbol.for("react.fragment"),Jm=Symbol.for("react.strict_mode"),Ym=Symbol.for("react.profiler"),Qm=Symbol.for("react.provider"),Xm=Symbol.for("react.context"),Zm=Symbol.for("react.forward_ref"),eg=Symbol.for("react.suspense"),tg=Symbol.for("react.memo"),rg=Symbol.for("react.lazy"),hc=Symbol.iterator;function ng(e){return e===null||typeof e!="object"?null:(e=hc&&e[hc]||e["@@iterator"],typeof e=="function"?e:null)}var jh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nh=Object.assign,Th={};function Rn(e,t,r){this.props=e,this.context=t,this.refs=Th,this.updater=r||jh}Rn.prototype.isReactComponent={};Rn.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")};Rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ah(){}Ah.prototype=Rn.prototype;function nu(e,t,r){this.props=e,this.context=t,this.refs=Th,this.updater=r||jh}var su=nu.prototype=new Ah;su.constructor=nu;Nh(su,Rn.prototype);su.isPureReactComponent=!0;var fc=Array.isArray,Rh=Object.prototype.hasOwnProperty,iu={current:null},Ph={key:!0,ref:!0,__self:!0,__source:!0};function Oh(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)Rh.call(t,n)&&!Ph.hasOwnProperty(n)&&(s[n]=t[n]);var o=arguments.length-2;if(o===1)s.children=r;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];s.children=u}if(e&&e.defaultProps)for(n in o=e.defaultProps,o)s[n]===void 0&&(s[n]=o[n]);return{$$typeof:Hs,type:e,key:i,ref:a,props:s,_owner:iu.current}}function sg(e,t){return{$$typeof:Hs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function au(e){return typeof e=="object"&&e!==null&&e.$$typeof===Hs}function ig(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var pc=/\/+/g;function ao(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ig(""+e.key):t.toString(36)}function Pi(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 Hs:case Km:a=!0}}if(a)return a=e,s=s(a),e=n===""?"."+ao(a,0):n,fc(s)?(r="",e!=null&&(r=e.replace(pc,"$&/")+"/"),Pi(s,t,r,"",function(c){return c})):s!=null&&(au(s)&&(s=sg(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(pc,"$&/")+"/")+e)),t.push(s)),1;if(a=0,n=n===""?".":n+":",fc(e))for(var o=0;o<e.length;o++){i=e[o];var u=n+ao(i,o);a+=Pi(i,t,r,u,s)}else if(u=ng(e),typeof u=="function")for(e=u.call(e),o=0;!(i=e.next()).done;)i=i.value,u=n+ao(i,o++),a+=Pi(i,t,r,u,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 Pi(e,n,"","",function(i){return t.call(r,i,s++)}),n}function ag(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 Ae={current:null},Oi={transition:null},og={ReactCurrentDispatcher:Ae,ReactCurrentBatchConfig:Oi,ReactCurrentOwner:iu};function zh(){throw Error("act(...) is not supported in production builds of React.")}V.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(!au(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};V.Component=Rn;V.Fragment=Gm;V.Profiler=Ym;V.PureComponent=nu;V.StrictMode=Jm;V.Suspense=eg;V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=og;V.act=zh;V.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=Nh({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=iu.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)Rh.call(t,u)&&!Ph.hasOwnProperty(u)&&(n[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];n.children=o}return{$$typeof:Hs,type:e.type,key:s,ref:i,props:n,_owner:a}};V.createContext=function(e){return e={$$typeof:Xm,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Qm,_context:e},e.Consumer=e};V.createElement=Oh;V.createFactory=function(e){var t=Oh.bind(null,e);return t.type=e,t};V.createRef=function(){return{current:null}};V.forwardRef=function(e){return{$$typeof:Zm,render:e}};V.isValidElement=au;V.lazy=function(e){return{$$typeof:rg,_payload:{_status:-1,_result:e},_init:ag}};V.memo=function(e,t){return{$$typeof:tg,type:e,compare:t===void 0?null:t}};V.startTransition=function(e){var t=Oi.transition;Oi.transition={};try{e()}finally{Oi.transition=t}};V.unstable_act=zh;V.useCallback=function(e,t){return Ae.current.useCallback(e,t)};V.useContext=function(e){return Ae.current.useContext(e)};V.useDebugValue=function(){};V.useDeferredValue=function(e){return Ae.current.useDeferredValue(e)};V.useEffect=function(e,t){return Ae.current.useEffect(e,t)};V.useId=function(){return Ae.current.useId()};V.useImperativeHandle=function(e,t,r){return Ae.current.useImperativeHandle(e,t,r)};V.useInsertionEffect=function(e,t){return Ae.current.useInsertionEffect(e,t)};V.useLayoutEffect=function(e,t){return Ae.current.useLayoutEffect(e,t)};V.useMemo=function(e,t){return Ae.current.useMemo(e,t)};V.useReducer=function(e,t,r){return Ae.current.useReducer(e,t,r)};V.useRef=function(e){return Ae.current.useRef(e)};V.useState=function(e){return Ae.current.useState(e)};V.useSyncExternalStore=function(e,t,r){return Ae.current.useSyncExternalStore(e,t,r)};V.useTransition=function(){return Ae.current.useTransition()};V.version="18.3.1";Ch.exports=V;var w=Ch.exports;const lg=Vm(w);/**
* @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 ug=w,cg=Symbol.for("react.element"),dg=Symbol.for("react.fragment"),hg=Object.prototype.hasOwnProperty,fg=ug.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pg={key:!0,ref:!0,__self:!0,__source:!0};function Ih(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)hg.call(t,n)&&!pg.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:cg,type:e,key:i,ref:a,props:s,_owner:fg.current}}za.Fragment=dg;za.jsx=Ih;za.jsxs=Ih;Eh.exports=za;var l=Eh.exports,Vo={},$h={exports:{}},Ve={},Dh={exports:{}},Lh={};/**
* @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,B){var q=O.length;O.push(B);e:for(;0<q;){var J=q-1>>>1,Q=O[J];if(0<s(Q,B))O[J]=B,O[q]=Q,q=J;else break e}}function r(O){return O.length===0?null:O[0]}function n(O){if(O.length===0)return null;var B=O[0],q=O.pop();if(q!==B){O[0]=q;e:for(var J=0,Q=O.length,U=Q>>>1;J<U;){var K=2*(J+1)-1,Ht=O[K],wr=K+1,ti=O[wr];if(0>s(Ht,q))wr<Q&&0>s(ti,Ht)?(O[J]=ti,O[wr]=q,J=wr):(O[J]=Ht,O[K]=q,J=K);else if(wr<Q&&0>s(ti,q))O[J]=ti,O[wr]=q,J=wr;else break e}}return B}function s(O,B){var q=O.sortIndex-B.sortIndex;return q!==0?q:O.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],d=1,h=null,f=3,m=!1,x=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(O){for(var B=r(c);B!==null;){if(B.callback===null)n(c);else if(B.startTime<=O)n(c),B.sortIndex=B.expirationTime,t(u,B);else break;B=r(c)}}function k(O){if(y=!1,v(O),!x)if(r(u)!==null)x=!0,H(_);else{var B=r(c);B!==null&&W(k,B.startTime-O)}}function _(O,B){x=!1,y&&(y=!1,g(P),P=-1),m=!0;var q=f;try{for(v(B),h=r(u);h!==null&&(!(h.expirationTime>B)||O&&!L());){var J=h.callback;if(typeof J=="function"){h.callback=null,f=h.priorityLevel;var Q=J(h.expirationTime<=B);B=e.unstable_now(),typeof Q=="function"?h.callback=Q:h===r(u)&&n(u),v(B)}else n(u);h=r(u)}if(h!==null)var U=!0;else{var K=r(c);K!==null&&W(k,K.startTime-B),U=!1}return U}finally{h=null,f=q,m=!1}}var E=!1,C=null,P=-1,T=5,j=-1;function L(){return!(e.unstable_now()-j<T)}function S(){if(C!==null){var O=e.unstable_now();j=O;var B=!0;try{B=C(!0,O)}finally{B?N():(E=!1,C=null)}}else E=!1}var N;if(typeof p=="function")N=function(){p(S)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,z=R.port2;R.port1.onmessage=S,N=function(){z.postMessage(null)}}else N=function(){b(S,0)};function H(O){C=O,E||(E=!0,N())}function W(O,B){P=b(function(){O(e.unstable_now())},B)}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(){x||m||(x=!0,H(_))},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"):T=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(O){switch(f){case 1:case 2:case 3:var B=3;break;default:B=f}var q=f;f=B;try{return O()}finally{f=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,B){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var q=f;f=O;try{return B()}finally{f=q}},e.unstable_scheduleCallback=function(O,B,q){var J=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?J+q:J):q=J,O){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=q+Q,O={id:d++,callback:B,priorityLevel:O,startTime:q,expirationTime:Q,sortIndex:-1},q>J?(O.sortIndex=q,t(c,O),r(u)===null&&O===r(c)&&(y?(g(P),P=-1):y=!0,W(k,q-J))):(O.sortIndex=Q,t(u,O),x||m||(x=!0,H(_))),O},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(O){var B=f;return function(){var q=f;f=B;try{return O.apply(this,arguments)}finally{f=q}}}})(Lh);Dh.exports=Lh;var mg=Dh.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 gg=w,He=mg;function A(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 Uh=new Set,gs={};function Mr(e,t){_n(e,t),_n(e+"Capture",t)}function _n(e,t){for(gs[e]=t,e=0;e<t.length;e++)Uh.add(t[e])}var Lt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ko=Object.prototype.hasOwnProperty,yg=/^[: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]*$/,mc={},gc={};function vg(e){return Ko.call(gc,e)?!0:Ko.call(mc,e)?!1:yg.test(e)?gc[e]=!0:(mc[e]=!0,!1)}function xg(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 wg(e,t,r,n){if(t===null||typeof t>"u"||xg(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 Re(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 ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ke[e]=new Re(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ke[t]=new Re(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ke[e]=new Re(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ke[e]=new Re(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){ke[e]=new Re(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ke[e]=new Re(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ke[e]=new Re(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ke[e]=new Re(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ke[e]=new Re(e,5,!1,e.toLowerCase(),null,!1,!1)});var ou=/[\-:]([a-z])/g;function lu(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(ou,lu);ke[t]=new Re(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(ou,lu);ke[t]=new Re(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(ou,lu);ke[t]=new Re(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ke[e]=new Re(e,1,!1,e.toLowerCase(),null,!1,!1)});ke.xlinkHref=new Re("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ke[e]=new Re(e,1,!1,e.toLowerCase(),null,!0,!0)});function uu(e,t,r,n){var s=ke.hasOwnProperty(t)?ke[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(wg(t,r,s,n)&&(r=null),n||s===null?vg(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 qt=gg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ni=Symbol.for("react.element"),rn=Symbol.for("react.portal"),nn=Symbol.for("react.fragment"),cu=Symbol.for("react.strict_mode"),Go=Symbol.for("react.profiler"),Fh=Symbol.for("react.provider"),Bh=Symbol.for("react.context"),du=Symbol.for("react.forward_ref"),Jo=Symbol.for("react.suspense"),Yo=Symbol.for("react.suspense_list"),hu=Symbol.for("react.memo"),Gt=Symbol.for("react.lazy"),Mh=Symbol.for("react.offscreen"),yc=Symbol.iterator;function Dn(e){return e===null||typeof e!="object"?null:(e=yc&&e[yc]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Object.assign,oo;function Jn(e){if(oo===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);oo=t&&t[1]||""}return`
`+oo+e}var lo=!1;function uo(e,t){if(!e||lo)return"";lo=!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(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var s=c.stack.split(`
`),i=n.stack.split(`
`),a=s.length-1,o=i.length-1;1<=a&&0<=o&&s[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(s[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||s[a]!==i[o]){var u=`
`+s[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{lo=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Jn(e):""}function bg(e){switch(e.tag){case 5:return Jn(e.type);case 16:return Jn("Lazy");case 13:return Jn("Suspense");case 19:return Jn("SuspenseList");case 0:case 2:case 15:return e=uo(e.type,!1),e;case 11:return e=uo(e.type.render,!1),e;case 1:return e=uo(e.type,!0),e;default:return""}}function Qo(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 nn:return"Fragment";case rn:return"Portal";case Go:return"Profiler";case cu:return"StrictMode";case Jo:return"Suspense";case Yo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bh:return(e.displayName||"Context")+".Consumer";case Fh:return(e._context.displayName||"Context")+".Provider";case du:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hu:return t=e.displayName||null,t!==null?t:Qo(e.type)||"Memo";case Gt:t=e._payload,e=e._init;try{return Qo(e(t))}catch{}}return null}function kg(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 Qo(t);case 8:return t===cu?"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 hr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _g(e){var t=qh(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 si(e){e._valueTracker||(e._valueTracker=_g(e))}function Wh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=qh(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Gi(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 Xo(e,t){var r=t.checked;return oe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function vc(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=hr(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 Hh(e,t){t=t.checked,t!=null&&uu(e,"checked",t,!1)}function Zo(e,t){Hh(e,t);var r=hr(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")?el(e,t.type,r):t.hasOwnProperty("defaultValue")&&el(e,t.type,hr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xc(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 el(e,t,r){(t!=="number"||Gi(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Yn=Array.isArray;function gn(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=""+hr(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(A(91));return oe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function wc(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(A(92));if(Yn(r)){if(1<r.length)throw Error(A(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:hr(r)}}function Vh(e,t){var r=hr(t.value),n=hr(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 bc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Kh(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"?Kh(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ii,Gh=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(ii=ii||document.createElement("div"),ii.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ii.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ys(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ns={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},Sg=["Webkit","ms","Moz","O"];Object.keys(ns).forEach(function(e){Sg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ns[t]=ns[e]})});function Jh(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ns.hasOwnProperty(e)&&ns[e]?(""+t).trim():t+"px"}function Yh(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Jh(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var Eg=oe({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 nl(e,t){if(t){if(Eg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function sl(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 il=null;function fu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var al=null,yn=null,vn=null;function kc(e){if(e=Gs(e)){if(typeof al!="function")throw Error(A(280));var t=e.stateNode;t&&(t=Ua(t),al(e.stateNode,e.type,t))}}function Qh(e){yn?vn?vn.push(e):vn=[e]:yn=e}function Xh(){if(yn){var e=yn,t=vn;if(vn=yn=null,kc(e),t)for(e=0;e<t.length;e++)kc(t[e])}}function Zh(e,t){return e(t)}function ef(){}var co=!1;function tf(e,t,r){if(co)return e(t,r);co=!0;try{return Zh(e,t,r)}finally{co=!1,(yn!==null||vn!==null)&&(ef(),Xh())}}function vs(e,t){var r=e.stateNode;if(r===null)return null;var n=Ua(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(A(231,t,typeof r));return r}var ol=!1;if(Lt)try{var Ln={};Object.defineProperty(Ln,"passive",{get:function(){ol=!0}}),window.addEventListener("test",Ln,Ln),window.removeEventListener("test",Ln,Ln)}catch{ol=!1}function Cg(e,t,r,n,s,i,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(d){this.onError(d)}}var ss=!1,Ji=null,Yi=!1,ll=null,jg={onError:function(e){ss=!0,Ji=e}};function Ng(e,t,r,n,s,i,a,o,u){ss=!1,Ji=null,Cg.apply(jg,arguments)}function Tg(e,t,r,n,s,i,a,o,u){if(Ng.apply(this,arguments),ss){if(ss){var c=Ji;ss=!1,Ji=null}else throw Error(A(198));Yi||(Yi=!0,ll=c)}}function qr(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 rf(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 _c(e){if(qr(e)!==e)throw Error(A(188))}function Ag(e){var t=e.alternate;if(!t){if(t=qr(e),t===null)throw Error(A(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 _c(s),e;if(i===n)return _c(s),t;i=i.sibling}throw Error(A(188))}if(r.return!==n.return)r=s,n=i;else{for(var a=!1,o=s.child;o;){if(o===r){a=!0,r=s,n=i;break}if(o===n){a=!0,n=s,r=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===r){a=!0,r=i,n=s;break}if(o===n){a=!0,n=i,r=s;break}o=o.sibling}if(!a)throw Error(A(189))}}if(r.alternate!==n)throw Error(A(190))}if(r.tag!==3)throw Error(A(188));return r.stateNode.current===r?e:t}function nf(e){return e=Ag(e),e!==null?sf(e):null}function sf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=sf(e);if(t!==null)return t;e=e.sibling}return null}var af=He.unstable_scheduleCallback,Sc=He.unstable_cancelCallback,Rg=He.unstable_shouldYield,Pg=He.unstable_requestPaint,de=He.unstable_now,Og=He.unstable_getCurrentPriorityLevel,pu=He.unstable_ImmediatePriority,of=He.unstable_UserBlockingPriority,Qi=He.unstable_NormalPriority,zg=He.unstable_LowPriority,lf=He.unstable_IdlePriority,Ia=null,bt=null;function Ig(e){if(bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot(Ia,e,void 0,(e.current.flags&128)===128)}catch{}}var ct=Math.clz32?Math.clz32:Lg,$g=Math.log,Dg=Math.LN2;function Lg(e){return e>>>=0,e===0?32:31-($g(e)/Dg|0)|0}var ai=64,oi=4194304;function Qn(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 Xi(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 o=a&~s;o!==0?n=Qn(o):(i&=a,i!==0&&(n=Qn(i)))}else a=r&~s,a!==0?n=Qn(a):i!==0&&(n=Qn(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-ct(t),s=1<<r,n|=e[r],t&=~s;return n}function Ug(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 Fg(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-ct(i),o=1<<a,u=s[a];u===-1?(!(o&r)||o&n)&&(s[a]=Ug(o,t)):u<=t&&(e.expiredLanes|=o),i&=~o}}function ul(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function uf(){var e=ai;return ai<<=1,!(ai&4194240)&&(ai=64),e}function ho(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=r}function Bg(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-ct(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function mu(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-ct(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var Y=0;function cf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var df,gu,hf,ff,pf,cl=!1,li=[],sr=null,ir=null,ar=null,xs=new Map,ws=new Map,Yt=[],Mg="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 Ec(e,t){switch(e){case"focusin":case"focusout":sr=null;break;case"dragenter":case"dragleave":ir=null;break;case"mouseover":case"mouseout":ar=null;break;case"pointerover":case"pointerout":xs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ws.delete(t.pointerId)}}function Un(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=Gs(t),t!==null&&gu(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function qg(e,t,r,n,s){switch(t){case"focusin":return sr=Un(sr,e,t,r,n,s),!0;case"dragenter":return ir=Un(ir,e,t,r,n,s),!0;case"mouseover":return ar=Un(ar,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return xs.set(i,Un(xs.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,ws.set(i,Un(ws.get(i)||null,e,t,r,n,s)),!0}return!1}function mf(e){var t=jr(e.target);if(t!==null){var r=qr(t);if(r!==null){if(t=r.tag,t===13){if(t=rf(r),t!==null){e.blockedOn=t,pf(e.priority,function(){hf(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 zi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=dl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);il=n,r.target.dispatchEvent(n),il=null}else return t=Gs(r),t!==null&&gu(t),e.blockedOn=r,!1;t.shift()}return!0}function Cc(e,t,r){zi(e)&&r.delete(t)}function Wg(){cl=!1,sr!==null&&zi(sr)&&(sr=null),ir!==null&&zi(ir)&&(ir=null),ar!==null&&zi(ar)&&(ar=null),xs.forEach(Cc),ws.forEach(Cc)}function Fn(e,t){e.blockedOn===t&&(e.blockedOn=null,cl||(cl=!0,He.unstable_scheduleCallback(He.unstable_NormalPriority,Wg)))}function bs(e){function t(s){return Fn(s,e)}if(0<li.length){Fn(li[0],e);for(var r=1;r<li.length;r++){var n=li[r];n.blockedOn===e&&(n.blockedOn=null)}}for(sr!==null&&Fn(sr,e),ir!==null&&Fn(ir,e),ar!==null&&Fn(ar,e),xs.forEach(t),ws.forEach(t),r=0;r<Yt.length;r++)n=Yt[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Yt.length&&(r=Yt[0],r.blockedOn===null);)mf(r),r.blockedOn===null&&Yt.shift()}var xn=qt.ReactCurrentBatchConfig,Zi=!0;function Hg(e,t,r,n){var s=Y,i=xn.transition;xn.transition=null;try{Y=1,yu(e,t,r,n)}finally{Y=s,xn.transition=i}}function Vg(e,t,r,n){var s=Y,i=xn.transition;xn.transition=null;try{Y=4,yu(e,t,r,n)}finally{Y=s,xn.transition=i}}function yu(e,t,r,n){if(Zi){var s=dl(e,t,r,n);if(s===null)ko(e,t,n,ea,r),Ec(e,n);else if(qg(s,e,t,r,n))n.stopPropagation();else if(Ec(e,n),t&4&&-1<Mg.indexOf(e)){for(;s!==null;){var i=Gs(s);if(i!==null&&df(i),i=dl(e,t,r,n),i===null&&ko(e,t,n,ea,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else ko(e,t,n,null,r)}}var ea=null;function dl(e,t,r,n){if(ea=null,e=fu(n),e=jr(e),e!==null)if(t=qr(e),t===null)e=null;else if(r=t.tag,r===13){if(e=rf(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 ea=e,null}function gf(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(Og()){case pu:return 1;case of:return 4;case Qi:case zg:return 16;case lf:return 536870912;default:return 16}default:return 16}}var tr=null,vu=null,Ii=null;function yf(){if(Ii)return Ii;var e,t=vu,r=t.length,n,s="value"in tr?tr.value:tr.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 Ii=s.slice(e,1<n?1-n:void 0)}function $i(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 ui(){return!0}function jc(){return!1}function Ke(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 o in e)e.hasOwnProperty(o)&&(r=e[o],this[o]=r?r(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ui:jc,this.isPropagationStopped=jc,this}return oe(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=ui)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ui)},persist:function(){},isPersistent:ui}),t}var Pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xu=Ke(Pn),Ks=oe({},Pn,{view:0,detail:0}),Kg=Ke(Ks),fo,po,Bn,$a=oe({},Ks,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wu,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!==Bn&&(Bn&&e.type==="mousemove"?(fo=e.screenX-Bn.screenX,po=e.screenY-Bn.screenY):po=fo=0,Bn=e),fo)},movementY:function(e){return"movementY"in e?e.movementY:po}}),Nc=Ke($a),Gg=oe({},$a,{dataTransfer:0}),Jg=Ke(Gg),Yg=oe({},Ks,{relatedTarget:0}),mo=Ke(Yg),Qg=oe({},Pn,{animationName:0,elapsedTime:0,pseudoElement:0}),Xg=Ke(Qg),Zg=oe({},Pn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ey=Ke(Zg),ty=oe({},Pn,{data:0}),Tc=Ke(ty),ry={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ny={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"},sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sy[e])?!!t[e]:!1}function wu(){return iy}var ay=oe({},Ks,{key:function(e){if(e.key){var t=ry[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=$i(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ny[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wu,charCode:function(e){return e.type==="keypress"?$i(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$i(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),oy=Ke(ay),ly=oe({},$a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ac=Ke(ly),uy=oe({},Ks,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wu}),cy=Ke(uy),dy=oe({},Pn,{propertyName:0,elapsedTime:0,pseudoElement:0}),hy=Ke(dy),fy=oe({},$a,{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}),py=Ke(fy),my=[9,13,27,32],bu=Lt&&"CompositionEvent"in window,is=null;Lt&&"documentMode"in document&&(is=document.documentMode);var gy=Lt&&"TextEvent"in window&&!is,vf=Lt&&(!bu||is&&8<is&&11>=is),Rc=" ",Pc=!1;function xf(e,t){switch(e){case"keyup":return my.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var sn=!1;function yy(e,t){switch(e){case"compositionend":return wf(t);case"keypress":return t.which!==32?null:(Pc=!0,Rc);case"textInput":return e=t.data,e===Rc&&Pc?null:e;default:return null}}function vy(e,t){if(sn)return e==="compositionend"||!bu&&xf(e,t)?(e=yf(),Ii=vu=tr=null,sn=!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 vf&&t.locale!=="ko"?null:t.data;default:return null}}var xy={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 Oc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xy[e.type]:t==="textarea"}function bf(e,t,r,n){Qh(n),t=ta(t,"onChange"),0<t.length&&(r=new xu("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var as=null,ks=null;function wy(e){Pf(e,0)}function Da(e){var t=ln(e);if(Wh(t))return e}function by(e,t){if(e==="change")return t}var kf=!1;if(Lt){var go;if(Lt){var yo="oninput"in document;if(!yo){var zc=document.createElement("div");zc.setAttribute("oninput","return;"),yo=typeof zc.oninput=="function"}go=yo}else go=!1;kf=go&&(!document.documentMode||9<document.documentMode)}function Ic(){as&&(as.detachEvent("onpropertychange",_f),ks=as=null)}function _f(e){if(e.propertyName==="value"&&Da(ks)){var t=[];bf(t,ks,e,fu(e)),tf(wy,t)}}function ky(e,t,r){e==="focusin"?(Ic(),as=t,ks=r,as.attachEvent("onpropertychange",_f)):e==="focusout"&&Ic()}function _y(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Da(ks)}function Sy(e,t){if(e==="click")return Da(t)}function Ey(e,t){if(e==="input"||e==="change")return Da(t)}function Cy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ft=typeof Object.is=="function"?Object.is:Cy;function _s(e,t){if(ft(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(!Ko.call(t,s)||!ft(e[s],t[s]))return!1}return!0}function $c(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dc(e,t){var r=$c(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=$c(r)}}function Sf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ef(){for(var e=window,t=Gi();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Gi(e.document)}return t}function ku(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 jy(e){var t=Ef(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Sf(r.ownerDocument.documentElement,r)){if(n!==null&&ku(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=Dc(r,i);var a=Dc(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 Ny=Lt&&"documentMode"in document&&11>=document.documentMode,an=null,hl=null,os=null,fl=!1;function Lc(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;fl||an==null||an!==Gi(n)||(n=an,"selectionStart"in n&&ku(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}),os&&_s(os,n)||(os=n,n=ta(hl,"onSelect"),0<n.length&&(t=new xu("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=an)))}function ci(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var on={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionend:ci("Transition","TransitionEnd")},vo={},Cf={};Lt&&(Cf=document.createElement("div").style,"AnimationEvent"in window||(delete on.animationend.animation,delete on.animationiteration.animation,delete on.animationstart.animation),"TransitionEvent"in window||delete on.transitionend.transition);function La(e){if(vo[e])return vo[e];if(!on[e])return e;var t=on[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in Cf)return vo[e]=t[r];return e}var jf=La("animationend"),Nf=La("animationiteration"),Tf=La("animationstart"),Af=La("transitionend"),Rf=new Map,Uc="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 yr(e,t){Rf.set(e,t),Mr(t,[e])}for(var xo=0;xo<Uc.length;xo++){var wo=Uc[xo],Ty=wo.toLowerCase(),Ay=wo[0].toUpperCase()+wo.slice(1);yr(Ty,"on"+Ay)}yr(jf,"onAnimationEnd");yr(Nf,"onAnimationIteration");yr(Tf,"onAnimationStart");yr("dblclick","onDoubleClick");yr("focusin","onFocus");yr("focusout","onBlur");yr(Af,"onTransitionEnd");_n("onMouseEnter",["mouseout","mouseover"]);_n("onMouseLeave",["mouseout","mouseover"]);_n("onPointerEnter",["pointerout","pointerover"]);_n("onPointerLeave",["pointerout","pointerover"]);Mr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Mr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Mr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Mr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Mr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Mr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xn="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(" "),Ry=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xn));function Fc(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Tg(n,t,void 0,e),e.currentTarget=null}function Pf(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 o=n[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==i&&s.isPropagationStopped())break e;Fc(s,o,c),i=u}else for(a=0;a<n.length;a++){if(o=n[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==i&&s.isPropagationStopped())break e;Fc(s,o,c),i=u}}}if(Yi)throw e=ll,Yi=!1,ll=null,e}function te(e,t){var r=t[vl];r===void 0&&(r=t[vl]=new Set);var n=e+"__bubble";r.has(n)||(Of(t,e,2,!1),r.add(n))}function bo(e,t,r){var n=0;t&&(n|=4),Of(r,e,n,t)}var di="_reactListening"+Math.random().toString(36).slice(2);function Ss(e){if(!e[di]){e[di]=!0,Uh.forEach(function(r){r!=="selectionchange"&&(Ry.has(r)||bo(r,!1,e),bo(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[di]||(t[di]=!0,bo("selectionchange",!1,t))}}function Of(e,t,r,n){switch(gf(t)){case 1:var s=Hg;break;case 4:s=Vg;break;default:s=yu}r=s.bind(null,t,r,e),s=void 0,!ol||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 ko(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 o=n.stateNode.containerInfo;if(o===s||o.nodeType===8&&o.parentNode===s)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;a=a.return}for(;o!==null;){if(a=jr(o),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}o=o.parentNode}}n=n.return}tf(function(){var c=i,d=fu(r),h=[];e:{var f=Rf.get(e);if(f!==void 0){var m=xu,x=e;switch(e){case"keypress":if($i(r)===0)break e;case"keydown":case"keyup":m=oy;break;case"focusin":x="focus",m=mo;break;case"focusout":x="blur",m=mo;break;case"beforeblur":case"afterblur":m=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":m=Nc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=Jg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=cy;break;case jf:case Nf:case Tf:m=Xg;break;case Af:m=hy;break;case"scroll":m=Kg;break;case"wheel":m=py;break;case"copy":case"cut":case"paste":m=ey;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Ac}var y=(t&4)!==0,b=!y&&e==="scroll",g=y?f!==null?f+"Capture":null:f;y=[];for(var p=c,v;p!==null;){v=p;var k=v.stateNode;if(v.tag===5&&k!==null&&(v=k,g!==null&&(k=vs(p,g),k!=null&&y.push(Es(p,k,v)))),b)break;p=p.return}0<y.length&&(f=new m(f,x,null,r,d),h.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&r!==il&&(x=r.relatedTarget||r.fromElement)&&(jr(x)||x[Ut]))break e;if((m||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,m?(x=r.relatedTarget||r.toElement,m=c,x=x?jr(x):null,x!==null&&(b=qr(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(m=null,x=c),m!==x)){if(y=Nc,k="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(y=Ac,k="onPointerLeave",g="onPointerEnter",p="pointer"),b=m==null?f:ln(m),v=x==null?f:ln(x),f=new y(k,p+"leave",m,r,d),f.target=b,f.relatedTarget=v,k=null,jr(d)===c&&(y=new y(g,p+"enter",x,r,d),y.target=v,y.relatedTarget=b,k=y),b=k,m&&x)t:{for(y=m,g=x,p=0,v=y;v;v=Vr(v))p++;for(v=0,k=g;k;k=Vr(k))v++;for(;0<p-v;)y=Vr(y),p--;for(;0<v-p;)g=Vr(g),v--;for(;p--;){if(y===g||g!==null&&y===g.alternate)break t;y=Vr(y),g=Vr(g)}y=null}else y=null;m!==null&&Bc(h,f,m,y,!1),x!==null&&b!==null&&Bc(h,b,x,y,!0)}}e:{if(f=c?ln(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var _=by;else if(Oc(f))if(kf)_=Ey;else{_=_y;var E=ky}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(_=Sy);if(_&&(_=_(e,c))){bf(h,_,r,d);break e}E&&E(e,f,c),e==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&el(f,"number",f.value)}switch(E=c?ln(c):window,e){case"focusin":(Oc(E)||E.contentEditable==="true")&&(an=E,hl=c,os=null);break;case"focusout":os=hl=an=null;break;case"mousedown":fl=!0;break;case"contextmenu":case"mouseup":case"dragend":fl=!1,Lc(h,r,d);break;case"selectionchange":if(Ny)break;case"keydown":case"keyup":Lc(h,r,d)}var C;if(bu)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else sn?xf(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(vf&&r.locale!=="ko"&&(sn||P!=="onCompositionStart"?P==="onCompositionEnd"&&sn&&(C=yf()):(tr=d,vu="value"in tr?tr.value:tr.textContent,sn=!0)),E=ta(c,P),0<E.length&&(P=new Tc(P,e,null,r,d),h.push({event:P,listeners:E}),C?P.data=C:(C=wf(r),C!==null&&(P.data=C)))),(C=gy?yy(e,r):vy(e,r))&&(c=ta(c,"onBeforeInput"),0<c.length&&(d=new Tc("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:c}),d.data=C))}Pf(h,t)})}function Es(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ta(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=vs(e,r),i!=null&&n.unshift(Es(e,i,s)),i=vs(e,t),i!=null&&n.push(Es(e,i,s))),e=e.return}return n}function Vr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bc(e,t,r,n,s){for(var i=t._reactName,a=[];r!==null&&r!==n;){var o=r,u=o.alternate,c=o.stateNode;if(u!==null&&u===n)break;o.tag===5&&c!==null&&(o=c,s?(u=vs(r,i),u!=null&&a.unshift(Es(r,u,o))):s||(u=vs(r,i),u!=null&&a.push(Es(r,u,o)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var Py=/\r\n?/g,Oy=/\u0000|\uFFFD/g;function Mc(e){return(typeof e=="string"?e:""+e).replace(Py,`
`).replace(Oy,"")}function hi(e,t,r){if(t=Mc(t),Mc(e)!==t&&r)throw Error(A(425))}function ra(){}var pl=null,ml=null;function gl(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 yl=typeof setTimeout=="function"?setTimeout:void 0,zy=typeof clearTimeout=="function"?clearTimeout:void 0,qc=typeof Promise=="function"?Promise:void 0,Iy=typeof queueMicrotask=="function"?queueMicrotask:typeof qc<"u"?function(e){return qc.resolve(null).then(e).catch($y)}:yl;function $y(e){setTimeout(function(){throw e})}function _o(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),bs(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);bs(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 Wc(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 On=Math.random().toString(36).slice(2),wt="__reactFiber$"+On,Cs="__reactProps$"+On,Ut="__reactContainer$"+On,vl="__reactEvents$"+On,Dy="__reactListeners$"+On,Ly="__reactHandles$"+On;function jr(e){var t=e[wt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Ut]||r[wt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Wc(e);e!==null;){if(r=e[wt])return r;e=Wc(e)}return t}e=r,r=e.parentNode}return null}function Gs(e){return e=e[wt]||e[Ut],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ln(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(A(33))}function Ua(e){return e[Cs]||null}var xl=[],un=-1;function vr(e){return{current:e}}function re(e){0>un||(e.current=xl[un],xl[un]=null,un--)}function ee(e,t){un++,xl[un]=e.current,e.current=t}var fr={},je=vr(fr),$e=vr(!1),$r=fr;function Sn(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 De(e){return e=e.childContextTypes,e!=null}function na(){re($e),re(je)}function Hc(e,t,r){if(je.current!==fr)throw Error(A(168));ee(je,t),ee($e,r)}function zf(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(A(108,kg(e)||"Unknown",s));return oe({},r,n)}function sa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fr,$r=je.current,ee(je,e),ee($e,$e.current),!0}function Vc(e,t,r){var n=e.stateNode;if(!n)throw Error(A(169));r?(e=zf(e,t,$r),n.__reactInternalMemoizedMergedChildContext=e,re($e),re(je),ee(je,e)):re($e),ee($e,r)}var Ot=null,Fa=!1,So=!1;function If(e){Ot===null?Ot=[e]:Ot.push(e)}function Uy(e){Fa=!0,If(e)}function xr(){if(!So&&Ot!==null){So=!0;var e=0,t=Y;try{var r=Ot;for(Y=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Ot=null,Fa=!1}catch(s){throw Ot!==null&&(Ot=Ot.slice(e+1)),af(pu,xr),s}finally{Y=t,So=!1}}return null}var cn=[],dn=0,ia=null,aa=0,Je=[],Ye=0,Dr=null,zt=1,It="";function Sr(e,t){cn[dn++]=aa,cn[dn++]=ia,ia=e,aa=t}function $f(e,t,r){Je[Ye++]=zt,Je[Ye++]=It,Je[Ye++]=Dr,Dr=e;var n=zt;e=It;var s=32-ct(n)-1;n&=~(1<<s),r+=1;var i=32-ct(t)+s;if(30<i){var a=s-s%5;i=(n&(1<<a)-1).toString(32),n>>=a,s-=a,zt=1<<32-ct(t)+s|r<<s|n,It=i+e}else zt=1<<i|r<<s|n,It=e}function _u(e){e.return!==null&&(Sr(e,1),$f(e,1,0))}function Su(e){for(;e===ia;)ia=cn[--dn],cn[dn]=null,aa=cn[--dn],cn[dn]=null;for(;e===Dr;)Dr=Je[--Ye],Je[Ye]=null,It=Je[--Ye],Je[Ye]=null,zt=Je[--Ye],Je[Ye]=null}var We=null,qe=null,se=!1,lt=null;function Df(e,t){var r=Qe(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 Kc(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,We=e,qe=or(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,We=e,qe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Dr!==null?{id:zt,overflow:It}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Qe(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,We=e,qe=null,!0):!1;default:return!1}}function wl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function bl(e){if(se){var t=qe;if(t){var r=t;if(!Kc(e,t)){if(wl(e))throw Error(A(418));t=or(r.nextSibling);var n=We;t&&Kc(e,t)?Df(n,r):(e.flags=e.flags&-4097|2,se=!1,We=e)}}else{if(wl(e))throw Error(A(418));e.flags=e.flags&-4097|2,se=!1,We=e}}}function Gc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;We=e}function fi(e){if(e!==We)return!1;if(!se)return Gc(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!gl(e.type,e.memoizedProps)),t&&(t=qe)){if(wl(e))throw Lf(),Error(A(418));for(;t;)Df(e,t),t=or(t.nextSibling)}if(Gc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){qe=or(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}qe=null}}else qe=We?or(e.stateNode.nextSibling):null;return!0}function Lf(){for(var e=qe;e;)e=or(e.nextSibling)}function En(){qe=We=null,se=!1}function Eu(e){lt===null?lt=[e]:lt.push(e)}var Fy=qt.ReactCurrentBatchConfig;function Mn(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(A(309));var n=r.stateNode}if(!n)throw Error(A(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 o=s.refs;a===null?delete o[i]:o[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(A(284));if(!r._owner)throw Error(A(290,e))}return e}function pi(e,t){throw e=Object.prototype.toString.call(t),Error(A(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Jc(e){var t=e._init;return t(e._payload)}function Uf(e){function t(g,p){if(e){var v=g.deletions;v===null?(g.deletions=[p],g.flags|=16):v.push(p)}}function r(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function n(g,p){for(g=new Map;p!==null;)p.key!==null?g.set(p.key,p):g.set(p.index,p),p=p.sibling;return g}function s(g,p){return g=dr(g,p),g.index=0,g.sibling=null,g}function i(g,p,v){return g.index=v,e?(v=g.alternate,v!==null?(v=v.index,v<p?(g.flags|=2,p):v):(g.flags|=2,p)):(g.flags|=1048576,p)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function o(g,p,v,k){return p===null||p.tag!==6?(p=Ro(v,g.mode,k),p.return=g,p):(p=s(p,v),p.return=g,p)}function u(g,p,v,k){var _=v.type;return _===nn?d(g,p,v.props.children,k,v.key):p!==null&&(p.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Gt&&Jc(_)===p.type)?(k=s(p,v.props),k.ref=Mn(g,p,v),k.return=g,k):(k=qi(v.type,v.key,v.props,null,g.mode,k),k.ref=Mn(g,p,v),k.return=g,k)}function c(g,p,v,k){return p===null||p.tag!==4||p.stateNode.containerInfo!==v.containerInfo||p.stateNode.implementation!==v.implementation?(p=Po(v,g.mode,k),p.return=g,p):(p=s(p,v.children||[]),p.return=g,p)}function d(g,p,v,k,_){return p===null||p.tag!==7?(p=Or(v,g.mode,k,_),p.return=g,p):(p=s(p,v),p.return=g,p)}function h(g,p,v){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ro(""+p,g.mode,v),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case ni:return v=qi(p.type,p.key,p.props,null,g.mode,v),v.ref=Mn(g,null,p),v.return=g,v;case rn:return p=Po(p,g.mode,v),p.return=g,p;case Gt:var k=p._init;return h(g,k(p._payload),v)}if(Yn(p)||Dn(p))return p=Or(p,g.mode,v,null),p.return=g,p;pi(g,p)}return null}function f(g,p,v,k){var _=p!==null?p.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return _!==null?null:o(g,p,""+v,k);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ni:return v.key===_?u(g,p,v,k):null;case rn:return v.key===_?c(g,p,v,k):null;case Gt:return _=v._init,f(g,p,_(v._payload),k)}if(Yn(v)||Dn(v))return _!==null?null:d(g,p,v,k,null);pi(g,v)}return null}function m(g,p,v,k,_){if(typeof k=="string"&&k!==""||typeof k=="number")return g=g.get(v)||null,o(p,g,""+k,_);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ni:return g=g.get(k.key===null?v:k.key)||null,u(p,g,k,_);case rn:return g=g.get(k.key===null?v:k.key)||null,c(p,g,k,_);case Gt:var E=k._init;return m(g,p,v,E(k._payload),_)}if(Yn(k)||Dn(k))return g=g.get(v)||null,d(p,g,k,_,null);pi(p,k)}return null}function x(g,p,v,k){for(var _=null,E=null,C=p,P=p=0,T=null;C!==null&&P<v.length;P++){C.index>P?(T=C,C=null):T=C.sibling;var j=f(g,C,v[P],k);if(j===null){C===null&&(C=T);break}e&&C&&j.alternate===null&&t(g,C),p=i(j,p,P),E===null?_=j:E.sibling=j,E=j,C=T}if(P===v.length)return r(g,C),se&&Sr(g,P),_;if(C===null){for(;P<v.length;P++)C=h(g,v[P],k),C!==null&&(p=i(C,p,P),E===null?_=C:E.sibling=C,E=C);return se&&Sr(g,P),_}for(C=n(g,C);P<v.length;P++)T=m(C,g,P,v[P],k),T!==null&&(e&&T.alternate!==null&&C.delete(T.key===null?P:T.key),p=i(T,p,P),E===null?_=T:E.sibling=T,E=T);return e&&C.forEach(function(L){return t(g,L)}),se&&Sr(g,P),_}function y(g,p,v,k){var _=Dn(v);if(typeof _!="function")throw Error(A(150));if(v=_.call(v),v==null)throw Error(A(151));for(var E=_=null,C=p,P=p=0,T=null,j=v.next();C!==null&&!j.done;P++,j=v.next()){C.index>P?(T=C,C=null):T=C.sibling;var L=f(g,C,j.value,k);if(L===null){C===null&&(C=T);break}e&&C&&L.alternate===null&&t(g,C),p=i(L,p,P),E===null?_=L:E.sibling=L,E=L,C=T}if(j.done)return r(g,C),se&&Sr(g,P),_;if(C===null){for(;!j.done;P++,j=v.next())j=h(g,j.value,k),j!==null&&(p=i(j,p,P),E===null?_=j:E.sibling=j,E=j);return se&&Sr(g,P),_}for(C=n(g,C);!j.done;P++,j=v.next())j=m(C,g,P,j.value,k),j!==null&&(e&&j.alternate!==null&&C.delete(j.key===null?P:j.key),p=i(j,p,P),E===null?_=j:E.sibling=j,E=j);return e&&C.forEach(function(S){return t(g,S)}),se&&Sr(g,P),_}function b(g,p,v,k){if(typeof v=="object"&&v!==null&&v.type===nn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ni:e:{for(var _=v.key,E=p;E!==null;){if(E.key===_){if(_=v.type,_===nn){if(E.tag===7){r(g,E.sibling),p=s(E,v.props.children),p.return=g,g=p;break e}}else if(E.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Gt&&Jc(_)===E.type){r(g,E.sibling),p=s(E,v.props),p.ref=Mn(g,E,v),p.return=g,g=p;break e}r(g,E);break}else t(g,E);E=E.sibling}v.type===nn?(p=Or(v.props.children,g.mode,k,v.key),p.return=g,g=p):(k=qi(v.type,v.key,v.props,null,g.mode,k),k.ref=Mn(g,p,v),k.return=g,g=k)}return a(g);case rn:e:{for(E=v.key;p!==null;){if(p.key===E)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){r(g,p.sibling),p=s(p,v.children||[]),p.return=g,g=p;break e}else{r(g,p);break}else t(g,p);p=p.sibling}p=Po(v,g.mode,k),p.return=g,g=p}return a(g);case Gt:return E=v._init,b(g,p,E(v._payload),k)}if(Yn(v))return x(g,p,v,k);if(Dn(v))return y(g,p,v,k);pi(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,p!==null&&p.tag===6?(r(g,p.sibling),p=s(p,v),p.return=g,g=p):(r(g,p),p=Ro(v,g.mode,k),p.return=g,g=p),a(g)):r(g,p)}return b}var Cn=Uf(!0),Ff=Uf(!1),oa=vr(null),la=null,hn=null,Cu=null;function ju(){Cu=hn=la=null}function Nu(e){var t=oa.current;re(oa),e._currentValue=t}function kl(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 wn(e,t){la=e,Cu=hn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ze=!0),e.firstContext=null)}function Ze(e){var t=e._currentValue;if(Cu!==e)if(e={context:e,memoizedValue:t,next:null},hn===null){if(la===null)throw Error(A(308));hn=e,la.dependencies={lanes:0,firstContext:e}}else hn=hn.next=e;return t}var Nr=null;function Tu(e){Nr===null?Nr=[e]:Nr.push(e)}function Bf(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Tu(t)):(r.next=s.next,s.next=r),t.interleaved=r,Ft(e,n)}function Ft(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 Jt=!1;function Au(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(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 Dt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function lr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,G&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,Ft(e,r)}return s=n.interleaved,s===null?(t.next=t,Tu(n)):(t.next=s.next,s.next=t),n.interleaved=t,Ft(e,r)}function Di(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,mu(e,r)}}function Yc(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 ua(e,t,r,n){var s=e.updateQueue;Jt=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?i=c:a.next=c,a=u;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=c:o.next=c,d.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;a=0,d=c=u=null,o=i;do{var f=o.lane,m=o.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var x=e,y=o;switch(f=t,m=r,y.tag){case 1:if(x=y.payload,typeof x=="function"){h=x.call(m,h,f);break e}h=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=y.payload,f=typeof x=="function"?x.call(m,h,f):x,f==null)break e;h=oe({},h,f);break e;case 2:Jt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else m={eventTime:m,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(c=d=m,u=h):d=d.next=m,a|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(u=h),s.baseState=u,s.firstBaseUpdate=c,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);Ur|=a,e.lanes=a,e.memoizedState=h}}function Qc(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(A(191,s));s.call(n)}}}var Js={},kt=vr(Js),js=vr(Js),Ns=vr(Js);function Tr(e){if(e===Js)throw Error(A(174));return e}function Ru(e,t){switch(ee(Ns,t),ee(js,e),ee(kt,Js),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)}re(kt),ee(kt,t)}function jn(){re(kt),re(js),re(Ns)}function qf(e){Tr(Ns.current);var t=Tr(kt.current),r=rl(t,e.type);t!==r&&(ee(js,e),ee(kt,r))}function Pu(e){js.current===e&&(re(kt),re(js))}var ie=vr(0);function ca(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 Eo=[];function Ou(){for(var e=0;e<Eo.length;e++)Eo[e]._workInProgressVersionPrimary=null;Eo.length=0}var Li=qt.ReactCurrentDispatcher,Co=qt.ReactCurrentBatchConfig,Lr=0,ae=null,pe=null,ve=null,da=!1,ls=!1,Ts=0,By=0;function _e(){throw Error(A(321))}function zu(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!ft(e[r],t[r]))return!1;return!0}function Iu(e,t,r,n,s,i){if(Lr=i,ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Li.current=e===null||e.memoizedState===null?Hy:Vy,e=r(n,s),ls){i=0;do{if(ls=!1,Ts=0,25<=i)throw Error(A(301));i+=1,ve=pe=null,t.updateQueue=null,Li.current=Ky,e=r(n,s)}while(ls)}if(Li.current=ha,t=pe!==null&&pe.next!==null,Lr=0,ve=pe=ae=null,da=!1,t)throw Error(A(300));return e}function $u(){var e=Ts!==0;return Ts=0,e}function yt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ve===null?ae.memoizedState=ve=e:ve=ve.next=e,ve}function et(){if(pe===null){var e=ae.alternate;e=e!==null?e.memoizedState:null}else e=pe.next;var t=ve===null?ae.memoizedState:ve.next;if(t!==null)ve=t,pe=e;else{if(e===null)throw Error(A(310));pe=e,e={memoizedState:pe.memoizedState,baseState:pe.baseState,baseQueue:pe.baseQueue,queue:pe.queue,next:null},ve===null?ae.memoizedState=ve=e:ve=ve.next=e}return ve}function As(e,t){return typeof t=="function"?t(e):t}function jo(e){var t=et(),r=t.queue;if(r===null)throw Error(A(311));r.lastRenderedReducer=e;var n=pe,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 o=a=null,u=null,c=i;do{var d=c.lane;if((Lr&d)===d)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=h,a=n):u=u.next=h,ae.lanes|=d,Ur|=d}c=c.next}while(c!==null&&c!==i);u===null?a=n:u.next=o,ft(n,t.memoizedState)||(ze=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=u,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,ae.lanes|=i,Ur|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function No(e){var t=et(),r=t.queue;if(r===null)throw Error(A(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);ft(i,t.memoizedState)||(ze=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function Wf(){}function Hf(e,t){var r=ae,n=et(),s=t(),i=!ft(n.memoizedState,s);if(i&&(n.memoizedState=s,ze=!0),n=n.queue,Du(Gf.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||ve!==null&&ve.memoizedState.tag&1){if(r.flags|=2048,Rs(9,Kf.bind(null,r,n,s,t),void 0,null),xe===null)throw Error(A(349));Lr&30||Vf(r,t,s)}return s}function Vf(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Kf(e,t,r,n){t.value=r,t.getSnapshot=n,Jf(t)&&Yf(e)}function Gf(e,t,r){return r(function(){Jf(t)&&Yf(e)})}function Jf(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!ft(e,r)}catch{return!0}}function Yf(e){var t=Ft(e,1);t!==null&&dt(t,e,1,-1)}function Xc(e){var t=yt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:As,lastRenderedState:e},t.queue=e,e=e.dispatch=Wy.bind(null,ae,e),[t.memoizedState,e]}function Rs(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.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 Qf(){return et().memoizedState}function Ui(e,t,r,n){var s=yt();ae.flags|=e,s.memoizedState=Rs(1|t,r,void 0,n===void 0?null:n)}function Ba(e,t,r,n){var s=et();n=n===void 0?null:n;var i=void 0;if(pe!==null){var a=pe.memoizedState;if(i=a.destroy,n!==null&&zu(n,a.deps)){s.memoizedState=Rs(t,r,i,n);return}}ae.flags|=e,s.memoizedState=Rs(1|t,r,i,n)}function Zc(e,t){return Ui(8390656,8,e,t)}function Du(e,t){return Ba(2048,8,e,t)}function Xf(e,t){return Ba(4,2,e,t)}function Zf(e,t){return Ba(4,4,e,t)}function ep(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 tp(e,t,r){return r=r!=null?r.concat([e]):null,Ba(4,4,ep.bind(null,t,e),r)}function Lu(){}function rp(e,t){var r=et();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&zu(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function np(e,t){var r=et();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&zu(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function sp(e,t,r){return Lr&21?(ft(r,t)||(r=uf(),ae.lanes|=r,Ur|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ze=!0),e.memoizedState=r)}function My(e,t){var r=Y;Y=r!==0&&4>r?r:4,e(!0);var n=Co.transition;Co.transition={};try{e(!1),t()}finally{Y=r,Co.transition=n}}function ip(){return et().memoizedState}function qy(e,t,r){var n=cr(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},ap(e))op(t,r);else if(r=Bf(e,t,r,n),r!==null){var s=Te();dt(r,e,n,s),lp(r,t,n)}}function Wy(e,t,r){var n=cr(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(ap(e))op(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,o=i(a,r);if(s.hasEagerState=!0,s.eagerState=o,ft(o,a)){var u=t.interleaved;u===null?(s.next=s,Tu(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}r=Bf(e,t,s,n),r!==null&&(s=Te(),dt(r,e,n,s),lp(r,t,n))}}function ap(e){var t=e.alternate;return e===ae||t!==null&&t===ae}function op(e,t){ls=da=!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,mu(e,r)}}var ha={readContext:Ze,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useInsertionEffect:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useDeferredValue:_e,useTransition:_e,useMutableSource:_e,useSyncExternalStore:_e,useId:_e,unstable_isNewReconciler:!1},Hy={readContext:Ze,useCallback:function(e,t){return yt().memoizedState=[e,t===void 0?null:t],e},useContext:Ze,useEffect:Zc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Ui(4194308,4,ep.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ui(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ui(4,2,e,t)},useMemo:function(e,t){var r=yt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=yt();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=qy.bind(null,ae,e),[n.memoizedState,e]},useRef:function(e){var t=yt();return e={current:e},t.memoizedState=e},useState:Xc,useDebugValue:Lu,useDeferredValue:function(e){return yt().memoizedState=e},useTransition:function(){var e=Xc(!1),t=e[0];return e=My.bind(null,e[1]),yt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ae,s=yt();if(se){if(r===void 0)throw Error(A(407));r=r()}else{if(r=t(),xe===null)throw Error(A(349));Lr&30||Vf(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,Zc(Gf.bind(null,n,i,e),[e]),n.flags|=2048,Rs(9,Kf.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=yt(),t=xe.identifierPrefix;if(se){var r=It,n=zt;r=(n&~(1<<32-ct(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ts++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=By++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Vy={readContext:Ze,useCallback:rp,useContext:Ze,useEffect:Du,useImperativeHandle:tp,useInsertionEffect:Xf,useLayoutEffect:Zf,useMemo:np,useReducer:jo,useRef:Qf,useState:function(){return jo(As)},useDebugValue:Lu,useDeferredValue:function(e){var t=et();return sp(t,pe.memoizedState,e)},useTransition:function(){var e=jo(As)[0],t=et().memoizedState;return[e,t]},useMutableSource:Wf,useSyncExternalStore:Hf,useId:ip,unstable_isNewReconciler:!1},Ky={readContext:Ze,useCallback:rp,useContext:Ze,useEffect:Du,useImperativeHandle:tp,useInsertionEffect:Xf,useLayoutEffect:Zf,useMemo:np,useReducer:No,useRef:Qf,useState:function(){return No(As)},useDebugValue:Lu,useDeferredValue:function(e){var t=et();return pe===null?t.memoizedState=e:sp(t,pe.memoizedState,e)},useTransition:function(){var e=No(As)[0],t=et().memoizedState;return[e,t]},useMutableSource:Wf,useSyncExternalStore:Hf,useId:ip,unstable_isNewReconciler:!1};function it(e,t){if(e&&e.defaultProps){t=oe({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function _l(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:oe({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Ma={isMounted:function(e){return(e=e._reactInternals)?qr(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Te(),s=cr(e),i=Dt(n,s);i.payload=t,r!=null&&(i.callback=r),t=lr(e,i,s),t!==null&&(dt(t,e,s,n),Di(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Te(),s=cr(e),i=Dt(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=lr(e,i,s),t!==null&&(dt(t,e,s,n),Di(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Te(),n=cr(e),s=Dt(r,n);s.tag=2,t!=null&&(s.callback=t),t=lr(e,s,n),t!==null&&(dt(t,e,n,r),Di(t,e,n))}};function ed(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?!_s(r,n)||!_s(s,i):!0}function up(e,t,r){var n=!1,s=fr,i=t.contextType;return typeof i=="object"&&i!==null?i=Ze(i):(s=De(t)?$r:je.current,n=t.contextTypes,i=(n=n!=null)?Sn(e,s):fr),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ma,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function td(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&&Ma.enqueueReplaceState(t,t.state,null)}function Sl(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Au(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Ze(i):(i=De(t)?$r:je.current,s.context=Sn(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(_l(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&&Ma.enqueueReplaceState(s,s.state,null),ua(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Nn(e,t){try{var r="",n=t;do r+=bg(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 To(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function El(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Gy=typeof WeakMap=="function"?WeakMap:Map;function cp(e,t,r){r=Dt(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){pa||(pa=!0,Il=n),El(e,t)},r}function dp(e,t,r){r=Dt(-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(){El(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){El(e,t),typeof n!="function"&&(ur===null?ur=new Set([this]):ur.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function rd(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Gy;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=l0.bind(null,e,t,r),t.then(e,e))}function nd(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 sd(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=Dt(-1,1),t.tag=2,lr(r,t,1))),r.lanes|=1),e)}var Jy=qt.ReactCurrentOwner,ze=!1;function Ne(e,t,r,n){t.child=e===null?Ff(t,null,r,n):Cn(t,e.child,r,n)}function id(e,t,r,n,s){r=r.render;var i=t.ref;return wn(t,s),n=Iu(e,t,r,n,i,s),r=$u(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Bt(e,t,s)):(se&&r&&_u(t),t.flags|=1,Ne(e,t,n,s),t.child)}function ad(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!Vu(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,hp(e,t,i,n,s)):(e=qi(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:_s,r(a,n)&&e.ref===t.ref)return Bt(e,t,s)}return t.flags|=1,e=dr(i,n),e.ref=t.ref,e.return=t,t.child=e}function hp(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(_s(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,Bt(e,t,s)}return Cl(e,t,r,n,s)}function fp(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},ee(pn,Be),Be|=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,ee(pn,Be),Be|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,ee(pn,Be),Be|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,ee(pn,Be),Be|=n;return Ne(e,t,s,r),t.child}function pp(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Cl(e,t,r,n,s){var i=De(r)?$r:je.current;return i=Sn(t,i),wn(t,s),r=Iu(e,t,r,n,i,s),n=$u(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Bt(e,t,s)):(se&&n&&_u(t),t.flags|=1,Ne(e,t,r,s),t.child)}function od(e,t,r,n,s){if(De(r)){var i=!0;sa(t)}else i=!1;if(wn(t,s),t.stateNode===null)Fi(e,t),up(t,r,n),Sl(t,r,n,s),n=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=r.contextType;typeof c=="object"&&c!==null?c=Ze(c):(c=De(r)?$r:je.current,c=Sn(t,c));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||u!==c)&&td(t,a,n,c),Jt=!1;var f=t.memoizedState;a.state=f,ua(t,n,a,s),u=t.memoizedState,o!==n||f!==u||$e.current||Jt?(typeof d=="function"&&(_l(t,r,d,n),u=t.memoizedState),(o=Jt||ed(t,r,o,n,f,u,c))?(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=u),a.props=n,a.state=u,a.context=c,n=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,Mf(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:it(t.type,o),a.props=c,h=t.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=Ze(u):(u=De(r)?$r:je.current,u=Sn(t,u));var m=r.getDerivedStateFromProps;(d=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||f!==u)&&td(t,a,n,u),Jt=!1,f=t.memoizedState,a.state=f,ua(t,n,a,s);var x=t.memoizedState;o!==h||f!==x||$e.current||Jt?(typeof m=="function"&&(_l(t,r,m,n),x=t.memoizedState),(c=Jt||ed(t,r,c,n,f,x,u)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,x,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,x,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=x),a.props=n,a.state=x,a.context=u,n=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return jl(e,t,r,n,i,s)}function jl(e,t,r,n,s,i){pp(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return s&&Vc(t,r,!1),Bt(e,t,i);n=t.stateNode,Jy.current=t;var o=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=Cn(t,e.child,null,i),t.child=Cn(t,null,o,i)):Ne(e,t,o,i),t.memoizedState=n.state,s&&Vc(t,r,!0),t.child}function mp(e){var t=e.stateNode;t.pendingContext?Hc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hc(e,t.context,!1),Ru(e,t.containerInfo)}function ld(e,t,r,n,s){return En(),Eu(s),t.flags|=256,Ne(e,t,r,n),t.child}var Nl={dehydrated:null,treeContext:null,retryLane:0};function Tl(e){return{baseLanes:e,cachePool:null,transitions:null}}function gp(e,t,r){var n=t.pendingProps,s=ie.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(s&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ee(ie,s&1),e===null)return bl(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=Ha(a,n,0,null),e=Or(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Tl(r),t.memoizedState=Nl,e):Uu(t,a));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return Yy(e,t,a,n,o,s,r);if(i){i=n.fallback,a=t.mode,s=e.child,o=s.sibling;var u={mode:"hidden",children:n.children};return!(a&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=u,t.deletions=null):(n=dr(s,u),n.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=dr(o,i):(i=Or(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?Tl(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=Nl,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 Uu(e,t){return t=Ha({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function mi(e,t,r,n){return n!==null&&Eu(n),Cn(t,e.child,null,r),e=Uu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yy(e,t,r,n,s,i,a){if(r)return t.flags&256?(t.flags&=-257,n=To(Error(A(422))),mi(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=Ha({mode:"visible",children:n.children},s,0,null),i=Or(i,s,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Cn(t,e.child,null,a),t.child.memoizedState=Tl(a),t.memoizedState=Nl,i);if(!(t.mode&1))return mi(e,t,a,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var o=n.dgst;return n=o,i=Error(A(419)),n=To(i,n,void 0),mi(e,t,a,n)}if(o=(a&e.childLanes)!==0,ze||o){if(n=xe,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,Ft(e,s),dt(n,e,s,-1))}return Hu(),n=To(Error(A(421))),mi(e,t,a,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=u0.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,qe=or(s.nextSibling),We=t,se=!0,lt=null,e!==null&&(Je[Ye++]=zt,Je[Ye++]=It,Je[Ye++]=Dr,zt=e.id,It=e.overflow,Dr=t),t=Uu(t,n.children),t.flags|=4096,t)}function ud(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),kl(e.return,t,r)}function Ao(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 yp(e,t,r){var n=t.pendingProps,s=n.revealOrder,i=n.tail;if(Ne(e,t,n.children,r),n=ie.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&&ud(e,r,t);else if(e.tag===19)ud(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(ee(ie,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&&ca(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Ao(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&&ca(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Ao(t,!0,r,null,i);break;case"together":Ao(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Bt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Ur|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(A(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 Qy(e,t,r){switch(t.tag){case 3:mp(t),En();break;case 5:qf(t);break;case 1:De(t.type)&&sa(t);break;case 4:Ru(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;ee(oa,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(ee(ie,ie.current&1),t.flags|=128,null):r&t.child.childLanes?gp(e,t,r):(ee(ie,ie.current&1),e=Bt(e,t,r),e!==null?e.sibling:null);ee(ie,ie.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return yp(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ee(ie,ie.current),n)break;return null;case 22:case 23:return t.lanes=0,fp(e,t,r)}return Bt(e,t,r)}var vp,Al,xp,wp;vp=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}};Al=function(){};xp=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Tr(kt.current);var i=null;switch(r){case"input":s=Xo(e,s),n=Xo(e,n),i=[];break;case"select":s=oe({},s,{value:void 0}),n=oe({},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=ra)}nl(r,n);var a;r=null;for(c in s)if(!n.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var o=s[c];for(a in o)o.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(gs.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in n){var u=n[c];if(o=s!=null?s[c]:void 0,n.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(r||(r={}),r[a]=u[a])}else r||(i||(i=[]),i.push(c,r)),r=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(i=i||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(gs.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&te("scroll",e),i||o===u||(i=[])):(i=i||[]).push(c,u))}r&&(i=i||[]).push("style",r);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};wp=function(e,t,r,n){r!==n&&(t.flags|=4)};function qn(e,t){if(!se)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 Se(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 Xy(e,t,r){var n=t.pendingProps;switch(Su(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Se(t),null;case 1:return De(t.type)&&na(),Se(t),null;case 3:return n=t.stateNode,jn(),re($e),re(je),Ou(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(fi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,lt!==null&&(Ll(lt),lt=null))),Al(e,t),Se(t),null;case 5:Pu(t);var s=Tr(Ns.current);if(r=t.type,e!==null&&t.stateNode!=null)xp(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(A(166));return Se(t),null}if(e=Tr(kt.current),fi(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[wt]=t,n[Cs]=i,e=(t.mode&1)!==0,r){case"dialog":te("cancel",n),te("close",n);break;case"iframe":case"object":case"embed":te("load",n);break;case"video":case"audio":for(s=0;s<Xn.length;s++)te(Xn[s],n);break;case"source":te("error",n);break;case"img":case"image":case"link":te("error",n),te("load",n);break;case"details":te("toggle",n);break;case"input":vc(n,i),te("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},te("invalid",n);break;case"textarea":wc(n,i),te("invalid",n)}nl(r,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];a==="children"?typeof o=="string"?n.textContent!==o&&(i.suppressHydrationWarning!==!0&&hi(n.textContent,o,e),s=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&hi(n.textContent,o,e),s=["children",""+o]):gs.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&te("scroll",n)}switch(r){case"input":si(n),xc(n,i,!0);break;case"textarea":si(n),bc(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=ra)}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=Kh(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[Cs]=n,vp(e,t,!1,!1),t.stateNode=e;e:{switch(a=sl(r,n),r){case"dialog":te("cancel",e),te("close",e),s=n;break;case"iframe":case"object":case"embed":te("load",e),s=n;break;case"video":case"audio":for(s=0;s<Xn.length;s++)te(Xn[s],e);s=n;break;case"source":te("error",e),s=n;break;case"img":case"image":case"link":te("error",e),te("load",e),s=n;break;case"details":te("toggle",e),s=n;break;case"input":vc(e,n),s=Xo(e,n),te("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=oe({},n,{value:void 0}),te("invalid",e);break;case"textarea":wc(e,n),s=tl(e,n),te("invalid",e);break;default:s=n}nl(r,s),o=s;for(i in o)if(o.hasOwnProperty(i)){var u=o[i];i==="style"?Yh(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Gh(e,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&ys(e,u):typeof u=="number"&&ys(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(gs.hasOwnProperty(i)?u!=null&&i==="onScroll"&&te("scroll",e):u!=null&&uu(e,i,u,a))}switch(r){case"input":si(e),xc(e,n,!1);break;case"textarea":si(e),bc(e);break;case"option":n.value!=null&&e.setAttribute("value",""+hr(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?gn(e,!!n.multiple,i,!1):n.defaultValue!=null&&gn(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=ra)}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 Se(t),null;case 6:if(e&&t.stateNode!=null)wp(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(A(166));if(r=Tr(Ns.current),Tr(kt.current),fi(t)){if(n=t.stateNode,r=t.memoizedProps,n[wt]=t,(i=n.nodeValue!==r)&&(e=We,e!==null))switch(e.tag){case 3:hi(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hi(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 Se(t),null;case 13:if(re(ie),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&qe!==null&&t.mode&1&&!(t.flags&128))Lf(),En(),t.flags|=98560,i=!1;else if(i=fi(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(A(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(A(317));i[wt]=t}else En(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Se(t),i=!1}else lt!==null&&(Ll(lt),lt=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||ie.current&1?me===0&&(me=3):Hu())),t.updateQueue!==null&&(t.flags|=4),Se(t),null);case 4:return jn(),Al(e,t),e===null&&Ss(t.stateNode.containerInfo),Se(t),null;case 10:return Nu(t.type._context),Se(t),null;case 17:return De(t.type)&&na(),Se(t),null;case 19:if(re(ie),i=t.memoizedState,i===null)return Se(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)qn(i,!1);else{if(me!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ca(e),a!==null){for(t.flags|=128,qn(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 ee(ie,ie.current&1|2),t.child}e=e.sibling}i.tail!==null&&de()>Tn&&(t.flags|=128,n=!0,qn(i,!1),t.lanes=4194304)}else{if(!n)if(e=ca(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),qn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!se)return Se(t),null}else 2*de()-i.renderingStartTime>Tn&&r!==1073741824&&(t.flags|=128,n=!0,qn(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=de(),t.sibling=null,r=ie.current,ee(ie,n?r&1|2:r&1),t):(Se(t),null);case 22:case 23:return Wu(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Be&1073741824&&(Se(t),t.subtreeFlags&6&&(t.flags|=8192)):Se(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function Zy(e,t){switch(Su(t),t.tag){case 1:return De(t.type)&&na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jn(),re($e),re(je),Ou(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pu(t),null;case 13:if(re(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));En()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(ie),null;case 4:return jn(),null;case 10:return Nu(t.type._context),null;case 22:case 23:return Wu(),null;case 24:return null;default:return null}}var gi=!1,Ce=!1,e0=typeof WeakSet=="function"?WeakSet:Set,$=null;function fn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ue(e,t,n)}else r.current=null}function Rl(e,t,r){try{r()}catch(n){ue(e,t,n)}}var cd=!1;function t0(e,t){if(pl=Zi,e=Ef(),ku(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,o=-1,u=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var m;h!==r||s!==0&&h.nodeType!==3||(o=a+s),h!==i||n!==0&&h.nodeType!==3||(u=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===e)break t;if(f===r&&++c===s&&(o=a),f===i&&++d===n&&(u=a),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}r=o===-1||u===-1?null:{start:o,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(ml={focusedElem:e,selectionRange:r},Zi=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var y=x.memoizedProps,b=x.memoizedState,g=t.stateNode,p=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:it(t.type,y),b);g.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(k){ue(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return x=cd,cd=!1,x}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&&Rl(t,r,i)}s=s.next}while(s!==n)}}function qa(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 Pl(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 bp(e){var t=e.alternate;t!==null&&(e.alternate=null,bp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[wt],delete t[Cs],delete t[vl],delete t[Dy],delete t[Ly])),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 kp(e){return e.tag===5||e.tag===3||e.tag===4}function dd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kp(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 Ol(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=ra));else if(n!==4&&(e=e.child,e!==null))for(Ol(e,t,r),e=e.sibling;e!==null;)Ol(e,t,r),e=e.sibling}function zl(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(zl(e,t,r),e=e.sibling;e!==null;)zl(e,t,r),e=e.sibling}var we=null,ot=!1;function Vt(e,t,r){for(r=r.child;r!==null;)_p(e,t,r),r=r.sibling}function _p(e,t,r){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount(Ia,r)}catch{}switch(r.tag){case 5:Ce||fn(r,t);case 6:var n=we,s=ot;we=null,Vt(e,t,r),we=n,ot=s,we!==null&&(ot?(e=we,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):we.removeChild(r.stateNode));break;case 18:we!==null&&(ot?(e=we,r=r.stateNode,e.nodeType===8?_o(e.parentNode,r):e.nodeType===1&&_o(e,r),bs(e)):_o(we,r.stateNode));break;case 4:n=we,s=ot,we=r.stateNode.containerInfo,ot=!0,Vt(e,t,r),we=n,ot=s;break;case 0:case 11:case 14:case 15:if(!Ce&&(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)&&Rl(r,t,a),s=s.next}while(s!==n)}Vt(e,t,r);break;case 1:if(!Ce&&(fn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){ue(r,t,o)}Vt(e,t,r);break;case 21:Vt(e,t,r);break;case 22:r.mode&1?(Ce=(n=Ce)||r.memoizedState!==null,Vt(e,t,r),Ce=n):Vt(e,t,r);break;default:Vt(e,t,r)}}function hd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new e0),t.forEach(function(n){var s=c0.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function rt(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,o=a;e:for(;o!==null;){switch(o.tag){case 5:we=o.stateNode,ot=!1;break e;case 3:we=o.stateNode.containerInfo,ot=!0;break e;case 4:we=o.stateNode.containerInfo,ot=!0;break e}o=o.return}if(we===null)throw Error(A(160));_p(i,a,s),we=null,ot=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(c){ue(s,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Sp(t,e),t=t.sibling}function Sp(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(rt(t,e),mt(e),n&4){try{us(3,e,e.return),qa(3,e)}catch(y){ue(e,e.return,y)}try{us(5,e,e.return)}catch(y){ue(e,e.return,y)}}break;case 1:rt(t,e),mt(e),n&512&&r!==null&&fn(r,r.return);break;case 5:if(rt(t,e),mt(e),n&512&&r!==null&&fn(r,r.return),e.flags&32){var s=e.stateNode;try{ys(s,"")}catch(y){ue(e,e.return,y)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&Hh(s,i),sl(o,a);var c=sl(o,i);for(a=0;a<u.length;a+=2){var d=u[a],h=u[a+1];d==="style"?Yh(s,h):d==="dangerouslySetInnerHTML"?Gh(s,h):d==="children"?ys(s,h):uu(s,d,h,c)}switch(o){case"input":Zo(s,i);break;case"textarea":Vh(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?gn(s,!!i.multiple,m,!1):f!==!!i.multiple&&(i.defaultValue!=null?gn(s,!!i.multiple,i.defaultValue,!0):gn(s,!!i.multiple,i.multiple?[]:"",!1))}s[Cs]=i}catch(y){ue(e,e.return,y)}}break;case 6:if(rt(t,e),mt(e),n&4){if(e.stateNode===null)throw Error(A(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(y){ue(e,e.return,y)}}break;case 3:if(rt(t,e),mt(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{bs(t.containerInfo)}catch(y){ue(e,e.return,y)}break;case 4:rt(t,e),mt(e);break;case 13:rt(t,e),mt(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Mu=de())),n&4&&hd(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Ce=(c=Ce)||d,rt(t,e),Ce=c):rt(t,e),mt(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for($=e,d=e.child;d!==null;){for(h=$=d;$!==null;){switch(f=$,m=f.child,f.tag){case 0:case 11:case 14:case 15:us(4,f,f.return);break;case 1:fn(f,f.return);var x=f.stateNode;if(typeof x.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(y){ue(n,r,y)}}break;case 5:fn(f,f.return);break;case 22:if(f.memoizedState!==null){pd(h);continue}}m!==null?(m.return=f,$=m):pd(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,c?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=h.stateNode,u=h.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=Jh("display",a))}catch(y){ue(e,e.return,y)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(y){ue(e,e.return,y)}}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:rt(t,e),mt(e),n&4&&hd(e);break;case 21:break;default:rt(t,e),mt(e)}}function mt(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(kp(r)){var n=r;break e}r=r.return}throw Error(A(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(ys(s,""),n.flags&=-33);var i=dd(e);zl(e,i,s);break;case 3:case 4:var a=n.stateNode.containerInfo,o=dd(e);Ol(e,o,a);break;default:throw Error(A(161))}}catch(u){ue(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function r0(e,t,r){$=e,Ep(e)}function Ep(e,t,r){for(var n=(e.mode&1)!==0;$!==null;){var s=$,i=s.child;if(s.tag===22&&n){var a=s.memoizedState!==null||gi;if(!a){var o=s.alternate,u=o!==null&&o.memoizedState!==null||Ce;o=gi;var c=Ce;if(gi=a,(Ce=u)&&!c)for($=s;$!==null;)a=$,u=a.child,a.tag===22&&a.memoizedState!==null?md(s):u!==null?(u.return=a,$=u):md(s);for(;i!==null;)$=i,Ep(i),i=i.sibling;$=s,gi=o,Ce=c}fd(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,$=i):fd(e)}}function fd(e){for(;$!==null;){var t=$;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ce||qa(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Ce)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:it(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Qc(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}Qc(t,a,r)}break;case 5:var o=t.stateNode;if(r===null&&t.flags&4){r=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&bs(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(A(163))}Ce||t.flags&512&&Pl(t)}catch(f){ue(t,t.return,f)}}if(t===e){$=null;break}if(r=t.sibling,r!==null){r.return=t.return,$=r;break}$=t.return}}function pd(e){for(;$!==null;){var t=$;if(t===e){$=null;break}var r=t.sibling;if(r!==null){r.return=t.return,$=r;break}$=t.return}}function md(e){for(;$!==null;){var t=$;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{qa(4,t)}catch(u){ue(t,r,u)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(u){ue(t,s,u)}}var i=t.return;try{Pl(t)}catch(u){ue(t,i,u)}break;case 5:var a=t.return;try{Pl(t)}catch(u){ue(t,a,u)}}}catch(u){ue(t,t.return,u)}if(t===e){$=null;break}var o=t.sibling;if(o!==null){o.return=t.return,$=o;break}$=t.return}}var n0=Math.ceil,fa=qt.ReactCurrentDispatcher,Fu=qt.ReactCurrentOwner,Xe=qt.ReactCurrentBatchConfig,G=0,xe=null,fe=null,be=0,Be=0,pn=vr(0),me=0,Ps=null,Ur=0,Wa=0,Bu=0,cs=null,Oe=null,Mu=0,Tn=1/0,Tt=null,pa=!1,Il=null,ur=null,yi=!1,rr=null,ma=0,ds=0,$l=null,Bi=-1,Mi=0;function Te(){return G&6?de():Bi!==-1?Bi:Bi=de()}function cr(e){return e.mode&1?G&2&&be!==0?be&-be:Fy.transition!==null?(Mi===0&&(Mi=uf()),Mi):(e=Y,e!==0||(e=window.event,e=e===void 0?16:gf(e.type)),e):1}function dt(e,t,r,n){if(50<ds)throw ds=0,$l=null,Error(A(185));Vs(e,r,n),(!(G&2)||e!==xe)&&(e===xe&&(!(G&2)&&(Wa|=r),me===4&&Qt(e,be)),Le(e,n),r===1&&G===0&&!(t.mode&1)&&(Tn=de()+500,Fa&&xr()))}function Le(e,t){var r=e.callbackNode;Fg(e,t);var n=Xi(e,e===xe?be:0);if(n===0)r!==null&&Sc(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Sc(r),t===1)e.tag===0?Uy(gd.bind(null,e)):If(gd.bind(null,e)),Iy(function(){!(G&6)&&xr()}),r=null;else{switch(cf(n)){case 1:r=pu;break;case 4:r=of;break;case 16:r=Qi;break;case 536870912:r=lf;break;default:r=Qi}r=Op(r,Cp.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Cp(e,t){if(Bi=-1,Mi=0,G&6)throw Error(A(327));var r=e.callbackNode;if(bn()&&e.callbackNode!==r)return null;var n=Xi(e,e===xe?be:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=ga(e,n);else{t=n;var s=G;G|=2;var i=Np();(xe!==e||be!==t)&&(Tt=null,Tn=de()+500,Pr(e,t));do try{a0();break}catch(o){jp(e,o)}while(!0);ju(),fa.current=i,G=s,fe!==null?t=0:(xe=null,be=0,t=me)}if(t!==0){if(t===2&&(s=ul(e),s!==0&&(n=s,t=Dl(e,s))),t===1)throw r=Ps,Pr(e,0),Qt(e,n),Le(e,de()),r;if(t===6)Qt(e,n);else{if(s=e.current.alternate,!(n&30)&&!s0(s)&&(t=ga(e,n),t===2&&(i=ul(e),i!==0&&(n=i,t=Dl(e,i))),t===1))throw r=Ps,Pr(e,0),Qt(e,n),Le(e,de()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(A(345));case 2:Er(e,Oe,Tt);break;case 3:if(Qt(e,n),(n&130023424)===n&&(t=Mu+500-de(),10<t)){if(Xi(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){Te(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=yl(Er.bind(null,e,Oe,Tt),t);break}Er(e,Oe,Tt);break;case 4:if(Qt(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var a=31-ct(n);i=1<<a,a=t[a],a>s&&(s=a),n&=~i}if(n=s,n=de()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*n0(n/1960))-n,10<n){e.timeoutHandle=yl(Er.bind(null,e,Oe,Tt),n);break}Er(e,Oe,Tt);break;case 5:Er(e,Oe,Tt);break;default:throw Error(A(329))}}}return Le(e,de()),e.callbackNode===r?Cp.bind(null,e):null}function Dl(e,t){var r=cs;return e.current.memoizedState.isDehydrated&&(Pr(e,t).flags|=256),e=ga(e,t),e!==2&&(t=Oe,Oe=r,t!==null&&Ll(t)),e}function Ll(e){Oe===null?Oe=e:Oe.push.apply(Oe,e)}function s0(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(!ft(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 Qt(e,t){for(t&=~Bu,t&=~Wa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-ct(t),n=1<<r;e[r]=-1,t&=~n}}function gd(e){if(G&6)throw Error(A(327));bn();var t=Xi(e,0);if(!(t&1))return Le(e,de()),null;var r=ga(e,t);if(e.tag!==0&&r===2){var n=ul(e);n!==0&&(t=n,r=Dl(e,n))}if(r===1)throw r=Ps,Pr(e,0),Qt(e,t),Le(e,de()),r;if(r===6)throw Error(A(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Er(e,Oe,Tt),Le(e,de()),null}function qu(e,t){var r=G;G|=1;try{return e(t)}finally{G=r,G===0&&(Tn=de()+500,Fa&&xr())}}function Fr(e){rr!==null&&rr.tag===0&&!(G&6)&&bn();var t=G;G|=1;var r=Xe.transition,n=Y;try{if(Xe.transition=null,Y=1,e)return e()}finally{Y=n,Xe.transition=r,G=t,!(G&6)&&xr()}}function Wu(){Be=pn.current,re(pn)}function Pr(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,zy(r)),fe!==null)for(r=fe.return;r!==null;){var n=r;switch(Su(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&na();break;case 3:jn(),re($e),re(je),Ou();break;case 5:Pu(n);break;case 4:jn();break;case 13:re(ie);break;case 19:re(ie);break;case 10:Nu(n.type._context);break;case 22:case 23:Wu()}r=r.return}if(xe=e,fe=e=dr(e.current,null),be=Be=t,me=0,Ps=null,Bu=Wa=Ur=0,Oe=cs=null,Nr!==null){for(t=0;t<Nr.length;t++)if(r=Nr[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}Nr=null}return e}function jp(e,t){do{var r=fe;try{if(ju(),Li.current=ha,da){for(var n=ae.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}da=!1}if(Lr=0,ve=pe=ae=null,ls=!1,Ts=0,Fu.current=null,r===null||r.return===null){me=1,Ps=t,fe=null;break}e:{var i=e,a=r.return,o=r,u=t;if(t=be,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,d=o,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 m=nd(a);if(m!==null){m.flags&=-257,sd(m,a,o,i,t),m.mode&1&&rd(i,c,t),t=m,u=c;var x=t.updateQueue;if(x===null){var y=new Set;y.add(u),t.updateQueue=y}else x.add(u);break e}else{if(!(t&1)){rd(i,c,t),Hu();break e}u=Error(A(426))}}else if(se&&o.mode&1){var b=nd(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),sd(b,a,o,i,t),Eu(Nn(u,o));break e}}i=u=Nn(u,o),me!==4&&(me=2),cs===null?cs=[i]:cs.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=cp(i,u,t);Yc(i,g);break e;case 1:o=u;var p=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof p.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ur===null||!ur.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=dp(i,o,t);Yc(i,k);break e}}i=i.return}while(i!==null)}Ap(r)}catch(_){t=_,fe===r&&r!==null&&(fe=r=r.return);continue}break}while(!0)}function Np(){var e=fa.current;return fa.current=ha,e===null?ha:e}function Hu(){(me===0||me===3||me===2)&&(me=4),xe===null||!(Ur&268435455)&&!(Wa&268435455)||Qt(xe,be)}function ga(e,t){var r=G;G|=2;var n=Np();(xe!==e||be!==t)&&(Tt=null,Pr(e,t));do try{i0();break}catch(s){jp(e,s)}while(!0);if(ju(),G=r,fa.current=n,fe!==null)throw Error(A(261));return xe=null,be=0,me}function i0(){for(;fe!==null;)Tp(fe)}function a0(){for(;fe!==null&&!Rg();)Tp(fe)}function Tp(e){var t=Pp(e.alternate,e,Be);e.memoizedProps=e.pendingProps,t===null?Ap(e):fe=t,Fu.current=null}function Ap(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Zy(r,t),r!==null){r.flags&=32767,fe=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{me=6,fe=null;return}}else if(r=Xy(r,t,Be),r!==null){fe=r;return}if(t=t.sibling,t!==null){fe=t;return}fe=t=e}while(t!==null);me===0&&(me=5)}function Er(e,t,r){var n=Y,s=Xe.transition;try{Xe.transition=null,Y=1,o0(e,t,r,n)}finally{Xe.transition=s,Y=n}return null}function o0(e,t,r,n){do bn();while(rr!==null);if(G&6)throw Error(A(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(A(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(Bg(e,i),e===xe&&(fe=xe=null,be=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||yi||(yi=!0,Op(Qi,function(){return bn(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=Xe.transition,Xe.transition=null;var a=Y;Y=1;var o=G;G|=4,Fu.current=null,t0(e,r),Sp(r,e),jy(ml),Zi=!!pl,ml=pl=null,e.current=r,r0(r),Pg(),G=o,Y=a,Xe.transition=i}else e.current=r;if(yi&&(yi=!1,rr=e,ma=s),i=e.pendingLanes,i===0&&(ur=null),Ig(r.stateNode),Le(e,de()),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(pa)throw pa=!1,e=Il,Il=null,e;return ma&1&&e.tag!==0&&bn(),i=e.pendingLanes,i&1?e===$l?ds++:(ds=0,$l=e):ds=0,xr(),null}function bn(){if(rr!==null){var e=cf(ma),t=Xe.transition,r=Y;try{if(Xe.transition=null,Y=16>e?16:e,rr===null)var n=!1;else{if(e=rr,rr=null,ma=0,G&6)throw Error(A(331));var s=G;for(G|=4,$=e.current;$!==null;){var i=$,a=i.child;if($.flags&16){var o=i.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for($=c;$!==null;){var d=$;switch(d.tag){case 0:case 11:case 15:us(8,d,i)}var h=d.child;if(h!==null)h.return=d,$=h;else for(;$!==null;){d=$;var f=d.sibling,m=d.return;if(bp(d),d===c){$=null;break}if(f!==null){f.return=m,$=f;break}$=m}}}var x=i.alternate;if(x!==null){var y=x.child;if(y!==null){x.child=null;do{var b=y.sibling;y.sibling=null,y=b}while(y!==null)}}$=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,$=a;else e:for(;$!==null;){if(i=$,i.flags&2048)switch(i.tag){case 0:case 11:case 15:us(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,$=g;break e}$=i.return}}var p=e.current;for($=p;$!==null;){a=$;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,$=v;else e:for(a=p;$!==null;){if(o=$,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:qa(9,o)}}catch(_){ue(o,o.return,_)}if(o===a){$=null;break e}var k=o.sibling;if(k!==null){k.return=o.return,$=k;break e}$=o.return}}if(G=s,xr(),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot(Ia,e)}catch{}n=!0}return n}finally{Y=r,Xe.transition=t}}return!1}function yd(e,t,r){t=Nn(r,t),t=cp(e,t,1),e=lr(e,t,1),t=Te(),e!==null&&(Vs(e,1,t),Le(e,t))}function ue(e,t,r){if(e.tag===3)yd(e,e,r);else for(;t!==null;){if(t.tag===3){yd(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ur===null||!ur.has(n))){e=Nn(r,e),e=dp(t,e,1),t=lr(t,e,1),e=Te(),t!==null&&(Vs(t,1,e),Le(t,e));break}}t=t.return}}function l0(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Te(),e.pingedLanes|=e.suspendedLanes&r,xe===e&&(be&r)===r&&(me===4||me===3&&(be&130023424)===be&&500>de()-Mu?Pr(e,0):Bu|=r),Le(e,t)}function Rp(e,t){t===0&&(e.mode&1?(t=oi,oi<<=1,!(oi&130023424)&&(oi=4194304)):t=1);var r=Te();e=Ft(e,t),e!==null&&(Vs(e,t,r),Le(e,r))}function u0(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Rp(e,r)}function c0(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(A(314))}n!==null&&n.delete(t),Rp(e,r)}var Pp;Pp=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||$e.current)ze=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return ze=!1,Qy(e,t,r);ze=!!(e.flags&131072)}else ze=!1,se&&t.flags&1048576&&$f(t,aa,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Fi(e,t),e=t.pendingProps;var s=Sn(t,je.current);wn(t,r),s=Iu(null,t,n,e,s,r);var i=$u();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,De(n)?(i=!0,sa(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Au(t),s.updater=Ma,t.stateNode=s,s._reactInternals=t,Sl(t,n,e,r),t=jl(null,t,n,!0,i,r)):(t.tag=0,se&&i&&_u(t),Ne(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Fi(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=h0(n),e=it(n,e),s){case 0:t=Cl(null,t,n,e,r);break e;case 1:t=od(null,t,n,e,r);break e;case 11:t=id(null,t,n,e,r);break e;case 14:t=ad(null,t,n,it(n.type,e),r);break e}throw Error(A(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:it(n,s),Cl(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:it(n,s),od(e,t,n,s,r);case 3:e:{if(mp(t),e===null)throw Error(A(387));n=t.pendingProps,i=t.memoizedState,s=i.element,Mf(e,t),ua(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=Nn(Error(A(423)),t),t=ld(e,t,n,r,s);break e}else if(n!==s){s=Nn(Error(A(424)),t),t=ld(e,t,n,r,s);break e}else for(qe=or(t.stateNode.containerInfo.firstChild),We=t,se=!0,lt=null,r=Ff(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(En(),n===s){t=Bt(e,t,r);break e}Ne(e,t,n,r)}t=t.child}return t;case 5:return qf(t),e===null&&bl(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,gl(n,s)?a=null:i!==null&&gl(n,i)&&(t.flags|=32),pp(e,t),Ne(e,t,a,r),t.child;case 6:return e===null&&bl(t),null;case 13:return gp(e,t,r);case 4:return Ru(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Cn(t,null,n,r):Ne(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:it(n,s),id(e,t,n,s,r);case 7:return Ne(e,t,t.pendingProps,r),t.child;case 8:return Ne(e,t,t.pendingProps.children,r),t.child;case 12:return Ne(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,ee(oa,n._currentValue),n._currentValue=a,i!==null)if(ft(i.value,a)){if(i.children===s.children&&!$e.current){t=Bt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var u=o.firstContext;u!==null;){if(u.context===n){if(i.tag===1){u=Dt(-1,r&-r),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?u.next=u:(u.next=d.next,d.next=u),c.pending=u}}i.lanes|=r,u=i.alternate,u!==null&&(u.lanes|=r),kl(i.return,r,t),o.lanes|=r;break}u=u.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(A(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),kl(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}Ne(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,wn(t,r),s=Ze(s),n=n(s),t.flags|=1,Ne(e,t,n,r),t.child;case 14:return n=t.type,s=it(n,t.pendingProps),s=it(n.type,s),ad(e,t,n,s,r);case 15:return hp(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:it(n,s),Fi(e,t),t.tag=1,De(n)?(e=!0,sa(t)):e=!1,wn(t,r),up(t,n,s),Sl(t,n,s,r),jl(null,t,n,!0,e,r);case 19:return yp(e,t,r);case 22:return fp(e,t,r)}throw Error(A(156,t.tag))};function Op(e,t){return af(e,t)}function d0(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 Qe(e,t,r,n){return new d0(e,t,r,n)}function Vu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function h0(e){if(typeof e=="function")return Vu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===du)return 11;if(e===hu)return 14}return 2}function dr(e,t){var r=e.alternate;return r===null?(r=Qe(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 qi(e,t,r,n,s,i){var a=2;if(n=e,typeof e=="function")Vu(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case nn:return Or(r.children,s,i,t);case cu:a=8,s|=8;break;case Go:return e=Qe(12,r,t,s|2),e.elementType=Go,e.lanes=i,e;case Jo:return e=Qe(13,r,t,s),e.elementType=Jo,e.lanes=i,e;case Yo:return e=Qe(19,r,t,s),e.elementType=Yo,e.lanes=i,e;case Mh:return Ha(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fh:a=10;break e;case Bh:a=9;break e;case du:a=11;break e;case hu:a=14;break e;case Gt:a=16,n=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=Qe(a,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function Or(e,t,r,n){return e=Qe(7,e,n,t),e.lanes=r,e}function Ha(e,t,r,n){return e=Qe(22,e,n,t),e.elementType=Mh,e.lanes=r,e.stateNode={isHidden:!1},e}function Ro(e,t,r){return e=Qe(6,e,null,t),e.lanes=r,e}function Po(e,t,r){return t=Qe(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function f0(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=ho(0),this.expirationTimes=ho(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ho(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ku(e,t,r,n,s,i,a,o,u){return e=new f0(e,t,r,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Qe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Au(i),e}function p0(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 zp(e){if(!e)return fr;e=e._reactInternals;e:{if(qr(e)!==e||e.tag!==1)throw Error(A(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(De(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(A(171))}if(e.tag===1){var r=e.type;if(De(r))return zf(e,r,t)}return t}function Ip(e,t,r,n,s,i,a,o,u){return e=Ku(r,n,!0,e,s,i,a,o,u),e.context=zp(null),r=e.current,n=Te(),s=cr(r),i=Dt(n,s),i.callback=t??null,lr(r,i,s),e.current.lanes=s,Vs(e,s,n),Le(e,n),e}function Va(e,t,r,n){var s=t.current,i=Te(),a=cr(s);return r=zp(r),t.context===null?t.context=r:t.pendingContext=r,t=Dt(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=lr(s,t,a),e!==null&&(dt(e,s,a,i),Di(e,s,a)),a}function ya(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 vd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Gu(e,t){vd(e,t),(e=e.alternate)&&vd(e,t)}function m0(){return null}var $p=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ju(e){this._internalRoot=e}Ka.prototype.render=Ju.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(A(409));Va(e,t,null,null)};Ka.prototype.unmount=Ju.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fr(function(){Va(null,e,null,null)}),t[Ut]=null}};function Ka(e){this._internalRoot=e}Ka.prototype.unstable_scheduleHydration=function(e){if(e){var t=ff();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Yt.length&&t!==0&&t<Yt[r].priority;r++);Yt.splice(r,0,e),r===0&&mf(e)}};function Yu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ga(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function xd(){}function g0(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var c=ya(a);i.call(c)}}var a=Ip(t,n,e,0,null,!1,!1,"",xd);return e._reactRootContainer=a,e[Ut]=a.current,Ss(e.nodeType===8?e.parentNode:e),Fr(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var o=n;n=function(){var c=ya(u);o.call(c)}}var u=Ku(e,0,!1,null,null,!1,!1,"",xd);return e._reactRootContainer=u,e[Ut]=u.current,Ss(e.nodeType===8?e.parentNode:e),Fr(function(){Va(t,u,r,n)}),u}function Ja(e,t,r,n,s){var i=r._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var o=s;s=function(){var u=ya(a);o.call(u)}}Va(t,a,e,s)}else a=g0(r,t,e,s,n);return ya(a)}df=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Qn(t.pendingLanes);r!==0&&(mu(t,r|1),Le(t,de()),!(G&6)&&(Tn=de()+500,xr()))}break;case 13:Fr(function(){var n=Ft(e,1);if(n!==null){var s=Te();dt(n,e,1,s)}}),Gu(e,1)}};gu=function(e){if(e.tag===13){var t=Ft(e,134217728);if(t!==null){var r=Te();dt(t,e,134217728,r)}Gu(e,134217728)}};hf=function(e){if(e.tag===13){var t=cr(e),r=Ft(e,t);if(r!==null){var n=Te();dt(r,e,t,n)}Gu(e,t)}};ff=function(){return Y};pf=function(e,t){var r=Y;try{return Y=e,t()}finally{Y=r}};al=function(e,t,r){switch(t){case"input":if(Zo(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=Ua(n);if(!s)throw Error(A(90));Wh(n),Zo(n,s)}}}break;case"textarea":Vh(e,r);break;case"select":t=r.value,t!=null&&gn(e,!!r.multiple,t,!1)}};Zh=qu;ef=Fr;var y0={usingClientEntryPoint:!1,Events:[Gs,ln,Ua,Qh,Xh,qu]},Wn={findFiberByHostInstance:jr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},v0={bundleType:Wn.bundleType,version:Wn.version,rendererPackageName:Wn.rendererPackageName,rendererConfig:Wn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:qt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=nf(e),e===null?null:e.stateNode},findFiberByHostInstance:Wn.findFiberByHostInstance||m0,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 vi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vi.isDisabled&&vi.supportsFiber)try{Ia=vi.inject(v0),bt=vi}catch{}}Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=y0;Ve.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yu(t))throw Error(A(200));return p0(e,t,null,r)};Ve.createRoot=function(e,t){if(!Yu(e))throw Error(A(299));var r=!1,n="",s=$p;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Ku(e,1,!1,null,null,r,!1,n,s),e[Ut]=t.current,Ss(e.nodeType===8?e.parentNode:e),new Ju(t)};Ve.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(A(188)):(e=Object.keys(e).join(","),Error(A(268,e)));return e=nf(t),e=e===null?null:e.stateNode,e};Ve.flushSync=function(e){return Fr(e)};Ve.hydrate=function(e,t,r){if(!Ga(t))throw Error(A(200));return Ja(null,e,t,!0,r)};Ve.hydrateRoot=function(e,t,r){if(!Yu(e))throw Error(A(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",a=$p;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=Ip(t,null,e,1,r??null,s,!1,i,a),e[Ut]=t.current,Ss(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 Ka(t)};Ve.render=function(e,t,r){if(!Ga(t))throw Error(A(200));return Ja(null,e,t,!1,r)};Ve.unmountComponentAtNode=function(e){if(!Ga(e))throw Error(A(40));return e._reactRootContainer?(Fr(function(){Ja(null,null,e,!1,function(){e._reactRootContainer=null,e[Ut]=null})}),!0):!1};Ve.unstable_batchedUpdates=qu;Ve.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Ga(r))throw Error(A(200));if(e==null||e._reactInternals===void 0)throw Error(A(38));return Ja(e,t,r,!1,n)};Ve.version="18.3.1-next-f1338f8080-20240426";function Dp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dp)}catch(e){console.error(e)}}Dp(),$h.exports=Ve;var x0=$h.exports,wd=x0;Vo.createRoot=wd.createRoot,Vo.hydrateRoot=wd.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 Qu=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Lp=/^[\\/]{2}/;function w0(e,t){return t+e.replace(/\\/g,"/")}var bd="popstate";function kd(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function b0(e={}){function t(n,s){var c;let i=(c=s.state)==null?void 0:c.masked,{pathname:a,search:o,hash:u}=i||n.location;return Ul("",{pathname:a,search:o,hash:u},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:Os(s)}return _0(t,r,null,e)}function ge(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function St(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function k0(){return Math.random().toString(36).substring(2,10)}function _d(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 Ul(e,t,r=null,n,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ys(t):t,state:r,key:t&&t.key||n||k0(),mask:s}}function Os({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 Ys(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 _0(e,t,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,o="POP",u=null,c=d();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function d(){return(a.state||{idx:null}).idx}function h(){o="POP";let b=d(),g=b==null?null:b-c;c=b,u&&u({action:o,location:y.location,delta:g})}function f(b,g){o="PUSH";let p=kd(b)?b:Ul(y.location,b,g);c=d()+1;let v=_d(p,c),k=y.createHref(p.mask||p);try{a.pushState(v,"",k)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;s.location.assign(k)}i&&u&&u({action:o,location:y.location,delta:1})}function m(b,g){o="REPLACE";let p=kd(b)?b:Ul(y.location,b,g);c=d();let v=_d(p,c),k=y.createHref(p.mask||p);a.replaceState(v,"",k),i&&u&&u({action:o,location:y.location,delta:0})}function x(b){return S0(s,b)}let y={get action(){return o},get location(){return e(s,a)},listen(b){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(bd,h),u=b,()=>{s.removeEventListener(bd,h),u=null}},createHref(b){return t(s,b)},createURL:x,encodeLocation(b){let g=x(b);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:m,go(b){return a.go(b)}};return y}function S0(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),ge(n,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Os(t);return s=s.replace(/ $/,"%20"),!r&&Lp.test(s)&&(s=n+s),new URL(s,n)}function Up(e,t,r="/"){return E0(e,t,r,!1)}function E0(e,t,r,n,s){let i=typeof t=="string"?Ys(t):t,a=Mt(i.pathname||"/",r);if(a==null)return null;let o=C0(e),u=null,c=D0(a);for(let d=0;u==null&&d<o.length;++d)u=$0(o[d],c,n);return u}function C0(e){let t=Fp(e);return j0(t),t}function Fp(e,t=[],r=[],n="",s=!1){let i=(a,o,u=s,c)=>{let d={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&u)return;ge(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=ht([n,d.relativePath]),f=r.concat(d);a.children&&a.children.length>0&&(ge(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),Fp(a.children,t,f,h,u)),!(a.path==null&&!a.index)&&t.push({path:h,score:z0(h,a.index),routesMeta:f.map((m,x)=>{let[y,b]=qp(m.relativePath,m.caseSensitive,x===f.length-1);return{...m,matcher:y,compiledParams:b}})})};return e.forEach((a,o)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))i(a,o);else for(let c of Bp(a.path))i(a,o,!0,c)}),t}function Bp(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=Bp(n.join("/")),o=[];return o.push(...a.map(u=>u===""?i:[i,u].join("/"))),s&&o.push(...a),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function j0(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:I0(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var N0=/^:[\w-]+$/,T0=3,A0=2,R0=1,P0=10,O0=-2,Sd=e=>e==="*";function z0(e,t){let r=e.split("/"),n=r.length;return r.some(Sd)&&(n+=O0),t&&(n+=A0),r.filter(s=>!Sd(s)).reduce((s,i)=>s+(N0.test(i)?T0:i===""?R0:P0),n)}function I0(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 $0(e,t,r=!1){let{routesMeta:n}=e,s={},i="/",a=[];for(let o=0;o<n.length;++o){let u=n[o],c=o===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",h={path:u.relativePath,caseSensitive:u.caseSensitive,end:c},f=u.matcher&&u.compiledParams?Mp(h,d,u.matcher,u.compiledParams):va(h,d),m=u.route;if(!f&&c&&r&&!n[n.length-1].route.index&&(f=va({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!f)return null;Object.assign(s,f.params),a.push({params:s,pathname:ht([i,f.pathname]),pathnameBase:F0(ht([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=ht([i,f.pathnameBase]))}return a}function va(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=qp(e.path,e.caseSensitive,e.end);return Mp(e,t,r,n)}function Mp(e,t,r,n){let s=t.match(r);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),o=s.slice(1);return{params:n.reduce((c,{paramName:d,isOptional:h},f)=>{if(d==="*"){let x=o[f]||"";a=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const m=o[f];return h&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:a,pattern:e}}function qp(e,t=!1,r=!0){St(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,o,u,c,d)=>{if(n.push({paramName:o,isOptional:u!=null}),u){let h=d.charAt(c+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 D0(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return St(!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 Mt(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 L0(e,t="/"){let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Ys(e):e,i;return r?(r=Hp(r),r.startsWith("/")?i=Ed(r.substring(1),"/"):i=Ed(r,t)):i=t,{pathname:i,search:B0(n),hash:M0(s)}}function Ed(e,t){let r=xa(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Oo(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 U0(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Wp(e){let t=U0(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function Xu(e,t,r,n=!1){let s;typeof e=="string"?s=Ys(e):(s={...e},ge(!s.pathname||!s.pathname.includes("?"),Oo("?","pathname","search",s)),ge(!s.pathname||!s.pathname.includes("#"),Oo("#","pathname","hash",s)),ge(!s.search||!s.search.includes("#"),Oo("#","search","hash",s)));let i=e===""||s.pathname==="",a=i?"/":s.pathname,o;if(a==null)o=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("/")}o=h>=0?t[h]:"/"}let u=L0(s,o),c=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||d)&&(u.pathname+="/"),u}var Hp=e=>e.replace(/[\\/]{2,}/g,"/"),ht=e=>Hp(e.join("/")),xa=e=>e.replace(/\/+$/,""),F0=e=>xa(e).replace(/^\/*/,"/"),B0=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,M0=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,q0=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 W0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function H0(e){let t=e.map(r=>r.route.path).filter(Boolean);return ht(t)||"/"}var Vp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Kp(e,t){let r=e;if(typeof r!="string"||!Qu.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,s=!1;if(Vp)try{let i=new URL(window.location.href),a=Lp.test(r)?new URL(w0(r,i.protocol)):new URL(r),o=Mt(a.pathname,t);a.origin===i.origin&&o!=null?r=o+a.search+a.hash:s=!0}catch{St(!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 Gp=["POST","PUT","PATCH","DELETE"];new Set(Gp);var V0=["GET",...Gp];new Set(V0);var K0=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function G0(e){try{return K0.includes(new URL(e).protocol)}catch{return!1}}var zn=w.createContext(null);zn.displayName="DataRouter";var Ya=w.createContext(null);Ya.displayName="DataRouterState";var Jp=w.createContext(!1);function J0(){return w.useContext(Jp)}var Yp=w.createContext({isTransitioning:!1});Yp.displayName="ViewTransition";var Y0=w.createContext(new Map);Y0.displayName="Fetchers";var Q0=w.createContext(null);Q0.displayName="Await";var tt=w.createContext(null);tt.displayName="Navigation";var Qa=w.createContext(null);Qa.displayName="Location";var Wt=w.createContext({outlet:null,matches:[],isDataRoute:!1});Wt.displayName="Route";var Zu=w.createContext(null);Zu.displayName="RouteError";var Qp="REACT_ROUTER_ERROR",X0="REDIRECT",Z0="ROUTE_ERROR_RESPONSE";function ev(e){if(e.startsWith(`${Qp}:${X0}:{`))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 tv(e){if(e.startsWith(`${Qp}:${Z0}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new q0(t.status,t.statusText,t.data)}catch{}}function rv(e,{relative:t}={}){ge(Qs(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=w.useContext(tt),{hash:s,pathname:i,search:a}=Xs(e,{relative:t}),o=i;return r!=="/"&&(o=i==="/"?r:ht([r,i])),n.createHref({pathname:o,search:a,hash:s})}function Qs(){return w.useContext(Qa)!=null}function pt(){return ge(Qs(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Qa).location}var Xp="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Zp(e){w.useContext(tt).static||w.useLayoutEffect(e)}function em(){let{isDataRoute:e}=w.useContext(Wt);return e?mv():nv()}function nv(){ge(Qs(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(zn),{basename:t,navigator:r}=w.useContext(tt),{matches:n}=w.useContext(Wt),{pathname:s}=pt(),i=JSON.stringify(Wp(n)),a=w.useRef(!1);return Zp(()=>{a.current=!0}),w.useCallback((u,c={})=>{if(St(a.current,Xp),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=Xu(u,JSON.parse(i),s,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ht([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,i,s,e])}w.createContext(null);function Xs(e,{relative:t}={}){let{matches:r}=w.useContext(Wt),{pathname:n}=pt(),s=JSON.stringify(Wp(r));return w.useMemo(()=>Xu(e,JSON.parse(s),n,t==="path"),[e,s,n,t])}function sv(e,t,r){ge(Qs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=w.useContext(tt),{matches:s}=w.useContext(Wt),i=s[s.length-1],a=i?i.params:{},o=i?i.pathname:"/",u=i?i.pathnameBase:"/",c=i&&i.route;{let b=c&&c.path||"";rm(o,!c||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${b}">) 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="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let d=pt(),h;h=d;let f=h.pathname||"/",m=f;if(u!=="/"){let b=u.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=r&&r.state.matches.length?r.state.matches.map(b=>Object.assign(b,{route:r.manifest[b.route.id]||b.route})):Up(e,{pathname:m});return St(c||x!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),St(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.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.`),uv(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},a,b.params),pathname:ht([u,n.encodeLocation?n.encodeLocation(b.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:ht([u,n.encodeLocation?n.encodeLocation(b.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),s,r)}function iv(){let e=pv(),t=W0(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=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:i},"ErrorBoundary")," or"," ",w.createElement("code",{style:i},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),r?w.createElement("pre",{style:s},r):null,a)}var av=w.createElement(iv,null),tm=class extends w.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=tv(e.digest);r&&(e=r)}let t=e!==void 0?w.createElement(Wt.Provider,{value:this.props.routeContext},w.createElement(Zu.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(ov,{error:e},t):t}};tm.contextType=Jp;var zo=new WeakMap;function ov({children:e,error:t}){let{basename:r}=w.useContext(tt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=ev(t.digest);if(n){let s=zo.get(t);if(s)throw s;let i=Kp(n.location,r),a=i.absoluteURL||i.to;if(G0(a))throw new Error("Invalid redirect location");if(Vp&&!zo.get(t))if(i.isExternal||n.reloadDocument)window.location.href=a;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw zo.set(t,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a}`})}}return e}function lv({routeContext:e,match:t,children:r}){let n=w.useContext(zn);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(Wt.Provider,{value:e},r)}function uv(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);ge(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,o=-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)&&(o=d),h.route.id){let{loaderData:f,errors:m}=n,x=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!m||m[h.route.id]===void 0);if(h.route.lazy||x){r.isStatic&&(a=!0),o>=0?s=s.slice(0,o+1):s=[s[0]];break}}}}let u=r==null?void 0:r.onError,c=n&&u?(d,h)=>{var f,m;u(d,{location:n.location,params:((m=(f=n.matches)==null?void 0:f[0])==null?void 0:m.params)??{},pattern:H0(n.matches),errorInfo:h})}:void 0;return s.reduceRight((d,h,f)=>{let m,x=!1,y=null,b=null;n&&(m=i&&h.route.id?i[h.route.id]:void 0,y=h.route.errorElement||av,a&&(o<0&&f===0?(rm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,b=null):o===f&&(x=!0,b=h.route.hydrateFallbackElement||null)));let g=t.concat(s.slice(0,f+1)),p=()=>{let v;return m?v=y:x?v=b:h.route.Component?v=w.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=d,w.createElement(lv,{match:h,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?w.createElement(tm,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:p(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):p()},null)}function ec(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cv(e){let t=w.useContext(zn);return ge(t,ec(e)),t}function dv(e){let t=w.useContext(Ya);return ge(t,ec(e)),t}function hv(e){let t=w.useContext(Wt);return ge(t,ec(e)),t}function tc(e){let t=hv(e),r=t.matches[t.matches.length-1];return ge(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function fv(){return tc("useRouteId")}function pv(){var n;let e=w.useContext(Zu),t=dv("useRouteError"),r=tc("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function mv(){let{router:e}=cv("useNavigate"),t=tc("useNavigate"),r=w.useRef(!1);return Zp(()=>{r.current=!0}),w.useCallback(async(s,i={})=>{St(r.current,Xp),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Cd={};function rm(e,t,r){!t&&!Cd[e]&&(Cd[e]=!0,St(!1,r))}w.memo(gv);function gv({routes:e,manifest:t,future:r,state:n,isStatic:s,onError:i}){return sv(e,void 0,{manifest:t,state:n,isStatic:s,onError:i})}function yv({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:s,static:i=!1,useTransitions:a}){ge(!Qs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),u=w.useMemo(()=>({basename:o,navigator:s,static:i,useTransitions:a,future:{}}),[o,s,i,a]);typeof r=="string"&&(r=Ys(r));let{pathname:c="/",search:d="",hash:h="",state:f=null,key:m="default",mask:x}=r,y=w.useMemo(()=>{let b=Mt(c,o);return b==null?null:{location:{pathname:b,search:d,hash:h,state:f,key:m,mask:x},navigationType:n}},[o,c,d,h,f,m,n,x]);return St(y!=null,`<Router basename="${o}"> is not able to match the URL "${c}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:w.createElement(tt.Provider,{value:u},w.createElement(Qa.Provider,{children:t,value:y}))}var Wi="get",Hi="application/x-www-form-urlencoded";function Xa(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function vv(e){return Xa(e)&&e.tagName.toLowerCase()==="button"}function xv(e){return Xa(e)&&e.tagName.toLowerCase()==="form"}function wv(e){return Xa(e)&&e.tagName.toLowerCase()==="input"}function bv(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kv(e,t){return e.button===0&&(!t||t==="_self")&&!bv(e)}var xi=null;function _v(){if(xi===null)try{new FormData(document.createElement("form"),0),xi=!1}catch{xi=!0}return xi}var Sv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Io(e){return e!=null&&!Sv.has(e)?(St(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Hi}"`),null):e}function Ev(e,t){let r,n,s,i,a;if(xv(e)){let o=e.getAttribute("action");n=o?Mt(o,t):null,r=e.getAttribute("method")||Wi,s=Io(e.getAttribute("enctype"))||Hi,i=new FormData(e)}else if(vv(e)||wv(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||o.getAttribute("action");if(n=u?Mt(u,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||Wi,s=Io(e.getAttribute("formenctype"))||Io(o.getAttribute("enctype"))||Hi,i=new FormData(o,e),!_v()){let{name:c,type:d,value:h}=e;if(d==="image"){let f=c?`${c}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else c&&i.append(c,h)}}else{if(Xa(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Wi,n=null,s=Hi,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 rc(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nm(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&&Mt(s.pathname,t)==="/"?s.pathname=`${xa(t)}/_root.${n}`:s.pathname=`${xa(s.pathname)}.${n}`,s}async function Cv(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 jv(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 Nv(e,t,r){let n=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let a=await Cv(i,r);return a.links?a.links():[]}return[]}));return Pv(n.flat(1).filter(jv).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function jd(e,t,r,n,s,i){let a=(u,c)=>r[c]?u.route.id!==r[c].route.id:!0,o=(u,c)=>{var d;return r[c].pathname!==u.pathname||((d=r[c].route.path)==null?void 0:d.endsWith("*"))&&r[c].params["*"]!==u.params["*"]};return i==="assets"?t.filter((u,c)=>a(u,c)||o(u,c)):i==="data"?t.filter((u,c)=>{var h;let d=n.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(a(u,c)||o(u,c))return!0;if(u.route.shouldRevalidate){let f=u.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:u.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function Tv(e,t,{includeHydrateFallback:r}={}){return Av(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 Av(e){return[...new Set(e)]}function Rv(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function Pv(e,t){let r=new Set;return new Set(t),e.reduce((n,s)=>{let i=JSON.stringify(Rv(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function nc(){let e=w.useContext(zn);return rc(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ov(){let e=w.useContext(Ya);return rc(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var sc=w.createContext(void 0);sc.displayName="FrameworkContext";function Za(){let e=w.useContext(sc);return rc(e,"You must render this element inside a <HydratedRouter> element"),e}function zv(e,t){let r=w.useContext(sc),[n,s]=w.useState(!1),[i,a]=w.useState(!1),{onFocus:o,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=t,f=w.useRef(null);w.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let y=g=>{g.forEach(p=>{a(p.isIntersecting)})},b=new IntersectionObserver(y,{threshold:.5});return f.current&&b.observe(f.current),()=>{b.disconnect()}}},[e]),w.useEffect(()=>{if(n){let y=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(y)}}},[n]);let m=()=>{s(!0)},x=()=>{s(!1),a(!1)};return r?e!=="intent"?[i,f,{}]:[i,f,{onFocus:Hn(o,m),onBlur:Hn(u,x),onMouseEnter:Hn(c,m),onMouseLeave:Hn(d,x),onTouchStart:Hn(h,m)}]:[!1,f,{}]}function Hn(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Iv({page:e,...t}){let r=J0(),{nonce:n}=Za(),{router:s}=nc(),i=w.useMemo(()=>Up(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&n&&(t={...t,nonce:n}),r?w.createElement(Dv,{page:e,matches:i,...t}):w.createElement(Lv,{page:e,matches:i,...t})):null}function $v(e){let{manifest:t,routeModules:r}=Za(),[n,s]=w.useState([]);return w.useEffect(()=>{let i=!1;return Nv(e,t,r).then(a=>{i||s(a)}),()=>{i=!0}},[e,t,r]),n}function Dv({page:e,matches:t,...r}){let n=pt(),{future:s}=Za(),{basename:i}=nc(),a=w.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let o=nm(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),u=!1,c=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?u=!0:c.push(d.route.id);return u&&c.length>0&&o.searchParams.set("_routes",c.join(",")),[o.pathname+o.search]},[i,s.v8_trailingSlashAwareDataRequests,e,n,t]);return w.createElement(w.Fragment,null,a.map(o=>w.createElement("link",{key:o,rel:"prefetch",as:"fetch",href:o,...r})))}function Lv({page:e,matches:t,...r}){let n=pt(),{future:s,manifest:i,routeModules:a}=Za(),{basename:o}=nc(),{loaderData:u,matches:c}=Ov(),d=w.useMemo(()=>jd(e,t,c,i,n,"data"),[e,t,c,i,n]),h=w.useMemo(()=>jd(e,t,c,i,n,"assets"),[e,t,c,i,n]),f=w.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let y=new Set,b=!1;if(t.forEach(p=>{var k;let v=i.routes[p.route.id];!v||!v.hasLoader||(!d.some(_=>_.route.id===p.route.id)&&p.route.id in u&&((k=a[p.route.id])!=null&&k.shouldRevalidate)||v.hasClientLoader?b=!0:y.add(p.route.id))}),y.size===0)return[];let g=nm(e,o,s.v8_trailingSlashAwareDataRequests,"data");return b&&y.size>0&&g.searchParams.set("_routes",t.filter(p=>y.has(p.route.id)).map(p=>p.route.id).join(",")),[g.pathname+g.search]},[o,s.v8_trailingSlashAwareDataRequests,u,n,i,d,t,e,a]),m=w.useMemo(()=>Tv(h,i),[h,i]),x=$v(h);return w.createElement(w.Fragment,null,f.map(y=>w.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...r})),m.map(y=>w.createElement("link",{key:y,rel:"modulepreload",href:y,...r})),x.map(({key:y,link:b})=>w.createElement("link",{key:y,nonce:r.nonce,...b,crossOrigin:b.crossOrigin??r.crossOrigin})))}function Uv(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Fv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Fv&&(window.__reactRouterVersion="7.18.1")}catch{}function Bv({basename:e,children:t,useTransitions:r,window:n}){let s=w.useRef();s.current==null&&(s.current=b0({window:n,v5Compat:!0}));let i=s.current,[a,o]=w.useState({action:i.action,location:i.location}),u=w.useCallback(c=>{r===!1?o(c):w.startTransition(()=>o(c))},[r]);return w.useLayoutEffect(()=>i.listen(u),[i,u]),w.createElement(yv,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,useTransitions:r})}var sm=w.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,mask:o,state:u,target:c,to:d,preventScrollReset:h,viewTransition:f,defaultShouldRevalidate:m,...x},y){let{basename:b,navigator:g,useTransitions:p}=w.useContext(tt),v=typeof d=="string"&&Qu.test(d),k=Kp(d,b);d=k.to;let _=rv(d,{relative:s}),E=pt(),C=null;if(o){let z=Xu(o,[],E.mask?E.mask.pathname:"/",!0);b!=="/"&&(z.pathname=z.pathname==="/"?b:ht([b,z.pathname])),C=g.createHref(z)}let[P,T,j]=zv(n,x),L=Hv(d,{replace:a,mask:o,state:u,target:c,preventScrollReset:h,relative:s,viewTransition:f,defaultShouldRevalidate:m,useTransitions:p});function S(z){t&&t(z),z.defaultPrevented||L(z)}let N=!(k.isExternal||i),R=w.createElement("a",{...x,...j,href:(N?C:void 0)||k.absoluteURL||_,onClick:N?S:t,ref:Uv(y,T),target:c,"data-discover":!v&&r==="render"?"true":void 0});return P&&!v?w.createElement(w.Fragment,null,R,w.createElement(Iv,{page:_})):R});sm.displayName="Link";var Mv=w.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:o,children:u,...c},d){let h=Xs(a,{relative:c.relative}),f=pt(),m=w.useContext(Ya),{navigator:x,basename:y}=w.useContext(tt),b=m!=null&&Yv(h)&&o===!0,g=x.encodeLocation?x.encodeLocation(h).pathname:h.pathname,p=f.pathname,v=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;r||(p=p.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&y&&(v=Mt(v,y)||v);const k=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let _=p===g||!s&&p.startsWith(g)&&p.charAt(k)==="/",E=v!=null&&(v===g||!s&&v.startsWith(g)&&v.charAt(g.length)==="/"),C={isActive:_,isPending:E,isTransitioning:b},P=_?t:void 0,T;typeof n=="function"?T=n(C):T=[n,_?"active":null,E?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let j=typeof i=="function"?i(C):i;return w.createElement(sm,{...c,"aria-current":P,className:T,ref:d,style:j,to:a,viewTransition:o},typeof u=="function"?u(C):u)});Mv.displayName="NavLink";var qv=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:s,state:i,method:a=Wi,action:o,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f,...m},x)=>{let{useTransitions:y}=w.useContext(tt),b=Gv(),g=Jv(o,{relative:c}),p=a.toLowerCase()==="get"?"get":"post",v=typeof o=="string"&&Qu.test(o),k=_=>{if(u&&u(_),_.defaultPrevented)return;_.preventDefault();let E=_.nativeEvent.submitter,C=(E==null?void 0:E.getAttribute("formmethod"))||a,P=()=>b(E||_.currentTarget,{fetcherKey:t,method:C,navigate:r,replace:s,state:i,relative:c,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f});y&&r!==!1?w.startTransition(()=>P()):P()};return w.createElement("form",{ref:x,method:p,action:g,onSubmit:n?u:k,...m,"data-discover":!v&&e==="render"?"true":void 0})});qv.displayName="Form";function Wv(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=w.useContext(zn);return ge(t,Wv(e)),t}function Hv(e,{target:t,replace:r,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:u,useTransitions:c}={}){let d=em(),h=pt(),f=Xs(e,{relative:a});return w.useCallback(m=>{if(kv(m,t)){m.preventDefault();let x=r!==void 0?r:Os(h)===Os(f),y=()=>d(e,{replace:x,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:u});c?w.startTransition(()=>y()):y()}},[h,d,f,r,n,s,t,e,i,a,o,u,c])}var Vv=0,Kv=()=>`__${String(++Vv)}__`;function Gv(){let{router:e}=im("useSubmit"),{basename:t}=w.useContext(tt),r=fv(),n=e.fetch,s=e.navigate;return w.useCallback(async(i,a={})=>{let{action:o,method:u,encType:c,formData:d,body:h}=Ev(i,t);if(a.navigate===!1){let f=a.fetcherKey||Kv();await n(f,r,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||u,formEncType:a.encType||c,flushSync:a.flushSync})}else await s(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||u,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,s,t,r])}function Jv(e,{relative:t}={}){let{basename:r}=w.useContext(tt),n=w.useContext(Wt);ge(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...Xs(e||".",{relative:t})},a=pt();if(e==null){i.search=a.search;let o=new URLSearchParams(i.search),u=o.getAll("index");if(u.some(d=>d==="")){o.delete("index"),u.filter(h=>h).forEach(h=>o.append("index",h));let d=o.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:ht([r,i.pathname])),Os(i)}function Yv(e,{relative:t}={}){let r=w.useContext(Yp);ge(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=Xs(e,{relative:t});if(!r.isTransitioning)return!1;let i=Mt(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=Mt(r.nextLocation.pathname,n)||r.nextLocation.pathname;return va(s.pathname,a)!=null||va(s.pathname,i)!=null}const Qv="modulepreload",Xv=function(e){return"/"+e},Nd={},Ct=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(r.map(u=>{if(u=Xv(u),u in Nd)return;Nd[u]=!0;const c=u.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Qv,c||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),c)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.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 Zv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),am=(...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 ex={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 tx=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...o},u)=>w.createElement("svg",{ref:u,...ex,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:am("lucide",s),...o},[...a.map(([c,d])=>w.createElement(c,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 M=(e,t)=>{const r=w.forwardRef(({className:n,...s},i)=>w.createElement(tx,{ref:i,iconNode:t,className:am(`lucide-${Zv(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 om=M("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 rx=M("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 $t=M("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 eo=M("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 zr=M("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 lm=M("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 nx=M("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 ic=M("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 zs=M("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 Wr=M("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 sx=M("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 ix=M("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 ax=M("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 Fl=M("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 Td=M("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 um=M("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 ox=M("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 pr=M("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 An=M("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 lx=M("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 mr=M("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 Ad=M("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 ux=M("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 gr=M("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 cx=M("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 dx=M("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 hx=M("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 wa=M("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 fx=M("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 ac=M("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 Is=M("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 px=M("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 hs=M("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 _t=M("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 mx=M("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
* @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 ba=M("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 oc=M("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 gx=M("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 Rd=M("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 ka=M("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 cm=M("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 Bl=M("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
* @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 Br=M("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 _a=M("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 Et=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function to(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 yx(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 o(d){try{c(n.next(d))}catch(h){a(h)}}function u(d){try{c(n.throw(d))}catch(h){a(h)}}function c(d){d.done?i(d.value):s(d.value).then(o,u)}c((n=n.apply(e,t||[])).next())})}const vx=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class lc 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 xx extends lc{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Pd extends lc{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Od extends lc{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Ml;(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"})(Ml||(Ml={}));class wx{constructor(t,{headers:r={},customFetch:n,region:s=Ml.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=vx(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return yx(this,arguments,void 0,function*(r,n={}){var s;let i,a;try{const{headers:o,method:u,body:c,signal:d,timeout:h}=n;let f={},{region:m}=n;m||(m=this.region);const x=new URL(`${this.url}/${r}`);m&&m!=="any"&&(f["x-region"]=m,x.searchParams.set("forceFunctionRegion",m));let y;const b=!!o&&Object.keys(o).some(E=>E.toLowerCase()==="content-type");c&&!b?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(f["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(f["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let g=d;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),d?(g=a.signal,d.addEventListener("abort",()=>a.abort())):g=a.signal);const p=yield this.fetch(x.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:y,signal:g}).catch(E=>{throw new xx(E)}),v=p.headers.get("x-relay-error");if(v&&v==="true")throw new Pd(p);if(!p.ok)throw new Od(p);let k=((s=p.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),_;return k==="application/json"?_=yield p.json():k==="application/octet-stream"||k==="application/pdf"?_=yield p.blob():k==="text/event-stream"?_=p:k==="multipart/form-data"?_=yield p.formData():_=yield p.text(),{data:_,error:null,response:p}}catch(o){return{data:null,error:o,response:o instanceof Od||o instanceof Pd?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const dm=3,zd=e=>Math.min(1e3*2**e,3e4),bx=[520,503],hm=["GET","HEAD","OPTIONS"];var Id=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 $d(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 kx(e,t,r,n){return!(!n||r>=dm||!hm.includes(e)||!bx.includes(t))}var _x=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 c={};r.headers.forEach((h,f)=>{c[f]=h}),a>0&&(c["X-Retry-Count"]=String(a));let d;try{d=await n(r.url.toString(),{method:r.method,headers:c,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"||!hm.includes(r.method))throw h;if(r.retryEnabled&&a<dm){const f=zd(a);a++,await $d(f,r.signal);continue}throw h}if(kx(r.method,d.status,a,r.retryEnabled)){var o,u;const h=(o=(u=d.headers)===null||u===void 0?void 0:u.get("Retry-After"))!==null&&o!==void 0?o:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:zd(a);await d.text(),a++,await $d(f,r.signal);continue}return await r.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let u="",c="",d="";const h=a==null?void 0:a.cause;if(h){var f,m,x,y;const p=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",v=(m=h==null?void 0:h.code)!==null&&m!==void 0?m:"";u=`${(x=a==null?void 0:a.name)!==null&&x!==void 0?x:"FetchError"}: ${a==null?void 0:a.message}`,u+=`
Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${p}`,v&&(u+=` (${v})`),h!=null&&h.stack&&(u+=`
${h.stack}`)}else{var b;u=(b=a==null?void 0:a.stack)!==null&&b!==void 0?b:""}const g=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(d="",c="Request was aborted (timeout or manual cancellation)",g>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${g} 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="",c="HTTP headers exceeded server limits (typically 16KB)",g>this.urlLengthLimit&&(c+=`. Your request URL is ${g} 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:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:u,hint:c,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 o,u;if(t.method!=="HEAD"){var c;const f=await e.text();if(f!=="")if(t.headers.get("Accept")==="text/csv")n=f;else if(t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.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 Id({message:f,details:"",hint:"",code:""})}}const d=(o=t.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),h=(u=e.headers.get("content-range"))===null||u===void 0?void 0:u.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 Id(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},Sx=class extends _x{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 o=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${u}"; options=${o};`),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 Dd=new RegExp("[,()]");var Xr=class extends Sx{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"&&Dd.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"&&Dd.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}},Ex=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(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:o,headers:u}=this.cloneRequestState();return o.searchParams.set("select",a),n&&u.append("Prefer",`count=${n}`),new Xr({method:s,url:o,headers:u,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 o=e.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(o.length>0){const u=[...new Set(o)].map(c=>`"${c}"`);i.searchParams.set("columns",u.join(","))}}return new Xr({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:o,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&u.append("Prefer",`count=${n}`),s||u.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(c.length>0){const d=[...new Set(c)].map(h=>`"${h}"`);o.searchParams.set("columns",d.join(","))}}return new Xr({method:a,url:o,headers:u,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 Xr({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 Xr({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 $s(e){"@babel/helpers - typeof";return $s=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},$s(e)}function Cx(e,t){if($s(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($s(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jx(e){var t=Cx(e,"string");return $s(t)=="symbol"?t:t+""}function Nx(e,t,r){return(t=jx(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ld(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 wi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ld(Object(r),!0).forEach(function(n){Nx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ld(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Tx=class fm{constructor(t,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=a;const u=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),i),m=d==null?void 0:d.signal;if(m){if(m.aborted)return clearTimeout(f),u(c,d);const x=()=>{clearTimeout(f),h.abort()};return m.addEventListener("abort",x,{once:!0}),u(c,wi(wi({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),m.removeEventListener("abort",x)})}return u(c,wi(wi({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=u,this.retry=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Ex(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 fm(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 o;const u=new URL(`${this.url}/rpc/${t}`);let c;const d=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(d)),h=n&&Object.values(r).some(d);h?(o="POST",c=r):n||s?(o=n?"HEAD":"GET",Object.entries(r).filter(([m,x])=>x!==void 0).map(([m,x])=>[m,Array.isArray(x)?`{${x.join(",")}}`:`${x}`]).forEach(([m,x])=>{u.searchParams.append(m,x)})):(o="POST",c=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 Xr({method:o,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Ax{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 Rx="2.110.2",Px=`realtime-js/${Rx}`,Ox="1.0.0",pm="2.0.0",zx=pm,Ix=1e4,$x=100,Xt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},mm={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ql={connecting:"connecting",closing:"closing",closed:"closed"};class Dx{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,o=(s=t.ref)!==null&&s!==void 0?s:"",u=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.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+u.length+o.length+a.length+c.length+h.length,m=new ArrayBuffer(this.HEADER_LENGTH+f);let x=new DataView(m),y=0;x.setUint8(y++,this.KINDS.userBroadcastPush),x.setUint8(y++,u.length),x.setUint8(y++,o.length),x.setUint8(y++,a.length),x.setUint8(y++,c.length),x.setUint8(y++,h.length),x.setUint8(y++,r),Array.from(u,g=>x.setUint8(y++,g.charCodeAt(0))),Array.from(o,g=>x.setUint8(y++,g.charCodeAt(0))),Array.from(a,g=>x.setUint8(y++,g.charCodeAt(0))),Array.from(c,g=>x.setUint8(y++,g.charCodeAt(0))),Array.from(h,g=>x.setUint8(y++,g.charCodeAt(0)));var b=new Uint8Array(m.byteLength+n.byteLength);return b.set(new Uint8Array(m),0),b.set(new Uint8Array(n),m.byteLength),b.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,o,u]=n;return r({join_ref:s,ref:i,topic:a,event:o,payload:u})}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),o=r.getUint8(4);let u=this.HEADER_LENGTH+4;const c=n.decode(t.slice(u,u+s));u=u+s;const d=n.decode(t.slice(u,u+i));u=u+i;const h=n.decode(t.slice(u,u+a));u=u+a;const f=t.slice(u,t.byteLength),m=o===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,x={type:this.BROADCAST_EVENT,event:d,payload:m};return a>0&&(x.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:x}}_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 Z;(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"})(Z||(Z={}));const Ud=(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]=Lx(a,e,t,s),i),{}):{}},Lx=(e,t,r,n)=>{const s=t.find(o=>o.name===e),i=s==null?void 0:s.type,a=r[e];return i&&!n.includes(i)?gm(i,a):Wl(a)},gm=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Mx(t,r)}switch(e){case Z.bool:return Ux(t);case Z.float4:case Z.float8:case Z.int2:case Z.int4:case Z.int8:case Z.numeric:case Z.oid:return Fx(t);case Z.json:case Z.jsonb:return Bx(t);case Z.timestamp:return qx(t);case Z.abstime:case Z.date:case Z.daterange:case Z.int4range:case Z.int8range:case Z.money:case Z.reltime:case Z.text:case Z.time:case Z.timestamptz:case Z.timetz:case Z.tsrange:case Z.tstzrange:return Wl(t);default:return Wl(t)}},Wl=e=>e,Ux=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Fx=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Bx=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Mx=(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(o=>gm(t,o))}return e},qx=e=>typeof e=="string"?e.replace(" ","T"):e,ym=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 fs=e=>typeof e=="function"?e:function(){return e},Wx=typeof self<"u"?self:null,Zr=typeof window<"u"?window:null,vt=Wx||Zr||globalThis,Hx="2.0.0",Vx=1e4,Kx=1e3,xt={connecting:0,open:1,closing:2,closed:3},Pe={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},At={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Hl={longpoll:"longpoll",websocket:"websocket"},Gx={complete:4},Vl="base64url.bearer.phx.",bi=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})}},vm=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))}},Jx=class{constructor(e,t,r){this.state=Pe.closed,this.topic=e,this.params=fs(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new bi(this,At.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new vm(()=>{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=Pe.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Pe.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=Pe.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=Pe.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 bi(this,At.leave,fs({}),this.timeout).send(),this.state=Pe.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(At.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=Pe.closed,this.bindings=[]}onClose(e){this.on(At.close,e)}onError(e){return this.on(At.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 bi(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=Pe.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(At.close,"leave")},r=new bi(this,At.leave,fs({}),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=Pe.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===Pe.closed}isErrored(){return this.state===Pe.errored}isJoined(){return this.state===Pe.joined}isJoining(){return this.state===Pe.joining}isLeaving(){return this.state===Pe.leaving}},Sa=class{static request(e,t,r,n,s,i,a){if(vt.XDomainRequest){let o=new vt.XDomainRequest;return this.xdomainRequest(o,e,t,n,s,i,a)}else if(vt.XMLHttpRequest){let o=new vt.XMLHttpRequest;return this.xhrRequest(o,e,t,r,n,s,i,a)}else{if(vt.fetch&&vt.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 o={method:e,headers:r,body:n},u=null;return s&&(u=new AbortController,setTimeout(()=>u.abort(),s),o.signal=u.signal),vt.fetch(t,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&i?i():a&&a(null)}),u}static xdomainRequest(e,t,r,n,s,i,a){return e.timeout=s,e.open(t,r),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,i,a,o){e.open(t,r,!0),e.timeout=i;for(let[u,c]of Object.entries(n))e.setRequestHeader(u,c);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Gx.complete&&o){let u=this.parseJSON(e.responseText);o(u)}},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)}`}},Yx=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)},Kr=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Vl)&&(this.authToken=atob(t[1].slice(Vl.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=xt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Hl.websocket),"$1/"+Hl.longpoll)}endpointURL(){return Sa.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=xt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===xt.open||this.readyState===xt.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=xt.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=Yx(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=xt.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=Sa.request(e,this.endpointURL(),t,r,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&s(o)}),this.reqs.add(i)}},Qx=class Zn{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:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Zn.syncState(this.state,s,i,a),this.pendingDiffs.forEach(u=>{this.state=Zn.syncDiff(this.state,u,i,a)}),this.pendingDiffs=[],o()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Zn.syncDiff(this.state,s,i,a),o())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Zn.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={},o={};return this.map(i,(u,c)=>{r[u]||(o[u]=c)}),this.map(r,(u,c)=>{let d=i[u];if(d){let h=c.metas.map(y=>y.phx_ref),f=d.metas.map(y=>y.phx_ref),m=c.metas.filter(y=>f.indexOf(y.phx_ref)<0),x=d.metas.filter(y=>h.indexOf(y.phx_ref)<0);m.length>0&&(a[u]=c,a[u].metas=m),x.length>0&&(o[u]=this.clone(d),o[u].metas=x)}else a[u]=c}),this.syncDiff(i,{joins:a,leaves:o},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,(o,u)=>{let c=t[o];if(t[o]=this.clone(u),c){let d=t[o].metas.map(f=>f.phx_ref),h=c.metas.filter(f=>d.indexOf(f.phx_ref)<0);t[o].metas.unshift(...h)}n(o,c,u)}),this.map(a,(o,u)=>{let c=t[o];if(!c)return;let d=u.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(o,c,u),c.metas.length===0&&delete t[o]}),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))}},ki={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,o=new ArrayBuffer(this.HEADER_LENGTH+a),u=new DataView(o),c=0;u.setUint8(c++,this.KINDS.push),u.setUint8(c++,t.length),u.setUint8(c++,r.length),u.setUint8(c++,s.length),u.setUint8(c++,n.length),Array.from(t,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>u.setUint8(c++,h.charCodeAt(0)));var d=new Uint8Array(o.byteLength+i.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(i),o.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,o=r.decode(e.slice(a,a+n));a=a+n;let u=r.decode(e.slice(a,a+s));a=a+s;let c=r.decode(e.slice(a,a+i));a=a+i;let d=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:u,event:c,payload:d}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,u=r.decode(e.slice(o,o+n));o=o+n;let c=r.decode(e.slice(o,o+s));o=o+s;let d=r.decode(e.slice(o,o+i));o=o+i;let h=r.decode(e.slice(o,o+a));o=o+a;let f=e.slice(o,e.byteLength),m={status:h,response:f};return{join_ref:u,ref:c,topic:d,event:At.reply,payload:m}},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 o=r.decode(e.slice(i,i+s));i=i+s;let u=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:u}}},Xx=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Vx,this.transport=t.transport||vt.WebSocket||Kr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=vt&&vt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=ki.encode.bind(ki),this.defaultDecoder=ki.decode.bind(ki),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!==Kr?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Zr&&Zr.addEventListener&&(Zr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Zr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Zr.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=fs(t.params||{}),this.endPoint=`${e}/${Hl.websocket}`,this.vsn=t.vsn||Hx,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new vm(()=>{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 Kr}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=Sa.appendParams(Sa.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=fs(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Kr?this.connectWithFallback(Kr,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 Kr:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Vl}${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),o=u=>{this.log("transport",`falling back to ${a}...`,u),this.off([s,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(u=>{this.log("transport","error",u),n&&!r&&(clearTimeout(this.fallbackTimer),o(u))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let u=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${u}`,"true"),this.log("transport",`established ${u} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(u=>{this.log("transport","connected to primary after",u),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(),Kx,"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===xt.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(At.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case xt.connecting:return"connecting";case xt.open:return"open";case xt.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 Jx(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 o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",o)}catch(u){this.log("error","error in heartbeat callback",u)}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 o=0;o<this.channels.length;o++){const u=this.channels[o];u.isMember(r,n,s,a)&&u.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 ps{constructor(t,r){const n=ew(r);this.presence=new Qx(t.getChannel(),n),this.presence.onJoin((s,i,a)=>{const o=ps.onJoinPayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((s,i,a)=>{const o=ps.onLeavePayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return ps.transformState(this.presence.state)}static transformState(t){return t=Zx(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=Vi(s),r},{})}static onJoinPayload(t,r,n){const s=Fd(r),i=Vi(n);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,r,n){const s=Fd(r),i=Vi(n);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function Vi(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function Zx(e){return JSON.parse(JSON.stringify(e))}function ew(e){return(e==null?void 0:e.events)&&{events:e.events}}function Fd(e){return e!=null&&e.metas?Vi(e):[]}var Bd;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Bd||(Bd={}));class tw{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new ps(this.channel.channelAdapter,r)}}function rw(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 nw{constructor(t,r,n){const s=sw(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>$x){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===Xt.joined}isJoined(){return this.state===Xt.joined}isJoining(){return this.state===Xt.joining}isClosed(){return this.state===Xt.closed}isLeaving(){return this.state===Xt.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function sw(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}const iw=/[,()"\\]/,aw=e=>iw.test(e)||e!==e.trim(),ow=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Md=e=>{const t=e===null?"null":String(e);return aw(t)?ow(t):t},lw=e=>e===null?"null":String(e),uw=(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=>Md(s)).join(",")})`}return e==="is"?`is.${lw(t)}`:`${e}.${Md(t)}`};class cw{constructor(){this.filters=[]}add(t,r,n,s=!1){const i=s?"not.":"";return this.filters.push(`${t}=${i}${uw(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 qd;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(qd||(qd={}));var mn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(mn||(mn={}));var Rt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Rt||(Rt={}));class ms{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 nw(this.socket.socketAdapter,t,this.params),this.presence=new tw(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=ym(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:o,private:u}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(m=>m.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[mn.PRESENCE]&&this.bindings[mn.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({},o),{enabled:d}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>{t==null||t(Rt.CHANNEL_ERROR,rw(m))}),this._onClose(()=>t==null?void 0:t(Rt.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:m})=>{if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){t==null||t(Rt.SUBSCRIBED);return}this._updatePostgresBindings(m,t)}).receive("error",m=>{this.state=Xt.errored;const x=Object.values(m).join(", ")||"error";t==null||t(Rt.CHANNEL_ERROR,new Error(x,{cause:m}))}).receive("timeout",()=>{t==null||t(Rt.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 o=0;o<i;o++){const u=s[o],{filter:{event:c,schema:d,table:h,filter:f}}=u,m=t&&t[o];if(m&&m.event===c&&ms.isFilterValueEqual(m.schema,d)&&ms.isFilterValueEqual(m.table,h)&&ms.isFilterValueEqual(m.filter,f))a.push(Object.assign(Object.assign({},u),{id:m.id}));else{this.unsubscribe(),this.state=Xt.errored,r==null||r(Rt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=Xt.errored&&r&&r(Rt.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===mn.PRESENCE||t===mn.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 o=new URL(this.broadcastEndpointURL);o.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(t)}`,this.private&&o.searchParams.set("private","true");const u={method:"POST",headers:a,body:i?r:JSON.stringify(r)},c=await this._fetchWithTimeout(o.toString(),u,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(c.status===202)return{success:!0};if(c.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=c.statusText;try{const h=await c.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,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,u;const c=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||u===void 0)&&u.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.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 cw||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),o={type:s,filter:r,callback:n,ref:a};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],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,o,u,c,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(m=>m.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const m=f.id,x=(i=f.filter)===null||i===void 0?void 0:i.event;return m&&((a=r.ids)===null||a===void 0?void 0:a.includes(m))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((o=r.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const m=(c=(u=f==null?void 0:f.filter)===null||u===void 0?void 0:u.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return m==="*"||m===((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}=mm;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:o,type:u,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:u,new:{},old:{},errors:c}),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=Ud(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=Ud(t.columns,t.old_record)),r}}class dw{constructor(t,r){this.socket=new Xx(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()==ql.connecting}isDisconnecting(){return this.socket.connectionState()==ql.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Wd={HEARTBEAT_INTERVAL:25e3},hw=[1e3,2e3,5e3,1e4],fw=1e4;function pw(){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 mw(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return pw()}const gw=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class yw{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 Dx,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 dw(t,s),this.httpEndpoint=ym(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()||ql.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 ms(`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:Px};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(mm.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([gw],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,i,a,o,u,c,d,h,f,m;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 x={};x.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Ix,x.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:Wd.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:Wd.HEARTBEAT_INTERVAL),x.transport=(u=t==null?void 0:t.transport)!==null&&u!==void 0?u:Ax.getWebSocketConstructor(),x.params=t==null?void 0:t.params,x.logger=t==null?void 0:t.logger,x.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),x.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:mw(),x.reconnectAfterMs=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:p=>hw[p-1]||fw;let y,b;const g=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:zx;switch(g){case Ox:y=(p,v)=>v(JSON.stringify(p)),b=(p,v)=>v(JSON.parse(p));break;case pm:y=this.serializer.encode.bind(this.serializer),b=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${x.vsn}`)}if(x.vsn=g,x.encode=(f=t==null?void 0:t.encode)!==null&&f!==void 0?f:y,x.decode=(m=t==null?void 0:t.decode)!==null&&m!==void 0?m:b,x.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,x.params=Object.assign(Object.assign({},x.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,x.autoSendHeartbeat=!this.worker}return x}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Ds=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 vw(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 xw(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 ww(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:a}){const o=vw(e.baseUrl,n,s),u=await xw(e.auth),c=await t(o,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),d=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!c.ok){const m=h?f:void 0,x=m==null?void 0:m.error;throw new Ds((x==null?void 0:x.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:x==null?void 0:x.type,icebergCode:x==null?void 0:x.code,details:m})}return{status:c.status,headers:c.headers,data:f}}}}function _i(e){return e.join("")}var bw=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:_i(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/${_i(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_i(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_i(e.namespace)}`}),!0}catch(t){if(t instanceof Ds&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Ds&&r.status===409)return;throw r}}};function Gr(e){return e.join("")}var kw=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/${Gr(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/${Gr(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/${Gr(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/${Gr(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/${Gr(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/${Gr(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Ds&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Ds&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},_w=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=ww({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new bw(this.client,t),this.tableOps=new kw(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 Ls(e){"@babel/helpers - typeof";return Ls=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},Ls(e)}function Sw(e,t){if(Ls(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ls(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ew(e){var t=Sw(e,"string");return Ls(t)=="symbol"?t:t+""}function Cw(e,t,r){return(t=Ew(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hd(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 F(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hd(Object(r),!0).forEach(function(n){Cw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ro=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 no(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Kl=class extends ro{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 F({},super.toJSON())}},xm=class extends ro{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Ea(e,t,r){const n=F({},e),s=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function jw(e){const t={};for(const[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}const Nw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Tw=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)},Gl=e=>{if(Array.isArray(e))return e.map(r=>Gl(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]=Gl(n)}),t},Aw=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),Vd=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)},Rw=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 o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new Kl(Vd(a),i,o,n))}).catch(()=>{const a=i+"";t(new Kl(s.statusText||`HTTP ${i} error`,i,a,n))})}else t(new xm(Vd(e),e,n))},Pw=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return F(F({},s),r);if(Tw(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[u,c]of Object.entries(a))u.toLowerCase()==="content-type"&&(o=c);s.headers=Ea(a,"Content-Type",(i=o)!==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),F(F({},s),r)};async function Vn(e,t,r,n,s,i,a){return new Promise((o,u)=>{e(r,Pw(t,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="vectors"){const d=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!d||!d.includes("application/json"))return{}}return c.json()}).then(c=>o(c)).catch(c=>Rw(c,u,n,a))})}function wm(e="storage"){return{get:async(t,r,n,s)=>Vn(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>Vn(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>Vn(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>Vn(t,"HEAD",r,F(F({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>Vn(t,"DELETE",r,s,i,n,e)}}const Ow=wm("storage"),{get:Us,post:at,put:Jl,head:zw,remove:Fs}=Ow,Me=wm("vectors");var In=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=jw(t),this.fetch=Nw(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ea(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(no(r))return{data:null,error:r};throw r}}};let bm;bm=Symbol.toStringTag;var Iw=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[bm]="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(no(t))return{data:null,error:t};throw t}}};let km;km=Symbol.toStringTag;var $w=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[km]="BlobDownloadBuilder",this.promise=null}asStream(){return new Iw(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(no(t))return{data:null,error:t};throw t}}};const $o={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kd={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Dw=class extends In{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=F(F({},Kd),n);let o=F(F({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",s.encodeMetadata(u)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(u))):(i=r,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,u&&(o["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(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,m]of Object.entries(n.headers))o=Ea(o,f,m);const c=s._removeEmptyFolders(t),d=s._getFinalPath(c),h=await(e=="PUT"?Jl:at)(s.fetch,`${s.url}/object/${d}`,i,F({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,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),o=new URL(s.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),s.handleOperation(async()=>{let u;const c=F(F({},Kd),n);let d=F(F({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),h&&u.append("metadata",s.encodeMetadata(h)),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.has("cacheControl")||u.append("cacheControl",c.cacheControl),h&&!u.has("metadata")&&u.append("metadata",s.encodeMetadata(h))):(u=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[f,m]of Object.entries(n.headers))d=Ea(d,f,m);return{path:i,fullPath:(await Jl(s.fetch,o.toString(),u,F({headers:d},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=F({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await at(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+i.url),o=a.searchParams.get("token");if(!o)throw new ro("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}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 at(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 at(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 at(n.fetch,`${n.url}/object/sign/${s}`,F({expiresIn:t},i?{transform:r.transform}:{}),{headers:n.headers});const o=new URLSearchParams;r!=null&&r.download&&o.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&o.set("cacheNonce",String(r.cacheNonce));const u=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${u?`&${u}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await at(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(o=>F(F({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.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),o=()=>Us(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new $w(o,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Gl(await Us(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await zw(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(no(s)){var n;const i=s instanceof Kl?s.status:s instanceof xm?(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 Fs(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 Fs(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?F(F({},$o.sortBy),t.sortBy):$o.sortBy,i=F(F(F({},$o),t),{},{sortBy:s,prefix:e||""});return await at(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=F({},e);return await at(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 Lw="2.110.2",Zs={"X-Client-Info":`storage-js/${Lw}`};var Uw=class extends In{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=F(F({},Zs),t);super(i,a,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Us(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Us(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await at(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 Jl(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 at(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Fs(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 Fs(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():""}},Fw=class extends In{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},Zs),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await at(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 Us(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Fs(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Aw(e))throw new ro("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 _w({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(...o)=>{try{return{data:await a.apply(s,o),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},Bw=class extends In{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},Zs),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Me.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Me.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},Mw=class extends In{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},Zs),{},{"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 Me.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Me.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 Me.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Me.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 Me.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},qw=class extends In{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},Zs),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Me.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Ww=class extends qw{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Hw(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)}},Hw=class extends Bw{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,F(F({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,F(F({},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 Vw(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Vw=class extends Mw{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,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Kw=class extends Uw{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new Dw(this.url,this.headers,e,this.fetch)}get vectors(){return new Ww(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Fw(this.url+"/iceberg",this.headers,this.fetch)}};const _m="2.110.2",Pt=30*1e3,es=3,Do=es*Pt,Gw=2*Pt,Jw="http://localhost:9999",Yw="supabase.auth.token",Qw={"X-Client-Info":`gotrue-js/${_m}`},Yl="X-Supabase-Api-Version",Sm={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Xw=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Zw=10*60*1e3;class Bs 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 I(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class eb extends Bs{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function tb(e){return I(e)&&e.name==="AuthApiError"}class ut extends Bs{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class jt extends Bs{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class ye extends jt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Si(e){return I(e)&&e.name==="AuthSessionMissingError"}class Jr extends jt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ei extends jt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Ci extends jt{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 rb(e){return I(e)&&e.name==="AuthImplicitGrantRedirectError"}class Gd extends jt{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 nb extends jt{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 Ql extends jt{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Jd(e){return I(e)&&e.name==="AuthRetryableFetchError"}class Yd extends jt{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,"AuthRefreshDiscardedError",409,void 0)}}function sb(e){return I(e)&&e.name==="AuthRefreshDiscardedError"}class Qd extends jt{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 Ca extends jt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const ja="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Xd=`
\r=`.split(""),ib=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Xd.length;t+=1)e[Xd[t].charCodeAt(0)]=-2;for(let t=0;t<ja.length;t+=1)e[ja[t].charCodeAt(0)]=t;return e})();function Zd(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(ja[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(ja[n]),t.queuedBits-=6}}function Em(e,t,r){const n=ib[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 eh(e){const t=[],r=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{lb(a,n,r)};for(let a=0;a<e.length;a+=1)Em(e.charCodeAt(a),s,i);return t.join("")}function ab(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 ob(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}ab(n,t)}}function lb(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 kn(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Em(e.charCodeAt(s),r,n);return new Uint8Array(t)}function ub(e){const t=[];return ob(e,r=>t.push(r)),new Uint8Array(t)}function Ar(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>Zd(s,r,n)),Zd(null,r,n),t.join("")}function cb(e){return Math.round(Date.now()/1e3)+e}function db(){return Symbol("auth-callback")}const Ee=()=>typeof window<"u"&&typeof document<"u",br={tested:!1,writable:!1},Cm=()=>{if(!Ee())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(br.tested)return br.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),br.tested=!0,br.writable=!0}catch{br.tested=!0,br.writable=!1}return br.writable};function hb(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 jm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),fb=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",en=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},nt=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ce=async(e,t)=>{await e.removeItem(t)};class so{constructor(){this.promise=new so.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}so.promiseConstructor=Promise;function ji(e){const t=e.split(".");if(t.length!==3)throw new Ca("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!Xw.test(t[n]))throw new Ca("JWT not in base64url format");return{header:JSON.parse(eh(t[0])),payload:JSON.parse(eh(t[1])),signature:kn(t[2]),raw:{header:t[0],payload:t[1]}}}async function pb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function mb(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 gb(e){return("0"+e.toString(16)).substr(-2)}function yb(){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,gb).join("")}async function vb(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 xb(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 vb(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function kr(e,t,r=!1){const n=yb();let s=n;r&&(s+="/recovery"),await en(e,`${t}-code-verifier`,s);const i=await xb(n);return[i,n===i?"plain":"s256"]}const wb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function bb(e){const t=e.headers.get(Yl);if(!t||!t.match(wb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function kb(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 _b(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 Sb=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Nt(e){if(!Sb.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function st(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 Lo(){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 Eb(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 Cr=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)},Cb=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function rh(e){var t;if(!fb(e))throw new Ql(Cr(e),0);if(Cb.includes(e.status))throw new Ql(Cr(e),e.status);let r;try{r=await e.json()}catch(i){throw new ut(Cr(i),i)}let n;const s=bb(e);if(s&&s.getTime()>=Sm["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 Qd(Cr(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new ye}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 Qd(Cr(r),e.status,r.weak_password.reasons);throw new eb(Cr(r),e.status||500,n)}const jb=(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 D(e,t,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[Yl]||(i[Yl]=Sm["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 o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await Nb(e,t,r+o,{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(u):{data:Object.assign({},u),error:null}}async function Nb(e,t,r,n,s,i){const a=jb(t,n,s,i);let o;try{o=await e(r,Object.assign({},a))}catch(u){throw console.error(u),new Ql(Cr(u),0)}if(o.ok||await rh(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(u){await rh(u)}}function Ge(e){var t;let r=null;Rb(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=cb(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 nh(e){const t=Ge(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 Zt(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Tb(e){return{data:e,error:null}}function Ab(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e,a=to(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},u=Object.assign({},a);return{data:{properties:o,user:u},error:null}}function sh(e){return e}function Rb(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Uo=["global","local","others"];class Pb{constructor({url:t="",headers:r={},fetch:n,experimental:s}){this.url=t,this.headers=r,this.fetch=jm(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=Uo[0]){if(Uo.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Uo.join(", ")}`);try{return await D(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(I(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await D(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Zt})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=to(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 D(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Ab,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(I(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await D(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Zt})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,i,a,o,u;try{const c={nextPage:null,lastPage:0,total:0},d=await D(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:sh});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,m=(u=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return m.length>0&&(m.forEach(x=>{const y=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);c[`${b}Page`]=y}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Nt(t);try{return await D(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Zt})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Nt(t);try{return await D(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Zt})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){Nt(t);try{return await D(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Zt})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Nt(t.userId);try{const{data:r,error:n}=await D(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(I(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Nt(t.userId),Nt(t.id);try{return{data:await D(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,i,a,o,u;try{const c={nextPage:null,lastPage:0,total:0},d=await D(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:sh});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,m=(u=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return m.length>0&&(m.forEach(x=>{const y=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);c[`${b}Page`]=y}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await D(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await D(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await D(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await D(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await D(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await D(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(I(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await D(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await D(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await D(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await D(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){st(this.experimental),Nt(t.userId);try{return await D(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){st(this.experimental),Nt(t.userId),Nt(t.passkeyId);try{return await D(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}}function ih(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}globalThis&&Cm()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class Ob extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}function zb(){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 Nm(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Ib(e){return parseInt(e,16)}function $b(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function Db(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:u,resources:c,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 m=Nm(e.address),x=d?`${d}://${n}`:n,y=e.statement?`${e.statement}
`:"",b=`${x} wants you to sign in with your Ethereum account:
${m}
${y}`;let g=`URI: ${h}
Version: ${f}
Chain ID: ${r}${a?`
Nonce: ${a}`:""}
Issued At: ${i.toISOString()}`;if(s&&(g+=`
Expiration Time: ${s.toISOString()}`),o&&(g+=`
Not Before: ${o.toISOString()}`),u&&(g+=`
Request ID: ${u}`),c){let p=`
Resources:`;for(const v of c){if(!v||typeof v!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${v}`);p+=`
- ${v}`}g+=p}return`${b}
${g}`}class he 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 Na extends he{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Lb({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 he({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 he({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 he({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 he({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 he({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new he({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new he({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new he({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(Tm(a)){if(i.rp.id!==a)return new he({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new he({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 he({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 he({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 he({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Ub({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 he({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new he({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Tm(n)){if(r.rpId!==n)return new he({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new he({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new he({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 he({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Fb{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 Xl=new Fb;function ah(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=to(e,["challenge","user","excludeCredentials"]),i=kn(t).buffer,a=Object.assign(Object.assign({},r),{id:kn(r.id).buffer}),o=Object.assign(Object.assign({},s),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const c=n[u];o.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:kn(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function oh(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=to(e,["challenge","allowCredentials"]),s=kn(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 o=r[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:kn(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function lh(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:Ar(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ar(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function uh(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:Ar(new Uint8Array(s.authenticatorData)),clientDataJSON:Ar(new Uint8Array(s.clientDataJSON)),signature:Ar(new Uint8Array(s.signature)),userHandle:s.userHandle?Ar(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Tm(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ta(){var e,t;return!!(Ee()&&"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 Am(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Na("Browser returned unexpected credential type",t)}:{data:null,error:new Na("Empty credential response",t)}}catch(t){return{data:null,error:Lb({error:t,options:e})}}}async function Rm(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Na("Browser returned unexpected credential type",t)}:{data:null,error:new Na("Empty credential response",t)}}catch(t){return{data:null,error:Ub({error:t,options:e})}}}const Bb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Mb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Aa(...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 o=n[i];t(o)?n[i]=Aa(o,a):n[i]=Aa(a)}else n[i]=a}return n}function qb(e,t){return Aa(Bb,e,t||{})}function Wb(e,t){return Aa(Mb,e,t||{})}class Hb{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:o,error:u}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!o)return{data:null,error:u};const c=s??Xl.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:d}=o.webauthn.credential_options.publicKey;if(!d.name){const h=n;if(h)d.name=`${d.id}:${h}`;else{const m=(await this.client.getUser()).data.user,x=((a=m==null?void 0:m.user_metadata)===null||a===void 0?void 0:a.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";d.name=`${d.id}:${x}`}}d.displayName||(d.displayName=d.name)}switch(o.webauthn.type){case"create":{const d=qb(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:f}=await Am({publicKey:d,signal:c});return h?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const d=Wb(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:f}=await Rm(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:d,signal:c}));return h?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new ut("Unexpected error in challenge",o)}}}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 Bs("rpId is required for WebAuthn authentication")};try{if(!Ta())return{data:null,error:new ut("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!a)return{data:null,error:o};const{webauthn:u}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new ut("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 Bs("rpId is required for WebAuthn registration")};try{if(!Ta())return{data:null,error:new ut("Browser does not support WebAuthn",null)};const{data:a,error:o}=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:o};const{data:u,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return u?this._verify({factorId:a.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new ut("Unexpected error in register",a)}}}}zb();const Vb={url:Jw,storageKey:Yw,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Qw,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Yr={};class Ms{get jwks(){var t,r;return(r=(t=Yr[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Yr[this.storageKey]=Object.assign(Object.assign({},Yr[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Yr[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Yr[this.storageKey]=Object.assign(Object.assign({},Yr[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({},Vb),t);if(this.storageKey=i.storageKey,this.instanceID=(r=Ms.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ms.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Ee()){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 Pb({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=jm(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 Hb(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:Cm()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ih(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=ih(this.memoryStorage)),Ee()&&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(o){this._debug("#broadcastChannel","error",o)}})}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} (${_m}) ${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(Ee()&&(r=hb(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ee()&&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),rb(i)){const u=(t=i.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType:o}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="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 I(r)?this._returnResult({error:r}):this._returnResult({error:new ut("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const i=await D(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:Ge}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const u=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if(I(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 m=null,x=null;this.flowType==="pkce"&&([m,x]=await kr(this.storage,this.storageKey)),i=await D(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:m,code_challenge_method:x},xform:Ge})}else if("phone"in t){const{phone:d,password:h,options:f}=t;i=await D(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:Ge})}else throw new Ei("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await ce(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const u=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(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:o}=t;r=await D(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:nh})}else if("phone"in t){const{phone:i,password:a,options:o}=t;r=await D(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:nh})}else throw new Ei("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 Jr;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(I(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,o,u,c,d,h,f;let m,x;if("message"in t)m=t.message,x=t.signature;else{const{chain:y,wallet:b,statement:g,options:p}=t;let v;if(Ee())if(typeof b=="object")v=b;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")v=T.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 b!="object"||!(p!=null&&p.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");v=b}const k=new URL((r=p==null?void 0:p.url)!==null&&r!==void 0?r:window.location.href),_=await v.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!_||_.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=Nm(_[0]);let C=(n=p==null?void 0:p.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!C){const T=await v.request({method:"eth_chainId"});C=Ib(T)}const P={domain:k.host,address:E,statement:g,uri:k.href,version:"1",chainId:C,nonce:(s=p==null?void 0:p.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=p==null?void 0:p.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=p==null?void 0:p.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(u=p==null?void 0:p.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=p==null?void 0:p.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(d=p==null?void 0:p.signInWithEthereum)===null||d===void 0?void 0:d.resources};m=Db(P),x=await v.request({method:"personal_sign",params:[$b(m),E]})}try{const{data:y,error:b}=await D(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:x},!((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:Ge});if(b)throw b;if(!y||!y.session||!y.user){const g=new Jr;return this._returnResult({data:{user:null,session:null},error:g})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:b})}catch(y){if(I(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(t){var r,n,s,i,a,o,u,c,d,h,f,m;let x,y;if("message"in t)x=t.message,y=t.signature;else{const{chain:b,wallet:g,statement:p,options:v}=t;let k;if(Ee())if(typeof g=="object")k=g;else{const E=window;if("solana"in E&&typeof E.solana=="object"&&("signIn"in E.solana&&typeof E.solana.signIn=="function"||"signMessage"in E.solana&&typeof E.solana.signMessage=="function"))k=E.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 g!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=g}const _=new URL((r=v==null?void 0:v.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in k&&k.signIn){const E=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},v==null?void 0:v.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),p?{statement:p}:null));let C;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")C=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)C=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)x=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),y=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");x=[`${_.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...p?["",p,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(s=(n=v==null?void 0:v.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=v==null?void 0:v.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${v.signInWithSolana.notBefore}`]:[],...!((a=v==null?void 0:v.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${v.signInWithSolana.expirationTime}`]:[],...!((o=v==null?void 0:v.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${v.signInWithSolana.chainId}`]:[],...!((u=v==null?void 0:v.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${v.signInWithSolana.nonce}`]:[],...!((c=v==null?void 0:v.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${v.signInWithSolana.requestId}`]:[],...!((h=(d=v==null?void 0:v.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...v.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
`);const E=await k.signMessage(new TextEncoder().encode(x),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=E}}try{const{data:b,error:g}=await D(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:x,signature:Ar(y)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Ge});if(g)throw g;if(!b||!b.session||!b.user){const p=new Jr;return this._returnResult({data:{user:null,session:null},error:p})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:g})}catch(b){if(I(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(t){const r=await nt(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new nb;const{data:i,error:a}=await D(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:Ge});if(await ce(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Jr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}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 ce(this.storage,`${this.storageKey}-code-verifier`),I(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,o=await D(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:Ge}),{data:u,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){const d=new Jr;return this._returnResult({data:{user:null,session:null},error:d})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if(I(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:o,options:u}=t;let c=null,d=null;this.flowType==="pkce"&&([c,d]=await kr(this.storage,this.storageKey));const{error:h}=await D(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u==null?void 0:u.data)!==null&&r!==void 0?r:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:c,code_challenge_method:d},redirectTo:u==null?void 0:u.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:o,options:u}=t,{data:c,error:d}=await D(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(s=u==null?void 0:u.data)!==null&&s!==void 0?s:{},create_user:(i=u==null?void 0:u.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(a=u==null?void 0:u.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:d})}throw new Ei("You must provide either an email or phone number.")}catch(o){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}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:o}=await D(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ge});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const u=a.session,c=a.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,i,a;try{let o=null,u=null;this.flowType==="pkce"&&([o,u]=await kr(this.storage,this.storageKey));const c=await D(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:o,code_challenge_method:u}),headers:this.headers,xform:Tb});return!((i=c.data)===null||i===void 0)&&i.url&&Ee()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(o))return this._returnResult({data:null,error:o});throw o}}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 ye;const{error:s}=await D(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(I(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,o=null;this.flowType==="pkce"&&([a,o]=await kr(this.storage,this.storageKey));const{error:u}=await D(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:o},redirectTo:i==null?void 0:i.emailRedirectTo});return u&&await ce(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in t){const{phone:n,type:s,options:i}=t,{data:a,error:o}=await D(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:o})}throw new Ei("You must provide either an email or phone number and a type")}catch(r){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(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 nt(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()<Do:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await nt(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Lo()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=Eb(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 o=await nt(this.storage,this.storageKey);if(o&&o.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 D(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Zt}):await this._useSession(async r=>{var n,s,i;const{data:a,error:o}=r;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ye}:await D(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:Zt})})}catch(r){if(I(r))return Si(r)&&(await this._removeSession(),await ce(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 ye;const a=s.session;let o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await kr(this.storage,this.storageKey));const{data:c,error:d}=await D(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:u}),jwt:a.access_token,xform:Zt});if(d)throw d;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(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 ye;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:a}=ji(t.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:u}=await this._getUser(t.access_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});i={access_token:t.access_token,refresh_token:t.refresh_token,user:o.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(I(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:o}=r;if(o)throw o;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new ye;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(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var n;try{if(!Ee())throw new Ci("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Ci(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 Gd("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ci("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 Gd("No code detected.");const{data:v,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:v.session,redirectType:(n=v.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:u,expires_at:c,token_type:d}=t;if(!a||!u||!o||!d)throw new Ci("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(u);let m=h+f;c&&(m=parseInt(c));const x=m-h;x*1e3<=Pt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${x}s, should have been closer to ${f}s`);const y=m-f;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,m,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,m,h);const{data:b,error:g}=await this._getUser(a);if(g)throw g;const p={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:m,refresh_token:o,token_type:d,user:b.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:p,redirectType:t.type},error:null})}catch(s){if(I(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 nt(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 ce(this.storage,`${this.storageKey}-code-verifier`)},{data:i,error:a}=r;if(a&&!Si(a))return this._returnResult({error:a});const o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:u}=await this.admin.signOut(o,t);if(u&&!(tb(u)&&(u.status===404||u.status===401||u.status===403)||Si(u)))return t!=="others"&&await s(),this._returnResult({error:u})}return t!=="others"&&await s(),this._returnResult({error:null})})}onAuthStateChange(t){const r=db(),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),Si(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await kr(this.storage,this.storageKey,!0));try{return await D(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 ce(this.storage,`${this.storageKey}-code-verifier`),I(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(I(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,o,u,c,d;const{data:h,error:f}=i;if(f)throw f;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await D(this.fetch,"GET",m,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Ee()&&!(!((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(I(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:o,token:u,access_token:c,nonce:d}=t,h=await D(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:o,id_token:u,access_token:c,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Ge}),{data:f,error:m}=h;return m?this._returnResult({data:{user:null,session:null},error:m}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Jr}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:m}))}catch(s){if(await ce(this.storage,`${this.storageKey}-code-verifier`),I(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 D(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(I(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 mb(async s=>(s>0&&await pb(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await D(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Ge})),(s,i)=>{const a=200*Math.pow(2,s);return i&&Jd(i)&&Date.now()+a-n<Pt})}catch(n){if(this._debug(r,"error",n),I(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),Ee()&&!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 nt(this.storage,this.storageKey);if(s&&this.userStorage){let a=await nt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await en(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Lo()}else if(s&&!s.user&&!s.user){const a=await nt(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await ce(this.storage,this.storageKey+"-user"),await en(this.storage,this.storageKey,s)):s.user=Lo()}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()<Do;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Do}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(sb(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:o}=await this._getUser(s.access_token);!o&&(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 ye;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 so;const i=await nt(this.storage,this.storageKey),{data:a,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!a.session)throw new ye;const u=await nt(this.storage,this.storageKey);if(i!==null&&(u===null||u.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:u?"replaced":"cleared"});const f={data:null,error:new Yd};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 ce(this.storage,this.storageKey),this.userStorage&&await ce(this.userStorage,this.storageKey+"-user");const f={data:null,error:new Yd};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),I(i)){const a={data:null,error:i};if(!Jd(i)){const o=await nt(this.storage,this.storageKey);!!(o!=null&&o.expires_at&&o.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()+Gw},(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 o=>{try{await o.callback(t,r)}catch(u){i.push(u)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await ce(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 en(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=th(s);await en(this.storage,this.storageKey,i)}else{const s=th(r);await en(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ce(this.storage,this.storageKey),await ce(this.storage,this.storageKey+"-code-verifier"),await ce(this.storage,this.storageKey+"-user"),this.userStorage&&await ce(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ee()&&(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(),Pt);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)/Pt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Pt}ms, refresh threshold is ${es} ticks`),s<=es&&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 Ob)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)/Pt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Pt}ms, refresh threshold is ${es} ticks`),s<=es&&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()"),!Ee()||!(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 kr(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(o.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 D(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(I(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 o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:u,error:c}=await D(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&u.type==="totp"&&(!((s=u==null?void 0:u.totp)===null||s===void 0)&&s.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if(I(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 o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?lh(t.webauthn.credential_response):uh(t.webauthn.credential_response)})}:{code:t.code}),{data:u,error:c}=await D(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+u.expires_in},u)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",u),this._returnResult({data:u,error:c}))})}catch(n){if(I(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 o=await D(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(o.error)return o;const{data:u}=o;if(u.type!=="webauthn")return{data:u,error:null};switch(u.webauthn.type){case"create":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:ah(u.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:oh(u.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(I(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:m}=ji(t);let x=null;m.aal&&(x=m.aal);let y=x;const{data:{user:b},error:g}=await this.getUser(t);if(g)return this._returnResult({data:null,error:g});((n=(r=b==null?void 0:b.factors)===null||r===void 0?void 0:r.filter(k=>k.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const v=m.amr||[];return{data:{currentLevel:x,nextLevel:y,currentAuthenticationMethods:v},error:null}}catch(m){if(I(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:a},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=ji(a.access_token);let c=null;u.aal&&(c=u.aal);let d=c;((i=(s=a.user.factors)===null||s===void 0?void 0:s.filter(m=>m.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const f=u.amr||[];return{data:{currentLevel:c,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 D(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 ye})})}catch(r){if(I(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 ye});const a=await D(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Ee()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(I(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 ye});const a=await D(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Ee()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(I(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 D(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 ye})})}catch(t){if(I(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 D(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 ye})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(o=>o.kid===t);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(o=>o.kid===t),n&&this.jwks_cached_at+Zw>s)return n;const{data:i,error:a}=await D(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(o=>o.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:m,error:x}=await this.getSession();if(x||!m.session)return this._returnResult({data:null,error:x});n=m.session.access_token}const{header:s,payload:i,signature:a,raw:{header:o,payload:u}}=ji(n);if(!(r!=null&&r.allowExpired))try{kb(i.exp)}catch(m){throw new Ca(m instanceof Error?m.message:"JWT validation failed")}const c=!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(!c){const{error:m}=await this.getUser(n);if(m)throw m;return{data:{claims:i,header:s,signature:a},error:null}}const d=_b(s.alg),h=await crypto.subtle.importKey("jwk",c,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,ub(`${o}.${u}`)))throw new Ca("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var r,n,s;st(this.experimental);try{if(!Ta())return this._returnResult({data:null,error:new ut("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 o=oh(i.options),u=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:Xl.createNewAbortSignal(),{data:c,error:d}=await Rm({publicKey:o,signal:u});if(d||!c)return this._returnResult({data:null,error:d??new ut("WebAuthn ceremony failed",null)});const h=uh(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var r,n;st(this.experimental);try{if(!Ta())return this._returnResult({data:null,error:new ut("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=ah(s.options),o=(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Xl.createNewAbortSignal(),{data:u,error:c}=await Am({publicKey:a,signal:o});if(c||!u)return this._returnResult({data:null,error:c??new ut("WebAuthn ceremony failed",null)});const d=lh(u);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){st(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 ye});const{data:s,error:i}=await D(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(I(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){st(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 ye});const{data:i,error:a}=await D(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;st(this.experimental);try{const{data:n,error:s}=await D(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(I(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){st(this.experimental);try{const{data:r,error:n}=await D(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:Ge});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(I(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){st(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 ye});const{data:s,error:i}=await D(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(I(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){st(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 ye});const{data:i,error:a}=await D(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){st(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 ye});const{error:i}=await D(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(I(r))return this._returnResult({data:null,error:r});throw r}}}Ms.nextInstanceID={};const Kb=Ms,Gb="2.110.2";let ts="",Ra;if(typeof Deno<"u"){var Fo;ts="deno",Ra=(Fo=Deno.version)===null||Fo===void 0?void 0:Fo.deno}else if(typeof document<"u")ts="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")ts="react-native";else{var Bo;ts="node",Ra=typeof process<"u"?(Bo=process.version)===null||Bo===void 0?void 0:Bo.replace(/^v/,""):void 0}const Pm=[`runtime=${ts}`];Ra&&Pm.push(`runtime-version=${Ra}`);const Jb={"X-Client-Info":`supabase-js/${Gb}; ${Pm.join("; ")}`},Yb={headers:Jb},Qb={schema:"public"},Xb={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Zb={},e1={enabled:!1,respectSamplingDecision:!0};function t1(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 o(d){try{c(n.next(d))}catch(h){a(h)}}function u(d){try{c(n.throw(d))}catch(h){a(h)}}function c(d){d.done?i(d.value):s(d.value).then(o,u)}c((n=n.apply(e,[])).next())})}let Mo=null;const r1="@opentelemetry/api";function n1(){return Mo===null&&(Mo=import(r1).catch(()=>null)),Mo}function s1(){return t1(this,void 0,void 0,function*(){try{const e=yield n1();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 i1(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 a1(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(o1(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 o1(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 l1(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 qs(e){"@babel/helpers - typeof";return qs=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},qs(e)}function u1(e,t){if(qs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function c1(e){var t=u1(e,"string");return qs(t)=="symbol"?t:t+""}function d1(e,t,r){return(t=c1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ch(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 le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ch(Object(r),!0).forEach(function(n){d1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ch(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const h1=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),f1=()=>Headers,p1=(e,t,r,n,s)=>{const i=h1(n),a=f1(),o=(s==null?void 0:s.enabled)===!0,u=(s==null?void 0:s.respectSamplingDecision)!==!1,c=o?l1(t):null;return async(d,h)=>{var f;const m=(f=await r())!==null&&f!==void 0?f:e;let x=new a(h==null?void 0:h.headers);if(x.has("apikey")||x.set("apikey",e),x.has("Authorization")||x.set("Authorization",`Bearer ${m}`),c){const y=await m1(d,c,u);y&&(y.traceparent&&!x.has("traceparent")&&x.set("traceparent",y.traceparent),y.tracestate&&!x.has("tracestate")&&x.set("tracestate",y.tracestate),y.baggage&&!x.has("baggage")&&x.set("baggage",y.baggage))}return i(d,le(le({},h),{},{headers:x}))}};async function m1(e,t,r){if(!a1(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const n=await s1();if(!n||!n.traceparent)return null;if(r){const s=i1(n.traceparent);if(s&&!s.isSampled)return null}return n}function dh(e){return typeof e=="boolean"?{enabled:e}:e}function g1(e){return e.endsWith("/")?e:e+"/"}function y1(e,t){var r,n,s,i,a,o;const{db:u,auth:c,realtime:d,global:h}=e,{db:f,auth:m,realtime:x,global:y}=t,b=dh(e.tracePropagation),g=dh(t.tracePropagation),p={db:le(le({},f),u),auth:le(le({},m),c),realtime:le(le({},x),d),storage:{},global:le(le(le({},y),h),{},{headers:le(le({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=b==null?void 0:b.enabled)!==null&&i!==void 0?i:g==null?void 0:g.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(a=(o=b==null?void 0:b.respectSamplingDecision)!==null&&o!==void 0?o:g==null?void 0:g.respectSamplingDecision)!==null&&a!==void 0?a:!0},accessToken:async()=>""};return e.accessToken?p.accessToken=e.accessToken:delete p.accessToken,p}function v1(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(g1(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var x1=class extends Kb{constructor(e){super(e)}},w1=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const i=v1(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`,o={db:Qb,realtime:Zb,auth:le(le({},Xb),{},{storageKey:a}),global:Yb,tracePropagation:e1},u=y1(r??{},o);if(this.settings=u,this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=u.global.headers)!==null&&s!==void 0?s:{},u.accessToken)this.accessToken=u.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 c;this.auth=this._initSupabaseAuthClient((c=u.auth)!==null&&c!==void 0?c:{},this.headers,u.global.fetch)}this.fetch=p1(t,e,this._getAccessToken.bind(this),u.global.fetch,u.tracePropagation),this.realtime=this._initRealtimeClient(le({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},u.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 Tx(new URL("rest/v1",i).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch,timeout:u.db.timeout,urlLengthLimit:u.db.urlLengthLimit}),this.storage=new Kw(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new wx(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:o,debug:u,throwOnError:c,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:f},m,x){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new x1({url:this.authUrl.href,headers:le(le({},y),m),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:u,throwOnError:c,experimental:d,fetch:x,lockAcquireTimeout:h,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new yw(this.realtimeUrl.href,le(le({},e),{},{params:le(le({},{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 b1=(e,t,r)=>new w1(e,t,r);function k1(){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}k1()&&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 Om="https://udmfeelrxeoahrzkxmlk.supabase.co",zm="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVkbWZlZWxyeGVvYWhyemt4bWxrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM0NTYxMzYsImV4cCI6MjA5OTAzMjEzNn0.gu2A5wZAbVPN2GFKFNVILnjmqUrDm_Xv9xMCqTnItC0",_1=Om.includes("your-project")||zm.includes("your-anon"),X=!_1;X||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 ne=b1(X?Om:"https://placeholder.supabase.co",X?zm:"placeholder-anon-key");function er(e,t){try{const r=localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}function Rr(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(r){console.warn("localStorage write failed",e,r)}}const ei=["Western","Sitcom","Drama","Crime","Mystery","Sci-Fi","Kids","Animation","British TV","Soap Opera","Mini Series","Classic TV"],uc=["1950s","1960s","1970s","1980s","1990s","2000s"],Zl={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"]},Pa=["rings","diagonal","dots","sunburst"];function S1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function Im(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t}function $m(){return`zc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}function E1(){return`ZA-${new Date().getFullYear()}${String(Math.floor(Math.random()*9e4)+1e4)}`}function Ws(e){const t=(e.title||"Untitled").trim(),r=(e.genres&&e.genres.length?e.genres:["Classic TV"]).filter(u=>typeof u=="string"),n=ei.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,o=e.id||$m();return{id:o,slug:e.slug||S1(`${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(u=>String(u).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:Zl[n]||["#221C14","#C6A15B"],pattern:Pa[Im(o)%Pa.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 hh(e){const t=ei.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 and restored",isHD:!!e.is_hd,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||[],seoTitle:e.seo_title||"",seoDescription:e.seo_description||"",palette:Zl[t]||Zl["Classic TV"],pattern:Pa[Im(e.id)%Pa.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 fh(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 ph(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,country:e.customer_country,currency:e.customer_currency||"USD",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 C1(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,customer_country:e.country||null,customer_currency:e.currency||"USD",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 Dm="za-demo-products",Lm="za-demo-orders",Um="za-demo-settings";function tn(){return er(Dm,[])}function rs(e){Rr(Dm,e)}function gt(){return er(Lm,[])}function Kt(e){Rr(Lm,e)}function j1(e){return er(Um,e)}function N1(e){Rr(Um,e)}const T1=[{title:"Frontier Skies",genres:["Western"],decades:["1960s"],seasons:6},{title:"Harbor Lights",genres:["Drama"],decades:["1970s"],seasons:4}],A1=["Frontier Skies","Harbor Lights","Midnight Precinct","The Larkspur House","Silver Static","Copper County","Willow Creek Junction","Sterling Manor"];async function R1(){const e=tn();if(e.length>0&&!(e.some(s=>A1.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)=>Ws({...i,createdAt:t-a*36e5}))}catch{r=T1.map((n,s)=>Ws({title:n.title,genres:n.genres.filter(i=>ei.includes(i)),decades:n.decades.filter(i=>uc.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}))}rs(r)}const Fm=w.createContext(null),Ue=()=>w.useContext(Fm),mh={payoneerEmail:"payments@tvseriesarchive.com",supportEmail:"support@tvseriesarchive.com",currency:"USD"},qo="za-my-orders-index";function Ni(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 P1(e){return{digitalPrice:e.formats.digital.price,usbPrice:e.formats.usb.price,digitalAvailable:e.formats.digital.available,usbAvailable:e.formats.usb.available}}function O1({children:e}){const[t,r]=w.useState([]),[n,s]=w.useState([]),[i,a]=w.useState([]),[o,u]=w.useState([]),[c,d]=w.useState(mh),[h,f]=w.useState(()=>er("za-wishlist",[])),[m,x]=w.useState(()=>er("za-recent-searches",[])),[y,b]=w.useState(()=>er("za-cart",[])),[g,p]=w.useState(!1),[v,k]=w.useState(null);w.useEffect(()=>{Rr("za-wishlist",h)},[h]),w.useEffect(()=>{Rr("za-recent-searches",m)},[m]),w.useEffect(()=>{Rr("za-cart",y)},[y]);async function _(){if(!X){const z=tn().filter(H=>H.enabled&&!H.needsReview).map(H=>({...H,deliveryLink:null})).sort((H,W)=>W.createdAt-H.createdAt);r(z);return}let S=[],N=0;const R=1e3;for(;;){const z=N*R,H=z+R-1,{data:W,error:O}=await ne.from("public_products").select("*").order("created_at",{ascending:!1}).range(z,H);if(O){k(O.message);return}if(!W||W.length===0||(S=S.concat(W),W.length<R))break;N++}r(S.map(hh))}async function E(){if(!X){s([...tn()].sort((z,H)=>H.createdAt-z.createdAt));return}let S=[],N=0;const R=1e3;for(;;){const z=N*R,H=z+R-1,{data:W,error:O}=await ne.from("products").select("*").order("created_at",{ascending:!1}).range(z,H);if(O){k(O.message);return}if(!W||W.length===0||(S=S.concat(W),W.length<R))break;N++}s(S.map(hh))}async function C(){if(!X){a([...gt()].sort((R,z)=>z.createdAt-R.createdAt));return}const{data:S,error:N}=await ne.from("orders").select("*").order("created_at",{ascending:!1});if(N){k(N.message);return}a((S||[]).map(ph))}async function P(){if(!X){d(j1(mh));return}const{data:S,error:N}=await ne.from("settings").select("*").eq("id",1).maybeSingle();if(N){k(N.message);return}S&&d({payoneerEmail:S.payoneer_email,supportEmail:S.support_email,currency:S.currency||"USD"})}async function T(S,N){if(!X)return gt().find(W=>W.id===S&&W.customer.email.trim().toLowerCase()===(N||"").trim().toLowerCase())||null;const{data:R,error:z}=await ne.rpc("get_my_order",{p_order_id:S,p_email:N});return z||!R||R.length===0?null:ph(R[0])}async function j(){const S=er(qo,[]),N=[];for(const R of S){const z=await T(R.id,R.email);z&&N.push(z)}N.sort((R,z)=>z.createdAt-R.createdAt),u(N)}w.useEffect(()=>{(async()=>(X||await R1(),await Promise.all([_(),P()]),p(!0)))()},[]);const L={products:t,adminProducts:n,orders:i,myOrders:o,settings:c,wishlist:h,recentSearches:m,cartItems:y,loaded:g,error:v,refreshProducts:_,refreshAdminProducts:E,refreshOrders:C,refreshMyOrders:j,lookupOrder:T,async setSettings(S){if(d(S),!X){N1(S);return}const{error:N}=await ne.from("settings").update({payoneer_email:S.payoneerEmail,support_email:S.supportEmail,currency:S.currency}).eq("id",1);N&&k(N.message)},async upsertProducts(S){const N=S.map(H=>Ws(H));if(!X){const H=tn();N.forEach(W=>{const O=H.findIndex(B=>B.slug===W.slug);O>=0?H[O]={...W,id:H[O].id}:H.push(W)}),rs(H),await Promise.all([_(),E()]);return}const R=N.map(fh),{error:z}=await ne.from("products").upsert(R,{onConflict:"slug"});if(z){k(z.message);return}await Promise.all([_(),E()])},async updateProduct(S,N){const R=n.find(W=>W.id===S)||t.find(W=>W.id===S);if(!R)return;const z=Ws({...R,...P1(R),...N,id:S});if(!X){const W=tn(),O=W.findIndex(B=>B.id===S);O>=0?W[O]=z:W.push(z),rs(W),await Promise.all([_(),E()]);return}const{error:H}=await ne.from("products").update(fh(z)).eq("id",S);if(H){k(H.message);return}await Promise.all([_(),E()])},async deleteProducts(S){if(!X){rs(tn().filter(R=>!S.includes(R.id))),await Promise.all([_(),E()]);return}const{error:N}=await ne.from("products").delete().in("id",S);if(N){k(N.message);return}await Promise.all([_(),E()])},async replaceAllProducts(S){if(!X){rs(S),await Promise.all([_(),E()]);return}const N=S.map(z=>z.id),R=n.filter(z=>!N.includes(z.id)).map(z=>z.id);R.length&&await ne.from("products").delete().in("id",R),await Promise.all([_(),E()])},toggleWishlist(S){f(N=>N.includes(S)?N.filter(R=>R!==S):[...N,S])},pushRecentSearch(S){x(N=>[S,...N.filter(R=>R!==S)].slice(0,5))},addToCart(S,N){b(R=>[...R,{productId:S.id,format:N,price:S.formats[N].price}])},removeFromCart(S){b(N=>N.filter((R,z)=>z!==S))},clearCart(){b([])},async placeOrder(S){if(!X)Kt([S,...gt()]);else{const{error:R}=await ne.from("orders").insert(C1(S));if(R)throw k(R.message),R}b([]);const N=er(qo,[]);Rr(qo,[{id:S.id,email:S.customer.email},...N].slice(0,50)),Ni("pending_payment",{orderId:S.id,email:S.customer.email})},async reportPaid(S){if(!X){Kt(gt().map(z=>z.id===S?{...z,status:"payment_reported"}:z)),await C();return}const{error:N}=await ne.from("orders").update({status:"payment_reported"}).eq("id",S);if(N){k(N.message);return}await C();const R=i.find(z=>z.id===S);R&&Ni("payment_reported",{orderId:S,email:R.customer.email})},async markPaid(S){if(!X){Kt(gt().map(R=>R.id===S?{...R,status:"paid"}:R)),await C();return}const{error:N}=await ne.from("orders").update({status:"paid"}).eq("id",S);if(N){k(N.message);return}await C()},async approveAccess(S){const N=i.find(z=>z.id===S);if(!N)return;const R={};if(N.items.forEach(z=>{if(z.format!=="digital")return;const H=n.find(W=>W.id===z.productId);R[z.productId]=(H==null?void 0:H.deliveryLink)||"(No delivery link set on this product yet — add one in Admin > Products.)"}),!X)Kt(gt().map(z=>z.id===S?{...z,status:"access_granted",accessLinks:R}:z));else{const{error:z}=await ne.from("orders").update({status:"access_granted",access_links:R}).eq("id",S);if(z){k(z.message);return}}await C(),Ni("access_granted",{orderId:S,email:N.customer.email})},async markShipped(S,N){if(!X){Kt(gt().map(z=>z.id===S?{...z,status:"shipped",tracking:N}:z)),await C();return}const{error:R}=await ne.from("orders").update({status:"shipped",tracking:N}).eq("id",S);if(R){k(R.message);return}await C()},async markCompleted(S){if(!X){Kt(gt().map(R=>R.id===S?{...R,status:"completed"}:R)),await C();return}const{error:N}=await ne.from("orders").update({status:"completed"}).eq("id",S);if(N){k(N.message);return}Ni("request_review",{orderId:S}),await C()},async cancelOrder(S){if(!X){Kt(gt().map(R=>R.id===S?{...R,status:"cancelled"}:R)),await C();return}const{error:N}=await ne.from("orders").update({status:"cancelled"}).eq("id",S);if(N){k(N.message);return}fetch("/api/payoneer-links",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"release",orderId:S})}).catch(()=>{}),await C()},async refundOrder(S){if(!X){Kt(gt().map(R=>R.id===S?{...R,status:"refunded"}:R)),await C();return}const{error:N}=await ne.from("orders").update({status:"refunded"}).eq("id",S);if(N){k(N.message);return}await C()}};return l.jsx(Fm.Provider,{value:L,children:e})}const eu="za-demo-admin-session",z1="tvseriesarchive-preview";let Bm=typeof sessionStorage<"u"&&sessionStorage.getItem(eu)==="1";const tu=new Set;function gh(e){Bm=e,tu.forEach(t=>t(e))}function Mm(){const[e,t]=w.useState(null),[r,n]=w.useState(!0),[s,i]=w.useState(Bm);return w.useEffect(()=>{if(!X)return n(!1),tu.add(i),()=>tu.delete(i);ne.auth.getSession().then(({data:o})=>{t(o.session),n(!1)});const{data:a}=ne.auth.onAuthStateChange((o,u)=>t(u));return()=>a.subscription.unsubscribe()},[]),{session:e,loading:r,isAdmin:X?!!e:s,isDemoMode:!X,signIn:async(a,o)=>X?ne.auth.signInWithPassword({email:a,password:o}):o===z1?(sessionStorage.setItem(eu,"1"),gh(!0),{error:null}):{error:{message:"Incorrect preview password."}},signOut:async()=>{if(!X){sessionStorage.removeItem(eu),gh(!1);return}return ne.auth.signOut()}}}function I1(){const{signIn:e,isDemoMode:t}=Mm(),[r,n]=w.useState(""),[s,i]=w.useState(""),[a,o]=w.useState(""),[u,c]=w.useState(!1),d=async h=>{h.preventDefault(),c(!0),o("");const{error:f}=await e(r,s);f&&o(f.message||"Sign-in failed. Check your email and password."),c(!1)};return l.jsx("div",{className:"max-w-sm mx-auto px-4 py-20",children:l.jsxs("div",{className:"za-card rounded-2xl p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(_a,{size:20,className:"za-gold"}),l.jsx("span",{className:"za-display text-lg",children:"TvSeriesArchive Admin"})]}),l.jsxs("p",{className:"text-xs za-ink-dim mb-5 flex items-center gap-1.5",children:[l.jsx(Ad,{size:12})," ",t?"Preview Mode — local admin session":"Staff sign-in required"]}),t&&l.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: ",l.jsx("span",{className:"za-display text-current",children:"tvseriesarchive-preview"})," — change it via ",l.jsx("span",{className:"za-display text-current",children:"VITE_ADMIN_DEMO_PASSWORD"})," in ",l.jsx("span",{className:"za-display text-current",children:".env"}),"."]}),l.jsxs("form",{onSubmit:d,className:"flex flex-col gap-3",children:[!t&&l.jsx("input",{className:"za-input",type:"email",placeholder:"Email",value:r,onChange:h=>n(h.target.value),required:!0}),l.jsx("input",{className:"za-input",type:"password",placeholder:"Password",value:s,onChange:h=>i(h.target.value),required:!0,autoFocus:t}),a&&l.jsxs("p",{className:"text-xs za-warn flex items-center gap-1.5",children:[l.jsx(cm,{size:12})," ",a]}),l.jsxs("button",{type:"submit",disabled:u,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:[u?l.jsx(mr,{size:14,className:"za-spin"}):l.jsx(Ad,{size:14})," Sign In"]})]}),!t&&l.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 $1({children:e}){const{loading:t,isAdmin:r,signOut:n,isDemoMode:s}=Mm();return t?l.jsxs("div",{className:"flex items-center justify-center py-24 za-ink-dim text-sm gap-2",children:[l.jsx(mr,{size:16,className:"za-spin"})," Checking admin session…"]}):r?l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between max-w-7xl mx-auto px-4 sm:px-6 pt-4",children:[s?l.jsx("span",{className:"text-xs za-warn",children:"Preview Mode — data is stored locally in this browser only"}):l.jsx("span",{}),l.jsxs("button",{onClick:n,className:"za-focus text-xs za-ink-dim hover:text-current flex items-center gap-1.5",children:[l.jsx(ux,{size:12})," Sign out"]})]}),e]}):l.jsx(I1,{})}class Ti extends w.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||l.jsx("div",{className:"za-card rounded-xl p-12 text-center za-ink-dim min-h-[40vh] flex items-center justify-center",children:l.jsxs("div",{children:[l.jsx("p",{className:"text-lg za-display mb-2",children:"Something went wrong"}),l.jsx("p",{className:"text-sm",children:"Please try refreshing the page."})]})}):this.props.children}}function Hr({product:e,className:t="",eager:r=!1}){if(e.coverUrl)return l.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 l.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:[l.jsx(Fl,{size:16,style:{color:s},strokeWidth:1.5,className:"absolute left-3 top-1/2 -translate-y-1/2 z-10"}),l.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]}),l.jsxs("div",{className:"p-3 relative z-10",children:[l.jsx("p",{className:"za-display text-lg leading-tight",style:{color:"#F7F8FC"},children:e.title}),l.jsx("p",{className:"text-[11px] tracking-wide mt-1",style:{color:s},children:e.years})]})]})}const qm=w.createContext(null),io=()=>w.useContext(qm),D1=2800,Ai=10,L1=1800,yh=10,Ri=["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 U1(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 F1(e){return e<.5?2*e*e:-1+(4-2*e)*e}function B1({start:e,end:t,coverStyle:r,onDone:n}){const s=w.useRef(null),i=w.useRef([]),a=w.useRef([]),o=w.useRef(),u=w.useRef(null),c=t.x-e.x,d={x:e.x+c*.2,y:e.y-180},h={x:e.x+c*.8,y:t.y-260};return w.useEffect(()=>{const f=s.current,m=f.querySelector(".za-fly-item"),x=f.querySelector(".za-fly-package"),y=f.querySelector(".za-pkg-fold"),b=f.querySelector(".za-pkg-tape-h"),g=f.querySelector(".za-pkg-tape-v"),p=f.querySelector(".za-pkg-lid");if(!f)return;function v(k){u.current==null&&(u.current=k);const _=k-u.current,E=Math.min(_/D1,1),C=F1(E),P=U1(C,e,d,h,t);i.current=[...i.current,P].slice(-Ai);const T=Math.max(0,Math.min(1,(C-.18)/.55)),j=540+C*180,L=Math.max(1-C*.55,.4)*1.15,S=Math.sin(_*.003)*(1-C)*8,N=Math.sin(C*Math.PI*2)*2.5,R=T<.5?1:Math.max(0,1-(T-.5)*2.5),z=T>.2?Math.min(1,(T-.2)/.5):0,H=T>.25?Math.min(1,(T-.25)/.35):0,W=T>.5?Math.min(1,(T-.5)/.25):0,O=T>.4?Math.min(1,(T-.4)/.2):0,B=(1-H)*60;f.style.transform=`translate(${P.x-23}px, ${P.y-27}px) rotate(${j}deg) scale(${L})`,f.style.filter=`blur(${N}px)`,m&&(m.style.opacity=R),x&&(x.style.opacity=z,x.style.transform=`translateY(${B}px)`),y&&(y.style.opacity=H),b&&(b.style.opacity=O),g&&(g.style.opacity=O),p&&(p.style.opacity=W,p.style.transform=`translateY(${(1-W)*-12}px)`);const q=i.current;for(let J=0;J<Ai;J++){const Q=a.current[J];if(Q)if(J<q.length){const U=q[J],K=J/Ai,Ht=Math.sin(J*2.3)*.5+.5;Q.style.display="block",Q.style.transform=`translate(${U.x-3-Ht*5}px, ${U.y-3-Ht*5+S*K}px) scale(${.08+K*.5})`,Q.style.opacity=K*(.3+T*.3)*(.6+Ht*.4),Q.style.width=Q.style.height=`${6+Ht*10}px`}else Q.style.display="none"}E<1?o.current=requestAnimationFrame(v):n()}return o.current=requestAnimationFrame(v),()=>cancelAnimationFrame(o.current)},[]),l.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:Ai}).map((f,m)=>l.jsx("div",{ref:x=>{x&&(a.current[m]=x)},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"}},m)),l.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"}}),l.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:[l.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)"}}),l.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)"}}),l.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)"}}),l.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 Wo({x:e,y:t,baseColor:r}){const[n,s]=w.useState([]),[i,a]=w.useState([]);return w.useEffect(()=>{const o=Array.from({length:yh},(d,h)=>{const f=h/yh*360+Math.random()*18,m=30+Math.random()*70;return{id:h,dx:Math.cos(f*Math.PI/180)*m,dy:Math.sin(f*Math.PI/180)*m,size:2+Math.random()*6,delay:Math.random()*40}});s(o);const u=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(u);const c=setTimeout(()=>{s([]),a([])},800);return()=>clearTimeout(c)},[]),l.jsxs(l.Fragment,{children:[n.map(o=>l.jsx("div",{className:"za-fly-particle",style:{left:e,top:t,"--dx":`${o.dx}px`,"--dy":`${o.dy}px`,"--size":`${o.size}px`,"--color":r,"--delay":`${o.delay}ms`}},o.id)),i.map(o=>l.jsx("div",{className:"za-fly-spark",style:{left:e,top:t,"--dx":`${o.dx}px`,"--dy":`${o.dy}px`,"--color":r,"--delay":`${o.delay}ms`}},o.id))]})}function M1({x:e,y:t,text:r,onDone:n}){const[s,i]=w.useState(!1);return w.useEffect(()=>{const a=setTimeout(()=>i(!0),50),o=setTimeout(n,L1);return()=>{clearTimeout(a),clearTimeout(o)}},[]),l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"za-fly-text",style:{left:e,top:t-28},children:r}),s&&l.jsxs(l.Fragment,{children:[l.jsx(Wo,{x:e,y:t-40,baseColor:"#FF6B6B"}),l.jsx(Wo,{x:e,y:t-40,baseColor:"#FFD93D"}),l.jsx(Wo,{x:e,y:t-40,baseColor:"#4D96FF"})]})]})}function q1({arrivals:e,count:t,onClick:r}){const[n,s]=w.useState(!1),i=w.useRef(0);return w.useEffect(()=>{if(e>i.current){s(!0);const a=setTimeout(()=>s(!1),500);return i.current=e,()=>clearTimeout(a)}},[e]),l.jsxs("div",{className:`za-cart-target ${n?"za-cart-bump":""}`,onClick:r,children:[l.jsxs("svg",{className:"za-cart-icon",viewBox:"0 0 28 32",fill:"none",children:[l.jsx("rect",{x:"2",y:"10",width:"24",height:"18",rx:"3",stroke:"currentColor",strokeWidth:"1.6",fill:"none"}),l.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"}),l.jsx("line",{x1:"4",y1:"14",x2:"24",y2:"14",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),l.jsx("rect",{x:"10",y:"3",width:"8",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"14",cy:"20",r:"2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]}),t>0&&l.jsx("div",{className:"za-cart-badge",children:t})]})}function vh({onLand:e,onCartClick:t,cartCount:r=0,children:n}){const[s,i]=w.useState([]),[a,o]=w.useState([]),[u,c]=w.useState(0),d=w.useRef(0),h=w.useRef(-1),f=w.useCallback((y,b)=>{if(!y)return;const g=y.getBoundingClientRect(),p=window.innerWidth-50,v=window.innerHeight-112,k=++d.current,_={x:g.left+g.width/2,y:g.top+g.height/2},E={x:p,y:v};i(T=>[...T,{id:k,start:_,end:E,coverStyle:b}]);let C=Math.floor(Math.random()*Ri.length);Ri.length>1&&C===h.current&&(C=(C+1)%Ri.length),h.current=C;const P=`t${k}`;o(T=>[...T,{id:P,x:_.x,y:_.y,text:Ri[C]}])},[]),m=w.useCallback(y=>{i(b=>b.filter(g=>g.id!==y)),c(b=>b+1),e==null||e()},[e]),x=w.useCallback(y=>{o(b=>b.filter(g=>g.id!==y))},[]);return l.jsxs(qm.Provider,{value:f,children:[n,a.map(y=>l.jsx(M1,{x:y.x,y:y.y,text:y.text,onDone:()=>x(y.id)},y.id)),s.map(y=>l.jsx(B1,{start:y.start,end:y.end,coverStyle:y.coverStyle,onDone:()=>m(y.id)},y.id)),l.jsx(q1,{arrivals:u,count:r,onClick:t})]})}function W1(e){if(e.coverUrl)return{backgroundImage:`url(${e.coverUrl})`,backgroundSize:"cover",backgroundPosition:"center"};const[t,r]=e.palette||["#1e1b2e","#8b5cf6"];return{background:`linear-gradient(155deg, ${t}, ${r}33 70%, ${t})`}}function H1({open:e,onClose:t,onNav:r}){const n=Ue(),s=io(),[i,a]=w.useState({}),o=(n.products||[]).filter(f=>{var m;return(m=n.wishlist)==null?void 0:m.includes(f.id)}),u=(f,m)=>{var y,b,g,p;const x=(b=(y=f.formats)==null?void 0:y.digital)!=null&&b.available?"digital":"usb";(p=(g=f.formats)==null?void 0:g[x])!=null&&p.available&&(s(m.currentTarget,W1(f)),n.addToCart(f,x),a(v=>({...v,[f.id]:!0})),setTimeout(()=>a(v=>({...v,[f.id]:!1})),1200))},c=f=>{o.forEach(m=>{var y,b,g,p;const x=(b=(y=m.formats)==null?void 0:y.digital)!=null&&b.available?"digital":"usb";(p=(g=m.formats)==null?void 0:g[x])!=null&&p.available&&n.addToCart(m,x)}),t()},d=f=>n.toggleWishlist(f),h=()=>o.forEach(f=>n.toggleWishlist(f.id));return l.jsxs("div",{className:`fixed inset-0 ${e?"":"pointer-events-none"}`,children:[l.jsx("div",{className:`absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-300 ${e?"opacity-100":"opacity-0"}`,onClick:t}),l.jsxs("div",{className:`absolute right-0 top-0 bottom-0 w-full max-w-sm bg-[var(--exp-bg)] border-l border-[var(--exp-border)] flex flex-col transition-transform duration-300 ${e?"translate-x-0":"translate-x-full"}`,children:[l.jsxs("div",{className:"shrink-0 border-b border-[var(--exp-border)]",children:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(An,{size:18,className:"text-[var(--exp-accent)]",fill:"currentColor"}),l.jsx("h3",{className:"exp-section-title",style:{margin:0,fontSize:17},children:"Favorites"}),o.length>0&&l.jsx("span",{className:"text-[11px] text-[var(--exp-text-muted)] bg-white/5 rounded-full px-2.5 py-0.5",children:o.length})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[o.length>0&&l.jsxs("button",{onClick:h,className:"text-[11px] text-red-400 hover:text-red-300 transition-colors flex items-center gap-1 px-2.5 py-1.5 rounded-full hover:bg-red-500/10",children:[l.jsx(Rd,{size:11})," Clear"]}),l.jsx("button",{onClick:t,className:"exp-icon-btn",children:l.jsx(Et,{size:18})})]})]}),o.length>0&&l.jsxs("div",{className:"flex gap-1 px-5 pb-3",children:[l.jsxs("button",{onClick:f=>c(),className:"flex-1 px-2.5 py-1.5 rounded-full text-[11px] font-semibold text-white shadow-lg flex items-center justify-center gap-1",style:{background:"linear-gradient(135deg, #7C5CFF, #405DFF)"},children:[l.jsx(mx,{size:10})," Add All"]}),l.jsxs("button",{onClick:()=>{t(),r==null||r("checkout")},className:"flex-1 px-2.5 py-1.5 rounded-full text-[11px] font-semibold border border-purple-500/40 text-purple-300 hover:bg-purple-500/10 transition-all flex items-center justify-center gap-1",children:[l.jsx(om,{size:10})," Cart"]})]})]}),o.length===0?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-8 text-center",children:[l.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-purple-500/10 to-blue-500/10 border border-purple-500/20 flex items-center justify-center mb-4",children:l.jsx(An,{size:28,className:"text-purple-400/50"})}),l.jsx("p",{className:"text-sm text-[var(--exp-text-muted)] mb-1",children:"Your wishlist is empty"}),l.jsx("p",{className:"text-xs text-[var(--exp-text-muted)] opacity-60 mb-5",children:"Heart the shows you love to save them here."}),l.jsxs("button",{onClick:()=>{t()},className:"px-5 py-2.5 rounded-full text-sm font-semibold text-white shadow-lg",style:{background:"linear-gradient(135deg, #7C5CFF, #405DFF)"},children:[l.jsx(ba,{size:14,className:"inline mr-1.5"})," Browse Collections"]})]}):l.jsx(l.Fragment,{children:l.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:o.map(f=>{var b,g,p,v,k,_,E,C;const[m,x]=f.palette||["#1e1b2e","#8b5cf6"],y=f.coverUrl?{backgroundImage:`url(${f.coverUrl})`,backgroundSize:"cover",backgroundPosition:"center"}:{background:`linear-gradient(155deg, ${m}, ${x}33 70%, ${m})`};return l.jsxs("div",{className:"flex gap-3 bg-[var(--exp-surface)] border border-[var(--exp-border)] rounded-[14px] overflow-hidden hover:border-purple-500/30 transition-all",children:[l.jsx("div",{className:"w-[88px] shrink-0 cursor-pointer",style:{...y,aspectRatio:"3/4"},onClick:()=>{t()}}),l.jsxs("div",{className:"flex-1 min-w-0 py-3 pr-3 flex flex-col justify-between",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-start justify-between gap-1",children:[l.jsx("div",{className:"text-left min-w-0",children:l.jsx("p",{className:"exp-trending-title text-sm leading-snug line-clamp-2",style:{margin:0},children:f.displayTitle||f.title})}),l.jsx("button",{onClick:()=>d(f.id),className:"shrink-0 w-7 h-7 rounded-full flex items-center justify-center hover:bg-red-500/10 text-[var(--exp-text-muted)] hover:text-red-400 transition-all",title:"Remove",children:l.jsx(Rd,{size:14})})]}),l.jsxs("p",{className:"text-[11px] text-[var(--exp-text-muted)] mt-0.5",children:[f.years," · ",(b=f.genres)==null?void 0:b[0]]}),l.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[l.jsx(oc,{size:10,fill:"#FFB800",color:"#FFB800"}),l.jsx("span",{className:"text-[10px] text-[var(--exp-text-muted)]",children:(g=f.rating)==null?void 0:g.toFixed(1)})]})]}),l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[((v=(p=f.formats)==null?void 0:p.digital)==null?void 0:v.available)&&l.jsxs("span",{className:"flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded-full bg-white/5 text-purple-300",children:[l.jsx(Wr,{size:8})," Digital"]}),((_=(k=f.formats)==null?void 0:k.usb)==null?void 0:_.available)&&l.jsxs("span",{className:"flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded-full bg-white/5 text-blue-300",children:[l.jsx(pr,{size:8})," USB"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"exp-trending-price text-sm",children:["$",(((C=(E=f.formats)==null?void 0:E.digital)==null?void 0:C.price)||29.99).toFixed(2),"+"]}),l.jsx("button",{onClick:P=>u(f,P),className:`w-8 h-8 rounded-full flex items-center justify-center transition-all ${i[f.id]?"opacity-50":""}`,style:{background:"linear-gradient(135deg, #7C5CFF, #405DFF)"},title:"Add to Cart",children:l.jsx(_t,{size:13,className:"text-white"})})]})]})]})]},f.id)})})})]})]})}const Ir="TvSeriesArchive",Ie="https://tvseriesarchive.com",cc="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 Fe(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 V1(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 nr(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 K1={"@context":"https://schema.org","@type":"Organization",name:Ir,url:Ie,logo:`${Ie}/logo.webp`,description:cc,sameAs:[]},G1={"@context":"https://schema.org","@type":"WebSite",name:Ir,url:Ie,description:cc,potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${Ie}/collections?q={search_term_string}`},"query-input":"required name=search_term_string"}};function J1(){w.useEffect(()=>(nr(K1,"za-org"),nr(G1,"za-website"),()=>{nr(null,"za-org"),nr(null,"za-website")}),[])}function $n({title:e,description:t,path:r="/",image:n,keywords:s,jsonLd:i,noindex:a=!1,jsonLdExtra:o,robots:u}={}){w.useEffect(()=>{const c=` | ${Ir}`,d=e&&e.endsWith(c)?e.slice(0,-c.length):e,h=d?`${d}${c}`:`${Ir} — Complete TV Series Collections, Worldwide Delivery`,f=t||cc,m=`${Ie}${r}`;return document.title=h,Fe("name","description",f),s&&Fe("name","keywords",s),Fe("name","robots",u||(a?"noindex, nofollow":"index, follow")),Fe("property","og:site_name",Ir),Fe("property","og:title",h),Fe("property","og:description",f),Fe("property","og:type",n?"product":"website"),Fe("property","og:url",m),n&&Fe("property","og:image",n),Fe("name","twitter:card",n?"summary_large_image":"summary"),Fe("name","twitter:title",h),Fe("name","twitter:description",f),n&&Fe("name","twitter:image",n),V1(m),nr(i,"page"),o&&o.forEach((x,y)=>nr(x,`extra-${y}`)),()=>{nr(null,"page"),o&&o.forEach((x,y)=>nr(null,`extra-${y}`))}},[e,t,r,n,s,i,a,o,u])}function $k(e){return{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url?`${Ie}${t.url}`:void 0}))}}function Dk(e){const t=e.featuredImage?e.featuredImage.startsWith("http")?e.featuredImage:`${Ie}${e.featuredImage}`:Y1;return{"@context":"https://schema.org","@type":"Article",headline:e.title,description:e.excerpt,image:t,author:{"@type":"Person",name:e.author},datePublished:e.publishedDate,dateModified:e.updatedDate||e.publishedDate,publisher:{"@type":"Organization",name:Ir,url:Ie},mainEntityOfPage:{"@type":"WebPage","@id":`${Ie}/blog/${e.slug}`}}}const Y1=`${Ie}/og-fallback.png`,xh={pending_payment:{label:"Payment Pending",icon:zs,tone:"text-[#FFB800]"},payment_reported:{label:"Payment Reported: Awaiting Confirmation",icon:ic,tone:"text-purple-400"},paid:{label:"Paid",icon:wa,tone:"text-purple-400"},access_granted:{label:"Digital Download Ready",icon:gr,tone:"text-[#42D392]"},shipped:{label:"Shipped",icon:Br,tone:"text-purple-400"},completed:{label:"Completed",icon:$t,tone:"text-[#42D392]"},cancelled:{label:"Cancelled",icon:Et,tone:"text-[#FFB800]"},refunded:{label:"Refunded",icon:ac,tone:"text-[#FFB800]"}},Lk=20;async function Uk(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 Fk(e,t={}){const r=Number(e.confidence)||0;return Ws({...t,title:e.title||e.input||t.title,years:e.years||t.years||"",genres:(e.genres||[]).filter(n=>ei.includes(n)),country:e.country||t.country||"USA",language:e.language||"English",decades:(e.decades||[]).filter(n=>uc.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})}const Q1=[{slug:"dallas",show:"Dallas",years:"1978–1991",tagline:"Who shot J.R.? If you have to ask, this quiz isn't for you.",coverUrl:"https://image.tmdb.org/t/p/w500/A1dupjBm7rXqBw2Dbz9WUsHoyxo.jpg",accent:"#D946EF",questions:[{q:"Dallas centers on which wealthy family?",options:["The Ewings","The Barnes","The Carringtons","The Colbys"],correct:0,points:10},{q:"What business are the Ewings primarily in?",options:["Banking","Oil","Cattle ranching only","Real estate"],correct:1,points:10},{q:"What is the name of the Ewing family ranch?",options:["Tara","Falcon Crest","Southfork","Cimarron"],correct:2,points:15},{q:'Who famously got shot in the season 3 cliffhanger "Who shot J.R.?"',options:["Bobby Ewing","J.R. Ewing","Cliff Barnes","Ray Krebbs"],correct:1,points:15},{q:"Which actor played J.R. Ewing?",options:["Larry Hagman","Patrick Duffy","Ken Kercheval","Howard Keel"],correct:0,points:20},{q:"Bobby Ewing's death was famously undone by revealing it was all a...",options:["Hoax staged by Cliff Barnes","Dream","Case of mistaken identity","Coma-induced hallucination"],correct:1,points:20},{q:"What is the name of J.R.'s long-suffering wife?",options:["Pamela","Sue Ellen","Donna","April"],correct:1,points:25},{q:"Dallas originally aired on which US network?",options:["ABC","NBC","CBS","Fox"],correct:2,points:25}]},{slug:"supernatural",show:"Supernatural",years:"2005–2020",tagline:"Saving people, hunting things — but do you know the family business?",coverUrl:"https://image.tmdb.org/t/p/w500/8iixmfGx5EIFPdpNvB2JvI3VIqX.jpg",accent:"#405DFF",questions:[{q:"What are the names of the two brothers at the center of the show?",options:["Sam and Dean Winchester","Sam and Adam Winchester","Dean and John Winchester","Sam and Bobby Singer"],correct:0,points:10},{q:"What do the brothers drive?",options:["A pickup truck","A 1967 Chevrolet Impala","A hearse","A '69 Camaro"],correct:1,points:10},{q:"What is their father's name?",options:["Bobby Winchester","Rufus Turner","John Winchester","Henry Winchester"],correct:2,points:15},{q:"Which angel becomes one of the boys' closest allies?",options:["Gabriel","Castiel","Zachariah","Uriel"],correct:1,points:15},{q:"What supernatural creature killed Sam's girlfriend Jessica and their mother Mary?",options:["A vampire","A werewolf","The demon Azazel","A shapeshifter"],correct:2,points:20},{q:"What is the name of the family's longtime hunter friend and surrogate father figure?",options:["Bobby Singer","Rufus Turner","Garth Fitzgerald","Crowley"],correct:0,points:20},{q:"In later seasons, who becomes the King of Hell and an uneasy ally?",options:["Lucifer","Crowley","Ruby","Metatron"],correct:1,points:25},{q:"How many seasons did Supernatural run for in total?",options:["12","15","18","10"],correct:1,points:25}]},{slug:"the-twilight-zone-1783733491701",show:"The Twilight Zone",years:"1959–1964",tagline:"There's a signpost up ahead — your next stop, this quiz.",coverUrl:"https://image.tmdb.org/t/p/w500/7uY4pCOxbEdv4M8jTE4uMPVoSIW.jpg",accent:"#36C5FF",questions:[{q:"Who created and hosted the original Twilight Zone?",options:["Alfred Hitchcock","Rod Serling","Ray Bradbury","Gene Roddenberry"],correct:1,points:10},{q:"The Twilight Zone is best described as which genre?",options:["Sitcom","Anthology sci-fi/fantasy","Soap opera","Western"],correct:1,points:10},{q:"What network originally aired The Twilight Zone?",options:["NBC","ABC","CBS","Syndicated only"],correct:2,points:15},{q:`In the famous episode "To Serve Man," what is the twist about the aliens' book?`,options:["It's a cookbook","It's a peace treaty","It's a religious text","It's a trap for their leader"],correct:0,points:20},{q:'In "Time Enough at Last," what tragedy befalls the bookworm protagonist right when he finally has time to read?',options:["He goes blind","His glasses break","The library burns down","He runs out of time"],correct:1,points:20},{q:"Each episode of the original series ran for about how long?",options:["15 minutes","25–30 minutes","45 minutes","60 minutes"],correct:1,points:15},{q:"William Shatner starred in which classic episode, before his Star Trek fame?",options:['"The Invaders"','"Nightmare at 20,000 Feet"','"The Eye of the Beholder"','"A Stop at Willoughby"'],correct:1,points:25},{q:"What was Rod Serling's iconic sign-off phrase style known for?",options:["Breaking the fourth wall with closing narration","A musical outro only","A written epilogue","A studio audience reaction"],correct:0,points:25}]},{slug:"columbo",show:"Columbo",years:"1971–2003",tagline:"Just one more thing... how well do you know the rumpled detective?",coverUrl:"https://image.tmdb.org/t/p/w500/2JCD8vab3fircOU8cM2HJCxfv4I.jpg",accent:"#FFB800",questions:[{q:"What is Columbo's profession?",options:["FBI agent","Private investigator","LAPD homicide detective","District attorney"],correct:2,points:10},{q:"What does Columbo famously drive?",options:["A shiny new sedan","A battered Peugeot convertible","A police cruiser","A motorcycle"],correct:1,points:15},{q:"Columbo's storytelling format is unusual because the audience...",options:["Never sees the murder","Sees the murder happen first, then watches Columbo solve it","Only hears Columbo's narration","Solves the case alongside him with hidden clues"],correct:1,points:15},{q:"Who played Lieutenant Columbo in the original series?",options:["Peter Falk","Telly Savalas","Karl Malden","William Conrad"],correct:0,points:10},{q:"What phrase is Columbo famous for saying just as he's about to leave a suspect?",options:['"One more question"','"Just one more thing"','"Before I forget"','"Hold on a second"'],correct:1,points:20},{q:"What is notably never revealed about Columbo throughout the series?",options:["His badge number","His first name (in most versions)","His car's make","His wife's existence"],correct:1,points:25},{q:"Columbo aired as part of which rotating anthology series in its early years?",options:["The NBC Mystery Movie","ABC Suspense Theater","CBS Playhouse","The Wednesday Movie"],correct:0,points:25},{q:"What does Columbo often mention about his wife?",options:["She is a famous actress","She is frequently referenced but never seen on screen","She works with him","She is deceased"],correct:1,points:20}]},{slug:"gunsmoke",show:"Gunsmoke",years:"1955–1975",tagline:"Dodge City runs on grit. Prove you can hang with Marshal Dillon.",coverUrl:"https://image.tmdb.org/t/p/w500/x7WjYizqcrA64xi9XLqUWCz5DNk.jpg",accent:"#42D392",questions:[{q:"Gunsmoke is set in which frontier town?",options:["Tombstone","Dodge City","Deadwood","Laredo"],correct:1,points:10},{q:"What is the profession of the show's main character, Matt Dillon?",options:["Sheriff","US Marshal","Bounty hunter","Cattle rancher"],correct:1,points:10},{q:"What is the name of the saloon owner and Matt Dillon's close companion?",options:["Miss Kitty","Miss Ellie","Miss Amanda","Miss Rose"],correct:0,points:15},{q:"Who plays the limping Doc, one of Dillon's closest friends?",options:["Milburn Stone as Doc Adams","Dennis Weaver as Doc Adams","Ken Curtis as Doc Adams","James Arness as Doc Adams"],correct:0,points:20},{q:"Which actor played Marshal Matt Dillon for the entire run?",options:["Chuck Connors","James Arness","Clint Eastwood","Hugh O'Brian"],correct:1,points:15},{q:"Gunsmoke originally began as what kind of production before becoming a TV show?",options:["A stage play","A radio drama","A movie serial","A comic strip"],correct:1,points:25},{q:"How many seasons did Gunsmoke run, making it one of the longest-running scripted TV shows in US history?",options:["12","15","20","10"],correct:2,points:25},{q:"What was the name of Dillon's deputy, known for his limp?",options:["Chester Goode","Festus Haggen","Newly O'Brien","Quint Asper"],correct:0,points:20}]},{slug:"friends",show:"Friends",years:"1994–2004",tagline:`"How you doin'?" Prove you could survive in apartment 20.`,coverUrl:"https://image.tmdb.org/t/p/w500/2koX1xLkpTQM4IZebYvKysFW1Nh.jpg",accent:"#FFB800",questions:[{q:"How many friends are in the main group?",options:["Four","Five","Six","Seven"],correct:2,points:10},{q:"What is the name of the coffee shop where the group hangs out?",options:["Central Perk","The Grind","Java Joe's","Coffee Corner"],correct:0,points:10},{q:"What is Ross's profession?",options:["Chef","Paleontologist","Fashion designer","Actor"],correct:1,points:15},{q:"Who ends up marrying Ross (for the third time)?",options:["Rachel","Emily","Carol","Janice"],correct:0,points:15},{q:"What is the name of Ross and Rachel's daughter?",options:["Erica","Emma","Emily","Ellie"],correct:1,points:20},{q:"What game does Chandler and Joey's foosball table get replaced by, after a famous bet with Monica and Rachel?",options:["Nothing — they lose their apartment to the girls","A pool table","An arcade machine","A ping pong table"],correct:0,points:20},{q:"What is Phoebe's signature (and famously terrible) song?",options:['"Sticky Shoes"','"Smelly Cat"',`"Grandma's Dead"`,`"My Mother's Ghost"`],correct:1,points:15},{q:"Which two friends get married in Las Vegas after a drunken night, then decide to stay married?",options:["Ross and Rachel","Monica and Chandler","Joey and Phoebe","Chandler and Rachel"],correct:1,points:25}]},{slug:"knots-landing",show:"Knots Landing",years:"1979–1993",tagline:"Life on the cul-de-sac gets messy — see how much you remember.",coverUrl:"https://image.tmdb.org/t/p/w500/ohcRf8CyVpQiUw2ZTmGQ2I4fH8D.jpg",accent:"#9B80FF",questions:[{q:"Knots Landing is a spin-off of which other classic primetime soap?",options:["Dynasty","Dallas","Falcon Crest","Melrose Place"],correct:1,points:10},{q:"The show is set in a cul-de-sac in which US state?",options:["Texas","California","Florida","Arizona"],correct:1,points:10},{q:"Which Dallas character(s) moved to Knots Landing at the start of the series?",options:["J.R. and Sue Ellen Ewing","Gary and Valene Ewing","Bobby and Pamela Ewing","Cliff and April Barnes"],correct:1,points:20},{q:"How many seasons did Knots Landing run for?",options:["10","14","8","20"],correct:1,points:20},{q:"What type of neighborhood setting distinguishes Knots Landing from Dallas's ranch setting?",options:["A beachfront resort","A suburban cul-de-sac","A downtown high-rise","A farming community"],correct:1,points:15},{q:"Knots Landing originally aired on which network?",options:["ABC","CBS","NBC","Fox"],correct:1,points:15},{q:"Which actress played Valene Ewing for most of the series?",options:["Joan Van Ark","Michele Lee","Donna Mills","Nicollette Sheridan"],correct:0,points:25},{q:"Knots Landing is notable for being one of the longest-running what in US television history?",options:["Sitcoms","Primetime serialized dramas","Game shows","Anthology series"],correct:1,points:25}]},{slug:"sunset-beach",show:"Sunset Beach",years:"1997–1999",tagline:"Short-lived but unforgettable — how deep is your Sunset Beach knowledge?",coverUrl:"https://image.tmdb.org/t/p/w500/b4wqMNq1v3oksZ1V88aemWxbx15.jpg",accent:"#36C5FF",questions:[{q:"Sunset Beach is what type of TV show?",options:["Sitcom","Daytime soap opera","Crime drama","Reality show"],correct:1,points:10},{q:"Who created Sunset Beach?",options:["Aaron Spelling","Stephen J. Cannell","Aaron Spelling & E. Duke Vincent","Chuck Lorre"],correct:2,points:20},{q:"What network originally aired Sunset Beach?",options:["NBC","ABC","CBS","Fox"],correct:0,points:15},{q:"Roughly how long did Sunset Beach's original run last?",options:["About 1 year","About 2–3 years","About 5 years","About 10 years"],correct:1,points:15},{q:"Sunset Beach was known for its storylines being somewhat unusual for daytime soaps by leaning into which genre?",options:["Pure courtroom drama","Supernatural and over-the-top plots","Historical fiction","Musical numbers"],correct:1,points:20},{q:"What type of California town is Sunset Beach set in?",options:["A landlocked farming town","A fictional beach town","A mountain ski resort","A big city downtown"],correct:1,points:10},{q:"Sunset Beach aired in the same general daytime era as which other well-known soaps?",options:["Days of Our Lives and General Hospital","The Sopranos and The Wire","Friends and Seinfeld","24 and Lost"],correct:0,points:20},{q:"Despite its relatively short run, Sunset Beach has since developed a reputation among fans as a...",options:["Forgotten failure with no following","Cult favorite remembered fondly by soap fans","Long-running franchise with many spin-offs","Show that was never actually broadcast"],correct:1,points:25}]}];function X1(e){return Q1.find(t=>t.slug===e)||null}function Z1(e){return e.questions.reduce((t,r)=>t+r.points,0)}const ek=w.lazy(()=>Ct(()=>import("./ExperimentalHome-CfL01DMg.js"),__vite__mapDeps([0,1,2,3]))),tk=w.lazy(()=>Ct(()=>import("./BlogPage-CIV9xHsc.js"),__vite__mapDeps([4,5,6,7,2]))),rk=w.lazy(()=>Ct(()=>import("./BlogArticle-45haRgeK.js"),__vite__mapDeps([8,5,9,10,11,7]))),nk=w.lazy(()=>Ct(()=>import("./BlogCategory-Cviidj3n.js"),__vite__mapDeps([12,5,6,10,7]))),sk=w.lazy(()=>Ct(()=>import("./BlogTag-Bb6dKUFG.js"),__vite__mapDeps([13,5,6,10,7]))),ik=w.lazy(()=>Ct(()=>import("./BlogAuthor-BqesC73k.js"),__vite__mapDeps([14,5,9,6,10]))),ak=w.lazy(()=>Ct(()=>import("./NotFoundPage-BWhm3F0b.js"),[])),ok=w.lazy(()=>Ct(()=>import("./AdminPanel-DcrwZpga.js"),__vite__mapDeps([15,16,2,1]))),lk=w.lazy(()=>Ct(()=>import("./QuizHub-CvcFCGgo.js"),[])),uk=w.lazy(()=>Ct(()=>import("./QuizPlay-BfCz12Xt.js"),__vite__mapDeps([17,11,16])));function ck(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"quiz-hub":return"/quiz";case"quiz-play":return`/quiz/${encodeURIComponent(t.slug||"")}`;case"admin":return"/zqx!";case"designlab":return"/design-lab";default:return"/"}}function dk(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 o=e.match(/^\/blog\/author\/([^/]+)$/);if(o)return{view:"blog-author",params:{slug:decodeURIComponent(o[1])}};const u=e.match(/^\/blog\/([^/]+)$/);if(u)return{view:"blog-article",params:{slug:decodeURIComponent(u[1])}};const c=e.match(/^\/pages\/([^/]+)$/);if(c)return{view:"trust",params:{page:c[1]}};if(e==="/quiz")return{view:"quiz-hub",params:{}};const d=e.match(/^\/quiz\/([^/]+)$/);return d?{view:"quiz-play",params:{slug:decodeURIComponent(d[1])}}:e==="/zqx!"?{view:"admin",params:{}}:e==="/design-lab"?{view:"designlab",params:{}}:e==="/404"?{view:"notfound",params:{}}:{view:"notfound",params:{}}}const hk=["Columbo","Western","1980s","British Sitcoms","Falcon Crest","Sci-Fi"],Ho=24,fk={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 wh(){return l.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; }
.quiz-promo-card{ animation: quiz-promo-glow 2.4s ease-in-out infinite; }
@keyframes quiz-promo-glow{
0%,100%{ box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--quiz-accent) 55%, transparent), 0 20px 50px -15px color-mix(in srgb, var(--quiz-accent) 45%, transparent); }
50%{ box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--quiz-accent) 90%, transparent), 0 24px 60px -12px color-mix(in srgb, var(--quiz-accent) 65%, transparent); }
}
.quiz-promo-icon{ animation: quiz-promo-bounce 2.4s ease-in-out infinite; }
@keyframes quiz-promo-bounce{ 0%,100%{ transform:rotate(-4deg); } 50%{ transform:rotate(4deg); } }
@media (prefers-reduced-motion: reduce){
.za-marquee-track,.za-grain,.za-crt,.za-orb-1,.za-orb-2,.za-skeleton,.za-fade-view,.quiz-promo-card,.quiz-promo-icon{ animation:none !important; }
}
`})}function dc(e,t){w.useEffect(()=>{const r=n=>{!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t])}function Ki(e){if(e.coverUrl)return{backgroundImage:`url(${e.coverUrl})`};const[t,r]=e.palette;return{background:`linear-gradient(155deg, ${t}, ${r})`}}function Oa({value:e,size:t=13}){const r=Math.round(e);return l.jsx("div",{className:"flex items-center gap-0.5","aria-label":`${e.toFixed(1)} / 5`,children:[1,2,3,4,5].map(n=>l.jsx(oc,{size:t,strokeWidth:1.5,className:n<=r?"text-[#FFB800]":"za-ink-dim",fill:n<=r?"currentColor":"none"},n))})}function pk(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 mk({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 l.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded-full ${r}`,children:e})}function gk({product:e,onOpen:t,onQuickView:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i}=Ue();io();const a=s.includes(e.id);return l.jsxs("a",{href:`/show/${e.slug}`,onClick:o=>{!o.metaKey&&!o.ctrlKey&&(o.preventDefault(),t(e.slug))},className:"group za-neon-card rounded-[17px] overflow-hidden flex flex-col cursor-pointer relative",children:[l.jsxs("div",{className:"relative overflow-hidden",children:[l.jsx("div",{className:"transition-transform duration-500 group-hover:scale-[1.06] aspect-[4/5]",children:l.jsx(Hr,{product:e,className:"w-full h-full"})}),l.jsx("div",{className:"absolute top-2 left-2 flex flex-col gap-1 items-start z-20",children:pk(e).map(o=>l.jsx(mk,{...o},o.label))}),l.jsx("button",{onClick:o=>{o.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:l.jsx(An,{size:14,className:a?"text-purple-400":"text-white/70",fill:a?"currentColor":"none"})}),l.jsxs("div",{className:"za-quick-overlay absolute bottom-0 left-0 right-0 p-3 flex gap-2 z-20",children:[l.jsxs("button",{onClick:o=>{o.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:[l.jsx(ix,{size:13})," Quick View"]}),l.jsxs("button",{onClick:o=>{o.stopPropagation(),n(e,o.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:[l.jsx(_t,{size:13})," Add"]})]})]}),l.jsxs("div",{className:"p-4 flex flex-col gap-1.5 flex-1",children:[l.jsx("h3",{className:"za-display text-sm leading-snug truncate",children:e.displayTitle}),l.jsxs("p",{className:"text-xs za-ink-dim",children:[e.years,e.years&&" · ",e.genres[0]]}),l.jsx("div",{className:"flex items-center gap-2 mt-0.5",children:l.jsx(Oa,{value:e.rating})}),l.jsxs("div",{className:"flex items-center justify-between mt-auto pt-2",children:[l.jsxs("div",{className:"flex gap-1.5",children:[e.formats.digital.available&&l.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:[l.jsx(Wr,{size:10})," Digital"]}),e.formats.usb.available&&l.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:[l.jsx(pr,{size:10})," USB"]})]}),l.jsxs("span",{className:"za-display text-sm text-purple-400",children:["$",e.formats.digital.price.toFixed(2),"+"]})]})]})]})}function yk(){return l.jsxs("div",{className:"rounded-[17px] overflow-hidden bg-[#0E1222] border border-[rgba(255,255,255,0.06)]",children:[l.jsx("div",{className:"za-skeleton aspect-[4/5] w-full"}),l.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[l.jsx("div",{className:"za-skeleton h-4 w-4/5 rounded"}),l.jsx("div",{className:"za-skeleton h-3 w-3/5 rounded"})]})]})}function Wm({items:e,onOpen:t,onQuickView:r,onShowAddMenu:n,loading:s}){return s?l.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)=>l.jsx(yk,{},a))}):l.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=>l.jsx(gk,{product:i,onOpen:t,onQuickView:r,onShowAddMenu:n},i.id))})}function Qr({eyebrow:e,title:t,action:r,onAction:n}){return l.jsxs("div",{className:"flex items-end justify-between mb-5",children:[l.jsxs("div",{children:[e&&l.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}),l.jsx("h2",{className:"za-display text-[28px] sm:text-[36px] text-white",children:t})]}),r&&l.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," ",l.jsx(zr,{size:15})]})]})}function vk({onNavigateDetail:e,onRunSearch:t}){const{products:r,recentSearches:n,pushRecentSearch:s}=Ue(),[i,a]=w.useState(""),[o,u]=w.useState(!1),[c,d]=w.useState(-1),h=w.useRef(null);dc(h,()=>u(!1));const f=w.useMemo(()=>{if(!i)return[];const y=i.toLowerCase(),b=[];for(const g of r)if(g.enabled&&(g.title.toLowerCase().includes(y)||g.genres.some(p=>p.toLowerCase().includes(y))||g.cast.some(p=>p.toLowerCase().includes(y))||g.years.includes(y))&&(b.push(g),b.length>=6))break;return b},[i,r]),m=(y,b)=>{s(y),u(!1),a(""),b?e(b):t(y)},x=y=>{o&&(y.key==="ArrowDown"&&(y.preventDefault(),d(b=>Math.min(b+1,f.length-1))),y.key==="ArrowUp"&&(y.preventDefault(),d(b=>Math.max(b-1,0))),y.key==="Enter"&&(y.preventDefault(),c>=0&&f[c]?m(f[c].title,f[c].slug):i&&m(i)),y.key==="Escape"&&u(!1))};return l.jsxs("div",{ref:h,className:"relative w-full",children:[l.jsxs("div",{className:"flex items-center bg-white/5 border border-white/[0.08] rounded-full px-4 py-2.5 gap-2",children:[l.jsx(Is,{size:16,className:"text-[#70768F] shrink-0"}),l.jsx("input",{value:i,onFocus:()=>u(!0),onChange:y=>{a(y.target.value),d(-1)},onKeyDown:x,placeholder:"Search titles, cast, genre, or decade…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white"}),i&&l.jsx("button",{onClick:()=>a(""),className:"za-focus",children:l.jsx(Et,{size:14,className:"text-[#70768F]"})})]}),o&&l.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?l.jsxs("div",{className:"p-4",children:[l.jsxs("p",{className:"text-[11px] uppercase tracking-widest text-[#70768F] mb-2 flex items-center gap-1.5",children:[l.jsx(ka,{size:12})," Trending Searches"]}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:hk.map(y=>l.jsx("button",{onClick:()=>m(y),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:y},y))}),n.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-[11px] uppercase tracking-widest text-[#70768F] mb-2 flex items-center gap-1.5",children:[l.jsx(ic,{size:12})," Recent Searches"]}),l.jsx("div",{className:"flex flex-col",children:n.map(y=>l.jsx("button",{onClick:()=>m(y),className:"za-focus text-left px-2 py-1.5 rounded hover:bg-white/5 text-sm text-[#A7ABC0] hover:text-white",children:y},y))})]})]}):f.length===0?l.jsxs("div",{className:"p-6 text-sm text-[#70768F] text-center",children:['No matches for "',i,'" — try a genre, decade, or actor.']}):l.jsx("div",{className:"py-2",children:f.map((y,b)=>l.jsxs("button",{onMouseDown:()=>m(y.title,y.slug),className:`za-focus w-full text-left px-3 py-2 flex items-center gap-3 ${c===b?"bg-white/5":"hover:bg-white/5"}`,children:[l.jsx(Hr,{product:y,className:"w-10 h-12 shrink-0 rounded-lg"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"za-display text-sm truncate text-white",children:y.title}),l.jsxs("p",{className:"text-xs text-[#70768F]",children:[y.years," · ",y.genres[0]]})]})]},y.id))})})]})}function xk({onNav:e}){const{products:t}=Ue(),[r,n]=w.useState(!1),s=w.useRef(null);dc(s,()=>n(!1));const i=w.useMemo(()=>[...t].filter(a=>a.enabled).sort((a,o)=>o.rating*Math.log(o.reviewCount+2)-a.rating*Math.log(a.reviewCount+2)).slice(0,10),[t]);return l.jsxs("div",{ref:s,className:"relative",children:[l.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:[l.jsx(ka,{size:14})," Top 10 ",l.jsx(eo,{size:13,className:`transition-transform ${r?"rotate-180":""}`})]}),r&&l.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:[l.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:[l.jsx(ka,{size:12})," Top 10 Right Now"]}),l.jsxs("div",{className:"py-1",children:[i.map((a,o)=>l.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:[l.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:o+1}),l.jsx(Hr,{product:a,className:"w-9 h-11 shrink-0 rounded-lg"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"za-display text-sm truncate text-white",children:a.title}),l.jsxs("p",{className:"text-xs text-[#70768F]",children:[a.years," · ",a.genres[0]]})]})]},a.id)),i.length===0&&l.jsx("p",{className:"px-3 py-4 text-sm text-[#70768F]",children:"No titles yet."})]}),l.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 wk({theme:e,setTheme:t,onNav:r,currentView:n,onWishlistOpen:s}){const{wishlist:i}=Ue(),[a,o]=w.useState(!1);return l.jsx("header",{className:"sticky top-0 z-40 za-glass border-b border-[rgba(255,255,255,0.06)]",children:l.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12",children:[l.jsxs("div",{className:"flex items-center justify-between h-16 gap-4",children:[l.jsxs("button",{onClick:()=>r("home"),className:"exp-logo",children:[l.jsx("img",{src:"/logo.webp",alt:"TvSeriesArchive",style:{height:38,width:"auto",borderRadius:6}}),l.jsxs("span",{className:"exp-logo-text",children:["TvSeries",l.jsx("span",{children:"Archive"})]})]}),l.jsxs("nav",{className:"hidden lg:flex items-center gap-8 text-sm text-[#A7ABC0]",children:[l.jsxs("button",{onClick:()=>r("home"),className:`za-focus relative hover:text-white transition-colors ${n==="home"?"text-white":""}`,children:["Home",n==="home"&&l.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)]"})]}),l.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"&&l.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)]"})]}),l.jsx("button",{onClick:()=>r("blog"),className:`za-focus hover:text-white transition-colors ${n==="blog"||n&&n.startsWith("blog-")?"text-white":""}`,children:"Blog"}),l.jsxs("button",{onClick:()=>r("quiz-hub"),className:`za-focus hover:text-white transition-colors flex items-center gap-1 ${n&&n.startsWith("quiz")?"text-white":""}`,children:[l.jsx(Bl,{size:13})," Quiz"]}),l.jsxs("button",{onClick:()=>r("listing",{sort:"newest"}),className:"za-focus hover:text-white transition-colors flex items-center gap-1",children:[l.jsx(ba,{size:13})," New Arrivals"]}),l.jsx(xk,{onNav:r})]}),l.jsx("div",{className:"flex-1 hidden lg:block max-w-md mx-4",children:l.jsx(vk,{onNavigateDetail:u=>r("detail",{slug:u}),onRunSearch:u=>r("listing",{q:u})})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>r("quiz-hub"),className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Quiz",children:l.jsx(Bl,{size:18,className:n&&n.startsWith("quiz")?"text-purple-400":"text-[#A7ABC0]"})}),l.jsxs("button",{onClick:s,className:"za-focus relative p-2 rounded-full hover:bg-white/5","aria-label":"Wishlist",children:[l.jsx(An,{size:18,className:"text-[#A7ABC0] hover:text-white transition-colors"}),i.length>0&&l.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:i.length})]}),l.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"?l.jsx(gx,{size:18,className:"text-[#A7ABC0]"}):l.jsx(hx,{size:18,className:"text-[#A7ABC0]"})}),l.jsx("button",{onClick:()=>{o(!0),setTimeout(()=>{var u;return(u=document.getElementById("mob-search"))==null?void 0:u.focus()},100)},className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Search",children:l.jsx(Is,{size:18,className:"text-[#A7ABC0]"})}),l.jsx("button",{onClick:()=>o(u=>!u),className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Menu",children:a?l.jsx(Et,{size:18,className:"text-[#A7ABC0]"}):l.jsx(cx,{size:18,className:"text-[#A7ABC0]"})})]})]}),a&&l.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:[l.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:[l.jsx(Is,{size:14,className:"text-[#70768F] shrink-0"}),l.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:u=>{if(u.key==="Enter"){const c=u.target.value.trim();c&&(r("listing",{query:c}),o(!1))}}})]}),[["home","Home"],["listing","All Series"],["blog","Blog"],["quiz-hub","Quiz"],["listing_newest","New Arrivals"],["myorders","My Orders"]].map(([u,c])=>l.jsx("button",{onClick:()=>{u==="listing_newest"?r("listing",{sort:"newest"}):r(u),o(!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},u)),l.jsxs("button",{onClick:()=>{r("listing",{sort:"popularity"}),o(!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:[l.jsx(ka,{size:14})," Top 10"]})]})]})})}function bk({onNav:e}){const t=[["contact","Contact"],["faq","FAQ"],["delivery","Delivery Information"],["digitalAccess","Digital Download"],["usbCollections","USB Explained"],["refund","Refund Policy"],["archiveRequest","Archive Request"],["privacy","Privacy Policy"],["terms","Terms of Service"]];return l.jsxs("footer",{className:"bg-[#050711] border-t border-[rgba(255,255,255,0.06)] mt-8",children:[l.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:[l.jsxs("div",{className:"lg:col-span-1",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[l.jsx("img",{src:"/logo.webp",alt:"TvSeriesArchive",style:{height:34,width:"auto",borderRadius:5}}),l.jsxs("span",{className:"exp-logo-text",style:{fontSize:16},children:["TvSeries",l.jsx("span",{children:"Archive"})]})]}),l.jsx("p",{className:"text-sm text-[#70768F] leading-relaxed",children:"A premium digital and USB archive for classic TV series and film collections."})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Shop"}),l.jsxs("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:[l.jsx("li",{children:l.jsx("button",{onClick:()=>e("listing"),className:"za-focus hover:text-purple-400 transition-colors",children:"All Series"})}),l.jsx("li",{children:l.jsx("button",{onClick:()=>e("listing",{sort:"newest"}),className:"za-focus hover:text-purple-400 transition-colors",children:"New Arrivals"})}),l.jsx("li",{children:l.jsx("button",{onClick:()=>e("listing",{sort:"popularity"}),className:"za-focus hover:text-purple-400 transition-colors",children:"Top 10"})})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Account"}),l.jsxs("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:[l.jsx("li",{children:l.jsx("button",{onClick:()=>e("myorders"),className:"za-focus hover:text-purple-400 transition-colors",children:"My Orders"})}),l.jsx("li",{children:l.jsx("button",{onClick:()=>e("listing",{wishlistOnly:!0}),className:"za-focus hover:text-purple-400 transition-colors",children:"Wishlist"})})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Help"}),l.jsx("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:t.slice(0,5).map(([r,n])=>l.jsx("li",{children:l.jsx("button",{onClick:()=>e("trust",{page:r}),className:"za-focus hover:text-purple-400 transition-colors",children:n})},r))})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"za-display text-sm text-white mb-4",children:"Policies"}),l.jsx("ul",{className:"text-sm text-[#70768F] space-y-2.5",children:t.slice(5).map(([r,n])=>l.jsx("li",{children:l.jsx("button",{onClick:()=>e("trust",{page:r}),className:"za-focus hover:text-purple-400 transition-colors",children:n})},r))})]})]}),l.jsxs("div",{className:"border-t border-[rgba(255,255,255,0.06)] py-6 text-center text-xs text-[#70768F]",children:[l.jsxs("div",{children:["© ",new Date().getFullYear()," TvSeriesArchive. All rights reserved."]}),l.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 Kn({label:e,checked:t,onChange:r,count:n}){return l.jsxs("label",{className:"za-focus flex items-center justify-between gap-2 py-1.5 cursor-pointer text-sm text-[#A7ABC0]",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"checkbox",checked:t,onChange:r,className:"accent-purple-500"}),e]}),typeof n=="number"&&l.jsx("span",{className:"text-[#70768F] text-xs",children:n})]})}function Gn({title:e,children:t,defaultOpen:r=!0}){const[n,s]=w.useState(r);return l.jsxs("div",{className:"py-3 border-b border-[rgba(255,255,255,0.06)]",children:[l.jsxs("button",{onClick:()=>s(i=>!i),className:"za-focus w-full flex items-center justify-between mb-1",children:[l.jsx("span",{className:"za-display text-sm text-white",children:e}),l.jsx(eo,{size:14,className:`text-[#70768F] transition-transform ${n?"rotate-180":""}`})]}),n&&l.jsx("div",{children:t})]})}function kk({onNav:e,initialFilters:t,onQuickView:r,onShowAddMenu:n}){const{products:s,wishlist:i,loaded:a}=Ue(),[o,u]=w.useState({genre:t.genre?[t.genre]:[],decade:t.decade?[t.decade]:[],country:[],language:[],format:t.format?[t.format]:[]}),[c,d]=w.useState(t.sort||"popularity"),[h,f]=w.useState(t.query||""),[m,x]=w.useState(Ho),[y,b]=w.useState(!1),g=!!t.wishlistOnly,p=pt(),v=g?"My Wishlist":t.genre?`${t.genre} TV Series`:t.decade?`${t.decade} TV Series`:t.format?`${t.format==="digital"?"Digital":"USB"} Collections`:"All Collections";$n({title:v,description:`Browse ${v.toLowerCase()} — complete classic TV series collections, available on Digital and USB, delivered worldwide.`,path:`${p.pathname}${p.search}`,noindex:!!(t.query||g)});const k=w.useMemo(()=>s.filter(j=>j.enabled),[s]),_=w.useMemo(()=>Array.from(new Set(k.map(j=>j.country))).sort(),[k]),E=w.useMemo(()=>Array.from(new Set(k.map(j=>j.language))).sort(),[k]),C=w.useMemo(()=>{const j=h.toLowerCase();let L=k.filter(S=>!(g&&!i.includes(S.id)||o.genre.length&&!o.genre.some(N=>S.genres.includes(N))||o.decade.length&&!o.decade.some(N=>S.decades.includes(N))||o.country.length&&!o.country.includes(S.country)||o.language.length&&!o.language.includes(S.language)||o.format.length&&!o.format.some(N=>{var R;return(R=S.formats[N])==null?void 0:R.available})||j&&!`${S.title} ${S.genres.join(" ")} ${S.cast.join(" ")} ${S.country} ${S.decades.join(" ")} ${S.years}`.toLowerCase().includes(j)));switch(c){case"az":L.sort((S,N)=>S.title.localeCompare(N.title));break;case"newest":L.sort((S,N)=>N.createdAt-S.createdAt);break;case"price-asc":L.sort((S,N)=>S.formats.digital.price-N.formats.digital.price);break;case"price-desc":L.sort((S,N)=>N.formats.digital.price-S.formats.digital.price);break;default:L.sort((S,N)=>N.reviewCount+(N.bestSeller?1e3:0)-(S.reviewCount+(S.bestSeller?1e3:0)))}return L},[k,o,c,h,g,i]);w.useEffect(()=>{x(Ho)},[o,c,h]);const P=C.slice(0,m),T=l.jsxs("aside",{className:"w-full lg:w-64 shrink-0",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("h3",{className:"za-display text-lg flex items-center gap-2 text-white",children:[l.jsx(Td,{size:16})," Filters"]}),l.jsx("button",{onClick:()=>u({genre:[],decade:[],country:[],language:[],format:[]}),className:"za-focus text-xs text-[#70768F] hover:text-white",children:"Clear"})]}),l.jsx(Gn,{title:"Format",children:["digital","usb"].map(j=>l.jsx(Kn,{label:j==="digital"?"Digital":"USB",checked:o.format.includes(j),onChange:()=>u(L=>({...L,format:L.format.includes(j)?L.format.filter(S=>S!==j):[...L.format,j]}))},j))}),l.jsx(Gn,{title:"Genre",children:ei.map(j=>l.jsx(Kn,{label:j,checked:o.genre.includes(j),onChange:()=>u(L=>({...L,genre:L.genre.includes(j)?L.genre.filter(S=>S!==j):[...L.genre,j]}))},j))}),l.jsx(Gn,{title:"Decade",children:uc.map(j=>l.jsx(Kn,{label:j,checked:o.decade.includes(j),onChange:()=>u(L=>({...L,decade:L.decade.includes(j)?L.decade.filter(S=>S!==j):[...L.decade,j]}))},j))}),l.jsx(Gn,{title:"Country",defaultOpen:!1,children:_.map(j=>l.jsx(Kn,{label:j,checked:o.country.includes(j),onChange:()=>u(L=>({...L,country:L.country.includes(j)?L.country.filter(S=>S!==j):[...L.country,j]}))},j))}),l.jsx(Gn,{title:"Language",defaultOpen:!1,children:E.map(j=>l.jsx(Kn,{label:j,checked:o.language.includes(j),onChange:()=>u(L=>({...L,language:L.language.includes(j)?L.language.filter(S=>S!==j):[...L.language,j]}))},j))})]});return l.jsxs("div",{className:"max-w-[1440px] mx-auto px-5 sm:px-8 lg:px-12 py-8 sm:py-10",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-4",children:[l.jsx("button",{onClick:()=>e("home"),className:"za-focus hover:text-white",children:"Home"}),l.jsx(zr,{size:12}),l.jsx("span",{className:"text-white/60",children:g?"My Wishlist":"Collections"})]}),l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white",children:g?"My Wishlist":"All Collections"}),l.jsxs("button",{onClick:()=>b(!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:[l.jsx(Td,{size:14})," Filter"]})]}),l.jsxs("div",{className:"flex gap-8",children:[l.jsx("div",{className:"hidden lg:block",children:T}),y&&l.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>b(!1)}),l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"za-display text-lg text-white",children:"Filters"}),l.jsx("button",{onClick:()=>b(!1),className:"za-focus p-1",children:l.jsx(Et,{size:18,className:"text-[#A7ABC0]"})})]}),T,l.jsxs("button",{onClick:()=>b(!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 ",C.length," Results"]})]})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5",children:[l.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:[l.jsx(Is,{size:15,className:"text-[#70768F] shrink-0"}),l.jsx("input",{value:h,onChange:j=>f(j.target.value),placeholder:"Search within results…",className:"bg-transparent outline-none text-sm w-full placeholder:text-[#70768F] text-white"})]}),l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsxs("span",{className:"text-[#70768F]",children:[C.length," results"]}),l.jsxs("select",{value:c,onChange:j=>d(j.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:[l.jsx("option",{value:"popularity",className:"bg-[#0E1222]",children:"Popularity"}),l.jsx("option",{value:"newest",className:"bg-[#0E1222]",children:"Newest"}),l.jsx("option",{value:"az",className:"bg-[#0E1222]",children:"A–Z"}),l.jsx("option",{value:"price-asc",className:"bg-[#0E1222]",children:"Price: Low to High"}),l.jsx("option",{value:"price-desc",className:"bg-[#0E1222]",children:"Price: High to Low"})]})]})]}),C.length===0?l.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…"}):l.jsxs(l.Fragment,{children:[l.jsx(Wm,{items:P,onOpen:j=>e("detail",{slug:j}),onQuickView:r,onShowAddMenu:n}),m<C.length&&l.jsx("div",{className:"text-center mt-8",children:l.jsxs("button",{onClick:()=>x(j=>j+Ho),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 (",C.length-m," remaining)"]})})]})]})]})]})}function _r({label:e,value:t}){return!t&&t!==0?null:l.jsxs("div",{className:"flex justify-between py-2.5 border-b border-[rgba(255,255,255,0.06)] text-sm",children:[l.jsx("span",{className:"text-[#70768F]",children:e}),l.jsx("span",{className:"za-display text-right text-white",children:t})]})}function Hm({product:e,format:t,setFormat:r}){const n=["digital","usb"].filter(i=>e.formats[i].available),s=n.indexOf(t);return l.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&&l.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 l.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:[l.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wide mb-0.5",children:[i==="digital"?l.jsx(Wr,{size:11}):l.jsx(pr,{size:11}),i==="digital"?"Digital":"USB"]}),l.jsxs("p",{className:"za-display text-sm",children:["$",e.formats[i].price.toFixed(2)]})]},i)})]})}function _k({format:e}){const t=e==="digital"?[{icon:zs,title:"Order Placed",desc:"Payoneer payment link emailed to you."},{icon:wa,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:gr,title:"Access Sent",desc:"Your download link arrives by email."},{icon:$t,title:"Delivered",desc:"Watch anytime."}]:[{icon:zs,title:"Order Placed",desc:"Payoneer payment link emailed to you."},{icon:wa,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:Br,title:"USB Shipped",desc:"Tracking number added to your order."},{icon:$t,title:"Delivered",desc:"Plug in and start watching."}];return l.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.map((r,n)=>l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.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}),l.jsx(r.icon,{size:15,className:"text-purple-400"})]}),l.jsx("p",{className:"za-display text-sm text-white",children:r.title}),l.jsx("p",{className:"text-xs text-[#70768F] mt-1 leading-snug",children:r.desc})]},r.title))})}function Sk({slug:e,title:t,onNav:r}){const n=X1(e);return n?l.jsxs("button",{onClick:()=>r("quiz-play",{slug:n.slug}),className:"za-focus quiz-promo-card group w-full mt-14 flex items-center gap-5 text-left rounded-[20px] p-6 relative overflow-hidden transition-all hover:-translate-y-1",style:{"--quiz-accent":n.accent,background:`radial-gradient(circle at 15% 20%, ${n.accent}30, transparent 55%), linear-gradient(135deg, #171226, #0E1222 60%)`,boxShadow:`0 0 0 1.5px ${n.accent}55, 0 20px 50px -15px ${n.accent}45`},children:[l.jsxs("span",{className:"absolute top-0 right-0 text-[10px] uppercase tracking-wide font-bold px-3 py-1.5 rounded-bl-[14px] text-white flex items-center gap-1",style:{background:`linear-gradient(135deg, ${n.accent}, #405DFF)`},children:[l.jsx(um,{size:11})," Play & Share"]}),l.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center shrink-0 quiz-promo-icon",style:{background:`linear-gradient(135deg, ${n.accent}, #405DFF)`,boxShadow:`0 8px 24px ${n.accent}55`},children:l.jsx(Bl,{size:26,className:"text-white"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"za-display text-white text-lg leading-snug",children:["Think you ",l.jsx("em",{style:{color:n.accent,fontStyle:"normal"},children:"really"})," know ",t,"?"]}),l.jsxs("p",{className:"text-[13px] text-[#A7ABC0] mt-1",children:[n.questions.length," questions · ",Z1(n)," pts max · brag on the leaderboard"]})]}),l.jsxs("span",{className:"za-display shrink-0 text-sm text-white px-5 py-2.5 rounded-full flex items-center gap-1.5 transition-transform group-hover:translate-x-1",style:{background:`linear-gradient(135deg, ${n.accent}, #405DFF)`,boxShadow:`0 10px 25px ${n.accent}40`},children:["Play Now ",l.jsx(zr,{size:15})]})]}):null}function Ek({slug:e,onNav:t,onShowAddMenu:r,onQuickView:n}){const s=Ue(),i=io(),{products:a,wishlist:o,toggleWishlist:u,loaded:c}=s,d=a.find(U=>U.slug===e),[h,f]=w.useState(d!=null&&d.formats.digital.available?"digital":"usb"),[m,x]=w.useState(""),y=w.useRef(null),[b,g]=w.useState(0),[p,v]=w.useState([]),[k,_]=w.useState(""),[E,C]=w.useState(5),[P,T]=w.useState(""),[j,L]=w.useState(""),[S,N]=w.useState("idle"),[R,z]=w.useState("");w.useEffect(()=>{if(!d){v([]);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(U=>U.json()).then(v).catch(()=>v([]))},[d==null?void 0:d.id]);const H=async()=>{if(k.trim()){N("verifying"),z("");try{const{data:U,error:K}=await ne.rpc("can_review",{p_email:k.trim(),p_product_id:d.id});if(K)throw K;U?(N("verified"),L(k.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.")}}},W=async()=>{if(!(!P.trim()||E<1)){N("submitting"),z("");try{const{data:U,error:K}=await ne.rpc("submit_review",{p_product_id:d.id,p_author:j.trim()||k.trim().split("@")[0],p_rating:E,p_text:P.trim(),p_email:k.trim()});if(K)throw K;U.error?(N("error"),z(U.error)):(N("success"),z("Review submitted! Thank you."),T(""),C(5),setTimeout(()=>{N("idle"),z(""),_("")},3e3))}catch{N("error"),z("Could not submit review. Try again.")}}},O=()=>{N("idle"),z(""),_(""),T(""),L(""),C(5)},B=w.useMemo(()=>d?a.filter(U=>U.enabled&&U.id!==d.id&&U.genres.some(K=>d.genres.includes(K))).slice(0,4):[],[a,d]);if($n({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:Ir},offers:[...d.formats.digital.available?[{"@type":"Offer",url:`${Ie}/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:"Google Drive download link emailed after payment is confirmed.",hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",returnPolicyCategory:"https://schema.org/MerchantReturnNotPermitted"}}]:[],...d.formats.usb.available?[{"@type":"Offer",url:`${Ie}/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)}},{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:Ie},{"@type":"ListItem",position:2,name:d.genres[0],item:`${Ie}/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 c?l.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-24 text-center za-fade-view",children:[l.jsx("h1",{className:"za-display text-3xl mb-3",children:"Series not found"}),l.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."}),l.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"})]}):l.jsx("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center za-ink-dim",children:"Loading…"});const q=[`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),J={digital:[{icon:gr,text:"Instant access — download link sent to your email"},{icon:ox,text:"Watch on any device: computer, tablet, phone, smart TV"},{icon:ba,text:"No physical storage needed — your library lives in the cloud"},{icon:sx,text:`Best value at $${d.formats.digital.price.toFixed(2)}`}],usb:[{icon:pr,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:fx,text:"Beautiful shelf display for the dedicated collector"},{icon:Br,text:"Tracked worldwide shipping with replacement guarantee"}]},Q=[{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 l.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:[l.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-6 flex-wrap",children:[l.jsx("button",{onClick:()=>t("home"),className:"za-focus hover:text-white",children:"Home"}),l.jsx(zr,{size:12}),l.jsx("button",{onClick:()=>t("listing",{genre:d.genres[0]}),className:"za-focus hover:text-white",children:d.genres[0]}),l.jsx(zr,{size:12}),d.decades[0]&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>t("listing",{decade:d.decades[0]}),className:"za-focus hover:text-white",children:d.decades[0]}),l.jsx(zr,{size:12})]}),l.jsx("span",{className:"text-white/60",children:d.displayTitle})]}),l.jsxs("div",{className:"grid lg:grid-cols-[340px_1fr] gap-8 items-start",children:[l.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[l.jsx(Hr,{product:d,className:"w-full aspect-[3/4] rounded-[17px]",eager:!0}),l.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:[l.jsxs("h2",{className:"za-display text-lg text-white mb-2 flex items-center gap-2",children:[l.jsx(Fl,{size:16,className:"text-purple-400"})," About This Collection"]}),l.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:d.longDesc})]})]}),l.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[d.needsReview&&l.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:[l.jsx(ba,{size:11})," Metadata auto-generated by AI"]}),l.jsx("h1",{className:"za-display text-3xl sm:text-4xl leading-tight text-white",children:d.displayTitle}),l.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[l.jsx(Oa,{value:d.rating}),l.jsx("span",{className:"text-sm text-[#70768F]",children:d.rating.toFixed(1)})]}),l.jsx("p",{className:"text-[#A7ABC0] mt-4 leading-relaxed",children:d.shortDesc}),l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[14px] p-4",children:[l.jsx("p",{className:"za-display text-xs text-white mb-2 uppercase tracking-wider",children:"Choose Format"}),l.jsx(Hm,{product:d,format:h,setFormat:f}),l.jsx("div",{className:"flex items-center gap-2 mt-3 text-[11px] text-[#70768F]",children:h==="digital"?l.jsxs(l.Fragment,{children:[l.jsx(gr,{size:12})," Email access after payment"]}):l.jsxs(l.Fragment,{children:[l.jsx(Br,{size:12})," Worldwide shipping, tracked"]})}),l.jsxs("button",{onClick:U=>{d.formats[h].available&&(i(U.currentTarget,Ki(d)),s.addToCart(d,h),x(`Added "${d.title}" (${h==="digital"?"Digital":"USB"}) to cart`),clearTimeout(y.current),y.current=setTimeout(()=>x(""),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:[l.jsx(_t,{size:15})," Add to Cart — $",d.formats[h].price.toFixed(2)]}),l.jsxs("button",{onClick:()=>u(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:[l.jsx(An,{size:14,className:o.includes(d.id)?"text-purple-400":"",fill:o.includes(d.id)?"currentColor":"none"}),o.includes(d.id)?"In Wishlist":"Add to Wishlist"]})]}),l.jsxs("div",{className:"mt-6",children:[l.jsx(_r,{label:"Years",value:d.years}),l.jsx(_r,{label:"Genre",value:d.genres.join(", ")}),l.jsx(_r,{label:"Country",value:d.country}),l.jsx(_r,{label:"Language",value:d.language}),l.jsx(_r,{label:"Seasons",value:d.seasons}),l.jsx(_r,{label:"Episodes",value:d.episodes||null}),l.jsx(_r,{label:"Quality",value:d.quality})]}),d.cast.length>0&&l.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:[l.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[l.jsx(_a,{size:16,className:"text-purple-400"})," Cast"]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((U,K)=>l.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:U},K)),d.cast.length>10&&l.jsxs("span",{className:"text-xs text-[#70768F] self-center",children:["+",d.cast.length-10," more"]})]})]})]}),l.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:[l.jsxs("h2",{className:"za-display text-lg text-white mb-2 flex items-center gap-2",children:[l.jsx(Fl,{size:16,className:"text-purple-400"})," About This Collection"]}),l.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:d.longDesc}),d.cast.length>0&&l.jsxs("div",{className:"mt-4 pt-4 border-t border-[rgba(255,255,255,0.06)]",children:[l.jsxs("h3",{className:"za-display text-sm text-white mb-2 flex items-center gap-2",children:[l.jsx(_a,{size:13,className:"text-purple-400"})," Cast"]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((U,K)=>l.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:U},K)),d.cast.length>10&&l.jsxs("span",{className:"text-xs text-[#70768F] self-center",children:["+",d.cast.length-10," more"]})]})]})]})]}),q.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"Collector's Choice",title:"Why Collectors Love This Series"}),l.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:q.map((U,K)=>l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-4 flex items-start gap-3",children:[l.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:K+1}),l.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:U})]},K))})]}),l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"Which Format?",title:"Digital Collection vs USB Collection"}),l.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[d.formats.digital.available&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx(Wr,{size:18,className:"text-purple-400"}),l.jsx("h3",{className:"za-display text-lg text-white",children:"Digital Collection"})]}),l.jsxs("p",{className:"text-sm text-[#70768F] mb-4 leading-relaxed",children:["$",d.formats.digital.price.toFixed(2)," · Google Drive download link emailed after payment is confirmed."]}),l.jsx("ul",{className:"flex flex-col gap-2",children:J.digital.map((U,K)=>l.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[l.jsx($t,{size:14,className:"text-purple-400 shrink-0 mt-0.5"}),l.jsx("span",{children:U.text})]},K))}),l.jsxs("button",{onClick:U=>{d.formats.digital.available&&(i(U.currentTarget,Ki(d)),s.addToCart(d,"digital"),x(`Added "${d.title}" (Digital) to cart`),clearTimeout(y.current),y.current=setTimeout(()=>x(""),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:[l.jsx(_t,{size:14})," Buy Digital — $",d.formats.digital.price.toFixed(2)]})]}),d.formats.usb.available&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx(pr,{size:18,className:"text-blue-400"}),l.jsx("h3",{className:"za-display text-lg text-white",children:"USB Collection"})]}),l.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."]}),l.jsx("ul",{className:"flex flex-col gap-2",children:J.usb.map((U,K)=>l.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[l.jsx($t,{size:14,className:"text-blue-400 shrink-0 mt-0.5"}),l.jsx("span",{children:U.text})]},K))}),l.jsxs("button",{onClick:U=>{d.formats.usb.available&&(i(U.currentTarget,Ki(d)),s.addToCart(d,"usb"),x(`Added "${d.title}" (USB) to cart`),clearTimeout(y.current),y.current=setTimeout(()=>x(""),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:[l.jsx(_t,{size:14})," Buy USB — $",d.formats.usb.price.toFixed(2)]})]})]})]}),l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"How It Works",title:"Delivery Timeline"}),l.jsx(_k,{format:h})]}),l.jsx(Sk,{slug:d.slug,title:d.title,onNav:t}),l.jsxs("div",{className:"grid lg:grid-cols-3 gap-10 mt-14",children:[l.jsxs("div",{className:"lg:col-span-2",children:[l.jsx("h2",{className:"za-display text-2xl text-white mb-3",children:"Frequently Asked Questions"}),l.jsx("div",{className:"divide-y divide-[rgba(255,255,255,0.06)]",children:Q.map((U,K)=>l.jsxs("div",{className:"py-4",children:[l.jsxs("button",{onClick:()=>g(b===K?-1:K),className:"za-focus w-full flex items-center justify-between text-left",children:[l.jsx("span",{className:"za-display text-[15px] text-white",children:U.q}),l.jsx(eo,{size:16,className:`text-[#70768F] transition-transform ${b===K?"rotate-180":""}`})]}),b===K&&l.jsx("p",{className:"text-sm text-[#A7ABC0] mt-2.5 leading-relaxed pr-6",children:U.a})]},K))})]}),l.jsxs("div",{children:[l.jsx("h2",{className:"za-display text-xl text-white mb-3",children:"Compatibility"}),l.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",p.length),p.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"Reviews",title:`What Collectors Say About ${d.title}`}),l.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(U=>l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx(Oa,{value:U.rating}),l.jsx("span",{className:"text-xs text-[#70768F]",children:U.author})]}),l.jsxs("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:['"',U.text,'"']})]},U.id))})]}),l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"Review",title:"Write a Review"}),l.jsx("p",{className:"text-sm text-[#70768F] mb-4",children:"Purchased this collection? Verify your email and leave a review."}),S==="success"?l.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:[l.jsx($t,{size:16})," ",R]}):S==="verified"?l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 max-w-lg",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("span",{className:"text-xs text-[#70768F]",children:"Verified"}),l.jsx("button",{onClick:O,className:"text-xs text-purple-400 hover:text-purple-300",children:"Change"})]}),l.jsxs("div",{className:"mb-3",children:[l.jsx("label",{className:"text-[11px] text-[#70768F] block mb-1",children:"Display name"}),l.jsx("input",{value:j,onChange:U=>L(U.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"})]}),l.jsx("div",{className:"flex items-center gap-1 mb-4",children:[1,2,3,4,5].map(U=>l.jsx("button",{onClick:()=>C(U),className:"za-focus p-0.5",children:l.jsx(oc,{size:22,className:U<=E?"text-[#FFB800] fill-[#FFB800]":"text-[#70768F]"})},U))}),l.jsx("textarea",{value:P,onChange:U=>T(U.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"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{onClick:W,disabled:S==="submitting"||!P.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:[S==="submitting"?l.jsx(mr,{size:14,className:"animate-spin"}):l.jsx(px,{size:14}),S==="submitting"?"Submitting...":"Submit Review"]}),R&&l.jsx("span",{className:"text-xs text-red-400",children:R})]})]}):l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 max-w-lg",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("input",{value:k,onChange:U=>_(U.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"}),l.jsxs("button",{onClick:H,disabled:S==="verifying"||!k.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:[S==="verifying"?l.jsx(mr,{size:14,className:"animate-spin"}):l.jsx($t,{size:14}),S==="verifying"?"Checking...":"Verify"]})]}),R&&l.jsx("p",{className:"text-xs text-red-400 mt-2",children:R}),S==="error"&&l.jsx("button",{onClick:()=>N("idle"),className:"text-xs text-purple-400 mt-1 hover:text-purple-300",children:"Try again"})]})]}),B.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(Qr,{eyebrow:"Related",title:`More ${d.genres[0]} Collections You'll Love`}),l.jsxs("p",{className:"text-sm text-[#70768F] mb-4",children:["If you enjoyed ",l.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."]}),l.jsx(Wm,{items:B,onOpen:U=>t("detail",{slug:U}),onQuickView:n,onShowAddMenu:r})]}),l.jsx(ru,{message:m})]})}function bh({open:e,onClose:t,onCheckout:r}){const{cartItems:n,removeFromCart:s,products:i}=Ue(),a=w.useRef(null);dc(a,()=>e&&t());const o=n.map(c=>({...c,product:i.find(d=>d.id===c.productId)})).filter(c=>c.product),u=o.reduce((c,d)=>c+d.price,0);return l.jsxs("div",{className:`fixed inset-0 z-[60] ${e?"":"pointer-events-none"}`,children:[l.jsx("div",{className:`absolute inset-0 bg-black/60 transition-opacity ${e?"opacity-100":"opacity-0"}`}),l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[l.jsxs("h3",{className:"za-display text-xl text-white flex items-center gap-2",children:[l.jsx(_t,{size:18,className:"text-purple-400"})," Your Cart"]}),l.jsx("button",{onClick:t,className:"za-focus p-1",children:l.jsx(Et,{size:18,className:"text-[#A7ABC0]"})})]}),o.length===0?l.jsx("p",{className:"text-sm text-[#70768F]",children:"Your cart is empty. Add a collection to get started."}):l.jsxs("div",{className:"flex flex-col gap-3",children:[o.map((c,d)=>l.jsxs("div",{className:"flex gap-3 bg-white/5 border border-[rgba(255,255,255,0.06)] rounded-[13px] p-3",children:[l.jsx(Hr,{product:c.product,className:"w-12 h-14 shrink-0 rounded-lg"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"za-display text-sm truncate text-white",children:c.product.title}),l.jsx("p",{className:"text-xs text-[#70768F] capitalize",children:c.format}),l.jsxs("p",{className:"za-display text-sm text-purple-400 mt-1",children:["$",c.price.toFixed(2)]})]}),l.jsxs("button",{onClick:()=>s(d),className:"za-focus text-[#70768F] hover:text-red-400 flex items-center gap-1 text-xs",children:[l.jsx(Et,{size:12})," Remove"]})]},d)),l.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-[rgba(255,255,255,0.06)]",children:[l.jsx("span",{className:"za-display text-white",children:"Total"}),l.jsxs("span",{className:"za-display text-purple-400 text-lg",children:["$",u.toFixed(2)]})]}),l.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 ",l.jsx(om,{size:15})]})]})]})]})}function kh({target:e,onClose:t,showToast:r}){const n=Ue(),s=io(),[i,a]=w.useState(null);if(!e)return null;const{product:o,element:u}=e,c=()=>{!i||!o.formats[i].available||(s(u,Ki(o)),n.addToCart(o,i),r(`Added "${o.title}" (${i==="digital"?"Digital":"USB"}) to cart`),t())};return l.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",onClick:t,children:[l.jsx("div",{className:"absolute inset-0 bg-black/60"}),l.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:[l.jsxs("div",{className:"p-5 border-b border-[rgba(255,255,255,0.06)] flex items-center justify-between",children:[l.jsx("h3",{className:"za-display text-lg text-white",children:"Choose Format"}),l.jsx("button",{onClick:t,className:"za-focus p-1",children:l.jsx(Et,{size:18,className:"text-[#A7ABC0]"})})]}),l.jsxs("div",{className:"p-4 flex flex-col gap-3",children:[o.formats.digital.available&&l.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:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.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:l.jsx(Wr,{size:18,className:"text-purple-400"})}),l.jsxs("div",{children:[l.jsx("p",{className:"za-display text-sm text-white",children:"Digital Download"}),l.jsxs("p",{className:"text-[11px] text-[#70768F]",children:["Instant access",o.isHD?" · HD quality":""]})]})]}),l.jsxs("span",{className:"za-display text-purple-400 text-lg shrink-0",children:["$",o.formats.digital.price.toFixed(2)]})]}),o.formats.usb.available&&l.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:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/5 border border-white/10 flex items-center justify-center",children:l.jsx(pr,{size:18,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("p",{className:"za-display text-sm text-white",children:"USB Drive"}),l.jsx("p",{className:"text-[11px] text-[#70768F]",children:"Physical copy · Shipped worldwide"})]})]}),l.jsxs("span",{className:"za-display text-blue-400 text-lg shrink-0",children:["$",o.formats.usb.price.toFixed(2)]})]})]}),l.jsx("div",{className:"p-4 pt-0",children:l.jsxs("button",{onClick:c,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:[l.jsx(_t,{size:15})," Add to Cart ",i?`— $${o.formats[i].price.toFixed(2)}`:""]})})]})]})}function _h({product:e,onClose:t,onOpenFull:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i}=Ue(),[a,o]=w.useState("digital");return e?l.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:t}),l.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:[l.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:l.jsx(Et,{size:16,className:"text-white"})}),l.jsx(Hr,{product:e,className:"w-full h-full min-h-[220px]",eager:!0}),l.jsxs("div",{className:"p-5 overflow-y-auto",children:[l.jsx("h3",{className:"za-display text-2xl leading-tight text-white",children:e.displayTitle}),l.jsx("div",{className:"flex items-center gap-2 mt-2",children:l.jsx(Oa,{value:e.rating})}),l.jsx("p",{className:"text-sm text-[#A7ABC0] mt-3 leading-relaxed",children:e.shortDesc}),l.jsx("div",{className:"mt-4",children:l.jsx(Hm,{product:e,format:a,setFormat:o})}),l.jsxs("button",{onClick:u=>{n(e,u.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:[l.jsx(_t,{size:14})," Add to Cart — $",e.formats[a].price.toFixed(2)]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.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:[l.jsx(An,{size:13,className:s.includes(e.id)?"text-purple-400":"",fill:s.includes(e.id)?"currentColor":"none"})," Wishlist"]}),l.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 ru({message:e}){return e?l.jsx("div",{className:"fixed bottom-5 left-1/2 -translate-x-1/2 z-[70] za-toast",children:l.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:[l.jsx($t,{size:14,className:"text-purple-400"})," ",l.jsx("span",{className:"text-white",children:e})]})}):null}const Ck=[["USD","USD — US Dollar"],["GBP","GBP — British Pound"],["EUR","EUR — Euro"]];function jk({onNav:e}){const{cartItems:t,products:r,settings:n,placeOrder:s,removeFromCart:i}=Ue();$n({title:"Checkout",path:"/checkout",noindex:!0});const a=t.map(T=>({...T,product:r.find(j=>j.id===T.productId)})).filter(T=>T.product),o=a.some(T=>T.format==="usb"),u=a.reduce((T,j)=>T+j.price,0),c={AU:40,NZ:40},d=19.99,[h,f]=w.useState({name:"",email:"",phone:"",billing:"",shipping:"",city:"",postalCode:"",country:"",currency:"USD",notes:"",coupon:""}),[m,x]=w.useState({}),[y,b]=w.useState(!1),g=T=>j=>f(L=>({...L,[T]:j.target.value})),p=w.useRef(null),v=o?c[h.country]||d:0,k=h.coupon.trim().toUpperCase()==="ARCHIVE10",_=k?u*.1:0,E=u+v-_,C=()=>{var j;const T={};return h.name.trim()||(T.name="Please enter your full name."),/^\S+@\S+\.\S+$/.test(h.email)||(T.email="Please enter a valid email address."),o&&!h.shipping.trim()&&(T.shipping="A shipping address is required for USB orders."),o&&!h.city.trim()&&(T.city="City is required."),o&&!h.postalCode.trim()&&(T.postalCode="Postal code is required."),o&&!h.country&&(T.country="Please select your country for shipping calculation."),x(T),Object.keys(T).length>0&&((j=p.current)==null||j.scrollIntoView({behavior:"smooth",block:"start"})),Object.keys(T).length===0},P=async()=>{if(!C())return;b(!0);const T=o?`${h.shipping.trim()}, ${h.city.trim()}, ${h.postalCode.trim()}, ${h.country}`:"",j={id:$m(),number:E1(),createdAt:Date.now(),status:"pending_payment",customer:{name:h.name.trim(),email:h.email.trim(),phone:h.phone.trim()},billing:T,shipping:T,country:h.country||null,currency:h.currency,notes:h.notes.trim(),coupon:k?"ARCHIVE10":null,items:a.map(L=>({productId:L.product.id,title:L.product.displayTitle,format:L.format,price:L.price})),subtotal:u,shippingCost:v,discount:_,total:E,tracking:null,accessLinks:{}};try{await s(j),e("confirmation",{orderId:j.id,email:j.customer.email})}catch{b(!1),alert("We couldn't place your order — please try again in a moment.")}};return a.length===0?l.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[l.jsx(_t,{size:40,className:"text-[#70768F] mx-auto mb-4"}),l.jsx("h1",{className:"za-display text-2xl mb-2 text-white",children:"Your cart is empty"}),l.jsx("p",{className:"text-[#70768F] text-sm mb-6",children:"Add a collection to your cart before checking out."}),l.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"})]}):l.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:[l.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white mb-8",children:"Checkout"}),l.jsxs("div",{className:"grid lg:grid-cols-[1fr_380px] gap-8",children:[l.jsxs("div",{className:"flex flex-col gap-5",children:[l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("h2",{className:"za-display text-lg text-white mb-4 flex items-center gap-2",children:[l.jsx(_t,{size:16,className:"text-purple-400"})," Order Summary"]}),l.jsx("div",{className:"flex flex-col gap-3",children:a.map((T,j)=>l.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:[l.jsx(Hr,{product:T.product,className:"w-16 h-20 shrink-0 rounded-lg",eager:!0}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"za-display text-sm text-white leading-snug",children:T.product.title}),l.jsxs("p",{className:"text-xs text-[#70768F] mt-1",children:[T.product.years," · ",T.product.genres[0]]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[l.jsxs("span",{className:"flex items-center gap-1 text-[11px] px-2 py-1 rounded bg-white/5 text-purple-300/80 capitalize",children:[T.format==="digital"?l.jsx(Wr,{size:11}):l.jsx(pr,{size:11})," ",T.format]}),l.jsxs("span",{className:"text-purple-400 za-display text-sm",children:["$",T.price.toFixed(2)]})]})]}),l.jsx("button",{onClick:()=>{i(j),a.length<=1&&e("home")},className:"text-[#70768F] hover:text-red-400 transition-colors p-1 shrink-0",title:"Remove item",children:l.jsx(Et,{size:14})})]},j))})]}),l.jsxs("div",{ref:p,className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Contact Details"}),l.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("input",{className:"za-input",placeholder:"Full name *",value:h.name,onChange:g("name")}),m.name&&l.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:m.name})]}),l.jsxs("div",{children:[l.jsx("input",{className:"za-input",type:"email",placeholder:"Email address *",value:h.email,onChange:g("email")}),m.email&&l.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:m.email})]}),l.jsx("input",{className:"za-input sm:col-span-2",placeholder:"Phone (optional, for WhatsApp updates)",value:h.phone,onChange:g("phone")})]})]}),o&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("h2",{className:"za-display text-lg mb-1 flex items-center gap-2 text-white",children:[l.jsx(Br,{size:16,className:"text-purple-400"})," Shipping"]}),l.jsx("p",{className:"text-xs text-[#70768F] mb-3",children:"Required — your cart contains a USB collection."}),l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsx("textarea",{className:"za-input",rows:2,placeholder:"Street address *",value:h.shipping,onChange:g("shipping")}),m.shipping&&l.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:m.shipping}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx("input",{className:"za-input",placeholder:"City *",value:h.city,onChange:g("city")}),l.jsx("input",{className:"za-input",placeholder:"Postal code *",value:h.postalCode,onChange:g("postalCode")})]}),l.jsxs("div",{children:[l.jsxs("select",{className:"za-input",value:h.country,onChange:g("country"),children:[l.jsx("option",{value:"",children:"Select country *"}),l.jsx("option",{value:"US",children:"United States — $19.99"}),l.jsx("option",{value:"GB",children:"United Kingdom — $19.99"}),l.jsx("option",{value:"CA",children:"Canada — $19.99"}),l.jsx("option",{value:"AU",children:"Australia — $40.00"}),l.jsx("option",{value:"NZ",children:"New Zealand — $40.00"}),l.jsx("option",{value:"DE",children:"Germany — $19.99"}),l.jsx("option",{value:"FR",children:"France — $19.99"}),l.jsx("option",{value:"OTHER",children:"Other — $19.99"})]}),m.country&&l.jsx("p",{className:"text-xs text-[#FFB800] mt-1",children:m.country})]})]})]}),!o&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5 flex items-center gap-3",children:[l.jsx(gr,{size:18,className:"text-purple-400 shrink-0"}),l.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."})]}),l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsx("h2",{className:"za-display text-lg text-white mb-3",children:"Payment Currency"}),l.jsx("select",{className:"za-input",value:h.currency,onChange:g("currency"),children:Ck.map(([T,j])=>l.jsx("option",{value:T,children:j},T))})]}),l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Order Notes"}),l.jsx("textarea",{className:"za-input",rows:2,placeholder:"Anything we should know? (optional)",value:h.notes,onChange:g("notes")})]})]}),l.jsxs("div",{className:"lg:sticky lg:top-24 lg:self-start",children:[l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsx("h2",{className:"za-display text-lg text-white mb-4",children:"Payment Summary"}),l.jsxs("div",{className:"mt-5 pt-4 border-t border-[rgba(255,255,255,0.06)]",children:[l.jsx("div",{className:"flex gap-2 mb-4",children:l.jsx("input",{className:"za-input",placeholder:"Coupon code",value:h.coupon,onChange:g("coupon")})}),h.coupon&&l.jsx("p",{className:`text-xs -mt-3 mb-4 ${k?"text-[#42D392]":"text-[#FFB800]"}`,children:k?"ARCHIVE10 applied — 10% off.":"This code isn't valid."}),l.jsxs("div",{className:"flex flex-col gap-1.5 text-sm text-[#A7ABC0]",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Subtotal"}),l.jsxs("span",{className:"text-white",children:["$",u.toFixed(2)]})]}),_>0&&l.jsxs("div",{className:"flex justify-between text-[#42D392]",children:[l.jsx("span",{children:"Discount (10%)"}),l.jsxs("span",{children:["−$",_.toFixed(2)]})]}),o&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Shipping"}),l.jsxs("span",{className:"text-white",children:["$",v.toFixed(2)]})]}),l.jsxs("div",{className:"flex justify-between za-display text-xl pt-1.5 text-white",children:[l.jsx("span",{children:"Total"}),l.jsxs("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-blue-400",children:["$",E.toFixed(2)]})]})]}),l.jsxs("div",{className:"bg-white/5 rounded-[13px] p-4 mt-4 text-xs text-[#70768F] leading-relaxed",children:[l.jsxs("p",{className:"flex items-center gap-1.5 mb-1 za-display text-white text-sm",children:[l.jsx(zs,{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."]})]})]}),l.jsxs("div",{className:"hidden sm:block mt-4",children:[l.jsxs("button",{onClick:P,disabled:y,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:[y?l.jsx(mr,{size:15,className:"za-spin"}):l.jsx(hs,{size:15})," Place Order — $",E.toFixed(2)]}),l.jsxs("p",{className:"text-[11px] text-[#70768F] text-center mt-3 flex items-center justify-center gap-1",children:[l.jsx(hs,{size:11})," Your details are only used to process this order."]})]})]})]}),l.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:l.jsxs("button",{onClick:P,disabled:y,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:[y?l.jsx(mr,{size:15,className:"za-spin"}):l.jsx(hs,{size:15})," Place Order — $",E.toFixed(2)]})})]})}function Nk({orderId:e,email:t,onNav:r}){const{settings:n,lookupOrder:s}=Ue(),[i,a]=w.useState(null),[o,u]=w.useState(!0),[c,d]=w.useState(!1);if($n({title:"Order Confirmation",path:`/order-confirmation/${e}`,noindex:!0}),w.useEffect(()=>{let m=!0;return(async()=>{const x=await s(e,t);m&&(a(x),u(!1))})(),()=>{m=!1}},[e,t]),o)return l.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:[l.jsx(mr,{size:16,className:"za-spin"})," Loading your order…"]});if(!i)return l.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(m=>m.format==="digital");return l.jsxs("div",{className:"max-w-3xl mx-auto px-5 sm:px-8 py-12 za-fade-view",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.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:l.jsx($t,{size:26,className:"text-white"})}),l.jsx("h1",{className:"za-display text-3xl text-white",children:"Order placed"}),l.jsxs("p",{className:"text-[#A7ABC0] text-sm mt-2",children:["Order ",l.jsx("span",{className:"za-display text-purple-400",children:i.number})," · A confirmation was sent to ",i.customer.email]})]}),i.status==="pending_payment"&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[l.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[l.jsx(zs,{size:16,className:"text-purple-400"})," Payment Link Sent"]}),l.jsxs("div",{className:"text-sm text-[#A7ABC0] leading-relaxed space-y-3",children:[l.jsxs("p",{children:["A personalized ",l.jsx("strong",{className:"text-white",children:"Payoneer"})," payment link has been sent to ",l.jsx("strong",{className:"text-white",children:i.customer.email}),". Please check your inbox (and spam folder) for the payment instructions."]}),l.jsxs("p",{className:"pl-4",children:["• Once you complete the payment via Payoneer, your ",l.jsx("strong",{className:"text-white",children:"digital access link will be delivered instantly by email"})," — no waiting."]}),f.length===0&&l.jsx("p",{className:"pl-4",children:"• For USB orders, your collection will be prepared for shipping as soon as the payment is confirmed."}),l.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)&&l.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:[l.jsx(wa,{size:20,className:"text-purple-400 shrink-0"}),l.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"&&l.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:[l.jsx(cm,{size:20,className:"text-[#FFB800] shrink-0"}),l.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"&&l.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:[l.jsx(ac,{size:20,className:"text-[#FFB800] shrink-0"}),l.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["This order has been refunded. Contact ",n.supportEmail," with any questions."]})]}),h&&f.length>0&&l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-5",children:[l.jsxs("h2",{className:"za-display text-lg text-white mb-3 flex items-center gap-2",children:[l.jsx(gr,{size:16,className:"text-[#42D392]"})," Your Digital Download"]}),l.jsx("div",{className:"flex flex-col gap-2",children:f.map(m=>l.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 text-sm",children:[l.jsx("p",{className:"za-display text-white mb-1",children:m.title}),l.jsx("a",{href:i.accessLinks[m.productId],target:"_blank",rel:"noreferrer",className:"text-purple-400 break-all underline",children:i.accessLinks[m.productId]})]},m.productId))})]}),l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-6 mb-8",children:[l.jsx("h2",{className:"za-display text-lg text-white mb-3",children:"Order Summary"}),i.items.map((m,x)=>l.jsxs("div",{className:"flex justify-between text-sm py-1.5",children:[l.jsxs("span",{className:"text-[#A7ABC0]",children:[m.title," ",l.jsxs("span",{className:"capitalize",children:["(",m.format,")"]})]}),l.jsxs("span",{className:"text-white",children:["$",m.price.toFixed(2)]})]},x)),i.shippingCost>0&&l.jsxs("div",{className:"flex justify-between text-sm py-1.5",children:[l.jsx("span",{className:"text-[#A7ABC0]",children:"Shipping"}),l.jsxs("span",{className:"text-white",children:["$",i.shippingCost.toFixed(2)]})]}),l.jsxs("div",{className:"border-t border-[rgba(255,255,255,0.06)] mt-2 pt-2 flex justify-between za-display text-white",children:[l.jsx("span",{children:"Total"}),l.jsxs("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-blue-400",children:["$",i.total.toFixed(2)]})]})]}),l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.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"}),l.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"})]})]})}function Tk({onNav:e}){const{myOrders:t,settings:r,refreshMyOrders:n}=Ue(),[s,i]=w.useState(!0);return $n({title:"My Orders",path:"/my-orders",noindex:!0}),w.useEffect(()=>{(async()=>(await n(),i(!1)))()},[]),s?l.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center text-[#70768F] flex items-center justify-center gap-2",children:[l.jsx(mr,{size:16,className:"za-spin"})," Loading your orders…"]}):t.length===0?l.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[l.jsx(nx,{size:40,className:"text-[#70768F] mx-auto mb-4"}),l.jsx("h1",{className:"za-display text-2xl mb-2 text-white",children:"No orders yet"}),l.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."}),l.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"})]}):l.jsxs("div",{className:"max-w-4xl mx-auto px-5 sm:px-8 py-10 za-fade-view",children:[l.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white mb-8",children:"My Orders"}),l.jsx("div",{className:"flex flex-col gap-4",children:t.map(a=>{const o=xh[a.status]||xh.pending_payment,u=a.status==="access_granted"||a.status==="completed",c=a.items.filter(d=>d.format==="digital");return l.jsxs("div",{className:"bg-[#0E1222] border border-[rgba(255,255,255,0.06)] rounded-[17px] p-5",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"za-display text-white",children:a.number}),l.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)]})]}),l.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${o.tone}`,children:[l.jsx(o.icon,{size:15})," ",o.label]})]}),l.jsx("div",{className:"text-sm text-[#A7ABC0]",children:a.items.map((d,h)=>l.jsxs("p",{children:[d.title," ",l.jsxs("span",{className:"capitalize",children:["(",d.format,")"]})]},h))}),a.status==="pending_payment"&&l.jsx("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs text-[#70768F]",children:l.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."})}),!u&&c.length>0&&!["pending_payment","cancelled","refunded"].includes(a.status)&&l.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs text-[#70768F] flex items-center gap-2",children:[l.jsx(ic,{size:13})," Your digital download is pending approval."]}),u&&c.map(d=>l.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs flex flex-col gap-1",children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-white",children:[l.jsx(gr,{size:13,className:"text-[#42D392]"})," ",d.title]}),l.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&&l.jsxs("div",{className:"bg-white/5 rounded-[13px] p-3 mt-3 text-xs flex items-center gap-2 text-[#70768F]",children:[l.jsx(Br,{size:13,className:"text-purple-400"})," Tracking number: ",l.jsx("span",{className:"za-display text-white",children:a.tracking})]})]},a.id)})})]})}const Sh={contact:{title:"Contact Us",icon:gr,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:lm,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:ac,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:ax,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:Br,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."}]},usbCollections:{title:"USB Collections: Physical Delivery",icon:pr,intro:"How our USB flash drive collections work: what's included, shipping, and quality.",devices:[{icon:_a,label:"Smart TVs"},{icon:lx,label:"PC & Mac"},{icon:rx,label:"Car stereos"},{icon:um,label:"Game consoles"},{icon:dx,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:Is,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:Wr,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:"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:"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:"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:"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."},{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."}]}},Ak={digitalCollections:"digitalAccess"};function Rk({pageKey:e,onNav:t}){const r=Ak[e]||e,n=Sh[r]||Sh.contact,s=n.icon,i=r==="faq"&&n.faqs?{"@context":"https://schema.org","@type":"FAQPage",mainEntity:n.faqs.map(a=>({"@type":"Question",name:a.q,acceptedAnswer:{"@type":"Answer",text:a.a}}))}:null;return $n({title:n.title,description:n.intro,path:`/pages/${r||"contact"}`,jsonLd:i}),l.jsxs("div",{className:"max-w-3xl mx-auto px-5 sm:px-8 py-12 za-fade-view",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#70768F] mb-6",children:[l.jsx("button",{onClick:()=>t("home"),className:"za-focus hover:text-white",children:"Home"}),l.jsx(zr,{size:12}),l.jsx("span",{className:"text-white/60",children:n.title})]}),l.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[l.jsx(s,{size:22,className:"text-purple-400",strokeWidth:1.5}),l.jsx("h1",{className:"za-display text-3xl sm:text-4xl text-white",children:n.title})]}),l.jsx("p",{className:"text-[#A7ABC0] mb-8",children:n.intro}),n.devices&&l.jsx("div",{className:"flex flex-wrap gap-3 mb-8",children:n.devices.map(({icon:a,label:o})=>l.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:[l.jsx(a,{size:14,className:"text-purple-400"})," ",o]},o))}),n.faqs?l.jsx("div",{className:"divide-y divide-[rgba(255,255,255,0.06)]",children:n.faqs.map((a,o)=>l.jsx(Pk,{q:a.q,a:a.a},o))}):l.jsx("div",{className:"flex flex-col gap-6",children:n.sections.map(a=>l.jsxs("div",{children:[l.jsx("h2",{className:"za-display text-lg text-white mb-1.5",children:a.heading}),l.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:a.body}),a.email&&l.jsx("a",{href:`mailto:${a.email}`,className:"inline-block mt-2 za-focus text-purple-400 underline text-sm hover:text-purple-300 transition-colors",children:a.email})]},a.heading))}),l.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:[l.jsx(lm,{size:18,className:"text-purple-400 shrink-0"}),l.jsxs("p",{className:"text-sm text-[#A7ABC0]",children:["Still have a question? ",l.jsx("button",{onClick:()=>t("trust",{page:"contact"}),className:"za-focus text-purple-400 underline",children:"Contact us"}),"."]})]})]})}function Pk({q:e,a:t}){const[r,n]=w.useState(!1);return l.jsxs("div",{className:"py-4",children:[l.jsxs("button",{onClick:()=>n(s=>!s),className:"za-focus w-full flex items-center justify-between text-left",children:[l.jsx("span",{className:"za-display text-[15px] text-white",children:e}),l.jsx(eo,{size:16,className:`text-[#70768F] transition-transform ${r?"rotate-180":""}`})]}),r&&l.jsx("p",{className:"text-sm text-[#A7ABC0] mt-2.5 leading-relaxed pr-6",children:t})]})}function Ok(){J1();const e=Ue(),[t,r]=w.useState("dark"),n=pt(),s=em(),{view:i,params:a}=w.useMemo(()=>dk(n.pathname,n.search),[n.pathname,n.search]),[o,u]=w.useState(null),[c,d]=w.useState(!1),[h,f]=w.useState(!1),[m,x]=w.useState(""),y=w.useRef(null),[b,g]=w.useState(null),p=(_,E={})=>{s(ck(_,E)),window.scrollTo({top:0,behavior:"smooth"})},v=_=>{x(_),clearTimeout(y.current),y.current=setTimeout(()=>x(""),2200)},k=(_,E)=>g({product:_,element:E});return i==="home"||i==="designlab"?l.jsxs(vh,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:[l.jsx(wh,{}),l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"min-h-[80vh]"}),children:l.jsx(ek,{onNav:p,onQuickView:u,onShowAddMenu:k})}),l.jsx(_h,{product:o,onClose:()=>u(null),onOpenFull:_=>p("detail",{slug:_}),onShowAddMenu:k}),l.jsx(kh,{target:b,onClose:()=>g(null),showToast:v}),l.jsx(bh,{open:c,onClose:()=>d(!1),onCheckout:()=>p("checkout")}),l.jsx(ru,{message:m})]}):l.jsx(vh,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:l.jsxs("div",{className:"za-root min-h-screen",style:fk[t],children:[l.jsx(wh,{}),l.jsx(wk,{theme:t,setTheme:r,onNav:p,currentView:i,onWishlistOpen:()=>f(!0)}),l.jsxs("div",{className:"za-fade-view min-h-[60vh]",children:[i==="listing"&&l.jsx(kk,{onNav:p,initialFilters:a,onQuickView:u,onShowAddMenu:k}),i==="detail"&&l.jsx(Ek,{slug:a.slug,onNav:p,onShowAddMenu:k,onQuickView:u}),i==="checkout"&&l.jsx(jk,{onNav:p}),i==="confirmation"&&l.jsx(Nk,{orderId:a.orderId,email:a.email,onNav:p}),i==="myorders"&&l.jsx(Tk,{onNav:p}),l.jsx(Ti,{children:l.jsxs(w.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:[i==="blog"&&l.jsx(tk,{onNav:p,params:a}),i==="blog-article"&&l.jsx(rk,{slug:a.slug,onNav:p}),i==="blog-category"&&l.jsx(nk,{slug:a.slug,onNav:p}),i==="blog-tag"&&l.jsx(sk,{slug:a.slug,onNav:p}),i==="blog-author"&&l.jsx(ik,{slug:a.slug,onNav:p})]})}),i==="trust"&&l.jsx(Rk,{pageKey:a.page,onNav:p}),l.jsx(Ti,{children:l.jsxs(w.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:[i==="quiz-hub"&&l.jsx(lk,{onNav:p}),i==="quiz-play"&&l.jsx(uk,{slug:a.slug,onNav:p})]})}),i==="admin"&&l.jsx(Ti,{children:l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:l.jsx($1,{children:l.jsx(ok,{})})})}),l.jsx(Ti,{children:l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:i==="notfound"&&l.jsx(ak,{onNav:p})})})]},i+(a.slug||"")+(a.orderId||"")),l.jsx(bk,{onNav:p}),l.jsx(_h,{product:o,onClose:()=>u(null),onOpenFull:_=>p("detail",{slug:_}),onShowAddMenu:k}),l.jsx(kh,{target:b,onClose:()=>g(null),showToast:v}),l.jsx(H1,{open:h,onClose:()=>f(!1),onNav:p}),l.jsx(bh,{open:c,onClose:()=>d(!1),onCheckout:()=>p("checkout")}),l.jsx(ru,{message:m})]})})}function zk(){return l.jsx(O1,{children:l.jsx(Ok,{})})}Vo.createRoot(document.getElementById("root")).render(l.jsx(lg.StrictMode,{children:l.jsx(Bv,{children:l.jsx(zk,{})})}));export{Lk as $,om as A,Ik as B,ic as C,Wr as D,ix as E,Fl as F,ox as G,An as H,mr as I,$t as J,X as K,lx as L,cx as M,cm as N,Y1 as O,fx as P,ne as Q,zs as R,Is as S,Bl as T,ac as U,Rd as V,H1 as W,Et as X,nx as Y,sx as Z,xh as _,oc as a,Hr as a0,S1 as a1,ax as a2,wa as a3,Br as a4,Uk as a5,Fk as a6,Ws as a7,ei as a8,Q1 as a9,Z1 as aa,X1 as ab,ba as b,M as c,_t as d,pr as e,hs as f,_a as g,rx as h,um as i,l as j,zr as k,ka as l,uc as m,Ad as n,lm as o,eo as p,gr as q,w as r,io as s,$n as t,Ue as u,Ki as v,$k as w,Ie as x,Dk as y,Vm as z};