const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalHome-D2iWvXUb.js","assets/zap-C80JWl8K.js","assets/chevron-left-CZxZTi0E.js","assets/ExperimentalHome-ghxRXOdL.css","assets/BlogPage-DWGyLAb0.js","assets/blogArticles-oDydDS7S.js","assets/BlogSidebar-DmHXLhXF.js","assets/user-tSGhXNog.js","assets/BlogArticle-BYPRlZOy.js","assets/blogAuthors-DbgqyNiY.js","assets/NotFoundPage-DdbkzmIj.js","assets/arrow-left-BawhodSS.js","assets/BlogCategory-DkLHhY9v.js","assets/BlogTag-BkaL4iRZ.js","assets/BlogAuthor-mjA9Kjf3.js","assets/AdminPanel-C6MhXUoN.js","assets/copy-Cc8DelDf.js","assets/QuizPlay-s369Xc4j.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 Vk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $h={exports:{}},La={},Ih={exports:{}},G={};/**
* @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 Gs=Symbol.for("react.element"),ng=Symbol.for("react.portal"),sg=Symbol.for("react.fragment"),ig=Symbol.for("react.strict_mode"),ag=Symbol.for("react.profiler"),og=Symbol.for("react.provider"),lg=Symbol.for("react.context"),cg=Symbol.for("react.forward_ref"),ug=Symbol.for("react.suspense"),dg=Symbol.for("react.memo"),hg=Symbol.for("react.lazy"),wu=Symbol.iterator;function fg(e){return e===null||typeof e!="object"?null:(e=wu&&e[wu]||e["@@iterator"],typeof e=="function"?e:null)}var Dh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Lh=Object.assign,Uh={};function zn(e,t,r){this.props=e,this.context=t,this.refs=Uh,this.updater=r||Dh}zn.prototype.isReactComponent={};zn.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")};zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fh(){}Fh.prototype=zn.prototype;function lc(e,t,r){this.props=e,this.context=t,this.refs=Uh,this.updater=r||Dh}var cc=lc.prototype=new Fh;cc.constructor=lc;Lh(cc,zn.prototype);cc.isPureReactComponent=!0;var bu=Array.isArray,Bh=Object.prototype.hasOwnProperty,uc={current:null},Mh={key:!0,ref:!0,__self:!0,__source:!0};function qh(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)Bh.call(t,n)&&!Mh.hasOwnProperty(n)&&(s[n]=t[n]);var o=arguments.length-2;if(o===1)s.children=r;else if(1<o){for(var c=Array(o),u=0;u<o;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in o=e.defaultProps,o)s[n]===void 0&&(s[n]=o[n]);return{$$typeof:Gs,type:e,key:i,ref:a,props:s,_owner:uc.current}}function pg(e,t){return{$$typeof:Gs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function dc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gs}function mg(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var ku=/\/+/g;function uo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?mg(""+e.key):t.toString(36)}function zi(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 Gs:case ng:a=!0}}if(a)return a=e,s=s(a),e=n===""?"."+uo(a,0):n,bu(s)?(r="",e!=null&&(r=e.replace(ku,"$&/")+"/"),zi(s,t,r,"",function(u){return u})):s!=null&&(dc(s)&&(s=pg(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(ku,"$&/")+"/")+e)),t.push(s)),1;if(a=0,n=n===""?".":n+":",bu(e))for(var o=0;o<e.length;o++){i=e[o];var c=n+uo(i,o);a+=zi(i,t,r,c,s)}else if(c=fg(e),typeof c=="function")for(e=c.call(e),o=0;!(i=e.next()).done;)i=i.value,c=n+uo(i,o++),a+=zi(i,t,r,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function ii(e,t,r){if(e==null)return e;var n=[],s=0;return zi(e,n,"","",function(i){return t.call(r,i,s++)}),n}function gg(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},$i={transition:null},yg={ReactCurrentDispatcher:Ae,ReactCurrentBatchConfig:$i,ReactCurrentOwner:uc};function Wh(){throw Error("act(...) is not supported in production builds of React.")}G.Children={map:ii,forEach:function(e,t,r){ii(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return ii(e,function(){t++}),t},toArray:function(e){return ii(e,function(t){return t})||[]},only:function(e){if(!dc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};G.Component=zn;G.Fragment=sg;G.Profiler=ag;G.PureComponent=lc;G.StrictMode=ig;G.Suspense=ug;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yg;G.act=Wh;G.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=Lh({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=uc.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(c in t)Bh.call(t,c)&&!Mh.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&o!==void 0?o[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){o=Array(c);for(var u=0;u<c;u++)o[u]=arguments[u+2];n.children=o}return{$$typeof:Gs,type:e.type,key:s,ref:i,props:n,_owner:a}};G.createContext=function(e){return e={$$typeof:lg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:og,_context:e},e.Consumer=e};G.createElement=qh;G.createFactory=function(e){var t=qh.bind(null,e);return t.type=e,t};G.createRef=function(){return{current:null}};G.forwardRef=function(e){return{$$typeof:cg,render:e}};G.isValidElement=dc;G.lazy=function(e){return{$$typeof:hg,_payload:{_status:-1,_result:e},_init:gg}};G.memo=function(e,t){return{$$typeof:dg,type:e,compare:t===void 0?null:t}};G.startTransition=function(e){var t=$i.transition;$i.transition={};try{e()}finally{$i.transition=t}};G.unstable_act=Wh;G.useCallback=function(e,t){return Ae.current.useCallback(e,t)};G.useContext=function(e){return Ae.current.useContext(e)};G.useDebugValue=function(){};G.useDeferredValue=function(e){return Ae.current.useDeferredValue(e)};G.useEffect=function(e,t){return Ae.current.useEffect(e,t)};G.useId=function(){return Ae.current.useId()};G.useImperativeHandle=function(e,t,r){return Ae.current.useImperativeHandle(e,t,r)};G.useInsertionEffect=function(e,t){return Ae.current.useInsertionEffect(e,t)};G.useLayoutEffect=function(e,t){return Ae.current.useLayoutEffect(e,t)};G.useMemo=function(e,t){return Ae.current.useMemo(e,t)};G.useReducer=function(e,t,r){return Ae.current.useReducer(e,t,r)};G.useRef=function(e){return Ae.current.useRef(e)};G.useState=function(e){return Ae.current.useState(e)};G.useSyncExternalStore=function(e,t,r){return Ae.current.useSyncExternalStore(e,t,r)};G.useTransition=function(){return Ae.current.useTransition()};G.version="18.3.1";Ih.exports=G;var b=Ih.exports;const vg=rg(b);/**
* @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 xg=b,wg=Symbol.for("react.element"),bg=Symbol.for("react.fragment"),kg=Object.prototype.hasOwnProperty,_g=xg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Sg={key:!0,ref:!0,__self:!0,__source:!0};function Hh(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)kg.call(t,n)&&!Sg.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:wg,type:e,key:i,ref:a,props:s,_owner:_g.current}}La.Fragment=bg;La.jsx=Hh;La.jsxs=Hh;$h.exports=La;var l=$h.exports,Qo={},Vh={exports:{}},Ve={},Kh={exports:{}},Gh={};/**
* @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(T,A){var z=T.length;T.push(A);e:for(;0<z;){var K=z-1>>>1,Y=T[K];if(0<s(Y,A))T[K]=A,T[z]=Y,z=K;else break e}}function r(T){return T.length===0?null:T[0]}function n(T){if(T.length===0)return null;var A=T[0],z=T.pop();if(z!==A){T[0]=z;e:for(var K=0,Y=T.length,Tt=Y>>>1;K<Tt;){var U=2*(K+1)-1,V=T[U],At=U+1,si=T[At];if(0>s(V,z))At<Y&&0>s(si,V)?(T[K]=si,T[At]=z,K=At):(T[K]=V,T[U]=z,K=U);else if(At<Y&&0>s(si,z))T[K]=si,T[At]=z,K=At;else break e}}return A}function s(T,A){var z=T.sortIndex-A.sortIndex;return z!==0?z:T.id-A.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 c=[],u=[],d=1,h=null,f=3,p=!1,v=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(T){for(var A=r(u);A!==null;){if(A.callback===null)n(u);else if(A.startTime<=T)n(u),A.sortIndex=A.expirationTime,t(c,A);else break;A=r(u)}}function k(T){if(g=!1,x(T),!v)if(r(c)!==null)v=!0,L(S);else{var A=r(u);A!==null&&q(k,A.startTime-T)}}function S(T,A){v=!1,g&&(g=!1,y($),$=-1),p=!0;var z=f;try{for(x(A),h=r(c);h!==null&&(!(h.expirationTime>A)||T&&!M());){var K=h.callback;if(typeof K=="function"){h.callback=null,f=h.priorityLevel;var Y=K(h.expirationTime<=A);A=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===r(c)&&n(c),x(A)}else n(c);h=r(c)}if(h!==null)var Tt=!0;else{var U=r(u);U!==null&&q(k,U.startTime-A),Tt=!1}return Tt}finally{h=null,f=z,p=!1}}var E=!1,j=null,$=-1,I=5,N=-1;function M(){return!(e.unstable_now()-N<I)}function _(){if(j!==null){var T=e.unstable_now();N=T;var A=!0;try{A=j(!0,T)}finally{A?C():(E=!1,j=null)}}else E=!1}var C;if(typeof m=="function")C=function(){m(_)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,O=R.port2;R.port1.onmessage=_,C=function(){O.postMessage(null)}}else C=function(){w(_,0)};function L(T){j=T,E||(E=!0,C())}function q(T,A){$=w(function(){T(e.unstable_now())},A)}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(T){T.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,L(S))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(T){switch(f){case 1:case 2:case 3:var A=3;break;default:A=f}var z=f;f=A;try{return T()}finally{f=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,A){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var z=f;f=T;try{return A()}finally{f=z}},e.unstable_scheduleCallback=function(T,A,z){var K=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?K+z:K):z=K,T){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=z+Y,T={id:d++,callback:A,priorityLevel:T,startTime:z,expirationTime:Y,sortIndex:-1},z>K?(T.sortIndex=z,t(u,T),r(c)===null&&T===r(u)&&(g?(y($),$=-1):g=!0,q(k,z-K))):(T.sortIndex=Y,t(c,T),v||p||(v=!0,L(S))),T},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(T){var A=f;return function(){var z=f;f=A;try{return T.apply(this,arguments)}finally{f=z}}}})(Gh);Kh.exports=Gh;var Eg=Kh.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 jg=b,He=Eg;function P(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 Jh=new Set,xs={};function Wr(e,t){jn(e,t),jn(e+"Capture",t)}function jn(e,t){for(xs[e]=t,e=0;e<t.length;e++)Jh.add(t[e])}var qt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xo=Object.prototype.hasOwnProperty,Cg=/^[: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]*$/,_u={},Su={};function Ng(e){return Xo.call(Su,e)?!0:Xo.call(_u,e)?!1:Cg.test(e)?Su[e]=!0:(_u[e]=!0,!1)}function Tg(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 Ag(e,t,r,n){if(t===null||typeof t>"u"||Tg(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 hc=/[\-:]([a-z])/g;function fc(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(hc,fc);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(hc,fc);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(hc,fc);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 pc(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")&&(Ag(t,r,s,n)&&(r=null),n||s===null?Ng(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 Gt=jg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ai=Symbol.for("react.element"),an=Symbol.for("react.portal"),on=Symbol.for("react.fragment"),mc=Symbol.for("react.strict_mode"),Zo=Symbol.for("react.profiler"),Yh=Symbol.for("react.provider"),Qh=Symbol.for("react.context"),gc=Symbol.for("react.forward_ref"),el=Symbol.for("react.suspense"),tl=Symbol.for("react.suspense_list"),yc=Symbol.for("react.memo"),Qt=Symbol.for("react.lazy"),Xh=Symbol.for("react.offscreen"),Eu=Symbol.iterator;function Fn(e){return e===null||typeof e!="object"?null:(e=Eu&&e[Eu]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Object.assign,ho;function Zn(e){if(ho===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);ho=t&&t[1]||""}return`
`+ho+e}var fo=!1;function po(e,t){if(!e||fo)return"";fo=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=n.stack.split(`
`),a=s.length-1,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 c=`
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{fo=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Zn(e):""}function Rg(e){switch(e.tag){case 5:return Zn(e.type);case 16:return Zn("Lazy");case 13:return Zn("Suspense");case 19:return Zn("SuspenseList");case 0:case 2:case 15:return e=po(e.type,!1),e;case 11:return e=po(e.type.render,!1),e;case 1:return e=po(e.type,!0),e;default:return""}}function rl(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 on:return"Fragment";case an:return"Portal";case Zo:return"Profiler";case mc:return"StrictMode";case el:return"Suspense";case tl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qh:return(e.displayName||"Context")+".Consumer";case Yh:return(e._context.displayName||"Context")+".Provider";case gc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yc:return t=e.displayName||null,t!==null?t:rl(e.type)||"Memo";case Qt:t=e._payload,e=e._init;try{return rl(e(t))}catch{}}return null}function Pg(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 rl(t);case 8:return t===mc?"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 mr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Og(e){var t=Zh(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oi(e){e._valueTracker||(e._valueTracker=Og(e))}function ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Zh(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Yi(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 nl(e,t){var r=t.checked;return oe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ju(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=mr(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 tf(e,t){t=t.checked,t!=null&&pc(e,"checked",t,!1)}function sl(e,t){tf(e,t);var r=mr(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")?il(e,t.type,r):t.hasOwnProperty("defaultValue")&&il(e,t.type,mr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Cu(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 il(e,t,r){(t!=="number"||Yi(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var es=Array.isArray;function xn(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=""+mr(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 al(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(P(91));return oe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Nu(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(P(92));if(es(r)){if(1<r.length)throw Error(P(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:mr(r)}}function rf(e,t){var r=mr(t.value),n=mr(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 Tu(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function nf(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 ol(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?nf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var li,sf=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(li=li||document.createElement("div"),li.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=li.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ws(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var os={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},zg=["Webkit","ms","Moz","O"];Object.keys(os).forEach(function(e){zg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),os[t]=os[e]})});function af(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||os.hasOwnProperty(e)&&os[e]?(""+t).trim():t+"px"}function of(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=af(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var $g=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 ll(e,t){if(t){if($g[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(P(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(P(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(P(61))}if(t.style!=null&&typeof t.style!="object")throw Error(P(62))}}function cl(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 ul=null;function vc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dl=null,wn=null,bn=null;function Au(e){if(e=Qs(e)){if(typeof dl!="function")throw Error(P(280));var t=e.stateNode;t&&(t=qa(t),dl(e.stateNode,e.type,t))}}function lf(e){wn?bn?bn.push(e):bn=[e]:wn=e}function cf(){if(wn){var e=wn,t=bn;if(bn=wn=null,Au(e),t)for(e=0;e<t.length;e++)Au(t[e])}}function uf(e,t){return e(t)}function df(){}var mo=!1;function hf(e,t,r){if(mo)return e(t,r);mo=!0;try{return uf(e,t,r)}finally{mo=!1,(wn!==null||bn!==null)&&(df(),cf())}}function bs(e,t){var r=e.stateNode;if(r===null)return null;var n=qa(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(P(231,t,typeof r));return r}var hl=!1;if(qt)try{var Bn={};Object.defineProperty(Bn,"passive",{get:function(){hl=!0}}),window.addEventListener("test",Bn,Bn),window.removeEventListener("test",Bn,Bn)}catch{hl=!1}function Ig(e,t,r,n,s,i,a,o,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var ls=!1,Qi=null,Xi=!1,fl=null,Dg={onError:function(e){ls=!0,Qi=e}};function Lg(e,t,r,n,s,i,a,o,c){ls=!1,Qi=null,Ig.apply(Dg,arguments)}function Ug(e,t,r,n,s,i,a,o,c){if(Lg.apply(this,arguments),ls){if(ls){var u=Qi;ls=!1,Qi=null}else throw Error(P(198));Xi||(Xi=!0,fl=u)}}function Hr(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 ff(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 Ru(e){if(Hr(e)!==e)throw Error(P(188))}function Fg(e){var t=e.alternate;if(!t){if(t=Hr(e),t===null)throw Error(P(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 Ru(s),e;if(i===n)return Ru(s),t;i=i.sibling}throw Error(P(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(P(189))}}if(r.alternate!==n)throw Error(P(190))}if(r.tag!==3)throw Error(P(188));return r.stateNode.current===r?e:t}function pf(e){return e=Fg(e),e!==null?mf(e):null}function mf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=mf(e);if(t!==null)return t;e=e.sibling}return null}var gf=He.unstable_scheduleCallback,Pu=He.unstable_cancelCallback,Bg=He.unstable_shouldYield,Mg=He.unstable_requestPaint,de=He.unstable_now,qg=He.unstable_getCurrentPriorityLevel,xc=He.unstable_ImmediatePriority,yf=He.unstable_UserBlockingPriority,Zi=He.unstable_NormalPriority,Wg=He.unstable_LowPriority,vf=He.unstable_IdlePriority,Ua=null,kt=null;function Hg(e){if(kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(Ua,e,void 0,(e.current.flags&128)===128)}catch{}}var ht=Math.clz32?Math.clz32:Gg,Vg=Math.log,Kg=Math.LN2;function Gg(e){return e>>>=0,e===0?32:31-(Vg(e)/Kg|0)|0}var ci=64,ui=4194304;function ts(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 ea(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=ts(o):(i&=a,i!==0&&(n=ts(i)))}else a=r&~s,a!==0?n=ts(a):i!==0&&(n=ts(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-ht(t),s=1<<r,n|=e[r],t&=~s;return n}function Jg(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 Yg(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-ht(i),o=1<<a,c=s[a];c===-1?(!(o&r)||o&n)&&(s[a]=Jg(o,t)):c<=t&&(e.expiredLanes|=o),i&=~o}}function pl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function xf(){var e=ci;return ci<<=1,!(ci&4194240)&&(ci=64),e}function go(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Js(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ht(t),e[t]=r}function Qg(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-ht(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function wc(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-ht(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var Q=0;function wf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var bf,bc,kf,_f,Sf,ml=!1,di=[],or=null,lr=null,cr=null,ks=new Map,_s=new Map,Zt=[],Xg="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 Ou(e,t){switch(e){case"focusin":case"focusout":or=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":ks.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_s.delete(t.pointerId)}}function Mn(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=Qs(t),t!==null&&bc(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Zg(e,t,r,n,s){switch(t){case"focusin":return or=Mn(or,e,t,r,n,s),!0;case"dragenter":return lr=Mn(lr,e,t,r,n,s),!0;case"mouseover":return cr=Mn(cr,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return ks.set(i,Mn(ks.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,_s.set(i,Mn(_s.get(i)||null,e,t,r,n,s)),!0}return!1}function Ef(e){var t=Ar(e.target);if(t!==null){var r=Hr(t);if(r!==null){if(t=r.tag,t===13){if(t=ff(r),t!==null){e.blockedOn=t,Sf(e.priority,function(){kf(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 Ii(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=gl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ul=n,r.target.dispatchEvent(n),ul=null}else return t=Qs(r),t!==null&&bc(t),e.blockedOn=r,!1;t.shift()}return!0}function zu(e,t,r){Ii(e)&&r.delete(t)}function ey(){ml=!1,or!==null&&Ii(or)&&(or=null),lr!==null&&Ii(lr)&&(lr=null),cr!==null&&Ii(cr)&&(cr=null),ks.forEach(zu),_s.forEach(zu)}function qn(e,t){e.blockedOn===t&&(e.blockedOn=null,ml||(ml=!0,He.unstable_scheduleCallback(He.unstable_NormalPriority,ey)))}function Ss(e){function t(s){return qn(s,e)}if(0<di.length){qn(di[0],e);for(var r=1;r<di.length;r++){var n=di[r];n.blockedOn===e&&(n.blockedOn=null)}}for(or!==null&&qn(or,e),lr!==null&&qn(lr,e),cr!==null&&qn(cr,e),ks.forEach(t),_s.forEach(t),r=0;r<Zt.length;r++)n=Zt[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Zt.length&&(r=Zt[0],r.blockedOn===null);)Ef(r),r.blockedOn===null&&Zt.shift()}var kn=Gt.ReactCurrentBatchConfig,ta=!0;function ty(e,t,r,n){var s=Q,i=kn.transition;kn.transition=null;try{Q=1,kc(e,t,r,n)}finally{Q=s,kn.transition=i}}function ry(e,t,r,n){var s=Q,i=kn.transition;kn.transition=null;try{Q=4,kc(e,t,r,n)}finally{Q=s,kn.transition=i}}function kc(e,t,r,n){if(ta){var s=gl(e,t,r,n);if(s===null)jo(e,t,n,ra,r),Ou(e,n);else if(Zg(s,e,t,r,n))n.stopPropagation();else if(Ou(e,n),t&4&&-1<Xg.indexOf(e)){for(;s!==null;){var i=Qs(s);if(i!==null&&bf(i),i=gl(e,t,r,n),i===null&&jo(e,t,n,ra,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else jo(e,t,n,null,r)}}var ra=null;function gl(e,t,r,n){if(ra=null,e=vc(n),e=Ar(e),e!==null)if(t=Hr(e),t===null)e=null;else if(r=t.tag,r===13){if(e=ff(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 ra=e,null}function jf(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(qg()){case xc:return 1;case yf:return 4;case Zi:case Wg:return 16;case vf:return 536870912;default:return 16}default:return 16}}var sr=null,_c=null,Di=null;function Cf(){if(Di)return Di;var e,t=_c,r=t.length,n,s="value"in sr?sr.value:sr.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 Di=s.slice(e,1<n?1-n:void 0)}function Li(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 hi(){return!0}function $u(){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)?hi:$u,this.isPropagationStopped=$u,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=hi)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=hi)},persist:function(){},isPersistent:hi}),t}var $n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sc=Ke($n),Ys=oe({},$n,{view:0,detail:0}),ny=Ke(Ys),yo,vo,Wn,Fa=oe({},Ys,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ec,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!==Wn&&(Wn&&e.type==="mousemove"?(yo=e.screenX-Wn.screenX,vo=e.screenY-Wn.screenY):vo=yo=0,Wn=e),yo)},movementY:function(e){return"movementY"in e?e.movementY:vo}}),Iu=Ke(Fa),sy=oe({},Fa,{dataTransfer:0}),iy=Ke(sy),ay=oe({},Ys,{relatedTarget:0}),xo=Ke(ay),oy=oe({},$n,{animationName:0,elapsedTime:0,pseudoElement:0}),ly=Ke(oy),cy=oe({},$n,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uy=Ke(cy),dy=oe({},$n,{data:0}),Du=Ke(dy),hy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fy={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"},py={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function my(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=py[e])?!!t[e]:!1}function Ec(){return my}var gy=oe({},Ys,{key:function(e){if(e.key){var t=hy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Li(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?fy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ec,charCode:function(e){return e.type==="keypress"?Li(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Li(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yy=Ke(gy),vy=oe({},Fa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lu=Ke(vy),xy=oe({},Ys,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ec}),wy=Ke(xy),by=oe({},$n,{propertyName:0,elapsedTime:0,pseudoElement:0}),ky=Ke(by),_y=oe({},Fa,{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}),Sy=Ke(_y),Ey=[9,13,27,32],jc=qt&&"CompositionEvent"in window,cs=null;qt&&"documentMode"in document&&(cs=document.documentMode);var jy=qt&&"TextEvent"in window&&!cs,Nf=qt&&(!jc||cs&&8<cs&&11>=cs),Uu=" ",Fu=!1;function Tf(e,t){switch(e){case"keyup":return Ey.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Af(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ln=!1;function Cy(e,t){switch(e){case"compositionend":return Af(t);case"keypress":return t.which!==32?null:(Fu=!0,Uu);case"textInput":return e=t.data,e===Uu&&Fu?null:e;default:return null}}function Ny(e,t){if(ln)return e==="compositionend"||!jc&&Tf(e,t)?(e=Cf(),Di=_c=sr=null,ln=!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 Nf&&t.locale!=="ko"?null:t.data;default:return null}}var Ty={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 Bu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ty[e.type]:t==="textarea"}function Rf(e,t,r,n){lf(n),t=na(t,"onChange"),0<t.length&&(r=new Sc("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var us=null,Es=null;function Ay(e){Mf(e,0)}function Ba(e){var t=dn(e);if(ef(t))return e}function Ry(e,t){if(e==="change")return t}var Pf=!1;if(qt){var wo;if(qt){var bo="oninput"in document;if(!bo){var Mu=document.createElement("div");Mu.setAttribute("oninput","return;"),bo=typeof Mu.oninput=="function"}wo=bo}else wo=!1;Pf=wo&&(!document.documentMode||9<document.documentMode)}function qu(){us&&(us.detachEvent("onpropertychange",Of),Es=us=null)}function Of(e){if(e.propertyName==="value"&&Ba(Es)){var t=[];Rf(t,Es,e,vc(e)),hf(Ay,t)}}function Py(e,t,r){e==="focusin"?(qu(),us=t,Es=r,us.attachEvent("onpropertychange",Of)):e==="focusout"&&qu()}function Oy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ba(Es)}function zy(e,t){if(e==="click")return Ba(t)}function $y(e,t){if(e==="input"||e==="change")return Ba(t)}function Iy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mt=typeof Object.is=="function"?Object.is:Iy;function js(e,t){if(mt(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(!Xo.call(t,s)||!mt(e[s],t[s]))return!1}return!0}function Wu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hu(e,t){var r=Wu(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=Wu(r)}}function zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $f(){for(var e=window,t=Yi();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Yi(e.document)}return t}function Cc(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 Dy(e){var t=$f(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&zf(r.ownerDocument.documentElement,r)){if(n!==null&&Cc(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=Hu(r,i);var a=Hu(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 Ly=qt&&"documentMode"in document&&11>=document.documentMode,cn=null,yl=null,ds=null,vl=!1;function Vu(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;vl||cn==null||cn!==Yi(n)||(n=cn,"selectionStart"in n&&Cc(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}),ds&&js(ds,n)||(ds=n,n=na(yl,"onSelect"),0<n.length&&(t=new Sc("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=cn)))}function fi(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var un={animationend:fi("Animation","AnimationEnd"),animationiteration:fi("Animation","AnimationIteration"),animationstart:fi("Animation","AnimationStart"),transitionend:fi("Transition","TransitionEnd")},ko={},If={};qt&&(If=document.createElement("div").style,"AnimationEvent"in window||(delete un.animationend.animation,delete un.animationiteration.animation,delete un.animationstart.animation),"TransitionEvent"in window||delete un.transitionend.transition);function Ma(e){if(ko[e])return ko[e];if(!un[e])return e;var t=un[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in If)return ko[e]=t[r];return e}var Df=Ma("animationend"),Lf=Ma("animationiteration"),Uf=Ma("animationstart"),Ff=Ma("transitionend"),Bf=new Map,Ku="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function br(e,t){Bf.set(e,t),Wr(t,[e])}for(var _o=0;_o<Ku.length;_o++){var So=Ku[_o],Uy=So.toLowerCase(),Fy=So[0].toUpperCase()+So.slice(1);br(Uy,"on"+Fy)}br(Df,"onAnimationEnd");br(Lf,"onAnimationIteration");br(Uf,"onAnimationStart");br("dblclick","onDoubleClick");br("focusin","onFocus");br("focusout","onBlur");br(Ff,"onTransitionEnd");jn("onMouseEnter",["mouseout","mouseover"]);jn("onMouseLeave",["mouseout","mouseover"]);jn("onPointerEnter",["pointerout","pointerover"]);jn("onPointerLeave",["pointerout","pointerover"]);Wr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Wr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Wr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Wr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Wr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Wr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rs="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(" "),By=new Set("cancel close invalid load scroll toggle".split(" ").concat(rs));function Gu(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Ug(n,t,void 0,e),e.currentTarget=null}function Mf(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],c=o.instance,u=o.currentTarget;if(o=o.listener,c!==i&&s.isPropagationStopped())break e;Gu(s,o,u),i=c}else for(a=0;a<n.length;a++){if(o=n[a],c=o.instance,u=o.currentTarget,o=o.listener,c!==i&&s.isPropagationStopped())break e;Gu(s,o,u),i=c}}}if(Xi)throw e=fl,Xi=!1,fl=null,e}function re(e,t){var r=t[_l];r===void 0&&(r=t[_l]=new Set);var n=e+"__bubble";r.has(n)||(qf(t,e,2,!1),r.add(n))}function Eo(e,t,r){var n=0;t&&(n|=4),qf(r,e,n,t)}var pi="_reactListening"+Math.random().toString(36).slice(2);function Cs(e){if(!e[pi]){e[pi]=!0,Jh.forEach(function(r){r!=="selectionchange"&&(By.has(r)||Eo(r,!1,e),Eo(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pi]||(t[pi]=!0,Eo("selectionchange",!1,t))}}function qf(e,t,r,n){switch(jf(t)){case 1:var s=ty;break;case 4:s=ry;break;default:s=kc}r=s.bind(null,t,r,e),s=void 0,!hl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function jo(e,t,r,n,s){var i=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var o=n.stateNode.containerInfo;if(o===s||o.nodeType===8&&o.parentNode===s)break;if(a===4)for(a=n.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;o!==null;){if(a=Ar(o),a===null)return;if(c=a.tag,c===5||c===6){n=i=a;continue e}o=o.parentNode}}n=n.return}hf(function(){var u=i,d=vc(r),h=[];e:{var f=Bf.get(e);if(f!==void 0){var p=Sc,v=e;switch(e){case"keypress":if(Li(r)===0)break e;case"keydown":case"keyup":p=yy;break;case"focusin":v="focus",p=xo;break;case"focusout":v="blur",p=xo;break;case"beforeblur":case"afterblur":p=xo;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Iu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=iy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=wy;break;case Df:case Lf:case Uf:p=ly;break;case Ff:p=ky;break;case"scroll":p=ny;break;case"wheel":p=Sy;break;case"copy":case"cut":case"paste":p=uy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Lu}var g=(t&4)!==0,w=!g&&e==="scroll",y=g?f!==null?f+"Capture":null:f;g=[];for(var m=u,x;m!==null;){x=m;var k=x.stateNode;if(x.tag===5&&k!==null&&(x=k,y!==null&&(k=bs(m,y),k!=null&&g.push(Ns(m,k,x)))),w)break;m=m.return}0<g.length&&(f=new p(f,v,null,r,d),h.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==ul&&(v=r.relatedTarget||r.fromElement)&&(Ar(v)||v[Wt]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(v=r.relatedTarget||r.toElement,p=u,v=v?Ar(v):null,v!==null&&(w=Hr(v),v!==w||v.tag!==5&&v.tag!==6)&&(v=null)):(p=null,v=u),p!==v)){if(g=Iu,k="onMouseLeave",y="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(g=Lu,k="onPointerLeave",y="onPointerEnter",m="pointer"),w=p==null?f:dn(p),x=v==null?f:dn(v),f=new g(k,m+"leave",p,r,d),f.target=w,f.relatedTarget=x,k=null,Ar(d)===u&&(g=new g(y,m+"enter",v,r,d),g.target=x,g.relatedTarget=w,k=g),w=k,p&&v)t:{for(g=p,y=v,m=0,x=g;x;x=Gr(x))m++;for(x=0,k=y;k;k=Gr(k))x++;for(;0<m-x;)g=Gr(g),m--;for(;0<x-m;)y=Gr(y),x--;for(;m--;){if(g===y||y!==null&&g===y.alternate)break t;g=Gr(g),y=Gr(y)}g=null}else g=null;p!==null&&Ju(h,f,p,g,!1),v!==null&&w!==null&&Ju(h,w,v,g,!0)}}e:{if(f=u?dn(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var S=Ry;else if(Bu(f))if(Pf)S=$y;else{S=Oy;var E=Py}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=zy);if(S&&(S=S(e,u))){Rf(h,S,r,d);break e}E&&E(e,f,u),e==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&il(f,"number",f.value)}switch(E=u?dn(u):window,e){case"focusin":(Bu(E)||E.contentEditable==="true")&&(cn=E,yl=u,ds=null);break;case"focusout":ds=yl=cn=null;break;case"mousedown":vl=!0;break;case"contextmenu":case"mouseup":case"dragend":vl=!1,Vu(h,r,d);break;case"selectionchange":if(Ly)break;case"keydown":case"keyup":Vu(h,r,d)}var j;if(jc)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else ln?Tf(e,r)&&($="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&($="onCompositionStart");$&&(Nf&&r.locale!=="ko"&&(ln||$!=="onCompositionStart"?$==="onCompositionEnd"&&ln&&(j=Cf()):(sr=d,_c="value"in sr?sr.value:sr.textContent,ln=!0)),E=na(u,$),0<E.length&&($=new Du($,e,null,r,d),h.push({event:$,listeners:E}),j?$.data=j:(j=Af(r),j!==null&&($.data=j)))),(j=jy?Cy(e,r):Ny(e,r))&&(u=na(u,"onBeforeInput"),0<u.length&&(d=new Du("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=j))}Mf(h,t)})}function Ns(e,t,r){return{instance:e,listener:t,currentTarget:r}}function na(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=bs(e,r),i!=null&&n.unshift(Ns(e,i,s)),i=bs(e,t),i!=null&&n.push(Ns(e,i,s))),e=e.return}return n}function Gr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ju(e,t,r,n,s){for(var i=t._reactName,a=[];r!==null&&r!==n;){var o=r,c=o.alternate,u=o.stateNode;if(c!==null&&c===n)break;o.tag===5&&u!==null&&(o=u,s?(c=bs(r,i),c!=null&&a.unshift(Ns(r,c,o))):s||(c=bs(r,i),c!=null&&a.push(Ns(r,c,o)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var My=/\r\n?/g,qy=/\u0000|\uFFFD/g;function Yu(e){return(typeof e=="string"?e:""+e).replace(My,`
`).replace(qy,"")}function mi(e,t,r){if(t=Yu(t),Yu(e)!==t&&r)throw Error(P(425))}function sa(){}var xl=null,wl=null;function bl(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 kl=typeof setTimeout=="function"?setTimeout:void 0,Wy=typeof clearTimeout=="function"?clearTimeout:void 0,Qu=typeof Promise=="function"?Promise:void 0,Hy=typeof queueMicrotask=="function"?queueMicrotask:typeof Qu<"u"?function(e){return Qu.resolve(null).then(e).catch(Vy)}:kl;function Vy(e){setTimeout(function(){throw e})}function Co(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),Ss(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Ss(t)}function ur(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 Xu(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 In=Math.random().toString(36).slice(2),bt="__reactFiber$"+In,Ts="__reactProps$"+In,Wt="__reactContainer$"+In,_l="__reactEvents$"+In,Ky="__reactListeners$"+In,Gy="__reactHandles$"+In;function Ar(e){var t=e[bt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Wt]||r[bt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Xu(e);e!==null;){if(r=e[bt])return r;e=Xu(e)}return t}e=r,r=e.parentNode}return null}function Qs(e){return e=e[bt]||e[Wt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function dn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(P(33))}function qa(e){return e[Ts]||null}var Sl=[],hn=-1;function kr(e){return{current:e}}function ne(e){0>hn||(e.current=Sl[hn],Sl[hn]=null,hn--)}function te(e,t){hn++,Sl[hn]=e.current,e.current=t}var gr={},Ce=kr(gr),Ie=kr(!1),Lr=gr;function Cn(e,t){var r=e.type.contextTypes;if(!r)return gr;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 ia(){ne(Ie),ne(Ce)}function Zu(e,t,r){if(Ce.current!==gr)throw Error(P(168));te(Ce,t),te(Ie,r)}function Wf(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(P(108,Pg(e)||"Unknown",s));return oe({},r,n)}function aa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||gr,Lr=Ce.current,te(Ce,e),te(Ie,Ie.current),!0}function ed(e,t,r){var n=e.stateNode;if(!n)throw Error(P(169));r?(e=Wf(e,t,Lr),n.__reactInternalMemoizedMergedChildContext=e,ne(Ie),ne(Ce),te(Ce,e)):ne(Ie),te(Ie,r)}var Dt=null,Wa=!1,No=!1;function Hf(e){Dt===null?Dt=[e]:Dt.push(e)}function Jy(e){Wa=!0,Hf(e)}function _r(){if(!No&&Dt!==null){No=!0;var e=0,t=Q;try{var r=Dt;for(Q=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Dt=null,Wa=!1}catch(s){throw Dt!==null&&(Dt=Dt.slice(e+1)),gf(xc,_r),s}finally{Q=t,No=!1}}return null}var fn=[],pn=0,oa=null,la=0,Je=[],Ye=0,Ur=null,Ut=1,Ft="";function Cr(e,t){fn[pn++]=la,fn[pn++]=oa,oa=e,la=t}function Vf(e,t,r){Je[Ye++]=Ut,Je[Ye++]=Ft,Je[Ye++]=Ur,Ur=e;var n=Ut;e=Ft;var s=32-ht(n)-1;n&=~(1<<s),r+=1;var i=32-ht(t)+s;if(30<i){var a=s-s%5;i=(n&(1<<a)-1).toString(32),n>>=a,s-=a,Ut=1<<32-ht(t)+s|r<<s|n,Ft=i+e}else Ut=1<<i|r<<s|n,Ft=e}function Nc(e){e.return!==null&&(Cr(e,1),Vf(e,1,0))}function Tc(e){for(;e===oa;)oa=fn[--pn],fn[pn]=null,la=fn[--pn],fn[pn]=null;for(;e===Ur;)Ur=Je[--Ye],Je[Ye]=null,Ft=Je[--Ye],Je[Ye]=null,Ut=Je[--Ye],Je[Ye]=null}var We=null,qe=null,se=!1,ut=null;function Kf(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 td(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=ur(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=Ur!==null?{id:Ut,overflow:Ft}: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 El(e){return(e.mode&1)!==0&&(e.flags&128)===0}function jl(e){if(se){var t=qe;if(t){var r=t;if(!td(e,t)){if(El(e))throw Error(P(418));t=ur(r.nextSibling);var n=We;t&&td(e,t)?Kf(n,r):(e.flags=e.flags&-4097|2,se=!1,We=e)}}else{if(El(e))throw Error(P(418));e.flags=e.flags&-4097|2,se=!1,We=e}}}function rd(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;We=e}function gi(e){if(e!==We)return!1;if(!se)return rd(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!bl(e.type,e.memoizedProps)),t&&(t=qe)){if(El(e))throw Gf(),Error(P(418));for(;t;)Kf(e,t),t=ur(t.nextSibling)}if(rd(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){qe=ur(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}qe=null}}else qe=We?ur(e.stateNode.nextSibling):null;return!0}function Gf(){for(var e=qe;e;)e=ur(e.nextSibling)}function Nn(){qe=We=null,se=!1}function Ac(e){ut===null?ut=[e]:ut.push(e)}var Yy=Gt.ReactCurrentBatchConfig;function Hn(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(P(309));var n=r.stateNode}if(!n)throw Error(P(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(P(284));if(!r._owner)throw Error(P(290,e))}return e}function yi(e,t){throw e=Object.prototype.toString.call(t),Error(P(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function nd(e){var t=e._init;return t(e._payload)}function Jf(e){function t(y,m){if(e){var x=y.deletions;x===null?(y.deletions=[m],y.flags|=16):x.push(m)}}function r(y,m){if(!e)return null;for(;m!==null;)t(y,m),m=m.sibling;return null}function n(y,m){for(y=new Map;m!==null;)m.key!==null?y.set(m.key,m):y.set(m.index,m),m=m.sibling;return y}function s(y,m){return y=pr(y,m),y.index=0,y.sibling=null,y}function i(y,m,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<m?(y.flags|=2,m):x):(y.flags|=2,m)):(y.flags|=1048576,m)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function o(y,m,x,k){return m===null||m.tag!==6?(m=$o(x,y.mode,k),m.return=y,m):(m=s(m,x),m.return=y,m)}function c(y,m,x,k){var S=x.type;return S===on?d(y,m,x.props.children,k,x.key):m!==null&&(m.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Qt&&nd(S)===m.type)?(k=s(m,x.props),k.ref=Hn(y,m,x),k.return=y,k):(k=Hi(x.type,x.key,x.props,null,y.mode,k),k.ref=Hn(y,m,x),k.return=y,k)}function u(y,m,x,k){return m===null||m.tag!==4||m.stateNode.containerInfo!==x.containerInfo||m.stateNode.implementation!==x.implementation?(m=Io(x,y.mode,k),m.return=y,m):(m=s(m,x.children||[]),m.return=y,m)}function d(y,m,x,k,S){return m===null||m.tag!==7?(m=$r(x,y.mode,k,S),m.return=y,m):(m=s(m,x),m.return=y,m)}function h(y,m,x){if(typeof m=="string"&&m!==""||typeof m=="number")return m=$o(""+m,y.mode,x),m.return=y,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case ai:return x=Hi(m.type,m.key,m.props,null,y.mode,x),x.ref=Hn(y,null,m),x.return=y,x;case an:return m=Io(m,y.mode,x),m.return=y,m;case Qt:var k=m._init;return h(y,k(m._payload),x)}if(es(m)||Fn(m))return m=$r(m,y.mode,x,null),m.return=y,m;yi(y,m)}return null}function f(y,m,x,k){var S=m!==null?m.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return S!==null?null:o(y,m,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case ai:return x.key===S?c(y,m,x,k):null;case an:return x.key===S?u(y,m,x,k):null;case Qt:return S=x._init,f(y,m,S(x._payload),k)}if(es(x)||Fn(x))return S!==null?null:d(y,m,x,k,null);yi(y,x)}return null}function p(y,m,x,k,S){if(typeof k=="string"&&k!==""||typeof k=="number")return y=y.get(x)||null,o(m,y,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ai:return y=y.get(k.key===null?x:k.key)||null,c(m,y,k,S);case an:return y=y.get(k.key===null?x:k.key)||null,u(m,y,k,S);case Qt:var E=k._init;return p(y,m,x,E(k._payload),S)}if(es(k)||Fn(k))return y=y.get(x)||null,d(m,y,k,S,null);yi(m,k)}return null}function v(y,m,x,k){for(var S=null,E=null,j=m,$=m=0,I=null;j!==null&&$<x.length;$++){j.index>$?(I=j,j=null):I=j.sibling;var N=f(y,j,x[$],k);if(N===null){j===null&&(j=I);break}e&&j&&N.alternate===null&&t(y,j),m=i(N,m,$),E===null?S=N:E.sibling=N,E=N,j=I}if($===x.length)return r(y,j),se&&Cr(y,$),S;if(j===null){for(;$<x.length;$++)j=h(y,x[$],k),j!==null&&(m=i(j,m,$),E===null?S=j:E.sibling=j,E=j);return se&&Cr(y,$),S}for(j=n(y,j);$<x.length;$++)I=p(j,y,$,x[$],k),I!==null&&(e&&I.alternate!==null&&j.delete(I.key===null?$:I.key),m=i(I,m,$),E===null?S=I:E.sibling=I,E=I);return e&&j.forEach(function(M){return t(y,M)}),se&&Cr(y,$),S}function g(y,m,x,k){var S=Fn(x);if(typeof S!="function")throw Error(P(150));if(x=S.call(x),x==null)throw Error(P(151));for(var E=S=null,j=m,$=m=0,I=null,N=x.next();j!==null&&!N.done;$++,N=x.next()){j.index>$?(I=j,j=null):I=j.sibling;var M=f(y,j,N.value,k);if(M===null){j===null&&(j=I);break}e&&j&&M.alternate===null&&t(y,j),m=i(M,m,$),E===null?S=M:E.sibling=M,E=M,j=I}if(N.done)return r(y,j),se&&Cr(y,$),S;if(j===null){for(;!N.done;$++,N=x.next())N=h(y,N.value,k),N!==null&&(m=i(N,m,$),E===null?S=N:E.sibling=N,E=N);return se&&Cr(y,$),S}for(j=n(y,j);!N.done;$++,N=x.next())N=p(j,y,$,N.value,k),N!==null&&(e&&N.alternate!==null&&j.delete(N.key===null?$:N.key),m=i(N,m,$),E===null?S=N:E.sibling=N,E=N);return e&&j.forEach(function(_){return t(y,_)}),se&&Cr(y,$),S}function w(y,m,x,k){if(typeof x=="object"&&x!==null&&x.type===on&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ai:e:{for(var S=x.key,E=m;E!==null;){if(E.key===S){if(S=x.type,S===on){if(E.tag===7){r(y,E.sibling),m=s(E,x.props.children),m.return=y,y=m;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Qt&&nd(S)===E.type){r(y,E.sibling),m=s(E,x.props),m.ref=Hn(y,E,x),m.return=y,y=m;break e}r(y,E);break}else t(y,E);E=E.sibling}x.type===on?(m=$r(x.props.children,y.mode,k,x.key),m.return=y,y=m):(k=Hi(x.type,x.key,x.props,null,y.mode,k),k.ref=Hn(y,m,x),k.return=y,y=k)}return a(y);case an:e:{for(E=x.key;m!==null;){if(m.key===E)if(m.tag===4&&m.stateNode.containerInfo===x.containerInfo&&m.stateNode.implementation===x.implementation){r(y,m.sibling),m=s(m,x.children||[]),m.return=y,y=m;break e}else{r(y,m);break}else t(y,m);m=m.sibling}m=Io(x,y.mode,k),m.return=y,y=m}return a(y);case Qt:return E=x._init,w(y,m,E(x._payload),k)}if(es(x))return v(y,m,x,k);if(Fn(x))return g(y,m,x,k);yi(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,m!==null&&m.tag===6?(r(y,m.sibling),m=s(m,x),m.return=y,y=m):(r(y,m),m=$o(x,y.mode,k),m.return=y,y=m),a(y)):r(y,m)}return w}var Tn=Jf(!0),Yf=Jf(!1),ca=kr(null),ua=null,mn=null,Rc=null;function Pc(){Rc=mn=ua=null}function Oc(e){var t=ca.current;ne(ca),e._currentValue=t}function Cl(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 _n(e,t){ua=e,Rc=mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ze=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Rc!==e)if(e={context:e,memoizedValue:t,next:null},mn===null){if(ua===null)throw Error(P(308));mn=e,ua.dependencies={lanes:0,firstContext:e}}else mn=mn.next=e;return t}var Rr=null;function zc(e){Rr===null?Rr=[e]:Rr.push(e)}function Qf(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,zc(t)):(r.next=s.next,s.next=r),t.interleaved=r,Ht(e,n)}function Ht(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 Xt=!1;function $c(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xf(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 Mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function dr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,J&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,Ht(e,r)}return s=n.interleaved,s===null?(t.next=t,zc(n)):(t.next=s.next,s.next=t),n.interleaved=t,Ht(e,r)}function Ui(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,wc(e,r)}}function sd(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 da(e,t,r,n){var s=e.updateQueue;Xt=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;a=0,d=u=c=null,o=i;do{var f=o.lane,p=o.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var v=e,g=o;switch(f=t,p=r,g.tag){case 1:if(v=g.payload,typeof v=="function"){h=v.call(p,h,f);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=g.payload,f=typeof v=="function"?v.call(p,h,f):v,f==null)break e;h=oe({},h,f);break e;case 2:Xt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else p={eventTime:p,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,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&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Br|=a,e.lanes=a,e.memoizedState=h}}function id(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(P(191,s));s.call(n)}}}var Xs={},_t=kr(Xs),As=kr(Xs),Rs=kr(Xs);function Pr(e){if(e===Xs)throw Error(P(174));return e}function Ic(e,t){switch(te(Rs,t),te(As,e),te(_t,Xs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ol(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ol(t,e)}ne(_t),te(_t,t)}function An(){ne(_t),ne(As),ne(Rs)}function Zf(e){Pr(Rs.current);var t=Pr(_t.current),r=ol(t,e.type);t!==r&&(te(As,e),te(_t,r))}function Dc(e){As.current===e&&(ne(_t),ne(As))}var ie=kr(0);function ha(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 To=[];function Lc(){for(var e=0;e<To.length;e++)To[e]._workInProgressVersionPrimary=null;To.length=0}var Fi=Gt.ReactCurrentDispatcher,Ao=Gt.ReactCurrentBatchConfig,Fr=0,ae=null,pe=null,ve=null,fa=!1,hs=!1,Ps=0,Qy=0;function _e(){throw Error(P(321))}function Uc(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!mt(e[r],t[r]))return!1;return!0}function Fc(e,t,r,n,s,i){if(Fr=i,ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Fi.current=e===null||e.memoizedState===null?t0:r0,e=r(n,s),hs){i=0;do{if(hs=!1,Ps=0,25<=i)throw Error(P(301));i+=1,ve=pe=null,t.updateQueue=null,Fi.current=n0,e=r(n,s)}while(hs)}if(Fi.current=pa,t=pe!==null&&pe.next!==null,Fr=0,ve=pe=ae=null,fa=!1,t)throw Error(P(300));return e}function Bc(){var e=Ps!==0;return Ps=0,e}function vt(){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 tt(){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(P(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 Os(e,t){return typeof t=="function"?t(e):t}function Ro(e){var t=tt(),r=t.queue;if(r===null)throw Error(P(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,c=null,u=i;do{var d=u.lane;if((Fr&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(o=c=h,a=n):c=c.next=h,ae.lanes|=d,Br|=d}u=u.next}while(u!==null&&u!==i);c===null?a=n:c.next=o,mt(n,t.memoizedState)||(ze=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,ae.lanes|=i,Br|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Po(e){var t=tt(),r=t.queue;if(r===null)throw Error(P(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);mt(i,t.memoizedState)||(ze=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function ep(){}function tp(e,t){var r=ae,n=tt(),s=t(),i=!mt(n.memoizedState,s);if(i&&(n.memoizedState=s,ze=!0),n=n.queue,Mc(sp.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||ve!==null&&ve.memoizedState.tag&1){if(r.flags|=2048,zs(9,np.bind(null,r,n,s,t),void 0,null),xe===null)throw Error(P(349));Fr&30||rp(r,t,s)}return s}function rp(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 np(e,t,r,n){t.value=r,t.getSnapshot=n,ip(t)&&ap(e)}function sp(e,t,r){return r(function(){ip(t)&&ap(e)})}function ip(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!mt(e,r)}catch{return!0}}function ap(e){var t=Ht(e,1);t!==null&&ft(t,e,1,-1)}function ad(e){var t=vt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:e},t.queue=e,e=e.dispatch=e0.bind(null,ae,e),[t.memoizedState,e]}function zs(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 op(){return tt().memoizedState}function Bi(e,t,r,n){var s=vt();ae.flags|=e,s.memoizedState=zs(1|t,r,void 0,n===void 0?null:n)}function Ha(e,t,r,n){var s=tt();n=n===void 0?null:n;var i=void 0;if(pe!==null){var a=pe.memoizedState;if(i=a.destroy,n!==null&&Uc(n,a.deps)){s.memoizedState=zs(t,r,i,n);return}}ae.flags|=e,s.memoizedState=zs(1|t,r,i,n)}function od(e,t){return Bi(8390656,8,e,t)}function Mc(e,t){return Ha(2048,8,e,t)}function lp(e,t){return Ha(4,2,e,t)}function cp(e,t){return Ha(4,4,e,t)}function up(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 dp(e,t,r){return r=r!=null?r.concat([e]):null,Ha(4,4,up.bind(null,t,e),r)}function qc(){}function hp(e,t){var r=tt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Uc(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function fp(e,t){var r=tt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Uc(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function pp(e,t,r){return Fr&21?(mt(r,t)||(r=xf(),ae.lanes|=r,Br|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ze=!0),e.memoizedState=r)}function Xy(e,t){var r=Q;Q=r!==0&&4>r?r:4,e(!0);var n=Ao.transition;Ao.transition={};try{e(!1),t()}finally{Q=r,Ao.transition=n}}function mp(){return tt().memoizedState}function Zy(e,t,r){var n=fr(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},gp(e))yp(t,r);else if(r=Qf(e,t,r,n),r!==null){var s=Te();ft(r,e,n,s),vp(r,t,n)}}function e0(e,t,r){var n=fr(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(gp(e))yp(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,mt(o,a)){var c=t.interleaved;c===null?(s.next=s,zc(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=Qf(e,t,s,n),r!==null&&(s=Te(),ft(r,e,n,s),vp(r,t,n))}}function gp(e){var t=e.alternate;return e===ae||t!==null&&t===ae}function yp(e,t){hs=fa=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function vp(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,wc(e,r)}}var pa={readContext:et,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},t0={readContext:et,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:od,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Bi(4194308,4,up.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Bi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bi(4,2,e,t)},useMemo:function(e,t){var r=vt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=vt();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=Zy.bind(null,ae,e),[n.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:ad,useDebugValue:qc,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=ad(!1),t=e[0];return e=Xy.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ae,s=vt();if(se){if(r===void 0)throw Error(P(407));r=r()}else{if(r=t(),xe===null)throw Error(P(349));Fr&30||rp(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,od(sp.bind(null,n,i,e),[e]),n.flags|=2048,zs(9,np.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=vt(),t=xe.identifierPrefix;if(se){var r=Ft,n=Ut;r=(n&~(1<<32-ht(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ps++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Qy++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},r0={readContext:et,useCallback:hp,useContext:et,useEffect:Mc,useImperativeHandle:dp,useInsertionEffect:lp,useLayoutEffect:cp,useMemo:fp,useReducer:Ro,useRef:op,useState:function(){return Ro(Os)},useDebugValue:qc,useDeferredValue:function(e){var t=tt();return pp(t,pe.memoizedState,e)},useTransition:function(){var e=Ro(Os)[0],t=tt().memoizedState;return[e,t]},useMutableSource:ep,useSyncExternalStore:tp,useId:mp,unstable_isNewReconciler:!1},n0={readContext:et,useCallback:hp,useContext:et,useEffect:Mc,useImperativeHandle:dp,useInsertionEffect:lp,useLayoutEffect:cp,useMemo:fp,useReducer:Po,useRef:op,useState:function(){return Po(Os)},useDebugValue:qc,useDeferredValue:function(e){var t=tt();return pe===null?t.memoizedState=e:pp(t,pe.memoizedState,e)},useTransition:function(){var e=Po(Os)[0],t=tt().memoizedState;return[e,t]},useMutableSource:ep,useSyncExternalStore:tp,useId:mp,unstable_isNewReconciler:!1};function ot(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 Nl(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 Va={isMounted:function(e){return(e=e._reactInternals)?Hr(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Te(),s=fr(e),i=Mt(n,s);i.payload=t,r!=null&&(i.callback=r),t=dr(e,i,s),t!==null&&(ft(t,e,s,n),Ui(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Te(),s=fr(e),i=Mt(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=dr(e,i,s),t!==null&&(ft(t,e,s,n),Ui(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Te(),n=fr(e),s=Mt(r,n);s.tag=2,t!=null&&(s.callback=t),t=dr(e,s,n),t!==null&&(ft(t,e,n,r),Ui(t,e,n))}};function ld(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?!js(r,n)||!js(s,i):!0}function xp(e,t,r){var n=!1,s=gr,i=t.contextType;return typeof i=="object"&&i!==null?i=et(i):(s=De(t)?Lr:Ce.current,n=t.contextTypes,i=(n=n!=null)?Cn(e,s):gr),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Va,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function cd(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&&Va.enqueueReplaceState(t,t.state,null)}function Tl(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},$c(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=et(i):(i=De(t)?Lr:Ce.current,s.context=Cn(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Nl(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&&Va.enqueueReplaceState(s,s.state,null),da(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Rn(e,t){try{var r="",n=t;do r+=Rg(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 Oo(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Al(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var s0=typeof WeakMap=="function"?WeakMap:Map;function wp(e,t,r){r=Mt(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){ga||(ga=!0,Fl=n),Al(e,t)},r}function bp(e,t,r){r=Mt(-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(){Al(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Al(e,t),typeof n!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function ud(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new s0;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=v0.bind(null,e,t,r),t.then(e,e))}function dd(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 hd(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=Mt(-1,1),t.tag=2,dr(r,t,1))),r.lanes|=1),e)}var i0=Gt.ReactCurrentOwner,ze=!1;function Ne(e,t,r,n){t.child=e===null?Yf(t,null,r,n):Tn(t,e.child,r,n)}function fd(e,t,r,n,s){r=r.render;var i=t.ref;return _n(t,s),n=Fc(e,t,r,n,i,s),r=Bc(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vt(e,t,s)):(se&&r&&Nc(t),t.flags|=1,Ne(e,t,n,s),t.child)}function pd(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!Qc(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,kp(e,t,i,n,s)):(e=Hi(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:js,r(a,n)&&e.ref===t.ref)return Vt(e,t,s)}return t.flags|=1,e=pr(i,n),e.ref=t.ref,e.return=t,t.child=e}function kp(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(js(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,Vt(e,t,s)}return Rl(e,t,r,n,s)}function _p(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},te(yn,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,te(yn,Be),Be|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,te(yn,Be),Be|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,te(yn,Be),Be|=n;return Ne(e,t,s,r),t.child}function Sp(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Rl(e,t,r,n,s){var i=De(r)?Lr:Ce.current;return i=Cn(t,i),_n(t,s),r=Fc(e,t,r,n,i,s),n=Bc(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vt(e,t,s)):(se&&n&&Nc(t),t.flags|=1,Ne(e,t,r,s),t.child)}function md(e,t,r,n,s){if(De(r)){var i=!0;aa(t)}else i=!1;if(_n(t,s),t.stateNode===null)Mi(e,t),xp(t,r,n),Tl(t,r,n,s),n=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var c=a.context,u=r.contextType;typeof u=="object"&&u!==null?u=et(u):(u=De(r)?Lr:Ce.current,u=Cn(t,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||c!==u)&&cd(t,a,n,u),Xt=!1;var f=t.memoizedState;a.state=f,da(t,n,a,s),c=t.memoizedState,o!==n||f!==c||Ie.current||Xt?(typeof d=="function"&&(Nl(t,r,d,n),c=t.memoizedState),(o=Xt||ld(t,r,o,n,f,c,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=u,n=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,Xf(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:ot(t.type,o),a.props=u,h=t.pendingProps,f=a.context,c=r.contextType,typeof c=="object"&&c!==null?c=et(c):(c=De(r)?Lr:Ce.current,c=Cn(t,c));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||f!==c)&&cd(t,a,n,c),Xt=!1,f=t.memoizedState,a.state=f,da(t,n,a,s);var v=t.memoizedState;o!==h||f!==v||Ie.current||Xt?(typeof p=="function"&&(Nl(t,r,p,n),v=t.memoizedState),(u=Xt||ld(t,r,u,n,f,v,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,v,c)),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=v),a.props=n,a.state=v,a.context=c,n=u):(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 Pl(e,t,r,n,i,s)}function Pl(e,t,r,n,s,i){Sp(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return s&&ed(t,r,!1),Vt(e,t,i);n=t.stateNode,i0.current=t;var o=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=Tn(t,e.child,null,i),t.child=Tn(t,null,o,i)):Ne(e,t,o,i),t.memoizedState=n.state,s&&ed(t,r,!0),t.child}function Ep(e){var t=e.stateNode;t.pendingContext?Zu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zu(e,t.context,!1),Ic(e,t.containerInfo)}function gd(e,t,r,n,s){return Nn(),Ac(s),t.flags|=256,Ne(e,t,r,n),t.child}var Ol={dehydrated:null,treeContext:null,retryLane:0};function zl(e){return{baseLanes:e,cachePool:null,transitions:null}}function jp(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),te(ie,s&1),e===null)return jl(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=Ja(a,n,0,null),e=$r(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=zl(r),t.memoizedState=Ol,e):Wc(t,a));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return a0(e,t,a,n,o,s,r);if(i){i=n.fallback,a=t.mode,s=e.child,o=s.sibling;var c={mode:"hidden",children:n.children};return!(a&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=pr(s,c),n.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=pr(o,i):(i=$r(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?zl(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=Ol,n}return i=e.child,e=i.sibling,n=pr(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 Wc(e,t){return t=Ja({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function vi(e,t,r,n){return n!==null&&Ac(n),Tn(t,e.child,null,r),e=Wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function a0(e,t,r,n,s,i,a){if(r)return t.flags&256?(t.flags&=-257,n=Oo(Error(P(422))),vi(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=Ja({mode:"visible",children:n.children},s,0,null),i=$r(i,s,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Tn(t,e.child,null,a),t.child.memoizedState=zl(a),t.memoizedState=Ol,i);if(!(t.mode&1))return vi(e,t,a,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var o=n.dgst;return n=o,i=Error(P(419)),n=Oo(i,n,void 0),vi(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,Ht(e,s),ft(n,e,s,-1))}return Yc(),n=Oo(Error(P(421))),vi(e,t,a,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=x0.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,qe=ur(s.nextSibling),We=t,se=!0,ut=null,e!==null&&(Je[Ye++]=Ut,Je[Ye++]=Ft,Je[Ye++]=Ur,Ut=e.id,Ft=e.overflow,Ur=t),t=Wc(t,n.children),t.flags|=4096,t)}function yd(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Cl(e.return,t,r)}function zo(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 Cp(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&&yd(e,r,t);else if(e.tag===19)yd(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(te(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&&ha(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),zo(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&&ha(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}zo(t,!0,r,null,i);break;case"together":zo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Mi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Br|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(P(153));if(t.child!==null){for(e=t.child,r=pr(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=pr(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function o0(e,t,r){switch(t.tag){case 3:Ep(t),Nn();break;case 5:Zf(t);break;case 1:De(t.type)&&aa(t);break;case 4:Ic(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;te(ca,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(te(ie,ie.current&1),t.flags|=128,null):r&t.child.childLanes?jp(e,t,r):(te(ie,ie.current&1),e=Vt(e,t,r),e!==null?e.sibling:null);te(ie,ie.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return Cp(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),te(ie,ie.current),n)break;return null;case 22:case 23:return t.lanes=0,_p(e,t,r)}return Vt(e,t,r)}var Np,$l,Tp,Ap;Np=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}};$l=function(){};Tp=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Pr(_t.current);var i=null;switch(r){case"input":s=nl(e,s),n=nl(e,n),i=[];break;case"select":s=oe({},s,{value:void 0}),n=oe({},n,{value:void 0}),i=[];break;case"textarea":s=al(e,s),n=al(e,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=sa)}ll(r,n);var a;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var o=s[u];for(a in o)o.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(xs.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(o=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in c)c.hasOwnProperty(a)&&o[a]!==c[a]&&(r||(r={}),r[a]=c[a])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(xs.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&re("scroll",e),i||o===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Ap=function(e,t,r,n){r!==n&&(t.flags|=4)};function Vn(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 l0(e,t,r){var n=t.pendingProps;switch(Tc(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)&&ia(),Se(t),null;case 3:return n=t.stateNode,An(),ne(Ie),ne(Ce),Lc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(gi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ut!==null&&(ql(ut),ut=null))),$l(e,t),Se(t),null;case 5:Dc(t);var s=Pr(Rs.current);if(r=t.type,e!==null&&t.stateNode!=null)Tp(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(P(166));return Se(t),null}if(e=Pr(_t.current),gi(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[bt]=t,n[Ts]=i,e=(t.mode&1)!==0,r){case"dialog":re("cancel",n),re("close",n);break;case"iframe":case"object":case"embed":re("load",n);break;case"video":case"audio":for(s=0;s<rs.length;s++)re(rs[s],n);break;case"source":re("error",n);break;case"img":case"image":case"link":re("error",n),re("load",n);break;case"details":re("toggle",n);break;case"input":ju(n,i),re("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},re("invalid",n);break;case"textarea":Nu(n,i),re("invalid",n)}ll(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&&mi(n.textContent,o,e),s=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&mi(n.textContent,o,e),s=["children",""+o]):xs.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&re("scroll",n)}switch(r){case"input":oi(n),Cu(n,i,!0);break;case"textarea":oi(n),Tu(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=sa)}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=nf(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[bt]=t,e[Ts]=n,Np(e,t,!1,!1),t.stateNode=e;e:{switch(a=cl(r,n),r){case"dialog":re("cancel",e),re("close",e),s=n;break;case"iframe":case"object":case"embed":re("load",e),s=n;break;case"video":case"audio":for(s=0;s<rs.length;s++)re(rs[s],e);s=n;break;case"source":re("error",e),s=n;break;case"img":case"image":case"link":re("error",e),re("load",e),s=n;break;case"details":re("toggle",e),s=n;break;case"input":ju(e,n),s=nl(e,n),re("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=oe({},n,{value:void 0}),re("invalid",e);break;case"textarea":Nu(e,n),s=al(e,n),re("invalid",e);break;default:s=n}ll(r,s),o=s;for(i in o)if(o.hasOwnProperty(i)){var c=o[i];i==="style"?of(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&sf(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&ws(e,c):typeof c=="number"&&ws(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(xs.hasOwnProperty(i)?c!=null&&i==="onScroll"&&re("scroll",e):c!=null&&pc(e,i,c,a))}switch(r){case"input":oi(e),Cu(e,n,!1);break;case"textarea":oi(e),Tu(e);break;case"option":n.value!=null&&e.setAttribute("value",""+mr(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?xn(e,!!n.multiple,i,!1):n.defaultValue!=null&&xn(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=sa)}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)Ap(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(P(166));if(r=Pr(Rs.current),Pr(_t.current),gi(t)){if(n=t.stateNode,r=t.memoizedProps,n[bt]=t,(i=n.nodeValue!==r)&&(e=We,e!==null))switch(e.tag){case 3:mi(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&mi(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[bt]=t,t.stateNode=n}return Se(t),null;case 13:if(ne(ie),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&qe!==null&&t.mode&1&&!(t.flags&128))Gf(),Nn(),t.flags|=98560,i=!1;else if(i=gi(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(P(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(P(317));i[bt]=t}else Nn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Se(t),i=!1}else ut!==null&&(ql(ut),ut=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):Yc())),t.updateQueue!==null&&(t.flags|=4),Se(t),null);case 4:return An(),$l(e,t),e===null&&Cs(t.stateNode.containerInfo),Se(t),null;case 10:return Oc(t.type._context),Se(t),null;case 17:return De(t.type)&&ia(),Se(t),null;case 19:if(ne(ie),i=t.memoizedState,i===null)return Se(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)Vn(i,!1);else{if(me!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ha(e),a!==null){for(t.flags|=128,Vn(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 te(ie,ie.current&1|2),t.child}e=e.sibling}i.tail!==null&&de()>Pn&&(t.flags|=128,n=!0,Vn(i,!1),t.lanes=4194304)}else{if(!n)if(e=ha(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Vn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!se)return Se(t),null}else 2*de()-i.renderingStartTime>Pn&&r!==1073741824&&(t.flags|=128,n=!0,Vn(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,te(ie,n?r&1|2:r&1),t):(Se(t),null);case 22:case 23:return Jc(),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(P(156,t.tag))}function c0(e,t){switch(Tc(t),t.tag){case 1:return De(t.type)&&ia(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return An(),ne(Ie),ne(Ce),Lc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dc(t),null;case 13:if(ne(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(P(340));Nn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ne(ie),null;case 4:return An(),null;case 10:return Oc(t.type._context),null;case 22:case 23:return Jc(),null;case 24:return null;default:return null}}var xi=!1,je=!1,u0=typeof WeakSet=="function"?WeakSet:Set,F=null;function gn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ce(e,t,n)}else r.current=null}function Il(e,t,r){try{r()}catch(n){ce(e,t,n)}}var vd=!1;function d0(e,t){if(xl=ta,e=$f(),Cc(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,c=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(o=a+s),h!==i||n!==0&&h.nodeType!==3||(c=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++u===s&&(o=a),f===i&&++d===n&&(c=a),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=o===-1||c===-1?null:{start:o,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(wl={focusedElem:e,selectionRange:r},ta=!1,F=t;F!==null;)if(t=F,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,F=e;else for(;F!==null;){t=F;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var g=v.memoizedProps,w=v.memoizedState,y=t.stateNode,m=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:ot(t.type,g),w);y.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(k){ce(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,F=e;break}F=t.return}return v=vd,vd=!1,v}function fs(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&&Il(t,r,i)}s=s.next}while(s!==n)}}function Ka(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 Dl(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 Rp(e){var t=e.alternate;t!==null&&(e.alternate=null,Rp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Ts],delete t[_l],delete t[Ky],delete t[Gy])),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 Pp(e){return e.tag===5||e.tag===3||e.tag===4}function xd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Pp(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 Ll(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=sa));else if(n!==4&&(e=e.child,e!==null))for(Ll(e,t,r),e=e.sibling;e!==null;)Ll(e,t,r),e=e.sibling}function Ul(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(Ul(e,t,r),e=e.sibling;e!==null;)Ul(e,t,r),e=e.sibling}var we=null,ct=!1;function Yt(e,t,r){for(r=r.child;r!==null;)Op(e,t,r),r=r.sibling}function Op(e,t,r){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(Ua,r)}catch{}switch(r.tag){case 5:je||gn(r,t);case 6:var n=we,s=ct;we=null,Yt(e,t,r),we=n,ct=s,we!==null&&(ct?(e=we,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):we.removeChild(r.stateNode));break;case 18:we!==null&&(ct?(e=we,r=r.stateNode,e.nodeType===8?Co(e.parentNode,r):e.nodeType===1&&Co(e,r),Ss(e)):Co(we,r.stateNode));break;case 4:n=we,s=ct,we=r.stateNode.containerInfo,ct=!0,Yt(e,t,r),we=n,ct=s;break;case 0:case 11:case 14:case 15:if(!je&&(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)&&Il(r,t,a),s=s.next}while(s!==n)}Yt(e,t,r);break;case 1:if(!je&&(gn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){ce(r,t,o)}Yt(e,t,r);break;case 21:Yt(e,t,r);break;case 22:r.mode&1?(je=(n=je)||r.memoizedState!==null,Yt(e,t,r),je=n):Yt(e,t,r);break;default:Yt(e,t,r)}}function wd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new u0),t.forEach(function(n){var s=w0.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function nt(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,ct=!1;break e;case 3:we=o.stateNode.containerInfo,ct=!0;break e;case 4:we=o.stateNode.containerInfo,ct=!0;break e}o=o.return}if(we===null)throw Error(P(160));Op(i,a,s),we=null,ct=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){ce(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)zp(t,e),t=t.sibling}function zp(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(nt(t,e),yt(e),n&4){try{fs(3,e,e.return),Ka(3,e)}catch(g){ce(e,e.return,g)}try{fs(5,e,e.return)}catch(g){ce(e,e.return,g)}}break;case 1:nt(t,e),yt(e),n&512&&r!==null&&gn(r,r.return);break;case 5:if(nt(t,e),yt(e),n&512&&r!==null&&gn(r,r.return),e.flags&32){var s=e.stateNode;try{ws(s,"")}catch(g){ce(e,e.return,g)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,o=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&tf(s,i),cl(o,a);var u=cl(o,i);for(a=0;a<c.length;a+=2){var d=c[a],h=c[a+1];d==="style"?of(s,h):d==="dangerouslySetInnerHTML"?sf(s,h):d==="children"?ws(s,h):pc(s,d,h,u)}switch(o){case"input":sl(s,i);break;case"textarea":rf(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?xn(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?xn(s,!!i.multiple,i.defaultValue,!0):xn(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ts]=i}catch(g){ce(e,e.return,g)}}break;case 6:if(nt(t,e),yt(e),n&4){if(e.stateNode===null)throw Error(P(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(g){ce(e,e.return,g)}}break;case 3:if(nt(t,e),yt(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Ss(t.containerInfo)}catch(g){ce(e,e.return,g)}break;case 4:nt(t,e),yt(e);break;case 13:nt(t,e),yt(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Kc=de())),n&4&&wd(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(je=(u=je)||d,nt(t,e),je=u):nt(t,e),yt(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(F=e,d=e.child;d!==null;){for(h=F=d;F!==null;){switch(f=F,p=f.child,f.tag){case 0:case 11:case 14:case 15:fs(4,f,f.return);break;case 1:gn(f,f.return);var v=f.stateNode;if(typeof v.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(g){ce(n,r,g)}}break;case 5:gn(f,f.return);break;case 22:if(f.memoizedState!==null){kd(h);continue}}p!==null?(p.return=f,F=p):kd(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=h.stateNode,c=h.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,o.style.display=af("display",a))}catch(g){ce(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){ce(e,e.return,g)}}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:nt(t,e),yt(e),n&4&&wd(e);break;case 21:break;default:nt(t,e),yt(e)}}function yt(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Pp(r)){var n=r;break e}r=r.return}throw Error(P(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(ws(s,""),n.flags&=-33);var i=xd(e);Ul(e,i,s);break;case 3:case 4:var a=n.stateNode.containerInfo,o=xd(e);Ll(e,o,a);break;default:throw Error(P(161))}}catch(c){ce(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function h0(e,t,r){F=e,$p(e)}function $p(e,t,r){for(var n=(e.mode&1)!==0;F!==null;){var s=F,i=s.child;if(s.tag===22&&n){var a=s.memoizedState!==null||xi;if(!a){var o=s.alternate,c=o!==null&&o.memoizedState!==null||je;o=xi;var u=je;if(xi=a,(je=c)&&!u)for(F=s;F!==null;)a=F,c=a.child,a.tag===22&&a.memoizedState!==null?_d(s):c!==null?(c.return=a,F=c):_d(s);for(;i!==null;)F=i,$p(i),i=i.sibling;F=s,xi=o,je=u}bd(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,F=i):bd(e)}}function bd(e){for(;F!==null;){var t=F;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:je||Ka(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!je)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:ot(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&id(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}id(t,a,r)}break;case 5:var o=t.stateNode;if(r===null&&t.flags&4){r=o;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Ss(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}je||t.flags&512&&Dl(t)}catch(f){ce(t,t.return,f)}}if(t===e){F=null;break}if(r=t.sibling,r!==null){r.return=t.return,F=r;break}F=t.return}}function kd(e){for(;F!==null;){var t=F;if(t===e){F=null;break}var r=t.sibling;if(r!==null){r.return=t.return,F=r;break}F=t.return}}function _d(e){for(;F!==null;){var t=F;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Ka(4,t)}catch(c){ce(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){ce(t,s,c)}}var i=t.return;try{Dl(t)}catch(c){ce(t,i,c)}break;case 5:var a=t.return;try{Dl(t)}catch(c){ce(t,a,c)}}}catch(c){ce(t,t.return,c)}if(t===e){F=null;break}var o=t.sibling;if(o!==null){o.return=t.return,F=o;break}F=t.return}}var f0=Math.ceil,ma=Gt.ReactCurrentDispatcher,Hc=Gt.ReactCurrentOwner,Xe=Gt.ReactCurrentBatchConfig,J=0,xe=null,fe=null,be=0,Be=0,yn=kr(0),me=0,$s=null,Br=0,Ga=0,Vc=0,ps=null,Oe=null,Kc=0,Pn=1/0,Ot=null,ga=!1,Fl=null,hr=null,wi=!1,ir=null,ya=0,ms=0,Bl=null,qi=-1,Wi=0;function Te(){return J&6?de():qi!==-1?qi:qi=de()}function fr(e){return e.mode&1?J&2&&be!==0?be&-be:Yy.transition!==null?(Wi===0&&(Wi=xf()),Wi):(e=Q,e!==0||(e=window.event,e=e===void 0?16:jf(e.type)),e):1}function ft(e,t,r,n){if(50<ms)throw ms=0,Bl=null,Error(P(185));Js(e,r,n),(!(J&2)||e!==xe)&&(e===xe&&(!(J&2)&&(Ga|=r),me===4&&er(e,be)),Le(e,n),r===1&&J===0&&!(t.mode&1)&&(Pn=de()+500,Wa&&_r()))}function Le(e,t){var r=e.callbackNode;Yg(e,t);var n=ea(e,e===xe?be:0);if(n===0)r!==null&&Pu(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Pu(r),t===1)e.tag===0?Jy(Sd.bind(null,e)):Hf(Sd.bind(null,e)),Hy(function(){!(J&6)&&_r()}),r=null;else{switch(wf(n)){case 1:r=xc;break;case 4:r=yf;break;case 16:r=Zi;break;case 536870912:r=vf;break;default:r=Zi}r=qp(r,Ip.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Ip(e,t){if(qi=-1,Wi=0,J&6)throw Error(P(327));var r=e.callbackNode;if(Sn()&&e.callbackNode!==r)return null;var n=ea(e,e===xe?be:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=va(e,n);else{t=n;var s=J;J|=2;var i=Lp();(xe!==e||be!==t)&&(Ot=null,Pn=de()+500,zr(e,t));do try{g0();break}catch(o){Dp(e,o)}while(!0);Pc(),ma.current=i,J=s,fe!==null?t=0:(xe=null,be=0,t=me)}if(t!==0){if(t===2&&(s=pl(e),s!==0&&(n=s,t=Ml(e,s))),t===1)throw r=$s,zr(e,0),er(e,n),Le(e,de()),r;if(t===6)er(e,n);else{if(s=e.current.alternate,!(n&30)&&!p0(s)&&(t=va(e,n),t===2&&(i=pl(e),i!==0&&(n=i,t=Ml(e,i))),t===1))throw r=$s,zr(e,0),er(e,n),Le(e,de()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(P(345));case 2:Nr(e,Oe,Ot);break;case 3:if(er(e,n),(n&130023424)===n&&(t=Kc+500-de(),10<t)){if(ea(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){Te(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=kl(Nr.bind(null,e,Oe,Ot),t);break}Nr(e,Oe,Ot);break;case 4:if(er(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var a=31-ht(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*f0(n/1960))-n,10<n){e.timeoutHandle=kl(Nr.bind(null,e,Oe,Ot),n);break}Nr(e,Oe,Ot);break;case 5:Nr(e,Oe,Ot);break;default:throw Error(P(329))}}}return Le(e,de()),e.callbackNode===r?Ip.bind(null,e):null}function Ml(e,t){var r=ps;return e.current.memoizedState.isDehydrated&&(zr(e,t).flags|=256),e=va(e,t),e!==2&&(t=Oe,Oe=r,t!==null&&ql(t)),e}function ql(e){Oe===null?Oe=e:Oe.push.apply(Oe,e)}function p0(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(!mt(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 er(e,t){for(t&=~Vc,t&=~Ga,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-ht(t),n=1<<r;e[r]=-1,t&=~n}}function Sd(e){if(J&6)throw Error(P(327));Sn();var t=ea(e,0);if(!(t&1))return Le(e,de()),null;var r=va(e,t);if(e.tag!==0&&r===2){var n=pl(e);n!==0&&(t=n,r=Ml(e,n))}if(r===1)throw r=$s,zr(e,0),er(e,t),Le(e,de()),r;if(r===6)throw Error(P(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Nr(e,Oe,Ot),Le(e,de()),null}function Gc(e,t){var r=J;J|=1;try{return e(t)}finally{J=r,J===0&&(Pn=de()+500,Wa&&_r())}}function Mr(e){ir!==null&&ir.tag===0&&!(J&6)&&Sn();var t=J;J|=1;var r=Xe.transition,n=Q;try{if(Xe.transition=null,Q=1,e)return e()}finally{Q=n,Xe.transition=r,J=t,!(J&6)&&_r()}}function Jc(){Be=yn.current,ne(yn)}function zr(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Wy(r)),fe!==null)for(r=fe.return;r!==null;){var n=r;switch(Tc(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ia();break;case 3:An(),ne(Ie),ne(Ce),Lc();break;case 5:Dc(n);break;case 4:An();break;case 13:ne(ie);break;case 19:ne(ie);break;case 10:Oc(n.type._context);break;case 22:case 23:Jc()}r=r.return}if(xe=e,fe=e=pr(e.current,null),be=Be=t,me=0,$s=null,Vc=Ga=Br=0,Oe=ps=null,Rr!==null){for(t=0;t<Rr.length;t++)if(r=Rr[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}Rr=null}return e}function Dp(e,t){do{var r=fe;try{if(Pc(),Fi.current=pa,fa){for(var n=ae.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}fa=!1}if(Fr=0,ve=pe=ae=null,hs=!1,Ps=0,Hc.current=null,r===null||r.return===null){me=1,$s=t,fe=null;break}e:{var i=e,a=r.return,o=r,c=t;if(t=be,o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,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 p=dd(a);if(p!==null){p.flags&=-257,hd(p,a,o,i,t),p.mode&1&&ud(i,u,t),t=p,c=u;var v=t.updateQueue;if(v===null){var g=new Set;g.add(c),t.updateQueue=g}else v.add(c);break e}else{if(!(t&1)){ud(i,u,t),Yc();break e}c=Error(P(426))}}else if(se&&o.mode&1){var w=dd(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),hd(w,a,o,i,t),Ac(Rn(c,o));break e}}i=c=Rn(c,o),me!==4&&(me=2),ps===null?ps=[i]:ps.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=wp(i,c,t);sd(i,y);break e;case 1:o=c;var m=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof m.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(hr===null||!hr.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=bp(i,o,t);sd(i,k);break e}}i=i.return}while(i!==null)}Fp(r)}catch(S){t=S,fe===r&&r!==null&&(fe=r=r.return);continue}break}while(!0)}function Lp(){var e=ma.current;return ma.current=pa,e===null?pa:e}function Yc(){(me===0||me===3||me===2)&&(me=4),xe===null||!(Br&268435455)&&!(Ga&268435455)||er(xe,be)}function va(e,t){var r=J;J|=2;var n=Lp();(xe!==e||be!==t)&&(Ot=null,zr(e,t));do try{m0();break}catch(s){Dp(e,s)}while(!0);if(Pc(),J=r,ma.current=n,fe!==null)throw Error(P(261));return xe=null,be=0,me}function m0(){for(;fe!==null;)Up(fe)}function g0(){for(;fe!==null&&!Bg();)Up(fe)}function Up(e){var t=Mp(e.alternate,e,Be);e.memoizedProps=e.pendingProps,t===null?Fp(e):fe=t,Hc.current=null}function Fp(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=c0(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=l0(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 Nr(e,t,r){var n=Q,s=Xe.transition;try{Xe.transition=null,Q=1,y0(e,t,r,n)}finally{Xe.transition=s,Q=n}return null}function y0(e,t,r,n){do Sn();while(ir!==null);if(J&6)throw Error(P(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(P(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(Qg(e,i),e===xe&&(fe=xe=null,be=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||wi||(wi=!0,qp(Zi,function(){return Sn(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=Xe.transition,Xe.transition=null;var a=Q;Q=1;var o=J;J|=4,Hc.current=null,d0(e,r),zp(r,e),Dy(wl),ta=!!xl,wl=xl=null,e.current=r,h0(r),Mg(),J=o,Q=a,Xe.transition=i}else e.current=r;if(wi&&(wi=!1,ir=e,ya=s),i=e.pendingLanes,i===0&&(hr=null),Hg(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(ga)throw ga=!1,e=Fl,Fl=null,e;return ya&1&&e.tag!==0&&Sn(),i=e.pendingLanes,i&1?e===Bl?ms++:(ms=0,Bl=e):ms=0,_r(),null}function Sn(){if(ir!==null){var e=wf(ya),t=Xe.transition,r=Q;try{if(Xe.transition=null,Q=16>e?16:e,ir===null)var n=!1;else{if(e=ir,ir=null,ya=0,J&6)throw Error(P(331));var s=J;for(J|=4,F=e.current;F!==null;){var i=F,a=i.child;if(F.flags&16){var o=i.deletions;if(o!==null){for(var c=0;c<o.length;c++){var u=o[c];for(F=u;F!==null;){var d=F;switch(d.tag){case 0:case 11:case 15:fs(8,d,i)}var h=d.child;if(h!==null)h.return=d,F=h;else for(;F!==null;){d=F;var f=d.sibling,p=d.return;if(Rp(d),d===u){F=null;break}if(f!==null){f.return=p,F=f;break}F=p}}}var v=i.alternate;if(v!==null){var g=v.child;if(g!==null){v.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}F=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,F=a;else e:for(;F!==null;){if(i=F,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fs(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,F=y;break e}F=i.return}}var m=e.current;for(F=m;F!==null;){a=F;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,F=x;else e:for(a=m;F!==null;){if(o=F,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Ka(9,o)}}catch(S){ce(o,o.return,S)}if(o===a){F=null;break e}var k=o.sibling;if(k!==null){k.return=o.return,F=k;break e}F=o.return}}if(J=s,_r(),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(Ua,e)}catch{}n=!0}return n}finally{Q=r,Xe.transition=t}}return!1}function Ed(e,t,r){t=Rn(r,t),t=wp(e,t,1),e=dr(e,t,1),t=Te(),e!==null&&(Js(e,1,t),Le(e,t))}function ce(e,t,r){if(e.tag===3)Ed(e,e,r);else for(;t!==null;){if(t.tag===3){Ed(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(hr===null||!hr.has(n))){e=Rn(r,e),e=bp(t,e,1),t=dr(t,e,1),e=Te(),t!==null&&(Js(t,1,e),Le(t,e));break}}t=t.return}}function v0(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()-Kc?zr(e,0):Vc|=r),Le(e,t)}function Bp(e,t){t===0&&(e.mode&1?(t=ui,ui<<=1,!(ui&130023424)&&(ui=4194304)):t=1);var r=Te();e=Ht(e,t),e!==null&&(Js(e,t,r),Le(e,r))}function x0(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Bp(e,r)}function w0(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(P(314))}n!==null&&n.delete(t),Bp(e,r)}var Mp;Mp=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ie.current)ze=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return ze=!1,o0(e,t,r);ze=!!(e.flags&131072)}else ze=!1,se&&t.flags&1048576&&Vf(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Mi(e,t),e=t.pendingProps;var s=Cn(t,Ce.current);_n(t,r),s=Fc(null,t,n,e,s,r);var i=Bc();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,aa(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,$c(t),s.updater=Va,t.stateNode=s,s._reactInternals=t,Tl(t,n,e,r),t=Pl(null,t,n,!0,i,r)):(t.tag=0,se&&i&&Nc(t),Ne(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Mi(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=k0(n),e=ot(n,e),s){case 0:t=Rl(null,t,n,e,r);break e;case 1:t=md(null,t,n,e,r);break e;case 11:t=fd(null,t,n,e,r);break e;case 14:t=pd(null,t,n,ot(n.type,e),r);break e}throw Error(P(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ot(n,s),Rl(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ot(n,s),md(e,t,n,s,r);case 3:e:{if(Ep(t),e===null)throw Error(P(387));n=t.pendingProps,i=t.memoizedState,s=i.element,Xf(e,t),da(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=Rn(Error(P(423)),t),t=gd(e,t,n,r,s);break e}else if(n!==s){s=Rn(Error(P(424)),t),t=gd(e,t,n,r,s);break e}else for(qe=ur(t.stateNode.containerInfo.firstChild),We=t,se=!0,ut=null,r=Yf(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Nn(),n===s){t=Vt(e,t,r);break e}Ne(e,t,n,r)}t=t.child}return t;case 5:return Zf(t),e===null&&jl(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,bl(n,s)?a=null:i!==null&&bl(n,i)&&(t.flags|=32),Sp(e,t),Ne(e,t,a,r),t.child;case 6:return e===null&&jl(t),null;case 13:return jp(e,t,r);case 4:return Ic(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Tn(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:ot(n,s),fd(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,te(ca,n._currentValue),n._currentValue=a,i!==null)if(mt(i.value,a)){if(i.children===s.children&&!Ie.current){t=Vt(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 c=o.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=Mt(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),Cl(i.return,r,t),o.lanes|=r;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(P(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),Cl(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,_n(t,r),s=et(s),n=n(s),t.flags|=1,Ne(e,t,n,r),t.child;case 14:return n=t.type,s=ot(n,t.pendingProps),s=ot(n.type,s),pd(e,t,n,s,r);case 15:return kp(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ot(n,s),Mi(e,t),t.tag=1,De(n)?(e=!0,aa(t)):e=!1,_n(t,r),xp(t,n,s),Tl(t,n,s,r),Pl(null,t,n,!0,e,r);case 19:return Cp(e,t,r);case 22:return _p(e,t,r)}throw Error(P(156,t.tag))};function qp(e,t){return gf(e,t)}function b0(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 b0(e,t,r,n)}function Qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function k0(e){if(typeof e=="function")return Qc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===gc)return 11;if(e===yc)return 14}return 2}function pr(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 Hi(e,t,r,n,s,i){var a=2;if(n=e,typeof e=="function")Qc(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case on:return $r(r.children,s,i,t);case mc:a=8,s|=8;break;case Zo:return e=Qe(12,r,t,s|2),e.elementType=Zo,e.lanes=i,e;case el:return e=Qe(13,r,t,s),e.elementType=el,e.lanes=i,e;case tl:return e=Qe(19,r,t,s),e.elementType=tl,e.lanes=i,e;case Xh:return Ja(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Yh:a=10;break e;case Qh:a=9;break e;case gc:a=11;break e;case yc:a=14;break e;case Qt:a=16,n=null;break e}throw Error(P(130,e==null?e:typeof e,""))}return t=Qe(a,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function $r(e,t,r,n){return e=Qe(7,e,n,t),e.lanes=r,e}function Ja(e,t,r,n){return e=Qe(22,e,n,t),e.elementType=Xh,e.lanes=r,e.stateNode={isHidden:!1},e}function $o(e,t,r){return e=Qe(6,e,null,t),e.lanes=r,e}function Io(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 _0(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=go(0),this.expirationTimes=go(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=go(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Xc(e,t,r,n,s,i,a,o,c){return e=new _0(e,t,r,o,c),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},$c(i),e}function S0(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:an,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function Wp(e){if(!e)return gr;e=e._reactInternals;e:{if(Hr(e)!==e||e.tag!==1)throw Error(P(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(P(171))}if(e.tag===1){var r=e.type;if(De(r))return Wf(e,r,t)}return t}function Hp(e,t,r,n,s,i,a,o,c){return e=Xc(r,n,!0,e,s,i,a,o,c),e.context=Wp(null),r=e.current,n=Te(),s=fr(r),i=Mt(n,s),i.callback=t??null,dr(r,i,s),e.current.lanes=s,Js(e,s,n),Le(e,n),e}function Ya(e,t,r,n){var s=t.current,i=Te(),a=fr(s);return r=Wp(r),t.context===null?t.context=r:t.pendingContext=r,t=Mt(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=dr(s,t,a),e!==null&&(ft(e,s,a,i),Ui(e,s,a)),a}function xa(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 jd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Zc(e,t){jd(e,t),(e=e.alternate)&&jd(e,t)}function E0(){return null}var Vp=typeof reportError=="function"?reportError:function(e){console.error(e)};function eu(e){this._internalRoot=e}Qa.prototype.render=eu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(P(409));Ya(e,t,null,null)};Qa.prototype.unmount=eu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Mr(function(){Ya(null,e,null,null)}),t[Wt]=null}};function Qa(e){this._internalRoot=e}Qa.prototype.unstable_scheduleHydration=function(e){if(e){var t=_f();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Zt.length&&t!==0&&t<Zt[r].priority;r++);Zt.splice(r,0,e),r===0&&Ef(e)}};function tu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Cd(){}function j0(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=xa(a);i.call(u)}}var a=Hp(t,n,e,0,null,!1,!1,"",Cd);return e._reactRootContainer=a,e[Wt]=a.current,Cs(e.nodeType===8?e.parentNode:e),Mr(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var o=n;n=function(){var u=xa(c);o.call(u)}}var c=Xc(e,0,!1,null,null,!1,!1,"",Cd);return e._reactRootContainer=c,e[Wt]=c.current,Cs(e.nodeType===8?e.parentNode:e),Mr(function(){Ya(t,c,r,n)}),c}function Za(e,t,r,n,s){var i=r._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var o=s;s=function(){var c=xa(a);o.call(c)}}Ya(t,a,e,s)}else a=j0(r,t,e,s,n);return xa(a)}bf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ts(t.pendingLanes);r!==0&&(wc(t,r|1),Le(t,de()),!(J&6)&&(Pn=de()+500,_r()))}break;case 13:Mr(function(){var n=Ht(e,1);if(n!==null){var s=Te();ft(n,e,1,s)}}),Zc(e,1)}};bc=function(e){if(e.tag===13){var t=Ht(e,134217728);if(t!==null){var r=Te();ft(t,e,134217728,r)}Zc(e,134217728)}};kf=function(e){if(e.tag===13){var t=fr(e),r=Ht(e,t);if(r!==null){var n=Te();ft(r,e,t,n)}Zc(e,t)}};_f=function(){return Q};Sf=function(e,t){var r=Q;try{return Q=e,t()}finally{Q=r}};dl=function(e,t,r){switch(t){case"input":if(sl(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=qa(n);if(!s)throw Error(P(90));ef(n),sl(n,s)}}}break;case"textarea":rf(e,r);break;case"select":t=r.value,t!=null&&xn(e,!!r.multiple,t,!1)}};uf=Gc;df=Mr;var C0={usingClientEntryPoint:!1,Events:[Qs,dn,qa,lf,cf,Gc]},Kn={findFiberByHostInstance:Ar,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},N0={bundleType:Kn.bundleType,version:Kn.version,rendererPackageName:Kn.rendererPackageName,rendererConfig:Kn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Gt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=pf(e),e===null?null:e.stateNode},findFiberByHostInstance:Kn.findFiberByHostInstance||E0,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 bi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bi.isDisabled&&bi.supportsFiber)try{Ua=bi.inject(N0),kt=bi}catch{}}Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C0;Ve.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tu(t))throw Error(P(200));return S0(e,t,null,r)};Ve.createRoot=function(e,t){if(!tu(e))throw Error(P(299));var r=!1,n="",s=Vp;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Xc(e,1,!1,null,null,r,!1,n,s),e[Wt]=t.current,Cs(e.nodeType===8?e.parentNode:e),new eu(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(P(188)):(e=Object.keys(e).join(","),Error(P(268,e)));return e=pf(t),e=e===null?null:e.stateNode,e};Ve.flushSync=function(e){return Mr(e)};Ve.hydrate=function(e,t,r){if(!Xa(t))throw Error(P(200));return Za(null,e,t,!0,r)};Ve.hydrateRoot=function(e,t,r){if(!tu(e))throw Error(P(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",a=Vp;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=Hp(t,null,e,1,r??null,s,!1,i,a),e[Wt]=t.current,Cs(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 Qa(t)};Ve.render=function(e,t,r){if(!Xa(t))throw Error(P(200));return Za(null,e,t,!1,r)};Ve.unmountComponentAtNode=function(e){if(!Xa(e))throw Error(P(40));return e._reactRootContainer?(Mr(function(){Za(null,null,e,!1,function(){e._reactRootContainer=null,e[Wt]=null})}),!0):!1};Ve.unstable_batchedUpdates=Gc;Ve.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Xa(r))throw Error(P(200));if(e==null||e._reactInternals===void 0)throw Error(P(38));return Za(e,t,r,!1,n)};Ve.version="18.3.1-next-f1338f8080-20240426";function Kp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kp)}catch(e){console.error(e)}}Kp(),Vh.exports=Ve;var T0=Vh.exports,Nd=T0;Qo.createRoot=Nd.createRoot,Qo.hydrateRoot=Nd.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 ru=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Gp=/^[\\/]{2}/;function A0(e,t){return t+e.replace(/\\/g,"/")}var Td="popstate";function Ad(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function R0(e={}){function t(n,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:a,search:o,hash:c}=i||n.location;return Wl("",{pathname:a,search:o,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,s){return typeof s=="string"?s:Is(s)}return O0(t,r,null,e)}function ge(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Et(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function P0(){return Math.random().toString(36).substring(2,10)}function Rd(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 Wl(e,t,r=null,n,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Zs(t):t,state:r,key:t&&t.key||n||P0(),mask:s}}function Is({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 Zs(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 O0(e,t,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,o="POP",c=null,u=d();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function d(){return(a.state||{idx:null}).idx}function h(){o="POP";let w=d(),y=w==null?null:w-u;u=w,c&&c({action:o,location:g.location,delta:y})}function f(w,y){o="PUSH";let m=Ad(w)?w:Wl(g.location,w,y);u=d()+1;let x=Rd(m,u),k=g.createHref(m.mask||m);try{a.pushState(x,"",k)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(k)}i&&c&&c({action:o,location:g.location,delta:1})}function p(w,y){o="REPLACE";let m=Ad(w)?w:Wl(g.location,w,y);u=d();let x=Rd(m,u),k=g.createHref(m.mask||m);a.replaceState(x,"",k),i&&c&&c({action:o,location:g.location,delta:0})}function v(w){return z0(s,w)}let g={get action(){return o},get location(){return e(s,a)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Td,h),c=w,()=>{s.removeEventListener(Td,h),c=null}},createHref(w){return t(s,w)},createURL:v,encodeLocation(w){let y=v(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(w){return a.go(w)}};return g}function z0(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:Is(t);return s=s.replace(/ $/,"%20"),!r&&Gp.test(s)&&(s=n+s),new URL(s,n)}function Jp(e,t,r="/"){return $0(e,t,r,!1)}function $0(e,t,r,n,s){let i=typeof t=="string"?Zs(t):t,a=Kt(i.pathname||"/",r);if(a==null)return null;let o=I0(e),c=null,u=K0(a);for(let d=0;c==null&&d<o.length;++d)c=V0(o[d],u,n);return c}function I0(e){let t=Yp(e);return D0(t),t}function Yp(e,t=[],r=[],n="",s=!1){let i=(a,o,c=s,u)=>{let d={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&c)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=pt([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}".`),Yp(a.children,t,f,h,c)),!(a.path==null&&!a.index)&&t.push({path:h,score:W0(h,a.index),routesMeta:f.map((p,v)=>{let[g,w]=Zp(p.relativePath,p.caseSensitive,v===f.length-1);return{...p,matcher:g,compiledParams:w}})})};return e.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,o);else for(let u of Qp(a.path))i(a,o,!0,u)}),t}function Qp(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=Qp(n.join("/")),o=[];return o.push(...a.map(c=>c===""?i:[i,c].join("/"))),s&&o.push(...a),o.map(c=>e.startsWith("/")&&c===""?"/":c)}function D0(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:H0(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var L0=/^:[\w-]+$/,U0=3,F0=2,B0=1,M0=10,q0=-2,Pd=e=>e==="*";function W0(e,t){let r=e.split("/"),n=r.length;return r.some(Pd)&&(n+=q0),t&&(n+=F0),r.filter(s=>!Pd(s)).reduce((s,i)=>s+(L0.test(i)?U0:i===""?B0:M0),n)}function H0(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 V0(e,t,r=!1){let{routesMeta:n}=e,s={},i="/",a=[];for(let o=0;o<n.length;++o){let c=n[o],u=o===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",h={path:c.relativePath,caseSensitive:c.caseSensitive,end:u},f=c.matcher&&c.compiledParams?Xp(h,d,c.matcher,c.compiledParams):wa(h,d),p=c.route;if(!f&&u&&r&&!n[n.length-1].route.index&&(f=wa({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!f)return null;Object.assign(s,f.params),a.push({params:s,pathname:pt([i,f.pathname]),pathnameBase:Y0(pt([i,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(i=pt([i,f.pathnameBase]))}return a}function wa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Zp(e.path,e.caseSensitive,e.end);return Xp(e,t,r,n)}function Xp(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((u,{paramName:d,isOptional:h},f)=>{if(d==="*"){let v=o[f]||"";a=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const p=o[f];return h&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:e}}function Zp(e,t=!1,r=!0){Et(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,c,u,d)=>{if(n.push({paramName:o,isOptional:c!=null}),c){let h=d.charAt(u+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function K0(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Et(!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 Kt(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 G0(e,t="/"){let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Zs(e):e,i;return r?(r=tm(r),r.startsWith("/")?i=Od(r.substring(1),"/"):i=Od(r,t)):i=t,{pathname:i,search:Q0(n),hash:X0(s)}}function Od(e,t){let r=ba(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Do(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 J0(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function em(e){let t=J0(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function nu(e,t,r,n=!1){let s;typeof e=="string"?s=Zs(e):(s={...e},ge(!s.pathname||!s.pathname.includes("?"),Do("?","pathname","search",s)),ge(!s.pathname||!s.pathname.includes("#"),Do("#","pathname","hash",s)),ge(!s.search||!s.search.includes("#"),Do("#","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 c=G0(s,o),u=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var tm=e=>e.replace(/[\\/]{2,}/g,"/"),pt=e=>tm(e.join("/")),ba=e=>e.replace(/\/+$/,""),Y0=e=>ba(e).replace(/^\/*/,"/"),Q0=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,X0=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Z0=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 ev(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function tv(e){let t=e.map(r=>r.route.path).filter(Boolean);return pt(t)||"/"}var rm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nm(e,t){let r=e;if(typeof r!="string"||!ru.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,s=!1;if(rm)try{let i=new URL(window.location.href),a=Gp.test(r)?new URL(A0(r,i.protocol)):new URL(r),o=Kt(a.pathname,t);a.origin===i.origin&&o!=null?r=o+a.search+a.hash:s=!0}catch{Et(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var sm=["POST","PUT","PATCH","DELETE"];new Set(sm);var rv=["GET",...sm];new Set(rv);var nv=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function sv(e){try{return nv.includes(new URL(e).protocol)}catch{return!1}}var Dn=b.createContext(null);Dn.displayName="DataRouter";var eo=b.createContext(null);eo.displayName="DataRouterState";var im=b.createContext(!1);function iv(){return b.useContext(im)}var am=b.createContext({isTransitioning:!1});am.displayName="ViewTransition";var av=b.createContext(new Map);av.displayName="Fetchers";var ov=b.createContext(null);ov.displayName="Await";var rt=b.createContext(null);rt.displayName="Navigation";var to=b.createContext(null);to.displayName="Location";var Jt=b.createContext({outlet:null,matches:[],isDataRoute:!1});Jt.displayName="Route";var su=b.createContext(null);su.displayName="RouteError";var om="REACT_ROUTER_ERROR",lv="REDIRECT",cv="ROUTE_ERROR_RESPONSE";function uv(e){if(e.startsWith(`${om}:${lv}:{`))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 dv(e){if(e.startsWith(`${om}:${cv}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Z0(t.status,t.statusText,t.data)}catch{}}function hv(e,{relative:t}={}){ge(ei(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=b.useContext(rt),{hash:s,pathname:i,search:a}=ti(e,{relative:t}),o=i;return r!=="/"&&(o=i==="/"?r:pt([r,i])),n.createHref({pathname:o,search:a,hash:s})}function ei(){return b.useContext(to)!=null}function gt(){return ge(ei(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(to).location}var lm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cm(e){b.useContext(rt).static||b.useLayoutEffect(e)}function um(){let{isDataRoute:e}=b.useContext(Jt);return e?Ev():fv()}function fv(){ge(ei(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Dn),{basename:t,navigator:r}=b.useContext(rt),{matches:n}=b.useContext(Jt),{pathname:s}=gt(),i=JSON.stringify(em(n)),a=b.useRef(!1);return cm(()=>{a.current=!0}),b.useCallback((c,u={})=>{if(Et(a.current,lm),!a.current)return;if(typeof c=="number"){r.go(c);return}let d=nu(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:pt([t,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[t,r,i,s,e])}b.createContext(null);function ti(e,{relative:t}={}){let{matches:r}=b.useContext(Jt),{pathname:n}=gt(),s=JSON.stringify(em(r));return b.useMemo(()=>nu(e,JSON.parse(s),n,t==="path"),[e,s,n,t])}function pv(e,t,r){ge(ei(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=b.useContext(rt),{matches:s}=b.useContext(Jt),i=s[s.length-1],a=i?i.params:{},o=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let w=u&&u.path||"";hm(o,!u||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${w}">) 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="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let d=gt(),h;h=d;let f=h.pathname||"/",p=f;if(c!=="/"){let w=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=r&&r.state.matches.length?r.state.matches.map(w=>Object.assign(w,{route:r.manifest[w.route.id]||w.route})):Jp(e,{pathname:p});return Et(u||v!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Et(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.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.`),xv(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:pt([c,n.encodeLocation?n.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?c:pt([c,n.encodeLocation?n.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,r)}function mv(){let e=Sv(),t=ev(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=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:i},"ErrorBoundary")," or"," ",b.createElement("code",{style:i},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),r?b.createElement("pre",{style:s},r):null,a)}var gv=b.createElement(mv,null),dm=class extends b.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=dv(e.digest);r&&(e=r)}let t=e!==void 0?b.createElement(Jt.Provider,{value:this.props.routeContext},b.createElement(su.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(yv,{error:e},t):t}};dm.contextType=im;var Lo=new WeakMap;function yv({children:e,error:t}){let{basename:r}=b.useContext(rt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=uv(t.digest);if(n){let s=Lo.get(t);if(s)throw s;let i=nm(n.location,r),a=i.absoluteURL||i.to;if(sv(a))throw new Error("Invalid redirect location");if(rm&&!Lo.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 Lo.set(t,o),o}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a}`})}}return e}function vv({routeContext:e,match:t,children:r}){let n=b.useContext(Dn);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(Jt.Provider,{value:e},r)}function xv(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:p}=n,v=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!p||p[h.route.id]===void 0);if(h.route.lazy||v){r.isStatic&&(a=!0),o>=0?s=s.slice(0,o+1):s=[s[0]];break}}}}let c=r==null?void 0:r.onError,u=n&&c?(d,h)=>{var f,p;c(d,{location:n.location,params:((p=(f=n.matches)==null?void 0:f[0])==null?void 0:p.params)??{},pattern:tv(n.matches),errorInfo:h})}:void 0;return s.reduceRight((d,h,f)=>{let p,v=!1,g=null,w=null;n&&(p=i&&h.route.id?i[h.route.id]:void 0,g=h.route.errorElement||gv,a&&(o<0&&f===0?(hm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,w=null):o===f&&(v=!0,w=h.route.hydrateFallbackElement||null)));let y=t.concat(s.slice(0,f+1)),m=()=>{let x;return p?x=g:v?x=w:h.route.Component?x=b.createElement(h.route.Component,null):h.route.element?x=h.route.element:x=d,b.createElement(vv,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:x})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?b.createElement(dm,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:m(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:u}):m()},null)}function iu(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wv(e){let t=b.useContext(Dn);return ge(t,iu(e)),t}function bv(e){let t=b.useContext(eo);return ge(t,iu(e)),t}function kv(e){let t=b.useContext(Jt);return ge(t,iu(e)),t}function au(e){let t=kv(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 _v(){return au("useRouteId")}function Sv(){var n;let e=b.useContext(su),t=bv("useRouteError"),r=au("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function Ev(){let{router:e}=wv("useNavigate"),t=au("useNavigate"),r=b.useRef(!1);return cm(()=>{r.current=!0}),b.useCallback(async(s,i={})=>{Et(r.current,lm),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var zd={};function hm(e,t,r){!t&&!zd[e]&&(zd[e]=!0,Et(!1,r))}b.memo(jv);function jv({routes:e,manifest:t,future:r,state:n,isStatic:s,onError:i}){return pv(e,void 0,{manifest:t,state:n,isStatic:s,onError:i})}function Cv({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:s,static:i=!1,useTransitions:a}){ge(!ei(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),c=b.useMemo(()=>({basename:o,navigator:s,static:i,useTransitions:a,future:{}}),[o,s,i,a]);typeof r=="string"&&(r=Zs(r));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:p="default",mask:v}=r,g=b.useMemo(()=>{let w=Kt(u,o);return w==null?null:{location:{pathname:w,search:d,hash:h,state:f,key:p,mask:v},navigationType:n}},[o,u,d,h,f,p,n,v]);return Et(g!=null,`<Router basename="${o}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:b.createElement(rt.Provider,{value:c},b.createElement(to.Provider,{children:t,value:g}))}var Vi="get",Ki="application/x-www-form-urlencoded";function ro(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Nv(e){return ro(e)&&e.tagName.toLowerCase()==="button"}function Tv(e){return ro(e)&&e.tagName.toLowerCase()==="form"}function Av(e){return ro(e)&&e.tagName.toLowerCase()==="input"}function Rv(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Pv(e,t){return e.button===0&&(!t||t==="_self")&&!Rv(e)}var ki=null;function Ov(){if(ki===null)try{new FormData(document.createElement("form"),0),ki=!1}catch{ki=!0}return ki}var zv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Uo(e){return e!=null&&!zv.has(e)?(Et(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ki}"`),null):e}function $v(e,t){let r,n,s,i,a;if(Tv(e)){let o=e.getAttribute("action");n=o?Kt(o,t):null,r=e.getAttribute("method")||Vi,s=Uo(e.getAttribute("enctype"))||Ki,i=new FormData(e)}else if(Nv(e)||Av(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 c=e.getAttribute("formaction")||o.getAttribute("action");if(n=c?Kt(c,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||Vi,s=Uo(e.getAttribute("formenctype"))||Uo(o.getAttribute("enctype"))||Ki,i=new FormData(o,e),!Ov()){let{name:u,type:d,value:h}=e;if(d==="image"){let f=u?`${u}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else u&&i.append(u,h)}}else{if(ro(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Vi,n=null,s=Ki,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 ou(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function fm(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&&Kt(s.pathname,t)==="/"?s.pathname=`${ba(t)}/_root.${n}`:s.pathname=`${ba(s.pathname)}.${n}`,s}async function Iv(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 Dv(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 Lv(e,t,r){let n=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let a=await Iv(i,r);return a.links?a.links():[]}return[]}));return Mv(n.flat(1).filter(Dv).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function $d(e,t,r,n,s,i){let a=(c,u)=>r[u]?c.route.id!==r[u].route.id:!0,o=(c,u)=>{var d;return r[u].pathname!==c.pathname||((d=r[u].route.path)==null?void 0:d.endsWith("*"))&&r[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>a(c,u)||o(c,u)):i==="data"?t.filter((c,u)=>{var h;let d=n.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(a(c,u)||o(c,u))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function Uv(e,t,{includeHydrateFallback:r}={}){return Fv(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 Fv(e){return[...new Set(e)]}function Bv(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function Mv(e,t){let r=new Set;return new Set(t),e.reduce((n,s)=>{let i=JSON.stringify(Bv(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function lu(){let e=b.useContext(Dn);return ou(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function qv(){let e=b.useContext(eo);return ou(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cu=b.createContext(void 0);cu.displayName="FrameworkContext";function no(){let e=b.useContext(cu);return ou(e,"You must render this element inside a <HydratedRouter> element"),e}function Wv(e,t){let r=b.useContext(cu),[n,s]=b.useState(!1),[i,a]=b.useState(!1),{onFocus:o,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:h}=t,f=b.useRef(null);b.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let g=y=>{y.forEach(m=>{a(m.isIntersecting)})},w=new IntersectionObserver(g,{threshold:.5});return f.current&&w.observe(f.current),()=>{w.disconnect()}}},[e]),b.useEffect(()=>{if(n){let g=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(g)}}},[n]);let p=()=>{s(!0)},v=()=>{s(!1),a(!1)};return r?e!=="intent"?[i,f,{}]:[i,f,{onFocus:Gn(o,p),onBlur:Gn(c,v),onMouseEnter:Gn(u,p),onMouseLeave:Gn(d,v),onTouchStart:Gn(h,p)}]:[!1,f,{}]}function Gn(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Hv({page:e,...t}){let r=iv(),{nonce:n}=no(),{router:s}=lu(),i=b.useMemo(()=>Jp(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&n&&(t={...t,nonce:n}),r?b.createElement(Kv,{page:e,matches:i,...t}):b.createElement(Gv,{page:e,matches:i,...t})):null}function Vv(e){let{manifest:t,routeModules:r}=no(),[n,s]=b.useState([]);return b.useEffect(()=>{let i=!1;return Lv(e,t,r).then(a=>{i||s(a)}),()=>{i=!0}},[e,t,r]),n}function Kv({page:e,matches:t,...r}){let n=gt(),{future:s}=no(),{basename:i}=lu(),a=b.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let o=fm(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&o.searchParams.set("_routes",u.join(",")),[o.pathname+o.search]},[i,s.v8_trailingSlashAwareDataRequests,e,n,t]);return b.createElement(b.Fragment,null,a.map(o=>b.createElement("link",{key:o,rel:"prefetch",as:"fetch",href:o,...r})))}function Gv({page:e,matches:t,...r}){let n=gt(),{future:s,manifest:i,routeModules:a}=no(),{basename:o}=lu(),{loaderData:c,matches:u}=qv(),d=b.useMemo(()=>$d(e,t,u,i,n,"data"),[e,t,u,i,n]),h=b.useMemo(()=>$d(e,t,u,i,n,"assets"),[e,t,u,i,n]),f=b.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let g=new Set,w=!1;if(t.forEach(m=>{var k;let x=i.routes[m.route.id];!x||!x.hasLoader||(!d.some(S=>S.route.id===m.route.id)&&m.route.id in c&&((k=a[m.route.id])!=null&&k.shouldRevalidate)||x.hasClientLoader?w=!0:g.add(m.route.id))}),g.size===0)return[];let y=fm(e,o,s.v8_trailingSlashAwareDataRequests,"data");return w&&g.size>0&&y.searchParams.set("_routes",t.filter(m=>g.has(m.route.id)).map(m=>m.route.id).join(",")),[y.pathname+y.search]},[o,s.v8_trailingSlashAwareDataRequests,c,n,i,d,t,e,a]),p=b.useMemo(()=>Uv(h,i),[h,i]),v=Vv(h);return b.createElement(b.Fragment,null,f.map(g=>b.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})),p.map(g=>b.createElement("link",{key:g,rel:"modulepreload",href:g,...r})),v.map(({key:g,link:w})=>b.createElement("link",{key:g,nonce:r.nonce,...w,crossOrigin:w.crossOrigin??r.crossOrigin})))}function Jv(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Yv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Yv&&(window.__reactRouterVersion="7.18.1")}catch{}function Qv({basename:e,children:t,useTransitions:r,window:n}){let s=b.useRef();s.current==null&&(s.current=R0({window:n,v5Compat:!0}));let i=s.current,[a,o]=b.useState({action:i.action,location:i.location}),c=b.useCallback(u=>{r===!1?o(u):b.startTransition(()=>o(u))},[r]);return b.useLayoutEffect(()=>i.listen(c),[i,c]),b.createElement(Cv,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,useTransitions:r})}var pm=b.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,mask:o,state:c,target:u,to:d,preventScrollReset:h,viewTransition:f,defaultShouldRevalidate:p,...v},g){let{basename:w,navigator:y,useTransitions:m}=b.useContext(rt),x=typeof d=="string"&&ru.test(d),k=nm(d,w);d=k.to;let S=hv(d,{relative:s}),E=gt(),j=null;if(o){let O=nu(o,[],E.mask?E.mask.pathname:"/",!0);w!=="/"&&(O.pathname=O.pathname==="/"?w:pt([w,O.pathname])),j=y.createHref(O)}let[$,I,N]=Wv(n,v),M=tx(d,{replace:a,mask:o,state:c,target:u,preventScrollReset:h,relative:s,viewTransition:f,defaultShouldRevalidate:p,useTransitions:m});function _(O){t&&t(O),O.defaultPrevented||M(O)}let C=!(k.isExternal||i),R=b.createElement("a",{...v,...N,href:(C?j:void 0)||k.absoluteURL||S,onClick:C?_:t,ref:Jv(g,I),target:u,"data-discover":!x&&r==="render"?"true":void 0});return $&&!x?b.createElement(b.Fragment,null,R,b.createElement(Hv,{page:S})):R});pm.displayName="Link";var Xv=b.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:o,children:c,...u},d){let h=ti(a,{relative:u.relative}),f=gt(),p=b.useContext(eo),{navigator:v,basename:g}=b.useContext(rt),w=p!=null&&ax(h)&&o===!0,y=v.encodeLocation?v.encodeLocation(h).pathname:h.pathname,m=f.pathname,x=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;r||(m=m.toLowerCase(),x=x?x.toLowerCase():null,y=y.toLowerCase()),x&&g&&(x=Kt(x,g)||x);const k=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let S=m===y||!s&&m.startsWith(y)&&m.charAt(k)==="/",E=x!=null&&(x===y||!s&&x.startsWith(y)&&x.charAt(y.length)==="/"),j={isActive:S,isPending:E,isTransitioning:w},$=S?t:void 0,I;typeof n=="function"?I=n(j):I=[n,S?"active":null,E?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(j):i;return b.createElement(pm,{...u,"aria-current":$,className:I,ref:d,style:N,to:a,viewTransition:o},typeof c=="function"?c(j):c)});Xv.displayName="NavLink";var Zv=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:s,state:i,method:a=Vi,action:o,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f,...p},v)=>{let{useTransitions:g}=b.useContext(rt),w=sx(),y=ix(o,{relative:u}),m=a.toLowerCase()==="get"?"get":"post",x=typeof o=="string"&&ru.test(o),k=S=>{if(c&&c(S),S.defaultPrevented)return;S.preventDefault();let E=S.nativeEvent.submitter,j=(E==null?void 0:E.getAttribute("formmethod"))||a,$=()=>w(E||S.currentTarget,{fetcherKey:t,method:j,navigate:r,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:f});g&&r!==!1?b.startTransition(()=>$()):$()};return b.createElement("form",{ref:v,method:m,action:y,onSubmit:n?c:k,...p,"data-discover":!x&&e==="render"?"true":void 0})});Zv.displayName="Form";function ex(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mm(e){let t=b.useContext(Dn);return ge(t,ex(e)),t}function tx(e,{target:t,replace:r,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:c,useTransitions:u}={}){let d=um(),h=gt(),f=ti(e,{relative:a});return b.useCallback(p=>{if(Pv(p,t)){p.preventDefault();let v=r!==void 0?r:Is(h)===Is(f),g=()=>d(e,{replace:v,mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:c});u?b.startTransition(()=>g()):g()}},[h,d,f,r,n,s,t,e,i,a,o,c,u])}var rx=0,nx=()=>`__${String(++rx)}__`;function sx(){let{router:e}=mm("useSubmit"),{basename:t}=b.useContext(rt),r=_v(),n=e.fetch,s=e.navigate;return b.useCallback(async(i,a={})=>{let{action:o,method:c,encType:u,formData:d,body:h}=$v(i,t);if(a.navigate===!1){let f=a.fetcherKey||nx();await n(f,r,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||c,formEncType:a.encType||u,flushSync:a.flushSync})}else await s(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||c,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,s,t,r])}function ix(e,{relative:t}={}){let{basename:r}=b.useContext(rt),n=b.useContext(Jt);ge(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...ti(e||".",{relative:t})},a=gt();if(e==null){i.search=a.search;let o=new URLSearchParams(i.search),c=o.getAll("index");if(c.some(d=>d==="")){o.delete("index"),c.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:pt([r,i.pathname])),Is(i)}function ax(e,{relative:t}={}){let r=b.useContext(am);ge(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=mm("useViewTransitionState"),s=ti(e,{relative:t});if(!r.isTransitioning)return!1;let i=Kt(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=Kt(r.nextLocation.pathname,n)||r.nextLocation.pathname;return wa(s.pathname,a)!=null||wa(s.pathname,i)!=null}const ox="modulepreload",lx=function(e){return"/"+e},Id={},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(c=>{if(c=lx(c),c in Id)return;Id[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":ox,u||(h.as="script"),h.crossOrigin="",h.href=c,o&&h.setAttribute("nonce",o),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const 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 cx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gm=(...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 ux={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 dx=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...o},c)=>b.createElement("svg",{ref:c,...ux,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:gm("lucide",s),...o},[...a.map(([u,d])=>b.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.383.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H=(e,t)=>{const r=b.forwardRef(({className:n,...s},i)=>b.createElement(dx,{ref:i,iconNode:t,className:gm(`lucide-${cx(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 ym=H("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 hx=H("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 Bt=H("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 so=H("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 Ir=H("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 vm=H("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 fx=H("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 uu=H("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 ka=H("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 Vr=H("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 px=H("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 mx=H("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 gx=H("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 Hl=H("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 Dd=H("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 xm=H("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 yx=H("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 yr=H("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 On=H("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 vx=H("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 vr=H("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 _a=H("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 xx=H("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 xr=H("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 wx=H("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 bx=H("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 kx=H("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 Sa=H("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 _x=H("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 du=H("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 Ds=H("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 Sx=H("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 hu=H("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 St=H("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 Ex=H("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 Ea=H("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 fu=H("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 jx=H("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 Ld=H("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 ja=H("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 wm=H("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 Vl=H("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 qr=H("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 Ca=H("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 jt=H("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function io(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 Cx(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{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(o,c)}u((n=n.apply(e,t||[])).next())})}const Nx=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class pu 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 Tx extends pu{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ud extends pu{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Fd extends pu{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Kl;(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"})(Kl||(Kl={}));class Ax{constructor(t,{headers:r={},customFetch:n,region:s=Kl.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=Nx(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Cx(this,arguments,void 0,function*(r,n={}){var s;let i,a;try{const{headers:o,method:c,body:u,signal:d,timeout:h}=n;let f={},{region:p}=n;p||(p=this.region);const v=new URL(`${this.url}/${r}`);p&&p!=="any"&&(f["x-region"]=p,v.searchParams.set("forceFunctionRegion",p));let g;const w=!!o&&Object.keys(o).some(E=>E.toLowerCase()==="content-type");u&&!w?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",g=u):typeof u=="string"?(f["Content-Type"]="text/plain",g=u):typeof FormData<"u"&&u instanceof FormData?g=u:(f["Content-Type"]="application/json",g=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?g=JSON.stringify(u):g=u;let y=d;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),d?(y=a.signal,d.addEventListener("abort",()=>a.abort())):y=a.signal);const m=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:g,signal:y}).catch(E=>{throw new Tx(E)}),x=m.headers.get("x-relay-error");if(x&&x==="true")throw new Ud(m);if(!m.ok)throw new Fd(m);let k=((s=m.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),S;return k==="application/json"?S=yield m.json():k==="application/octet-stream"||k==="application/pdf"?S=yield m.blob():k==="text/event-stream"?S=m:k==="multipart/form-data"?S=yield m.formData():S=yield m.text(),{data:S,error:null,response:m}}catch(o){return{data:null,error:o,response:o instanceof Fd||o instanceof Ud?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const bm=3,Bd=e=>Math.min(1e3*2**e,3e4),Rx=[520,503],km=["GET","HEAD","OPTIONS"];var Md=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 qd(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 Px(e,t,r,n){return!(!n||r>=bm||!km.includes(e)||!Rx.includes(t))}var Ox=class{constructor(e){var t,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const u={};r.headers.forEach((h,f)=>{u[f]=h}),a>0&&(u["X-Retry-Count"]=String(a));let d;try{d=await n(r.url.toString(),{method:r.method,headers:u,body:JSON.stringify(r.body,(h,f)=>typeof f=="bigint"?f.toString():f),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!km.includes(r.method))throw h;if(r.retryEnabled&&a<bm){const f=Bd(a);a++,await qd(f,r.signal);continue}throw h}if(Px(r.method,d.status,a,r.retryEnabled)){var o,c;const h=(o=(c=d.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&o!==void 0?o:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Bd(a);await d.text(),a++,await qd(f,r.signal);continue}return await r.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let c="",u="",d="";const h=a==null?void 0:a.cause;if(h){var f,p,v,g;const m=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",x=(p=h==null?void 0:h.code)!==null&&p!==void 0?p:"";c=`${(v=a==null?void 0:a.name)!==null&&v!==void 0?v:"FetchError"}: ${a==null?void 0:a.message}`,c+=`
Caused by: ${(g=h==null?void 0:h.name)!==null&&g!==void 0?g:"Error"}: ${m}`,x&&(c+=` (${x})`),h!=null&&h.stack&&(c+=`
${h.stack}`)}else{var w;c=(w=a==null?void 0:a.stack)!==null&&w!==void 0?w:""}const y=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(d="",u="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${y} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",u="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(u+=`. Your request URL is ${y} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:c,hint:u,code:d},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let r=null,n=null,s=null,i=e.status,a=e.statusText;if(e.ok){var o,c;if(t.method!=="HEAD"){var u;const f=await e.text();if(f!=="")if(t.headers.get("Accept")==="text/csv")n=f;else if(t.headers.get("Accept")&&(!((u=t.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text")))n=f;else try{n=JSON.parse(f)}catch{if(r={message:f},n=null,t.shouldThrowOnError)throw new Md({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=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");d&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const d=await e.text();try{r=JSON.parse(d),Array.isArray(r)&&e.status===404&&(n=[],r=null,i=200,a="OK")}catch{e.status===404&&d===""?(i=204,a="No Content"):r={message:d}}if(r&&t.shouldThrowOnError)throw new Md(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},zx=class extends Ox{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("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${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 Wd=new RegExp("[,()]");var tn=class extends zx{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"&&Wd.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"&&Wd.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}},$x=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:n}=t??{},s=r?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:o,headers:c}=this.cloneRequestState();return o.searchParams.set("select",a),n&&c.append("Prefer",`count=${n}`),new tn({method:s,url:o,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),r||a.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(o.length>0){const c=[...new Set(o)].map(u=>`"${u}"`);i.searchParams.set("columns",c.join(","))}}return new tn({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:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);o.searchParams.set("columns",d.join(","))}}return new tn({method:a,url:o,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new tn({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 tn({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 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 Ix(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 Dx(e){var t=Ix(e,"string");return Ls(t)=="symbol"?t:t+""}function Lx(e,t,r){return(t=Dx(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 _i(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){Lx(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 Ux=class _m{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 c=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(u,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),i),p=d==null?void 0:d.signal;if(p){if(p.aborted)return clearTimeout(f),c(u,d);const v=()=>{clearTimeout(f),h.abort()};return p.addEventListener("abort",v,{once:!0}),c(u,_i(_i({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",v)})}return c(u,_i(_i({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=c,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 $x(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 _m(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 c=new URL(`${this.url}/rpc/${t}`);let u;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),h=n&&Object.values(r).some(d);h?(o="POST",u=r):n||s?(o=n?"HEAD":"GET",Object.entries(r).filter(([p,v])=>v!==void 0).map(([p,v])=>[p,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([p,v])=>{c.searchParams.append(p,v)})):(o="POST",u=r);const f=new Headers(this.headers);return h?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new tn({method:o,url:c,headers:f,schema:this.schemaName,body:u,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Fx{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 Bx="2.110.2",Mx=`realtime-js/${Bx}`,qx="1.0.0",Sm="2.0.0",Wx=Sm,Hx=1e4,Vx=100,tr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Em={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Gl={connecting:"connecting",closing:"closing",closed:"closed"};class Kx{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:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(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(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+o.length+a.length+u.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let v=new DataView(p),g=0;v.setUint8(g++,this.KINDS.userBroadcastPush),v.setUint8(g++,c.length),v.setUint8(g++,o.length),v.setUint8(g++,a.length),v.setUint8(g++,u.length),v.setUint8(g++,h.length),v.setUint8(g++,r),Array.from(c,y=>v.setUint8(g++,y.charCodeAt(0))),Array.from(o,y=>v.setUint8(g++,y.charCodeAt(0))),Array.from(a,y=>v.setUint8(g++,y.charCodeAt(0))),Array.from(u,y=>v.setUint8(g++,y.charCodeAt(0))),Array.from(h,y=>v.setUint8(g++,y.charCodeAt(0)));var w=new Uint8Array(p.byteLength+n.byteLength);return w.set(new Uint8Array(p),0),w.set(new Uint8Array(n),p.byteLength),w.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,c]=n;return r({join_ref:s,ref:i,topic:a,event:o,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,s)}}_decodeUserBroadcast(t,r,n){const s=r.getUint8(1),i=r.getUint8(2),a=r.getUint8(3),o=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(t.slice(c,c+s));c=c+s;const d=n.decode(t.slice(c,c+i));c=c+i;const h=n.decode(t.slice(c,c+a));c=c+a;const f=t.slice(c,t.byteLength),p=o===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,v={type:this.BROADCAST_EVENT,event:d,payload:p};return a>0&&(v.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:v}}_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 ee;(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"})(ee||(ee={}));const Vd=(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]=Gx(a,e,t,s),i),{}):{}},Gx=(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)?jm(i,a):Jl(a)},jm=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Xx(t,r)}switch(e){case ee.bool:return Jx(t);case ee.float4:case ee.float8:case ee.int2:case ee.int4:case ee.int8:case ee.numeric:case ee.oid:return Yx(t);case ee.json:case ee.jsonb:return Qx(t);case ee.timestamp:return Zx(t);case ee.abstime:case ee.date:case ee.daterange:case ee.int4range:case ee.int8range:case ee.money:case ee.reltime:case ee.text:case ee.time:case ee.timestamptz:case ee.timetz:case ee.tsrange:case ee.tstzrange:return Jl(t);default:return Jl(t)}},Jl=e=>e,Jx=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Yx=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Qx=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Xx=(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=>jm(t,o))}return e},Zx=e=>typeof e=="string"?e.replace(" ","T"):e,Cm=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 gs=e=>typeof e=="function"?e:function(){return e},ew=typeof self<"u"?self:null,rn=typeof window<"u"?window:null,xt=ew||rn||globalThis,tw="2.0.0",rw=1e4,nw=1e3,wt={connecting:0,open:1,closing:2,closed:3},Pe={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},zt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Yl={longpoll:"longpoll",websocket:"websocket"},sw={complete:4},Ql="base64url.bearer.phx.",Si=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})}},Nm=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))}},iw=class{constructor(e,t,r){this.state=Pe.closed,this.topic=e,this.params=gs(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Si(this,zt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Nm(()=>{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 Si(this,zt.leave,gs({}),this.timeout).send(),this.state=Pe.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(zt.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(zt.close,e)}onError(e){return this.on(zt.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 Si(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(zt.close,"leave")},r=new Si(this,zt.leave,gs({}),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}},Na=class{static request(e,t,r,n,s,i,a){if(xt.XDomainRequest){let o=new xt.XDomainRequest;return this.xdomainRequest(o,e,t,n,s,i,a)}else if(xt.XMLHttpRequest){let o=new xt.XMLHttpRequest;return this.xhrRequest(o,e,t,r,n,s,i,a)}else{if(xt.fetch&&xt.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},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),o.signal=c.signal),xt.fetch(t,o).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>a&&a(u)).catch(u=>{u.name==="AbortError"&&i?i():a&&a(null)}),c}static xdomainRequest(e,t,r,n,s,i,a){return e.timeout=s,e.open(t,r),e.onload=()=>{let 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[c,u]of Object.entries(n))e.setRequestHeader(c,u);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===sw.complete&&o){let c=this.parseJSON(e.responseText);o(c)}},a&&(e.ontimeout=a),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},aw=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)},Jr=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Ql)&&(this.authToken=atob(t[1].slice(Ql.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=wt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Yl.websocket),"$1/"+Yl.longpoll)}endpointURL(){return Na.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=wt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===wt.open||this.readyState===wt.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=wt.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=aw(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=wt.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=Na.request(e,this.endpointURL(),t,r,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&s(o)}),this.reqs.add(i)}},ow=class ns{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=ns.syncState(this.state,s,i,a),this.pendingDiffs.forEach(c=>{this.state=ns.syncDiff(this.state,c,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=ns.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 ns.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,(c,u)=>{r[c]||(o[c]=u)}),this.map(r,(c,u)=>{let d=i[c];if(d){let h=u.metas.map(g=>g.phx_ref),f=d.metas.map(g=>g.phx_ref),p=u.metas.filter(g=>f.indexOf(g.phx_ref)<0),v=d.metas.filter(g=>h.indexOf(g.phx_ref)<0);p.length>0&&(a[c]=u,a[c].metas=p),v.length>0&&(o[c]=this.clone(d),o[c].metas=v)}else a[c]=u}),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,c)=>{let u=t[o];if(t[o]=this.clone(c),u){let d=t[o].metas.map(f=>f.phx_ref),h=u.metas.filter(f=>d.indexOf(f.phx_ref)<0);t[o].metas.unshift(...h)}n(o,u,c)}),this.map(a,(o,c)=>{let u=t[o];if(!u)return;let d=c.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(o,u,c),u.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))}},Ei={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),c=new DataView(o),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,r.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(r,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(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 c=r.decode(e.slice(a,a+s));a=a+s;let u=r.decode(e.slice(a,a+i));a=a+i;let d=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:c,event:u,payload:d}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(o,o+n));o=o+n;let u=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),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:zt.reply,payload:p}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(e.slice(i,i+n));i=i+n;let o=r.decode(e.slice(i,i+s));i=i+s;let c=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:c}}},lw=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||rw,this.transport=t.transport||xt.WebSocket||Jr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=xt&&xt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Ei.encode.bind(Ei),this.defaultDecoder=Ei.decode.bind(Ei),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!==Jr?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;rn&&rn.addEventListener&&(rn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),rn.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),rn.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=gs(t.params||{}),this.endPoint=`${e}/${Yl.websocket}`,this.vsn=t.vsn||tw,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Nm(()=>{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 Jr}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=Na.appendParams(Na.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=gs(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Jr?this.connectWithFallback(Jr,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 Jr:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Ql}${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=c=>{this.log("transport",`falling back to ${a}...`,c),this.off([s,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(c=>{this.log("transport","error",c),n&&!r&&(clearTimeout(this.fallbackTimer),o(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),nw,"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===wt.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(zt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case wt.connecting:return"connecting";case wt.open:return"open";case wt.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 iw(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(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let o=0;o<this.channels.length;o++){const c=this.channels[o];c.isMember(r,n,s,a)&&c.trigger(n,s,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class ys{constructor(t,r){const n=uw(r);this.presence=new ow(t.getChannel(),n),this.presence.onJoin((s,i,a)=>{const o=ys.onJoinPayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((s,i,a)=>{const o=ys.onLeavePayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return ys.transformState(this.presence.state)}static transformState(t){return t=cw(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=Gi(s),r},{})}static onJoinPayload(t,r,n){const s=Kd(r),i=Gi(n);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,r,n){const s=Kd(r),i=Gi(n);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function Gi(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function cw(e){return JSON.parse(JSON.stringify(e))}function uw(e){return(e==null?void 0:e.events)&&{events:e.events}}function Kd(e){return e!=null&&e.metas?Gi(e):[]}var Gd;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Gd||(Gd={}));class dw{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new ys(this.channel.channelAdapter,r)}}function hw(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 fw{constructor(t,r,n){const s=pw(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>Vx){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===tr.joined}isJoined(){return this.state===tr.joined}isJoining(){return this.state===tr.joining}isClosed(){return this.state===tr.closed}isLeaving(){return this.state===tr.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function pw(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}const mw=/[,()"\\]/,gw=e=>mw.test(e)||e!==e.trim(),yw=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Jd=e=>{const t=e===null?"null":String(e);return gw(t)?yw(t):t},vw=e=>e===null?"null":String(e),xw=(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=>Jd(s)).join(",")})`}return e==="is"?`is.${vw(t)}`:`${e}.${Jd(t)}`};class ww{constructor(){this.filters=[]}add(t,r,n,s=!1){const i=s?"not.":"";return this.filters.push(`${t}=${i}${xw(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 Yd;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Yd||(Yd={}));var vn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(vn||(vn={}));var $t;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})($t||($t={}));class vs{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},n){var s,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new fw(this.socket.socketAdapter,t,this.params),this.presence=new dw(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Cm(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:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[vn.PRESENCE]&&this.bindings[vn.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:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>{t==null||t($t.CHANNEL_ERROR,hw(p))}),this._onClose(()=>t==null?void 0:t($t.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t($t.SUBSCRIBED);return}this._updatePostgresBindings(p,t)}).receive("error",p=>{this.state=tr.errored;const v=Object.values(p).join(", ")||"error";t==null||t($t.CHANNEL_ERROR,new Error(v,{cause:p}))}).receive("timeout",()=>{t==null||t($t.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 c=s[o],{filter:{event:u,schema:d,table:h,filter:f}}=c,p=t&&t[o];if(p&&p.event===u&&vs.isFilterValueEqual(p.schema,d)&&vs.isFilterValueEqual(p.table,h)&&vs.isFilterValueEqual(p.filter,f))a.push(Object.assign(Object.assign({},c),{id:p.id}));else{this.unsubscribe(),this.state=tr.errored,r==null||r($t.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=tr.errored&&r&&r($t.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===vn.PRESENCE||t===vn.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 c={method:"POST",headers:a,body:i?r:JSON.stringify(r)},u=await this._fetchWithTimeout(o.toString(),c,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(u.status===202)return{success:!0};if(u.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let d=u.statusText;try{const h=await u.json();d=h.error||h.message||d}catch{}return Promise.reject(new Error(d))}async send(t,r={}){var n,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u instanceof Error&&u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,c;const u=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),a}_on(t,r,n){const s=t.toLocaleLowerCase(),i=r==null?void 0:r.filter;(i instanceof ww||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,c,u,d;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const f=(s=this.bindings[h])===null||s===void 0?void 0:s.find(p=>p.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const p=f.id,v=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((a=r.ids)===null||a===void 0?void 0:a.includes(p))&&(v==="*"||(v==null?void 0:v.toLocaleLowerCase())===((o=r.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const p=(u=(c=f==null?void 0:f.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return p==="*"||p===((d=r==null?void 0:r.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,r){const{close:n,error:s,leave:i,join:a}=Em;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:c,errors:u}=s;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const n of t.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=Vd(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=Vd(t.columns,t.old_record)),r}}class bw{constructor(t,r){this.socket=new lw(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()==Gl.connecting}isDisconnecting(){return this.socket.connectionState()==Gl.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Qd={HEARTBEAT_INTERVAL:25e3},kw=[1e3,2e3,5e3,1e4],_w=1e4;function Sw(){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 Ew(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Sw()}const jw=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class Cw{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 Kx,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 bw(t,s),this.httpEndpoint=Cm(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()||Gl.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new vs(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let r,n=!1;if(t)r=t,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:Mx};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Em.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([jw],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,i,a,o,c,u,d,h,f,p;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const v={};v.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Hx,v.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:Qd.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:Qd.HEARTBEAT_INTERVAL),v.transport=(c=t==null?void 0:t.transport)!==null&&c!==void 0?c:Fx.getWebSocketConstructor(),v.params=t==null?void 0:t.params,v.logger=t==null?void 0:t.logger,v.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),v.sessionStorage=(u=t==null?void 0:t.sessionStorage)!==null&&u!==void 0?u:Ew(),v.reconnectAfterMs=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:m=>kw[m-1]||_w;let g,w;const y=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:Wx;switch(y){case qx:g=(m,x)=>x(JSON.stringify(m)),w=(m,x)=>x(JSON.parse(m));break;case Sm:g=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${v.vsn}`)}if(v.vsn=y,v.encode=(f=t==null?void 0:t.encode)!==null&&f!==void 0?f:g,v.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:w,v.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,v.params=Object.assign(Object.assign({},v.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,v.autoSendHeartbeat=!this.worker}return v}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Us=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 Nw(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 Tw(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 Aw(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:a}){const o=Nw(e.baseUrl,n,s),c=await Tw(e.auth),u=await t(o,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...c,...a},body:i?JSON.stringify(i):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!u.ok){const p=h?f:void 0,v=p==null?void 0:p.error;throw new Us((v==null?void 0:v.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:v==null?void 0:v.type,icebergCode:v==null?void 0:v.code,details:p})}return{status:u.status,headers:u.headers,data:f}}}}function ji(e){return e.join("")}var Rw=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:ji(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/${ji(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ji(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ji(e.namespace)}`}),!0}catch(t){if(t instanceof Us&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Us&&r.status===409)return;throw r}}};function Yr(e){return e.join("")}var Pw=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/${Yr(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/${Yr(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/${Yr(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/${Yr(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/${Yr(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/${Yr(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Us&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Us&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},Ow=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Aw({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Rw(this.client,t),this.tableOps=new Pw(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 Fs(e){"@babel/helpers - typeof";return Fs=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},Fs(e)}function zw(e,t){if(Fs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $w(e){var t=zw(e,"string");return Fs(t)=="symbol"?t:t+""}function Iw(e,t,r){return(t=$w(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xd(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 W(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xd(Object(r),!0).forEach(function(n){Iw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ao=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 oo(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Xl=class extends ao{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 W({},super.toJSON())}},Tm=class extends ao{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Ta(e,t,r){const n=W({},e),s=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Dw(e){const t={};for(const[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}const Lw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Uw=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)},Zl=e=>{if(Array.isArray(e))return e.map(r=>Zl(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]=Zl(n)}),t},Fw=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),Zd=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)},Bw=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 Xl(Zd(a),i,o,n))}).catch(()=>{const a=i+"";t(new Xl(s.statusText||`HTTP ${i} error`,i,a,n))})}else t(new Tm(Zd(e),e,n))},Mw=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return W(W({},s),r);if(Uw(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[c,u]of Object.entries(a))c.toLowerCase()==="content-type"&&(o=u);s.headers=Ta(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),W(W({},s),r)};async function Jn(e,t,r,n,s,i,a){return new Promise((o,c)=>{e(r,Mw(t,n,s,i)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(a==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>o(u)).catch(u=>Bw(u,c,n,a))})}function Am(e="storage"){return{get:async(t,r,n,s)=>Jn(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>Jn(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>Jn(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>Jn(t,"HEAD",r,W(W({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>Jn(t,"DELETE",r,s,i,n,e)}}const qw=Am("storage"),{get:Bs,post:lt,put:ec,head:Ww,remove:Ms}=qw,Me=Am("vectors");var Ln=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Dw(t),this.fetch=Lw(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ta(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(oo(r))return{data:null,error:r};throw r}}};let Rm;Rm=Symbol.toStringTag;var Hw=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Rm]="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(oo(t))return{data:null,error:t};throw t}}};let Pm;Pm=Symbol.toStringTag;var Vw=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Pm]="BlobDownloadBuilder",this.promise=null}asStream(){return new Hw(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(oo(t))return{data:null,error:t};throw t}}};const Fo={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eh={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Kw=class extends Ln{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=W(W({},eh),n);let o=W(W({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",s.encodeMetadata(c)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),c&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(c))):(i=r,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,c&&(o["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))o=Ta(o,f,p);const u=s._removeEmptyFolders(t),d=s._getFinalPath(u),h=await(e=="PUT"?ec:lt)(s.fetch,`${s.url}/object/${d}`,i,W({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const i=s._removeEmptyFolders(e),a=s._getFinalPath(i),o=new URL(s.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),s.handleOperation(async()=>{let c;const u=W(W({},eh),n);let d=W(W({},s.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),h&&c.append("metadata",s.encodeMetadata(h)),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),h&&!c.has("metadata")&&c.append("metadata",s.encodeMetadata(h))):(c=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))d=Ta(d,f,p);return{path:i,fullPath:(await ec(s.fetch,o.toString(),c,W({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=W({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await lt(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 ao("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 lt(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 lt(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 lt(n.fetch,`${n.url}/object/sign/${s}`,W({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 c=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await lt(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=>W(W({},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=()=>Bs(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Vw(o,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Zl(await Bs(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await Ww(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(oo(s)){var n;const i=s instanceof Xl?s.status:s instanceof Tm?(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 Ms(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 Ms(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?W(W({},Fo.sortBy),t.sortBy):Fo.sortBy,i=W(W(W({},Fo),t),{},{sortBy:s,prefix:e||""});return await lt(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=W({},e);return await lt(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 Gw="2.110.2",ri={"X-Client-Info":`storage-js/${Gw}`};var Jw=class extends Ln{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=W(W({},ri),t);super(i,a,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Bs(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Bs(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await lt(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 ec(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 lt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Ms(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 Ms(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():""}},Yw=class extends Ln{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=W(W({},ri),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await lt(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 Bs(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Ms(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Fw(e))throw new ao("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 Ow({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(c){if(n)throw c;return{data:null,error:c}}}}})}},Qw=class extends Ln{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=W(W({},ri),{},{"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})||{})}},Xw=class extends Ln{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=W(W({},ri),{},{"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})||{})}},Zw=class extends Ln{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=W(W({},ri),{},{"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})||{})}},eb=class extends Zw{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new tb(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},tb=class extends Qw{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,W(W({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,W(W({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new rb(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},rb=class extends Xw{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,W(W({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,W(W({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,W(W({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,W(W({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,W(W({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},nb=class extends Jw{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new Kw(this.url,this.headers,e,this.fetch)}get vectors(){return new eb(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Yw(this.url+"/iceberg",this.headers,this.fetch)}};const Om="2.110.2",It=30*1e3,ss=3,Bo=ss*It,sb=2*It,ib="http://localhost:9999",ab="supabase.auth.token",ob={"X-Client-Info":`gotrue-js/${Om}`},tc="X-Supabase-Api-Version",zm={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},lb=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,cb=10*60*1e3;class qs 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 D(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class ub extends qs{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function db(e){return D(e)&&e.name==="AuthApiError"}class dt extends qs{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class Nt extends qs{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class ye extends Nt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ci(e){return D(e)&&e.name==="AuthSessionMissingError"}class Qr extends Nt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ni extends Nt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Ti extends Nt{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 hb(e){return D(e)&&e.name==="AuthImplicitGrantRedirectError"}class th extends Nt{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 fb extends Nt{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 rc extends Nt{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function rh(e){return D(e)&&e.name==="AuthRetryableFetchError"}class nh extends Nt{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,"AuthRefreshDiscardedError",409,void 0)}}function pb(e){return D(e)&&e.name==="AuthRefreshDiscardedError"}class sh extends Nt{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 Aa extends Nt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ra="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ih=`
\r=`.split(""),mb=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<ih.length;t+=1)e[ih[t].charCodeAt(0)]=-2;for(let t=0;t<Ra.length;t+=1)e[Ra[t].charCodeAt(0)]=t;return e})();function ah(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(Ra[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(Ra[n]),t.queuedBits-=6}}function $m(e,t,r){const n=mb[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 oh(e){const t=[],r=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{vb(a,n,r)};for(let a=0;a<e.length;a+=1)$m(e.charCodeAt(a),s,i);return t.join("")}function gb(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 yb(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}gb(n,t)}}function vb(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 En(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)$m(e.charCodeAt(s),r,n);return new Uint8Array(t)}function xb(e){const t=[];return yb(e,r=>t.push(r)),new Uint8Array(t)}function Or(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>ah(s,r,n)),ah(null,r,n),t.join("")}function wb(e){return Math.round(Date.now()/1e3)+e}function bb(){return Symbol("auth-callback")}const Ee=()=>typeof window<"u"&&typeof document<"u",Sr={tested:!1,writable:!1},Im=()=>{if(!Ee())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Sr.tested)return Sr.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Sr.tested=!0,Sr.writable=!0}catch{Sr.tested=!0,Sr.writable=!1}return Sr.writable};function kb(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 Dm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),_b=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",nn=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},st=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ue=async(e,t)=>{await e.removeItem(t)};class lo{constructor(){this.promise=new lo.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}lo.promiseConstructor=Promise;function Ai(e){const t=e.split(".");if(t.length!==3)throw new Aa("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!lb.test(t[n]))throw new Aa("JWT not in base64url format");return{header:JSON.parse(oh(t[0])),payload:JSON.parse(oh(t[1])),signature:En(t[2]),raw:{header:t[0],payload:t[1]}}}async function Sb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function Eb(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 jb(e){return("0"+e.toString(16)).substr(-2)}function Cb(){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,jb).join("")}async function Nb(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 Tb(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 Nb(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Er(e,t,r=!1){const n=Cb();let s=n;r&&(s+="/recovery"),await nn(e,`${t}-code-verifier`,s);const i=await Tb(n);return[i,n===i?"plain":"s256"]}const Ab=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Rb(e){const t=e.headers.get(tc);if(!t||!t.match(Ab))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Pb(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 Ob(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 zb=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Rt(e){if(!zb.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function at(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 Mo(){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 $b(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 lh(e){return JSON.parse(JSON.stringify(e))}const Tr=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)},Ib=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function ch(e){var t;if(!_b(e))throw new rc(Tr(e),0);if(Ib.includes(e.status))throw new rc(Tr(e),e.status);let r;try{r=await e.json()}catch(i){throw new dt(Tr(i),i)}let n;const s=Rb(e);if(s&&s.getTime()>=zm["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 sh(Tr(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 sh(Tr(r),e.status,r.weak_password.reasons);throw new ub(Tr(r),e.status||500,n)}const Db=(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 B(e,t,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[tc]||(i[tc]=zm["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():"",c=await Lb(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(c):{data:Object.assign({},c),error:null}}async function Lb(e,t,r,n,s,i){const a=Db(t,n,s,i);let o;try{o=await e(r,Object.assign({},a))}catch(c){throw console.error(c),new rc(Tr(c),0)}if(o.ok||await ch(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(c){await ch(c)}}function Ge(e){var t;let r=null;Bb(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=wb(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 uh(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 rr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Ub(e){return{data:e,error:null}}function Fb(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e,a=io(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},c=Object.assign({},a);return{data:{properties:o,user:c},error:null}}function dh(e){return e}function Bb(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const qo=["global","local","others"];class Mb{constructor({url:t="",headers:r={},fetch:n,experimental:s}){this.url=t,this.headers=r,this.fetch=Dm(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=qo[0]){if(qo.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${qo.join(", ")}`);try{return await B(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await B(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:rr})}catch(n){if(D(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=io(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 B(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Fb,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(D(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await B(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:rr})}catch(r){if(D(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,i,a,o,c;try{const u={nextPage:null,lastPage:0,total:0},d=await B(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:dh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(v=>{const g=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(v.split(";")[1].split("=")[1]);u[`${w}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(D(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Rt(t);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:rr})}catch(r){if(D(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Rt(t);try{return await B(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:rr})}catch(n){if(D(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){Rt(t);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:rr})}catch(n){if(D(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Rt(t.userId);try{const{data:r,error:n}=await B(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(D(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Rt(t.userId),Rt(t.id);try{return{data:await B(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(D(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,i,a,o,c;try{const u={nextPage:null,lastPage:0,total:0},d=await B(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:dh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(v=>{const g=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(v.split(";")[1].split("=")[1]);u[`${w}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(D(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await B(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await B(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(D(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await B(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(D(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await B(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(D(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await B(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await B(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await B(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(D(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await B(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(D(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){at(this.experimental),Rt(t.userId);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(D(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){at(this.experimental),Rt(t.userId),Rt(t.passkeyId);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(D(r))return{data:null,error:r};throw r}}}function hh(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}globalThis&&Im()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class qb extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}function Wb(){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 Lm(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Hb(e){return parseInt(e,16)}function Vb(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function Kb(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:c,resources:u,scheme:d,uri:h,version:f}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=Lm(e.address),v=d?`${d}://${n}`:n,g=e.statement?`${e.statement}
`:"",w=`${v} wants you to sign in with your Ethereum account:
${p}
${g}`;let y=`URI: ${h}
Version: ${f}
Chain ID: ${r}${a?`
Nonce: ${a}`:""}
Issued At: ${i.toISOString()}`;if(s&&(y+=`
Expiration Time: ${s.toISOString()}`),o&&(y+=`
Not Before: ${o.toISOString()}`),c&&(y+=`
Request ID: ${c}`),u){let m=`
Resources:`;for(const x of u){if(!x||typeof x!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${x}`);m+=`
- ${x}`}y+=m}return`${w}
${y}`}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 Pa extends he{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Gb({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(Um(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 Jb({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(Um(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 Yb{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 nc=new Yb;function fh(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=io(e,["challenge","user","excludeCredentials"]),i=En(t).buffer,a=Object.assign(Object.assign({},r),{id:En(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 c=0;c<n.length;c++){const u=n[c];o.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:En(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return o}function ph(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=io(e,["challenge","allowCredentials"]),s=En(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:En(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function mh(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:Or(new Uint8Array(e.response.attestationObject)),clientDataJSON:Or(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function gh(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:Or(new Uint8Array(s.authenticatorData)),clientDataJSON:Or(new Uint8Array(s.clientDataJSON)),signature:Or(new Uint8Array(s.signature)),userHandle:s.userHandle?Or(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Um(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Oa(){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 Fm(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",t)}:{data:null,error:new Pa("Empty credential response",t)}}catch(t){return{data:null,error:Gb({error:t,options:e})}}}async function Bm(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",t)}:{data:null,error:new Pa("Empty credential response",t)}}catch(t){return{data:null,error:Jb({error:t,options:e})}}}const Qb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Xb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function za(...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]=za(o,a):n[i]=za(a)}else n[i]=a}return n}function Zb(e,t){return za(Qb,e,t||{})}function e1(e,t){return za(Xb,e,t||{})}class t1{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:s},i){var a;try{const{data:o,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!o)return{data:null,error:c};const u=s??nc.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 p=(await this.client.getUser()).data.user,v=((a=p==null?void 0:p.user_metadata)===null||a===void 0?void 0:a.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";d.name=`${d.id}:${v}`}}d.displayName||(d.displayName=d.name)}switch(o.webauthn.type){case"create":{const d=Zb(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:f}=await Fm({publicKey:d,signal:u});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=e1(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:f}=await Bm(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:d,signal:u}));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 D(o)?{data:null,error:o}:{data:null,error:new dt("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 qs("rpId is required for WebAuthn authentication")};try{if(!Oa())return{data:null,error:new dt("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:c}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(a){return D(a)?{data:null,error:a}:{data:null,error:new dt("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 qs("rpId is required for WebAuthn registration")};try{if(!Oa())return{data:null,error:new dt("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:c,error:u}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return c?this._verify({factorId:a.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(a){return D(a)?{data:null,error:a}:{data:null,error:new dt("Unexpected error in register",a)}}}}Wb();const r1={url:ib,storageKey:ab,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ob,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Xr={};class Ws{get jwks(){var t,r;return(r=(t=Xr[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Xr[this.storageKey]=Object.assign(Object.assign({},Xr[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Xr[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Xr[this.storageKey]=Object.assign(Object.assign({},Xr[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},r1),t);if(this.storageKey=i.storageKey,this.instanceID=(r=Ws.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ws.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 Mb({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=Dm(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock!=null&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new t1(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:Im()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=hh(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=hh(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} (${Om}) ${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=kb(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),hb(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType: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 D(r)?this._returnResult({error:r}):this._returnResult({error:new dt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const i=await B(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 c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(D(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,n,s;try{let i;if("email"in t){const{email:d,password:h,options:f}=t;let p=null,v=null;this.flowType==="pkce"&&([p,v]=await Er(this.storage,this.storageKey)),i=await B(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:v},xform:Ge})}else if("phone"in t){const{phone:d,password:h,options:f}=t;i=await B(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 Ni("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await ue(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(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 B(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:uh})}else if("phone"in t){const{phone:i,password:a,options:o}=t;r=await B(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:uh})}else throw new Ni("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 Qr;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(D(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,c,u,d,h,f;let p,v;if("message"in t)p=t.message,v=t.signature;else{const{chain:g,wallet:w,statement:y,options:m}=t;let x;if(Ee())if(typeof w=="object")x=w;else{const I=window;if("ethereum"in I&&typeof I.ethereum=="object"&&"request"in I.ethereum&&typeof I.ethereum.request=="function")x=I.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 w!="object"||!(m!=null&&m.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const k=new URL((r=m==null?void 0:m.url)!==null&&r!==void 0?r:window.location.href),S=await x.request({method:"eth_requestAccounts"}).then(I=>I).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=Lm(S[0]);let j=(n=m==null?void 0:m.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!j){const I=await x.request({method:"eth_chainId"});j=Hb(I)}const $={domain:k.host,address:E,statement:y,uri:k.href,version:"1",chainId:j,nonce:(s=m==null?void 0:m.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=m==null?void 0:m.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=m==null?void 0:m.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(c=m==null?void 0:m.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=m==null?void 0:m.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=m==null?void 0:m.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=Kb($),v=await x.request({method:"personal_sign",params:[Vb(p),E]})}try{const{data:g,error:w}=await B(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:v},!((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(w)throw w;if(!g||!g.session||!g.user){const y=new Qr;return this._returnResult({data:{user:null,session:null},error:y})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:w})}catch(g){if(D(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(t){var r,n,s,i,a,o,c,u,d,h,f,p;let v,g;if("message"in t)v=t.message,g=t.signature;else{const{chain:w,wallet:y,statement:m,options:x}=t;let k;if(Ee())if(typeof y=="object")k=y;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 y!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=y}const S=new URL((r=x==null?void 0:x.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()},x==null?void 0:x.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),m?{statement:m}:null));let j;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")j=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)j=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in j&&"signature"in j&&(typeof j.signedMessage=="string"||j.signedMessage instanceof Uint8Array)&&j.signature instanceof Uint8Array)v=typeof j.signedMessage=="string"?j.signedMessage:new TextDecoder().decode(j.signedMessage),g=j.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");v=[`${S.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...m?["",m,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(s=(n=x==null?void 0:x.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=x==null?void 0:x.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${x.signInWithSolana.notBefore}`]:[],...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((o=x==null?void 0:x.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${x.signInWithSolana.chainId}`]:[],...!((c=x==null?void 0:x.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${x.signInWithSolana.nonce}`]:[],...!((u=x==null?void 0:x.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${x.signInWithSolana.requestId}`]:[],...!((h=(d=x==null?void 0:x.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...x.signInWithSolana.resources.map(j=>`- ${j}`)]:[]].join(`
`);const E=await k.signMessage(new TextEncoder().encode(v),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=E}}try{const{data:w,error:y}=await B(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Or(g)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Ge});if(y)throw y;if(!w||!w.session||!w.user){const m=new Qr;return this._returnResult({data:{user:null,session:null},error:m})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:y})}catch(w){if(D(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(t){const r=await st(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new fb;const{data:i,error:a}=await B(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:Ge});if(await ue(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Qr;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 ue(this.storage,`${this.storageKey}-code-verifier`),D(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 B(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:c,error:u}=o;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new Qr;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(D(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:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Er(this.storage,this.storageKey));const{error:h}=await B(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:o,options:c}=t,{data:u,error:d}=await B(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(a=c==null?void 0:c.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new Ni("You must provide either an email or phone number.")}catch(o){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(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 B(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 c=a.session,u=a.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(D(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,c=null;this.flowType==="pkce"&&([o,c]=await Er(this.storage,this.storageKey));const u=await B(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:c}),headers:this.headers,xform:Ub});return!((i=u.data)===null||i===void 0)&&i.url&&Ee()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(o){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(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 B(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(D(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 Er(this.storage,this.storageKey));const{error:c}=await B(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 c&&await ue(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c})}else if("phone"in t){const{phone:n,type:s,options:i}=t,{data:a,error:o}=await B(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 Ni("You must provide either an email or phone number and a type")}catch(r){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async t=>t)):await this._useSession(async t=>t)}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const r=await st(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<Bo:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await st(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Mo()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=$b(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 st(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 B(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:rr}):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 B(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:rr})})}catch(r){if(D(r))return Ci(r)&&(await this._removeSession(),await ue(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,c=null;this.flowType==="pkce"&&t.email!=null&&([o,c]=await Er(this.storage,this.storageKey));const{data:u,error:d}=await B(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:c}),jwt:a.access_token,xform:rr});if(d)throw d;return a.user=u.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(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}=Ai(t.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:o,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user: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(D(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(D(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var n;try{if(!Ee())throw new Ti("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Ti(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 th("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ti("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 th("No code detected.");const{data:x,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:x.session,redirectType:(n=x.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:c,expires_at:u,token_type:d}=t;if(!a||!c||!o||!d)throw new Ti("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(c);let p=h+f;u&&(p=parseInt(u));const v=p-h;v*1e3<=It&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${f}s`);const g=p-f;h-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,p,h):h-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,p,h);const{data:w,error:y}=await this._getUser(a);if(y)throw y;const m={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:p,refresh_token:o,token_type:d,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:m,redirectType:t.type},error:null})}catch(s){if(D(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error||t.error_description||t.error_code)}async _isPKCECallback(t){const r=await st(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t)):await this._signOut(t)}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const s=async()=>{await this._removeSession(),await ue(this.storage,`${this.storageKey}-code-verifier`)},{data:i,error:a}=r;if(a&&!Ci(a))return this._returnResult({error:a});const o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:c}=await this.admin.signOut(o,t);if(c&&!(db(c)&&(c.status===404||c.status===401||c.status===403)||Ci(c)))return t!=="others"&&await s(),this._returnResult({error:c})}return t!=="others"&&await s(),this._returnResult({error:null})})}onAuthStateChange(t){const r=bb(),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),Ci(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Er(this.storage,this.storageKey,!0));try{return await B(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 ue(this.storage,`${this.storageKey}-code-verifier`),D(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(D(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,c,u,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await B(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return 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(D(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:c,access_token:u,nonce:d}=t,h=await B(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:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Ge}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Qr}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await ue(this.storage,`${this.storageKey}-code-verifier`),D(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 B(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(D(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 Eb(async s=>(s>0&&await Sb(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await B(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&&rh(i)&&Date.now()+a-n<It})}catch(n){if(this._debug(r,"error",n),D(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 st(this.storage,this.storageKey);if(s&&this.userStorage){let a=await st(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await nn(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Mo()}else if(s&&!s.user&&!s.user){const a=await st(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await ue(this.storage,this.storageKey+"-user"),await nn(this.storage,this.storageKey,s)):s.user=Mo()}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()<Bo;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Bo}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(pb(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 lo;const i=await st(this.storage,this.storageKey),{data:a,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!a.session)throw new ye;const c=await st(this.storage,this.storageKey);if(i!==null&&(c===null||c.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:c?"replaced":"cleared"});const f={data:null,error:new nh};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 ue(this.storage,this.storageKey),this.userStorage&&await ue(this.userStorage,this.storageKey+"-user");const f={data:null,error:new nh};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),D(i)){const a={data:null,error:i};if(!rh(i)){const o=await st(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()+sb},(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(c){i.push(c)}});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 ue(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 nn(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=lh(s);await nn(this.storage,this.storageKey,i)}else{const s=lh(r);await nn(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ue(this.storage,this.storageKey),await ue(this.storage,this.storageKey+"-code-verifier"),await ue(this.storage,this.storageKey+"-user"),this.userStorage&&await ue(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(),It);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)/It);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${It}ms, refresh threshold is ${ss} ticks`),s<=ss&&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 qb)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)/It);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${It}ms, refresh threshold is ${ss} ticks`),s<=ss&&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 Er(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 B(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(D(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:c,error:u}=await B(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 u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(D(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"?mh(t.webauthn.credential_response):gh(t.webauthn.credential_response)})}:{code:t.code}),{data:c,error:u}=await B(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 u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+c.expires_in},c)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",c),this._returnResult({data:c,error:u}))})}catch(n){if(D(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 B(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:c}=o;if(c.type!=="webauthn")return{data:c,error:null};switch(c.webauthn.type){case"create":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:fh(c.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:ph(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(D(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,i;if(t)try{const{payload:p}=Ai(t);let v=null;p.aal&&(v=p.aal);let g=v;const{data:{user:w},error:y}=await this.getUser(t);if(y)return this._returnResult({data:null,error:y});((n=(r=w==null?void 0:w.factors)===null||r===void 0?void 0:r.filter(k=>k.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(g="aal2");const x=p.amr||[];return{data:{currentLevel:v,nextLevel:g,currentAuthenticationMethods:x},error:null}}catch(p){if(D(p))return this._returnResult({data:null,error:p});throw p}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:c}=Ai(a.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((i=(s=a.user.factors)===null||s===void 0?void 0:s.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const f=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await B(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(D(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 B(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(D(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 B(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(D(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 B(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(D(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 B(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(D(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+cb>s)return n;const{data:i,error:a}=await B(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:p,error:v}=await this.getSession();if(v||!p.session)return this._returnResult({data:null,error:v});n=p.session.access_token}const{header:s,payload:i,signature:a,raw:{header:o,payload:c}}=Ai(n);if(!(r!=null&&r.allowExpired))try{Pb(i.exp)}catch(p){throw new Aa(p instanceof Error?p.message:"JWT validation failed")}const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:a},error:null}}const d=Ob(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,xb(`${o}.${c}`)))throw new Aa("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(n){if(D(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var r,n,s;at(this.experimental);try{if(!Oa())return this._returnResult({data:null,error:new dt("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=ph(i.options),c=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:nc.createNewAbortSignal(),{data:u,error:d}=await Bm({publicKey:o,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new dt("WebAuthn ceremony failed",null)});const h=gh(u);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(D(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var r,n;at(this.experimental);try{if(!Oa())return this._returnResult({data:null,error:new dt("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=fh(s.options),o=(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:nc.createNewAbortSignal(),{data:c,error:u}=await Fm({publicKey:a,signal:o});if(u||!c)return this._returnResult({data:null,error:u??new dt("WebAuthn ceremony failed",null)});const d=mh(c);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(D(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){at(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 B(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(D(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){at(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 B(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(D(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;at(this.experimental);try{const{data:n,error:s}=await B(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(D(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){at(this.experimental);try{const{data:r,error:n}=await B(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(D(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){at(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 B(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(D(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){at(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 B(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(D(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){at(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 B(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(D(r))return this._returnResult({data:null,error:r});throw r}}}Ws.nextInstanceID={};const n1=Ws,s1="2.110.2";let is="",$a;if(typeof Deno<"u"){var Wo;is="deno",$a=(Wo=Deno.version)===null||Wo===void 0?void 0:Wo.deno}else if(typeof document<"u")is="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")is="react-native";else{var Ho;is="node",$a=typeof process<"u"?(Ho=process.version)===null||Ho===void 0?void 0:Ho.replace(/^v/,""):void 0}const Mm=[`runtime=${is}`];$a&&Mm.push(`runtime-version=${$a}`);const i1={"X-Client-Info":`supabase-js/${s1}; ${Mm.join("; ")}`},a1={headers:i1},o1={schema:"public"},l1={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},c1={},u1={enabled:!1,respectSamplingDecision:!0};function d1(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{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(o,c)}u((n=n.apply(e,[])).next())})}let Vo=null;const h1="@opentelemetry/api";function f1(){return Vo===null&&(Vo=import(h1).catch(()=>null)),Vo}function p1(){return d1(this,void 0,void 0,function*(){try{const e=yield f1();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 m1(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 g1(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(y1(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 y1(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 v1(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 Hs(e){"@babel/helpers - typeof";return Hs=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},Hs(e)}function x1(e,t){if(Hs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function w1(e){var t=x1(e,"string");return Hs(t)=="symbol"?t:t+""}function b1(e,t,r){return(t=w1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yh(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?yh(Object(r),!0).forEach(function(n){b1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const k1=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),_1=()=>Headers,S1=(e,t,r,n,s)=>{const i=k1(n),a=_1(),o=(s==null?void 0:s.enabled)===!0,c=(s==null?void 0:s.respectSamplingDecision)!==!1,u=o?v1(t):null;return async(d,h)=>{var f;const p=(f=await r())!==null&&f!==void 0?f:e;let v=new a(h==null?void 0:h.headers);if(v.has("apikey")||v.set("apikey",e),v.has("Authorization")||v.set("Authorization",`Bearer ${p}`),u){const g=await E1(d,u,c);g&&(g.traceparent&&!v.has("traceparent")&&v.set("traceparent",g.traceparent),g.tracestate&&!v.has("tracestate")&&v.set("tracestate",g.tracestate),g.baggage&&!v.has("baggage")&&v.set("baggage",g.baggage))}return i(d,le(le({},h),{},{headers:v}))}};async function E1(e,t,r){if(!g1(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const n=await p1();if(!n||!n.traceparent)return null;if(r){const s=m1(n.traceparent);if(s&&!s.isSampled)return null}return n}function vh(e){return typeof e=="boolean"?{enabled:e}:e}function j1(e){return e.endsWith("/")?e:e+"/"}function C1(e,t){var r,n,s,i,a,o;const{db:c,auth:u,realtime:d,global:h}=e,{db:f,auth:p,realtime:v,global:g}=t,w=vh(e.tracePropagation),y=vh(t.tracePropagation),m={db:le(le({},f),c),auth:le(le({},p),u),realtime:le(le({},v),d),storage:{},global:le(le(le({},g),h),{},{headers:le(le({},(r=g==null?void 0:g.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=w==null?void 0:w.enabled)!==null&&i!==void 0?i:y==null?void 0:y.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(a=(o=w==null?void 0:w.respectSamplingDecision)!==null&&o!==void 0?o:y==null?void 0:y.respectSamplingDecision)!==null&&a!==void 0?a:!0},accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function N1(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(j1(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var T1=class extends n1{constructor(e){super(e)}},A1=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const i=N1(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:o1,realtime:c1,auth:le(le({},l1),{},{storageKey:a}),global:a1,tracePropagation:u1},c=C1(r??{},o);if(this.settings=c,this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=S1(t,e,this._getAccessToken.bind(this),c.global.fetch,c.tracePropagation),this.realtime=this._initRealtimeClient(le({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Ux(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new nb(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new Ax(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:c,throwOnError:u,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:f},p,v){const g={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new T1({url:this.authUrl.href,headers:le(le({},g),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:c,throwOnError:u,experimental:d,fetch:v,lockAcquireTimeout:h,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Cw(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 R1=(e,t,r)=>new A1(e,t,r);function P1(){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}P1()&&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 qm="https://udmfeelrxeoahrzkxmlk.supabase.co",Wm="sb_publishable_IyiVc_rXSJ1UmjH5DvPQVw_Yf--y3sJ",O1=qm.includes("your-project")||Wm.includes("your-anon"),X=!O1;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 Z=R1(X?qm:"https://placeholder.supabase.co",X?Wm:"placeholder-anon-key");function Lt(e,t){try{const r=localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}function nr(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(r){console.warn("localStorage write failed",e,r)}}const ni=["Western","Sitcom","Drama","Crime","Mystery","Sci-Fi","Kids","Animation","British TV","Soap Opera","Mini Series","Classic TV"],mu=["1950s","1960s","1970s","1980s","1990s","2000s"],sc={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"]},Ia=["rings","diagonal","dots","sunburst"];function z1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function Hm(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t}function Vm(){return`zc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}function $1(){return`ZA-${new Date().getFullYear()}${String(Math.floor(Math.random()*9e4)+1e4)}`}function Vs(e){const t=(e.title||"Untitled").trim(),r=(e.genres&&e.genres.length?e.genres:["Classic TV"]).filter(c=>typeof c=="string"),n=ni.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||Vm();return{id:o,slug:e.slug||z1(`${t} complete series`),title:t,displayTitle:e.displayTitle||`${t} — Complete Series Collection`,years:e.years||"",genres:r,country:e.country||"USA",language:e.language||"English",decades:e.decades&&e.decades.length?e.decades:["1950s"],seasons:s,episodes:Number(e.episodes)||0,cast:e.cast||[],shortDesc:e.shortDesc||`Buy "${t}" complete series — ${s} season${s>1?"s":""}${e.years?` (${e.years})`:""} as digital download (lifetime Google Drive link) or USB edition with fast express shipping worldwide.`,longDesc:e.longDesc||`Own the complete "${t}" TV series — the full collection of ${e.episodes?`${e.episodes} episodes across `:""}${s} season${s>1?"s":""}${e.years?` (${e.years})`:""}.
Choose your format:
• **Digital Download** — receive a lifetime Google Drive link. Stream or download instantly to any device: laptop, tablet, phone, or smart TV. No expiry, no subscription. Yours forever.
• **USB Edition** — we ship via express courier worldwide. Plug into any USB port: TV, PC, Mac, media player, car entertainment. No internet needed. Play anywhere, anytime.
${r.join(", ")} fans will love this definitive ${e.country||"USA"} series. ${(e.decades||[]).length?`A timeless ${e.decades.join(", ")} classic,`:""} perfect for collectors and binge-watchers alike.`,quality:e.quality||"Standard-definition, cleaned and restored",isHD:!!e.isHD,compatibility:e.compatibility||"Digital: your lifetime Google Drive link works on any device with internet — laptops, tablets, phones, smart TVs. USB: plays seamlessly on any USB-compatible TV, PC, Mac, projector, car system, or media player. No region locks, no special software required.",tags:e.tags||[...r,...e.decades||[],e.country||"USA","digital download","USB","complete series","tv series collection","streaming","buy online","dvd collection","watch online","all episodes"].map(c=>String(c).toLowerCase()),seoTitle:e.seoTitle||`${t} Complete Series ${e.years?`(${e.years}) `:""}| Watch Online, Buy DVD, Digital Download & USB | TvSeriesArchive`,seoDescription:e.seoDescription||`Where to watch ${t} complete series ${e.years?`(${e.years})`:""}? Buy digital download, USB, or DVD collection. ${r.slice(0,2).join(", ")}. Instant stream or play offline on any device.`,palette:sc[n]||["#221C14","#C6A15B"],pattern:Ia[Hm(o)%Ia.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 xh(e){const t=ni.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:sc[t]||sc["Classic TV"],pattern:Ia[Hm(e.id)%Ia.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 wh(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 bh(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 kh(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 Km="za-demo-products",Gm="za-demo-orders",Jm="za-demo-settings";function sn(){return Lt(Km,[])}function as(e){nr(Km,e)}function it(){return Lt(Gm,[])}function Pt(e){nr(Gm,e)}function I1(e){return Lt(Jm,e)}function D1(e){nr(Jm,e)}const L1=[{title:"Frontier Skies",genres:["Western"],decades:["1960s"],seasons:6},{title:"Harbor Lights",genres:["Drama"],decades:["1970s"],seasons:4}],U1=["Frontier Skies","Harbor Lights","Midnight Precinct","The Larkspur House","Silver Static","Copper County","Willow Creek Junction","Sterling Manor"];async function F1(){const e=sn();if(e.length>0&&!(e.some(s=>U1.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)=>Vs({...i,createdAt:t-a*36e5}))}catch{r=L1.map((n,s)=>Vs({title:n.title,genres:n.genres.filter(i=>ni.includes(i)),decades:n.decades.filter(i=>mu.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}))}as(r)}const gu=.7,yu=.3,Ko=50,Go="This promotion is limited to a maximum of 50 digital collections per customer. Please remove some items to continue.";function B1(e){return e?new Date(e).getTime()-Date.now():0}function wr(e){return B1(e)>0}function Ze(e,t){var s,i;const r=((i=(s=e.formats)==null?void 0:s[t])==null?void 0:i.price)||0;return Math.round(r/(1-(t==="digital"?gu:yu))*100)/100}function M1(e,t){return e.formats.digital.price}const _h=new Set(["sarahmulholland37@gmail.com"]),Ym=b.createContext(null),Ue=()=>b.useContext(Ym),Sh={payoneerEmail:"payments@tvseriesarchive.com",supportEmail:"support@tvseriesarchive.com",currency:"USD",saleEndsAt:null},Yn="za-my-orders-index";function Zr(e,{orderId:t,email:r,...n}){fetch("/api/send-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e,orderId:t,email:r,...n})}).catch(s=>console.warn("Email notification failed (non-blocking):",s))}function q1(e){return{digitalPrice:e.formats.digital.price,usbPrice:e.formats.usb.price,digitalAvailable:e.formats.digital.available,usbAvailable:e.formats.usb.available}}function W1({children:e}){const[t,r]=b.useState([]),[n,s]=b.useState([]),[i,a]=b.useState([]),[o,c]=b.useState([]),[u,d]=b.useState(Sh),[h,f]=b.useState(()=>Lt("za-wishlist",[])),[p,v]=b.useState(()=>Lt("za-recent-searches",[])),[g,w]=b.useState(()=>Lt("za-cart",[])),[y,m]=b.useState(!1),[x,k]=b.useState(null);b.useEffect(()=>{nr("za-wishlist",h)},[h]),b.useEffect(()=>{nr("za-recent-searches",p)},[p]),b.useEffect(()=>{nr("za-cart",g)},[g]);async function S(){if(!X){const O=sn().filter(L=>L.enabled&&!L.needsReview).map(L=>({...L,deliveryLink:null})).sort((L,q)=>q.createdAt-L.createdAt);r(O);return}let _=[],C=0;const R=1e3;for(;;){const O=C*R,L=O+R-1,{data:q,error:T}=await Z.from("public_products").select("*").order("created_at",{ascending:!1}).range(O,L);if(T){k(T.message);return}if(!q||q.length===0||(_=_.concat(q),q.length<R))break;C++}r(_.map(xh))}async function E(){if(!X){s([...sn()].sort((O,L)=>L.createdAt-O.createdAt));return}let _=[],C=0;const R=1e3;for(;;){const O=C*R,L=O+R-1,{data:q,error:T}=await Z.from("products").select("*").order("created_at",{ascending:!1}).range(O,L);if(T){k(T.message);return}if(!q||q.length===0||(_=_.concat(q),q.length<R))break;C++}s(_.map(xh))}async function j(){if(!X){a([...it()].sort((R,O)=>O.createdAt-R.createdAt));return}const{data:_,error:C}=await Z.from("orders").select("*").order("created_at",{ascending:!1});if(C){k(C.message);return}a((_||[]).map(bh))}async function $(){if(!X){d(I1(Sh));return}const{data:_,error:C}=await Z.from("settings").select("*").eq("id",1).maybeSingle();if(C){k(C.message);return}_&&d({payoneerEmail:_.payoneer_email,supportEmail:_.support_email,currency:_.currency||"USD",saleEndsAt:_.sale_ends_at||null})}async function I(_,C){if(!X)return it().find(q=>q.id===_&&q.customer.email.trim().toLowerCase()===(C||"").trim().toLowerCase())||null;const{data:R,error:O}=await Z.rpc("get_my_order",{p_order_id:_,p_email:C});return O||!R||R.length===0?null:bh(R[0])}async function N(){const _=Lt(Yn,[]),C=[];for(const R of _){const O=await I(R.id,R.email);O&&C.push(O)}C.sort((R,O)=>O.createdAt-R.createdAt),c(C)}b.useEffect(()=>{(async()=>(X||await F1(),await Promise.all([S(),$()]),m(!0)))()},[]);const M={products:t,adminProducts:n,orders:i,myOrders:o,settings:u,wishlist:h,recentSearches:p,cartItems:g,loaded:y,error:x,refreshProducts:S,refreshAdminProducts:E,refreshOrders:j,refreshMyOrders:N,lookupOrder:I,async setSettings(_){if(d(_),!X){D1(_);return}const{error:C}=await Z.from("settings").update({payoneer_email:_.payoneerEmail,support_email:_.supportEmail,currency:_.currency,sale_ends_at:_.saleEndsAt||null}).eq("id",1);C&&k(C.message)},async upsertProducts(_){const C=_.map(L=>Vs(L));if(!X){const L=sn();C.forEach(q=>{const T=L.findIndex(A=>A.slug===q.slug);T>=0?L[T]={...q,id:L[T].id}:L.push(q)}),as(L),await Promise.all([S(),E()]);return}const R=C.map(wh),{error:O}=await Z.from("products").upsert(R,{onConflict:"slug"});if(O){k(O.message);return}await Promise.all([S(),E()])},async updateProduct(_,C){const R=n.find(q=>q.id===_)||t.find(q=>q.id===_);if(!R)return;const O=Vs({...R,...q1(R),...C,id:_});if(!X){const q=sn(),T=q.findIndex(A=>A.id===_);T>=0?q[T]=O:q.push(O),as(q),await Promise.all([S(),E()]);return}const{error:L}=await Z.from("products").update(wh(O)).eq("id",_);if(L){k(L.message);return}await Promise.all([S(),E()])},async deleteProducts(_){if(!X){as(sn().filter(R=>!_.includes(R.id))),await Promise.all([S(),E()]);return}const{error:C}=await Z.from("products").delete().in("id",_);if(C){k(C.message);return}await Promise.all([S(),E()])},async replaceAllProducts(_){if(!X){as(_),await Promise.all([S(),E()]);return}const C=_.map(O=>O.id),R=n.filter(O=>!C.includes(O.id)).map(O=>O.id);R.length&&await Z.from("products").delete().in("id",R),await Promise.all([S(),E()])},toggleWishlist(_){f(C=>C.includes(_)?C.filter(R=>R!==_):[...C,_])},pushRecentSearch(_){v(C=>[_,...C.filter(R=>R!==_)].slice(0,5))},addToCart(_,C){const R=C==="digital"&&wr(u.saleEndsAt);if(R&&g.filter(q=>q.format==="digital"&&q.onSale).length+1>Ko)return{ok:!1,error:Go};const O=R?M1(_,u.saleEndsAt):_.formats[C].price;return w(L=>[...L,{productId:_.id,format:C,price:O,onSale:R}]),{ok:!0}},removeFromCart(_){w(C=>C.filter((R,O)=>O!==_))},clearCart(){w([])},syncCartPricing(){return wr(u.saleEndsAt)||!g.some(C=>C.onSale)?!1:(w(C=>C.map(R=>{if(!R.onSale)return R;const O=t.find(L=>L.id===R.productId);return{...R,price:O?O.formats.digital.price:R.price,onSale:!1}})),!0)},async placeOrder(_){var L,q;const C=(q=(L=_.customer)==null?void 0:L.email)==null?void 0:q.trim().toLowerCase();if(C&&_h.has(C))throw new Error("This email address has been blocked. Please contact support if you believe this is an error.");if(_.items.filter(T=>T.format==="digital"&&T.onSale).length>Ko)throw new Error(Go);if(!X)Pt([_,...it()]);else{const{error:T}=await Z.from("orders").insert(kh(_));if(T)throw k(T.message),T}w([]);const O=Lt(Yn,[]);nr(Yn,[{id:_.id,email:_.customer.email},...O].slice(0,50)),_.paymentMethod!=="stripe"&&Zr("pending_payment",{orderId:_.id,email:_.customer.email})},async stripeCheckout(_){var T,A;const C=(A=(T=_.customer)==null?void 0:T.email)==null?void 0:A.trim().toLowerCase();if(C&&_h.has(C))throw new Error("This email address has been blocked.");if(_.items.filter(z=>z.format==="digital"&&z.onSale).length>Ko)throw new Error(Go);if(!X)Pt([_,...it()]);else{const{error:z}=await Z.from("orders").insert(kh(_));if(z)throw k(z.message),z}w([]);const O=Lt(Yn,[]);nr(Yn,[{id:_.id,email:_.customer.email},...O].slice(0,50));const L=await fetch("/api/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderId:_.id,items:_.items,customer:_.customer,total:_.total,currency:_.currency})}),q=await L.json();if(!L.ok||!q.url)throw new Error(q.error||"Failed to create checkout session");return q.url},async reportPaid(_){if(!X){Pt(it().map(O=>O.id===_?{...O,status:"payment_reported"}:O)),await j();return}const{error:C}=await Z.from("orders").update({status:"payment_reported"}).eq("id",_);if(C){k(C.message);return}await j();const R=i.find(O=>O.id===_);R&&Zr("payment_reported",{orderId:_,email:R.customer.email})},async markPaid(_){const C=i.find(T=>T.id===_),R=((C==null?void 0:C.items)||[]).filter(T=>T.format==="digital"),O=R.every(T=>{const A=n.find(z=>z.id===T.productId);return A==null?void 0:A.deliveryLink}),L=R.length>0&&O,q={...(C==null?void 0:C.accessLinks)||{}};if(L&&R.forEach(T=>{const A=n.find(z=>z.id===T.productId);q[T.productId]=A.deliveryLink}),!X){Pt(it().map(T=>T.id===_?{...T,status:L?"access_granted":"paid",accessLinks:q}:T)),await j(),L&&Zr("access_granted",{orderId:_,email:C.customer.email});return}L?await Z.from("orders").update({status:"access_granted",access_links:q}).eq("id",_):await Z.from("orders").update({status:"paid"}).eq("id",_),await j(),L&&Zr("access_granted",{orderId:_,email:C.customer.email})},async approveAccess(_){const C=i.find(O=>O.id===_);if(!C)return;const R={};if(C.items.forEach(O=>{if(O.format!=="digital")return;const L=n.find(q=>q.id===O.productId);R[O.productId]=(L==null?void 0:L.deliveryLink)||"(No delivery link set on this product yet — add one in Admin > Products.)"}),!X)Pt(it().map(O=>O.id===_?{...O,status:"access_granted",accessLinks:R}:O));else{const{error:O}=await Z.from("orders").update({status:"access_granted",access_links:R}).eq("id",_);if(O){k(O.message);return}}await j(),Zr("access_granted",{orderId:_,email:C.customer.email})},async markShipped(_,C){if(!X){Pt(it().map(O=>O.id===_?{...O,status:"shipped",tracking:C}:O)),await j();return}const{error:R}=await Z.from("orders").update({status:"shipped",tracking:C}).eq("id",_);if(R){k(R.message);return}await j()},async markCompleted(_){if(!X){Pt(it().map(R=>R.id===_?{...R,status:"completed"}:R)),await j();return}const{error:C}=await Z.from("orders").update({status:"completed"}).eq("id",_);if(C){k(C.message);return}Zr("request_review",{orderId:_}),await j()},async cancelOrder(_){if(!X){Pt(it().map(R=>R.id===_?{...R,status:"cancelled"}:R)),await j();return}const{error:C}=await Z.from("orders").update({status:"cancelled"}).eq("id",_);if(C){k(C.message);return}fetch("/api/payoneer-links",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"release",orderId:_})}).catch(()=>{}),await j()},async refundOrder(_){if(!X){Pt(it().map(R=>R.id===_?{...R,status:"refunded"}:R)),await j();return}const{error:C}=await Z.from("orders").update({status:"refunded"}).eq("id",_);if(C){k(C.message);return}await j()}};return l.jsx(Ym.Provider,{value:M,children:e})}const ic="za-demo-admin-session",H1="tvseriesarchive-preview";let Qm=typeof sessionStorage<"u"&&sessionStorage.getItem(ic)==="1";const ac=new Set;function Eh(e){Qm=e,ac.forEach(t=>t(e))}function Xm(){const[e,t]=b.useState(null),[r,n]=b.useState(!0),[s,i]=b.useState(Qm);return b.useEffect(()=>{if(!X)return n(!1),ac.add(i),()=>ac.delete(i);Z.auth.getSession().then(({data:o})=>{t(o.session),n(!1)});const{data:a}=Z.auth.onAuthStateChange((o,c)=>t(c));return()=>a.subscription.unsubscribe()},[]),{session:e,loading:r,isAdmin:X?!!e:s,isDemoMode:!X,signIn:async(a,o)=>X?Z.auth.signInWithPassword({email:a,password:o}):o===H1?(sessionStorage.setItem(ic,"1"),Eh(!0),{error:null}):{error:{message:"Incorrect preview password."}},signOut:async()=>{if(!X){sessionStorage.removeItem(ic),Eh(!1);return}return Z.auth.signOut()}}}function V1(){const{signIn:e,isDemoMode:t}=Xm(),[r,n]=b.useState(""),[s,i]=b.useState(""),[a,o]=b.useState(""),[c,u]=b.useState(!1),d=async h=>{h.preventDefault(),u(!0),o("");const{error:f}=await e(r,s);f&&o(f.message||"Sign-in failed. Check your email and password."),u(!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(Ca,{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(_a,{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(wm,{size:12})," ",a]}),l.jsxs("button",{type:"submit",disabled:c,className:"za-focus za-bg-gold text-[#141118] rounded-full py-2.5 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60",children:[c?l.jsx(vr,{size:14,className:"za-spin"}):l.jsx(_a,{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 K1({children:e}){const{loading:t,isAdmin:r,signOut:n,isDemoMode:s}=Xm();return t?l.jsxs("div",{className:"flex items-center justify-center py-24 za-ink-dim text-sm gap-2",children:[l.jsx(vr,{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(xx,{size:12})," Sign out"]})]}),e]}):l.jsx(V1,{})}class Ri extends b.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 Kr({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(Hl,{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 Zm=b.createContext(null),co=()=>b.useContext(Zm),G1=2800,Pi=10,J1=1800,jh=10,Oi=["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 Y1(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 Q1(e){return e<.5?2*e*e:-1+(4-2*e)*e}function X1({start:e,end:t,coverStyle:r,onDone:n}){const s=b.useRef(null),i=b.useRef([]),a=b.useRef([]),o=b.useRef(),c=b.useRef(null),u=t.x-e.x,d={x:e.x+u*.2,y:e.y-180},h={x:e.x+u*.8,y:t.y-260};return b.useEffect(()=>{const f=s.current,p=f.querySelector(".za-fly-item"),v=f.querySelector(".za-fly-package"),g=f.querySelector(".za-pkg-fold"),w=f.querySelector(".za-pkg-tape-h"),y=f.querySelector(".za-pkg-tape-v"),m=f.querySelector(".za-pkg-lid");if(!f)return;function x(k){c.current==null&&(c.current=k);const S=k-c.current,E=Math.min(S/G1,1),j=Q1(E),$=Y1(j,e,d,h,t);i.current=[...i.current,$].slice(-Pi);const I=Math.max(0,Math.min(1,(j-.18)/.55)),N=540+j*180,M=Math.max(1-j*.55,.4)*1.15,_=Math.sin(S*.003)*(1-j)*8,C=Math.sin(j*Math.PI*2)*2.5,R=I<.5?1:Math.max(0,1-(I-.5)*2.5),O=I>.2?Math.min(1,(I-.2)/.5):0,L=I>.25?Math.min(1,(I-.25)/.35):0,q=I>.5?Math.min(1,(I-.5)/.25):0,T=I>.4?Math.min(1,(I-.4)/.2):0,A=(1-L)*60;f.style.transform=`translate(${$.x-23}px, ${$.y-27}px) rotate(${N}deg) scale(${M})`,f.style.filter=`blur(${C}px)`,p&&(p.style.opacity=R),v&&(v.style.opacity=O,v.style.transform=`translateY(${A}px)`),g&&(g.style.opacity=L),w&&(w.style.opacity=T),y&&(y.style.opacity=T),m&&(m.style.opacity=q,m.style.transform=`translateY(${(1-q)*-12}px)`);const z=i.current;for(let K=0;K<Pi;K++){const Y=a.current[K];if(Y)if(K<z.length){const Tt=z[K],U=K/Pi,V=Math.sin(K*2.3)*.5+.5;Y.style.display="block",Y.style.transform=`translate(${Tt.x-3-V*5}px, ${Tt.y-3-V*5+_*U}px) scale(${.08+U*.5})`,Y.style.opacity=U*(.3+I*.3)*(.6+V*.4),Y.style.width=Y.style.height=`${6+V*10}px`}else Y.style.display="none"}E<1?o.current=requestAnimationFrame(x):n()}return o.current=requestAnimationFrame(x),()=>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:Pi}).map((f,p)=>l.jsx("div",{ref:v=>{v&&(a.current[p]=v)},className:"za-fly-trail",style:{position:"fixed",zIndex:199,borderRadius:"50%",pointerEvents:"none",background:"radial-gradient(circle, rgba(109,74,255,0.8), rgba(63,140,255,0) 70%)",filter:"blur(2px)",willChange:"transform",boxShadow:"0 0 10px 3px rgba(109,74,255,0.3)",display:"none"}},p)),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 Jo({x:e,y:t,baseColor:r}){const[n,s]=b.useState([]),[i,a]=b.useState([]);return b.useEffect(()=>{const o=Array.from({length:jh},(d,h)=>{const f=h/jh*360+Math.random()*18,p=30+Math.random()*70;return{id:h,dx:Math.cos(f*Math.PI/180)*p,dy:Math.sin(f*Math.PI/180)*p,size:2+Math.random()*6,delay:Math.random()*40}});s(o);const c=Array.from({length:6},(d,h)=>{const f=h/6*360+15;return{id:`s${h}`,dx:Math.cos(f*Math.PI/180)*50,dy:Math.sin(f*Math.PI/180)*50-20,delay:Math.random()*30}});a(c);const u=setTimeout(()=>{s([]),a([])},800);return()=>clearTimeout(u)},[]),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 Z1({x:e,y:t,text:r,onDone:n}){const[s,i]=b.useState(!1);return b.useEffect(()=>{const a=setTimeout(()=>i(!0),50),o=setTimeout(n,J1);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(Jo,{x:e,y:t-40,baseColor:"#FF6B6B"}),l.jsx(Jo,{x:e,y:t-40,baseColor:"#FFD93D"}),l.jsx(Jo,{x:e,y:t-40,baseColor:"#4D96FF"})]})]})}function ek({arrivals:e,count:t,onClick:r}){const[n,s]=b.useState(!1),i=b.useRef(0);return b.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 Ch({onLand:e,onCartClick:t,cartCount:r=0,children:n}){const[s,i]=b.useState([]),[a,o]=b.useState([]),[c,u]=b.useState(0),d=b.useRef(0),h=b.useRef(-1),f=b.useCallback((g,w)=>{if(!g)return;const y=g.getBoundingClientRect(),m=window.innerWidth-50,x=window.innerHeight-112,k=++d.current,S={x:y.left+y.width/2,y:y.top+y.height/2},E={x:m,y:x};i(I=>[...I,{id:k,start:S,end:E,coverStyle:w}]);let j=Math.floor(Math.random()*Oi.length);Oi.length>1&&j===h.current&&(j=(j+1)%Oi.length),h.current=j;const $=`t${k}`;o(I=>[...I,{id:$,x:S.x,y:S.y,text:Oi[j]}])},[]),p=b.useCallback(g=>{i(w=>w.filter(y=>y.id!==g)),u(w=>w+1),e==null||e()},[e]),v=b.useCallback(g=>{o(w=>w.filter(y=>y.id!==g))},[]);return l.jsxs(Zm.Provider,{value:f,children:[n,a.map(g=>l.jsx(Z1,{x:g.x,y:g.y,text:g.text,onDone:()=>v(g.id)},g.id)),s.map(g=>l.jsx(X1,{start:g.start,end:g.end,coverStyle:g.coverStyle,onDone:()=>p(g.id)},g.id)),l.jsx(ek,{arrivals:c,count:r,onClick:t})]})}function tk(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 rk({open:e,onClose:t,onNav:r}){const n=Ue(),s=co(),[i,a]=b.useState({}),o=wr(n.settings.saleEndsAt),c=(n.products||[]).filter(p=>{var v;return(v=n.wishlist)==null?void 0:v.includes(p.id)}),u=(p,v)=>{var y,m,x,k;const g=(m=(y=p.formats)==null?void 0:y.digital)!=null&&m.available?"digital":"usb";if(!((k=(x=p.formats)==null?void 0:x[g])!=null&&k.available))return;const w=n.addToCart(p,g);if(!w.ok){alert(w.error);return}s(v.currentTarget,tk(p)),a(S=>({...S,[p.id]:!0})),setTimeout(()=>a(S=>({...S,[p.id]:!1})),1200)},d=p=>{var v,g,w,y;for(const m of c){const x=(g=(v=m.formats)==null?void 0:v.digital)!=null&&g.available?"digital":"usb";if(!((y=(w=m.formats)==null?void 0:w[x])!=null&&y.available))continue;const k=n.addToCart(m,x);if(!k.ok){alert(k.error);break}}t()},h=p=>n.toggleWishlist(p),f=()=>c.forEach(p=>n.toggleWishlist(p.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(On,{size:18,className:"text-[var(--exp-accent)]",fill:"currentColor"}),l.jsx("h3",{className:"exp-section-title",style:{margin:0,fontSize:17},children:"Favorites"}),c.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:c.length})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[c.length>0&&l.jsxs("button",{onClick:f,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(Ld,{size:11})," Clear"]}),l.jsx("button",{onClick:t,className:"exp-icon-btn",children:l.jsx(jt,{size:18})})]})]}),c.length>0&&l.jsxs("div",{className:"flex gap-1 px-5 pb-3",children:[l.jsxs("button",{onClick:p=>d(),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(Ex,{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(ym,{size:10})," Cart"]})]})]}),c.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(On,{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(Ea,{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:c.map(p=>{var y,m,x,k,S,E,j,$,I,N,M,_;const[v,g]=p.palette||["#1e1b2e","#8b5cf6"],w=p.coverUrl?{backgroundImage:`url(${p.coverUrl})`,backgroundSize:"cover",backgroundPosition:"center"}:{background:`linear-gradient(155deg, ${v}, ${g}33 70%, ${v})`};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:{...w,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:p.displayTitle||p.title})}),l.jsx("button",{onClick:()=>h(p.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(Ld,{size:14})})]}),l.jsxs("p",{className:"text-[11px] text-[var(--exp-text-muted)] mt-0.5",children:[p.years," · ",(y=p.genres)==null?void 0:y[0]]}),l.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[l.jsx(fu,{size:10,fill:"#FFB800",color:"#FFB800"}),l.jsx("span",{className:"text-[10px] text-[var(--exp-text-muted)]",children:(m=p.rating)==null?void 0:m.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:[((k=(x=p.formats)==null?void 0:x.digital)==null?void 0:k.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(Vr,{size:8})," Digital"]}),((E=(S=p.formats)==null?void 0:S.usb)==null?void 0:E.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(yr,{size:8})," USB"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"exp-trending-price text-sm",children:o&&(($=(j=p.formats)==null?void 0:j.digital)!=null&&$.available)?l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{textDecoration:"line-through",color:"var(--exp-text-muted)",fontSize:"0.8em"},children:["$",Ze(p,"digital").toFixed(2)]})," ",l.jsxs("b",{style:{color:"#9B80FF"},children:["$",(((N=(I=p.formats)==null?void 0:I.digital)==null?void 0:N.price)||29.99).toFixed(2)]})]}):l.jsxs(l.Fragment,{children:["$",(((_=(M=p.formats)==null?void 0:M.digital)==null?void 0:_.price)||29.99).toFixed(2),"+"]})}),l.jsx("button",{onClick:C=>u(p,C),className:`w-8 h-8 rounded-full flex items-center justify-center transition-all ${i[p.id]?"opacity-50":""}`,style:{background:"linear-gradient(135deg, #7C5CFF, #405DFF)"},title:"Add to Cart",children:l.jsx(St,{size:13,className:"text-white"})})]})]})]})]},p.id)})})})]})]})}const Dr="TvSeriesArchive",$e="https://tvseriesarchive.com",vu="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 nk(e){let t=document.head.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e)}function ar(e,t="za-jsonld"){let r=document.getElementById(t);if(!e){r&&r.remove();return}r||(r=document.createElement("script"),r.type="application/ld+json",r.id=t,document.head.appendChild(r)),r.textContent=JSON.stringify(e)}const sk={"@context":"https://schema.org","@type":"Organization",name:Dr,url:$e,logo:`${$e}/logo.webp`,description:vu,sameAs:[]},ik={"@context":"https://schema.org","@type":"WebSite",name:Dr,url:$e,description:vu,potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${$e}/collections?q={search_term_string}`},"query-input":"required name=search_term_string"}};function ak(){b.useEffect(()=>(ar(sk,"za-org"),ar(ik,"za-website"),()=>{ar(null,"za-org"),ar(null,"za-website")}),[])}function Un({title:e,description:t,path:r="/",image:n,keywords:s,jsonLd:i,noindex:a=!1,jsonLdExtra:o,robots:c}={}){b.useEffect(()=>{const u=` | ${Dr}`,d=e&&e.endsWith(u)?e.slice(0,-u.length):e,h=d?`${d}${u}`:`${Dr} — Complete TV Series Collections, Worldwide Delivery`,f=t||vu,p=`${$e}${r}`;return document.title=h,Fe("name","description",f),s&&Fe("name","keywords",s),Fe("name","robots",c||(a?"noindex, nofollow":"index, follow")),Fe("property","og:site_name",Dr),Fe("property","og:title",h),Fe("property","og:description",f),Fe("property","og:type",n?"product":"website"),Fe("property","og:url",p),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),nk(p),ar(i,"page"),o&&o.forEach((v,g)=>ar(v,`extra-${g}`)),()=>{ar(null,"page"),o&&o.forEach((v,g)=>ar(null,`extra-${g}`))}},[e,t,r,n,s,i,a,o,c])}function Kk(e){return{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url?`${$e}${t.url}`:void 0}))}}function Gk(e){const t=e.featuredImage?e.featuredImage.startsWith("http")?e.featuredImage:`${$e}${e.featuredImage}`:ok;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:Dr,url:$e},mainEntityOfPage:{"@type":"WebPage","@id":`${$e}/blog/${e.slug}`}}}const ok=`${$e}/og-fallback.png`,Nh={pending_payment:{label:"Payment Pending",icon:ka,tone:"text-[#FFB800]"},payment_reported:{label:"Payment Reported: Awaiting Confirmation",icon:uu,tone:"text-purple-400"},paid:{label:"Paid",icon:Sa,tone:"text-purple-400"},access_granted:{label:"Digital Download Ready",icon:xr,tone:"text-[#42D392]"},shipped:{label:"Shipped",icon:qr,tone:"text-purple-400"},completed:{label:"Completed",icon:Bt,tone:"text-[#42D392]"},cancelled:{label:"Cancelled",icon:jt,tone:"text-[#FFB800]"},refunded:{label:"Refunded",icon:du,tone:"text-[#FFB800]"}},Jk=20;async function Yk(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 Qk(e,t={}){const r=Number(e.confidence)||0;return Vs({...t,title:e.title||e.input||t.title,years:e.years||t.years||"",genres:(e.genres||[]).filter(n=>ni.includes(n)),country:e.country||t.country||"USA",language:e.language||"English",decades:(e.decades||[]).filter(n=>mu.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 lk=[{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 ck(e){return lk.find(t=>t.slug===e)||null}function uk(e){return e.questions.reduce((t,r)=>t+r.points,0)}const dk=b.lazy(()=>Ct(()=>import("./ExperimentalHome-D2iWvXUb.js"),__vite__mapDeps([0,1,2,3]))),hk=b.lazy(()=>Ct(()=>import("./BlogPage-DWGyLAb0.js"),__vite__mapDeps([4,5,6,7,2]))),fk=b.lazy(()=>Ct(()=>import("./BlogArticle-BYPRlZOy.js"),__vite__mapDeps([8,5,9,10,11,7]))),pk=b.lazy(()=>Ct(()=>import("./BlogCategory-DkLHhY9v.js"),__vite__mapDeps([12,5,6,10,7]))),mk=b.lazy(()=>Ct(()=>import("./BlogTag-BkaL4iRZ.js"),__vite__mapDeps([13,5,6,10,7]))),gk=b.lazy(()=>Ct(()=>import("./BlogAuthor-mjA9Kjf3.js"),__vite__mapDeps([14,5,9,6,10]))),yk=b.lazy(()=>Ct(()=>import("./NotFoundPage-DdbkzmIj.js"),[])),vk=b.lazy(()=>Ct(()=>import("./AdminPanel-C6MhXUoN.js"),__vite__mapDeps([15,16,2,1]))),xk=b.lazy(()=>Ct(()=>import("./QuizHub-CNiMGHSg.js"),[])),wk=b.lazy(()=>Ct(()=>import("./QuizPlay-s369Xc4j.js"),__vite__mapDeps([17,11,16])));function bk(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 kk(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 c=e.match(/^\/blog\/([^/]+)$/);if(c)return{view:"blog-article",params:{slug:decodeURIComponent(c[1])}};const u=e.match(/^\/pages\/([^/]+)$/);if(u)return{view:"trust",params:{page:u[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 _k=["Columbo","Western","1980s","British Sitcoms","Falcon Crest","Sci-Fi"],Yo=24,Sk={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 Th(){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 xu(e,t){b.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 Ji(e){if(e.coverUrl)return{backgroundImage:`url(${e.coverUrl})`};const[t,r]=e.palette;return{background:`linear-gradient(155deg, ${t}, ${r})`}}function Da({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(fu,{size:t,strokeWidth:1.5,className:n<=r?"text-[#FFB800]":"za-ink-dim",fill:n<=r?"currentColor":"none"},n))})}function Ek(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 jk({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 Ck({product:e,onOpen:t,onQuickView:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i}=Ue();co();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(Kr,{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:Ek(e).map(o=>l.jsx(jk,{...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(On,{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(mx,{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(St,{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(Da,{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(Vr,{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(yr,{size:10})," USB"]})]}),l.jsxs("span",{className:"za-display text-sm text-purple-400",children:["$",e.formats.digital.price.toFixed(2),"+"]})]})]})]})}function Nk(){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 eg({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(Nk,{},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(Ck,{product:i,onOpen:t,onQuickView:r,onShowAddMenu:n},i.id))})}function en({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(Ir,{size:15})]})]})}function Tk({onNavigateDetail:e,onRunSearch:t}){const{products:r,recentSearches:n,pushRecentSearch:s}=Ue(),[i,a]=b.useState(""),[o,c]=b.useState(!1),[u,d]=b.useState(-1),h=b.useRef(null);xu(h,()=>c(!1));const f=b.useMemo(()=>{if(!i)return[];const g=i.toLowerCase(),w=[];for(const y of r)if(y.enabled&&(y.title.toLowerCase().includes(g)||y.genres.some(m=>m.toLowerCase().includes(g))||y.cast.some(m=>m.toLowerCase().includes(g))||y.years.includes(g))&&(w.push(y),w.length>=6))break;return w},[i,r]),p=(g,w)=>{s(g),c(!1),a(""),w?e(w):t(g)},v=g=>{o&&(g.key==="ArrowDown"&&(g.preventDefault(),d(w=>Math.min(w+1,f.length-1))),g.key==="ArrowUp"&&(g.preventDefault(),d(w=>Math.max(w-1,0))),g.key==="Enter"&&(g.preventDefault(),u>=0&&f[u]?p(f[u].title,f[u].slug):i&&p(i)),g.key==="Escape"&&c(!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(Ds,{size:16,className:"text-[#70768F] shrink-0"}),l.jsx("input",{value:i,onFocus:()=>c(!0),onChange:g=>{a(g.target.value),d(-1)},onKeyDown:v,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(jt,{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(ja,{size:12})," Trending Searches"]}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:_k.map(g=>l.jsx("button",{onClick:()=>p(g),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:g},g))}),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(uu,{size:12})," Recent Searches"]}),l.jsx("div",{className:"flex flex-col",children:n.map(g=>l.jsx("button",{onClick:()=>p(g),className:"za-focus text-left px-2 py-1.5 rounded hover:bg-white/5 text-sm text-[#A7ABC0] hover:text-white",children:g},g))})]})]}):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((g,w)=>l.jsxs("button",{onMouseDown:()=>p(g.title,g.slug),className:`za-focus w-full text-left px-3 py-2 flex items-center gap-3 ${u===w?"bg-white/5":"hover:bg-white/5"}`,children:[l.jsx(Kr,{product:g,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:g.title}),l.jsxs("p",{className:"text-xs text-[#70768F]",children:[g.years," · ",g.genres[0]]})]})]},g.id))})})]})}function Ak({onNav:e}){const{products:t}=Ue(),[r,n]=b.useState(!1),s=b.useRef(null);xu(s,()=>n(!1));const i=b.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(ja,{size:14})," Top 10 ",l.jsx(so,{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(ja,{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(Kr,{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 Rk({theme:e,setTheme:t,onNav:r,currentView:n,onWishlistOpen:s}){const{wishlist:i}=Ue(),[a,o]=b.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(Vl,{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(Ea,{size:13})," New Arrivals"]}),l.jsx(Ak,{onNav:r})]}),l.jsx("div",{className:"flex-1 hidden lg:block max-w-md mx-4",children:l.jsx(Tk,{onNavigateDetail:c=>r("detail",{slug:c}),onRunSearch:c=>r("listing",{q:c})})}),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(Vl,{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(On,{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(jx,{size:18,className:"text-[#A7ABC0]"}):l.jsx(kx,{size:18,className:"text-[#A7ABC0]"})}),l.jsx("button",{onClick:()=>{o(!0),setTimeout(()=>{var c;return(c=document.getElementById("mob-search"))==null?void 0:c.focus()},100)},className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Search",children:l.jsx(Ds,{size:18,className:"text-[#A7ABC0]"})}),l.jsx("button",{onClick:()=>o(c=>!c),className:"za-focus lg:hidden p-2 rounded-full hover:bg-white/5","aria-label":"Menu",children:a?l.jsx(jt,{size:18,className:"text-[#A7ABC0]"}):l.jsx(wx,{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(Ds,{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:c=>{if(c.key==="Enter"){const u=c.target.value.trim();u&&(r("listing",{query:u}),o(!1))}}})]}),[["home","Home"],["listing","All Series"],["blog","Blog"],["quiz-hub","Quiz"],["listing_newest","New Arrivals"],["myorders","My Orders"]].map(([c,u])=>l.jsx("button",{onClick:()=>{c==="listing_newest"?r("listing",{sort:"newest"}):r(c),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:u},c)),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(ja,{size:14})," Top 10"]})]})]})})}function Pk({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 Qn({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 Xn({title:e,children:t,defaultOpen:r=!0}){const[n,s]=b.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(so,{size:14,className:`text-[#70768F] transition-transform ${n?"rotate-180":""}`})]}),n&&l.jsx("div",{children:t})]})}function Ok({onNav:e,initialFilters:t,onQuickView:r,onShowAddMenu:n}){const{products:s,wishlist:i,loaded:a}=Ue(),[o,c]=b.useState({genre:t.genre?[t.genre]:[],decade:t.decade?[t.decade]:[],country:[],language:[],format:t.format?[t.format]:[]}),[u,d]=b.useState(t.sort||"popularity"),[h,f]=b.useState(t.query||""),[p,v]=b.useState(Yo),[g,w]=b.useState(!1),y=!!t.wishlistOnly,m=gt(),x=y?"My Wishlist":t.genre?`${t.genre} TV Series`:t.decade?`${t.decade} TV Series`:t.format?`${t.format==="digital"?"Digital":"USB"} Collections`:"All Collections";Un({title:x,description:`Browse ${x.toLowerCase()} — complete classic TV series collections, available on Digital and USB, delivered worldwide.`,path:`${m.pathname}${m.search}`,noindex:!!(t.query||y)});const k=b.useMemo(()=>s.filter(N=>N.enabled),[s]),S=b.useMemo(()=>Array.from(new Set(k.map(N=>N.country))).sort(),[k]),E=b.useMemo(()=>Array.from(new Set(k.map(N=>N.language))).sort(),[k]),j=b.useMemo(()=>{const N=h.toLowerCase();let M=k.filter(_=>!(y&&!i.includes(_.id)||o.genre.length&&!o.genre.some(C=>_.genres.includes(C))||o.decade.length&&!o.decade.some(C=>_.decades.includes(C))||o.country.length&&!o.country.includes(_.country)||o.language.length&&!o.language.includes(_.language)||o.format.length&&!o.format.some(C=>{var R;return(R=_.formats[C])==null?void 0:R.available})||N&&!`${_.title} ${_.genres.join(" ")} ${_.cast.join(" ")} ${_.country} ${_.decades.join(" ")} ${_.years}`.toLowerCase().includes(N)));switch(u){case"az":M.sort((_,C)=>_.title.localeCompare(C.title));break;case"newest":M.sort((_,C)=>C.createdAt-_.createdAt);break;case"price-asc":M.sort((_,C)=>_.formats.digital.price-C.formats.digital.price);break;case"price-desc":M.sort((_,C)=>C.formats.digital.price-_.formats.digital.price);break;default:M.sort((_,C)=>C.reviewCount+(C.bestSeller?1e3:0)-(_.reviewCount+(_.bestSeller?1e3:0)))}return M},[k,o,u,h,y,i]);b.useEffect(()=>{v(Yo)},[o,u,h]);const $=j.slice(0,p),I=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(Dd,{size:16})," Filters"]}),l.jsx("button",{onClick:()=>c({genre:[],decade:[],country:[],language:[],format:[]}),className:"za-focus text-xs text-[#70768F] hover:text-white",children:"Clear"})]}),l.jsx(Xn,{title:"Format",children:["digital","usb"].map(N=>l.jsx(Qn,{label:N==="digital"?"Digital":"USB",checked:o.format.includes(N),onChange:()=>c(M=>({...M,format:M.format.includes(N)?M.format.filter(_=>_!==N):[...M.format,N]}))},N))}),l.jsx(Xn,{title:"Genre",children:ni.map(N=>l.jsx(Qn,{label:N,checked:o.genre.includes(N),onChange:()=>c(M=>({...M,genre:M.genre.includes(N)?M.genre.filter(_=>_!==N):[...M.genre,N]}))},N))}),l.jsx(Xn,{title:"Decade",children:mu.map(N=>l.jsx(Qn,{label:N,checked:o.decade.includes(N),onChange:()=>c(M=>({...M,decade:M.decade.includes(N)?M.decade.filter(_=>_!==N):[...M.decade,N]}))},N))}),l.jsx(Xn,{title:"Country",defaultOpen:!1,children:S.map(N=>l.jsx(Qn,{label:N,checked:o.country.includes(N),onChange:()=>c(M=>({...M,country:M.country.includes(N)?M.country.filter(_=>_!==N):[...M.country,N]}))},N))}),l.jsx(Xn,{title:"Language",defaultOpen:!1,children:E.map(N=>l.jsx(Qn,{label:N,checked:o.language.includes(N),onChange:()=>c(M=>({...M,language:M.language.includes(N)?M.language.filter(_=>_!==N):[...M.language,N]}))},N))})]});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(Ir,{size:12}),l.jsx("span",{className:"text-white/60",children:y?"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:y?"My Wishlist":"All Collections"}),l.jsxs("button",{onClick:()=>w(!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(Dd,{size:14})," Filter"]})]}),l.jsxs("div",{className:"flex gap-8",children:[l.jsx("div",{className:"hidden lg:block",children:I}),g&&l.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>w(!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:()=>w(!1),className:"za-focus p-1",children:l.jsx(jt,{size:18,className:"text-[#A7ABC0]"})})]}),I,l.jsxs("button",{onClick:()=>w(!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 ",j.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(Ds,{size:15,className:"text-[#70768F] shrink-0"}),l.jsx("input",{value:h,onChange:N=>f(N.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:[j.length," results"]}),l.jsxs("select",{value:u,onChange:N=>d(N.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"})]})]})]}),j.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(eg,{items:$,onOpen:N=>e("detail",{slug:N}),onQuickView:r,onShowAddMenu:n}),p<j.length&&l.jsx("div",{className:"text-center mt-8",children:l.jsxs("button",{onClick:()=>v(N=>N+Yo),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 (",j.length-p," remaining)"]})})]})]})]})]})}function jr({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 tg({product:e,format:t,setFormat:r,saleOn:n=!1}){const s=["digital","usb"].filter(a=>e.formats[a].available),i=s.indexOf(t);return l.jsxs("div",{className:`relative bg-white/5 rounded-lg p-0.5 grid gap-0.5 ${s.length===2?"grid-cols-2":"grid-cols-1"}`,children:[s.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(${i*100}%)`,left:2}}),s.map(a=>{const o=t===a;return l.jsxs("button",{onClick:()=>r(a),className:`za-focus relative z-10 rounded-md px-3 py-2.5 text-left transition-colors ${o&&s.length===2?"text-white":""} ${o&&s.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-1",children:[a==="digital"?l.jsx(Vr,{size:11}):l.jsx(yr,{size:11}),a==="digital"?"Digital":"USB"]}),l.jsx("p",{className:"za-display text-sm",children:l.jsx(Ks,{original:n?Ze(e,a):e.formats[a].price,onSale:n,salePrice:n?e.formats[a].price:void 0,size:"text-sm",onColoredBg:o&&s.length===2})})]},a)})]})}function zk({format:e}){const t=e==="digital"?[{icon:ka,title:"Order Placed",desc:"Payoneer payment link emailed to you."},{icon:Sa,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:xr,title:"Access Sent",desc:"Your download link arrives by email."},{icon:Bt,title:"Delivered",desc:"Watch anytime."}]:[{icon:ka,title:"Order Placed",desc:"Payoneer payment link emailed to you."},{icon:Sa,title:"Payment Confirmed",desc:"Admin verifies your payment."},{icon:qr,title:"USB Shipped",desc:"Tracking number added to your order."},{icon:Bt,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 Ks({original:e,onSale:t,salePrice:r,size:n="text-lg",className:s="",onColoredBg:i=!1}){if(!t)return l.jsxs("span",{className:`${n} ${s}`,children:["$",e.toFixed(2)]});const a=i?"text-white/70":"text-[#70768F]",o=i?"text-white":"text-purple-300";return l.jsxs("span",{className:`inline-flex items-center gap-1.5 ${s}`,children:[l.jsxs("span",{className:`${a} line-through text-[0.65em] whitespace-nowrap`,children:["$",e.toFixed(2)]}),l.jsxs("span",{className:`${n} ${o} font-bold whitespace-nowrap`,children:["$",(r??e).toFixed(2)]})]})}function $k({slug:e,title:t,onNav:r}){const n=ck(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(xm,{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(Vl,{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 · ",uk(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(Ir,{size:15})]})]}):null}function Ik({slug:e,onNav:t,onShowAddMenu:r,onQuickView:n}){const s=Ue(),i=co(),{products:a,wishlist:o,toggleWishlist:c,loaded:u}=s,d=a.find(U=>U.slug===e),h=wr(s.settings.saleEndsAt),[f,p]=b.useState(d!=null&&d.formats.digital.available?"digital":"usb"),[v,g]=b.useState(""),w=b.useRef(null),[y,m]=b.useState(0),[x,k]=b.useState([]),[S,E]=b.useState(""),[j,$]=b.useState(5),[I,N]=b.useState(""),[M,_]=b.useState(""),[C,R]=b.useState("idle"),[O,L]=b.useState("");b.useEffect(()=>{if(!d){k([]);return}Z.from("reviews").select("*").eq("product_id",d.id).order("created_at",{ascending:!1}).limit(10).then(({data:U})=>k(U||[])).catch(()=>k([]))},[d==null?void 0:d.id]);const q=async()=>{if(S.trim()){R("verifying"),L("");try{const{data:U,error:V}=await Z.rpc("can_review",{p_email:S.trim(),p_product_id:d.id});if(V)throw V;U?(R("verified"),_(S.trim().split("@")[0]),L("")):(R("error"),L("No paid order found for this email and product. Make sure you use the email you placed the order with."))}catch{R("error"),L("Could not verify. Try again later.")}}},T=async()=>{if(!(!I.trim()||j<1)){R("submitting"),L("");try{const{data:U,error:V}=await Z.rpc("submit_review",{p_product_id:d.id,p_author:M.trim()||S.trim().split("@")[0],p_rating:j,p_text:I.trim(),p_email:S.trim()});if(V)throw V;U.error?(R("error"),L(U.error)):(R("success"),L("Review submitted! Thank you."),N(""),$(5),setTimeout(()=>{R("idle"),L(""),E("")},3e3))}catch{R("error"),L("Could not submit review. Try again.")}}},A=()=>{R("idle"),L(""),E(""),N(""),_(""),$(5)},z=b.useMemo(()=>d?a.filter(U=>U.enabled&&U.id!==d.id&&U.genres.some(V=>d.genres.includes(V))).slice(0,4):[],[a,d]);if(Un({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:Dr},offers:(()=>{const U=[...d.formats.digital.available?[{"@type":"Offer",url:`${$e}/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:`${$e}/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"}}}]:[]],V=U.map(At=>Number(At.price));return{"@type":"AggregateOffer",priceCurrency:"USD",lowPrice:Math.min(...V).toFixed(2),highPrice:Math.max(...V).toFixed(2),offerCount:U.length,offers:U}})()},{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:$e},{"@type":"ListItem",position:2,name:d.genres[0],item:`${$e}/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:f==="digital"?"After payment is confirmed, a download link is emailed to you.":"The USB ships to your delivery address; you'll get a tracking number by email once it's on its way."}},{"@type":"Question",name:"What's the video quality?",acceptedAnswer:{"@type":"Answer",text:d.quality}},{"@type":"Question",name:"What can I play this on?",acceptedAnswer:{"@type":"Answer",text:d.compatibility}},{"@type":"Question",name:"Do you accept returns?",acceptedAnswer:{"@type":"Answer",text:"Digital products aren't refundable once the download link is sent. USB items can be replaced if damaged in transit."}}]}]}:null}),!d)return u?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 K=[`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),Y={digital:[{icon:xr,text:"Instant access — download link sent to your email"},{icon:yx,text:"Watch on any device: computer, tablet, phone, smart TV"},{icon:Ea,text:"No physical storage needed — your library lives in the cloud"},{icon:px,text:`Best value at $${d.formats.digital.price.toFixed(2)}`}],usb:[{icon:yr,text:"Plug & play — works in any TV, laptop, or media player with a USB port"},{icon:hu,text:"Physical backup — your collection can't be lost or deleted"},{icon:_x,text:"Beautiful shelf display for the dedicated collector"},{icon:qr,text:"Tracked worldwide shipping with replacement guarantee"}]},Tt=[{q:"How will I receive this?",a:f==="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(Ir,{size:12}),l.jsx("button",{onClick:()=>t("listing",{genre:d.genres[0]}),className:"za-focus hover:text-white",children:d.genres[0]}),l.jsx(Ir,{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(Ir,{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(Kr,{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(Hl,{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(Ea,{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(Da,{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(tg,{product:d,format:f,setFormat:p,saleOn:h}),l.jsx("div",{className:"flex items-center gap-2 mt-3 text-[11px] text-[#70768F]",children:f==="digital"?l.jsxs(l.Fragment,{children:[l.jsx(xr,{size:12})," Email access after payment"]}):l.jsxs(l.Fragment,{children:[l.jsx(qr,{size:12})," Worldwide shipping, tracked"]})}),l.jsxs("button",{onClick:U=>{if(!d.formats[f].available)return;const V=s.addToCart(d,f);if(!V.ok){g(V.error),clearTimeout(w.current),w.current=setTimeout(()=>g(""),4e3);return}i(U.currentTarget,Ji(d)),g(`Added "${d.title}" (${f==="digital"?"Digital":"USB"}) to cart`),clearTimeout(w.current),w.current=setTimeout(()=>g(""),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(St,{size:15})," Add to Cart — $",d.formats[f].price.toFixed(2)]}),l.jsxs("button",{onClick:()=>c(d.id),className:"za-focus w-full border border-[rgba(255,255,255,0.10)] rounded-[13px] py-2.5 text-sm mt-2 flex items-center justify-center gap-2 text-[#A7ABC0] hover:text-white transition-colors",children:[l.jsx(On,{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(jr,{label:"Years",value:d.years}),l.jsx(jr,{label:"Genre",value:d.genres.join(", ")}),l.jsx(jr,{label:"Country",value:d.country}),l.jsx(jr,{label:"Language",value:d.language}),l.jsx(jr,{label:"Seasons",value:d.seasons}),l.jsx(jr,{label:"Episodes",value:d.episodes||null}),l.jsx(jr,{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(Ca,{size:16,className:"text-purple-400"})," Cast"]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((U,V)=>l.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:U},V)),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(Hl,{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(Ca,{size:13,className:"text-purple-400"})," Cast"]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.cast.slice(0,10).map((U,V)=>l.jsx("span",{className:"text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1.5 text-[#A7ABC0]",children:U},V)),d.cast.length>10&&l.jsxs("span",{className:"text-xs text-[#70768F] self-center",children:["+",d.cast.length-10," more"]})]})]})]})]}),K.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(en,{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:K.map((U,V)=>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:V+1}),l.jsx("p",{className:"text-sm text-[#A7ABC0] leading-relaxed",children:U})]},V))})]}),l.jsxs("div",{className:"mt-14",children:[l.jsx(en,{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(Vr,{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:[l.jsx(Ks,{original:h?Ze(d,"digital"):d.formats.digital.price,onSale:h,salePrice:h?d.formats.digital.price:void 0,size:"text-sm",className:"text-[#70768F]"})," · Google Drive download link emailed after payment is confirmed."]}),l.jsx("ul",{className:"flex flex-col gap-2",children:Y.digital.map((U,V)=>l.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[l.jsx(Bt,{size:14,className:"text-purple-400 shrink-0 mt-0.5"}),l.jsx("span",{children:U.text})]},V))}),l.jsxs("button",{onClick:U=>{if(!d.formats.digital.available)return;const V=s.addToCart(d,"digital");if(!V.ok){g(V.error),clearTimeout(w.current),w.current=setTimeout(()=>g(""),4e3);return}i(U.currentTarget,Ji(d)),g(`Added "${d.title}" (Digital) to cart`),clearTimeout(w.current),w.current=setTimeout(()=>g(""),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(St,{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(yr,{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:[l.jsx(Ks,{original:h?Ze(d,"usb"):d.formats.usb.price,onSale:h,salePrice:h?d.formats.usb.price:void 0,size:"text-sm",className:"text-[#70768F]"})," · Physical USB drive shipped to your door, worldwide."]}),l.jsx("ul",{className:"flex flex-col gap-2",children:Y.usb.map((U,V)=>l.jsxs("li",{className:"flex items-start gap-2 text-sm text-[#A7ABC0]",children:[l.jsx(Bt,{size:14,className:"text-blue-400 shrink-0 mt-0.5"}),l.jsx("span",{children:U.text})]},V))}),l.jsxs("button",{onClick:U=>{d.formats.usb.available&&(i(U.currentTarget,Ji(d)),s.addToCart(d,"usb"),g(`Added "${d.title}" (USB) to cart`),clearTimeout(w.current),w.current=setTimeout(()=>g(""),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(St,{size:14})," Buy USB — $",d.formats.usb.price.toFixed(2)]})]})]})]}),l.jsxs("div",{className:"mt-14",children:[l.jsx(en,{eyebrow:"How It Works",title:"Delivery Timeline"}),l.jsx(zk,{format:f})]}),l.jsx($k,{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:Tt.map((U,V)=>l.jsxs("div",{className:"py-4",children:[l.jsxs("button",{onClick:()=>m(y===V?-1:V),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(so,{size:16,className:`text-[#70768F] transition-transform ${y===V?"rotate-180":""}`})]}),y===V&&l.jsx("p",{className:"text-sm text-[#A7ABC0] mt-2.5 leading-relaxed pr-6",children:U.a})]},V))})]}),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",x.length),x.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(en,{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:x.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(Da,{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(en,{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."}),C==="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(Bt,{size:16})," ",O]}):C==="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:A,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:M,onChange:U=>_(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:()=>$(U),className:"za-focus p-0.5",children:l.jsx(fu,{size:22,className:U<=j?"text-[#FFB800] fill-[#FFB800]":"text-[#70768F]"})},U))}),l.jsx("textarea",{value:I,onChange:U=>N(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:T,disabled:C==="submitting"||!I.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:[C==="submitting"?l.jsx(vr,{size:14,className:"animate-spin"}):l.jsx(Sx,{size:14}),C==="submitting"?"Submitting...":"Submit Review"]}),O&&l.jsx("span",{className:"text-xs text-red-400",children:O})]})]}):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:S,onChange:U=>E(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:q,disabled:C==="verifying"||!S.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:[C==="verifying"?l.jsx(vr,{size:14,className:"animate-spin"}):l.jsx(Bt,{size:14}),C==="verifying"?"Checking...":"Verify"]})]}),O&&l.jsx("p",{className:"text-xs text-red-400 mt-2",children:O}),C==="error"&&l.jsx("button",{onClick:()=>R("idle"),className:"text-xs text-purple-400 mt-1 hover:text-purple-300",children:"Try again"})]})]}),z.length>0&&l.jsxs("div",{className:"mt-14",children:[l.jsx(en,{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(eg,{items:z,onOpen:U=>t("detail",{slug:U}),onQuickView:n,onShowAddMenu:r})]}),l.jsx(oc,{message:v})]})}function Ah({open:e,onClose:t,onCheckout:r}){const{cartItems:n,removeFromCart:s,products:i,settings:a}=Ue(),o=b.useRef(null);xu(o,()=>e&&t());const c=wr(a.saleEndsAt),u=n.map(v=>({...v,product:i.find(g=>g.id===v.productId)})).filter(v=>v.product),d=u.reduce((v,g)=>v+g.price,0),h=c?u.reduce((v,g)=>v+Ze(g.product,g.format),0):0,f=c?u.reduce((v,g)=>v+(Ze(g.product,g.format)-g.price),0):0,p=h>0?Math.round(f/h*100):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:o,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(St,{size:18,className:"text-purple-400"})," Your Cart"]}),l.jsx("button",{onClick:t,className:"za-focus p-1",children:l.jsx(jt,{size:18,className:"text-[#A7ABC0]"})})]}),u.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:[u.map((v,g)=>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(Kr,{product:v.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:v.product.title}),l.jsx("p",{className:"text-xs text-[#70768F] capitalize",children:v.format}),c?l.jsxs("p",{className:"za-display text-sm mt-1 flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-[#70768F] line-through text-xs",children:["$",Ze(v.product,v.format).toFixed(2)]}),l.jsxs("span",{className:"text-purple-400",children:["$",v.price.toFixed(2)]}),l.jsxs("span",{className:"text-[10px] font-bold text-[#42D392] bg-[#42D392]/10 border border-[#42D392]/30 rounded-full px-1.5 py-0.5",children:["−",Math.round((v.format==="digital"?gu:yu)*100),"%"]})]}):l.jsxs("p",{className:"za-display text-sm text-purple-400 mt-1",children:["$",v.price.toFixed(2)]})]}),l.jsxs("button",{onClick:()=>s(g),className:"za-focus text-[#70768F] hover:text-red-400 flex items-center gap-1 text-xs",children:[l.jsx(jt,{size:12})," Remove"]})]},g)),f>0&&l.jsxs("div",{className:"flex items-center justify-between text-sm text-[#42D392]",children:[l.jsx("span",{children:"You're saving"}),l.jsxs("span",{children:["$",f.toFixed(2)," (",p,"%)"]})]}),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:["$",d.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(ym,{size:15})]})]})]})]})}function Rh({target:e,onClose:t,showToast:r}){const n=Ue(),s=co(),[i,a]=b.useState(null);if(!e)return null;const{product:o,element:c}=e,u=wr(n.settings.saleEndsAt),d=()=>{if(!i||!o.formats[i].available)return;const h=n.addToCart(o,i);if(!h.ok){r(h.error),t();return}s(c,Ji(o)),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:h=>h.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(jt,{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(Vr,{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.jsx("span",{className:"za-display shrink-0 text-right",children:l.jsx(Ks,{original:u?Ze(o,"digital"):o.formats.digital.price,onSale:u,salePrice:u?o.formats.digital.price:void 0})})]}),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(yr,{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.jsx("span",{className:"za-display shrink-0 text-right",children:l.jsx(Ks,{original:u?Ze(o,"usb"):o.formats.usb.price,onSale:u,salePrice:u?o.formats.usb.price:void 0,className:"text-blue-400"})})]})]}),l.jsx("div",{className:"p-4 pt-0",children:l.jsxs("button",{onClick:d,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(St,{size:15})," Add to Cart ",i?`— $${o.formats[i].price.toFixed(2)}`:""]})})]})]})}function Ph({product:e,onClose:t,onOpenFull:r,onShowAddMenu:n}){const{wishlist:s,toggleWishlist:i,settings:a}=Ue(),[o,c]=b.useState("digital");if(!e)return null;const u=wr(a.saleEndsAt);return 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(jt,{size:16,className:"text-white"})}),l.jsx(Kr,{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(Da,{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(tg,{product:e,format:o,setFormat:c,saleOn:u})}),l.jsxs("button",{onClick:d=>{n(e,d.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(St,{size:14})," Add to Cart — $",e.formats[o].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(On,{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"})]})]})]})]})}function oc({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(Bt,{size:14,className:"text-purple-400"})," ",l.jsx("span",{className:"text-white",children:e})]})}):null}const Dk=[["USD","USD — US Dollar"],["GBP","GBP — British Pound"],["EUR","EUR — Euro"]];function Lk({onNav:e}){const{cartItems:t,products:r,settings:n,placeOrder:s,stripeCheckout:i,removeFromCart:a}=Ue();Un({title:"Checkout",path:"/checkout",noindex:!0});const o=t.map(A=>({...A,product:r.find(z=>z.id===A.productId)})).filter(A=>A.product),c=o.some(A=>A.format==="usb"),u=o.reduce((A,z)=>A+z.price,0),d=wr(n.saleEndsAt),h=d?o.reduce((A,z)=>A+Ze(z.product,z.format),0):0,f=d?o.reduce((A,z)=>A+(Ze(z.product,z.format)-z.price),0):0,p=h>0?Math.round(f/h*100):0,v={AU:40,NZ:40},g=19.99,[w,y]=b.useState({name:"",email:"",phone:"",billing:"",shipping:"",city:"",postalCode:"",country:"",currency:"USD",notes:"",coupon:""}),[m,x]=b.useState({}),[k,S]=b.useState(!1),E=A=>z=>y(K=>({...K,[A]:z.target.value})),j=b.useRef(null),$=c?v[w.country]||g:0,I=w.coupon.trim().toUpperCase()==="ARCHIVE10",[N,M]=b.useState({status:"idle",discount:0,error:null});b.useEffect(()=>{const A=w.coupon.trim();if(!A||I||!/^\S+@\S+\.\S+$/.test(w.email)){M({status:"idle",discount:0,error:null});return}M({status:"checking",discount:0,error:null});const z=setTimeout(()=>{fetch("/api/validate-coupon",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"check",code:A,email:w.email.trim(),itemCount:o.length})}).then(K=>K.json()).then(K=>M(K.valid?{status:"valid",discount:K.discount,error:null}:{status:"invalid",discount:0,error:K.error})).catch(()=>M({status:"invalid",discount:0,error:"Couldn't check this code — try again."}))},500);return()=>clearTimeout(z)},[w.coupon,w.email,I,o.length]);const _=I?u*.1:N.status==="valid"?N.discount:0,C=u+$-_,R=()=>{var z;const A={};return w.name.trim()||(A.name="Please enter your full name."),/^\S+@\S+\.\S+$/.test(w.email)||(A.email="Please enter a valid email address."),c&&!w.shipping.trim()&&(A.shipping="A shipping address is required for USB orders."),c&&!w.city.trim()&&(A.city="City is required."),c&&!w.postalCode.trim()&&(A.postalCode="Postal code is required."),c&&!w.country&&(A.country="Please select your country for shipping calculation."),x(A),Object.keys(A).length>0&&((z=j.current)==null||z.scrollIntoView({behavior:"smooth",block:"start"})),Object.keys(A).length===0};function O(){const A=c?`${w.shipping.trim()}, ${w.city.trim()}, ${w.postalCode.trim()}, ${w.country}`:"";return{id:Vm(),number:$1(),createdAt:Date.now(),status:"pending_payment",customer:{name:w.name.trim(),email:w.email.trim(),phone:w.phone.trim()},billing:A,shipping:A,country:w.country||null,currency:w.currency,notes:w.notes.trim(),coupon:I?"ARCHIVE10":N.status==="valid"?w.coupon.trim().toUpperCase():null,items:o.map(z=>({productId:z.product.id,title:z.product.displayTitle,format:z.format,price:z.price})),subtotal:u,shippingCost:$,discount:_,total:C,tracking:null,accessLinks:{}}}const[L,q]=b.useState(!1),T=async()=>{if(!R())return;q(!0);const A={...O(),status:"pending_payment",paymentMethod:"stripe"};try{const z=await i(A);window.location.href=z}catch(z){q(!1),alert("Payment couldn't be initiated: "+(z.message||"try again"))}};return o.length===0?l.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-20 text-center",children:[l.jsx(St,{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(St,{size:16,className:"text-purple-400"})," Order Summary"]}),l.jsx("div",{className:"flex flex-col gap-3",children:o.map((A,z)=>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(Kr,{product:A.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:A.product.title}),l.jsxs("p",{className:"text-xs text-[#70768F] mt-1",children:[A.product.years," · ",A.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:[A.format==="digital"?l.jsx(Vr,{size:11}):l.jsx(yr,{size:11})," ",A.format]}),d?l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-[#70768F] line-through text-xs",children:["$",Ze(A.product,A.format).toFixed(2)]}),l.jsxs("span",{className:"text-purple-400 za-display text-sm",children:["$",A.price.toFixed(2)]}),l.jsxs("span",{className:"text-[10px] font-bold text-[#42D392] bg-[#42D392]/10 border border-[#42D392]/30 rounded-full px-1.5 py-0.5",children:["−",Math.round((A.format==="digital"?gu:yu)*100),"%"]})]}):l.jsxs("span",{className:"text-purple-400 za-display text-sm",children:["$",A.price.toFixed(2)]})]})]}),l.jsx("button",{onClick:()=>{a(z),o.length<=1&&e("home")},className:"text-[#70768F] hover:text-red-400 transition-colors p-1 shrink-0",title:"Remove item",children:l.jsx(jt,{size:14})})]},z))})]}),l.jsxs("div",{ref:j,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:w.name,onChange:E("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:w.email,onChange:E("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:w.phone,onChange:E("phone")})]})]}),c&&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(qr,{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:w.shipping,onChange:E("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:w.city,onChange:E("city")}),l.jsx("input",{className:"za-input",placeholder:"Postal code *",value:w.postalCode,onChange:E("postalCode")})]}),l.jsxs("div",{children:[l.jsxs("select",{className:"za-input",value:w.country,onChange:E("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})]})]})]}),!c&&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(xr,{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:w.currency,onChange:E("currency"),children:Dk.map(([A,z])=>l.jsx("option",{value:A,children:z},A))})]}),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:w.notes,onChange:E("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:w.coupon,onChange:E("coupon")})}),w.coupon&&I&&l.jsx("p",{className:"text-xs -mt-3 mb-4 text-[#42D392]",children:"ARCHIVE10 applied — 10% off."}),w.coupon&&!I&&N.status==="checking"&&l.jsx("p",{className:"text-xs -mt-3 mb-4 text-[#70768F]",children:"Checking code…"}),w.coupon&&!I&&N.status==="valid"&&l.jsxs("p",{className:"text-xs -mt-3 mb-4 text-[#42D392]",children:["Code applied — $",N.discount.toFixed(2)," off."]}),w.coupon&&!I&&N.status==="invalid"&&l.jsx("p",{className:"text-xs -mt-3 mb-4 text-[#FFB800]",children:N.error||"This code isn't valid."}),l.jsxs("div",{className:"flex flex-col gap-1.5 text-sm text-[#A7ABC0]",children:[f>0&&l.jsxs("div",{className:"flex justify-between text-[#42D392]",children:[l.jsxs("span",{children:["Promotion savings (",p,"% off)"]}),l.jsxs("span",{children:["−$",f.toFixed(2)]})]}),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)]})]}),c&&l.jsxs("div",{className:"flex justify-between",children:[l.jsx("span",{children:"Shipping"}),l.jsxs("span",{className:"text-white",children:["$",$.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:["$",C.toFixed(2)]})]})]})]})]}),l.jsxs("div",{className:"hidden sm:block mt-4",children:[l.jsxs("button",{onClick:T,disabled:L,className:"za-focus w-full bg-[#635BFF] hover:bg-[#5851E0] text-white rounded-[13px] py-3.5 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60 transition-all shadow-[0_4px_14px_rgba(99,91,255,0.3)]",children:[L?l.jsx(vr,{size:15,className:"za-spin"}):l.jsx(_a,{size:15})," Pay with Card — $",C.toFixed(2)]}),l.jsx("div",{className:"flex items-center justify-center gap-2.5 mt-3",children:l.jsx(zh,{})}),l.jsxs("p",{className:"text-[11px] text-[#70768F] text-center mt-3 flex items-center justify-center gap-1",children:[l.jsx(hu,{size:11})," Secure card checkout"]})]})]})]}),l.jsxs("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:T,disabled:L,className:"za-focus w-full bg-[#635BFF] text-white rounded-[13px] py-3 text-sm za-display flex items-center justify-center gap-2 disabled:opacity-60 shadow-[0_4px_14px_rgba(99,91,255,0.3)]",children:[L?l.jsx(vr,{size:15,className:"za-spin"}):l.jsx(_a,{size:14})," Pay with Card — $",C.toFixed(2)]}),l.jsx("div",{className:"flex items-center justify-center gap-2.5 mt-2.5",children:l.jsx(zh,{})})]})]})}function Uk({orderId:e,email:t,onNav:r}){const{settings:n,lookupOrder:s}=Ue(),[i,a]=b.useState(null),[o,c]=b.useState(!0),[u,d]=b.useState(!1);if(Un({title:"Order Confirmation",path:`/order-confirmation/${e}`,noindex:!0}),b.useEffect(()=>{let p=!0;return(async()=>{const v=await s(e,t);p&&(a(v),c(!1))})(),()=>{p=!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(vr,{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(p=>p.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(Bt,{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(ka,{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(Sa,{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(wm,{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(du,{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(xr,{size:16,className:"text-[#42D392]"})," Your Digital Download"]}),l.jsx("div",{className:"flex flex-col gap-2",children:f.map(p=>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:p.title}),l.jsx("a",{href:i.accessLinks[p.productId],target:"_blank",rel:"noreferrer",className:"text-purple-400 break-all underline",children:i.accessLinks[p.productId]})]},p.productId))})]}),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((p,v)=>l.jsxs("div",{className:"flex justify-between text-sm py-1.5",children:[l.jsxs("span",{className:"text-[#A7ABC0]",children:[p.title," ",l.jsxs("span",{className:"capitalize",children:["(",p.format,")"]})]}),l.jsxs("span",{className:"text-white",children:["$",p.price.toFixed(2)]})]},v)),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 Fk({onNav:e}){const{myOrders:t,settings:r,refreshMyOrders:n}=Ue(),[s,i]=b.useState(!0);return Un({title:"My Orders",path:"/my-orders",noindex:!0}),b.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(vr,{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(fx,{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=Nh[a.status]||Nh.pending_payment,c=a.status==="access_granted"||a.status==="completed",u=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."})}),!c&&u.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(uu,{size:13})," Your digital download is pending approval."]}),c&&u.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(xr,{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(qr,{size:13,className:"text-purple-400"})," Tracking number: ",l.jsx("span",{className:"za-display text-white",children:a.tracking})]})]},a.id)})})]})}const Oh={contact:{title:"Contact Us",icon:xr,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:vm,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:du,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:hu,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:gx,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:qr,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:yr,intro:"How our USB flash drive collections work: what's included, shipping, and quality.",devices:[{icon:Ca,label:"Smart TVs"},{icon:vx,label:"PC & Mac"},{icon:hx,label:"Car stereos"},{icon:xm,label:"Game consoles"},{icon:bx,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:Ds,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:Vr,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."}]}},Bk={digitalCollections:"digitalAccess"};function Mk({pageKey:e,onNav:t}){const r=Bk[e]||e,n=Oh[r]||Oh.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 Un({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(Ir,{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(qk,{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(vm,{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 qk({q:e,a:t}){const[r,n]=b.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(so,{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 Wk(){ak();const e=Ue(),[t,r]=b.useState("dark"),n=gt(),s=um(),{view:i,params:a}=b.useMemo(()=>kk(n.pathname,n.search),[n.pathname,n.search]),[o,c]=b.useState(null),[u,d]=b.useState(!1),[h,f]=b.useState(!1),[p,v]=b.useState(""),g=b.useRef(null),[w,y]=b.useState(null),m=(S,E={})=>{s(bk(S,E)),window.scrollTo({top:0,behavior:"smooth"})},x=S=>{v(S),clearTimeout(g.current),g.current=setTimeout(()=>v(""),2200)},k=(S,E)=>y({product:S,element:E});return i==="home"||i==="designlab"?l.jsxs(Ch,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:[l.jsx(Th,{}),l.jsx(b.Suspense,{fallback:l.jsx("div",{className:"min-h-[80vh]"}),children:l.jsx(dk,{onNav:m,onQuickView:c,onShowAddMenu:k})}),l.jsx(Ph,{product:o,onClose:()=>c(null),onOpenFull:S=>m("detail",{slug:S}),onShowAddMenu:k}),l.jsx(Rh,{target:w,onClose:()=>y(null),showToast:x}),l.jsx(Ah,{open:u,onClose:()=>d(!1),onCheckout:()=>m("checkout")}),l.jsx(oc,{message:p})]}):l.jsx(Ch,{onCartClick:()=>d(!0),cartCount:e.cartItems.length,children:l.jsxs("div",{className:"za-root min-h-screen",style:Sk[t],children:[l.jsx(Th,{}),l.jsx(Rk,{theme:t,setTheme:r,onNav:m,currentView:i,onWishlistOpen:()=>f(!0)}),l.jsxs("div",{className:"za-fade-view min-h-[60vh]",children:[i==="listing"&&l.jsx(Ok,{onNav:m,initialFilters:a,onQuickView:c,onShowAddMenu:k}),i==="detail"&&l.jsx(Ik,{slug:a.slug,onNav:m,onShowAddMenu:k,onQuickView:c}),i==="checkout"&&l.jsx(Lk,{onNav:m}),i==="confirmation"&&l.jsx(Uk,{orderId:a.orderId,email:a.email,onNav:m}),i==="myorders"&&l.jsx(Fk,{onNav:m}),l.jsx(Ri,{children:l.jsxs(b.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:[i==="blog"&&l.jsx(hk,{onNav:m,params:a}),i==="blog-article"&&l.jsx(fk,{slug:a.slug,onNav:m}),i==="blog-category"&&l.jsx(pk,{slug:a.slug,onNav:m}),i==="blog-tag"&&l.jsx(mk,{slug:a.slug,onNav:m}),i==="blog-author"&&l.jsx(gk,{slug:a.slug,onNav:m})]})}),i==="trust"&&l.jsx(Mk,{pageKey:a.page,onNav:m}),l.jsx(Ri,{children:l.jsxs(b.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:[i==="quiz-hub"&&l.jsx(xk,{onNav:m}),i==="quiz-play"&&l.jsx(wk,{slug:a.slug,onNav:m})]})}),i==="admin"&&l.jsx(Ri,{children:l.jsx(b.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:l.jsx(K1,{children:l.jsx(vk,{})})})}),l.jsx(Ri,{children:l.jsx(b.Suspense,{fallback:l.jsx("div",{className:"min-h-[60vh]"}),children:i==="notfound"&&l.jsx(yk,{onNav:m})})})]},i+(a.slug||"")+(a.orderId||"")),l.jsx(Pk,{onNav:m}),l.jsx(Ph,{product:o,onClose:()=>c(null),onOpenFull:S=>m("detail",{slug:S}),onShowAddMenu:k}),l.jsx(Rh,{target:w,onClose:()=>y(null),showToast:x}),l.jsx(rk,{open:h,onClose:()=>f(!1),onNav:m}),l.jsx(Ah,{open:u,onClose:()=>d(!1),onCheckout:()=>m("checkout")}),l.jsx(oc,{message:p})]})})}function zh(){const e={display:"inline-flex",alignItems:"center",justifyContent:"center",height:28,borderRadius:4,background:"white",padding:"2px 6px",marginRight:4};return l.jsxs("span",{style:{display:"inline-flex",gap:4,alignItems:"center"},children:[l.jsx("span",{style:e,children:l.jsx("img",{src:"/logos/visa.svg",alt:"Visa",style:{height:18,width:"auto",objectFit:"contain"}})}),l.jsx("span",{style:e,children:l.jsx("img",{src:"/logos/mastercard.svg",alt:"Mastercard",style:{height:20,width:"auto",objectFit:"contain"}})}),l.jsx("span",{style:e,children:l.jsx("img",{src:"/logos/amex.svg",alt:"Amex",style:{height:18,width:"auto",objectFit:"contain"}})}),l.jsx("span",{style:e,children:l.jsx("img",{src:"/logos/applepay.svg",alt:"Apple Pay",style:{height:18,width:"auto",objectFit:"contain"}})}),l.jsx("span",{style:e,children:l.jsx("img",{src:"/logos/paypal.svg",alt:"PayPal",style:{height:16,width:"auto",objectFit:"contain"}})})]})}function Hk(){return l.jsx(W1,{children:l.jsx(Wk,{})})}Qo.createRoot(document.getElementById("root")).render(l.jsx(vg.StrictMode,{children:l.jsx(Qv,{children:l.jsx(Hk,{})})}));export{Ld as $,ym as A,$e as B,uu as C,Vr as D,mx as E,Hl as F,yx as G,On as H,Gk as I,rg as J,Vk as K,vx as L,wx as M,vr as N,ok as O,_x as P,Bt as Q,X as R,Ds as S,Vl as T,yu as U,wm as V,rk as W,jt as X,Z as Y,ka as Z,du as _,fu as a,fx as a0,px as a1,Nh as a2,Jk as a3,Kr as a4,z1 as a5,gx as a6,Sa as a7,qr as a8,Yk as a9,Qk as aa,Vs as ab,ni as ac,lk as ad,uk as ae,ck as af,St as b,H as c,yr as d,Ea as e,hu as f,Ca as g,hx as h,wr as i,l as j,xm as k,Ir as l,gu as m,Ze as n,ja as o,mu as p,_a as q,b as r,vm as s,so as t,Ue as u,xr as v,co as w,Un as x,Ji as y,Kk as z};