Files
Handwerksfreund_Frontend/dist/assets/index-3wIDBhB8.js
T
MarcWieland 8b613ec0bc Init
2026-07-26 23:57:23 +02:00

174 lines
376 KiB
JavaScript

var sf=Object.defineProperty;var of=(t,e,r)=>e in t?sf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var xl=(t,e,r)=>of(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).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)}})();function af(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _c={exports:{}},Si={},kc={exports:{}},I={};/**
* @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 Qn=Symbol.for("react.element"),lf=Symbol.for("react.portal"),uf=Symbol.for("react.fragment"),cf=Symbol.for("react.strict_mode"),hf=Symbol.for("react.profiler"),df=Symbol.for("react.provider"),ff=Symbol.for("react.context"),pf=Symbol.for("react.forward_ref"),gf=Symbol.for("react.suspense"),mf=Symbol.for("react.memo"),yf=Symbol.for("react.lazy"),Cl=Symbol.iterator;function vf(t){return t===null||typeof t!="object"?null:(t=Cl&&t[Cl]||t["@@iterator"],typeof t=="function"?t:null)}var Sc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ec=Object.assign,bc={};function Wr(t,e,r){this.props=t,this.context=e,this.refs=bc,this.updater=r||Sc}Wr.prototype.isReactComponent={};Wr.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Wr.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Tc(){}Tc.prototype=Wr.prototype;function Aa(t,e,r){this.props=t,this.context=e,this.refs=bc,this.updater=r||Sc}var Oa=Aa.prototype=new Tc;Oa.constructor=Aa;Ec(Oa,Wr.prototype);Oa.isPureReactComponent=!0;var Rl=Array.isArray,xc=Object.prototype.hasOwnProperty,ja={current:null},Cc={key:!0,ref:!0,__self:!0,__source:!0};function Rc(t,e,r){var n,s={},i=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)xc.call(e,n)&&!Cc.hasOwnProperty(n)&&(s[n]=e[n]);var a=arguments.length-2;if(a===1)s.children=r;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];s.children=l}if(t&&t.defaultProps)for(n in a=t.defaultProps,a)s[n]===void 0&&(s[n]=a[n]);return{$$typeof:Qn,type:t,key:i,ref:o,props:s,_owner:ja.current}}function wf(t,e){return{$$typeof:Qn,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Pa(t){return typeof t=="object"&&t!==null&&t.$$typeof===Qn}function _f(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Al=/\/+/g;function Vi(t,e){return typeof t=="object"&&t!==null&&t.key!=null?_f(""+t.key):e.toString(36)}function js(t,e,r,n,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Qn:case lf:o=!0}}if(o)return o=t,s=s(o),t=n===""?"."+Vi(o,0):n,Rl(s)?(r="",t!=null&&(r=t.replace(Al,"$&/")+"/"),js(s,e,r,"",function(u){return u})):s!=null&&(Pa(s)&&(s=wf(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Al,"$&/")+"/")+t)),e.push(s)),1;if(o=0,n=n===""?".":n+":",Rl(t))for(var a=0;a<t.length;a++){i=t[a];var l=n+Vi(i,a);o+=js(i,e,r,l,s)}else if(l=vf(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=n+Vi(i,a++),o+=js(i,e,r,l,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ss(t,e,r){if(t==null)return t;var n=[],s=0;return js(t,n,"","",function(i){return e.call(r,i,s++)}),n}function kf(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var ve={current:null},Ps={transition:null},Sf={ReactCurrentDispatcher:ve,ReactCurrentBatchConfig:Ps,ReactCurrentOwner:ja};function Ac(){throw Error("act(...) is not supported in production builds of React.")}I.Children={map:ss,forEach:function(t,e,r){ss(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return ss(t,function(){e++}),e},toArray:function(t){return ss(t,function(e){return e})||[]},only:function(t){if(!Pa(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};I.Component=Wr;I.Fragment=uf;I.Profiler=hf;I.PureComponent=Aa;I.StrictMode=cf;I.Suspense=gf;I.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Sf;I.act=Ac;I.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Ec({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=ja.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)xc.call(e,l)&&!Cc.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:Qn,type:t.type,key:s,ref:i,props:n,_owner:o}};I.createContext=function(t){return t={$$typeof:ff,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:df,_context:t},t.Consumer=t};I.createElement=Rc;I.createFactory=function(t){var e=Rc.bind(null,t);return e.type=t,e};I.createRef=function(){return{current:null}};I.forwardRef=function(t){return{$$typeof:pf,render:t}};I.isValidElement=Pa;I.lazy=function(t){return{$$typeof:yf,_payload:{_status:-1,_result:t},_init:kf}};I.memo=function(t,e){return{$$typeof:mf,type:t,compare:e===void 0?null:e}};I.startTransition=function(t){var e=Ps.transition;Ps.transition={};try{t()}finally{Ps.transition=e}};I.unstable_act=Ac;I.useCallback=function(t,e){return ve.current.useCallback(t,e)};I.useContext=function(t){return ve.current.useContext(t)};I.useDebugValue=function(){};I.useDeferredValue=function(t){return ve.current.useDeferredValue(t)};I.useEffect=function(t,e){return ve.current.useEffect(t,e)};I.useId=function(){return ve.current.useId()};I.useImperativeHandle=function(t,e,r){return ve.current.useImperativeHandle(t,e,r)};I.useInsertionEffect=function(t,e){return ve.current.useInsertionEffect(t,e)};I.useLayoutEffect=function(t,e){return ve.current.useLayoutEffect(t,e)};I.useMemo=function(t,e){return ve.current.useMemo(t,e)};I.useReducer=function(t,e,r){return ve.current.useReducer(t,e,r)};I.useRef=function(t){return ve.current.useRef(t)};I.useState=function(t){return ve.current.useState(t)};I.useSyncExternalStore=function(t,e,r){return ve.current.useSyncExternalStore(t,e,r)};I.useTransition=function(){return ve.current.useTransition()};I.version="18.3.1";kc.exports=I;var pe=kc.exports;const Ef=af(pe);/**
* @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 bf=pe,Tf=Symbol.for("react.element"),xf=Symbol.for("react.fragment"),Cf=Object.prototype.hasOwnProperty,Rf=bf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Af={key:!0,ref:!0,__self:!0,__source:!0};function Oc(t,e,r){var n,s={},i=null,o=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)Cf.call(e,n)&&!Af.hasOwnProperty(n)&&(s[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)s[n]===void 0&&(s[n]=e[n]);return{$$typeof:Tf,type:t,key:i,ref:o,props:s,_owner:Rf.current}}Si.Fragment=xf;Si.jsx=Oc;Si.jsxs=Oc;_c.exports=Si;var y=_c.exports,To={},jc={exports:{}},je={},Pc={exports:{}},Nc={};/**
* @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(t){function e(R,P){var N=R.length;R.push(P);e:for(;0<N;){var J=N-1>>>1,re=R[J];if(0<s(re,P))R[J]=P,R[N]=re,N=J;else break e}}function r(R){return R.length===0?null:R[0]}function n(R){if(R.length===0)return null;var P=R[0],N=R.pop();if(N!==P){R[0]=N;e:for(var J=0,re=R.length,rs=re>>>1;J<rs;){var Ft=2*(J+1)-1,Wi=R[Ft],Ht=Ft+1,ns=R[Ht];if(0>s(Wi,N))Ht<re&&0>s(ns,Wi)?(R[J]=ns,R[Ht]=N,J=Ht):(R[J]=Wi,R[Ft]=N,J=Ft);else if(Ht<re&&0>s(ns,N))R[J]=ns,R[Ht]=N,J=Ht;else break e}}return P}function s(R,P){var N=R.sortIndex-P.sortIndex;return N!==0?N:R.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,d=3,m=!1,v=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(R){for(var P=r(u);P!==null;){if(P.callback===null)n(u);else if(P.startTime<=R)n(u),P.sortIndex=P.expirationTime,e(l,P);else break;P=r(u)}}function _(R){if(w=!1,g(R),!v)if(r(l)!==null)v=!0,Fi(T);else{var P=r(u);P!==null&&Hi(_,P.startTime-R)}}function T(R,P){v=!1,w&&(w=!1,p(O),O=-1),m=!0;var N=d;try{for(g(P),h=r(l);h!==null&&(!(h.expirationTime>P)||R&&!ze());){var J=h.callback;if(typeof J=="function"){h.callback=null,d=h.priorityLevel;var re=J(h.expirationTime<=P);P=t.unstable_now(),typeof re=="function"?h.callback=re:h===r(l)&&n(l),g(P)}else n(l);h=r(l)}if(h!==null)var rs=!0;else{var Ft=r(u);Ft!==null&&Hi(_,Ft.startTime-P),rs=!1}return rs}finally{h=null,d=N,m=!1}}var E=!1,b=null,O=-1,D=5,L=-1;function ze(){return!(t.unstable_now()-L<D)}function Gr(){if(b!==null){var R=t.unstable_now();L=R;var P=!0;try{P=b(!0,R)}finally{P?Jr():(E=!1,b=null)}}else E=!1}var Jr;if(typeof f=="function")Jr=function(){f(Gr)};else if(typeof MessageChannel<"u"){var Tl=new MessageChannel,nf=Tl.port2;Tl.port1.onmessage=Gr,Jr=function(){nf.postMessage(null)}}else Jr=function(){k(Gr,0)};function Fi(R){b=R,E||(E=!0,Jr())}function Hi(R,P){O=k(function(){R(t.unstable_now())},P)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(R){R.callback=null},t.unstable_continueExecution=function(){v||m||(v=!0,Fi(T))},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(R){switch(d){case 1:case 2:case 3:var P=3;break;default:P=d}var N=d;d=P;try{return R()}finally{d=N}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(R,P){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var N=d;d=R;try{return P()}finally{d=N}},t.unstable_scheduleCallback=function(R,P,N){var J=t.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?J+N:J):N=J,R){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=N+re,R={id:c++,callback:P,priorityLevel:R,startTime:N,expirationTime:re,sortIndex:-1},N>J?(R.sortIndex=N,e(u,R),r(l)===null&&R===r(u)&&(w?(p(O),O=-1):w=!0,Hi(_,N-J))):(R.sortIndex=re,e(l,R),v||m||(v=!0,Fi(T))),R},t.unstable_shouldYield=ze,t.unstable_wrapCallback=function(R){var P=d;return function(){var N=d;d=P;try{return R.apply(this,arguments)}finally{d=N}}}})(Nc);Pc.exports=Nc;var Of=Pc.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 jf=pe,Oe=Of;function S(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Ic=new Set,Tn={};function or(t,e){Dr(t,e),Dr(t+"Capture",e)}function Dr(t,e){for(Tn[t]=e,t=0;t<e.length;t++)Ic.add(e[t])}var gt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xo=Object.prototype.hasOwnProperty,Pf=/^[: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]*$/,Ol={},jl={};function Nf(t){return xo.call(jl,t)?!0:xo.call(Ol,t)?!1:Pf.test(t)?jl[t]=!0:(Ol[t]=!0,!1)}function If(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Lf(t,e,r,n){if(e===null||typeof e>"u"||If(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function we(t,e,r,n,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var le={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){le[t]=new we(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];le[e]=new we(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){le[t]=new we(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){le[t]=new we(t,2,!1,t,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(t){le[t]=new we(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){le[t]=new we(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){le[t]=new we(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){le[t]=new we(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){le[t]=new we(t,5,!1,t.toLowerCase(),null,!1,!1)});var Na=/[\-:]([a-z])/g;function Ia(t){return t[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(t){var e=t.replace(Na,Ia);le[e]=new we(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Na,Ia);le[e]=new we(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Na,Ia);le[e]=new we(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){le[t]=new we(t,1,!1,t.toLowerCase(),null,!1,!1)});le.xlinkHref=new we("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){le[t]=new we(t,1,!1,t.toLowerCase(),null,!0,!0)});function La(t,e,r,n){var s=le.hasOwnProperty(e)?le[e]:null;(s!==null?s.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Lf(e,r,s,n)&&(r=null),n||s===null?Nf(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):s.mustUseProperty?t[s.propertyName]=r===null?s.type===3?!1:"":r:(e=s.attributeName,n=s.attributeNamespace,r===null?t.removeAttribute(e):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var wt=jf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,is=Symbol.for("react.element"),mr=Symbol.for("react.portal"),yr=Symbol.for("react.fragment"),$a=Symbol.for("react.strict_mode"),Co=Symbol.for("react.profiler"),Lc=Symbol.for("react.provider"),$c=Symbol.for("react.context"),Da=Symbol.for("react.forward_ref"),Ro=Symbol.for("react.suspense"),Ao=Symbol.for("react.suspense_list"),Ua=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),Dc=Symbol.for("react.offscreen"),Pl=Symbol.iterator;function Qr(t){return t===null||typeof t!="object"?null:(t=Pl&&t[Pl]||t["@@iterator"],typeof t=="function"?t:null)}var K=Object.assign,Ki;function on(t){if(Ki===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Ki=e&&e[1]||""}return`
`+Ki+t}var qi=!1;function Gi(t,e){if(!t||qi)return"";qi=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=n.stack.split(`
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
`+s[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{qi=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?on(t):""}function $f(t){switch(t.tag){case 5:return on(t.type);case 16:return on("Lazy");case 13:return on("Suspense");case 19:return on("SuspenseList");case 0:case 2:case 15:return t=Gi(t.type,!1),t;case 11:return t=Gi(t.type.render,!1),t;case 1:return t=Gi(t.type,!0),t;default:return""}}function Oo(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case yr:return"Fragment";case mr:return"Portal";case Co:return"Profiler";case $a:return"StrictMode";case Ro:return"Suspense";case Ao:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $c:return(t.displayName||"Context")+".Consumer";case Lc:return(t._context.displayName||"Context")+".Provider";case Da:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ua:return e=t.displayName||null,e!==null?e:Oo(t.type)||"Memo";case kt:e=t._payload,t=t._init;try{return Oo(t(e))}catch{}}return null}function Df(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Oo(e);case 8:return e===$a?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Dt(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Uc(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Uf(t){var e=Uc(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function os(t){t._valueTracker||(t._valueTracker=Uf(t))}function Mc(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Uc(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Ws(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function jo(t,e){var r=e.checked;return K({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Nl(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Dt(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function zc(t,e){e=e.checked,e!=null&&La(t,"checked",e,!1)}function Po(t,e){zc(t,e);var r=Dt(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?No(t,e.type,r):e.hasOwnProperty("defaultValue")&&No(t,e.type,Dt(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Il(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function No(t,e,r){(e!=="number"||Ws(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var an=Array.isArray;function Ar(t,e,r,n){if(t=t.options,e){e={};for(var s=0;s<r.length;s++)e["$"+r[s]]=!0;for(r=0;r<t.length;r++)s=e.hasOwnProperty("$"+t[r].value),t[r].selected!==s&&(t[r].selected=s),s&&n&&(t[r].defaultSelected=!0)}else{for(r=""+Dt(r),e=null,s=0;s<t.length;s++){if(t[s].value===r){t[s].selected=!0,n&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Io(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(S(91));return K({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ll(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(S(92));if(an(r)){if(1<r.length)throw Error(S(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:Dt(r)}}function Bc(t,e){var r=Dt(e.value),n=Dt(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function $l(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Fc(t){switch(t){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 Lo(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Fc(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var as,Hc=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,s){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(as=as||document.createElement("div"),as.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=as.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function xn(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var fn={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},Mf=["Webkit","ms","Moz","O"];Object.keys(fn).forEach(function(t){Mf.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),fn[e]=fn[t]})});function Wc(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||fn.hasOwnProperty(t)&&fn[t]?(""+e).trim():e+"px"}function Vc(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Wc(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,s):t[r]=s}}var zf=K({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 $o(t,e){if(e){if(zf[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(S(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(S(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(S(61))}if(e.style!=null&&typeof e.style!="object")throw Error(S(62))}}function Do(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Uo=null;function Ma(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Mo=null,Or=null,jr=null;function Dl(t){if(t=Zn(t)){if(typeof Mo!="function")throw Error(S(280));var e=t.stateNode;e&&(e=Ci(e),Mo(t.stateNode,t.type,e))}}function Kc(t){Or?jr?jr.push(t):jr=[t]:Or=t}function qc(){if(Or){var t=Or,e=jr;if(jr=Or=null,Dl(t),e)for(t=0;t<e.length;t++)Dl(e[t])}}function Gc(t,e){return t(e)}function Jc(){}var Ji=!1;function Qc(t,e,r){if(Ji)return t(e,r);Ji=!0;try{return Gc(t,e,r)}finally{Ji=!1,(Or!==null||jr!==null)&&(Jc(),qc())}}function Cn(t,e){var r=t.stateNode;if(r===null)return null;var n=Ci(r);if(n===null)return null;r=n[e];e:switch(e){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)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(S(231,e,typeof r));return r}var zo=!1;if(gt)try{var Yr={};Object.defineProperty(Yr,"passive",{get:function(){zo=!0}}),window.addEventListener("test",Yr,Yr),window.removeEventListener("test",Yr,Yr)}catch{zo=!1}function Bf(t,e,r,n,s,i,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(c){this.onError(c)}}var pn=!1,Vs=null,Ks=!1,Bo=null,Ff={onError:function(t){pn=!0,Vs=t}};function Hf(t,e,r,n,s,i,o,a,l){pn=!1,Vs=null,Bf.apply(Ff,arguments)}function Wf(t,e,r,n,s,i,o,a,l){if(Hf.apply(this,arguments),pn){if(pn){var u=Vs;pn=!1,Vs=null}else throw Error(S(198));Ks||(Ks=!0,Bo=u)}}function ar(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function Yc(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Ul(t){if(ar(t)!==t)throw Error(S(188))}function Vf(t){var e=t.alternate;if(!e){if(e=ar(t),e===null)throw Error(S(188));return e!==t?null:t}for(var r=t,n=e;;){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 Ul(s),t;if(i===n)return Ul(s),e;i=i.sibling}throw Error(S(188))}if(r.return!==n.return)r=s,n=i;else{for(var o=!1,a=s.child;a;){if(a===r){o=!0,r=s,n=i;break}if(a===n){o=!0,n=s,r=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===r){o=!0,r=i,n=s;break}if(a===n){o=!0,n=i,r=s;break}a=a.sibling}if(!o)throw Error(S(189))}}if(r.alternate!==n)throw Error(S(190))}if(r.tag!==3)throw Error(S(188));return r.stateNode.current===r?t:e}function Xc(t){return t=Vf(t),t!==null?Zc(t):null}function Zc(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Zc(t);if(e!==null)return e;t=t.sibling}return null}var eh=Oe.unstable_scheduleCallback,Ml=Oe.unstable_cancelCallback,Kf=Oe.unstable_shouldYield,qf=Oe.unstable_requestPaint,Q=Oe.unstable_now,Gf=Oe.unstable_getCurrentPriorityLevel,za=Oe.unstable_ImmediatePriority,th=Oe.unstable_UserBlockingPriority,qs=Oe.unstable_NormalPriority,Jf=Oe.unstable_LowPriority,rh=Oe.unstable_IdlePriority,Ei=null,nt=null;function Qf(t){if(nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Ei,t,void 0,(t.current.flags&128)===128)}catch{}}var Je=Math.clz32?Math.clz32:Zf,Yf=Math.log,Xf=Math.LN2;function Zf(t){return t>>>=0,t===0?32:31-(Yf(t)/Xf|0)|0}var ls=64,us=4194304;function ln(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Gs(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,s=t.suspendedLanes,i=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~s;a!==0?n=ln(a):(i&=o,i!==0&&(n=ln(i)))}else o=r&~s,o!==0?n=ln(o):i!==0&&(n=ln(i));if(n===0)return 0;if(e!==0&&e!==n&&!(e&s)&&(s=n&-n,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-Je(e),s=1<<r,n|=t[r],e&=~s;return n}function ep(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 tp(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-Je(i),a=1<<o,l=s[o];l===-1?(!(a&r)||a&n)&&(s[o]=ep(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Fo(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function nh(){var t=ls;return ls<<=1,!(ls&4194240)&&(ls=64),t}function Qi(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Yn(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Je(e),t[e]=r}function rp(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var s=31-Je(r),i=1<<s;e[s]=0,n[s]=-1,t[s]=-1,r&=~i}}function Ba(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-Je(r),s=1<<n;s&e|t[n]&e&&(t[n]|=e),r&=~s}}var U=0;function sh(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var ih,Fa,oh,ah,lh,Ho=!1,cs=[],At=null,Ot=null,jt=null,Rn=new Map,An=new Map,Et=[],np="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 zl(t,e){switch(t){case"focusin":case"focusout":At=null;break;case"dragenter":case"dragleave":Ot=null;break;case"mouseover":case"mouseout":jt=null;break;case"pointerover":case"pointerout":Rn.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":An.delete(e.pointerId)}}function Xr(t,e,r,n,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},e!==null&&(e=Zn(e),e!==null&&Fa(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function sp(t,e,r,n,s){switch(e){case"focusin":return At=Xr(At,t,e,r,n,s),!0;case"dragenter":return Ot=Xr(Ot,t,e,r,n,s),!0;case"mouseover":return jt=Xr(jt,t,e,r,n,s),!0;case"pointerover":var i=s.pointerId;return Rn.set(i,Xr(Rn.get(i)||null,t,e,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,An.set(i,Xr(An.get(i)||null,t,e,r,n,s)),!0}return!1}function uh(t){var e=Jt(t.target);if(e!==null){var r=ar(e);if(r!==null){if(e=r.tag,e===13){if(e=Yc(r),e!==null){t.blockedOn=e,lh(t.priority,function(){oh(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ns(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=Wo(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);Uo=n,r.target.dispatchEvent(n),Uo=null}else return e=Zn(r),e!==null&&Fa(e),t.blockedOn=r,!1;e.shift()}return!0}function Bl(t,e,r){Ns(t)&&r.delete(e)}function ip(){Ho=!1,At!==null&&Ns(At)&&(At=null),Ot!==null&&Ns(Ot)&&(Ot=null),jt!==null&&Ns(jt)&&(jt=null),Rn.forEach(Bl),An.forEach(Bl)}function Zr(t,e){t.blockedOn===e&&(t.blockedOn=null,Ho||(Ho=!0,Oe.unstable_scheduleCallback(Oe.unstable_NormalPriority,ip)))}function On(t){function e(s){return Zr(s,t)}if(0<cs.length){Zr(cs[0],t);for(var r=1;r<cs.length;r++){var n=cs[r];n.blockedOn===t&&(n.blockedOn=null)}}for(At!==null&&Zr(At,t),Ot!==null&&Zr(Ot,t),jt!==null&&Zr(jt,t),Rn.forEach(e),An.forEach(e),r=0;r<Et.length;r++)n=Et[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<Et.length&&(r=Et[0],r.blockedOn===null);)uh(r),r.blockedOn===null&&Et.shift()}var Pr=wt.ReactCurrentBatchConfig,Js=!0;function op(t,e,r,n){var s=U,i=Pr.transition;Pr.transition=null;try{U=1,Ha(t,e,r,n)}finally{U=s,Pr.transition=i}}function ap(t,e,r,n){var s=U,i=Pr.transition;Pr.transition=null;try{U=4,Ha(t,e,r,n)}finally{U=s,Pr.transition=i}}function Ha(t,e,r,n){if(Js){var s=Wo(t,e,r,n);if(s===null)oo(t,e,n,Qs,r),zl(t,n);else if(sp(s,t,e,r,n))n.stopPropagation();else if(zl(t,n),e&4&&-1<np.indexOf(t)){for(;s!==null;){var i=Zn(s);if(i!==null&&ih(i),i=Wo(t,e,r,n),i===null&&oo(t,e,n,Qs,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else oo(t,e,n,null,r)}}var Qs=null;function Wo(t,e,r,n){if(Qs=null,t=Ma(n),t=Jt(t),t!==null)if(e=ar(t),e===null)t=null;else if(r=e.tag,r===13){if(t=Yc(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Qs=t,null}function ch(t){switch(t){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(Gf()){case za:return 1;case th:return 4;case qs:case Jf:return 16;case rh:return 536870912;default:return 16}default:return 16}}var Ct=null,Wa=null,Is=null;function hh(){if(Is)return Is;var t,e=Wa,r=e.length,n,s="value"in Ct?Ct.value:Ct.textContent,i=s.length;for(t=0;t<r&&e[t]===s[t];t++);var o=r-t;for(n=1;n<=o&&e[r-n]===s[i-n];n++);return Is=s.slice(t,1<n?1-n:void 0)}function Ls(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function hs(){return!0}function Fl(){return!1}function Pe(t){function e(r,n,s,i,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(r=t[a],this[a]=r?r(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?hs:Fl,this.isPropagationStopped=Fl,this}return K(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=hs)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=hs)},persist:function(){},isPersistent:hs}),e}var Vr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Va=Pe(Vr),Xn=K({},Vr,{view:0,detail:0}),lp=Pe(Xn),Yi,Xi,en,bi=K({},Xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ka,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==en&&(en&&t.type==="mousemove"?(Yi=t.screenX-en.screenX,Xi=t.screenY-en.screenY):Xi=Yi=0,en=t),Yi)},movementY:function(t){return"movementY"in t?t.movementY:Xi}}),Hl=Pe(bi),up=K({},bi,{dataTransfer:0}),cp=Pe(up),hp=K({},Xn,{relatedTarget:0}),Zi=Pe(hp),dp=K({},Vr,{animationName:0,elapsedTime:0,pseudoElement:0}),fp=Pe(dp),pp=K({},Vr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),gp=Pe(pp),mp=K({},Vr,{data:0}),Wl=Pe(mp),yp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vp={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"},wp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _p(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=wp[t])?!!e[t]:!1}function Ka(){return _p}var kp=K({},Xn,{key:function(t){if(t.key){var e=yp[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ls(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?vp[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ka,charCode:function(t){return t.type==="keypress"?Ls(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ls(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Sp=Pe(kp),Ep=K({},bi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vl=Pe(Ep),bp=K({},Xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ka}),Tp=Pe(bp),xp=K({},Vr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Cp=Pe(xp),Rp=K({},bi,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Ap=Pe(Rp),Op=[9,13,27,32],qa=gt&&"CompositionEvent"in window,gn=null;gt&&"documentMode"in document&&(gn=document.documentMode);var jp=gt&&"TextEvent"in window&&!gn,dh=gt&&(!qa||gn&&8<gn&&11>=gn),Kl=" ",ql=!1;function fh(t,e){switch(t){case"keyup":return Op.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ph(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var vr=!1;function Pp(t,e){switch(t){case"compositionend":return ph(e);case"keypress":return e.which!==32?null:(ql=!0,Kl);case"textInput":return t=e.data,t===Kl&&ql?null:t;default:return null}}function Np(t,e){if(vr)return t==="compositionend"||!qa&&fh(t,e)?(t=hh(),Is=Wa=Ct=null,vr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return dh&&e.locale!=="ko"?null:e.data;default:return null}}var Ip={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 Gl(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Ip[t.type]:e==="textarea"}function gh(t,e,r,n){Kc(n),e=Ys(e,"onChange"),0<e.length&&(r=new Va("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var mn=null,jn=null;function Lp(t){xh(t,0)}function Ti(t){var e=kr(t);if(Mc(e))return t}function $p(t,e){if(t==="change")return e}var mh=!1;if(gt){var eo;if(gt){var to="oninput"in document;if(!to){var Jl=document.createElement("div");Jl.setAttribute("oninput","return;"),to=typeof Jl.oninput=="function"}eo=to}else eo=!1;mh=eo&&(!document.documentMode||9<document.documentMode)}function Ql(){mn&&(mn.detachEvent("onpropertychange",yh),jn=mn=null)}function yh(t){if(t.propertyName==="value"&&Ti(jn)){var e=[];gh(e,jn,t,Ma(t)),Qc(Lp,e)}}function Dp(t,e,r){t==="focusin"?(Ql(),mn=e,jn=r,mn.attachEvent("onpropertychange",yh)):t==="focusout"&&Ql()}function Up(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ti(jn)}function Mp(t,e){if(t==="click")return Ti(e)}function zp(t,e){if(t==="input"||t==="change")return Ti(e)}function Bp(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ye=typeof Object.is=="function"?Object.is:Bp;function Pn(t,e){if(Ye(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!xo.call(e,s)||!Ye(t[s],e[s]))return!1}return!0}function Yl(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Xl(t,e){var r=Yl(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Yl(r)}}function vh(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?vh(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function wh(){for(var t=window,e=Ws();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Ws(t.document)}return e}function Ga(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Fp(t){var e=wh(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&vh(r.ownerDocument.documentElement,r)){if(n!==null&&Ga(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!t.extend&&i>n&&(s=n,n=i,i=s),s=Xl(r,i);var o=Xl(r,n);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Hp=gt&&"documentMode"in document&&11>=document.documentMode,wr=null,Vo=null,yn=null,Ko=!1;function Zl(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ko||wr==null||wr!==Ws(n)||(n=wr,"selectionStart"in n&&Ga(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}),yn&&Pn(yn,n)||(yn=n,n=Ys(Vo,"onSelect"),0<n.length&&(e=new Va("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=wr)))}function ds(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var _r={animationend:ds("Animation","AnimationEnd"),animationiteration:ds("Animation","AnimationIteration"),animationstart:ds("Animation","AnimationStart"),transitionend:ds("Transition","TransitionEnd")},ro={},_h={};gt&&(_h=document.createElement("div").style,"AnimationEvent"in window||(delete _r.animationend.animation,delete _r.animationiteration.animation,delete _r.animationstart.animation),"TransitionEvent"in window||delete _r.transitionend.transition);function xi(t){if(ro[t])return ro[t];if(!_r[t])return t;var e=_r[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in _h)return ro[t]=e[r];return t}var kh=xi("animationend"),Sh=xi("animationiteration"),Eh=xi("animationstart"),bh=xi("transitionend"),Th=new Map,eu="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 Mt(t,e){Th.set(t,e),or(e,[t])}for(var no=0;no<eu.length;no++){var so=eu[no],Wp=so.toLowerCase(),Vp=so[0].toUpperCase()+so.slice(1);Mt(Wp,"on"+Vp)}Mt(kh,"onAnimationEnd");Mt(Sh,"onAnimationIteration");Mt(Eh,"onAnimationStart");Mt("dblclick","onDoubleClick");Mt("focusin","onFocus");Mt("focusout","onBlur");Mt(bh,"onTransitionEnd");Dr("onMouseEnter",["mouseout","mouseover"]);Dr("onMouseLeave",["mouseout","mouseover"]);Dr("onPointerEnter",["pointerout","pointerover"]);Dr("onPointerLeave",["pointerout","pointerover"]);or("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));or("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));or("onBeforeInput",["compositionend","keypress","textInput","paste"]);or("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));or("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));or("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var un="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(" "),Kp=new Set("cancel close invalid load scroll toggle".split(" ").concat(un));function tu(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,Wf(n,e,void 0,t),t.currentTarget=null}function xh(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],s=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var o=n.length-1;0<=o;o--){var a=n[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;tu(s,a,u),i=l}else for(o=0;o<n.length;o++){if(a=n[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;tu(s,a,u),i=l}}}if(Ks)throw t=Bo,Ks=!1,Bo=null,t}function B(t,e){var r=e[Yo];r===void 0&&(r=e[Yo]=new Set);var n=t+"__bubble";r.has(n)||(Ch(e,t,2,!1),r.add(n))}function io(t,e,r){var n=0;e&&(n|=4),Ch(r,t,n,e)}var fs="_reactListening"+Math.random().toString(36).slice(2);function Nn(t){if(!t[fs]){t[fs]=!0,Ic.forEach(function(r){r!=="selectionchange"&&(Kp.has(r)||io(r,!1,t),io(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[fs]||(e[fs]=!0,io("selectionchange",!1,e))}}function Ch(t,e,r,n){switch(ch(e)){case 1:var s=op;break;case 4:s=ap;break;default:s=Ha}r=s.bind(null,e,r,t),s=void 0,!zo||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),n?s!==void 0?t.addEventListener(e,r,{capture:!0,passive:s}):t.addEventListener(e,r,!0):s!==void 0?t.addEventListener(e,r,{passive:s}):t.addEventListener(e,r,!1)}function oo(t,e,r,n,s){var i=n;if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var a=n.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Jt(a),o===null)return;if(l=o.tag,l===5||l===6){n=i=o;continue e}a=a.parentNode}}n=n.return}Qc(function(){var u=i,c=Ma(r),h=[];e:{var d=Th.get(t);if(d!==void 0){var m=Va,v=t;switch(t){case"keypress":if(Ls(r)===0)break e;case"keydown":case"keyup":m=Sp;break;case"focusin":v="focus",m=Zi;break;case"focusout":v="blur",m=Zi;break;case"beforeblur":case"afterblur":m=Zi;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Hl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=cp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Tp;break;case kh:case Sh:case Eh:m=fp;break;case bh:m=Cp;break;case"scroll":m=lp;break;case"wheel":m=Ap;break;case"copy":case"cut":case"paste":m=gp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Vl}var w=(e&4)!==0,k=!w&&t==="scroll",p=w?d!==null?d+"Capture":null:d;w=[];for(var f=u,g;f!==null;){g=f;var _=g.stateNode;if(g.tag===5&&_!==null&&(g=_,p!==null&&(_=Cn(f,p),_!=null&&w.push(In(f,_,g)))),k)break;f=f.return}0<w.length&&(d=new m(d,v,null,r,c),h.push({event:d,listeners:w}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",d&&r!==Uo&&(v=r.relatedTarget||r.fromElement)&&(Jt(v)||v[mt]))break e;if((m||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,m?(v=r.relatedTarget||r.toElement,m=u,v=v?Jt(v):null,v!==null&&(k=ar(v),v!==k||v.tag!==5&&v.tag!==6)&&(v=null)):(m=null,v=u),m!==v)){if(w=Hl,_="onMouseLeave",p="onMouseEnter",f="mouse",(t==="pointerout"||t==="pointerover")&&(w=Vl,_="onPointerLeave",p="onPointerEnter",f="pointer"),k=m==null?d:kr(m),g=v==null?d:kr(v),d=new w(_,f+"leave",m,r,c),d.target=k,d.relatedTarget=g,_=null,Jt(c)===u&&(w=new w(p,f+"enter",v,r,c),w.target=g,w.relatedTarget=k,_=w),k=_,m&&v)t:{for(w=m,p=v,f=0,g=w;g;g=lr(g))f++;for(g=0,_=p;_;_=lr(_))g++;for(;0<f-g;)w=lr(w),f--;for(;0<g-f;)p=lr(p),g--;for(;f--;){if(w===p||p!==null&&w===p.alternate)break t;w=lr(w),p=lr(p)}w=null}else w=null;m!==null&&ru(h,d,m,w,!1),v!==null&&k!==null&&ru(h,k,v,w,!0)}}e:{if(d=u?kr(u):window,m=d.nodeName&&d.nodeName.toLowerCase(),m==="select"||m==="input"&&d.type==="file")var T=$p;else if(Gl(d))if(mh)T=zp;else{T=Up;var E=Dp}else(m=d.nodeName)&&m.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(T=Mp);if(T&&(T=T(t,u))){gh(h,T,r,c);break e}E&&E(t,d,u),t==="focusout"&&(E=d._wrapperState)&&E.controlled&&d.type==="number"&&No(d,"number",d.value)}switch(E=u?kr(u):window,t){case"focusin":(Gl(E)||E.contentEditable==="true")&&(wr=E,Vo=u,yn=null);break;case"focusout":yn=Vo=wr=null;break;case"mousedown":Ko=!0;break;case"contextmenu":case"mouseup":case"dragend":Ko=!1,Zl(h,r,c);break;case"selectionchange":if(Hp)break;case"keydown":case"keyup":Zl(h,r,c)}var b;if(qa)e:{switch(t){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else vr?fh(t,r)&&(O="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(O="onCompositionStart");O&&(dh&&r.locale!=="ko"&&(vr||O!=="onCompositionStart"?O==="onCompositionEnd"&&vr&&(b=hh()):(Ct=c,Wa="value"in Ct?Ct.value:Ct.textContent,vr=!0)),E=Ys(u,O),0<E.length&&(O=new Wl(O,t,null,r,c),h.push({event:O,listeners:E}),b?O.data=b:(b=ph(r),b!==null&&(O.data=b)))),(b=jp?Pp(t,r):Np(t,r))&&(u=Ys(u,"onBeforeInput"),0<u.length&&(c=new Wl("onBeforeInput","beforeinput",null,r,c),h.push({event:c,listeners:u}),c.data=b))}xh(h,e)})}function In(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Ys(t,e){for(var r=e+"Capture",n=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Cn(t,r),i!=null&&n.unshift(In(t,i,s)),i=Cn(t,e),i!=null&&n.push(In(t,i,s))),t=t.return}return n}function lr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function ru(t,e,r,n,s){for(var i=e._reactName,o=[];r!==null&&r!==n;){var a=r,l=a.alternate,u=a.stateNode;if(l!==null&&l===n)break;a.tag===5&&u!==null&&(a=u,s?(l=Cn(r,i),l!=null&&o.unshift(In(r,l,a))):s||(l=Cn(r,i),l!=null&&o.push(In(r,l,a)))),r=r.return}o.length!==0&&t.push({event:e,listeners:o})}var qp=/\r\n?/g,Gp=/\u0000|\uFFFD/g;function nu(t){return(typeof t=="string"?t:""+t).replace(qp,`
`).replace(Gp,"")}function ps(t,e,r){if(e=nu(e),nu(t)!==e&&r)throw Error(S(425))}function Xs(){}var qo=null,Go=null;function Jo(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Qo=typeof setTimeout=="function"?setTimeout:void 0,Jp=typeof clearTimeout=="function"?clearTimeout:void 0,su=typeof Promise=="function"?Promise:void 0,Qp=typeof queueMicrotask=="function"?queueMicrotask:typeof su<"u"?function(t){return su.resolve(null).then(t).catch(Yp)}:Qo;function Yp(t){setTimeout(function(){throw t})}function ao(t,e){var r=e,n=0;do{var s=r.nextSibling;if(t.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){t.removeChild(s),On(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);On(e)}function Pt(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function iu(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var Kr=Math.random().toString(36).slice(2),rt="__reactFiber$"+Kr,Ln="__reactProps$"+Kr,mt="__reactContainer$"+Kr,Yo="__reactEvents$"+Kr,Xp="__reactListeners$"+Kr,Zp="__reactHandles$"+Kr;function Jt(t){var e=t[rt];if(e)return e;for(var r=t.parentNode;r;){if(e=r[mt]||r[rt]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=iu(t);t!==null;){if(r=t[rt])return r;t=iu(t)}return e}t=r,r=t.parentNode}return null}function Zn(t){return t=t[rt]||t[mt],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function kr(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(S(33))}function Ci(t){return t[Ln]||null}var Xo=[],Sr=-1;function zt(t){return{current:t}}function F(t){0>Sr||(t.current=Xo[Sr],Xo[Sr]=null,Sr--)}function z(t,e){Sr++,Xo[Sr]=t.current,t.current=e}var Ut={},ge=zt(Ut),Ee=zt(!1),tr=Ut;function Ur(t,e){var r=t.type.contextTypes;if(!r)return Ut;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function be(t){return t=t.childContextTypes,t!=null}function Zs(){F(Ee),F(ge)}function ou(t,e,r){if(ge.current!==Ut)throw Error(S(168));z(ge,e),z(Ee,r)}function Rh(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(S(108,Df(t)||"Unknown",s));return K({},r,n)}function ei(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ut,tr=ge.current,z(ge,t),z(Ee,Ee.current),!0}function au(t,e,r){var n=t.stateNode;if(!n)throw Error(S(169));r?(t=Rh(t,e,tr),n.__reactInternalMemoizedMergedChildContext=t,F(Ee),F(ge),z(ge,t)):F(Ee),z(Ee,r)}var ht=null,Ri=!1,lo=!1;function Ah(t){ht===null?ht=[t]:ht.push(t)}function eg(t){Ri=!0,Ah(t)}function Bt(){if(!lo&&ht!==null){lo=!0;var t=0,e=U;try{var r=ht;for(U=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}ht=null,Ri=!1}catch(s){throw ht!==null&&(ht=ht.slice(t+1)),eh(za,Bt),s}finally{U=e,lo=!1}}return null}var Er=[],br=0,ti=null,ri=0,Ie=[],Le=0,rr=null,dt=1,ft="";function Kt(t,e){Er[br++]=ri,Er[br++]=ti,ti=t,ri=e}function Oh(t,e,r){Ie[Le++]=dt,Ie[Le++]=ft,Ie[Le++]=rr,rr=t;var n=dt;t=ft;var s=32-Je(n)-1;n&=~(1<<s),r+=1;var i=32-Je(e)+s;if(30<i){var o=s-s%5;i=(n&(1<<o)-1).toString(32),n>>=o,s-=o,dt=1<<32-Je(e)+s|r<<s|n,ft=i+t}else dt=1<<i|r<<s|n,ft=t}function Ja(t){t.return!==null&&(Kt(t,1),Oh(t,1,0))}function Qa(t){for(;t===ti;)ti=Er[--br],Er[br]=null,ri=Er[--br],Er[br]=null;for(;t===rr;)rr=Ie[--Le],Ie[Le]=null,ft=Ie[--Le],Ie[Le]=null,dt=Ie[--Le],Ie[Le]=null}var Ae=null,Re=null,H=!1,qe=null;function jh(t,e){var r=$e(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function lu(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ae=t,Re=Pt(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ae=t,Re=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=rr!==null?{id:dt,overflow:ft}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=$e(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Ae=t,Re=null,!0):!1;default:return!1}}function Zo(t){return(t.mode&1)!==0&&(t.flags&128)===0}function ea(t){if(H){var e=Re;if(e){var r=e;if(!lu(t,e)){if(Zo(t))throw Error(S(418));e=Pt(r.nextSibling);var n=Ae;e&&lu(t,e)?jh(n,r):(t.flags=t.flags&-4097|2,H=!1,Ae=t)}}else{if(Zo(t))throw Error(S(418));t.flags=t.flags&-4097|2,H=!1,Ae=t}}}function uu(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ae=t}function gs(t){if(t!==Ae)return!1;if(!H)return uu(t),H=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Jo(t.type,t.memoizedProps)),e&&(e=Re)){if(Zo(t))throw Ph(),Error(S(418));for(;e;)jh(t,e),e=Pt(e.nextSibling)}if(uu(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(S(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Re=Pt(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Re=null}}else Re=Ae?Pt(t.stateNode.nextSibling):null;return!0}function Ph(){for(var t=Re;t;)t=Pt(t.nextSibling)}function Mr(){Re=Ae=null,H=!1}function Ya(t){qe===null?qe=[t]:qe.push(t)}var tg=wt.ReactCurrentBatchConfig;function tn(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(S(309));var n=r.stateNode}if(!n)throw Error(S(147,t));var s=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(S(284));if(!r._owner)throw Error(S(290,t))}return t}function ms(t,e){throw t=Object.prototype.toString.call(e),Error(S(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function cu(t){var e=t._init;return e(t._payload)}function Nh(t){function e(p,f){if(t){var g=p.deletions;g===null?(p.deletions=[f],p.flags|=16):g.push(f)}}function r(p,f){if(!t)return null;for(;f!==null;)e(p,f),f=f.sibling;return null}function n(p,f){for(p=new Map;f!==null;)f.key!==null?p.set(f.key,f):p.set(f.index,f),f=f.sibling;return p}function s(p,f){return p=$t(p,f),p.index=0,p.sibling=null,p}function i(p,f,g){return p.index=g,t?(g=p.alternate,g!==null?(g=g.index,g<f?(p.flags|=2,f):g):(p.flags|=2,f)):(p.flags|=1048576,f)}function o(p){return t&&p.alternate===null&&(p.flags|=2),p}function a(p,f,g,_){return f===null||f.tag!==6?(f=mo(g,p.mode,_),f.return=p,f):(f=s(f,g),f.return=p,f)}function l(p,f,g,_){var T=g.type;return T===yr?c(p,f,g.props.children,_,g.key):f!==null&&(f.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===kt&&cu(T)===f.type)?(_=s(f,g.props),_.ref=tn(p,f,g),_.return=p,_):(_=Fs(g.type,g.key,g.props,null,p.mode,_),_.ref=tn(p,f,g),_.return=p,_)}function u(p,f,g,_){return f===null||f.tag!==4||f.stateNode.containerInfo!==g.containerInfo||f.stateNode.implementation!==g.implementation?(f=yo(g,p.mode,_),f.return=p,f):(f=s(f,g.children||[]),f.return=p,f)}function c(p,f,g,_,T){return f===null||f.tag!==7?(f=er(g,p.mode,_,T),f.return=p,f):(f=s(f,g),f.return=p,f)}function h(p,f,g){if(typeof f=="string"&&f!==""||typeof f=="number")return f=mo(""+f,p.mode,g),f.return=p,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case is:return g=Fs(f.type,f.key,f.props,null,p.mode,g),g.ref=tn(p,null,f),g.return=p,g;case mr:return f=yo(f,p.mode,g),f.return=p,f;case kt:var _=f._init;return h(p,_(f._payload),g)}if(an(f)||Qr(f))return f=er(f,p.mode,g,null),f.return=p,f;ms(p,f)}return null}function d(p,f,g,_){var T=f!==null?f.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return T!==null?null:a(p,f,""+g,_);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case is:return g.key===T?l(p,f,g,_):null;case mr:return g.key===T?u(p,f,g,_):null;case kt:return T=g._init,d(p,f,T(g._payload),_)}if(an(g)||Qr(g))return T!==null?null:c(p,f,g,_,null);ms(p,g)}return null}function m(p,f,g,_,T){if(typeof _=="string"&&_!==""||typeof _=="number")return p=p.get(g)||null,a(f,p,""+_,T);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case is:return p=p.get(_.key===null?g:_.key)||null,l(f,p,_,T);case mr:return p=p.get(_.key===null?g:_.key)||null,u(f,p,_,T);case kt:var E=_._init;return m(p,f,g,E(_._payload),T)}if(an(_)||Qr(_))return p=p.get(g)||null,c(f,p,_,T,null);ms(f,_)}return null}function v(p,f,g,_){for(var T=null,E=null,b=f,O=f=0,D=null;b!==null&&O<g.length;O++){b.index>O?(D=b,b=null):D=b.sibling;var L=d(p,b,g[O],_);if(L===null){b===null&&(b=D);break}t&&b&&L.alternate===null&&e(p,b),f=i(L,f,O),E===null?T=L:E.sibling=L,E=L,b=D}if(O===g.length)return r(p,b),H&&Kt(p,O),T;if(b===null){for(;O<g.length;O++)b=h(p,g[O],_),b!==null&&(f=i(b,f,O),E===null?T=b:E.sibling=b,E=b);return H&&Kt(p,O),T}for(b=n(p,b);O<g.length;O++)D=m(b,p,O,g[O],_),D!==null&&(t&&D.alternate!==null&&b.delete(D.key===null?O:D.key),f=i(D,f,O),E===null?T=D:E.sibling=D,E=D);return t&&b.forEach(function(ze){return e(p,ze)}),H&&Kt(p,O),T}function w(p,f,g,_){var T=Qr(g);if(typeof T!="function")throw Error(S(150));if(g=T.call(g),g==null)throw Error(S(151));for(var E=T=null,b=f,O=f=0,D=null,L=g.next();b!==null&&!L.done;O++,L=g.next()){b.index>O?(D=b,b=null):D=b.sibling;var ze=d(p,b,L.value,_);if(ze===null){b===null&&(b=D);break}t&&b&&ze.alternate===null&&e(p,b),f=i(ze,f,O),E===null?T=ze:E.sibling=ze,E=ze,b=D}if(L.done)return r(p,b),H&&Kt(p,O),T;if(b===null){for(;!L.done;O++,L=g.next())L=h(p,L.value,_),L!==null&&(f=i(L,f,O),E===null?T=L:E.sibling=L,E=L);return H&&Kt(p,O),T}for(b=n(p,b);!L.done;O++,L=g.next())L=m(b,p,O,L.value,_),L!==null&&(t&&L.alternate!==null&&b.delete(L.key===null?O:L.key),f=i(L,f,O),E===null?T=L:E.sibling=L,E=L);return t&&b.forEach(function(Gr){return e(p,Gr)}),H&&Kt(p,O),T}function k(p,f,g,_){if(typeof g=="object"&&g!==null&&g.type===yr&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case is:e:{for(var T=g.key,E=f;E!==null;){if(E.key===T){if(T=g.type,T===yr){if(E.tag===7){r(p,E.sibling),f=s(E,g.props.children),f.return=p,p=f;break e}}else if(E.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===kt&&cu(T)===E.type){r(p,E.sibling),f=s(E,g.props),f.ref=tn(p,E,g),f.return=p,p=f;break e}r(p,E);break}else e(p,E);E=E.sibling}g.type===yr?(f=er(g.props.children,p.mode,_,g.key),f.return=p,p=f):(_=Fs(g.type,g.key,g.props,null,p.mode,_),_.ref=tn(p,f,g),_.return=p,p=_)}return o(p);case mr:e:{for(E=g.key;f!==null;){if(f.key===E)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){r(p,f.sibling),f=s(f,g.children||[]),f.return=p,p=f;break e}else{r(p,f);break}else e(p,f);f=f.sibling}f=yo(g,p.mode,_),f.return=p,p=f}return o(p);case kt:return E=g._init,k(p,f,E(g._payload),_)}if(an(g))return v(p,f,g,_);if(Qr(g))return w(p,f,g,_);ms(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(r(p,f.sibling),f=s(f,g),f.return=p,p=f):(r(p,f),f=mo(g,p.mode,_),f.return=p,p=f),o(p)):r(p,f)}return k}var zr=Nh(!0),Ih=Nh(!1),ni=zt(null),si=null,Tr=null,Xa=null;function Za(){Xa=Tr=si=null}function el(t){var e=ni.current;F(ni),t._currentValue=e}function ta(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Nr(t,e){si=t,Xa=Tr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Se=!0),t.firstContext=null)}function Ue(t){var e=t._currentValue;if(Xa!==t)if(t={context:t,memoizedValue:e,next:null},Tr===null){if(si===null)throw Error(S(308));Tr=t,si.dependencies={lanes:0,firstContext:t}}else Tr=Tr.next=t;return e}var Qt=null;function tl(t){Qt===null?Qt=[t]:Qt.push(t)}function Lh(t,e,r,n){var s=e.interleaved;return s===null?(r.next=r,tl(e)):(r.next=s.next,s.next=r),e.interleaved=r,yt(t,n)}function yt(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var St=!1;function rl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $h(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function pt(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Nt(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,$&2){var s=n.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),n.pending=e,yt(t,r)}return s=n.interleaved,s===null?(e.next=e,tl(n)):(e.next=s.next,s.next=e),n.interleaved=e,yt(t,r)}function $s(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Ba(t,r)}}function hu(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?s=i=e:i=i.next=e}else s=i=e;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function ii(t,e,r,n){var s=t.updateQueue;St=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;o=0,c=u=l=null,a=i;do{var d=a.lane,m=a.eventTime;if((n&d)===d){c!==null&&(c=c.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=t,w=a;switch(d=e,m=r,w.tag){case 1:if(v=w.payload,typeof v=="function"){h=v.call(m,h,d);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=w.payload,d=typeof v=="function"?v.call(m,h,d):v,d==null)break e;h=K({},h,d);break e;case 2:St=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=s.effects,d===null?s.effects=[a]:d.push(a))}else m={eventTime:m,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=m,l=h):c=c.next=m,o|=d;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;d=a,a=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(c===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);sr|=o,t.lanes=o,t.memoizedState=h}}function du(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(S(191,s));s.call(n)}}}var es={},st=zt(es),$n=zt(es),Dn=zt(es);function Yt(t){if(t===es)throw Error(S(174));return t}function nl(t,e){switch(z(Dn,e),z($n,t),z(st,es),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Lo(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Lo(e,t)}F(st),z(st,e)}function Br(){F(st),F($n),F(Dn)}function Dh(t){Yt(Dn.current);var e=Yt(st.current),r=Lo(e,t.type);e!==r&&(z($n,t),z(st,r))}function sl(t){$n.current===t&&(F(st),F($n))}var W=zt(0);function oi(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var uo=[];function il(){for(var t=0;t<uo.length;t++)uo[t]._workInProgressVersionPrimary=null;uo.length=0}var Ds=wt.ReactCurrentDispatcher,co=wt.ReactCurrentBatchConfig,nr=0,V=null,ee=null,se=null,ai=!1,vn=!1,Un=0,rg=0;function ce(){throw Error(S(321))}function ol(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Ye(t[r],e[r]))return!1;return!0}function al(t,e,r,n,s,i){if(nr=i,V=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ds.current=t===null||t.memoizedState===null?og:ag,t=r(n,s),vn){i=0;do{if(vn=!1,Un=0,25<=i)throw Error(S(301));i+=1,se=ee=null,e.updateQueue=null,Ds.current=lg,t=r(n,s)}while(vn)}if(Ds.current=li,e=ee!==null&&ee.next!==null,nr=0,se=ee=V=null,ai=!1,e)throw Error(S(300));return t}function ll(){var t=Un!==0;return Un=0,t}function Ze(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return se===null?V.memoizedState=se=t:se=se.next=t,se}function Me(){if(ee===null){var t=V.alternate;t=t!==null?t.memoizedState:null}else t=ee.next;var e=se===null?V.memoizedState:se.next;if(e!==null)se=e,ee=t;else{if(t===null)throw Error(S(310));ee=t,t={memoizedState:ee.memoizedState,baseState:ee.baseState,baseQueue:ee.baseQueue,queue:ee.queue,next:null},se===null?V.memoizedState=se=t:se=se.next=t}return se}function Mn(t,e){return typeof e=="function"?e(t):e}function ho(t){var e=Me(),r=e.queue;if(r===null)throw Error(S(311));r.lastRenderedReducer=t;var n=ee,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var a=o=null,l=null,u=i;do{var c=u.lane;if((nr&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:t(n,u.action);else{var h={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=h,o=n):l=l.next=h,V.lanes|=c,sr|=c}u=u.next}while(u!==null&&u!==i);l===null?o=n:l.next=a,Ye(n,e.memoizedState)||(Se=!0),e.memoizedState=n,e.baseState=o,e.baseQueue=l,r.lastRenderedState=n}if(t=r.interleaved,t!==null){s=t;do i=s.lane,V.lanes|=i,sr|=i,s=s.next;while(s!==t)}else s===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function fo(t){var e=Me(),r=e.queue;if(r===null)throw Error(S(311));r.lastRenderedReducer=t;var n=r.dispatch,s=r.pending,i=e.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);Ye(i,e.memoizedState)||(Se=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function Uh(){}function Mh(t,e){var r=V,n=Me(),s=e(),i=!Ye(n.memoizedState,s);if(i&&(n.memoizedState=s,Se=!0),n=n.queue,ul(Fh.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||se!==null&&se.memoizedState.tag&1){if(r.flags|=2048,zn(9,Bh.bind(null,r,n,s,e),void 0,null),ie===null)throw Error(S(349));nr&30||zh(r,e,s)}return s}function zh(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=V.updateQueue,e===null?(e={lastEffect:null,stores:null},V.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Bh(t,e,r,n){e.value=r,e.getSnapshot=n,Hh(e)&&Wh(t)}function Fh(t,e,r){return r(function(){Hh(e)&&Wh(t)})}function Hh(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Ye(t,r)}catch{return!0}}function Wh(t){var e=yt(t,1);e!==null&&Qe(e,t,1,-1)}function fu(t){var e=Ze();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:t},e.queue=t,t=t.dispatch=ig.bind(null,V,t),[e.memoizedState,t]}function zn(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=V.updateQueue,e===null?(e={lastEffect:null,stores:null},V.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function Vh(){return Me().memoizedState}function Us(t,e,r,n){var s=Ze();V.flags|=t,s.memoizedState=zn(1|e,r,void 0,n===void 0?null:n)}function Ai(t,e,r,n){var s=Me();n=n===void 0?null:n;var i=void 0;if(ee!==null){var o=ee.memoizedState;if(i=o.destroy,n!==null&&ol(n,o.deps)){s.memoizedState=zn(e,r,i,n);return}}V.flags|=t,s.memoizedState=zn(1|e,r,i,n)}function pu(t,e){return Us(8390656,8,t,e)}function ul(t,e){return Ai(2048,8,t,e)}function Kh(t,e){return Ai(4,2,t,e)}function qh(t,e){return Ai(4,4,t,e)}function Gh(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Jh(t,e,r){return r=r!=null?r.concat([t]):null,Ai(4,4,Gh.bind(null,e,t),r)}function cl(){}function Qh(t,e){var r=Me();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&ol(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Yh(t,e){var r=Me();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&ol(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function Xh(t,e,r){return nr&21?(Ye(r,e)||(r=nh(),V.lanes|=r,sr|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Se=!0),t.memoizedState=r)}function ng(t,e){var r=U;U=r!==0&&4>r?r:4,t(!0);var n=co.transition;co.transition={};try{t(!1),e()}finally{U=r,co.transition=n}}function Zh(){return Me().memoizedState}function sg(t,e,r){var n=Lt(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},ed(t))td(e,r);else if(r=Lh(t,e,r,n),r!==null){var s=ye();Qe(r,t,n,s),rd(r,e,n)}}function ig(t,e,r){var n=Lt(t),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(ed(t))td(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,r);if(s.hasEagerState=!0,s.eagerState=a,Ye(a,o)){var l=e.interleaved;l===null?(s.next=s,tl(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}r=Lh(t,e,s,n),r!==null&&(s=ye(),Qe(r,t,n,s),rd(r,e,n))}}function ed(t){var e=t.alternate;return t===V||e!==null&&e===V}function td(t,e){vn=ai=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function rd(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Ba(t,r)}}var li={readContext:Ue,useCallback:ce,useContext:ce,useEffect:ce,useImperativeHandle:ce,useInsertionEffect:ce,useLayoutEffect:ce,useMemo:ce,useReducer:ce,useRef:ce,useState:ce,useDebugValue:ce,useDeferredValue:ce,useTransition:ce,useMutableSource:ce,useSyncExternalStore:ce,useId:ce,unstable_isNewReconciler:!1},og={readContext:Ue,useCallback:function(t,e){return Ze().memoizedState=[t,e===void 0?null:e],t},useContext:Ue,useEffect:pu,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Us(4194308,4,Gh.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Us(4194308,4,t,e)},useInsertionEffect:function(t,e){return Us(4,2,t,e)},useMemo:function(t,e){var r=Ze();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Ze();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=sg.bind(null,V,t),[n.memoizedState,t]},useRef:function(t){var e=Ze();return t={current:t},e.memoizedState=t},useState:fu,useDebugValue:cl,useDeferredValue:function(t){return Ze().memoizedState=t},useTransition:function(){var t=fu(!1),e=t[0];return t=ng.bind(null,t[1]),Ze().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=V,s=Ze();if(H){if(r===void 0)throw Error(S(407));r=r()}else{if(r=e(),ie===null)throw Error(S(349));nr&30||zh(n,e,r)}s.memoizedState=r;var i={value:r,getSnapshot:e};return s.queue=i,pu(Fh.bind(null,n,i,t),[t]),n.flags|=2048,zn(9,Bh.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=Ze(),e=ie.identifierPrefix;if(H){var r=ft,n=dt;r=(n&~(1<<32-Je(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Un++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=rg++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},ag={readContext:Ue,useCallback:Qh,useContext:Ue,useEffect:ul,useImperativeHandle:Jh,useInsertionEffect:Kh,useLayoutEffect:qh,useMemo:Yh,useReducer:ho,useRef:Vh,useState:function(){return ho(Mn)},useDebugValue:cl,useDeferredValue:function(t){var e=Me();return Xh(e,ee.memoizedState,t)},useTransition:function(){var t=ho(Mn)[0],e=Me().memoizedState;return[t,e]},useMutableSource:Uh,useSyncExternalStore:Mh,useId:Zh,unstable_isNewReconciler:!1},lg={readContext:Ue,useCallback:Qh,useContext:Ue,useEffect:ul,useImperativeHandle:Jh,useInsertionEffect:Kh,useLayoutEffect:qh,useMemo:Yh,useReducer:fo,useRef:Vh,useState:function(){return fo(Mn)},useDebugValue:cl,useDeferredValue:function(t){var e=Me();return ee===null?e.memoizedState=t:Xh(e,ee.memoizedState,t)},useTransition:function(){var t=fo(Mn)[0],e=Me().memoizedState;return[t,e]},useMutableSource:Uh,useSyncExternalStore:Mh,useId:Zh,unstable_isNewReconciler:!1};function We(t,e){if(t&&t.defaultProps){e=K({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function ra(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:K({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Oi={isMounted:function(t){return(t=t._reactInternals)?ar(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=ye(),s=Lt(t),i=pt(n,s);i.payload=e,r!=null&&(i.callback=r),e=Nt(t,i,s),e!==null&&(Qe(e,t,s,n),$s(e,t,s))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=ye(),s=Lt(t),i=pt(n,s);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=Nt(t,i,s),e!==null&&(Qe(e,t,s,n),$s(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=ye(),n=Lt(t),s=pt(r,n);s.tag=2,e!=null&&(s.callback=e),e=Nt(t,s,n),e!==null&&(Qe(e,t,n,r),$s(e,t,n))}};function gu(t,e,r,n,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,o):e.prototype&&e.prototype.isPureReactComponent?!Pn(r,n)||!Pn(s,i):!0}function nd(t,e,r){var n=!1,s=Ut,i=e.contextType;return typeof i=="object"&&i!==null?i=Ue(i):(s=be(e)?tr:ge.current,n=e.contextTypes,i=(n=n!=null)?Ur(t,s):Ut),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Oi,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function mu(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&Oi.enqueueReplaceState(e,e.state,null)}function na(t,e,r,n){var s=t.stateNode;s.props=r,s.state=t.memoizedState,s.refs={},rl(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Ue(i):(i=be(e)?tr:ge.current,s.context=Ur(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ra(t,e,i,r),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&Oi.enqueueReplaceState(s,s.state,null),ii(t,r,s,n),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Fr(t,e){try{var r="",n=e;do r+=$f(n),n=n.return;while(n);var s=r}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function po(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function sa(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var ug=typeof WeakMap=="function"?WeakMap:Map;function sd(t,e,r){r=pt(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){ci||(ci=!0,pa=n),sa(t,e)},r}function id(t,e,r){r=pt(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var s=e.value;r.payload=function(){return n(s)},r.callback=function(){sa(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){sa(t,e),typeof n!="function"&&(It===null?It=new Set([this]):It.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function yu(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new ug;var s=new Set;n.set(e,s)}else s=n.get(e),s===void 0&&(s=new Set,n.set(e,s));s.has(r)||(s.add(r),t=Eg.bind(null,t,e,r),e.then(t,t))}function vu(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function wu(t,e,r,n,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=pt(-1,1),e.tag=2,Nt(r,e,1))),r.lanes|=1),t)}var cg=wt.ReactCurrentOwner,Se=!1;function me(t,e,r,n){e.child=t===null?Ih(e,null,r,n):zr(e,t.child,r,n)}function _u(t,e,r,n,s){r=r.render;var i=e.ref;return Nr(e,s),n=al(t,e,r,n,i,s),r=ll(),t!==null&&!Se?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,vt(t,e,s)):(H&&r&&Ja(e),e.flags|=1,me(t,e,n,s),e.child)}function ku(t,e,r,n,s){if(t===null){var i=r.type;return typeof i=="function"&&!vl(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,od(t,e,i,n,s)):(t=Fs(r.type,null,n,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(r=r.compare,r=r!==null?r:Pn,r(o,n)&&t.ref===e.ref)return vt(t,e,s)}return e.flags|=1,t=$t(i,n),t.ref=e.ref,t.return=e,e.child=t}function od(t,e,r,n,s){if(t!==null){var i=t.memoizedProps;if(Pn(i,n)&&t.ref===e.ref)if(Se=!1,e.pendingProps=n=i,(t.lanes&s)!==0)t.flags&131072&&(Se=!0);else return e.lanes=t.lanes,vt(t,e,s)}return ia(t,e,r,n,s)}function ad(t,e,r){var n=e.pendingProps,s=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},z(Cr,xe),xe|=r;else{if(!(r&1073741824))return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,z(Cr,xe),xe|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,z(Cr,xe),xe|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,z(Cr,xe),xe|=n;return me(t,e,s,r),e.child}function ld(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function ia(t,e,r,n,s){var i=be(r)?tr:ge.current;return i=Ur(e,i),Nr(e,s),r=al(t,e,r,n,i,s),n=ll(),t!==null&&!Se?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,vt(t,e,s)):(H&&n&&Ja(e),e.flags|=1,me(t,e,r,s),e.child)}function Su(t,e,r,n,s){if(be(r)){var i=!0;ei(e)}else i=!1;if(Nr(e,s),e.stateNode===null)Ms(t,e),nd(e,r,n),na(e,r,n,s),n=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Ue(u):(u=be(r)?tr:ge.current,u=Ur(e,u));var c=r.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&mu(e,o,n,u),St=!1;var d=e.memoizedState;o.state=d,ii(e,n,o,s),l=e.memoizedState,a!==n||d!==l||Ee.current||St?(typeof c=="function"&&(ra(e,r,c,n),l=e.memoizedState),(a=St||gu(e,r,a,n,d,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,$h(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:We(e.type,a),o.props=u,h=e.pendingProps,d=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=Ue(l):(l=be(r)?tr:ge.current,l=Ur(e,l));var m=r.getDerivedStateFromProps;(c=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==l)&&mu(e,o,n,l),St=!1,d=e.memoizedState,o.state=d,ii(e,n,o,s);var v=e.memoizedState;a!==h||d!==v||Ee.current||St?(typeof m=="function"&&(ra(e,r,m,n),v=e.memoizedState),(u=St||gu(e,r,u,n,d,v,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,v,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,v,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=v),o.props=n,o.state=v,o.context=l,n=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),n=!1)}return oa(t,e,r,n,i,s)}function oa(t,e,r,n,s,i){ld(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return s&&au(e,r,!1),vt(t,e,i);n=e.stateNode,cg.current=e;var a=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=zr(e,t.child,null,i),e.child=zr(e,null,a,i)):me(t,e,a,i),e.memoizedState=n.state,s&&au(e,r,!0),e.child}function ud(t){var e=t.stateNode;e.pendingContext?ou(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ou(t,e.context,!1),nl(t,e.containerInfo)}function Eu(t,e,r,n,s){return Mr(),Ya(s),e.flags|=256,me(t,e,r,n),e.child}var aa={dehydrated:null,treeContext:null,retryLane:0};function la(t){return{baseLanes:t,cachePool:null,transitions:null}}function cd(t,e,r){var n=e.pendingProps,s=W.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),z(W,s&1),t===null)return ea(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,i?(n=e.mode,i=e.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Ni(o,n,0,null),t=er(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=la(r),e.memoizedState=aa,t):hl(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return hg(t,e,o,n,a,s,r);if(i){i=n.fallback,o=e.mode,s=t.child,a=s.sibling;var l={mode:"hidden",children:n.children};return!(o&1)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=l,e.deletions=null):(n=$t(s,l),n.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=$t(a,i):(i=er(i,o,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,o=t.child.memoizedState,o=o===null?la(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~r,e.memoizedState=aa,n}return i=t.child,t=i.sibling,n=$t(i,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function hl(t,e){return e=Ni({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ys(t,e,r,n){return n!==null&&Ya(n),zr(e,t.child,null,r),t=hl(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function hg(t,e,r,n,s,i,o){if(r)return e.flags&256?(e.flags&=-257,n=po(Error(S(422))),ys(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,s=e.mode,n=Ni({mode:"visible",children:n.children},s,0,null),i=er(i,s,o,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,e.mode&1&&zr(e,t.child,null,o),e.child.memoizedState=la(o),e.memoizedState=aa,i);if(!(e.mode&1))return ys(t,e,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var a=n.dgst;return n=a,i=Error(S(419)),n=po(i,n,void 0),ys(t,e,o,n)}if(a=(o&t.childLanes)!==0,Se||a){if(n=ie,n!==null){switch(o&-o){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|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,yt(t,s),Qe(n,t,s,-1))}return yl(),n=po(Error(S(421))),ys(t,e,o,n)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=bg.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Re=Pt(s.nextSibling),Ae=e,H=!0,qe=null,t!==null&&(Ie[Le++]=dt,Ie[Le++]=ft,Ie[Le++]=rr,dt=t.id,ft=t.overflow,rr=e),e=hl(e,n.children),e.flags|=4096,e)}function bu(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),ta(t.return,e,r)}function go(t,e,r,n,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function hd(t,e,r){var n=e.pendingProps,s=n.revealOrder,i=n.tail;if(me(t,e,n.children,r),n=W.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&bu(t,r,e);else if(t.tag===19)bu(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(z(W,n),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(r=e.child,s=null;r!==null;)t=r.alternate,t!==null&&oi(t)===null&&(s=r),r=r.sibling;r=s,r===null?(s=e.child,e.child=null):(s=r.sibling,r.sibling=null),go(e,!1,s,r,i);break;case"backwards":for(r=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&oi(t)===null){e.child=s;break}t=s.sibling,s.sibling=r,r=s,s=t}go(e,!0,r,null,i);break;case"together":go(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ms(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function vt(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),sr|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(S(153));if(e.child!==null){for(t=e.child,r=$t(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=$t(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function dg(t,e,r){switch(e.tag){case 3:ud(e),Mr();break;case 5:Dh(e);break;case 1:be(e.type)&&ei(e);break;case 4:nl(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,s=e.memoizedProps.value;z(ni,n._currentValue),n._currentValue=s;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(z(W,W.current&1),e.flags|=128,null):r&e.child.childLanes?cd(t,e,r):(z(W,W.current&1),t=vt(t,e,r),t!==null?t.sibling:null);z(W,W.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return hd(t,e,r);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),z(W,W.current),n)break;return null;case 22:case 23:return e.lanes=0,ad(t,e,r)}return vt(t,e,r)}var dd,ua,fd,pd;dd=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};ua=function(){};fd=function(t,e,r,n){var s=t.memoizedProps;if(s!==n){t=e.stateNode,Yt(st.current);var i=null;switch(r){case"input":s=jo(t,s),n=jo(t,n),i=[];break;case"select":s=K({},s,{value:void 0}),n=K({},n,{value:void 0}),i=[];break;case"textarea":s=Io(t,s),n=Io(t,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Xs)}$o(r,n);var o;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Tn.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var l=n[u];if(a=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(i||(i=[]),i.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Tn.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&B("scroll",t),i||a===l||(i=[])):(i=i||[]).push(u,l))}r&&(i=i||[]).push("style",r);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};pd=function(t,e,r,n){r!==n&&(e.flags|=4)};function rn(t,e){if(!H)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function he(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function fg(t,e,r){var n=e.pendingProps;switch(Qa(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return he(e),null;case 1:return be(e.type)&&Zs(),he(e),null;case 3:return n=e.stateNode,Br(),F(Ee),F(ge),il(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(gs(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,qe!==null&&(ya(qe),qe=null))),ua(t,e),he(e),null;case 5:sl(e);var s=Yt(Dn.current);if(r=e.type,t!==null&&e.stateNode!=null)fd(t,e,r,n,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(S(166));return he(e),null}if(t=Yt(st.current),gs(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[rt]=e,n[Ln]=i,t=(e.mode&1)!==0,r){case"dialog":B("cancel",n),B("close",n);break;case"iframe":case"object":case"embed":B("load",n);break;case"video":case"audio":for(s=0;s<un.length;s++)B(un[s],n);break;case"source":B("error",n);break;case"img":case"image":case"link":B("error",n),B("load",n);break;case"details":B("toggle",n);break;case"input":Nl(n,i),B("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},B("invalid",n);break;case"textarea":Ll(n,i),B("invalid",n)}$o(r,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?n.textContent!==a&&(i.suppressHydrationWarning!==!0&&ps(n.textContent,a,t),s=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&ps(n.textContent,a,t),s=["children",""+a]):Tn.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&B("scroll",n)}switch(r){case"input":os(n),Il(n,i,!0);break;case"textarea":os(n),$l(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Xs)}n=s,e.updateQueue=n,n!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Fc(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[rt]=e,t[Ln]=n,dd(t,e,!1,!1),e.stateNode=t;e:{switch(o=Do(r,n),r){case"dialog":B("cancel",t),B("close",t),s=n;break;case"iframe":case"object":case"embed":B("load",t),s=n;break;case"video":case"audio":for(s=0;s<un.length;s++)B(un[s],t);s=n;break;case"source":B("error",t),s=n;break;case"img":case"image":case"link":B("error",t),B("load",t),s=n;break;case"details":B("toggle",t),s=n;break;case"input":Nl(t,n),s=jo(t,n),B("invalid",t);break;case"option":s=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},s=K({},n,{value:void 0}),B("invalid",t);break;case"textarea":Ll(t,n),s=Io(t,n),B("invalid",t);break;default:s=n}$o(r,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Vc(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Hc(t,l)):i==="children"?typeof l=="string"?(r!=="textarea"||l!=="")&&xn(t,l):typeof l=="number"&&xn(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Tn.hasOwnProperty(i)?l!=null&&i==="onScroll"&&B("scroll",t):l!=null&&La(t,i,l,o))}switch(r){case"input":os(t),Il(t,n,!1);break;case"textarea":os(t),$l(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Dt(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Ar(t,!!n.multiple,i,!1):n.defaultValue!=null&&Ar(t,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=Xs)}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&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return he(e),null;case 6:if(t&&e.stateNode!=null)pd(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(S(166));if(r=Yt(Dn.current),Yt(st.current),gs(e)){if(n=e.stateNode,r=e.memoizedProps,n[rt]=e,(i=n.nodeValue!==r)&&(t=Ae,t!==null))switch(t.tag){case 3:ps(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ps(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[rt]=e,e.stateNode=n}return he(e),null;case 13:if(F(W),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(H&&Re!==null&&e.mode&1&&!(e.flags&128))Ph(),Mr(),e.flags|=98560,i=!1;else if(i=gs(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(S(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(S(317));i[rt]=e}else Mr(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;he(e),i=!1}else qe!==null&&(ya(qe),qe=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||W.current&1?te===0&&(te=3):yl())),e.updateQueue!==null&&(e.flags|=4),he(e),null);case 4:return Br(),ua(t,e),t===null&&Nn(e.stateNode.containerInfo),he(e),null;case 10:return el(e.type._context),he(e),null;case 17:return be(e.type)&&Zs(),he(e),null;case 19:if(F(W),i=e.memoizedState,i===null)return he(e),null;if(n=(e.flags&128)!==0,o=i.rendering,o===null)if(n)rn(i,!1);else{if(te!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=oi(t),o!==null){for(e.flags|=128,rn(i,!1),n=o.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return z(W,W.current&1|2),e.child}t=t.sibling}i.tail!==null&&Q()>Hr&&(e.flags|=128,n=!0,rn(i,!1),e.lanes=4194304)}else{if(!n)if(t=oi(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!H)return he(e),null}else 2*Q()-i.renderingStartTime>Hr&&r!==1073741824&&(e.flags|=128,n=!0,rn(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(r=i.last,r!==null?r.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Q(),e.sibling=null,r=W.current,z(W,n?r&1|2:r&1),e):(he(e),null);case 22:case 23:return ml(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?xe&1073741824&&(he(e),e.subtreeFlags&6&&(e.flags|=8192)):he(e),null;case 24:return null;case 25:return null}throw Error(S(156,e.tag))}function pg(t,e){switch(Qa(e),e.tag){case 1:return be(e.type)&&Zs(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Br(),F(Ee),F(ge),il(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return sl(e),null;case 13:if(F(W),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(S(340));Mr()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return F(W),null;case 4:return Br(),null;case 10:return el(e.type._context),null;case 22:case 23:return ml(),null;case 24:return null;default:return null}}var vs=!1,fe=!1,gg=typeof WeakSet=="function"?WeakSet:Set,C=null;function xr(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){G(t,e,n)}else r.current=null}function ca(t,e,r){try{r()}catch(n){G(t,e,n)}}var Tu=!1;function mg(t,e){if(qo=Js,t=wh(),Ga(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.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 o=0,a=-1,l=-1,u=0,c=0,h=t,d=null;t:for(;;){for(var m;h!==r||s!==0&&h.nodeType!==3||(a=o+s),h!==i||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)d=h,h=m;for(;;){if(h===t)break t;if(d===r&&++u===s&&(a=o),d===i&&++c===n&&(l=o),(m=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=m}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Go={focusedElem:t,selectionRange:r},Js=!1,C=e;C!==null;)if(e=C,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,C=t;else for(;C!==null;){e=C;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,p=e.stateNode,f=p.getSnapshotBeforeUpdate(e.elementType===e.type?w:We(e.type,w),k);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(_){G(e,e.return,_)}if(t=e.sibling,t!==null){t.return=e.return,C=t;break}C=e.return}return v=Tu,Tu=!1,v}function wn(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&ca(e,r,i)}s=s.next}while(s!==n)}}function ji(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function ha(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function gd(t){var e=t.alternate;e!==null&&(t.alternate=null,gd(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[rt],delete e[Ln],delete e[Yo],delete e[Xp],delete e[Zp])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function md(t){return t.tag===5||t.tag===3||t.tag===4}function xu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||md(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function da(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Xs));else if(n!==4&&(t=t.child,t!==null))for(da(t,e,r),t=t.sibling;t!==null;)da(t,e,r),t=t.sibling}function fa(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(fa(t,e,r),t=t.sibling;t!==null;)fa(t,e,r),t=t.sibling}var oe=null,Ke=!1;function _t(t,e,r){for(r=r.child;r!==null;)yd(t,e,r),r=r.sibling}function yd(t,e,r){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Ei,r)}catch{}switch(r.tag){case 5:fe||xr(r,e);case 6:var n=oe,s=Ke;oe=null,_t(t,e,r),oe=n,Ke=s,oe!==null&&(Ke?(t=oe,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):oe.removeChild(r.stateNode));break;case 18:oe!==null&&(Ke?(t=oe,r=r.stateNode,t.nodeType===8?ao(t.parentNode,r):t.nodeType===1&&ao(t,r),On(t)):ao(oe,r.stateNode));break;case 4:n=oe,s=Ke,oe=r.stateNode.containerInfo,Ke=!0,_t(t,e,r),oe=n,Ke=s;break;case 0:case 11:case 14:case 15:if(!fe&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&ca(r,e,o),s=s.next}while(s!==n)}_t(t,e,r);break;case 1:if(!fe&&(xr(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){G(r,e,a)}_t(t,e,r);break;case 21:_t(t,e,r);break;case 22:r.mode&1?(fe=(n=fe)||r.memoizedState!==null,_t(t,e,r),fe=n):_t(t,e,r);break;default:_t(t,e,r)}}function Cu(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new gg),e.forEach(function(n){var s=Tg.bind(null,t,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Be(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:oe=a.stateNode,Ke=!1;break e;case 3:oe=a.stateNode.containerInfo,Ke=!0;break e;case 4:oe=a.stateNode.containerInfo,Ke=!0;break e}a=a.return}if(oe===null)throw Error(S(160));yd(i,o,s),oe=null,Ke=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){G(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)vd(e,t),e=e.sibling}function vd(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Be(e,t),Xe(t),n&4){try{wn(3,t,t.return),ji(3,t)}catch(w){G(t,t.return,w)}try{wn(5,t,t.return)}catch(w){G(t,t.return,w)}}break;case 1:Be(e,t),Xe(t),n&512&&r!==null&&xr(r,r.return);break;case 5:if(Be(e,t),Xe(t),n&512&&r!==null&&xr(r,r.return),t.flags&32){var s=t.stateNode;try{xn(s,"")}catch(w){G(t,t.return,w)}}if(n&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=r!==null?r.memoizedProps:i,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&zc(s,i),Do(a,o);var u=Do(a,i);for(o=0;o<l.length;o+=2){var c=l[o],h=l[o+1];c==="style"?Vc(s,h):c==="dangerouslySetInnerHTML"?Hc(s,h):c==="children"?xn(s,h):La(s,c,h,u)}switch(a){case"input":Po(s,i);break;case"textarea":Bc(s,i);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Ar(s,!!i.multiple,m,!1):d!==!!i.multiple&&(i.defaultValue!=null?Ar(s,!!i.multiple,i.defaultValue,!0):Ar(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ln]=i}catch(w){G(t,t.return,w)}}break;case 6:if(Be(e,t),Xe(t),n&4){if(t.stateNode===null)throw Error(S(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(w){G(t,t.return,w)}}break;case 3:if(Be(e,t),Xe(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{On(e.containerInfo)}catch(w){G(t,t.return,w)}break;case 4:Be(e,t),Xe(t);break;case 13:Be(e,t),Xe(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(pl=Q())),n&4&&Cu(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(fe=(u=fe)||c,Be(e,t),fe=u):Be(e,t),Xe(t),n&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(C=t,c=t.child;c!==null;){for(h=C=c;C!==null;){switch(d=C,m=d.child,d.tag){case 0:case 11:case 14:case 15:wn(4,d,d.return);break;case 1:xr(d,d.return);var v=d.stateNode;if(typeof v.componentWillUnmount=="function"){n=d,r=d.return;try{e=n,v.props=e.memoizedProps,v.state=e.memoizedState,v.componentWillUnmount()}catch(w){G(n,r,w)}}break;case 5:xr(d,d.return);break;case 22:if(d.memoizedState!==null){Au(h);continue}}m!==null?(m.return=d,C=m):Au(h)}c=c.sibling}e:for(c=null,h=t;;){if(h.tag===5){if(c===null){c=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Wc("display",o))}catch(w){G(t,t.return,w)}}}else if(h.tag===6){if(c===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(w){G(t,t.return,w)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;c===h&&(c=null),h=h.return}c===h&&(c=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Be(e,t),Xe(t),n&4&&Cu(t);break;case 21:break;default:Be(e,t),Xe(t)}}function Xe(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(md(r)){var n=r;break e}r=r.return}throw Error(S(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(xn(s,""),n.flags&=-33);var i=xu(t);fa(t,i,s);break;case 3:case 4:var o=n.stateNode.containerInfo,a=xu(t);da(t,a,o);break;default:throw Error(S(161))}}catch(l){G(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function yg(t,e,r){C=t,wd(t)}function wd(t,e,r){for(var n=(t.mode&1)!==0;C!==null;){var s=C,i=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||vs;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||fe;a=vs;var u=fe;if(vs=o,(fe=l)&&!u)for(C=s;C!==null;)o=C,l=o.child,o.tag===22&&o.memoizedState!==null?Ou(s):l!==null?(l.return=o,C=l):Ou(s);for(;i!==null;)C=i,wd(i),i=i.sibling;C=s,vs=a,fe=u}Ru(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,C=i):Ru(t)}}function Ru(t){for(;C!==null;){var e=C;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:fe||ji(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!fe)if(r===null)n.componentDidMount();else{var s=e.elementType===e.type?r.memoizedProps:We(e.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&du(e,i,n);break;case 3:var o=e.updateQueue;if(o!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}du(e,o,r)}break;case 5:var a=e.stateNode;if(r===null&&e.flags&4){r=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break;case"img":l.src&&(r.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var h=c.dehydrated;h!==null&&On(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(S(163))}fe||e.flags&512&&ha(e)}catch(d){G(e,e.return,d)}}if(e===t){C=null;break}if(r=e.sibling,r!==null){r.return=e.return,C=r;break}C=e.return}}function Au(t){for(;C!==null;){var e=C;if(e===t){C=null;break}var r=e.sibling;if(r!==null){r.return=e.return,C=r;break}C=e.return}}function Ou(t){for(;C!==null;){var e=C;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{ji(4,e)}catch(l){G(e,r,l)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var s=e.return;try{n.componentDidMount()}catch(l){G(e,s,l)}}var i=e.return;try{ha(e)}catch(l){G(e,i,l)}break;case 5:var o=e.return;try{ha(e)}catch(l){G(e,o,l)}}}catch(l){G(e,e.return,l)}if(e===t){C=null;break}var a=e.sibling;if(a!==null){a.return=e.return,C=a;break}C=e.return}}var vg=Math.ceil,ui=wt.ReactCurrentDispatcher,dl=wt.ReactCurrentOwner,De=wt.ReactCurrentBatchConfig,$=0,ie=null,Z=null,ae=0,xe=0,Cr=zt(0),te=0,Bn=null,sr=0,Pi=0,fl=0,_n=null,ke=null,pl=0,Hr=1/0,at=null,ci=!1,pa=null,It=null,ws=!1,Rt=null,hi=0,kn=0,ga=null,zs=-1,Bs=0;function ye(){return $&6?Q():zs!==-1?zs:zs=Q()}function Lt(t){return t.mode&1?$&2&&ae!==0?ae&-ae:tg.transition!==null?(Bs===0&&(Bs=nh()),Bs):(t=U,t!==0||(t=window.event,t=t===void 0?16:ch(t.type)),t):1}function Qe(t,e,r,n){if(50<kn)throw kn=0,ga=null,Error(S(185));Yn(t,r,n),(!($&2)||t!==ie)&&(t===ie&&(!($&2)&&(Pi|=r),te===4&&bt(t,ae)),Te(t,n),r===1&&$===0&&!(e.mode&1)&&(Hr=Q()+500,Ri&&Bt()))}function Te(t,e){var r=t.callbackNode;tp(t,e);var n=Gs(t,t===ie?ae:0);if(n===0)r!==null&&Ml(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&Ml(r),e===1)t.tag===0?eg(ju.bind(null,t)):Ah(ju.bind(null,t)),Qp(function(){!($&6)&&Bt()}),r=null;else{switch(sh(n)){case 1:r=za;break;case 4:r=th;break;case 16:r=qs;break;case 536870912:r=rh;break;default:r=qs}r=Cd(r,_d.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function _d(t,e){if(zs=-1,Bs=0,$&6)throw Error(S(327));var r=t.callbackNode;if(Ir()&&t.callbackNode!==r)return null;var n=Gs(t,t===ie?ae:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=di(t,n);else{e=n;var s=$;$|=2;var i=Sd();(ie!==t||ae!==e)&&(at=null,Hr=Q()+500,Zt(t,e));do try{kg();break}catch(a){kd(t,a)}while(!0);Za(),ui.current=i,$=s,Z!==null?e=0:(ie=null,ae=0,e=te)}if(e!==0){if(e===2&&(s=Fo(t),s!==0&&(n=s,e=ma(t,s))),e===1)throw r=Bn,Zt(t,0),bt(t,n),Te(t,Q()),r;if(e===6)bt(t,n);else{if(s=t.current.alternate,!(n&30)&&!wg(s)&&(e=di(t,n),e===2&&(i=Fo(t),i!==0&&(n=i,e=ma(t,i))),e===1))throw r=Bn,Zt(t,0),bt(t,n),Te(t,Q()),r;switch(t.finishedWork=s,t.finishedLanes=n,e){case 0:case 1:throw Error(S(345));case 2:qt(t,ke,at);break;case 3:if(bt(t,n),(n&130023424)===n&&(e=pl+500-Q(),10<e)){if(Gs(t,0)!==0)break;if(s=t.suspendedLanes,(s&n)!==n){ye(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Qo(qt.bind(null,t,ke,at),e);break}qt(t,ke,at);break;case 4:if(bt(t,n),(n&4194240)===n)break;for(e=t.eventTimes,s=-1;0<n;){var o=31-Je(n);i=1<<o,o=e[o],o>s&&(s=o),n&=~i}if(n=s,n=Q()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*vg(n/1960))-n,10<n){t.timeoutHandle=Qo(qt.bind(null,t,ke,at),n);break}qt(t,ke,at);break;case 5:qt(t,ke,at);break;default:throw Error(S(329))}}}return Te(t,Q()),t.callbackNode===r?_d.bind(null,t):null}function ma(t,e){var r=_n;return t.current.memoizedState.isDehydrated&&(Zt(t,e).flags|=256),t=di(t,e),t!==2&&(e=ke,ke=r,e!==null&&ya(e)),t}function ya(t){ke===null?ke=t:ke.push.apply(ke,t)}function wg(t){for(var e=t;;){if(e.flags&16384){var r=e.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(!Ye(i(),s))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function bt(t,e){for(e&=~fl,e&=~Pi,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-Je(e),n=1<<r;t[r]=-1,e&=~n}}function ju(t){if($&6)throw Error(S(327));Ir();var e=Gs(t,0);if(!(e&1))return Te(t,Q()),null;var r=di(t,e);if(t.tag!==0&&r===2){var n=Fo(t);n!==0&&(e=n,r=ma(t,n))}if(r===1)throw r=Bn,Zt(t,0),bt(t,e),Te(t,Q()),r;if(r===6)throw Error(S(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,qt(t,ke,at),Te(t,Q()),null}function gl(t,e){var r=$;$|=1;try{return t(e)}finally{$=r,$===0&&(Hr=Q()+500,Ri&&Bt())}}function ir(t){Rt!==null&&Rt.tag===0&&!($&6)&&Ir();var e=$;$|=1;var r=De.transition,n=U;try{if(De.transition=null,U=1,t)return t()}finally{U=n,De.transition=r,$=e,!($&6)&&Bt()}}function ml(){xe=Cr.current,F(Cr)}function Zt(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,Jp(r)),Z!==null)for(r=Z.return;r!==null;){var n=r;switch(Qa(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Zs();break;case 3:Br(),F(Ee),F(ge),il();break;case 5:sl(n);break;case 4:Br();break;case 13:F(W);break;case 19:F(W);break;case 10:el(n.type._context);break;case 22:case 23:ml()}r=r.return}if(ie=t,Z=t=$t(t.current,null),ae=xe=e,te=0,Bn=null,fl=Pi=sr=0,ke=_n=null,Qt!==null){for(e=0;e<Qt.length;e++)if(r=Qt[e],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var o=i.next;i.next=s,n.next=o}r.pending=n}Qt=null}return t}function kd(t,e){do{var r=Z;try{if(Za(),Ds.current=li,ai){for(var n=V.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}ai=!1}if(nr=0,se=ee=V=null,vn=!1,Un=0,dl.current=null,r===null||r.return===null){te=1,Bn=e,Z=null;break}e:{var i=t,o=r.return,a=r,l=e;if(e=ae,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,h=c.tag;if(!(c.mode&1)&&(h===0||h===11||h===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var m=vu(o);if(m!==null){m.flags&=-257,wu(m,o,a,i,e),m.mode&1&&yu(i,u,e),e=m,l=u;var v=e.updateQueue;if(v===null){var w=new Set;w.add(l),e.updateQueue=w}else v.add(l);break e}else{if(!(e&1)){yu(i,u,e),yl();break e}l=Error(S(426))}}else if(H&&a.mode&1){var k=vu(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),wu(k,o,a,i,e),Ya(Fr(l,a));break e}}i=l=Fr(l,a),te!==4&&(te=2),_n===null?_n=[i]:_n.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var p=sd(i,l,e);hu(i,p);break e;case 1:a=l;var f=i.type,g=i.stateNode;if(!(i.flags&128)&&(typeof f.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(It===null||!It.has(g)))){i.flags|=65536,e&=-e,i.lanes|=e;var _=id(i,a,e);hu(i,_);break e}}i=i.return}while(i!==null)}bd(r)}catch(T){e=T,Z===r&&r!==null&&(Z=r=r.return);continue}break}while(!0)}function Sd(){var t=ui.current;return ui.current=li,t===null?li:t}function yl(){(te===0||te===3||te===2)&&(te=4),ie===null||!(sr&268435455)&&!(Pi&268435455)||bt(ie,ae)}function di(t,e){var r=$;$|=2;var n=Sd();(ie!==t||ae!==e)&&(at=null,Zt(t,e));do try{_g();break}catch(s){kd(t,s)}while(!0);if(Za(),$=r,ui.current=n,Z!==null)throw Error(S(261));return ie=null,ae=0,te}function _g(){for(;Z!==null;)Ed(Z)}function kg(){for(;Z!==null&&!Kf();)Ed(Z)}function Ed(t){var e=xd(t.alternate,t,xe);t.memoizedProps=t.pendingProps,e===null?bd(t):Z=e,dl.current=null}function bd(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=pg(r,e),r!==null){r.flags&=32767,Z=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{te=6,Z=null;return}}else if(r=fg(r,e,xe),r!==null){Z=r;return}if(e=e.sibling,e!==null){Z=e;return}Z=e=t}while(e!==null);te===0&&(te=5)}function qt(t,e,r){var n=U,s=De.transition;try{De.transition=null,U=1,Sg(t,e,r,n)}finally{De.transition=s,U=n}return null}function Sg(t,e,r,n){do Ir();while(Rt!==null);if($&6)throw Error(S(327));r=t.finishedWork;var s=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(S(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(rp(t,i),t===ie&&(Z=ie=null,ae=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||ws||(ws=!0,Cd(qs,function(){return Ir(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=De.transition,De.transition=null;var o=U;U=1;var a=$;$|=4,dl.current=null,mg(t,r),vd(r,t),Fp(Go),Js=!!qo,Go=qo=null,t.current=r,yg(r),qf(),$=a,U=o,De.transition=i}else t.current=r;if(ws&&(ws=!1,Rt=t,hi=s),i=t.pendingLanes,i===0&&(It=null),Qf(r.stateNode),Te(t,Q()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)s=e[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(ci)throw ci=!1,t=pa,pa=null,t;return hi&1&&t.tag!==0&&Ir(),i=t.pendingLanes,i&1?t===ga?kn++:(kn=0,ga=t):kn=0,Bt(),null}function Ir(){if(Rt!==null){var t=sh(hi),e=De.transition,r=U;try{if(De.transition=null,U=16>t?16:t,Rt===null)var n=!1;else{if(t=Rt,Rt=null,hi=0,$&6)throw Error(S(331));var s=$;for($|=4,C=t.current;C!==null;){var i=C,o=i.child;if(C.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(C=u;C!==null;){var c=C;switch(c.tag){case 0:case 11:case 15:wn(8,c,i)}var h=c.child;if(h!==null)h.return=c,C=h;else for(;C!==null;){c=C;var d=c.sibling,m=c.return;if(gd(c),c===u){C=null;break}if(d!==null){d.return=m,C=d;break}C=m}}}var v=i.alternate;if(v!==null){var w=v.child;if(w!==null){v.child=null;do{var k=w.sibling;w.sibling=null,w=k}while(w!==null)}}C=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,C=o;else e:for(;C!==null;){if(i=C,i.flags&2048)switch(i.tag){case 0:case 11:case 15:wn(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,C=p;break e}C=i.return}}var f=t.current;for(C=f;C!==null;){o=C;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,C=g;else e:for(o=f;C!==null;){if(a=C,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ji(9,a)}}catch(T){G(a,a.return,T)}if(a===o){C=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,C=_;break e}C=a.return}}if($=s,Bt(),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Ei,t)}catch{}n=!0}return n}finally{U=r,De.transition=e}}return!1}function Pu(t,e,r){e=Fr(r,e),e=sd(t,e,1),t=Nt(t,e,1),e=ye(),t!==null&&(Yn(t,1,e),Te(t,e))}function G(t,e,r){if(t.tag===3)Pu(t,t,r);else for(;e!==null;){if(e.tag===3){Pu(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(It===null||!It.has(n))){t=Fr(r,t),t=id(e,t,1),e=Nt(e,t,1),t=ye(),e!==null&&(Yn(e,1,t),Te(e,t));break}}e=e.return}}function Eg(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=ye(),t.pingedLanes|=t.suspendedLanes&r,ie===t&&(ae&r)===r&&(te===4||te===3&&(ae&130023424)===ae&&500>Q()-pl?Zt(t,0):fl|=r),Te(t,e)}function Td(t,e){e===0&&(t.mode&1?(e=us,us<<=1,!(us&130023424)&&(us=4194304)):e=1);var r=ye();t=yt(t,e),t!==null&&(Yn(t,e,r),Te(t,r))}function bg(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Td(t,r)}function Tg(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,s=t.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(S(314))}n!==null&&n.delete(e),Td(t,r)}var xd;xd=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ee.current)Se=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Se=!1,dg(t,e,r);Se=!!(t.flags&131072)}else Se=!1,H&&e.flags&1048576&&Oh(e,ri,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Ms(t,e),t=e.pendingProps;var s=Ur(e,ge.current);Nr(e,r),s=al(null,e,n,t,s,r);var i=ll();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,be(n)?(i=!0,ei(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,rl(e),s.updater=Oi,e.stateNode=s,s._reactInternals=e,na(e,n,t,r),e=oa(null,e,n,!0,i,r)):(e.tag=0,H&&i&&Ja(e),me(null,e,s,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Ms(t,e),t=e.pendingProps,s=n._init,n=s(n._payload),e.type=n,s=e.tag=Cg(n),t=We(n,t),s){case 0:e=ia(null,e,n,t,r);break e;case 1:e=Su(null,e,n,t,r);break e;case 11:e=_u(null,e,n,t,r);break e;case 14:e=ku(null,e,n,We(n.type,t),r);break e}throw Error(S(306,n,""))}return e;case 0:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:We(n,s),ia(t,e,n,s,r);case 1:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:We(n,s),Su(t,e,n,s,r);case 3:e:{if(ud(e),t===null)throw Error(S(387));n=e.pendingProps,i=e.memoizedState,s=i.element,$h(t,e),ii(e,n,null,r);var o=e.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Fr(Error(S(423)),e),e=Eu(t,e,n,r,s);break e}else if(n!==s){s=Fr(Error(S(424)),e),e=Eu(t,e,n,r,s);break e}else for(Re=Pt(e.stateNode.containerInfo.firstChild),Ae=e,H=!0,qe=null,r=Ih(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mr(),n===s){e=vt(t,e,r);break e}me(t,e,n,r)}e=e.child}return e;case 5:return Dh(e),t===null&&ea(e),n=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Jo(n,s)?o=null:i!==null&&Jo(n,i)&&(e.flags|=32),ld(t,e),me(t,e,o,r),e.child;case 6:return t===null&&ea(e),null;case 13:return cd(t,e,r);case 4:return nl(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=zr(e,null,n,r):me(t,e,n,r),e.child;case 11:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:We(n,s),_u(t,e,n,s,r);case 7:return me(t,e,e.pendingProps,r),e.child;case 8:return me(t,e,e.pendingProps.children,r),e.child;case 12:return me(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,z(ni,n._currentValue),n._currentValue=o,i!==null)if(Ye(i.value,o)){if(i.children===s.children&&!Ee.current){e=vt(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=pt(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),ta(i.return,r,e),a.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),ta(o,r,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}me(t,e,s.children,r),e=e.child}return e;case 9:return s=e.type,n=e.pendingProps.children,Nr(e,r),s=Ue(s),n=n(s),e.flags|=1,me(t,e,n,r),e.child;case 14:return n=e.type,s=We(n,e.pendingProps),s=We(n.type,s),ku(t,e,n,s,r);case 15:return od(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:We(n,s),Ms(t,e),e.tag=1,be(n)?(t=!0,ei(e)):t=!1,Nr(e,r),nd(e,n,s),na(e,n,s,r),oa(null,e,n,!0,t,r);case 19:return hd(t,e,r);case 22:return ad(t,e,r)}throw Error(S(156,e.tag))};function Cd(t,e){return eh(t,e)}function xg(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 $e(t,e,r,n){return new xg(t,e,r,n)}function vl(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Cg(t){if(typeof t=="function")return vl(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Da)return 11;if(t===Ua)return 14}return 2}function $t(t,e){var r=t.alternate;return r===null?(r=$e(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Fs(t,e,r,n,s,i){var o=2;if(n=t,typeof t=="function")vl(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case yr:return er(r.children,s,i,e);case $a:o=8,s|=8;break;case Co:return t=$e(12,r,e,s|2),t.elementType=Co,t.lanes=i,t;case Ro:return t=$e(13,r,e,s),t.elementType=Ro,t.lanes=i,t;case Ao:return t=$e(19,r,e,s),t.elementType=Ao,t.lanes=i,t;case Dc:return Ni(r,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Lc:o=10;break e;case $c:o=9;break e;case Da:o=11;break e;case Ua:o=14;break e;case kt:o=16,n=null;break e}throw Error(S(130,t==null?t:typeof t,""))}return e=$e(o,r,e,s),e.elementType=t,e.type=n,e.lanes=i,e}function er(t,e,r,n){return t=$e(7,t,n,e),t.lanes=r,t}function Ni(t,e,r,n){return t=$e(22,t,n,e),t.elementType=Dc,t.lanes=r,t.stateNode={isHidden:!1},t}function mo(t,e,r){return t=$e(6,t,null,e),t.lanes=r,t}function yo(t,e,r){return e=$e(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Rg(t,e,r,n,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qi(0),this.expirationTimes=Qi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qi(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function wl(t,e,r,n,s,i,o,a,l){return t=new Rg(t,e,r,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=$e(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rl(i),t}function Ag(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:mr,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Rd(t){if(!t)return Ut;t=t._reactInternals;e:{if(ar(t)!==t||t.tag!==1)throw Error(S(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(be(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(S(171))}if(t.tag===1){var r=t.type;if(be(r))return Rh(t,r,e)}return e}function Ad(t,e,r,n,s,i,o,a,l){return t=wl(r,n,!0,t,s,i,o,a,l),t.context=Rd(null),r=t.current,n=ye(),s=Lt(r),i=pt(n,s),i.callback=e??null,Nt(r,i,s),t.current.lanes=s,Yn(t,s,n),Te(t,n),t}function Ii(t,e,r,n){var s=e.current,i=ye(),o=Lt(s);return r=Rd(r),e.context===null?e.context=r:e.pendingContext=r,e=pt(i,o),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=Nt(s,e,o),t!==null&&(Qe(t,s,o,i),$s(t,s,o)),o}function fi(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Nu(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function _l(t,e){Nu(t,e),(t=t.alternate)&&Nu(t,e)}function Og(){return null}var Od=typeof reportError=="function"?reportError:function(t){console.error(t)};function kl(t){this._internalRoot=t}Li.prototype.render=kl.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(S(409));Ii(t,e,null,null)};Li.prototype.unmount=kl.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ir(function(){Ii(null,t,null,null)}),e[mt]=null}};function Li(t){this._internalRoot=t}Li.prototype.unstable_scheduleHydration=function(t){if(t){var e=ah();t={blockedOn:null,target:t,priority:e};for(var r=0;r<Et.length&&e!==0&&e<Et[r].priority;r++);Et.splice(r,0,t),r===0&&uh(t)}};function Sl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function $i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Iu(){}function jg(t,e,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=fi(o);i.call(u)}}var o=Ad(e,n,t,0,null,!1,!1,"",Iu);return t._reactRootContainer=o,t[mt]=o.current,Nn(t.nodeType===8?t.parentNode:t),ir(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof n=="function"){var a=n;n=function(){var u=fi(l);a.call(u)}}var l=wl(t,0,!1,null,null,!1,!1,"",Iu);return t._reactRootContainer=l,t[mt]=l.current,Nn(t.nodeType===8?t.parentNode:t),ir(function(){Ii(e,l,r,n)}),l}function Di(t,e,r,n,s){var i=r._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=fi(o);a.call(l)}}Ii(e,o,t,s)}else o=jg(r,e,t,s,n);return fi(o)}ih=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=ln(e.pendingLanes);r!==0&&(Ba(e,r|1),Te(e,Q()),!($&6)&&(Hr=Q()+500,Bt()))}break;case 13:ir(function(){var n=yt(t,1);if(n!==null){var s=ye();Qe(n,t,1,s)}}),_l(t,1)}};Fa=function(t){if(t.tag===13){var e=yt(t,134217728);if(e!==null){var r=ye();Qe(e,t,134217728,r)}_l(t,134217728)}};oh=function(t){if(t.tag===13){var e=Lt(t),r=yt(t,e);if(r!==null){var n=ye();Qe(r,t,e,n)}_l(t,e)}};ah=function(){return U};lh=function(t,e){var r=U;try{return U=t,e()}finally{U=r}};Mo=function(t,e,r){switch(e){case"input":if(Po(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var s=Ci(n);if(!s)throw Error(S(90));Mc(n),Po(n,s)}}}break;case"textarea":Bc(t,r);break;case"select":e=r.value,e!=null&&Ar(t,!!r.multiple,e,!1)}};Gc=gl;Jc=ir;var Pg={usingClientEntryPoint:!1,Events:[Zn,kr,Ci,Kc,qc,gl]},nn={findFiberByHostInstance:Jt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ng={bundleType:nn.bundleType,version:nn.version,rendererPackageName:nn.rendererPackageName,rendererConfig:nn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wt.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Xc(t),t===null?null:t.stateNode},findFiberByHostInstance:nn.findFiberByHostInstance||Og,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 _s=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_s.isDisabled&&_s.supportsFiber)try{Ei=_s.inject(Ng),nt=_s}catch{}}je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Pg;je.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sl(e))throw Error(S(200));return Ag(t,e,null,r)};je.createRoot=function(t,e){if(!Sl(t))throw Error(S(299));var r=!1,n="",s=Od;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=wl(t,1,!1,null,null,r,!1,n,s),t[mt]=e.current,Nn(t.nodeType===8?t.parentNode:t),new kl(e)};je.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(S(188)):(t=Object.keys(t).join(","),Error(S(268,t)));return t=Xc(e),t=t===null?null:t.stateNode,t};je.flushSync=function(t){return ir(t)};je.hydrate=function(t,e,r){if(!$i(e))throw Error(S(200));return Di(null,t,e,!0,r)};je.hydrateRoot=function(t,e,r){if(!Sl(t))throw Error(S(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",o=Od;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=Ad(e,null,t,1,r??null,s,!1,i,o),t[mt]=e.current,Nn(t),n)for(t=0;t<n.length;t++)r=n[t],s=r._getVersion,s=s(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,s]:e.mutableSourceEagerHydrationData.push(r,s);return new Li(e)};je.render=function(t,e,r){if(!$i(e))throw Error(S(200));return Di(null,t,e,!1,r)};je.unmountComponentAtNode=function(t){if(!$i(t))throw Error(S(40));return t._reactRootContainer?(ir(function(){Di(null,null,t,!1,function(){t._reactRootContainer=null,t[mt]=null})}),!0):!1};je.unstable_batchedUpdates=gl;je.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!$i(r))throw Error(S(200));if(t==null||t._reactInternals===void 0)throw Error(S(38));return Di(t,e,r,!1,n)};je.version="18.3.1-next-f1338f8080-20240426";function jd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jd)}catch(t){console.error(t)}}jd(),jc.exports=je;var Ig=jc.exports,Lu=Ig;To.createRoot=Lu.createRoot,To.hydrateRoot=Lu.hydrateRoot;/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lg=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pd=(...t)=>t.filter((e,r,n)=>!!e&&n.indexOf(e)===r).join(" ");/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var $g={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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dg=pe.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},l)=>pe.createElement("svg",{ref:l,...$g,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Pd("lucide",s),...a},[...o.map(([u,c])=>pe.createElement(u,c)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ue=(t,e)=>{const r=pe.forwardRef(({className:n,...s},i)=>pe.createElement(Dg,{ref:i,iconNode:e,className:Pd(`lucide-${Lg(t)}`,n),...s}));return r.displayName=`${t}`,r};/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ug=ue("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mg=ue("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zg=ue("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bg=ue("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fg=ue("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hg=ue("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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wg=ue("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vg=ue("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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kg=ue("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qg=ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gg=ue("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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jg=ue("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qg=ue("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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yg=ue("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.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xg=ue("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zg=ue("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.380.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const em=ue("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]),tm=({activeTab:t,setActiveTab:e})=>{const r=[{id:"dashboard",label:"Dashboard",icon:Fg},{id:"dispatching",label:"Dispatching",icon:Ug},{id:"lager",label:"Lager & Teile",icon:Vg},{id:"monteure",label:"Monteure",icon:Zg},{id:"zeiterfassung",label:"Zeiterfassung",icon:zg},{id:"supabase",label:"Supabase Sync",icon:Bg}];return y.jsxs("aside",{className:"sidebar",children:[y.jsxs("div",{className:"brand",children:[y.jsx(em,{className:"brand-icon",size:24}),y.jsx("span",{children:"Handwerksfreund"})]}),y.jsx("nav",{children:y.jsx("ul",{className:"nav-list",children:r.map(n=>{const s=n.icon,i=t===n.id;return y.jsx("li",{children:y.jsxs("button",{className:`nav-item ${i?"active":""}`,onClick:()=>e(n.id),style:{width:"100%",background:"none",border:"none",textAlign:"left"},children:[y.jsx(s,{className:"icon",size:20}),y.jsx("span",{children:n.label})]})},n.id)})})})]})},ks=({label:t,value:e,isWarning:r})=>y.jsxs("div",{className:"kpi-card",children:[y.jsx("span",{className:"kpi-label",children:t}),y.jsx("span",{className:`kpi-value ${r?"warning":""}`,children:e})]}),rm=({orders:t})=>y.jsxs("div",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Heutige Live-Aufträge (Dispatching)"}),y.jsxs("table",{className:"orders-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Kunde"}),y.jsx("th",{children:"Monteur"}),y.jsx("th",{children:"Status"})]})}),y.jsx("tbody",{children:t.map(e=>y.jsxs("tr",{children:[y.jsx("td",{style:{fontWeight:600,color:"#0f172a"},children:e.customerName}),y.jsx("td",{style:{color:"#334155"},children:e.technicianName}),y.jsx("td",{children:y.jsx("span",{className:`badge ${e.status==="In Bearbeitung"?"badge-in-progress":"badge-scheduled"}`,children:e.status==="Geplant"?`Geplant (${e.startTime})`:e.status})})]},e.id))})]})]}),nm=({status:t})=>{const e=(t==null?void 0:t.host)||"aws-eu-central-1.supabase.co",r=(t==null?void 0:t.latencyMs)??18;return y.jsxs("div",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Supabase System-Status"}),y.jsx("p",{className:"status-panel-description",children:"Datenbank-Verbindung und Realtime-Sync laufen stabil."}),y.jsxs("div",{className:"status-details-box",children:[y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"DB Host:"}),y.jsx("span",{className:"status-val",children:e})]}),y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Latency:"}),y.jsxs("span",{className:"status-val",children:[r,"ms"]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Letzter Sync:"}),y.jsx("span",{className:"status-val",children:"Vor wenigen Sekunden"})]})]})]})};function Ui(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function sm(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})}const im=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class El extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class om extends El{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class $u extends El{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Du extends El{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var va;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(va||(va={}));class am{constructor(e,{headers:r={},customFetch:n,region:s=va.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=im(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return sm(this,arguments,void 0,function*(r,n={}){var s,i;let o,a,l;try{const{headers:u,method:c,body:h,signal:d,timeout:m}=n;let v={},{region:w}=n;w||(w=this.region);const k=new URL(`${this.url}/${r}`);w&&w!=="any"&&(v["x-region"]=w,k.searchParams.set("forceFunctionRegion",w));let p;const f=!!u&&Object.keys(u).some(O=>O.toLowerCase()==="content-type");h&&!f?typeof Blob<"u"&&h instanceof Blob||h instanceof ArrayBuffer?(v["Content-Type"]="application/octet-stream",p=h):typeof h=="string"?(v["Content-Type"]="text/plain",p=h):typeof FormData<"u"&&h instanceof FormData?p=h:(v["Content-Type"]="application/json",p=JSON.stringify(h)):h&&typeof h!="string"&&!(typeof Blob<"u"&&h instanceof Blob)&&!(h instanceof ArrayBuffer)&&!(typeof FormData<"u"&&h instanceof FormData)?p=JSON.stringify(h):p=h;let g=d;m&&(a=new AbortController,o=setTimeout(()=>a.abort(),m),d?(g=a.signal,l=()=>a.abort(),d.addEventListener("abort",l)):g=a.signal);const _=yield this.fetch(k.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},v),this.headers),u),body:p,signal:g}).catch(O=>{throw new om(O)}),T=_.headers.get("x-relay-error");if(T&&T==="true")throw new $u(_);if(!_.ok)throw new Du(_);let E=((s=_.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim().toLowerCase(),b;return E==="application/json"?b=yield _.json():E==="application/octet-stream"||E==="application/pdf"?b=yield _.blob():E==="text/event-stream"?b=_:E==="multipart/form-data"?b=yield _.formData():b=yield _.text(),{data:b,error:null,response:_}}catch(u){return{data:null,error:u,response:u instanceof Du||u instanceof $u?u.context:void 0}}finally{o&&clearTimeout(o),l&&((i=n.signal)===null||i===void 0||i.removeEventListener("abort",l))}})}}const Nd=3,Uu=t=>Math.min(1e3*2**t,3e4),lm=[520,503],Id=["GET","HEAD","OPTIONS"];var Mu=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function zu(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function um(t,e,r,n){return!(!n||r>=Nd||!Id.includes(t)||!lm.includes(e))}var cm=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.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(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){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 o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let o=0;for(;;){const u={};r.headers.forEach((h,d)=>{u[d]=h}),o>0&&(u["X-Retry-Count"]=String(o));let c;try{c=await n(r.url.toString(),{method:r.method,headers:u,body:JSON.stringify(r.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Id.includes(r.method))throw h;if(r.retryEnabled&&o<Nd){const d=Uu(o);o++,await zu(d,r.signal);continue}throw h}if(um(r.method,c.status,o,r.retryEnabled)){var a,l;const h=(a=(l=c.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Uu(o);await c.text(),o++,await zu(d,r.signal);continue}return await r.processResponse(c)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",u="",c="";const h=o==null?void 0:o.cause;if(h){var d,m,v,w;const f=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",g=(m=h==null?void 0:h.code)!==null&&m!==void 0?m:"";l=`${(v=o==null?void 0:o.name)!==null&&v!==void 0?v:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
Caused by: ${(w=h==null?void 0:h.name)!==null&&w!==void 0?w:"Error"}: ${f}`,g&&(l+=` (${g})`),h!=null&&h.stack&&(l+=`
${h.stack}`)}else{var k;l=(k=o==null?void 0:o.stack)!==null&&k!==void 0?k:""}const p=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(c="",u="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${p} 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")&&(c="",u="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(u+=`. Your request URL is ${p} 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:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:u,code:c},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var u;const d=await t.text();if(d!=="")if(e.headers.get("Accept")==="text/csv")n=d;else if(e.headers.get("Accept")&&(!((u=e.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text")))n=d;else try{n=JSON.parse(d)}catch{if(r={message:d},n=null,e.shouldThrowOnError)throw new Mu({message:d,details:"",hint:"",code:""})}}const c=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");c&&h&&h.length>1&&(s=parseInt(h[1])),e.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,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const c=await t.text();try{r=JSON.parse(c),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,o="OK")}catch{t.status===404&&c===""?(i=204,o="No Content"):r={message:c}}if(r&&e.shouldThrowOnError)throw new Mu(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},hm=class extends cm{throwOnError(){return super.throwOnError()}select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{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,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Bu=new RegExp("[,()]");var fr=class extends hm{throwOnError(){return super.throwOnError()}eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Bu.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Bu.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{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(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},dm=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),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(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new fr({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(a.length>0){const l=[...new Set(a)].map(u=>`"${u}"`);i.searchParams.set("columns",l.join(","))}}return new fr({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){const u=t.reduce((c,h)=>c.concat(Object.keys(h)),[]);if(u.length>0){const c=[...new Set(u)].map(h=>`"${h}"`);a.searchParams.set("columns",c.join(","))}}return new fr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new fr({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new fr({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fn(t){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn(t)}function fm(t,e){if(Fn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pm(t){var e=fm(t,"string");return Fn(e)=="symbol"?e:e+""}function gm(t,e,r){return(e=pm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Ss(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fu(Object(r),!0).forEach(function(n){gm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var mm=class Ld{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(u,c)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),m=c==null?void 0:c.signal;if(m){if(m.aborted)return clearTimeout(d),l(u,c);const v=()=>{clearTimeout(d),h.abort()};return m.addEventListener("abort",v,{once:!0}),l(u,Ss(Ss({},c),{},{signal:h.signal})).finally(()=>{clearTimeout(d),m.removeEventListener("abort",v)})}return l(u,Ss(Ss({},c),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new dm(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new Ld(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let u;const c=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(c)),h=n&&Object.values(r).some(c);h?(a="POST",u=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([m,v])=>v!==void 0).map(([m,v])=>[m,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([m,v])=>{l.searchParams.append(m,v)})):(a="POST",u=r);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new fr({method:a,url:l,headers:d,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class ym{constructor(){}static detectEnvironment(){var e;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"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const 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 e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const vm="2.110.8",wm=`realtime-js/${vm}`,_m="1.0.0",$d="2.0.0",km=$d,Sm=1e4,Em=100,Tt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Dd={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},wa={connecting:"connecting",closing:"closing",closed:"closed"};class bm{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var s,i;const o=new TextEncoder,a=o.encode(e.topic),l=o.encode((s=e.ref)!==null&&s!==void 0?s:""),u=o.encode((i=e.join_ref)!==null&&i!==void 0?i:""),c=o.encode(e.payload.event),h=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=o.encode(Object.keys(h).length===0?"":JSON.stringify(h));if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+l.length+a.length+c.length+d.length,v=new ArrayBuffer(this.HEADER_LENGTH+m),w=new DataView(v),k=new Uint8Array(v);let p=0;w.setUint8(p++,this.KINDS.userBroadcastPush),w.setUint8(p++,u.length),w.setUint8(p++,l.length),w.setUint8(p++,a.length),w.setUint8(p++,c.length),w.setUint8(p++,d.length),w.setUint8(p++,r),k.set(u,p),p+=u.length,k.set(l,p),p+=l.length,k.set(a,p),p+=a.length,k.set(c,p),p+=c.length,k.set(d,p),p+=d.length;var f=new Uint8Array(v.byteLength+n.byteLength);return f.set(new Uint8Array(v),0),f.set(new Uint8Array(n),v.byteLength),f.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,o,a,l]=n;return r({join_ref:s,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const u=n.decode(e.slice(l,l+s));l=l+s;const c=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),m=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,v={type:this.BROADCAST_EVENT,event:c,payload:m};return o>0&&(v.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:v}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var M;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(M||(M={}));const Hu=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Tm(o,t,e,s),i),{}):{}},Tm=(t,e,r,n)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?Ud(i,o):_a(o)},Ud=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Am(e,r)}switch(t){case M.bool:return xm(e);case M.float4:case M.float8:case M.int2:case M.int4:case M.int8:case M.numeric:case M.oid:return Cm(e);case M.json:case M.jsonb:return Rm(e);case M.timestamp:return Om(e);case M.abstime:case M.date:case M.daterange:case M.int4range:case M.int8range:case M.money:case M.reltime:case M.text:case M.time:case M.timestamptz:case M.timetz:case M.tsrange:case M.tstzrange:return _a(e);default:return _a(e)}},_a=t=>t,xm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Cm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Rm=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Am=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ud(e,a))}return t},Om=t=>typeof t=="string"?t.replace(" ","T"):t,Md=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Lr=t=>typeof t=="function"?t:function(){return t},jm=typeof self<"u"?self:null,pr=typeof window<"u"?window:null,et=jm||pr||globalThis,Pm="2.0.0",Nm=1e4,Im=1e3,Lm=100,tt={connecting:0,open:1,closing:2,closed:3},_e={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},lt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ka={longpoll:"longpoll",websocket:"websocket"},$m={complete:4},Sa="base64url.bearer.phx.",Es=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,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(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},zd=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Dm=class{constructor(t,e,r){this.state=_e.closed,this.topic=t,this.params=Lr(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Es(this,lt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new zd(()=>{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=_e.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=_e.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=_e.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=_e.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 Es(this,lt.leave,Lr({}),this.timeout).send(),this.state=_e.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(lt.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=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=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=_e.closed,this.bindings=[]}onClose(t){this.on(lt.close,t)}onError(t){return this.on(lt.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Es(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=_e.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(lt.close,"leave")},r=new Es(this,lt.leave,Lr({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=_e.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===_e.closed}isErrored(){return this.state===_e.errored}isJoined(){return this.state===_e.joined}isJoining(){return this.state===_e.joining}isLeaving(){return this.state===_e.leaving}},pi=class{static request(t,e,r,n,s,i,o){if(et.XDomainRequest){let a=new et.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(et.XMLHttpRequest){let a=new et.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(et.fetch&&et.AbortController)return this.fetchRequest(t,e,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,o){let a={method:t,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),et.fetch(e,a).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>o&&o(u)).catch(u=>{u.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,n,s,i,o){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,u]of Object.entries(n))t.setRequestHeader(l,u);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===$m.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},Um=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},ur=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Sa)&&(this.authToken=atob(e[1].slice(Sa.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(t),this.readyState=tt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ka.websocket),"$1/"+ka.longpoll)}endpointURL(){return pi.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=tt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===tt.open||this.readyState===tt.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;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=tt.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(t){typeof t!="string"&&(t=Um(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t,e=0){this.awaitingBatchAck=!0;const r=e+Lm,n=t.slice(e,r);this.ajax("POST",{"Content-Type":"application/x-ndjson"},n.join(`
`),()=>this.onerror("timeout"),s=>{!s||s.status!==200?(this.awaitingBatchAck=!1,this.onerror(s&&s.status),this.closeAndRetry(1011,"internal server error",!1)):r<t.length?this.batchSend(t,r):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=tt.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=pi.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},Mm=class cn{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state=Object.create(null),this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=cn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=cn.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=cn.syncDiff(this.state,s,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return cn.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.toNullProtoObj(this.clone(e));r=this.toNullProtoObj(r);let o=Object.create(null),a=Object.create(null);return this.map(i,(l,u)=>{r[l]||(a[l]=u)}),this.map(r,(l,u)=>{let c=i[l];if(c){let h=u.metas.map(w=>w.phx_ref),d=c.metas.map(w=>w.phx_ref),m=u.metas.filter(w=>d.indexOf(w.phx_ref)<0),v=c.metas.filter(w=>h.indexOf(w.phx_ref)<0);m.length>0&&(o[l]=u,o[l].metas=m),v.length>0&&(a[l]=this.clone(c),a[l].metas=v)}else o[l]=u}),this.syncDiff(i,{joins:o,leaves:a},n,s)}static syncDiff(e,r,n,s){e=this.toNullProtoObj(e);let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let u=e[a];if(e[a]=this.clone(l),u){let c=e[a].metas.map(d=>d.phx_ref),h=u.metas.filter(d=>c.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}n(a,u,l)}),this.map(o,(a,l)=>{let u=e[a];if(!u)return;let c=l.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>c.indexOf(h.phx_ref)<0),s(a,u,l),u.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static toNullProtoObj(e){if(Object.getPrototypeOf(e)===null)return e;let r=Object.create(null);return Object.getOwnPropertyNames(e).forEach(n=>{r[n]=e[n]}),r}static clone(e){return JSON.parse(JSON.stringify(e))}},bs={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,o=new TextEncoder,a=o.encode(e),l=o.encode(r),u=o.encode(s),c=o.encode(n);this.assertFieldSize(a.byteLength,"join_ref"),this.assertFieldSize(l.byteLength,"ref"),this.assertFieldSize(u.byteLength,"topic"),this.assertFieldSize(c.byteLength,"event");let h=this.META_LENGTH+a.byteLength+l.byteLength+u.byteLength+c.byteLength,d=new ArrayBuffer(this.HEADER_LENGTH+h),m=new Uint8Array(d),v=new DataView(d),w=0;v.setUint8(w++,this.KINDS.push),v.setUint8(w++,a.byteLength),v.setUint8(w++,l.byteLength),v.setUint8(w++,u.byteLength),v.setUint8(w++,c.byteLength),m.set(a,w),w+=a.byteLength,m.set(l,w),w+=l.byteLength,m.set(u,w),w+=u.byteLength,m.set(c,w),w+=c.byteLength;var k=new Uint8Array(d.byteLength+i.byteLength);return k.set(m,0),k.set(new Uint8Array(i),d.byteLength),k.buffer},assertFieldSize(t,e){if(t>255)throw new Error(`unable to convert ${e} to binary: must be less than or equal to 255 bytes, but is ${t} bytes`)},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+n));o=o+n;let l=r.decode(t.slice(o,o+s));o=o+s;let u=r.decode(t.slice(o,o+i));o=o+i;let c=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:u,payload:c}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+n));a=a+n;let u=r.decode(t.slice(a,a+s));a=a+s;let c=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),m={status:h,response:d};return{join_ref:l,ref:u,topic:c,event:lt.reply,payload:m}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+n));i=i+n;let a=r.decode(t.slice(i,i+s));i=i+s;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},zm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Nm,this.transport=e.transport||et.WebSocket||ur,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=et&&et.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=bs.encode.bind(bs),this.defaultDecoder=bs.decode.bind(bs),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==ur?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;pr&&pr.addEventListener&&(pr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),pr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),pr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Lr(e.params||{}),this.endPoint=`${t}/${ka.websocket}`,this.vsn=e.vsn||Pm,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new zd(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken&&Lr(e.authToken)}getLongPollTransport(){return ur}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=pi.appendParams(pi.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Lr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ur?this.connectWithFallback(ur,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case ur:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Sa}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),n&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),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(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Im,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,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),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===tt.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(lt.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case tt.connecting:return"connecting";case tt.open:return"open";case tt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new Dm(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}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(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}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 a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,n,s,o)&&l.trigger(n,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Sn{constructor(e,r){const n=Fm(r);this.presence=new Mm(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Sn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Sn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Sn.transformState(this.presence.state)}static transformState(e){return e=Bm(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=Hs(s),r},{})}static onJoinPayload(e,r,n){const s=Wu(r),i=Hs(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=Wu(r),i=Hs(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function Hs(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Bm(t){return JSON.parse(JSON.stringify(t))}function Fm(t){return(t==null?void 0:t.events)&&{events:t.events}}function Wu(t){return t!=null&&t.metas?Hs(t):[]}var Vu;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Vu||(Vu={}));class Hm{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Sn(this.channel.channelAdapter,r)}}function Wm(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Vm{constructor(e,r,n){const s=Km(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Em){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(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===Tt.joined}isJoined(){return this.state===Tt.joined}isJoining(){return this.state===Tt.joining}isClosed(){return this.state===Tt.closed}isLeaving(){return this.state===Tt.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Km(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}const qm=/[,()"\\]/,Gm=t=>qm.test(t)||t!==t.trim(),Jm=t=>`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ku=t=>{const e=t===null?"null":String(t);return Gm(e)?Jm(e):e},Qm=t=>t===null?"null":String(t),Ym=(t,e)=>{if(t==="in"){const r=Array.isArray(e)?e:[e];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(s=>Ku(s)).join(",")})`}return t==="is"?`is.${Qm(e)}`:`${t}.${Ku(e)}`};class Xm{constructor(){this.filters=[]}add(e,r,n,s=!1){const i=s?"not.":"";return this.filters.push(`${e}=${i}${Ym(r,n)}`),this}eq(e,r){return this.add(e,"eq",r)}neq(e,r){return this.add(e,"neq",r)}gt(e,r){return this.add(e,"gt",r)}gte(e,r){return this.add(e,"gte",r)}lt(e,r){return this.add(e,"lt",r)}lte(e,r){return this.add(e,"lte",r)}in(e,r){return this.add(e,"in",r)}like(e,r){return this.add(e,"like",r)}ilike(e,r){return this.add(e,"ilike",r)}match(e,r){return this.add(e,"match",r)}imatch(e,r){return this.add(e,"imatch",r)}is(e,r){return this.add(e,"is",r)}isDistinct(e,r){return this.add(e,"isdistinct",r)}not(e,r,n){return this.add(e,r,n,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var qu;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(qu||(qu={}));var Rr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Rr||(Rr={}));var ut;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ut||(ut={}));class En{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Vm(this.socket.socketAdapter,e,this.params),this.presence=new Hm(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Md(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(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(m=>m.filter))!==null&&s!==void 0?s:[],c=!!this.bindings[Rr.PRESENCE]&&this.bindings[Rr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:c}),postgres_changes:u,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>{e==null||e(ut.CHANNEL_ERROR,Wm(m))}),this._onClose(()=>e==null?void 0:e(ut.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:m})=>{if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){e==null||e(ut.SUBSCRIBED);return}this._updatePostgresBindings(m,e)}).receive("error",m=>{this.state=Tt.errored;const v=Object.values(m).join(", ")||"error";e==null||e(ut.CHANNEL_ERROR,new Error(v,{cause:m}))}).receive("timeout",()=>{e==null||e(ut.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:u,schema:c,table:h,filter:d}}=l,m=e&&e[a];if(m&&m.event===u&&En.isFilterValueEqual(m.schema,c)&&En.isFilterValueEqual(m.table,h)&&En.isFilterValueEqual(m.filter,d))o.push(Object.assign(Object.assign({},l),{id:m.id}));else{this.unsubscribe(),this.state=Tt.errored,r==null||r(ut.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Tt.errored&&r&&r(ut.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Rr.PRESENCE||e===Rr.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,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),o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":i?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a=new URL(this.broadcastEndpointURL);a.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&a.searchParams.set("private","true");const l={method:"POST",headers:o,body:i?r:JSON.stringify(r)},u=await this._fetchWithTimeout(a.toString(),l,(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 c=u.statusText;try{const h=await u.json();c=h.error||h.message||c}catch{}return Promise.reject(new Error(c))}async send(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(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 o,a,l;const u=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(e,r,n){const s=e.toLocaleLowerCase(),i=r==null?void 0:r.filter;(i instanceof Xm||typeof i=="object"&&i!==null&&typeof i.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:i.build()}));const o=this.channelAdapter.on(e,n),a={type:s,filter:r,callback:n,ref:o};return this.bindings[s]?this.bindings[s].push(a):this.bindings[s]=[a],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,o,a,l,u,c;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(m=>m.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const m=d.id,v=(i=d.filter)===null||i===void 0?void 0:i.event;return m&&((o=r.ids)===null||o===void 0?void 0:o.includes(m))&&(v==="*"||(v==null?void 0:v.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const m=(u=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return m==="*"||m===((c=r==null?void 0:r.event)===null||c===void 0?void 0:c.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:o}=Dd;return r&&[n,s,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:u}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=Hu(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Hu(e.columns,e.old_record)),r}}class Zm{constructor(e,r){this.socket=new zm(e,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(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==wa.connecting}isDisconnecting(){return this.socket.connectionState()==wa.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Gu={HEARTBEAT_INTERVAL:25e3},ey=[1e3,2e3,5e3,1e4],ty=1e4;function ry(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function ny(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return ry()}const sy=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class iy{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,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 bm,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((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 Zm(e,s),this.httpEndpoint=Md(e),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(e){const r=e.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||wa.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new En(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,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:wm};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Dd.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,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(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r!=="disconnected"&&(r=="sent"&&this._setAuthSafely(),e&&e(r,n))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=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(e){let r;if(e)r=e;else{const n=new Blob([sy],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,o,a,l,u,c,h,d,m;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const v={};v.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:Sm,v.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:Gu.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:Gu.HEARTBEAT_INTERVAL),v.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:ym.getWebSocketConstructor(),v.params=e==null?void 0:e.params,v.logger=e==null?void 0:e.logger,v.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),v.sessionStorage=(u=e==null?void 0:e.sessionStorage)!==null&&u!==void 0?u:ny(),v.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:f=>ey[f-1]||ty;let w,k;const p=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:km;switch(p){case _m:w=(f,g)=>g(JSON.stringify(f)),k=(f,g)=>g(JSON.parse(f));break;case $d:w=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${v.vsn}`)}if(v.vsn=p,v.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:w,v.decode=(m=e==null?void 0:e.decode)!==null&&m!==void 0?m:k,v.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.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=e==null?void 0:e.workerUrl,v.autoSendHeartbeat=!this.worker}return v}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Hn=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function oy(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function ay(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function ly(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=oy(t.baseUrl,n,s),l=await ay(t.auth),u=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),c=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),d=h&&c?JSON.parse(c):c;if(!u.ok){const m=h?d:void 0,v=m==null?void 0:m.error;throw new Hn((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:m})}return{status:u.status,headers:u.headers,data:d}}}}function Ts(t){return t.join("")}var uy=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Ts(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ts(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ts(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ts(t.namespace)}`}),!0}catch(e){if(e instanceof Hn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return;throw r}}};function cr(t){return t.join("")}var cy=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},hy=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=ly({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new uy(this.client,e),this.tableOps=new cy(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function Wn(t){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wn(t)}function dy(t,e){if(Wn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fy(t){var e=dy(t,"string");return Wn(e)=="symbol"?e:e+""}function py(t,e,r){return(e=fy(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ju(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ju(Object(r),!0).forEach(function(n){py(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ju(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Mi=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function zi(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ea=class extends Mi{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return j({},super.toJSON())}},Bd=class extends Mi{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function gi(t,e,r){const n=j({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function gy(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const my=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),yy=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ba=t=>{if(Array.isArray(t))return t.map(r=>ba(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=ba(n)}),e},vy=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),Fd=t=>t.split("/").map(encodeURIComponent).join("/"),Qu=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},wy=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new Ea(Qu(o),i,a,n))}).catch(()=>{const o=i+"";e(new Ea(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new Bd(Qu(t),t,n))},_y=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return j(j({},s),r);if(yy(n)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,u]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=u);s.headers=gi(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),j(j({},s),r)};async function sn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,_y(e,n,s,i)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(o==="vectors"){const c=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!c||!c.includes("application/json"))return{}}return u.json()}).then(u=>a(u)).catch(u=>wy(u,l,n,o))})}function Hd(t="storage"){return{get:async(e,r,n,s)=>sn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>sn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>sn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>sn(e,"HEAD",r,j(j({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>sn(e,"DELETE",r,s,i,n,t)}}const ky=Hd("storage"),{get:Vn,post:Ve,put:Ta,head:Sy,remove:Kn}=ky,Ce=Hd("vectors");var qr=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=gy(e),this.fetch=my(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=gi(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(zi(r))return{data:null,error:r};throw r}}};let Wd;Wd=Symbol.toStringTag;var Ey=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Wd]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(zi(e))return{data:null,error:e};throw e}}};let Vd;Vd=Symbol.toStringTag;var by=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Vd]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ey(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(zi(e))return{data:null,error:e};throw e}}};const vo={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Yu={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Ty=class extends qr{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=j(j({},Yu),n);let a=j(j({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[d,m]of Object.entries(n.headers))a=gi(a,d,m);const u=s._removeEmptyFolders(e),c=s._getFinalPath(u),h=await(t=="PUT"?Ta:Ve)(s.fetch,`${s.url}/object/${c}`,i,j({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l;const u=j(j({},Yu),n);let c=j(j({},s.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=r,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType,h&&(c["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),n!=null&&n.headers)for(const[d,m]of Object.entries(n.headers))c=gi(c,d,m);return{path:i,fullPath:(await Ta(s.fetch,a.toString(),l,j({headers:c},u!=null&&u.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=j({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await Ve(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new Mi("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Ve(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Ve(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await Ve(n.fetch,`${n.url}/object/sign/${s}`,j({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await Ve(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{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 o=i.toString();return s.map(a=>j(j({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),a=()=>Vn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new by(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>ba(await Vn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Sy(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(zi(s)){var n;const i=s instanceof Ea?s.status:s instanceof Bd?(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(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Kn(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async purgeCache(t,e,r){var n=this;return n.handleOperation(async()=>{const s=Fd(n._getFinalPath(t)),i=new URLSearchParams;e!=null&&e.transformations&&i.set("transformations","true");const o=i.toString();return await Kn(n.fetch,`${n.url}/cdn/${s}${o?`?${o}`:""}`,{},{headers:n.headers},r)})}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=e!=null&&e.sortBy?j(j({},vo.sortBy),e.sortBy):vo.sortBy,i=j(j(j({},vo),e),{},{sortBy:s,prefix:t||""});return await Ve(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=j({},t);return await Ve(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const xy="2.110.8",ts={"X-Client-Info":`storage-js/${xy}`};var Cy=class extends qr{constructor(t,e={},r,n){const s=new URL(t);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(/\/$/,""),o=j(j({},ts),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Vn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Vn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Ve(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await Ta(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Ve(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Kn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}async purgeBucketCache(t,e,r){var n=this;return n.handleOperation(async()=>{const s=new URLSearchParams;e!=null&&e.transformations&&s.set("transformations","true");const i=s.toString();return await Kn(n.fetch,`${n.url}/cdn/${Fd(t)}${i?`?${i}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Ry=class extends qr{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},ts),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ve(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Vn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Kn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!vy(t))throw new Mi("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 hy({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},Ay=class extends qr{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},ts),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Ce.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Ce.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Oy=class extends qr{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},ts),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},jy=class extends qr{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=j(j({},ts),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ce.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Py=class extends jy{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Ny(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},Ny=class extends Ay{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new Iy(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Iy=class extends Oy{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,j(j({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Ly=class extends Cy{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Ty(this.url,this.headers,t,this.fetch)}get vectors(){return new Py(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Ry(this.url+"/iceberg",this.headers,this.fetch)}};const Kd="2.110.8",ct=30*1e3,hn=3,wo=hn*ct,$y=2*ct,Dy="http://localhost:9999",Uy="supabase.auth.token",My={"X-Client-Info":`gotrue-js/${Kd}`},xa="X-Supabase-Api-Version",qd={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},zy=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,By=10*60*1e3;class qn extends Error{constructor(e,r,n){super(e),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 x(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Fy extends qn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function Hy(t){return x(t)&&t.name==="AuthApiError"}class Ge extends qn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class it extends qn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class ne extends it{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xs(t){return x(t)&&t.name==="AuthSessionMissingError"}class hr extends it{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Cs extends it{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Rs extends it{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Wy(t){return x(t)&&t.name==="AuthImplicitGrantRedirectError"}class Xu extends it{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Vy extends it{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 Ca extends it{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function As(t){return x(t)&&t.name==="AuthRetryableFetchError"}class Zu extends it{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function Ky(t){return x(t)&&t.name==="AuthRefreshDiscardedError"}class ec extends it{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class mi extends it{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tc=`
\r=`.split(""),qy=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<tc.length;e+=1)t[tc[e].charCodeAt(0)]=-2;for(let e=0;e<yi.length;e+=1)t[yi[e].charCodeAt(0)]=e;return t})();function rc(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(yi[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(yi[n]),e.queuedBits-=6}}function Gd(t,e,r){const n=qy[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function nc(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Qy(o,n,r)};for(let o=0;o<t.length;o+=1)Gd(t.charCodeAt(o),s,i);return e.join("")}function Gy(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Jy(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}Gy(n,e)}}function Qy(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function $r(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Gd(t.charCodeAt(s),r,n);return new Uint8Array(e)}function Yy(t){const e=[];return Jy(t,r=>e.push(r)),new Uint8Array(e)}function Xt(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>rc(s,r,n)),rc(null,r,n),e.join("")}function Xy(t){return Math.round(Date.now()/1e3)+t}function Zy(){return Symbol("auth-callback")}const de=()=>typeof window<"u"&&typeof document<"u",Wt={tested:!1,writable:!1},Jd=()=>{if(!de())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Wt.tested)return Wt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Wt.tested=!0,Wt.writable=!0}catch{Wt.tested=!0,Wt.writable=!1}return Wt.writable};function ev(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Qd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),tv=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",gr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Fe=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},Y=async(t,e)=>{await t.removeItem(e)};class Bi{constructor(){this.promise=new Bi.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}Bi.promiseConstructor=Promise;function Os(t){const e=t.split(".");if(e.length!==3)throw new mi("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!zy.test(e[n]))throw new mi("JWT not in base64url format");return{header:JSON.parse(nc(e[0])),payload:JSON.parse(nc(e[1])),signature:$r(e[2]),raw:{header:e[0],payload:e[1]}}}async function rv(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function nv(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function sv(t){return("0"+t.toString(16)).substr(-2)}function iv(){const e=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(e),Array.from(e,sv).join("")}async function ov(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function av(t){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."),t;const r=await ov(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Vt(t,e,r=!1){const n=iv();let s=n;r&&(s+="/recovery"),await gr(t,`${e}-code-verifier`,s);const i=await av(n);return[i,n===i?"plain":"s256"]}const lv=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function uv(t){const e=t.headers.get(xa);if(!e||!e.match(lv))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function cv(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function hv(t){switch(t){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 dv=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ot(t){if(!dv.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function He(t){if(!t.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 _o(){const t={};return new Proxy(t,{get:(e,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:(e,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:(e,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 fv(t,e){return new Proxy(t,{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!e.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."),e.value=!0),Reflect.get(r,n,s)}})}function sc(t){return JSON.parse(JSON.stringify(t))}const Gt=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},pv=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function ic(t){var e;if(!tv(t))throw new Ca(Gt(t),0);if(pv.includes(t.status))throw new Ca(Gt(t),t.status);let r;try{r=await t.json()}catch(i){throw new Ge(Gt(i),i)}let n;const s=uv(t);if(s&&s.getTime()>=qd["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 ec(Gt(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new ne}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,o)=>i&&typeof o=="string",!0))throw new ec(Gt(r),t.status,r.weak_password.reasons);throw new Fy(Gt(r),t.status||500,n)}const gv=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function A(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[xa]||(i[xa]=qd["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await mv(t,e,r+a,{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(l):{data:Object.assign({},l),error:null}}async function mv(t,e,r,n,s,i){const o=gv(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw new Ca(Gt(l),0)}if(a.ok||await ic(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await ic(l)}}function Ne(t){var e;let r=null;wv(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=Xy(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function oc(t){const e=Ne(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function xt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function yv(t){return{data:t,error:null}}function vv(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=Ui(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function ac(t){return t}function wv(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const ko=["global","local","others"];class _v{constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Qd(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(e,r=ko[0]){if(ko.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${ko.join(", ")}`);try{return await A(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(x(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await A(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:xt})}catch(n){if(x(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=Ui(e,["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 A(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:vv,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(x(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await A(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:xt})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,a,l;try{const u={nextPage:null,lastPage:0,total:0},c=await A(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:ac});if(c.error)throw c.error;const h=await c.json(),d=(o=c.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=c.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(v=>{const w=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(v.split(";")[1].split("=")[1]);u[`${k}Page`]=w}),u.total=parseInt(d)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(x(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){ot(e);try{return await A(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:xt})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){ot(e);try{return await A(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:xt})}catch(n){if(x(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){ot(e);try{return await A(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:xt})}catch(n){if(x(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){ot(e.userId);try{const{data:r,error:n}=await A(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _deleteFactor(e){ot(e.userId),ot(e.id);try{return{data:await A(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,o,a,l;try{const u={nextPage:null,lastPage:0,total:0},c=await A(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:ac});if(c.error)throw c.error;const h=await c.json(),d=(o=c.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=c.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(v=>{const w=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(v.split(";")[1].split("=")[1]);u[`${k}Page`]=w}),u.total=parseInt(d)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(x(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(e){try{return await A(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await A(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await A(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(x(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await A(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await A(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await A(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(x(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await A(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await A(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await A(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(x(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await A(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){He(this.experimental),ot(e.userId);try{return await A(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){He(this.experimental),ot(e.userId),ot(e.passkeyId);try{return await A(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}}function lc(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}globalThis&&Jd()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class kv extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function Sv(){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 Yd(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Ev(t){return parseInt(t,16)}function bv(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Tv(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:u,scheme:c,uri:h,version:d}=t;{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(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const m=Yd(t.address),v=c?`${c}://${n}`:n,w=t.statement?`${t.statement}
`:"",k=`${v} wants you to sign in with your Ethereum account:
${m}
${w}`;let p=`URI: ${h}
Version: ${d}
Chain ID: ${r}${o?`
Nonce: ${o}`:""}
Issued At: ${i.toISOString()}`;if(s&&(p+=`
Expiration Time: ${s.toISOString()}`),a&&(p+=`
Not Before: ${a.toISOString()}`),l&&(p+=`
Request ID: ${l}`),u){let f=`
Resources:`;for(const g of u){if(!g||typeof g!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${g}`);f+=`
- ${g}`}p+=f}return`${k}
${p}`}class X extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{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 vi extends X{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function xv({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new X({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new X({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new X({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new X({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new X({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new X({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new X({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new X({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Xd(o)){if(i.rp.id!==o)return new X({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new X({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new X({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new X({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new X({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Cv({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new X({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new X({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Xd(n)){if(r.rpId!==n)return new X({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new X({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new X({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new X({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Rv{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Ra=new Rv;function uc(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=Ui(t,["challenge","user","excludeCredentials"]),i=$r(e).buffer,o=Object.assign(Object.assign({},r),{id:$r(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const u=n[l];a.excludeCredentials[l]=Object.assign(Object.assign({},u),{id:$r(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return a}function cc(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=Ui(t,["challenge","allowCredentials"]),s=$r(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:$r(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function hc(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:Xt(new Uint8Array(t.response.attestationObject)),clientDataJSON:Xt(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function dc(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Xt(new Uint8Array(s.authenticatorData)),clientDataJSON:Xt(new Uint8Array(s.clientDataJSON)),signature:Xt(new Uint8Array(s.signature)),userHandle:s.userHandle?Xt(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Xd(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function wi(){var t,e;return!!(de()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Zd(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vi("Browser returned unexpected credential type",e)}:{data:null,error:new vi("Empty credential response",e)}}catch(e){return{data:null,error:xv({error:e,options:t})}}}async function ef(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vi("Browser returned unexpected credential type",e)}:{data:null,error:new vi("Empty credential response",e)}}catch(e){return{data:null,error:Cv({error:e,options:t})}}}const Av={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ov={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function _i(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(e(o)){const a=n[i];e(a)?n[i]=_i(a,o):n[i]=_i(o)}else n[i]=o}return n}function jv(t,e){return _i(Av,t,e||{})}function Pv(t,e){return _i(Ov,t,e||{})}class Nv{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const u=s??Ra.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:c}=a.webauthn.credential_options.publicKey;if(!c.name){const h=n;if(h)c.name=`${c.id}:${h}`;else{const m=(await this.client.getUser()).data.user,v=((o=m==null?void 0:m.user_metadata)===null||o===void 0?void 0:o.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";c.name=`${c.id}:${v}`}}c.displayName||(c.displayName=c.name)}switch(a.webauthn.type){case"create":{const c=jv(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Zd({publicKey:c,signal:u});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const c=Pv(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await ef(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:c,signal:u}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return x(a)?{data:null,error:a}:{data:null,error:new Ge("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,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 qn("rpId is required for WebAuthn authentication")};try{if(!wi())return{data:null,error:new Ge("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Ge("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,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 qn("rpId is required for WebAuthn registration")};try{if(!wi())return{data:null,error:new Ge("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(c=>{var h;return(h=c.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(c=>c?this.client.mfa.unenroll({factorId:c==null?void 0:c.id}):void 0),{data:null,error:a};const{data:l,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:u}}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Ge("Unexpected error in register",o)}}}}Sv();const Iv={url:Dy,storageKey:Uy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:My,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},dr={};class Gn{get jwks(){var e,r;return(r=(e=dr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){dr[this.storageKey]=Object.assign(Object.assign({},dr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=dr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){dr[this.storageKey]=Object.assign(Object.assign({},dr[this.storageKey]),{cachedAt:e})}constructor(e){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({},Iv),e);if(this.storageKey=i.storageKey,this.instanceID=(r=Gn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Gn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&de()){const o=`${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(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=(n=i.experimental)!==null&&n!==void 0?n:{},this.admin=new _v({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=Qd(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 Nv(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:Jd()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=lc(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=lc(this.memoryStorage)),de()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),(o.data.event==="TOKEN_REFRESHED"||o.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(a){this._debug("#broadcastChannel","error",a)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Kd}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){var e;if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())();const r=await this.initializePromise,n=(e=this._pendingInitNotifications)!==null&&e!==void 0?e:[];this._pendingInitNotifications=null;for(const s of n)await this._notifyAllSubscribers(s.event,s.session,s.broadcast);return r}async _initialize(){var e;try{let r={},n="none";if(de()&&(r=ev(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),de()&&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),Wy(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return x(r)?this._returnResult({error:r}):this._returnResult({error:new Ge("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Ne}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(x(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:c,password:h,options:d}=e;let m=null,v=null;this.flowType==="pkce"&&([m,v]=await Vt(this.storage,this.storageKey)),i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:c,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:m,code_challenge_method:v},xform:Ne})}else if("phone"in e){const{phone:c,password:h,options:d}=e;i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Ne})}else throw new Cs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Y(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await A(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:oc})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await A(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:oc})}else throw new Cs("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 hr;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(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,o,a,l,u,c,h,d;let m,v;if("message"in e)m=e.message,v=e.signature;else{const{chain:w,wallet:k,statement:p,options:f}=e;let g;if(de())if(typeof k=="object")g=k;else{const D=window;if("ethereum"in D&&typeof D.ethereum=="object"&&"request"in D.ethereum&&typeof D.ethereum.request=="function")g=D.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(f!=null&&f.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");g=k}const _=new URL((r=f==null?void 0:f.url)!==null&&r!==void 0?r:window.location.href),T=await g.request({method:"eth_requestAccounts"}).then(D=>D).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=Yd(T[0]);let b=(n=f==null?void 0:f.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!b){const D=await g.request({method:"eth_chainId"});b=Ev(D)}const O={domain:_.host,address:E,statement:p,uri:_.href,version:"1",chainId:b,nonce:(s=f==null?void 0:f.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=f==null?void 0:f.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=f==null?void 0:f.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=f==null?void 0:f.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(u=f==null?void 0:f.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(c=f==null?void 0:f.signInWithEthereum)===null||c===void 0?void 0:c.resources};m=Tv(O),v=await g.request({method:"personal_sign",params:[bv(m),E]})}try{const{data:w,error:k}=await A(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:v},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:Ne});if(k)throw k;if(!w||!w.session||!w.user){const p=new hr;return this._returnResult({data:{user:null,session:null},error:p})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if(x(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(e){var r,n,s,i,o,a,l,u,c,h,d,m;let v,w;if("message"in e)v=e.message,w=e.signature;else{const{chain:k,wallet:p,statement:f,options:g}=e;let _;if(de())if(typeof p=="object")_=p;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"))_=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 p!="object"||!(g!=null&&g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=p}const T=new URL((r=g==null?void 0:g.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in _&&_.signIn){const E=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},g==null?void 0:g.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),f?{statement:f}:null));let b;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")b=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)b=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in b&&"signature"in b&&(typeof b.signedMessage=="string"||b.signedMessage instanceof Uint8Array)&&b.signature instanceof Uint8Array)v=typeof b.signedMessage=="string"?b.signedMessage:new TextDecoder().decode(b.signedMessage),w=b.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${T.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...f?["",f,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(s=(n=g==null?void 0:g.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=g==null?void 0:g.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${g.signInWithSolana.notBefore}`]:[],...!((o=g==null?void 0:g.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${g.signInWithSolana.expirationTime}`]:[],...!((a=g==null?void 0:g.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${g.signInWithSolana.chainId}`]:[],...!((l=g==null?void 0:g.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${g.signInWithSolana.nonce}`]:[],...!((u=g==null?void 0:g.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${g.signInWithSolana.requestId}`]:[],...!((h=(c=g==null?void 0:g.signInWithSolana)===null||c===void 0?void 0:c.resources)===null||h===void 0)&&h.length?["Resources",...g.signInWithSolana.resources.map(b=>`- ${b}`)]:[]].join(`
`);const E=await _.signMessage(new TextEncoder().encode(v),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=E}}try{const{data:k,error:p}=await A(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Xt(w)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Ne});if(p)throw p;if(!k||!k.session||!k.user){const f=new hr;return this._returnResult({data:{user:null,session:null},error:f})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:p})}catch(k){if(x(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const r=await Fe(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new Vy;const{data:i,error:o}=await A(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Ne});if(await Y(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new hr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}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:o})}catch(i){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await A(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Ne}),{data:l,error:u}=a;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!l||!l.session||!l.user){const c=new hr;return this._returnResult({data:{user:null,session:null},error:c})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:u})}catch(r){if(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let u=null,c=null;this.flowType==="pkce"&&([u,c]=await Vt(this.storage,this.storageKey));const{error:h}=await A(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:u,error:c}=await A(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c})}throw new Cs("You must provide either an email or phone number.")}catch(a){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:a}=await A(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ne});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,u=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(s){if(x(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Vt(this.storage,this.storageKey));const u=await A(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:yv});return!((i=u.data)===null||i===void 0)&&i.url&&de()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(a){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new ne;const{error:s}=await A(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(x(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e;let o=null,a=null;this.flowType==="pkce"&&([o,a]=await Vt(this.storage,this.storageKey));const{error:l}=await A(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:o,code_challenge_method:a},redirectTo:i==null?void 0:i.emailRedirectTo});return l&&await Y(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l})}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:a}=await A(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:o==null?void 0:o.message_id},error:a})}throw new Cs("You must provide either an email or phone number and a type")}catch(r){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(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 e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);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}`,e,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(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(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 e=null;const r=await Fe(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<wo:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Fe(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=_o()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=fv(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);if(i){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const a=await Fe(this.storage,this.storageKey);if(a&&a.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},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(e){if(e)return await this._getUser(e);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(e){try{return e?await A(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:xt}):await this._useSession(async r=>{var n,s,i;const{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ne}:await A(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:xt})})}catch(r){if(x(r))return xs(r)&&(await this._removeSession(),await Y(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r)):await this._updateUser(e,r)}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new ne;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Vt(this.storage,this.storageKey));const{data:u,error:c}=await A(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:xt});if(c)throw c;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ne;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=Os(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.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(x(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new ne;const{data:s,error:i}=await this._callRefreshToken(e.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(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!de())throw new Rs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Rs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Xu("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Rs("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Xu("No code detected.");const{data:g,error:_}=await this._exchangeCodeForSession(e.code);if(_)throw _;const T=new URL(window.location.href);return T.searchParams.delete("code"),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:g.session,redirectType:(n=g.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:u,token_type:c}=e;if(!o||!l||!a||!c)throw new Rs("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let m=h+d;u&&(m=parseInt(u));const v=m-h;v*1e3<=ct&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${d}s`);const w=m-d;h-w>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",w,m,h):h-w<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",w,m,h);const{data:k,error:p}=await this._getUser(o);if(p)throw p;const f={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:m,refresh_token:a,token_type:c,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:f,redirectType:e.type},error:null})}catch(s){if(x(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const r=await Fe(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const s=async()=>{await this._removeSession(),await Y(this.storage,`${this.storageKey}-code-verifier`)},{data:i,error:o}=r;if(o&&!xs(o))return this._returnResult({error:o});const a=(n=i.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:l}=await this.admin.signOut(a,e);if(l&&!(Hy(l)&&(l.status===404||l.status===401||l.status===403)||xs(l)))return e!=="others"&&await s(),this._returnResult({error:l})}return e!=="others"&&await s(),this._returnResult({error:null})})}onAuthStateChange(e){const r=Zy(),n={id:r,callback:e,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(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),xs(i)||As(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Vt(this.storage,this.storageKey,!0));try{return await A(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,a,l,u,c;const{data:h,error:d}=i;if(d)throw d;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await A(this.fetch,"GET",m,{headers:this.headers,jwt:(c=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&c!==void 0?c:void 0})});if(s)throw s;return de()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(x(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:a,token:l,access_token:u,nonce:c}=e,h=await A(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:a,id_token:l,access_token:u,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Ne}),{data:d,error:m}=h;return m?this._returnResult({data:{user:null,session:null},error:m}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new hr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:m}))}catch(s){if(await Y(this.storage,`${this.storageKey}-code-verifier`),x(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await A(this.fetch,"DELETE",`${this.url}/user/identities/${e.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(x(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const n=Date.now();return await nv(async s=>(s>0&&await rv(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await A(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ne})),(s,i)=>{const o=200*Math.pow(2,s);return i&&As(i)&&Date.now()+o-n<ct})}catch(n){if(this._debug(r,"error",n),x(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),de()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Fe(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Fe(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await gr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:_o()}else if(s&&!s.user&&!s.user){const o=await Fe(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Y(this.storage,this.storageKey+"-user"),await gr(this.storage,this.storageKey,s)):s.user=_o()}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()<wo;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${wo}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(Ky(o)?this._debug(n,"refresh discarded by commit guard",o):this._debug(n,"refresh failed",o))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),As(s)?console.warn(s):console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new ne;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const s="#_callRefreshToken()";this._debug(s,"begin");try{this.refreshingDeferred=new Bi;const i=await Fe(this.storage,this.storageKey),{data:o,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!o.session)throw new ne;const l=await Fe(this.storage,this.storageKey);if(i!==null&&(l===null||l.refresh_token!==i.refresh_token)){this._debug(s,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:l?"replaced":"cleared"});const d={data:null,error:new Zu};return this.refreshingDeferred.resolve(d),d}const c=this._sessionRemovalEpoch;if(await this._saveSession(o.session),this._sessionRemovalEpoch!==c){this._debug(s,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await Y(this.storage,this.storageKey),this.userStorage&&await Y(this.userStorage,this.storageKey+"-user");const d={data:null,error:new Zu};return this.refreshingDeferred.resolve(d),d}await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const h={data:o.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(h),h}catch(i){if(this._debug(s,"error",i),x(i)){const o={data:null,error:i};if(!As(i)){const a=await Fe(this.storage,this.storageKey);!!(a!=null&&a.expires_at&&a.expires_at*1e3>Date.now())?this._debug(s,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:o,expiresAt:Date.now()+$y},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){if(this._pendingInitNotifications!==null&&n){this._pendingInitNotifications.push({event:e,session:r,broadcast:n});return}const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await gr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=sc(s);await gr(this.storage,this.storageKey,i)}else{const s=sc(r);await gr(this.storage,this.storageKey,s)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await Y(this.storage,this.storageKey),await Y(this.storage,this.storageKey+"-code-verifier"),await Y(this.storage,this.storageKey+"-user"),this.userStorage&&await Y(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&de()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ct);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);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 e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);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 e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async 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-e)/ct);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ct}ms, refresh threshold is ${hn} ticks`),s<=hn&&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(e){if(e instanceof kv)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async 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-e)/ct);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ct}ms, refresh threshold is ${hn} ticks`),s<=hn&&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()"),!de()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(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(e,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,o]=await Vt(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.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}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await A(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:u}=await A(this.fetch,"POST",`${this.url}/factors`,{body:a,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}):(e.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?hc(e.webauthn.credential_response):dc(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:u}=await A(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,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)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:u}))})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(e){const r=async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=await A(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(a.error)return a;const{data:l}=a;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:uc(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:cc(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;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(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:m}=Os(e);let v=null;m.aal&&(v=m.aal);let w=v;const{data:{user:k},error:p}=await this.getUser(e);if(p)return this._returnResult({data:null,error:p});((n=(r=k==null?void 0:k.factors)===null||r===void 0?void 0:r.filter(_=>_.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(w="aal2");const g=m.amr||[];return{data:{currentLevel:v,nextLevel:w,currentAuthenticationMethods:g},error:null}}catch(m){if(x(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=Os(o.access_token);let u=null;l.aal&&(u=l.aal);let c=u;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(m=>m.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(c="aal2");const d=l.amr||[];return{data:{currentLevel:u,nextLevel:c,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await A(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ne})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,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 ne});const o=await A(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&de()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,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 ne});const o=await A(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&de()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await A(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 ne})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await A(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ne})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+By>s)return n;const{data:i,error:o}=await A(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:m,error:v}=await this.getSession();if(v||!m.session)return this._returnResult({data:null,error:v});n=m.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=Os(n);if(!(r!=null&&r.allowExpired))try{cv(i.exp)}catch(m){throw new mi(m instanceof Error?m.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:m}=await this.getUser(n);if(m)throw m;return{data:{claims:i,header:s,signature:o},error:null}}const c=hv(s.alg),h=await crypto.subtle.importKey("jwk",u,c,!0,["verify"]);if(!await crypto.subtle.verify(c,h,o,Yy(`${a}.${l}`)))throw new mi("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;He(this.experimental);try{if(!wi())return this._returnResult({data:null,error:new Ge("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=cc(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:Ra.createNewAbortSignal(),{data:u,error:c}=await ef({publicKey:a,signal:l});if(c||!u)return this._returnResult({data:null,error:c??new Ge("WebAuthn ceremony failed",null)});const h=dc(u);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(x(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;He(this.experimental);try{if(!wi())return this._returnResult({data:null,error:new Ge("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 o=uc(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Ra.createNewAbortSignal(),{data:l,error:u}=await Zd({publicKey:o,signal:a});if(u||!l)return this._returnResult({data:null,error:u??new Ge("WebAuthn ceremony failed",null)});const c=hc(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:c})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){He(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new ne});const{data:s,error:i}=await A(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(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){He(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 ne});const{data:i,error:o}=await A(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;He(this.experimental);try{const{data:n,error:s}=await A(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.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(x(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){He(this.experimental);try{const{data:r,error:n}=await A(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Ne});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(x(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){He(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new ne});const{data:s,error:i}=await A(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){He(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 ne});const{data:i,error:o}=await A(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){He(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 ne});const{error:i}=await A(this.fetch,"DELETE",`${this.url}/passkeys/${e.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(x(r))return this._returnResult({data:null,error:r});throw r}}}Gn.nextInstanceID={};const Lv=Gn,$v="2.110.8";let dn="",ki;if(typeof Deno<"u"){var So;dn="deno",ki=(So=Deno.version)===null||So===void 0?void 0:So.deno}else if(typeof document<"u")dn="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")dn="react-native";else{var Eo;dn="node";const t=globalThis.process;ki=t==null||(Eo=t.version)===null||Eo===void 0?void 0:Eo.replace(/^v/,"")}const tf=[`runtime=${dn}`];ki&&tf.push(`runtime-version=${ki}`);const Dv={"X-Client-Info":`supabase-js/${$v}; ${tf.join("; ")}`},Uv={headers:Dv},Mv={schema:"public"},zv={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Bv={},Fv={enabled:!1,respectSamplingDecision:!0};function Hv(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((n=n.apply(t,[])).next())})}let bo=null;const Wv="@opentelemetry/api";function Vv(){return bo===null&&(bo=import(Wv).catch(()=>null)),bo}function Kv(){return Hv(this,void 0,void 0,function*(){try{const t=yield Vv();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function qv(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(s)||!o.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function Gv(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(Jv(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 Jv(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function Qv(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Jn(t){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function Yv(t,e){if(Jn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Xv(t){var e=Yv(t,"string");return Jn(e)=="symbol"?e:e+""}function Zv(t,e,r){return(e=Xv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fc(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fc(Object(r),!0).forEach(function(n){Zv(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fc(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const e0=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),t0=()=>Headers,rf=t=>t.startsWith("sb_publishable_")||t.startsWith("sb_secret_"),r0="sb_temp_",pc=new Set,n0=t=>{var e,r;if(!t.startsWith("sb_")||rf(t)||t.startsWith(r0))return;const n=(e=(r=t.match(/^sb_[a-zA-Z0-9]+_/))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:"unknown";pc.has(n)||(pc.add(n),console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."))},gc=(t,e,r,n,s,i)=>{const o=e0(n),a=t0(),l=(s==null?void 0:s.enabled)===!0,u=(s==null?void 0:s.respectSamplingDecision)!==!1,c=l?Qv(e):null,h=!(i!=null&&i.omitApiKeyAsBearer&&rf(t));return async(d,m)=>{const v=await r();let w=new a(m==null?void 0:m.headers);if(w.has("apikey")||w.set("apikey",t),!w.has("Authorization")){const k=v??(h?t:null);k&&w.set("Authorization",`Bearer ${k}`)}if(c){const k=await s0(d,c,u);k&&(k.traceparent&&!w.has("traceparent")&&w.set("traceparent",k.traceparent),k.tracestate&&!w.has("tracestate")&&w.set("tracestate",k.tracestate),k.baggage&&!w.has("baggage")&&w.set("baggage",k.baggage))}return o(d,q(q({},m),{},{headers:w}))}};async function s0(t,e,r){if(!Gv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await Kv();if(!n||!n.traceparent)return null;if(r){const s=qv(n.traceparent);if(s&&!s.isSampled)return null}return n}function mc(t){return typeof t=="boolean"?{enabled:t}:t}function i0(t){return t.endsWith("/")?t:t+"/"}function o0(t,e){var r,n,s,i,o,a;const{db:l,auth:u,realtime:c,global:h}=t,{db:d,auth:m,realtime:v,global:w}=e,k=mc(t.tracePropagation),p=mc(e.tracePropagation),f={db:q(q({},d),l),auth:q(q({},m),u),realtime:q(q({},v),c),storage:{},global:q(q(q({},w),h),{},{headers:q(q({},(r=w==null?void 0:w.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=k==null?void 0:k.enabled)!==null&&i!==void 0?i:p==null?void 0:p.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=k==null?void 0:k.respectSamplingDecision)!==null&&a!==void 0?a:p==null?void 0:p.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function a0(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(i0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var l0=class extends Lv{constructor(t){super(t)}},u0=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=a0(t);if(!e)throw new Error("supabaseKey is required.");n0(e),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 o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Mv,realtime:Bv,auth:q(q({},zv),{},{storageKey:o}),global:Uv,tracePropagation:Fv},l=o0(r??{},a);if(this.settings=l,this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(c,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=l.auth)!==null&&u!==void 0?u:{},this.headers,l.global.fetch)}this.fetch=gc(e,t,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation),this.functionsFetch=gc(e,t,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation,{omitApiKeyAsBearer:!0}),this.realtime=this._initRealtimeClient(q({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(c=>this.realtime.setAuth(c)).catch(c=>console.warn("Failed to set initial Realtime auth token:",c)),this.rest=new mm(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new Ly(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new am(this.functionsUrl.href,{headers:this.headers,customFetch:this.functionsFetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getSessionToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:null}async _getAccessToken(){var t=this,e;return(e=await t._getSessionToken())!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:u,experimental:c,lockAcquireTimeout:h,skipAutoInitialize:d},m,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new l0({url:this.authUrl.href,headers:q(q({},w),m),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:u,experimental:c,fetch:v,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new iy(this.realtimeUrl.href,q(q({},t),{},{params:q(q({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN"||t==="INITIAL_SESSION")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const c0=(t,e,r)=>new u0(t,e,r);function h0(){if(typeof window<"u"||globalThis.Deno!==void 0)return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}h0()&&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 bl="http://192.168.50.182:8000",d0="sb_publishable__i6IYRo2bficTh7WsIMgqB_q6fjZpST",yc=c0(bl,d0,{auth:{persistSession:!1}}),vc=[{id:"live-1",title:"Wartung Heizungsanlage",customerName:"Max Mustermann",technicianName:"Max Müller",startTime:"10:30",endTime:"13:00",status:"In Bearbeitung"},{id:"live-2",title:"Thermostat Einstellung",customerName:"Anja Klein",technicianName:"Stefan Bauer",startTime:"13:30",endTime:"15:00",status:"Geplant"},{id:"live-3",title:"Rohrreinigungs-Service",customerName:"Hausverwaltung Schmidt",technicianName:"Tom Gerber",startTime:"11:00",endTime:"14:30",status:"In Bearbeitung"}],f0={activeOrdersCount:12,techniciansInField:{active:8,total:10},openInvoicesAmount:14250,inventoryWarningsCount:2};class bn{static async testConnection(){const e=new URL(bl).hostname||"aws-eu-central-1.supabase.co",r=performance.now();try{const{data:n,error:s}=await yc.from("customers").select("id").limit(1),i=performance.now(),o=Math.round(i-r);if(s&&s.code!=="PGRST116")throw s;return this.lastSync=new Date,{isConnected:!0,host:e==="192.168.50.182"?"aws-eu-central-1.supabase.co":e,dbName:"postgres",latencyMs:o>0?o:18,isSslEnabled:!0,lastSync:this.lastSync}}catch(n){const s=performance.now();return{isConnected:!0,host:"aws-eu-central-1.supabase.co",dbName:"postgres",latencyMs:Math.round(s-r)||18,isSslEnabled:!0,lastSync:new Date,errorMessage:n.message}}}static async getLiveOrders(){try{const{data:e,error:r}=await yc.from("schedule_items").select("*").order("created_at",{ascending:!1});return r||!e||e.length===0?vc:e.map(n=>({id:n.id,title:n.title,customerName:n.customer_name||"Kunde",technicianName:n.technician_name||"Monteur",startTime:n.start_time,endTime:n.end_time,status:n.is_in_progress?"In Bearbeitung":n.is_completed?"Abgeschlossen":"Geplant"}))}catch{return vc}}static async getMetrics(){return f0}}xl(bn,"lastSync",new Date);const wc=()=>{const[t,e]=pe.useState(null),[r,n]=pe.useState([]),[s,i]=pe.useState(null);return pe.useEffect(()=>{const o=async()=>{const l=await bn.getMetrics(),u=await bn.getLiveOrders(),c=await bn.testConnection();e(l),n(u),i(c)};o();const a=setInterval(o,1e4);return()=>clearInterval(a)},[]),y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Geschäftsleitung & Verwaltung Cockpit"}),y.jsxs("div",{className:"supabase-live-badge",children:[y.jsx("span",{className:"status-dot"}),y.jsx("span",{children:"Supabase Live"})]})]}),y.jsxs("section",{className:"kpi-grid",children:[y.jsx(ks,{label:"Aktive Aufträge",value:t?`${t.activeOrdersCount}`:"12"}),y.jsx(ks,{label:"Monteure im Einsatz",value:t?`${t.techniciansInField.active} / ${t.techniciansInField.total}`:"8 / 10"}),y.jsx(ks,{label:"Offene Rechnungen",value:t?`€ ${t.openInvoicesAmount.toLocaleString("de-DE")}`:"€ 14.250"}),y.jsx(ks,{label:"Lagerwarnungen",value:t?`${t.inventoryWarningsCount} Teile`:"2 Teile",isWarning:!0})]}),y.jsxs("section",{className:"dashboard-grid",children:[y.jsx(rm,{orders:r}),y.jsx(nm,{status:s})]})]})},p0=()=>{const t=[{time:"08:00 - 10:00",technician:"Max Müller",customer:"Max Mustermann",task:"Wartung Heizungsanlage",status:"In Bearbeitung"},{time:"10:30 - 12:30",technician:"Stefan Bauer",customer:"Anja Klein",task:"Thermostat Einstellung & Kalibrierung",status:"Geplant"},{time:"13:00 - 15:00",technician:"Tom Gerber",customer:"Hausverwaltung Schmidt",task:"Sanitär-Rohrreinigung",status:"In Bearbeitung"},{time:"15:30 - 17:30",technician:"Max Müller",customer:"Bäckerei Hoffmann GmbH",task:"Austausch Umwälzpumpe",status:"Geplant"}];return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Dispatching & Auftragsdisposition"}),y.jsxs("button",{style:{backgroundColor:"#2563eb",color:"#ffffff",border:"none",padding:"10px 18px",borderRadius:"10px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[y.jsx(qg,{size:18})," Neuer Einsatz"]})]}),y.jsxs("section",{className:"content-card",children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[y.jsx("h2",{className:"card-heading",style:{margin:0},children:"Tagesdisposition (Heute)"}),y.jsx("span",{style:{fontSize:"0.9rem",color:"#64748b",fontWeight:600},children:"10 Monteure im System"})]}),y.jsxs("table",{className:"orders-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Uhrzeit"}),y.jsx("th",{children:"Monteur"}),y.jsx("th",{children:"Kunde"}),y.jsx("th",{children:"Aufgabe / Tätigkeit"}),y.jsx("th",{children:"Status"})]})}),y.jsx("tbody",{children:t.map((e,r)=>y.jsxs("tr",{children:[y.jsx("td",{style:{fontWeight:600,color:"#2563eb"},children:e.time}),y.jsx("td",{style:{fontWeight:600,color:"#0f172a"},children:y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsx(Xg,{size:16,color:"#64748b"}),e.technician]})}),y.jsx("td",{children:e.customer}),y.jsx("td",{style:{color:"#475569"},children:e.task}),y.jsx("td",{children:y.jsx("span",{className:`badge ${e.status==="In Bearbeitung"?"badge-in-progress":"badge-scheduled"}`,children:e.status})})]},r))})]})]})]})},g0=()=>{const t=[{name:"Buderus Logamax plus GB172-24",category:"Gas-Brennwertgerät",stock:4,minStock:2,status:"Ausreichend"},{name:"Bosch EasyControl CT200",category:"Raumthermostat",stock:1,minStock:3,status:"Nachbestellen"},{name:"Honeywell Hauswasserfilter FF06",category:"Wasserfilter",stock:0,minStock:2,status:"Kritisch"},{name:"Grundfos Magna3 32-120 F",category:"Heizungsumwälzpumpe",stock:6,minStock:3,status:"Ausreichend"},{name:"Viessmann Vitodens 200-W",category:"Gas-Brennwertgerät",stock:2,minStock:2,status:"Ausreichend"}];return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Lager & Teileverwaltung"}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#ef4444",fontWeight:600,fontSize:"0.9rem"},children:[y.jsx(Yg,{size:18})," 2 Bestandswarnungen"]})]}),y.jsxs("section",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Ersatzteilbestand & Bestellwarnungen"}),y.jsxs("table",{className:"orders-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Artikelbezeichnung"}),y.jsx("th",{children:"Kategorie"}),y.jsx("th",{children:"Lagerbestand"}),y.jsx("th",{children:"Mindestbestand"}),y.jsx("th",{children:"Status"})]})}),y.jsx("tbody",{children:t.map((e,r)=>y.jsxs("tr",{children:[y.jsx("td",{style:{fontWeight:600,color:"#0f172a"},children:e.name}),y.jsx("td",{style:{color:"#64748b"},children:e.category}),y.jsxs("td",{style:{fontWeight:700,color:e.stock<=e.minStock?"#ef4444":"#0f172a"},children:[e.stock," Stk."]}),y.jsxs("td",{children:[e.minStock," Stk."]}),y.jsx("td",{children:y.jsx("span",{className:`badge ${e.status==="Kritisch"||e.status==="Nachbestellen"?"badge-scheduled":"badge-in-progress"}`,style:{backgroundColor:e.status==="Kritisch"?"#fef2f2":e.status==="Nachbestellen"?"#fffbeb":"#dcfce7",color:e.status==="Kritisch"?"#991b1b":e.status==="Nachbestellen"?"#b45309":"#15803d"},children:e.status})})]},r))})]})]})]})},m0=()=>{const t=[{name:"Max Müller",role:"Heizungsbaumeister",status:"Im Einsatz (Musterweg 12)",phone:"0170 1112233",email:"m.mueller@handwerksfreund.de"},{name:"Stefan Bauer",role:"Anlagenmechaniker SHK",status:"Unterwegs zu Anja Klein",phone:"0170 2223344",email:"s.bauer@handwerksfreund.de"},{name:"Tom Gerber",role:"Servicetechniker",status:"Im Einsatz (Hausverwaltung Schmidt)",phone:"0170 3334455",email:"t.gerber@handwerksfreund.de"},{name:"Janina Wagner",role:"Elektrotechnikerin",status:"Verfügbar / Werkstatt",phone:"0170 4445566",email:"j.wagner@handwerksfreund.de"}];return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Monteure & Servicekräfte"}),y.jsx("span",{style:{fontWeight:600,color:"#2563eb"},children:"8 von 10 im Außeneinsatz"})]}),y.jsxs("section",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Mitarbeiterübersicht & Status"}),y.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:"20px"},children:t.map((e,r)=>y.jsxs("div",{style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"20px",backgroundColor:"#ffffff"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},children:[y.jsx("div",{style:{width:"44px",height:"44px",borderRadius:"50%",backgroundColor:"#eff6ff",color:"#2563eb",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"700"},children:e.name.split(" ").map(n=>n[0]).join("")}),y.jsxs("div",{children:[y.jsx("h3",{style:{fontSize:"1.05rem",fontWeight:700,color:"#0f172a"},children:e.name}),y.jsx("p",{style:{fontSize:"0.85rem",color:"#64748b"},children:e.role})]})]}),y.jsxs("div",{style:{fontSize:"0.875rem",color:"#334155",display:"flex",flexDirection:"column",gap:"8px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsx(Wg,{size:16,color:"#2563eb"}),y.jsx("span",{style:{fontWeight:600},children:e.status})]}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsx(Kg,{size:16,color:"#64748b"}),y.jsx("span",{children:e.phone})]}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.jsx(Hg,{size:16,color:"#64748b"}),y.jsx("span",{children:e.email})]})]})]},r))})]})]})},y0=()=>{const t=[{date:"26.07.2026",technician:"Max Müller",customer:"Max Mustermann",activity:"Heizungswartung",hours:"4.5 Std.",status:"Freigegeben"},{date:"26.07.2026",technician:"Stefan Bauer",customer:"Anja Klein",activity:"Thermostat-Kalibrierung",hours:"2.0 Std.",status:"Freigegeben"},{date:"26.07.2026",technician:"Tom Gerber",customer:"Hausverwaltung Schmidt",activity:"Leitungsspülung",hours:"3.5 Std.",status:"Offen zur Prüfung"},{date:"25.07.2026",technician:"Max Müller",customer:"Bäckerei Hoffmann GmbH",activity:"Pumpentausch",hours:"6.0 Std.",status:"Abgerechnet"}];return y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Zeiterfassung & Stundenzettel"}),y.jsx("span",{style:{fontWeight:600,color:"#10b981"},children:"Gesamtstunden Heute: 16.0 Std."})]}),y.jsxs("section",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Erfasste Arbeitszeiten der Monteure"}),y.jsxs("table",{className:"orders-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Datum"}),y.jsx("th",{children:"Monteur"}),y.jsx("th",{children:"Kunde / Projekt"}),y.jsx("th",{children:"Tätigkeit"}),y.jsx("th",{children:"Dauer"}),y.jsx("th",{children:"Status"})]})}),y.jsx("tbody",{children:t.map((e,r)=>y.jsxs("tr",{children:[y.jsx("td",{style:{color:"#64748b"},children:e.date}),y.jsx("td",{style:{fontWeight:600,color:"#0f172a"},children:e.technician}),y.jsx("td",{children:e.customer}),y.jsx("td",{style:{color:"#334155"},children:e.activity}),y.jsx("td",{style:{fontWeight:700,color:"#2563eb"},children:e.hours}),y.jsx("td",{children:y.jsx("span",{className:`badge ${e.status==="Freigegeben"||e.status==="Abgerechnet"?"badge-in-progress":"badge-scheduled"}`,children:e.status})})]},r))})]})]})]})},v0=()=>{var i;const[t,e]=pe.useState(null),[r,n]=pe.useState(!1),s=async()=>{n(!0);const o=await bn.testConnection();e(o),n(!1)};return pe.useEffect(()=>{s()},[]),y.jsxs(y.Fragment,{children:[y.jsxs("header",{className:"header-bar",children:[y.jsx("h1",{className:"header-title",children:"Supabase Live Synchronization"}),y.jsxs("button",{onClick:s,disabled:r,style:{backgroundColor:"#2563eb",color:"#ffffff",border:"none",padding:"10px 18px",borderRadius:"10px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[y.jsx(Gg,{size:18,className:r?"spin":""})," Connection Test"]})]}),y.jsxs("section",{className:"content-card",children:[y.jsx("h2",{className:"card-heading",children:"Datenbank-Diagnose & Connection Status"}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:"20px",marginBottom:"28px"},children:[y.jsxs("div",{style:{padding:"20px",backgroundColor:"#f8fafc",borderRadius:"12px",border:"1px solid #e2e8f0"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",color:"#10b981",marginBottom:"8px"},children:[y.jsx(Mg,{size:20}),y.jsx("span",{style:{fontWeight:700,color:"#0f172a"},children:"Verbindungsstatus"})]}),y.jsx("p",{style:{fontSize:"1.2rem",fontWeight:800,color:"#10b981"},children:t!=null&&t.isConnected?"VERBUNDEN (STABIL)":"OFFLINE"})]}),y.jsxs("div",{style:{padding:"20px",backgroundColor:"#f8fafc",borderRadius:"12px",border:"1px solid #e2e8f0"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",color:"#2563eb",marginBottom:"8px"},children:[y.jsx(Jg,{size:20}),y.jsx("span",{style:{fontWeight:700,color:"#0f172a"},children:"Antwortzeit (Ping)"})]}),y.jsx("p",{style:{fontSize:"1.2rem",fontWeight:800,color:"#2563eb"},children:t?`${t.latencyMs} ms`:"18 ms"})]}),y.jsxs("div",{style:{padding:"20px",backgroundColor:"#f8fafc",borderRadius:"12px",border:"1px solid #e2e8f0"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",color:"#0284c7",marginBottom:"8px"},children:[y.jsx(Qg,{size:20}),y.jsx("span",{style:{fontWeight:700,color:"#0f172a"},children:"Verschlüsselung"})]}),y.jsx("p",{style:{fontSize:"1.2rem",fontWeight:800,color:"#0f172a"},children:"SSL / TLS 1.3"})]})]}),y.jsxs("div",{className:"status-details-box",children:[y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Supabase Endpunkt:"}),y.jsx("span",{className:"status-val",children:bl})]}),y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Aktive PostgreSQL Tabellen:"}),y.jsx("span",{className:"status-val",children:"customers, work_orders, schedule_items, installed_parts, order_attachments"})]}),y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Realtime Subscription Protocol:"}),y.jsx("span",{className:"status-val",children:"WebSocket (wss://) / HTTP Rest v1"})]}),y.jsxs("div",{className:"status-item",children:[y.jsx("span",{className:"status-key",children:"Letzte Aktualisierung:"}),y.jsx("span",{className:"status-val",children:((i=t==null?void 0:t.lastSync)==null?void 0:i.toLocaleTimeString())||"Vor wenigen Sekunden"})]})]})]})]})},w0=()=>{const[t,e]=pe.useState("dashboard"),r=()=>{switch(t){case"dashboard":return y.jsx(wc,{});case"dispatching":return y.jsx(p0,{});case"lager":return y.jsx(g0,{});case"monteure":return y.jsx(m0,{});case"zeiterfassung":return y.jsx(y0,{});case"supabase":return y.jsx(v0,{});default:return y.jsx(wc,{})}};return y.jsxs("div",{className:"app-container",children:[y.jsx(tm,{activeTab:t,setActiveTab:e}),y.jsx("main",{className:"main-content",children:r()})]})};To.createRoot(document.getElementById("root")).render(y.jsx(Ef.StrictMode,{children:y.jsx(w0,{})}));