heyio 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-dist/assets/{ChatView-BHo6lpBx.js → ChatView-B9WVD6tx.js} +2 -2
- package/web-dist/assets/{FeedView-BfDlNvNB.js → FeedView-CpzIivbf.js} +2 -2
- package/web-dist/assets/LoginView-CIP77sJH.js +1 -0
- package/web-dist/assets/{MarkdownContent.vue_vue_type_script_setup_true_lang-LK_1LFOW.js → MarkdownContent.vue_vue_type_script_setup_true_lang-Bo47khKQ.js} +1 -1
- package/web-dist/assets/{McpView-B1UW7bIs.js → McpView-Czjm3SHm.js} +1 -1
- package/web-dist/assets/{SchedulesView-BBIru1Fh.js → SchedulesView-DD_f5CP5.js} +1 -1
- package/web-dist/assets/{SettingsView-BOOCEXGs.js → SettingsView-BXYd-jo1.js} +1 -1
- package/web-dist/assets/SkillsView-DfS8e6eK.js +1 -0
- package/web-dist/assets/{SquadDetailView-BQ54LMfJ.js → SquadDetailView-BM0HhBdq.js} +2 -2
- package/web-dist/assets/{SquadsView-CI3ATEJZ.js → SquadsView-DaFexZRB.js} +2 -2
- package/web-dist/assets/{WikiView-B7vhxkhn.js → WikiView-BcQO6_oh.js} +2 -2
- package/web-dist/assets/api-GN_ZR-Nh.js +1 -0
- package/web-dist/assets/{index-x4G-bL2N.js → index-CMctONs4.js} +30 -30
- package/web-dist/assets/{plus-Drw0JiiN.js → plus-CObRuHy3.js} +1 -1
- package/web-dist/assets/{trash-2-BMzWlawI.js → trash-2-yEg_2EGm.js} +1 -1
- package/web-dist/index.html +1 -1
- package/web-dist/assets/LoginView-DoQBErlZ.js +0 -1
- package/web-dist/assets/SkillsView-DFuU-I5n.js +0 -1
- package/web-dist/assets/api-Bb5_Gvnf.js +0 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-
|
|
2
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();/**
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-B9WVD6tx.js","assets/api-GN_ZR-Nh.js","assets/MarkdownContent.vue_vue_type_script_setup_true_lang-Bo47khKQ.js","assets/SquadsView-DaFexZRB.js","assets/SquadDetailView-BM0HhBdq.js","assets/FeedView-CpzIivbf.js","assets/trash-2-yEg_2EGm.js","assets/SkillsView-DfS8e6eK.js","assets/plus-CObRuHy3.js","assets/McpView-Czjm3SHm.js","assets/SchedulesView-DD_f5CP5.js","assets/WikiView-BcQO6_oh.js","assets/SettingsView-BXYd-jo1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();const Rc="modulepreload",Oc=function(t){return"/"+t},Wi={},We=function(e,r,s){let n=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));n=o(r.map(c=>{if(c=Oc(c),c in Wi)return;Wi[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Rc,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};/**
|
|
3
3
|
* @vue/shared v3.5.34
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
5
|
* @license MIT
|
|
6
|
-
**/function
|
|
6
|
+
**/function Si(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const ne={},_r=[],pt=()=>{},Aa=()=>!1,Zs=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),en=t=>t.startsWith("onUpdate:"),Se=Object.assign,Ei=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},Cc=Object.prototype.hasOwnProperty,te=(t,e)=>Cc.call(t,e),M=Array.isArray,br=t=>ms(t)==="[object Map]",Pr=t=>ms(t)==="[object Set]",Gi=t=>ms(t)==="[object Date]",G=t=>typeof t=="function",ue=t=>typeof t=="string",Ke=t=>typeof t=="symbol",re=t=>t!==null&&typeof t=="object",Ta=t=>(re(t)||G(t))&&G(t.then)&&G(t.catch),Ra=Object.prototype.toString,ms=t=>Ra.call(t),Pc=t=>ms(t).slice(8,-1),Oa=t=>ms(t)==="[object Object]",tn=t=>ue(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Fr=Si(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),rn=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},xc=/-\w/g,Pe=rn(t=>t.replace(xc,e=>e.slice(1).toUpperCase())),Ic=/\B([A-Z])/g,Vt=rn(t=>t.replace(Ic,"-$1").toLowerCase()),sn=rn(t=>t.charAt(0).toUpperCase()+t.slice(1)),An=rn(t=>t?`on${sn(t)}`:""),ft=(t,e)=>!Object.is(t,e),Ns=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},Ca=(t,e,r,s=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:s,value:r})},nn=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let zi;const on=()=>zi||(zi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ki(t){if(M(t)){const e={};for(let r=0;r<t.length;r++){const s=t[r],n=ue(s)?Lc(s):ki(s);if(n)for(const i in n)e[i]=n[i]}return e}else if(ue(t)||re(t))return t}const jc=/;(?![^(]*\))/g,Nc=/:([^]+)/,$c=/\/\*[^]*?\*\//g;function Lc(t){const e={};return t.replace($c,"").split(jc).forEach(r=>{if(r){const s=r.split(Nc);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function an(t){let e="";if(ue(t))e=t;else if(M(t))for(let r=0;r<t.length;r++){const s=an(t[r]);s&&(e+=s+" ")}else if(re(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const Dc="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Uc=Si(Dc);function Pa(t){return!!t||t===""}function Bc(t,e){if(t.length!==e.length)return!1;let r=!0;for(let s=0;r&&s<t.length;s++)r=xr(t[s],e[s]);return r}function xr(t,e){if(t===e)return!0;let r=Gi(t),s=Gi(e);if(r||s)return r&&s?t.getTime()===e.getTime():!1;if(r=Ke(t),s=Ke(e),r||s)return t===e;if(r=M(t),s=M(e),r||s)return r&&s?Bc(t,e):!1;if(r=re(t),s=re(e),r||s){if(!r||!s)return!1;const n=Object.keys(t).length,i=Object.keys(e).length;if(n!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!xr(t[o],e[o]))return!1}}return String(t)===String(e)}function Ai(t,e){return t.findIndex(r=>xr(r,e))}const xa=t=>!!(t&&t.__v_isRef===!0),Kn=t=>ue(t)?t:t==null?"":M(t)||re(t)&&(t.toString===Ra||!G(t.toString))?xa(t)?Kn(t.value):JSON.stringify(t,Ia,2):String(t),Ia=(t,e)=>xa(e)?Ia(t,e.value):br(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[s,n],i)=>(r[Tn(s,i)+" =>"]=n,r),{})}:Pr(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>Tn(r))}:Ke(e)?Tn(e):re(e)&&!M(e)&&!Oa(e)?String(e):e,Tn=(t,e="")=>{var r;return Ke(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
|
|
7
7
|
* @vue/reactivity v3.5.34
|
|
8
8
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
9
|
* @license MIT
|
|
10
|
-
**/let ye;class ja{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&ye&&(ye.active?(this.parent=ye,this.index=(ye.scopes||(ye.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=ye;try{return ye=this,e()}finally{ye=r}}}on(){++this._on===1&&(this.prevScope=ye,ye=this)}off(){if(this._on>0&&--this._on===0){if(ye===this)ye=this.prevScope;else{let e=ye;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,s;for(r=0,s=this.effects.length;r<s;r++)this.effects[r].stop();for(this.effects.length=0,r=0,s=this.cleanups.length;r<s;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,s=this.scopes.length;r<s;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Na(t){return new ja(t)}function $a(){return ye}function Uc(t,e=!1){ye&&ye.cleanups.push(t)}let ae;const An=new WeakSet;class La{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,ye&&(ye.active?ye.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,An.has(this)&&(An.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ua(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,zi(this),Ba(this);const e=ae,r=Xe;ae=this,Xe=!0;try{return this.fn()}finally{Ma(this),ae=e,Xe=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ri(e);this.deps=this.depsTail=void 0,zi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?An.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Kn(this)&&this.run()}get dirty(){return Kn(this)}}let Da=0,qr,Vr;function Ua(t,e=!1){if(t.flags|=8,e){t.next=Vr,Vr=t;return}t.next=qr,qr=t}function Ai(){Da++}function Ti(){if(--Da>0)return;if(Vr){let e=Vr;for(Vr=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;qr;){let e=qr;for(qr=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){t||(t=s)}e=r}}if(t)throw t}function Ba(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ma(t){let e,r=t.depsTail,s=r;for(;s;){const n=s.prevDep;s.version===-1?(s===r&&(r=n),Ri(s),Bc(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=n}t.deps=e,t.depsTail=r}function Kn(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ha(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ha(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===rs)||(t.globalVersion=rs,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Kn(t))))return;t.flags|=2;const e=t.dep,r=ae,s=Xe;ae=t,Xe=!0;try{Ba(t);const n=t.fn(t._value);(e.version===0||ft(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{ae=r,Xe=s,Ma(t),t.flags&=-3}}function Ri(t,e=!1){const{dep:r,prevSub:s,nextSub:n}=t;if(s&&(s.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=s,t.nextSub=void 0),r.subs===t&&(r.subs=s,!s&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)Ri(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Bc(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let Xe=!0;const Fa=[];function Ot(){Fa.push(Xe),Xe=!1}function Ct(){const t=Fa.pop();Xe=t===void 0?!0:t}function zi(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ae;ae=void 0;try{e()}finally{ae=r}}}let rs=0;class Mc{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Oi{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ae||!Xe||ae===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ae)r=this.activeLink=new Mc(ae,this),ae.deps?(r.prevDep=ae.depsTail,ae.depsTail.nextDep=r,ae.depsTail=r):ae.deps=ae.depsTail=r,qa(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const s=r.nextDep;s.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=s),r.prevDep=ae.depsTail,r.nextDep=void 0,ae.depsTail.nextDep=r,ae.depsTail=r,ae.deps===r&&(ae.deps=s)}return r}trigger(e){this.version++,rs++,this.notify(e)}notify(e){Ai();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{Ti()}}}function qa(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)qa(s)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const Ds=new WeakMap,tr=Symbol(""),Wn=Symbol(""),ss=Symbol("");function Ee(t,e,r){if(Xe&&ae){let s=Ds.get(t);s||Ds.set(t,s=new Map);let n=s.get(r);n||(s.set(r,n=new Oi),n.map=s,n.key=r),n.track()}}function kt(t,e,r,s,n,i){const o=Ds.get(t);if(!o){rs++;return}const a=l=>{l&&l.trigger()};if(Ai(),e==="clear")o.forEach(a);else{const l=M(t),c=l&&en(r);if(l&&r==="length"){const u=Number(s);o.forEach((h,d)=>{(d==="length"||d===ss||!Ke(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(ss)),e){case"add":l?c&&a(o.get("length")):(a(o.get(tr)),br(t)&&a(o.get(Wn)));break;case"delete":l||(a(o.get(tr)),br(t)&&a(o.get(Wn)));break;case"set":br(t)&&a(o.get(tr));break}}Ti()}function Hc(t,e){const r=Ds.get(t);return r&&r.get(e)}function ir(t){const e=Q(t);return e===t?e:(Ee(e,"iterate",ss),He(t)?e:e.map(Qe))}function an(t){return Ee(t=Q(t),"iterate",ss),t}function ct(t,e){return Pt(t)?kr(Tt(t)?Qe(e):e):Qe(e)}const Fc={__proto__:null,[Symbol.iterator](){return Tn(this,Symbol.iterator,t=>ct(this,t))},concat(...t){return ir(this).concat(...t.map(e=>M(e)?ir(e):e))},entries(){return Tn(this,"entries",t=>(t[1]=ct(this,t[1]),t))},every(t,e){return yt(this,"every",t,e,void 0,arguments)},filter(t,e){return yt(this,"filter",t,e,r=>r.map(s=>ct(this,s)),arguments)},find(t,e){return yt(this,"find",t,e,r=>ct(this,r),arguments)},findIndex(t,e){return yt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return yt(this,"findLast",t,e,r=>ct(this,r),arguments)},findLastIndex(t,e){return yt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return yt(this,"forEach",t,e,void 0,arguments)},includes(...t){return Rn(this,"includes",t)},indexOf(...t){return Rn(this,"indexOf",t)},join(t){return ir(this).join(t)},lastIndexOf(...t){return Rn(this,"lastIndexOf",t)},map(t,e){return yt(this,"map",t,e,void 0,arguments)},pop(){return Nr(this,"pop")},push(...t){return Nr(this,"push",t)},reduce(t,...e){return Ji(this,"reduce",t,e)},reduceRight(t,...e){return Ji(this,"reduceRight",t,e)},shift(){return Nr(this,"shift")},some(t,e){return yt(this,"some",t,e,void 0,arguments)},splice(...t){return Nr(this,"splice",t)},toReversed(){return ir(this).toReversed()},toSorted(t){return ir(this).toSorted(t)},toSpliced(...t){return ir(this).toSpliced(...t)},unshift(...t){return Nr(this,"unshift",t)},values(){return Tn(this,"values",t=>ct(this,t))}};function Tn(t,e,r){const s=an(t),n=s[e]();return s!==t&&!He(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.done||(i.value=r(i.value)),i}),n}const qc=Array.prototype;function yt(t,e,r,s,n,i){const o=an(t),a=o!==t&&!He(t),l=o[e];if(l!==qc[e]){const h=l.apply(t,i);return a?Qe(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,ct(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,s);return a&&n?n(u):u}function Ji(t,e,r,s){const n=an(t),i=n!==t&&!He(t);let o=r,a=!1;n!==t&&(i?(a=s.length===0,o=function(c,u,h){return a&&(a=!1,c=ct(t,c)),r.call(this,c,ct(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=n[e](o,...s);return a?ct(t,l):l}function Rn(t,e,r){const s=Q(t);Ee(s,"iterate",ss);const n=s[e](...r);return(n===-1||n===!1)&&ln(r[0])?(r[0]=Q(r[0]),s[e](...r)):n}function Nr(t,e,r=[]){Ot(),Ai();const s=Q(t)[e].apply(t,r);return Ti(),Ct(),s}const Vc=wi("__proto__,__v_isRef,__isVue"),Va=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ke));function Kc(t){Ke(t)||(t=String(t));const e=Q(this);return Ee(e,"has",t),e.hasOwnProperty(t)}class Ka{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,s){if(r==="__v_skip")return e.__v_skip;const n=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!n;if(r==="__v_isReadonly")return n;if(r==="__v_isShallow")return i;if(r==="__v_raw")return s===(n?i?tu:Ja:i?za:Ga).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=M(e);if(!n){let l;if(o&&(l=Fc[r]))return l;if(r==="hasOwnProperty")return Kc}const a=Reflect.get(e,r,fe(e)?e:s);if((Ke(r)?Va.has(r):Vc(r))||(n||Ee(e,"get",r),i))return a;if(fe(a)){const l=o&&en(r)?a:a.value;return n&&re(l)?zn(l):l}return re(a)?n?zn(a):ys(a):a}}class Wa extends Ka{constructor(e=!1){super(!1,e)}set(e,r,s,n){let i=e[r];const o=M(e)&&en(r);if(!this._isShallow){const c=Pt(i);if(!He(s)&&!Pt(s)&&(i=Q(i),s=Q(s)),!o&&fe(i)&&!fe(s))return c||(i.value=s),!0}const a=o?Number(r)<e.length:te(e,r),l=Reflect.set(e,r,s,fe(e)?e:n);return e===Q(n)&&(a?ft(s,i)&&kt(e,"set",r,s):kt(e,"add",r,s)),l}deleteProperty(e,r){const s=te(e,r);e[r];const n=Reflect.deleteProperty(e,r);return n&&s&&kt(e,"delete",r,void 0),n}has(e,r){const s=Reflect.has(e,r);return(!Ke(r)||!Va.has(r))&&Ee(e,"has",r),s}ownKeys(e){return Ee(e,"iterate",M(e)?"length":tr),Reflect.ownKeys(e)}}class Wc extends Ka{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Gc=new Wa,zc=new Wc,Jc=new Wa(!0);const Gn=t=>t,ws=t=>Reflect.getPrototypeOf(t);function Yc(t,e,r){return function(...s){const n=this.__v_raw,i=Q(n),o=br(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...s),u=r?Gn:e?kr:Qe;return!e&&Ee(i,"iterate",l?Wn:tr),Se(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function Ss(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Xc(t,e){const r={get(n){const i=this.__v_raw,o=Q(i),a=Q(n);t||(ft(n,a)&&Ee(o,"get",n),Ee(o,"get",a));const{has:l}=ws(o),c=e?Gn:t?kr:Qe;if(l.call(o,n))return c(i.get(n));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!t&&Ee(Q(n),"iterate",tr),n.size},has(n){const i=this.__v_raw,o=Q(i),a=Q(n);return t||(ft(n,a)&&Ee(o,"has",n),Ee(o,"has",a)),n===a?i.has(n):i.has(n)||i.has(a)},forEach(n,i){const o=this,a=o.__v_raw,l=Q(a),c=e?Gn:t?kr:Qe;return!t&&Ee(l,"iterate",tr),a.forEach((u,h)=>n.call(i,c(u),c(h),o))}};return Se(r,t?{add:Ss("add"),set:Ss("set"),delete:Ss("delete"),clear:Ss("clear")}:{add(n){const i=Q(this),o=ws(i),a=Q(n),l=!e&&!He(n)&&!Pt(n)?a:n;return o.has.call(i,l)||ft(n,l)&&o.has.call(i,n)||ft(a,l)&&o.has.call(i,a)||(i.add(l),kt(i,"add",l,l)),this},set(n,i){!e&&!He(i)&&!Pt(i)&&(i=Q(i));const o=Q(this),{has:a,get:l}=ws(o);let c=a.call(o,n);c||(n=Q(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,i),c?ft(i,u)&&kt(o,"set",n,i):kt(o,"add",n,i),this},delete(n){const i=Q(this),{has:o,get:a}=ws(i);let l=o.call(i,n);l||(n=Q(n),l=o.call(i,n)),a&&a.call(i,n);const c=i.delete(n);return l&&kt(i,"delete",n,void 0),c},clear(){const n=Q(this),i=n.size!==0,o=n.clear();return i&&kt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{r[n]=Yc(n,t,e)}),r}function Ci(t,e){const r=Xc(t,e);return(s,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?s:Reflect.get(te(r,n)&&n in s?r:s,n,i)}const Qc={get:Ci(!1,!1)},Zc={get:Ci(!1,!0)},eu={get:Ci(!0,!1)};const Ga=new WeakMap,za=new WeakMap,Ja=new WeakMap,tu=new WeakMap;function ru(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function su(t){return t.__v_skip||!Object.isExtensible(t)?0:ru(Oc(t))}function ys(t){return Pt(t)?t:Pi(t,!1,Gc,Qc,Ga)}function Ya(t){return Pi(t,!1,Jc,Zc,za)}function zn(t){return Pi(t,!0,zc,eu,Ja)}function Pi(t,e,r,s,n){if(!re(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=su(t);if(i===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,i===2?s:r);return n.set(t,a),a}function Tt(t){return Pt(t)?Tt(t.__v_raw):!!(t&&t.__v_isReactive)}function Pt(t){return!!(t&&t.__v_isReadonly)}function He(t){return!!(t&&t.__v_isShallow)}function ln(t){return t?!!t.__v_raw:!1}function Q(t){const e=t&&t.__v_raw;return e?Q(e):t}function xi(t){return!te(t,"__v_skip")&&Object.isExtensible(t)&&Ca(t,"__v_skip",!0),t}const Qe=t=>re(t)?ys(t):t,kr=t=>re(t)?zn(t):t;function fe(t){return t?t.__v_isRef===!0:!1}function Kr(t){return Xa(t,!1)}function nu(t){return Xa(t,!0)}function Xa(t,e){return fe(t)?t:new iu(t,e)}class iu{constructor(e,r){this.dep=new Oi,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:Q(e),this._value=r?e:Qe(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,s=this.__v_isShallow||He(e)||Pt(e);e=s?e:Q(e),ft(e,r)&&(this._rawValue=e,this._value=s?e:Qe(e),this.dep.trigger())}}function Ye(t){return fe(t)?t.value:t}const ou={get:(t,e,r)=>e==="__v_raw"?t:Ye(Reflect.get(t,e,r)),set:(t,e,r,s)=>{const n=t[e];return fe(n)&&!fe(r)?(n.value=r,!0):Reflect.set(t,e,r,s)}};function Qa(t){return Tt(t)?t:new Proxy(t,ou)}function au(t){const e=M(t)?new Array(t.length):{};for(const r in t)e[r]=cu(t,r);return e}class lu{constructor(e,r,s){this._object=e,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=Ke(r)?r:String(r),this._raw=Q(e);let n=!0,i=e;if(!M(e)||Ke(this._key)||!en(this._key))do n=!ln(i)||He(i);while(n&&(i=i.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=Ye(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&fe(this._raw[this._key])){const r=this._object[this._key];if(fe(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return Hc(this._raw,this._key)}}function cu(t,e,r){return new lu(t,e,r)}class uu{constructor(e,r,s){this.fn=e,this.setter=r,this._value=void 0,this.dep=new Oi(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&ae!==this)return Ua(this,!0),!0}get value(){const e=this.dep.track();return Ha(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function hu(t,e,r=!1){let s,n;return G(t)?s=t:(s=t.get,n=t.set),new uu(s,n,r)}const Es={},Us=new WeakMap;let Xt;function du(t,e=!1,r=Xt){if(r){let s=Us.get(r);s||Us.set(r,s=[]),s.push(t)}}function fu(t,e,r=ne){const{immediate:s,deep:n,once:i,scheduler:o,augmentJob:a,call:l}=r,c=O=>n?O:He(O)||n===!1||n===0?At(O,1):At(O);let u,h,d,f,m=!1,v=!1;if(fe(t)?(h=()=>t.value,m=He(t)):Tt(t)?(h=()=>c(t),m=!0):M(t)?(v=!0,m=t.some(O=>Tt(O)||He(O)),h=()=>t.map(O=>{if(fe(O))return O.value;if(Tt(O))return c(O);if(G(O))return l?l(O,2):O()})):G(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Ot();try{d()}finally{Ct()}}const O=Xt;Xt=u;try{return l?l(t,3,[f]):t(f)}finally{Xt=O}}:h=pt,e&&n){const O=h,B=n===!0?1/0:n;h=()=>At(O(),B)}const A=$a(),E=()=>{u.stop(),A&&A.active&&Si(A.effects,u)};if(i&&e){const O=e;e=(...B)=>{O(...B),E()}}let _=v?new Array(t.length).fill(Es):Es;const b=O=>{if(!(!(u.flags&1)||!u.dirty&&!O))if(e){const B=u.run();if(n||m||(v?B.some((W,q)=>ft(W,_[q])):ft(B,_))){d&&d();const W=Xt;Xt=u;try{const q=[B,_===Es?void 0:v&&_[0]===Es?[]:_,f];_=B,l?l(e,3,q):e(...q)}finally{Xt=W}}}else u.run()};return a&&a(b),u=new La(h),u.scheduler=o?()=>o(b,!1):b,f=O=>du(O,!1,u),d=u.onStop=()=>{const O=Us.get(u);if(O){if(l)l(O,4);else for(const B of O)B();Us.delete(u)}},e?s?b(!0):_=u.run():o?o(b.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function At(t,e=1/0,r){if(e<=0||!re(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,fe(t))At(t.value,e,r);else if(M(t))for(let s=0;s<t.length;s++)At(t[s],e,r);else if(Pr(t)||br(t))t.forEach(s=>{At(s,e,r)});else if(Oa(t)){for(const s in t)At(t[s],e,r);for(const s of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,s)&&At(t[s],e,r)}return t}/**
|
|
10
|
+
**/let ye;class ja{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&ye&&(ye.active?(this.parent=ye,this.index=(ye.scopes||(ye.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=ye;try{return ye=this,e()}finally{ye=r}}}on(){++this._on===1&&(this.prevScope=ye,ye=this)}off(){if(this._on>0&&--this._on===0){if(ye===this)ye=this.prevScope;else{let e=ye;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,s;for(r=0,s=this.effects.length;r<s;r++)this.effects[r].stop();for(this.effects.length=0,r=0,s=this.cleanups.length;r<s;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,s=this.scopes.length;r<s;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Na(t){return new ja(t)}function $a(){return ye}function Mc(t,e=!1){ye&&ye.cleanups.push(t)}let ae;const Rn=new WeakSet;class La{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,ye&&(ye.active?ye.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Rn.has(this)&&(Rn.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ua(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ji(this),Ba(this);const e=ae,r=Qe;ae=this,Qe=!0;try{return this.fn()}finally{Ma(this),ae=e,Qe=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Oi(e);this.deps=this.depsTail=void 0,Ji(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Rn.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Wn(this)&&this.run()}get dirty(){return Wn(this)}}let Da=0,qr,Vr;function Ua(t,e=!1){if(t.flags|=8,e){t.next=Vr,Vr=t;return}t.next=qr,qr=t}function Ti(){Da++}function Ri(){if(--Da>0)return;if(Vr){let e=Vr;for(Vr=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;qr;){let e=qr;for(qr=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){t||(t=s)}e=r}}if(t)throw t}function Ba(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ma(t){let e,r=t.depsTail,s=r;for(;s;){const n=s.prevDep;s.version===-1?(s===r&&(r=n),Oi(s),Hc(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=n}t.deps=e,t.depsTail=r}function Wn(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ha(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ha(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===rs)||(t.globalVersion=rs,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Wn(t))))return;t.flags|=2;const e=t.dep,r=ae,s=Qe;ae=t,Qe=!0;try{Ba(t);const n=t.fn(t._value);(e.version===0||ft(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{ae=r,Qe=s,Ma(t),t.flags&=-3}}function Oi(t,e=!1){const{dep:r,prevSub:s,nextSub:n}=t;if(s&&(s.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=s,t.nextSub=void 0),r.subs===t&&(r.subs=s,!s&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)Oi(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Hc(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let Qe=!0;const Fa=[];function Ot(){Fa.push(Qe),Qe=!1}function Ct(){const t=Fa.pop();Qe=t===void 0?!0:t}function Ji(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ae;ae=void 0;try{e()}finally{ae=r}}}let rs=0;class Fc{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ci{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ae||!Qe||ae===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ae)r=this.activeLink=new Fc(ae,this),ae.deps?(r.prevDep=ae.depsTail,ae.depsTail.nextDep=r,ae.depsTail=r):ae.deps=ae.depsTail=r,qa(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const s=r.nextDep;s.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=s),r.prevDep=ae.depsTail,r.nextDep=void 0,ae.depsTail.nextDep=r,ae.depsTail=r,ae.deps===r&&(ae.deps=s)}return r}trigger(e){this.version++,rs++,this.notify(e)}notify(e){Ti();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{Ri()}}}function qa(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)qa(s)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const Us=new WeakMap,tr=Symbol(""),Gn=Symbol(""),ss=Symbol("");function Ee(t,e,r){if(Qe&&ae){let s=Us.get(t);s||Us.set(t,s=new Map);let n=s.get(r);n||(s.set(r,n=new Ci),n.map=s,n.key=r),n.track()}}function kt(t,e,r,s,n,i){const o=Us.get(t);if(!o){rs++;return}const a=l=>{l&&l.trigger()};if(Ti(),e==="clear")o.forEach(a);else{const l=M(t),c=l&&tn(r);if(l&&r==="length"){const u=Number(s);o.forEach((h,d)=>{(d==="length"||d===ss||!Ke(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(ss)),e){case"add":l?c&&a(o.get("length")):(a(o.get(tr)),br(t)&&a(o.get(Gn)));break;case"delete":l||(a(o.get(tr)),br(t)&&a(o.get(Gn)));break;case"set":br(t)&&a(o.get(tr));break}}Ri()}function qc(t,e){const r=Us.get(t);return r&&r.get(e)}function ir(t){const e=Q(t);return e===t?e:(Ee(e,"iterate",ss),He(t)?e:e.map(Ze))}function ln(t){return Ee(t=Q(t),"iterate",ss),t}function ct(t,e){return Pt(t)?kr(Tt(t)?Ze(e):e):Ze(e)}const Vc={__proto__:null,[Symbol.iterator](){return On(this,Symbol.iterator,t=>ct(this,t))},concat(...t){return ir(this).concat(...t.map(e=>M(e)?ir(e):e))},entries(){return On(this,"entries",t=>(t[1]=ct(this,t[1]),t))},every(t,e){return yt(this,"every",t,e,void 0,arguments)},filter(t,e){return yt(this,"filter",t,e,r=>r.map(s=>ct(this,s)),arguments)},find(t,e){return yt(this,"find",t,e,r=>ct(this,r),arguments)},findIndex(t,e){return yt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return yt(this,"findLast",t,e,r=>ct(this,r),arguments)},findLastIndex(t,e){return yt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return yt(this,"forEach",t,e,void 0,arguments)},includes(...t){return Cn(this,"includes",t)},indexOf(...t){return Cn(this,"indexOf",t)},join(t){return ir(this).join(t)},lastIndexOf(...t){return Cn(this,"lastIndexOf",t)},map(t,e){return yt(this,"map",t,e,void 0,arguments)},pop(){return Nr(this,"pop")},push(...t){return Nr(this,"push",t)},reduce(t,...e){return Yi(this,"reduce",t,e)},reduceRight(t,...e){return Yi(this,"reduceRight",t,e)},shift(){return Nr(this,"shift")},some(t,e){return yt(this,"some",t,e,void 0,arguments)},splice(...t){return Nr(this,"splice",t)},toReversed(){return ir(this).toReversed()},toSorted(t){return ir(this).toSorted(t)},toSpliced(...t){return ir(this).toSpliced(...t)},unshift(...t){return Nr(this,"unshift",t)},values(){return On(this,"values",t=>ct(this,t))}};function On(t,e,r){const s=ln(t),n=s[e]();return s!==t&&!He(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.done||(i.value=r(i.value)),i}),n}const Kc=Array.prototype;function yt(t,e,r,s,n,i){const o=ln(t),a=o!==t&&!He(t),l=o[e];if(l!==Kc[e]){const h=l.apply(t,i);return a?Ze(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,ct(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,s);return a&&n?n(u):u}function Yi(t,e,r,s){const n=ln(t),i=n!==t&&!He(t);let o=r,a=!1;n!==t&&(i?(a=s.length===0,o=function(c,u,h){return a&&(a=!1,c=ct(t,c)),r.call(this,c,ct(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=n[e](o,...s);return a?ct(t,l):l}function Cn(t,e,r){const s=Q(t);Ee(s,"iterate",ss);const n=s[e](...r);return(n===-1||n===!1)&&cn(r[0])?(r[0]=Q(r[0]),s[e](...r)):n}function Nr(t,e,r=[]){Ot(),Ti();const s=Q(t)[e].apply(t,r);return Ri(),Ct(),s}const Wc=Si("__proto__,__v_isRef,__isVue"),Va=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ke));function Gc(t){Ke(t)||(t=String(t));const e=Q(this);return Ee(e,"has",t),e.hasOwnProperty(t)}class Ka{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,s){if(r==="__v_skip")return e.__v_skip;const n=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!n;if(r==="__v_isReadonly")return n;if(r==="__v_isShallow")return i;if(r==="__v_raw")return s===(n?i?su:Ja:i?za:Ga).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=M(e);if(!n){let l;if(o&&(l=Vc[r]))return l;if(r==="hasOwnProperty")return Gc}const a=Reflect.get(e,r,fe(e)?e:s);if((Ke(r)?Va.has(r):Wc(r))||(n||Ee(e,"get",r),i))return a;if(fe(a)){const l=o&&tn(r)?a:a.value;return n&&re(l)?Jn(l):l}return re(a)?n?Jn(a):ys(a):a}}class Wa extends Ka{constructor(e=!1){super(!1,e)}set(e,r,s,n){let i=e[r];const o=M(e)&&tn(r);if(!this._isShallow){const c=Pt(i);if(!He(s)&&!Pt(s)&&(i=Q(i),s=Q(s)),!o&&fe(i)&&!fe(s))return c||(i.value=s),!0}const a=o?Number(r)<e.length:te(e,r),l=Reflect.set(e,r,s,fe(e)?e:n);return e===Q(n)&&(a?ft(s,i)&&kt(e,"set",r,s):kt(e,"add",r,s)),l}deleteProperty(e,r){const s=te(e,r);e[r];const n=Reflect.deleteProperty(e,r);return n&&s&&kt(e,"delete",r,void 0),n}has(e,r){const s=Reflect.has(e,r);return(!Ke(r)||!Va.has(r))&&Ee(e,"has",r),s}ownKeys(e){return Ee(e,"iterate",M(e)?"length":tr),Reflect.ownKeys(e)}}class zc extends Ka{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Jc=new Wa,Yc=new zc,Xc=new Wa(!0);const zn=t=>t,ws=t=>Reflect.getPrototypeOf(t);function Qc(t,e,r){return function(...s){const n=this.__v_raw,i=Q(n),o=br(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...s),u=r?zn:e?kr:Ze;return!e&&Ee(i,"iterate",l?Gn:tr),Se(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function Ss(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Zc(t,e){const r={get(n){const i=this.__v_raw,o=Q(i),a=Q(n);t||(ft(n,a)&&Ee(o,"get",n),Ee(o,"get",a));const{has:l}=ws(o),c=e?zn:t?kr:Ze;if(l.call(o,n))return c(i.get(n));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!t&&Ee(Q(n),"iterate",tr),n.size},has(n){const i=this.__v_raw,o=Q(i),a=Q(n);return t||(ft(n,a)&&Ee(o,"has",n),Ee(o,"has",a)),n===a?i.has(n):i.has(n)||i.has(a)},forEach(n,i){const o=this,a=o.__v_raw,l=Q(a),c=e?zn:t?kr:Ze;return!t&&Ee(l,"iterate",tr),a.forEach((u,h)=>n.call(i,c(u),c(h),o))}};return Se(r,t?{add:Ss("add"),set:Ss("set"),delete:Ss("delete"),clear:Ss("clear")}:{add(n){const i=Q(this),o=ws(i),a=Q(n),l=!e&&!He(n)&&!Pt(n)?a:n;return o.has.call(i,l)||ft(n,l)&&o.has.call(i,n)||ft(a,l)&&o.has.call(i,a)||(i.add(l),kt(i,"add",l,l)),this},set(n,i){!e&&!He(i)&&!Pt(i)&&(i=Q(i));const o=Q(this),{has:a,get:l}=ws(o);let c=a.call(o,n);c||(n=Q(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,i),c?ft(i,u)&&kt(o,"set",n,i):kt(o,"add",n,i),this},delete(n){const i=Q(this),{has:o,get:a}=ws(i);let l=o.call(i,n);l||(n=Q(n),l=o.call(i,n)),a&&a.call(i,n);const c=i.delete(n);return l&&kt(i,"delete",n,void 0),c},clear(){const n=Q(this),i=n.size!==0,o=n.clear();return i&&kt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{r[n]=Qc(n,t,e)}),r}function Pi(t,e){const r=Zc(t,e);return(s,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?s:Reflect.get(te(r,n)&&n in s?r:s,n,i)}const eu={get:Pi(!1,!1)},tu={get:Pi(!1,!0)},ru={get:Pi(!0,!1)};const Ga=new WeakMap,za=new WeakMap,Ja=new WeakMap,su=new WeakMap;function nu(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function iu(t){return t.__v_skip||!Object.isExtensible(t)?0:nu(Pc(t))}function ys(t){return Pt(t)?t:xi(t,!1,Jc,eu,Ga)}function Ya(t){return xi(t,!1,Xc,tu,za)}function Jn(t){return xi(t,!0,Yc,ru,Ja)}function xi(t,e,r,s,n){if(!re(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=iu(t);if(i===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,i===2?s:r);return n.set(t,a),a}function Tt(t){return Pt(t)?Tt(t.__v_raw):!!(t&&t.__v_isReactive)}function Pt(t){return!!(t&&t.__v_isReadonly)}function He(t){return!!(t&&t.__v_isShallow)}function cn(t){return t?!!t.__v_raw:!1}function Q(t){const e=t&&t.__v_raw;return e?Q(e):t}function Ii(t){return!te(t,"__v_skip")&&Object.isExtensible(t)&&Ca(t,"__v_skip",!0),t}const Ze=t=>re(t)?ys(t):t,kr=t=>re(t)?Jn(t):t;function fe(t){return t?t.__v_isRef===!0:!1}function Kr(t){return Xa(t,!1)}function ou(t){return Xa(t,!0)}function Xa(t,e){return fe(t)?t:new au(t,e)}class au{constructor(e,r){this.dep=new Ci,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:Q(e),this._value=r?e:Ze(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,s=this.__v_isShallow||He(e)||Pt(e);e=s?e:Q(e),ft(e,r)&&(this._rawValue=e,this._value=s?e:Ze(e),this.dep.trigger())}}function Xe(t){return fe(t)?t.value:t}const lu={get:(t,e,r)=>e==="__v_raw"?t:Xe(Reflect.get(t,e,r)),set:(t,e,r,s)=>{const n=t[e];return fe(n)&&!fe(r)?(n.value=r,!0):Reflect.set(t,e,r,s)}};function Qa(t){return Tt(t)?t:new Proxy(t,lu)}function cu(t){const e=M(t)?new Array(t.length):{};for(const r in t)e[r]=hu(t,r);return e}class uu{constructor(e,r,s){this._object=e,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=Ke(r)?r:String(r),this._raw=Q(e);let n=!0,i=e;if(!M(e)||Ke(this._key)||!tn(this._key))do n=!cn(i)||He(i);while(n&&(i=i.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=Xe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&fe(this._raw[this._key])){const r=this._object[this._key];if(fe(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return qc(this._raw,this._key)}}function hu(t,e,r){return new uu(t,e,r)}class du{constructor(e,r,s){this.fn=e,this.setter=r,this._value=void 0,this.dep=new Ci(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&ae!==this)return Ua(this,!0),!0}get value(){const e=this.dep.track();return Ha(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function fu(t,e,r=!1){let s,n;return G(t)?s=t:(s=t.get,n=t.set),new du(s,n,r)}const Es={},Bs=new WeakMap;let Xt;function pu(t,e=!1,r=Xt){if(r){let s=Bs.get(r);s||Bs.set(r,s=[]),s.push(t)}}function gu(t,e,r=ne){const{immediate:s,deep:n,once:i,scheduler:o,augmentJob:a,call:l}=r,c=O=>n?O:He(O)||n===!1||n===0?At(O,1):At(O);let u,h,d,f,m=!1,v=!1;if(fe(t)?(h=()=>t.value,m=He(t)):Tt(t)?(h=()=>c(t),m=!0):M(t)?(v=!0,m=t.some(O=>Tt(O)||He(O)),h=()=>t.map(O=>{if(fe(O))return O.value;if(Tt(O))return c(O);if(G(O))return l?l(O,2):O()})):G(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Ot();try{d()}finally{Ct()}}const O=Xt;Xt=u;try{return l?l(t,3,[f]):t(f)}finally{Xt=O}}:h=pt,e&&n){const O=h,B=n===!0?1/0:n;h=()=>At(O(),B)}const A=$a(),E=()=>{u.stop(),A&&A.active&&Ei(A.effects,u)};if(i&&e){const O=e;e=(...B)=>{O(...B),E()}}let _=v?new Array(t.length).fill(Es):Es;const b=O=>{if(!(!(u.flags&1)||!u.dirty&&!O))if(e){const B=u.run();if(n||m||(v?B.some((W,q)=>ft(W,_[q])):ft(B,_))){d&&d();const W=Xt;Xt=u;try{const q=[B,_===Es?void 0:v&&_[0]===Es?[]:_,f];_=B,l?l(e,3,q):e(...q)}finally{Xt=W}}}else u.run()};return a&&a(b),u=new La(h),u.scheduler=o?()=>o(b,!1):b,f=O=>pu(O,!1,u),d=u.onStop=()=>{const O=Bs.get(u);if(O){if(l)l(O,4);else for(const B of O)B();Bs.delete(u)}},e?s?b(!0):_=u.run():o?o(b.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function At(t,e=1/0,r){if(e<=0||!re(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,fe(t))At(t.value,e,r);else if(M(t))for(let s=0;s<t.length;s++)At(t[s],e,r);else if(Pr(t)||br(t))t.forEach(s=>{At(s,e,r)});else if(Oa(t)){for(const s in t)At(t[s],e,r);for(const s of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,s)&&At(t[s],e,r)}return t}/**
|
|
11
11
|
* @vue/runtime-core v3.5.34
|
|
12
12
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
13
|
* @license MIT
|
|
14
|
-
**/function vs(t,e,r,s){try{return s?t(...s):t()}catch(n){cn(n,e,r)}}function gt(t,e,r,s){if(G(t)){const n=vs(t,e,r,s);return n&&Ta(n)&&n.catch(i=>{cn(i,e,r)}),n}if(M(t)){const n=[];for(let i=0;i<t.length;i++)n.push(gt(t[i],e,r,s));return n}}function cn(t,e,r,s=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ne;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Ot(),vs(i,null,10,[t,l,c]),Ct();return}}pu(t,r,n,s,o)}function pu(t,e,r,s=!0,n=!1){if(n)throw t;console.error(t)}const Ce=[];let at=-1;const wr=[];let Ut=null,dr=0;const Za=Promise.resolve();let Bs=null;function un(t){const e=Bs||Za;return t?e.then(this?t.bind(this):t):e}function gu(t){let e=at+1,r=Ce.length;for(;e<r;){const s=e+r>>>1,n=Ce[s],i=ns(n);i<t||i===t&&n.flags&2?e=s+1:r=s}return e}function Ii(t){if(!(t.flags&1)){const e=ns(t),r=Ce[Ce.length-1];!r||!(t.flags&2)&&e>=ns(r)?Ce.push(t):Ce.splice(gu(e),0,t),t.flags|=1,el()}}function el(){Bs||(Bs=Za.then(rl))}function mu(t){M(t)?wr.push(...t):Ut&&t.id===-1?Ut.splice(dr+1,0,t):t.flags&1||(wr.push(t),t.flags|=1),el()}function Yi(t,e,r=at+1){for(;r<Ce.length;r++){const s=Ce[r];if(s&&s.flags&2){if(t&&s.id!==t.uid)continue;Ce.splice(r,1),r--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function tl(t){if(wr.length){const e=[...new Set(wr)].sort((r,s)=>ns(r)-ns(s));if(wr.length=0,Ut){Ut.push(...e);return}for(Ut=e,dr=0;dr<Ut.length;dr++){const r=Ut[dr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}Ut=null,dr=0}}const ns=t=>t.id==null?t.flags&2?-1:1/0:t.id;function rl(t){try{for(at=0;at<Ce.length;at++){const e=Ce[at];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),vs(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;at<Ce.length;at++){const e=Ce[at];e&&(e.flags&=-2)}at=-1,Ce.length=0,tl(),Bs=null,(Ce.length||wr.length)&&rl()}}let Be=null,sl=null;function Ms(t){const e=Be;return Be=t,sl=t&&t.type.__scopeId||null,e}function nl(t,e=Be,r){if(!e||t._n)return t;const s=(...n)=>{s._d&&qs(-1);const i=Ms(e);let o;try{o=t(...n)}finally{Ms(i),s._d&&qs(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Hm(t,e){if(Be===null)return t;const r=gn(Be),s=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[i,o,a,l=ne]=e[n];i&&(G(i)&&(i={mounted:i,updated:i}),i.deep&&At(o),s.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function Gt(t,e,r,s){const n=t.dirs,i=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];i&&(a.oldValue=i[o].value);let l=a.dir[s];l&&(Ot(),gt(l,r,8,[t.el,a,t,e]),Ct())}}function Ns(t,e){if(ke){let r=ke.provides;const s=ke.parent&&ke.parent.provides;s===r&&(r=ke.provides=Object.create(s)),r[t]=e}}function Ve(t,e,r=!1){const s=$l();if(s||rr){let n=rr?rr._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return r&&G(e)?e.call(s&&s.proxy):e}}function yu(){return!!($l()||rr)}const vu=Symbol.for("v-scx"),_u=()=>Ve(vu);function Wr(t,e,r){return il(t,e,r)}function il(t,e,r=ne){const{immediate:s,deep:n,flush:i,once:o}=r,a=Se({},r),l=e&&s||!e&&i!=="post";let c;if(os){if(i==="sync"){const f=_u();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=pt,f.resume=pt,f.pause=pt,f}}const u=ke;a.call=(f,m,v)=>gt(f,u,m,v);let h=!1;i==="post"?a.scheduler=f=>{Ne(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,m)=>{m?f():Ii(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=fu(t,e,a);return os&&(c?c.push(d):l&&d()),d}function bu(t,e,r){const s=this.proxy,n=ue(t)?t.includes(".")?ol(s,t):()=>s[t]:t.bind(s,s);let i;G(e)?i=e:(i=e.handler,r=e);const o=_s(this),a=il(n,i.bind(s),r);return o(),a}function ol(t,e){const r=e.split(".");return()=>{let s=t;for(let n=0;n<r.length&&s;n++)s=s[r[n]];return s}}const wu=Symbol("_vte"),Su=t=>t.__isTeleport,Eu=Symbol("_leaveCb");function ji(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ji(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function hn(t,e){return G(t)?Se({name:t.name},e,{setup:t}):t}function al(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Xi(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Hs=new WeakMap;function Gr(t,e,r,s,n=!1){if(M(t)){t.forEach((v,A)=>Gr(v,e&&(M(e)?e[A]:e),r,s,n));return}if(zr(s)&&!n){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Gr(t,e,r,s.component.subTree);return}const i=s.shapeFlag&4?gn(s.component):s.el,o=n?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ne?a.refs={}:a.refs,h=a.setupState,d=Q(h),f=h===ne?Aa:v=>Xi(u,v)?!1:te(d,v),m=(v,A)=>!(A&&Xi(u,A));if(c!=null&&c!==l){if(Qi(e),ue(c))u[c]=null,f(c)&&(h[c]=null);else if(fe(c)){const v=e;m(c,v.k)&&(c.value=null),v.k&&(u[v.k]=null)}}if(G(l))vs(l,a,12,[o,u]);else{const v=ue(l),A=fe(l);if(v||A){const E=()=>{if(t.f){const _=v?f(l)?h[l]:u[l]:m()||!t.k?l.value:u[t.k];if(n)M(_)&&Si(_,i);else if(M(_))_.includes(i)||_.push(i);else if(v)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];m(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else v?(u[l]=o,f(l)&&(h[l]=o)):A&&(m(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const _=()=>{E(),Hs.delete(t)};_.id=-1,Hs.set(t,_),Ne(_,r)}else Qi(t),E()}}}function Qi(t){const e=Hs.get(t);e&&(e.flags|=8,Hs.delete(t))}nn().requestIdleCallback;nn().cancelIdleCallback;const zr=t=>!!t.type.__asyncLoader,ll=t=>t.type.__isKeepAlive;function ku(t,e){cl(t,"a",e)}function Au(t,e){cl(t,"da",e)}function cl(t,e,r=ke){const s=t.__wdc||(t.__wdc=()=>{let n=r;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(dn(e,s,r),r){let n=r.parent;for(;n&&n.parent;)ll(n.parent.vnode)&&Tu(s,e,r,n),n=n.parent}}function Tu(t,e,r,s){const n=dn(e,t,s,!0);ul(()=>{Si(s[e],n)},r)}function dn(t,e,r=ke,s=!1){if(r){const n=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Ot();const a=_s(r),l=gt(e,r,t,o);return a(),Ct(),l});return s?n.unshift(i):n.push(i),i}}const xt=t=>(e,r=ke)=>{(!os||t==="sp")&&dn(t,(...s)=>e(...s),r)},Ru=xt("bm"),Ou=xt("m"),Cu=xt("bu"),Pu=xt("u"),xu=xt("bum"),ul=xt("um"),Iu=xt("sp"),ju=xt("rtg"),Nu=xt("rtc");function $u(t,e=ke){dn("ec",t,e)}const hl="components";function dl(t,e){return pl(hl,t,!0,e)||t}const fl=Symbol.for("v-ndc");function Lu(t){return ue(t)?pl(hl,t,!1)||t:t||fl}function pl(t,e,r=!0,s=!1){const n=Be||ke;if(n){const i=n.type;{const a=Sh(i,!1);if(a&&(a===e||a===Pe(e)||a===rn(Pe(e))))return i}const o=Zi(n[t]||i[t],e)||Zi(n.appContext[t],e);return!o&&s?i:o}}function Zi(t,e){return t&&(t[e]||t[Pe(e)]||t[rn(Pe(e))])}function Du(t,e,r,s){let n;const i=r,o=M(t);if(o||ue(t)){const a=o&&Tt(t);let l=!1,c=!1;a&&(l=!He(t),c=Pt(t),t=an(t)),n=new Array(t.length);for(let u=0,h=t.length;u<h;u++)n[u]=e(l?c?kr(Qe(t[u])):Qe(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,i)}else if(re(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,i)}}else n=[];return n}const Jn=t=>t?Ll(t)?gn(t):Jn(t.parent):null,Jr=Se(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Jn(t.parent),$root:t=>Jn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>ml(t),$forceUpdate:t=>t.f||(t.f=()=>{Ii(t.update)}),$nextTick:t=>t.n||(t.n=un.bind(t.proxy)),$watch:t=>bu.bind(t)}),On=(t,e)=>t!==ne&&!t.__isScriptSetup&&te(t,e),Uu={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:s,data:n,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return s[e];case 2:return n[e];case 4:return r[e];case 3:return i[e]}else{if(On(s,e))return o[e]=1,s[e];if(n!==ne&&te(n,e))return o[e]=2,n[e];if(te(i,e))return o[e]=3,i[e];if(r!==ne&&te(r,e))return o[e]=4,r[e];Yn&&(o[e]=0)}}const c=Jr[e];let u,h;if(c)return e==="$attrs"&&Ee(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==ne&&te(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,te(h,e))return h[e]},set({_:t},e,r){const{data:s,setupState:n,ctx:i}=t;return On(n,e)?(n[e]=r,!0):s!==ne&&te(s,e)?(s[e]=r,!0):te(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:s,appContext:n,props:i,type:o}},a){let l;return!!(r[a]||t!==ne&&a[0]!=="$"&&te(t,a)||On(e,a)||te(i,a)||te(s,a)||te(Jr,a)||te(n.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:te(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function eo(t){return M(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Yn=!0;function Bu(t){const e=ml(t),r=t.proxy,s=t.ctx;Yn=!1,e.beforeCreate&&to(e.beforeCreate,t,"bc");const{data:n,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:m,activated:v,deactivated:A,beforeDestroy:E,beforeUnmount:_,destroyed:b,unmounted:O,render:B,renderTracked:W,renderTriggered:q,errorCaptured:J,serverPrefetch:V,expose:ce,inheritAttrs:Te,components:Le,directives:xe,filters:Kt}=e;if(c&&Mu(c,s,null),o)for(const z in o){const Z=o[z];G(Z)&&(s[z]=Z.bind(r))}if(n){const z=n.call(r,r);re(z)&&(t.data=ys(z))}if(Yn=!0,i)for(const z in i){const Z=i[z],mt=G(Z)?Z.bind(r,r):G(Z.get)?Z.get.bind(r,r):pt,$t=!G(Z)&&G(Z.set)?Z.set.bind(r):pt,et=$e({get:mt,set:$t});Object.defineProperty(s,z,{enumerable:!0,configurable:!0,get:()=>et.value,set:Ie=>et.value=Ie})}if(a)for(const z in a)gl(a[z],s,r,z);if(l){const z=G(l)?l.call(r):l;Reflect.ownKeys(z).forEach(Z=>{Ns(Z,z[Z])})}u&&to(u,t,"c");function le(z,Z){M(Z)?Z.forEach(mt=>z(mt.bind(r))):Z&&z(Z.bind(r))}if(le(Ru,h),le(Ou,d),le(Cu,f),le(Pu,m),le(ku,v),le(Au,A),le($u,J),le(Nu,W),le(ju,q),le(xu,_),le(ul,O),le(Iu,V),M(ce))if(ce.length){const z=t.exposed||(t.exposed={});ce.forEach(Z=>{Object.defineProperty(z,Z,{get:()=>r[Z],set:mt=>r[Z]=mt,enumerable:!0})})}else t.exposed||(t.exposed={});B&&t.render===pt&&(t.render=B),Te!=null&&(t.inheritAttrs=Te),Le&&(t.components=Le),xe&&(t.directives=xe),V&&al(t)}function Mu(t,e,r=pt){M(t)&&(t=Xn(t));for(const s in t){const n=t[s];let i;re(n)?"default"in n?i=Ve(n.from||s,n.default,!0):i=Ve(n.from||s):i=Ve(n),fe(i)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[s]=i}}function to(t,e,r){gt(M(t)?t.map(s=>s.bind(e.proxy)):t.bind(e.proxy),e,r)}function gl(t,e,r,s){let n=s.includes(".")?ol(r,s):()=>r[s];if(ue(t)){const i=e[t];G(i)&&Wr(n,i)}else if(G(t))Wr(n,t.bind(r));else if(re(t))if(M(t))t.forEach(i=>gl(i,e,r,s));else{const i=G(t.handler)?t.handler.bind(r):e[t.handler];G(i)&&Wr(n,i,t)}}function ml(t){const e=t.type,{mixins:r,extends:s}=e,{mixins:n,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!n.length&&!r&&!s?l=e:(l={},n.length&&n.forEach(c=>Fs(l,c,o,!0)),Fs(l,e,o)),re(e)&&i.set(e,l),l}function Fs(t,e,r,s=!1){const{mixins:n,extends:i}=e;i&&Fs(t,i,r,!0),n&&n.forEach(o=>Fs(t,o,r,!0));for(const o in e)if(!(s&&o==="expose")){const a=Hu[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Hu={data:ro,props:so,emits:so,methods:Ur,computed:Ur,beforeCreate:Re,created:Re,beforeMount:Re,mounted:Re,beforeUpdate:Re,updated:Re,beforeDestroy:Re,beforeUnmount:Re,destroyed:Re,unmounted:Re,activated:Re,deactivated:Re,errorCaptured:Re,serverPrefetch:Re,components:Ur,directives:Ur,watch:qu,provide:ro,inject:Fu};function ro(t,e){return e?t?function(){return Se(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function Fu(t,e){return Ur(Xn(t),Xn(e))}function Xn(t){if(M(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function Re(t,e){return t?[...new Set([].concat(t,e))]:e}function Ur(t,e){return t?Se(Object.create(null),t,e):e}function so(t,e){return t?M(t)&&M(e)?[...new Set([...t,...e])]:Se(Object.create(null),eo(t),eo(e??{})):e}function qu(t,e){if(!t)return e;if(!e)return t;const r=Se(Object.create(null),t);for(const s in e)r[s]=Re(t[s],e[s]);return r}function yl(){return{app:null,config:{isNativeTag:Aa,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Vu=0;function Ku(t,e){return function(s,n=null){G(s)||(s=Se({},s)),n!=null&&!re(n)&&(n=null);const i=yl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Vu++,_component:s,_props:n,_container:null,_context:i,_instance:null,version:kh,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&G(u.install)?(o.add(u),u.install(c,...h)):G(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||Ae(s,n);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,gn(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(gt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=rr;rr=c;try{return u()}finally{rr=h}}};return c}}let rr=null;const Wu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Pe(e)}Modifiers`]||t[`${Vt(e)}Modifiers`];function Gu(t,e,...r){if(t.isUnmounted)return;const s=t.vnode.props||ne;let n=r;const i=e.startsWith("update:"),o=i&&Wu(s,e.slice(7));o&&(o.trim&&(n=r.map(u=>ue(u)?u.trim():u)),o.number&&(n=r.map(sn)));let a,l=s[a=En(e)]||s[a=En(Pe(e))];!l&&i&&(l=s[a=En(Vt(e))]),l&>(l,t,6,n);const c=s[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,gt(c,t,6,n)}}const zu=new WeakMap;function vl(t,e,r=!1){const s=r?zu:e.emitsCache,n=s.get(t);if(n!==void 0)return n;const i=t.emits;let o={},a=!1;if(!G(t)){const l=c=>{const u=vl(c,e,!0);u&&(a=!0,Se(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(re(t)&&s.set(t,null),null):(M(i)?i.forEach(l=>o[l]=null):Se(o,i),re(t)&&s.set(t,o),o)}function fn(t,e){return!t||!Qs(e)?!1:(e=e.slice(2).replace(/Once$/,""),te(t,e[0].toLowerCase()+e.slice(1))||te(t,Vt(e))||te(t,e))}function no(t){const{type:e,vnode:r,proxy:s,withProxy:n,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:m,inheritAttrs:v}=t,A=Ms(t);let E,_;try{if(r.shapeFlag&4){const O=n||s,B=O;E=ht(c.call(B,O,u,h,f,d,m)),_=a}else{const O=e;E=ht(O.length>1?O(h,{attrs:a,slots:o,emit:l}):O(h,null)),_=e.props?a:Ju(a)}}catch(O){Yr.length=0,cn(O,t,1),E=Ae(qt)}let b=E;if(_&&v!==!1){const O=Object.keys(_),{shapeFlag:B}=b;O.length&&B&7&&(i&&O.some(Zs)&&(_=Yu(_,i)),b=Ar(b,_,!1,!0))}return r.dirs&&(b=Ar(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&ji(b,r.transition),E=b,Ms(A),E}const Ju=t=>{let e;for(const r in t)(r==="class"||r==="style"||Qs(r))&&((e||(e={}))[r]=t[r]);return e},Yu=(t,e)=>{const r={};for(const s in t)(!Zs(s)||!(s.slice(9)in e))&&(r[s]=t[s]);return r};function Xu(t,e,r){const{props:s,children:n,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return s?io(s,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(_l(o,s,d)&&!fn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?io(s,o,c):!0:!!o;return!1}function io(t,e,r){const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!0;for(let n=0;n<s.length;n++){const i=s[n];if(_l(e,t,i)&&!fn(r,i))return!0}return!1}function _l(t,e,r){const s=t[r],n=e[r];return r==="style"&&re(s)&&re(n)?!xr(s,n):s!==n}function Qu({vnode:t,parent:e,suspense:r},s){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.suspense.vnode.el=n.el=s,t=n),n===t)(t=e.vnode).el=s,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=s)}const bl={},wl=()=>Object.create(bl),Sl=t=>Object.getPrototypeOf(t)===bl;function Zu(t,e,r,s=!1){const n={},i=wl();t.propsDefaults=Object.create(null),El(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);r?t.props=s?n:Ya(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function eh(t,e,r,s){const{props:n,attrs:i,vnode:{patchFlag:o}}=t,a=Q(n),[l]=t.propsOptions;let c=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(fn(t.emitsOptions,d))continue;const f=e[d];if(l)if(te(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const m=Pe(d);n[m]=Qn(l,a,m,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{El(t,e,n,i)&&(c=!0);let u;for(const h in a)(!e||!te(e,h)&&((u=Vt(h))===h||!te(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(n[h]=Qn(l,a,h,void 0,t,!0)):delete n[h]);if(i!==a)for(const h in i)(!e||!te(e,h))&&(delete i[h],c=!0)}c&&kt(t.attrs,"set","")}function El(t,e,r,s){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Fr(l))continue;const c=e[l];let u;n&&te(n,u=Pe(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:fn(t.emitsOptions,l)||(!(l in s)||c!==s[l])&&(s[l]=c,o=!0)}if(i){const l=Q(r),c=a||ne;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Qn(n,l,h,c[h],t,!te(c,h))}}return o}function Qn(t,e,r,s,n,i){const o=t[r];if(o!=null){const a=te(o,"default");if(a&&s===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&G(l)){const{propsDefaults:c}=n;if(r in c)s=c[r];else{const u=_s(n);s=c[r]=l.call(null,e),u()}}else s=l;n.ce&&n.ce._setProp(r,s)}o[0]&&(i&&!a?s=!1:o[1]&&(s===""||s===Vt(r))&&(s=!0))}return s}const th=new WeakMap;function kl(t,e,r=!1){const s=r?th:e.propsCache,n=s.get(t);if(n)return n;const i=t.props,o={},a=[];let l=!1;if(!G(t)){const u=h=>{l=!0;const[d,f]=kl(h,e,!0);Se(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return re(t)&&s.set(t,_r),_r;if(M(i))for(let u=0;u<i.length;u++){const h=Pe(i[u]);oo(h)&&(o[h]=ne)}else if(i)for(const u in i){const h=Pe(u);if(oo(h)){const d=i[u],f=o[h]=M(d)||G(d)?{type:d}:Se({},d),m=f.type;let v=!1,A=!0;if(M(m))for(let E=0;E<m.length;++E){const _=m[E],b=G(_)&&_.name;if(b==="Boolean"){v=!0;break}else b==="String"&&(A=!1)}else v=G(m)&&m.name==="Boolean";f[0]=v,f[1]=A,(v||te(f,"default"))&&a.push(h)}}const c=[o,a];return re(t)&&s.set(t,c),c}function oo(t){return t[0]!=="$"&&!Fr(t)}const Ni=t=>t==="_"||t==="_ctx"||t==="$stable",$i=t=>M(t)?t.map(ht):[ht(t)],rh=(t,e,r)=>{if(e._n)return e;const s=nl((...n)=>$i(e(...n)),r);return s._c=!1,s},Al=(t,e,r)=>{const s=t._ctx;for(const n in t){if(Ni(n))continue;const i=t[n];if(G(i))e[n]=rh(n,i,s);else if(i!=null){const o=$i(i);e[n]=()=>o}}},Tl=(t,e)=>{const r=$i(e);t.slots.default=()=>r},Rl=(t,e,r)=>{for(const s in e)(r||!Ni(s))&&(t[s]=e[s])},sh=(t,e,r)=>{const s=t.slots=wl();if(t.vnode.shapeFlag&32){const n=e._;n?(Rl(s,e,r),r&&Ca(s,"_",n,!0)):Al(e,s)}else e&&Tl(t,e)},nh=(t,e,r)=>{const{vnode:s,slots:n}=t;let i=!0,o=ne;if(s.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:Rl(n,e,r):(i=!e.$stable,Al(e,n)),o=e}else e&&(Tl(t,e),o={default:1});if(i)for(const a in n)!Ni(a)&&o[a]==null&&delete n[a]},Ne=ch;function ih(t){return oh(t)}function oh(t,e){const r=nn();r.__VUE__=!0;const{insert:s,remove:n,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=pt,insertStaticContent:m}=t,v=(p,g,y,w=null,T=null,S=null,I=void 0,P=null,C=!!g.dynamicChildren)=>{if(p===g)return;p&&!$r(p,g)&&(w=k(p),Ie(p,T,S,!0),p=null),g.patchFlag===-2&&(C=!1,g.dynamicChildren=null);const{type:R,ref:H,shapeFlag:N}=g;switch(R){case pn:A(p,g,y,w);break;case qt:E(p,g,y,w);break;case Pn:p==null&&_(g,y,w,I);break;case ut:Le(p,g,y,w,T,S,I,P,C);break;default:N&1?B(p,g,y,w,T,S,I,P,C):N&6?xe(p,g,y,w,T,S,I,P,C):(N&64||N&128)&&R.process(p,g,y,w,T,S,I,P,C,D)}H!=null&&T?Gr(H,p&&p.ref,S,g||p,!g):H==null&&p&&p.ref!=null&&Gr(p.ref,null,S,p,!0)},A=(p,g,y,w)=>{if(p==null)s(g.el=a(g.children),y,w);else{const T=g.el=p.el;g.children!==p.children&&c(T,g.children)}},E=(p,g,y,w)=>{p==null?s(g.el=l(g.children||""),y,w):g.el=p.el},_=(p,g,y,w)=>{[p.el,p.anchor]=m(p.children,g,y,w,p.el,p.anchor)},b=({el:p,anchor:g},y,w)=>{let T;for(;p&&p!==g;)T=d(p),s(p,y,w),p=T;s(g,y,w)},O=({el:p,anchor:g})=>{let y;for(;p&&p!==g;)y=d(p),n(p),p=y;n(g)},B=(p,g,y,w,T,S,I,P,C)=>{if(g.type==="svg"?I="svg":g.type==="math"&&(I="mathml"),p==null)W(g,y,w,T,S,I,P,C);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),V(p,g,T,S,I,P,C)}finally{R&&R._endPatch()}}},W=(p,g,y,w,T,S,I,P)=>{let C,R;const{props:H,shapeFlag:N,transition:U,dirs:K}=p;if(C=p.el=o(p.type,S,H&&H.is,H),N&8?u(C,p.children):N&16&&J(p.children,C,null,w,T,Cn(p,S),I,P),K&&Gt(p,null,w,"created"),q(C,p,p.scopeId,I,w),H){for(const se in H)se!=="value"&&!Fr(se)&&i(C,se,null,H[se],S,w);"value"in H&&i(C,"value",null,H.value,S),(R=H.onVnodeBeforeMount)&&nt(R,w,p)}K&&Gt(p,null,w,"beforeMount");const X=ah(T,U);X&&U.beforeEnter(C),s(C,g,y),((R=H&&H.onVnodeMounted)||X||K)&&Ne(()=>{try{R&&nt(R,w,p),X&&U.enter(C),K&&Gt(p,null,w,"mounted")}finally{}},T)},q=(p,g,y,w,T)=>{if(y&&f(p,y),w)for(let S=0;S<w.length;S++)f(p,w[S]);if(T){let S=T.subTree;if(g===S||xl(S.type)&&(S.ssContent===g||S.ssFallback===g)){const I=T.vnode;q(p,I,I.scopeId,I.slotScopeIds,T.parent)}}},J=(p,g,y,w,T,S,I,P,C=0)=>{for(let R=C;R<p.length;R++){const H=p[R]=P?Et(p[R]):ht(p[R]);v(null,H,g,y,w,T,S,I,P)}},V=(p,g,y,w,T,S,I)=>{const P=g.el=p.el;let{patchFlag:C,dynamicChildren:R,dirs:H}=g;C|=p.patchFlag&16;const N=p.props||ne,U=g.props||ne;let K;if(y&&zt(y,!1),(K=U.onVnodeBeforeUpdate)&&nt(K,y,g,p),H&&Gt(g,p,y,"beforeUpdate"),y&&zt(y,!0),(N.innerHTML&&U.innerHTML==null||N.textContent&&U.textContent==null)&&u(P,""),R?ce(p.dynamicChildren,R,P,y,w,Cn(g,T),S):I||Z(p,g,P,null,y,w,Cn(g,T),S,!1),C>0){if(C&16)Te(P,N,U,y,T);else if(C&2&&N.class!==U.class&&i(P,"class",null,U.class,T),C&4&&i(P,"style",N.style,U.style,T),C&8){const X=g.dynamicProps;for(let se=0;se<X.length;se++){const ie=X[se],pe=N[ie],_e=U[ie];(_e!==pe||ie==="value")&&i(P,ie,pe,_e,T,y)}}C&1&&p.children!==g.children&&u(P,g.children)}else!I&&R==null&&Te(P,N,U,y,T);((K=U.onVnodeUpdated)||H)&&Ne(()=>{K&&nt(K,y,g,p),H&&Gt(g,p,y,"updated")},w)},ce=(p,g,y,w,T,S,I)=>{for(let P=0;P<g.length;P++){const C=p[P],R=g[P],H=C.el&&(C.type===ut||!$r(C,R)||C.shapeFlag&198)?h(C.el):y;v(C,R,H,null,w,T,S,I,!0)}},Te=(p,g,y,w,T)=>{if(g!==y){if(g!==ne)for(const S in g)!Fr(S)&&!(S in y)&&i(p,S,g[S],null,T,w);for(const S in y){if(Fr(S))continue;const I=y[S],P=g[S];I!==P&&S!=="value"&&i(p,S,P,I,T,w)}"value"in y&&i(p,"value",g.value,y.value,T)}},Le=(p,g,y,w,T,S,I,P,C)=>{const R=g.el=p?p.el:a(""),H=g.anchor=p?p.anchor:a("");let{patchFlag:N,dynamicChildren:U,slotScopeIds:K}=g;K&&(P=P?P.concat(K):K),p==null?(s(R,y,w),s(H,y,w),J(g.children||[],y,H,T,S,I,P,C)):N>0&&N&64&&U&&p.dynamicChildren&&p.dynamicChildren.length===U.length?(ce(p.dynamicChildren,U,y,T,S,I,P),(g.key!=null||T&&g===T.subTree)&&Ol(p,g,!0)):Z(p,g,y,H,T,S,I,P,C)},xe=(p,g,y,w,T,S,I,P,C)=>{g.slotScopeIds=P,p==null?g.shapeFlag&512?T.ctx.activate(g,y,w,I,C):Kt(g,y,w,T,S,I,C):Nt(p,g,C)},Kt=(p,g,y,w,T,S,I)=>{const P=p.component=yh(p,w,T);if(ll(p)&&(P.ctx.renderer=D),vh(P,!1,I),P.asyncDep){if(T&&T.registerDep(P,le,I),!p.el){const C=P.subTree=Ae(qt);E(null,C,g,y),p.placeholder=C.el}}else le(P,p,g,y,T,S,I)},Nt=(p,g,y)=>{const w=g.component=p.component;if(Xu(p,g,y))if(w.asyncDep&&!w.asyncResolved){z(w,g,y);return}else w.next=g,w.update();else g.el=p.el,w.vnode=g},le=(p,g,y,w,T,S,I)=>{const P=()=>{if(p.isMounted){let{next:N,bu:U,u:K,parent:X,vnode:se}=p;{const rt=Cl(p);if(rt){N&&(N.el=se.el,z(p,N,I)),rt.asyncDep.then(()=>{Ne(()=>{p.isUnmounted||R()},T)});return}}let ie=N,pe;zt(p,!1),N?(N.el=se.el,z(p,N,I)):N=se,U&&js(U),(pe=N.props&&N.props.onVnodeBeforeUpdate)&&nt(pe,X,N,se),zt(p,!0);const _e=no(p),tt=p.subTree;p.subTree=_e,v(tt,_e,h(tt.el),k(tt),p,T,S),N.el=_e.el,ie===null&&Qu(p,_e.el),K&&Ne(K,T),(pe=N.props&&N.props.onVnodeUpdated)&&Ne(()=>nt(pe,X,N,se),T)}else{let N;const{el:U,props:K}=g,{bm:X,m:se,parent:ie,root:pe,type:_e}=p,tt=zr(g);zt(p,!1),X&&js(X),!tt&&(N=K&&K.onVnodeBeforeMount)&&nt(N,ie,g),zt(p,!0);{pe.ce&&pe.ce._hasShadowRoot()&&pe.ce._injectChildStyle(_e,p.parent?p.parent.type:void 0);const rt=p.subTree=no(p);v(null,rt,y,w,p,T,S),g.el=rt.el}if(se&&Ne(se,T),!tt&&(N=K&&K.onVnodeMounted)){const rt=g;Ne(()=>nt(N,ie,rt),T)}(g.shapeFlag&256||ie&&zr(ie.vnode)&&ie.vnode.shapeFlag&256)&&p.a&&Ne(p.a,T),p.isMounted=!0,g=y=w=null}};p.scope.on();const C=p.effect=new La(P);p.scope.off();const R=p.update=C.run.bind(C),H=p.job=C.runIfDirty.bind(C);H.i=p,H.id=p.uid,C.scheduler=()=>Ii(H),zt(p,!0),R()},z=(p,g,y)=>{g.component=p;const w=p.vnode.props;p.vnode=g,p.next=null,eh(p,g.props,w,y),nh(p,g.children,y),Ot(),Yi(p),Ct()},Z=(p,g,y,w,T,S,I,P,C=!1)=>{const R=p&&p.children,H=p?p.shapeFlag:0,N=g.children,{patchFlag:U,shapeFlag:K}=g;if(U>0){if(U&128){$t(R,N,y,w,T,S,I,P,C);return}else if(U&256){mt(R,N,y,w,T,S,I,P,C);return}}K&8?(H&16&&Fe(R,T,S),N!==R&&u(y,N)):H&16?K&16?$t(R,N,y,w,T,S,I,P,C):Fe(R,T,S,!0):(H&8&&u(y,""),K&16&&J(N,y,w,T,S,I,P,C))},mt=(p,g,y,w,T,S,I,P,C)=>{p=p||_r,g=g||_r;const R=p.length,H=g.length,N=Math.min(R,H);let U;for(U=0;U<N;U++){const K=g[U]=C?Et(g[U]):ht(g[U]);v(p[U],K,y,null,T,S,I,P,C)}R>H?Fe(p,T,S,!0,!1,N):J(g,y,w,T,S,I,P,C,N)},$t=(p,g,y,w,T,S,I,P,C)=>{let R=0;const H=g.length;let N=p.length-1,U=H-1;for(;R<=N&&R<=U;){const K=p[R],X=g[R]=C?Et(g[R]):ht(g[R]);if($r(K,X))v(K,X,y,null,T,S,I,P,C);else break;R++}for(;R<=N&&R<=U;){const K=p[N],X=g[U]=C?Et(g[U]):ht(g[U]);if($r(K,X))v(K,X,y,null,T,S,I,P,C);else break;N--,U--}if(R>N){if(R<=U){const K=U+1,X=K<H?g[K].el:w;for(;R<=U;)v(null,g[R]=C?Et(g[R]):ht(g[R]),y,X,T,S,I,P,C),R++}}else if(R>U)for(;R<=N;)Ie(p[R],T,S,!0),R++;else{const K=R,X=R,se=new Map;for(R=X;R<=U;R++){const De=g[R]=C?Et(g[R]):ht(g[R]);De.key!=null&&se.set(De.key,R)}let ie,pe=0;const _e=U-X+1;let tt=!1,rt=0;const jr=new Array(_e);for(R=0;R<_e;R++)jr[R]=0;for(R=K;R<=N;R++){const De=p[R];if(pe>=_e){Ie(De,T,S,!0);continue}let st;if(De.key!=null)st=se.get(De.key);else for(ie=X;ie<=U;ie++)if(jr[ie-X]===0&&$r(De,g[ie])){st=ie;break}st===void 0?Ie(De,T,S,!0):(jr[st-X]=R+1,st>=rt?rt=st:tt=!0,v(De,g[st],y,null,T,S,I,P,C),pe++)}const qi=tt?lh(jr):_r;for(ie=qi.length-1,R=_e-1;R>=0;R--){const De=X+R,st=g[De],Vi=g[De+1],Ki=De+1<H?Vi.el||Pl(Vi):w;jr[R]===0?v(null,st,y,Ki,T,S,I,P,C):tt&&(ie<0||R!==qi[ie]?et(st,y,Ki,2):ie--)}}},et=(p,g,y,w,T=null)=>{const{el:S,type:I,transition:P,children:C,shapeFlag:R}=p;if(R&6){et(p.component.subTree,g,y,w);return}if(R&128){p.suspense.move(g,y,w);return}if(R&64){I.move(p,g,y,D);return}if(I===ut){s(S,g,y);for(let N=0;N<C.length;N++)et(C[N],g,y,w);s(p.anchor,g,y);return}if(I===Pn){b(p,g,y);return}if(w!==2&&R&1&&P)if(w===0)P.beforeEnter(S),s(S,g,y),Ne(()=>P.enter(S),T);else{const{leave:N,delayLeave:U,afterLeave:K}=P,X=()=>{p.ctx.isUnmounted?n(S):s(S,g,y)},se=()=>{S._isLeaving&&S[Eu](!0),N(S,()=>{X(),K&&K()})};U?U(S,X,se):se()}else s(S,g,y)},Ie=(p,g,y,w=!1,T=!1)=>{const{type:S,props:I,ref:P,children:C,dynamicChildren:R,shapeFlag:H,patchFlag:N,dirs:U,cacheIndex:K,memo:X}=p;if(N===-2&&(T=!1),P!=null&&(Ot(),Gr(P,null,y,p,!0),Ct()),K!=null&&(g.renderCache[K]=void 0),H&256){g.ctx.deactivate(p);return}const se=H&1&&U,ie=!zr(p);let pe;if(ie&&(pe=I&&I.onVnodeBeforeUnmount)&&nt(pe,g,p),H&6)Wt(p.component,y,w);else{if(H&128){p.suspense.unmount(y,w);return}se&&Gt(p,null,g,"beforeUnmount"),H&64?p.type.remove(p,g,y,D,w):R&&!R.hasOnce&&(S!==ut||N>0&&N&64)?Fe(R,g,y,!1,!0):(S===ut&&N&384||!T&&H&16)&&Fe(C,g,y),w&&sr(p)}const _e=X!=null&&K==null;(ie&&(pe=I&&I.onVnodeUnmounted)||se||_e)&&Ne(()=>{pe&&nt(pe,g,p),se&&Gt(p,null,g,"unmounted"),_e&&(p.el=null)},y)},sr=p=>{const{type:g,el:y,anchor:w,transition:T}=p;if(g===ut){nr(y,w);return}if(g===Pn){O(p);return}const S=()=>{n(y),T&&!T.persisted&&T.afterLeave&&T.afterLeave()};if(p.shapeFlag&1&&T&&!T.persisted){const{leave:I,delayLeave:P}=T,C=()=>I(y,S);P?P(p.el,S,C):C()}else S()},nr=(p,g)=>{let y;for(;p!==g;)y=d(p),n(p),p=y;n(g)},Wt=(p,g,y)=>{const{bum:w,scope:T,job:S,subTree:I,um:P,m:C,a:R}=p;ao(C),ao(R),w&&js(w),T.stop(),S&&(S.flags|=8,Ie(I,p,g,y)),P&&Ne(P,g),Ne(()=>{p.isUnmounted=!0},g)},Fe=(p,g,y,w=!1,T=!1,S=0)=>{for(let I=S;I<p.length;I++)Ie(p[I],g,y,w,T)},k=p=>{if(p.shapeFlag&6)return k(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const g=d(p.anchor||p.el),y=g&&g[wu];return y?d(y):g};let $=!1;const j=(p,g,y)=>{let w;p==null?g._vnode&&(Ie(g._vnode,null,null,!0),w=g._vnode.component):v(g._vnode||null,p,g,null,null,null,y),g._vnode=p,$||($=!0,Yi(w),tl(),$=!1)},D={p:v,um:Ie,m:et,r:sr,mt:Kt,mc:J,pc:Z,pbc:ce,n:k,o:t};return{render:j,hydrate:void 0,createApp:Ku(j)}}function Cn({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function zt({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function ah(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Ol(t,e,r=!1){const s=t.children,n=e.children;if(M(s)&&M(n))for(let i=0;i<s.length;i++){const o=s[i];let a=n[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[i]=Et(n[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Ol(o,a)),a.type===pn&&(a.patchFlag===-1&&(a=n[i]=Et(a)),a.el=o.el),a.type===qt&&!a.el&&(a.el=o.el)}}function lh(t){const e=t.slice(),r=[0];let s,n,i,o,a;const l=t.length;for(s=0;s<l;s++){const c=t[s];if(c!==0){if(n=r[r.length-1],t[n]<c){e[s]=n,r.push(s);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[s]=r[i-1]),r[i]=s)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Cl(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Cl(e)}function ao(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Pl(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Pl(e.subTree):null}const xl=t=>t.__isSuspense;function ch(t,e){e&&e.pendingBranch?M(t)?e.effects.push(...t):e.effects.push(t):mu(t)}const ut=Symbol.for("v-fgt"),pn=Symbol.for("v-txt"),qt=Symbol.for("v-cmt"),Pn=Symbol.for("v-stc"),Yr=[];let Me=null;function Sr(t=!1){Yr.push(Me=t?null:[])}function uh(){Yr.pop(),Me=Yr[Yr.length-1]||null}let is=1;function qs(t,e=!1){is+=t,t<0&&Me&&e&&(Me.hasOnce=!0)}function Il(t){return t.dynamicChildren=is>0?Me||_r:null,uh(),is>0&&Me&&Me.push(t),t}function Zn(t,e,r,s,n,i){return Il(Ge(t,e,r,s,n,i,!0))}function Li(t,e,r,s,n){return Il(Ae(t,e,r,s,n,!0))}function Vs(t){return t?t.__v_isVNode===!0:!1}function $r(t,e){return t.type===e.type&&t.key===e.key}const jl=({key:t})=>t??null,$s=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?ue(t)||fe(t)||G(t)?{i:Be,r:t,k:e,f:!!r}:t:null);function Ge(t,e=null,r=null,s=0,n=null,i=t===ut?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&jl(e),ref:e&&$s(e),scopeId:sl,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Be};return a?(Di(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=ue(r)?8:16),is>0&&!o&&Me&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Me.push(l),l}const Ae=hh;function hh(t,e=null,r=null,s=0,n=null,i=!1){if((!t||t===fl)&&(t=qt),Vs(t)){const a=Ar(t,e,!0);return r&&Di(a,r),is>0&&!i&&Me&&(a.shapeFlag&6?Me[Me.indexOf(t)]=a:Me.push(a)),a.patchFlag=-2,a}if(Eh(t)&&(t=t.__vccOpts),e){e=dh(e);let{class:a,style:l}=e;a&&!ue(a)&&(e.class=on(a)),re(l)&&(ln(l)&&!M(l)&&(l=Se({},l)),e.style=Ei(l))}const o=ue(t)?1:xl(t)?128:Su(t)?64:re(t)?4:G(t)?2:0;return Ge(t,e,r,s,n,o,i,!0)}function dh(t){return t?ln(t)||Sl(t)?Se({},t):t:null}function Ar(t,e,r=!1,s=!1){const{props:n,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?ph(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&jl(c),ref:e&&e.ref?r&&i?M(i)?i.concat($s(e)):[i,$s(e)]:$s(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ut?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ar(t.ssContent),ssFallback:t.ssFallback&&Ar(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&s&&ji(u,l.clone(u)),u}function Nl(t=" ",e=0){return Ae(pn,null,t,e)}function fh(t="",e=!1){return e?(Sr(),Li(qt,null,t)):Ae(qt,null,t)}function ht(t){return t==null||typeof t=="boolean"?Ae(qt):M(t)?Ae(ut,null,t.slice()):Vs(t)?Et(t):Ae(pn,null,String(t))}function Et(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ar(t)}function Di(t,e){let r=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(M(e))r=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Di(t,n()),n._c&&(n._d=!0));return}else{r=32;const n=e._;!n&&!Sl(e)?e._ctx=Be:n===3&&Be&&(Be.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Be},r=32):(e=String(e),s&64?(r=16,e=[Nl(e)]):r=8);t.children=e,t.shapeFlag|=r}function ph(...t){const e={};for(let r=0;r<t.length;r++){const s=t[r];for(const n in s)if(n==="class")e.class!==s.class&&(e.class=on([e.class,s.class]));else if(n==="style")e.style=Ei([e.style,s.style]);else if(Qs(n)){const i=e[n],o=s[n];o&&i!==o&&!(M(i)&&i.includes(o))?e[n]=i?[].concat(i,o):o:o==null&&i==null&&!Zs(n)&&(e[n]=o)}else n!==""&&(e[n]=s[n])}return e}function nt(t,e,r,s=null){gt(t,e,7,[r,s])}const gh=yl();let mh=0;function yh(t,e,r){const s=t.type,n=(e?e.appContext:t.appContext)||gh,i={uid:mh++,vnode:t,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ja(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:kl(s,n),emitsOptions:vl(s,n),emit:null,emitted:null,propsDefaults:ne,inheritAttrs:s.inheritAttrs,ctx:ne,data:ne,props:ne,attrs:ne,slots:ne,refs:ne,setupState:ne,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Gu.bind(null,i),t.ce&&t.ce(i),i}let ke=null;const $l=()=>ke||Be;let Ks,ei;{const t=nn(),e=(r,s)=>{let n;return(n=t[r])||(n=t[r]=[]),n.push(s),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};Ks=e("__VUE_INSTANCE_SETTERS__",r=>ke=r),ei=e("__VUE_SSR_SETTERS__",r=>os=r)}const _s=t=>{const e=ke;return Ks(t),t.scope.on(),()=>{t.scope.off(),Ks(e)}},lo=()=>{ke&&ke.scope.off(),Ks(null)};function Ll(t){return t.vnode.shapeFlag&4}let os=!1;function vh(t,e=!1,r=!1){e&&ei(e);const{props:s,children:n}=t.vnode,i=Ll(t);Zu(t,s,i,e),sh(t,n,r||e);const o=i?_h(t,e):void 0;return e&&ei(!1),o}function _h(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Uu);const{setup:s}=r;if(s){Ot();const n=t.setupContext=s.length>1?wh(t):null,i=_s(t),o=vs(s,t,0,[t.props,n]),a=Ta(o);if(Ct(),i(),(a||t.sp)&&!zr(t)&&al(t),a){if(o.then(lo,lo),e)return o.then(l=>{co(t,l)}).catch(l=>{cn(l,t,0)});t.asyncDep=o}else co(t,o)}else Dl(t)}function co(t,e,r){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:re(e)&&(t.setupState=Qa(e)),Dl(t)}function Dl(t,e,r){const s=t.type;t.render||(t.render=s.render||pt);{const n=_s(t);Ot();try{Bu(t)}finally{Ct(),n()}}}const bh={get(t,e){return Ee(t,"get",""),t[e]}};function wh(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,bh),slots:t.slots,emit:t.emit,expose:e}}function gn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Qa(xi(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in Jr)return Jr[r](t)},has(e,r){return r in e||r in Jr}})):t.proxy}function Sh(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Eh(t){return G(t)&&"__vccOpts"in t}const $e=(t,e)=>hu(t,e,os);function as(t,e,r){try{qs(-1);const s=arguments.length;return s===2?re(e)&&!M(e)?Vs(e)?Ae(t,null,[e]):Ae(t,e):Ae(t,null,e):(s>3?r=Array.prototype.slice.call(arguments,2):s===3&&Vs(r)&&(r=[r]),Ae(t,e,r))}finally{qs(1)}}const kh="3.5.34";/**
|
|
14
|
+
**/function vs(t,e,r,s){try{return s?t(...s):t()}catch(n){un(n,e,r)}}function gt(t,e,r,s){if(G(t)){const n=vs(t,e,r,s);return n&&Ta(n)&&n.catch(i=>{un(i,e,r)}),n}if(M(t)){const n=[];for(let i=0;i<t.length;i++)n.push(gt(t[i],e,r,s));return n}}function un(t,e,r,s=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ne;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Ot(),vs(i,null,10,[t,l,c]),Ct();return}}mu(t,r,n,s,o)}function mu(t,e,r,s=!0,n=!1){if(n)throw t;console.error(t)}const Ce=[];let at=-1;const wr=[];let Ut=null,dr=0;const Za=Promise.resolve();let Ms=null;function hn(t){const e=Ms||Za;return t?e.then(this?t.bind(this):t):e}function yu(t){let e=at+1,r=Ce.length;for(;e<r;){const s=e+r>>>1,n=Ce[s],i=ns(n);i<t||i===t&&n.flags&2?e=s+1:r=s}return e}function ji(t){if(!(t.flags&1)){const e=ns(t),r=Ce[Ce.length-1];!r||!(t.flags&2)&&e>=ns(r)?Ce.push(t):Ce.splice(yu(e),0,t),t.flags|=1,el()}}function el(){Ms||(Ms=Za.then(rl))}function vu(t){M(t)?wr.push(...t):Ut&&t.id===-1?Ut.splice(dr+1,0,t):t.flags&1||(wr.push(t),t.flags|=1),el()}function Xi(t,e,r=at+1){for(;r<Ce.length;r++){const s=Ce[r];if(s&&s.flags&2){if(t&&s.id!==t.uid)continue;Ce.splice(r,1),r--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function tl(t){if(wr.length){const e=[...new Set(wr)].sort((r,s)=>ns(r)-ns(s));if(wr.length=0,Ut){Ut.push(...e);return}for(Ut=e,dr=0;dr<Ut.length;dr++){const r=Ut[dr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}Ut=null,dr=0}}const ns=t=>t.id==null?t.flags&2?-1:1/0:t.id;function rl(t){try{for(at=0;at<Ce.length;at++){const e=Ce[at];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),vs(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;at<Ce.length;at++){const e=Ce[at];e&&(e.flags&=-2)}at=-1,Ce.length=0,tl(),Ms=null,(Ce.length||wr.length)&&rl()}}let Be=null,sl=null;function Hs(t){const e=Be;return Be=t,sl=t&&t.type.__scopeId||null,e}function nl(t,e=Be,r){if(!e||t._n)return t;const s=(...n)=>{s._d&&Vs(-1);const i=Hs(e);let o;try{o=t(...n)}finally{Hs(i),s._d&&Vs(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Fm(t,e){if(Be===null)return t;const r=mn(Be),s=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[i,o,a,l=ne]=e[n];i&&(G(i)&&(i={mounted:i,updated:i}),i.deep&&At(o),s.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function Gt(t,e,r,s){const n=t.dirs,i=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];i&&(a.oldValue=i[o].value);let l=a.dir[s];l&&(Ot(),gt(l,r,8,[t.el,a,t,e]),Ct())}}function $s(t,e){if(ke){let r=ke.provides;const s=ke.parent&&ke.parent.provides;s===r&&(r=ke.provides=Object.create(s)),r[t]=e}}function Ve(t,e,r=!1){const s=$l();if(s||rr){let n=rr?rr._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return r&&G(e)?e.call(s&&s.proxy):e}}function _u(){return!!($l()||rr)}const bu=Symbol.for("v-scx"),wu=()=>Ve(bu);function Wr(t,e,r){return il(t,e,r)}function il(t,e,r=ne){const{immediate:s,deep:n,flush:i,once:o}=r,a=Se({},r),l=e&&s||!e&&i!=="post";let c;if(os){if(i==="sync"){const f=wu();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=pt,f.resume=pt,f.pause=pt,f}}const u=ke;a.call=(f,m,v)=>gt(f,u,m,v);let h=!1;i==="post"?a.scheduler=f=>{Ne(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,m)=>{m?f():ji(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=gu(t,e,a);return os&&(c?c.push(d):l&&d()),d}function Su(t,e,r){const s=this.proxy,n=ue(t)?t.includes(".")?ol(s,t):()=>s[t]:t.bind(s,s);let i;G(e)?i=e:(i=e.handler,r=e);const o=_s(this),a=il(n,i.bind(s),r);return o(),a}function ol(t,e){const r=e.split(".");return()=>{let s=t;for(let n=0;n<r.length&&s;n++)s=s[r[n]];return s}}const Eu=Symbol("_vte"),ku=t=>t.__isTeleport,Au=Symbol("_leaveCb");function Ni(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Ni(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function dn(t,e){return G(t)?Se({name:t.name},e,{setup:t}):t}function al(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Qi(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Fs=new WeakMap;function Gr(t,e,r,s,n=!1){if(M(t)){t.forEach((v,A)=>Gr(v,e&&(M(e)?e[A]:e),r,s,n));return}if(zr(s)&&!n){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Gr(t,e,r,s.component.subTree);return}const i=s.shapeFlag&4?mn(s.component):s.el,o=n?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ne?a.refs={}:a.refs,h=a.setupState,d=Q(h),f=h===ne?Aa:v=>Qi(u,v)?!1:te(d,v),m=(v,A)=>!(A&&Qi(u,A));if(c!=null&&c!==l){if(Zi(e),ue(c))u[c]=null,f(c)&&(h[c]=null);else if(fe(c)){const v=e;m(c,v.k)&&(c.value=null),v.k&&(u[v.k]=null)}}if(G(l))vs(l,a,12,[o,u]);else{const v=ue(l),A=fe(l);if(v||A){const E=()=>{if(t.f){const _=v?f(l)?h[l]:u[l]:m()||!t.k?l.value:u[t.k];if(n)M(_)&&Ei(_,i);else if(M(_))_.includes(i)||_.push(i);else if(v)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];m(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else v?(u[l]=o,f(l)&&(h[l]=o)):A&&(m(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const _=()=>{E(),Fs.delete(t)};_.id=-1,Fs.set(t,_),Ne(_,r)}else Zi(t),E()}}}function Zi(t){const e=Fs.get(t);e&&(e.flags|=8,Fs.delete(t))}on().requestIdleCallback;on().cancelIdleCallback;const zr=t=>!!t.type.__asyncLoader,ll=t=>t.type.__isKeepAlive;function Tu(t,e){cl(t,"a",e)}function Ru(t,e){cl(t,"da",e)}function cl(t,e,r=ke){const s=t.__wdc||(t.__wdc=()=>{let n=r;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(fn(e,s,r),r){let n=r.parent;for(;n&&n.parent;)ll(n.parent.vnode)&&Ou(s,e,r,n),n=n.parent}}function Ou(t,e,r,s){const n=fn(e,t,s,!0);ul(()=>{Ei(s[e],n)},r)}function fn(t,e,r=ke,s=!1){if(r){const n=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Ot();const a=_s(r),l=gt(e,r,t,o);return a(),Ct(),l});return s?n.unshift(i):n.push(i),i}}const xt=t=>(e,r=ke)=>{(!os||t==="sp")&&fn(t,(...s)=>e(...s),r)},Cu=xt("bm"),Pu=xt("m"),xu=xt("bu"),Iu=xt("u"),ju=xt("bum"),ul=xt("um"),Nu=xt("sp"),$u=xt("rtg"),Lu=xt("rtc");function Du(t,e=ke){fn("ec",t,e)}const hl="components";function dl(t,e){return pl(hl,t,!0,e)||t}const fl=Symbol.for("v-ndc");function Uu(t){return ue(t)?pl(hl,t,!1)||t:t||fl}function pl(t,e,r=!0,s=!1){const n=Be||ke;if(n){const i=n.type;{const a=kh(i,!1);if(a&&(a===e||a===Pe(e)||a===sn(Pe(e))))return i}const o=eo(n[t]||i[t],e)||eo(n.appContext[t],e);return!o&&s?i:o}}function eo(t,e){return t&&(t[e]||t[Pe(e)]||t[sn(Pe(e))])}function Bu(t,e,r,s){let n;const i=r,o=M(t);if(o||ue(t)){const a=o&&Tt(t);let l=!1,c=!1;a&&(l=!He(t),c=Pt(t),t=ln(t)),n=new Array(t.length);for(let u=0,h=t.length;u<h;u++)n[u]=e(l?c?kr(Ze(t[u])):Ze(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,i)}else if(re(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,i)}}else n=[];return n}const Yn=t=>t?Ll(t)?mn(t):Yn(t.parent):null,Jr=Se(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Yn(t.parent),$root:t=>Yn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>ml(t),$forceUpdate:t=>t.f||(t.f=()=>{ji(t.update)}),$nextTick:t=>t.n||(t.n=hn.bind(t.proxy)),$watch:t=>Su.bind(t)}),Pn=(t,e)=>t!==ne&&!t.__isScriptSetup&&te(t,e),Mu={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:s,data:n,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return s[e];case 2:return n[e];case 4:return r[e];case 3:return i[e]}else{if(Pn(s,e))return o[e]=1,s[e];if(n!==ne&&te(n,e))return o[e]=2,n[e];if(te(i,e))return o[e]=3,i[e];if(r!==ne&&te(r,e))return o[e]=4,r[e];Xn&&(o[e]=0)}}const c=Jr[e];let u,h;if(c)return e==="$attrs"&&Ee(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==ne&&te(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,te(h,e))return h[e]},set({_:t},e,r){const{data:s,setupState:n,ctx:i}=t;return Pn(n,e)?(n[e]=r,!0):s!==ne&&te(s,e)?(s[e]=r,!0):te(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:s,appContext:n,props:i,type:o}},a){let l;return!!(r[a]||t!==ne&&a[0]!=="$"&&te(t,a)||Pn(e,a)||te(i,a)||te(s,a)||te(Jr,a)||te(n.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:te(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function to(t){return M(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Xn=!0;function Hu(t){const e=ml(t),r=t.proxy,s=t.ctx;Xn=!1,e.beforeCreate&&ro(e.beforeCreate,t,"bc");const{data:n,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:m,activated:v,deactivated:A,beforeDestroy:E,beforeUnmount:_,destroyed:b,unmounted:O,render:B,renderTracked:W,renderTriggered:q,errorCaptured:J,serverPrefetch:V,expose:ce,inheritAttrs:Te,components:Le,directives:xe,filters:Kt}=e;if(c&&Fu(c,s,null),o)for(const z in o){const Z=o[z];G(Z)&&(s[z]=Z.bind(r))}if(n){const z=n.call(r,r);re(z)&&(t.data=ys(z))}if(Xn=!0,i)for(const z in i){const Z=i[z],mt=G(Z)?Z.bind(r,r):G(Z.get)?Z.get.bind(r,r):pt,$t=!G(Z)&&G(Z.set)?Z.set.bind(r):pt,tt=$e({get:mt,set:$t});Object.defineProperty(s,z,{enumerable:!0,configurable:!0,get:()=>tt.value,set:Ie=>tt.value=Ie})}if(a)for(const z in a)gl(a[z],s,r,z);if(l){const z=G(l)?l.call(r):l;Reflect.ownKeys(z).forEach(Z=>{$s(Z,z[Z])})}u&&ro(u,t,"c");function le(z,Z){M(Z)?Z.forEach(mt=>z(mt.bind(r))):Z&&z(Z.bind(r))}if(le(Cu,h),le(Pu,d),le(xu,f),le(Iu,m),le(Tu,v),le(Ru,A),le(Du,J),le(Lu,W),le($u,q),le(ju,_),le(ul,O),le(Nu,V),M(ce))if(ce.length){const z=t.exposed||(t.exposed={});ce.forEach(Z=>{Object.defineProperty(z,Z,{get:()=>r[Z],set:mt=>r[Z]=mt,enumerable:!0})})}else t.exposed||(t.exposed={});B&&t.render===pt&&(t.render=B),Te!=null&&(t.inheritAttrs=Te),Le&&(t.components=Le),xe&&(t.directives=xe),V&&al(t)}function Fu(t,e,r=pt){M(t)&&(t=Qn(t));for(const s in t){const n=t[s];let i;re(n)?"default"in n?i=Ve(n.from||s,n.default,!0):i=Ve(n.from||s):i=Ve(n),fe(i)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[s]=i}}function ro(t,e,r){gt(M(t)?t.map(s=>s.bind(e.proxy)):t.bind(e.proxy),e,r)}function gl(t,e,r,s){let n=s.includes(".")?ol(r,s):()=>r[s];if(ue(t)){const i=e[t];G(i)&&Wr(n,i)}else if(G(t))Wr(n,t.bind(r));else if(re(t))if(M(t))t.forEach(i=>gl(i,e,r,s));else{const i=G(t.handler)?t.handler.bind(r):e[t.handler];G(i)&&Wr(n,i,t)}}function ml(t){const e=t.type,{mixins:r,extends:s}=e,{mixins:n,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!n.length&&!r&&!s?l=e:(l={},n.length&&n.forEach(c=>qs(l,c,o,!0)),qs(l,e,o)),re(e)&&i.set(e,l),l}function qs(t,e,r,s=!1){const{mixins:n,extends:i}=e;i&&qs(t,i,r,!0),n&&n.forEach(o=>qs(t,o,r,!0));for(const o in e)if(!(s&&o==="expose")){const a=qu[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const qu={data:so,props:no,emits:no,methods:Ur,computed:Ur,beforeCreate:Re,created:Re,beforeMount:Re,mounted:Re,beforeUpdate:Re,updated:Re,beforeDestroy:Re,beforeUnmount:Re,destroyed:Re,unmounted:Re,activated:Re,deactivated:Re,errorCaptured:Re,serverPrefetch:Re,components:Ur,directives:Ur,watch:Ku,provide:so,inject:Vu};function so(t,e){return e?t?function(){return Se(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function Vu(t,e){return Ur(Qn(t),Qn(e))}function Qn(t){if(M(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function Re(t,e){return t?[...new Set([].concat(t,e))]:e}function Ur(t,e){return t?Se(Object.create(null),t,e):e}function no(t,e){return t?M(t)&&M(e)?[...new Set([...t,...e])]:Se(Object.create(null),to(t),to(e??{})):e}function Ku(t,e){if(!t)return e;if(!e)return t;const r=Se(Object.create(null),t);for(const s in e)r[s]=Re(t[s],e[s]);return r}function yl(){return{app:null,config:{isNativeTag:Aa,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Wu=0;function Gu(t,e){return function(s,n=null){G(s)||(s=Se({},s)),n!=null&&!re(n)&&(n=null);const i=yl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Wu++,_component:s,_props:n,_container:null,_context:i,_instance:null,version:Th,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&G(u.install)?(o.add(u),u.install(c,...h)):G(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||Ae(s,n);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,mn(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(gt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=rr;rr=c;try{return u()}finally{rr=h}}};return c}}let rr=null;const zu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Pe(e)}Modifiers`]||t[`${Vt(e)}Modifiers`];function Ju(t,e,...r){if(t.isUnmounted)return;const s=t.vnode.props||ne;let n=r;const i=e.startsWith("update:"),o=i&&zu(s,e.slice(7));o&&(o.trim&&(n=r.map(u=>ue(u)?u.trim():u)),o.number&&(n=r.map(nn)));let a,l=s[a=An(e)]||s[a=An(Pe(e))];!l&&i&&(l=s[a=An(Vt(e))]),l&>(l,t,6,n);const c=s[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,gt(c,t,6,n)}}const Yu=new WeakMap;function vl(t,e,r=!1){const s=r?Yu:e.emitsCache,n=s.get(t);if(n!==void 0)return n;const i=t.emits;let o={},a=!1;if(!G(t)){const l=c=>{const u=vl(c,e,!0);u&&(a=!0,Se(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(re(t)&&s.set(t,null),null):(M(i)?i.forEach(l=>o[l]=null):Se(o,i),re(t)&&s.set(t,o),o)}function pn(t,e){return!t||!Zs(e)?!1:(e=e.slice(2).replace(/Once$/,""),te(t,e[0].toLowerCase()+e.slice(1))||te(t,Vt(e))||te(t,e))}function io(t){const{type:e,vnode:r,proxy:s,withProxy:n,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:m,inheritAttrs:v}=t,A=Hs(t);let E,_;try{if(r.shapeFlag&4){const O=n||s,B=O;E=ht(c.call(B,O,u,h,f,d,m)),_=a}else{const O=e;E=ht(O.length>1?O(h,{attrs:a,slots:o,emit:l}):O(h,null)),_=e.props?a:Xu(a)}}catch(O){Yr.length=0,un(O,t,1),E=Ae(qt)}let b=E;if(_&&v!==!1){const O=Object.keys(_),{shapeFlag:B}=b;O.length&&B&7&&(i&&O.some(en)&&(_=Qu(_,i)),b=Ar(b,_,!1,!0))}return r.dirs&&(b=Ar(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&Ni(b,r.transition),E=b,Hs(A),E}const Xu=t=>{let e;for(const r in t)(r==="class"||r==="style"||Zs(r))&&((e||(e={}))[r]=t[r]);return e},Qu=(t,e)=>{const r={};for(const s in t)(!en(s)||!(s.slice(9)in e))&&(r[s]=t[s]);return r};function Zu(t,e,r){const{props:s,children:n,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return s?oo(s,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(_l(o,s,d)&&!pn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?oo(s,o,c):!0:!!o;return!1}function oo(t,e,r){const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!0;for(let n=0;n<s.length;n++){const i=s[n];if(_l(e,t,i)&&!pn(r,i))return!0}return!1}function _l(t,e,r){const s=t[r],n=e[r];return r==="style"&&re(s)&&re(n)?!xr(s,n):s!==n}function eh({vnode:t,parent:e,suspense:r},s){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.suspense.vnode.el=n.el=s,t=n),n===t)(t=e.vnode).el=s,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=s)}const bl={},wl=()=>Object.create(bl),Sl=t=>Object.getPrototypeOf(t)===bl;function th(t,e,r,s=!1){const n={},i=wl();t.propsDefaults=Object.create(null),El(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);r?t.props=s?n:Ya(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function rh(t,e,r,s){const{props:n,attrs:i,vnode:{patchFlag:o}}=t,a=Q(n),[l]=t.propsOptions;let c=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(pn(t.emitsOptions,d))continue;const f=e[d];if(l)if(te(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const m=Pe(d);n[m]=Zn(l,a,m,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{El(t,e,n,i)&&(c=!0);let u;for(const h in a)(!e||!te(e,h)&&((u=Vt(h))===h||!te(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(n[h]=Zn(l,a,h,void 0,t,!0)):delete n[h]);if(i!==a)for(const h in i)(!e||!te(e,h))&&(delete i[h],c=!0)}c&&kt(t.attrs,"set","")}function El(t,e,r,s){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Fr(l))continue;const c=e[l];let u;n&&te(n,u=Pe(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:pn(t.emitsOptions,l)||(!(l in s)||c!==s[l])&&(s[l]=c,o=!0)}if(i){const l=Q(r),c=a||ne;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Zn(n,l,h,c[h],t,!te(c,h))}}return o}function Zn(t,e,r,s,n,i){const o=t[r];if(o!=null){const a=te(o,"default");if(a&&s===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&G(l)){const{propsDefaults:c}=n;if(r in c)s=c[r];else{const u=_s(n);s=c[r]=l.call(null,e),u()}}else s=l;n.ce&&n.ce._setProp(r,s)}o[0]&&(i&&!a?s=!1:o[1]&&(s===""||s===Vt(r))&&(s=!0))}return s}const sh=new WeakMap;function kl(t,e,r=!1){const s=r?sh:e.propsCache,n=s.get(t);if(n)return n;const i=t.props,o={},a=[];let l=!1;if(!G(t)){const u=h=>{l=!0;const[d,f]=kl(h,e,!0);Se(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return re(t)&&s.set(t,_r),_r;if(M(i))for(let u=0;u<i.length;u++){const h=Pe(i[u]);ao(h)&&(o[h]=ne)}else if(i)for(const u in i){const h=Pe(u);if(ao(h)){const d=i[u],f=o[h]=M(d)||G(d)?{type:d}:Se({},d),m=f.type;let v=!1,A=!0;if(M(m))for(let E=0;E<m.length;++E){const _=m[E],b=G(_)&&_.name;if(b==="Boolean"){v=!0;break}else b==="String"&&(A=!1)}else v=G(m)&&m.name==="Boolean";f[0]=v,f[1]=A,(v||te(f,"default"))&&a.push(h)}}const c=[o,a];return re(t)&&s.set(t,c),c}function ao(t){return t[0]!=="$"&&!Fr(t)}const $i=t=>t==="_"||t==="_ctx"||t==="$stable",Li=t=>M(t)?t.map(ht):[ht(t)],nh=(t,e,r)=>{if(e._n)return e;const s=nl((...n)=>Li(e(...n)),r);return s._c=!1,s},Al=(t,e,r)=>{const s=t._ctx;for(const n in t){if($i(n))continue;const i=t[n];if(G(i))e[n]=nh(n,i,s);else if(i!=null){const o=Li(i);e[n]=()=>o}}},Tl=(t,e)=>{const r=Li(e);t.slots.default=()=>r},Rl=(t,e,r)=>{for(const s in e)(r||!$i(s))&&(t[s]=e[s])},ih=(t,e,r)=>{const s=t.slots=wl();if(t.vnode.shapeFlag&32){const n=e._;n?(Rl(s,e,r),r&&Ca(s,"_",n,!0)):Al(e,s)}else e&&Tl(t,e)},oh=(t,e,r)=>{const{vnode:s,slots:n}=t;let i=!0,o=ne;if(s.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:Rl(n,e,r):(i=!e.$stable,Al(e,n)),o=e}else e&&(Tl(t,e),o={default:1});if(i)for(const a in n)!$i(a)&&o[a]==null&&delete n[a]},Ne=hh;function ah(t){return lh(t)}function lh(t,e){const r=on();r.__VUE__=!0;const{insert:s,remove:n,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=pt,insertStaticContent:m}=t,v=(p,g,y,w=null,T=null,S=null,I=void 0,P=null,C=!!g.dynamicChildren)=>{if(p===g)return;p&&!$r(p,g)&&(w=k(p),Ie(p,T,S,!0),p=null),g.patchFlag===-2&&(C=!1,g.dynamicChildren=null);const{type:R,ref:H,shapeFlag:N}=g;switch(R){case gn:A(p,g,y,w);break;case qt:E(p,g,y,w);break;case In:p==null&&_(g,y,w,I);break;case ut:Le(p,g,y,w,T,S,I,P,C);break;default:N&1?B(p,g,y,w,T,S,I,P,C):N&6?xe(p,g,y,w,T,S,I,P,C):(N&64||N&128)&&R.process(p,g,y,w,T,S,I,P,C,D)}H!=null&&T?Gr(H,p&&p.ref,S,g||p,!g):H==null&&p&&p.ref!=null&&Gr(p.ref,null,S,p,!0)},A=(p,g,y,w)=>{if(p==null)s(g.el=a(g.children),y,w);else{const T=g.el=p.el;g.children!==p.children&&c(T,g.children)}},E=(p,g,y,w)=>{p==null?s(g.el=l(g.children||""),y,w):g.el=p.el},_=(p,g,y,w)=>{[p.el,p.anchor]=m(p.children,g,y,w,p.el,p.anchor)},b=({el:p,anchor:g},y,w)=>{let T;for(;p&&p!==g;)T=d(p),s(p,y,w),p=T;s(g,y,w)},O=({el:p,anchor:g})=>{let y;for(;p&&p!==g;)y=d(p),n(p),p=y;n(g)},B=(p,g,y,w,T,S,I,P,C)=>{if(g.type==="svg"?I="svg":g.type==="math"&&(I="mathml"),p==null)W(g,y,w,T,S,I,P,C);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),V(p,g,T,S,I,P,C)}finally{R&&R._endPatch()}}},W=(p,g,y,w,T,S,I,P)=>{let C,R;const{props:H,shapeFlag:N,transition:U,dirs:K}=p;if(C=p.el=o(p.type,S,H&&H.is,H),N&8?u(C,p.children):N&16&&J(p.children,C,null,w,T,xn(p,S),I,P),K&&Gt(p,null,w,"created"),q(C,p,p.scopeId,I,w),H){for(const se in H)se!=="value"&&!Fr(se)&&i(C,se,null,H[se],S,w);"value"in H&&i(C,"value",null,H.value,S),(R=H.onVnodeBeforeMount)&&it(R,w,p)}K&&Gt(p,null,w,"beforeMount");const X=ch(T,U);X&&U.beforeEnter(C),s(C,g,y),((R=H&&H.onVnodeMounted)||X||K)&&Ne(()=>{try{R&&it(R,w,p),X&&U.enter(C),K&&Gt(p,null,w,"mounted")}finally{}},T)},q=(p,g,y,w,T)=>{if(y&&f(p,y),w)for(let S=0;S<w.length;S++)f(p,w[S]);if(T){let S=T.subTree;if(g===S||xl(S.type)&&(S.ssContent===g||S.ssFallback===g)){const I=T.vnode;q(p,I,I.scopeId,I.slotScopeIds,T.parent)}}},J=(p,g,y,w,T,S,I,P,C=0)=>{for(let R=C;R<p.length;R++){const H=p[R]=P?Et(p[R]):ht(p[R]);v(null,H,g,y,w,T,S,I,P)}},V=(p,g,y,w,T,S,I)=>{const P=g.el=p.el;let{patchFlag:C,dynamicChildren:R,dirs:H}=g;C|=p.patchFlag&16;const N=p.props||ne,U=g.props||ne;let K;if(y&&zt(y,!1),(K=U.onVnodeBeforeUpdate)&&it(K,y,g,p),H&&Gt(g,p,y,"beforeUpdate"),y&&zt(y,!0),(N.innerHTML&&U.innerHTML==null||N.textContent&&U.textContent==null)&&u(P,""),R?ce(p.dynamicChildren,R,P,y,w,xn(g,T),S):I||Z(p,g,P,null,y,w,xn(g,T),S,!1),C>0){if(C&16)Te(P,N,U,y,T);else if(C&2&&N.class!==U.class&&i(P,"class",null,U.class,T),C&4&&i(P,"style",N.style,U.style,T),C&8){const X=g.dynamicProps;for(let se=0;se<X.length;se++){const ie=X[se],pe=N[ie],_e=U[ie];(_e!==pe||ie==="value")&&i(P,ie,pe,_e,T,y)}}C&1&&p.children!==g.children&&u(P,g.children)}else!I&&R==null&&Te(P,N,U,y,T);((K=U.onVnodeUpdated)||H)&&Ne(()=>{K&&it(K,y,g,p),H&&Gt(g,p,y,"updated")},w)},ce=(p,g,y,w,T,S,I)=>{for(let P=0;P<g.length;P++){const C=p[P],R=g[P],H=C.el&&(C.type===ut||!$r(C,R)||C.shapeFlag&198)?h(C.el):y;v(C,R,H,null,w,T,S,I,!0)}},Te=(p,g,y,w,T)=>{if(g!==y){if(g!==ne)for(const S in g)!Fr(S)&&!(S in y)&&i(p,S,g[S],null,T,w);for(const S in y){if(Fr(S))continue;const I=y[S],P=g[S];I!==P&&S!=="value"&&i(p,S,P,I,T,w)}"value"in y&&i(p,"value",g.value,y.value,T)}},Le=(p,g,y,w,T,S,I,P,C)=>{const R=g.el=p?p.el:a(""),H=g.anchor=p?p.anchor:a("");let{patchFlag:N,dynamicChildren:U,slotScopeIds:K}=g;K&&(P=P?P.concat(K):K),p==null?(s(R,y,w),s(H,y,w),J(g.children||[],y,H,T,S,I,P,C)):N>0&&N&64&&U&&p.dynamicChildren&&p.dynamicChildren.length===U.length?(ce(p.dynamicChildren,U,y,T,S,I,P),(g.key!=null||T&&g===T.subTree)&&Ol(p,g,!0)):Z(p,g,y,H,T,S,I,P,C)},xe=(p,g,y,w,T,S,I,P,C)=>{g.slotScopeIds=P,p==null?g.shapeFlag&512?T.ctx.activate(g,y,w,I,C):Kt(g,y,w,T,S,I,C):Nt(p,g,C)},Kt=(p,g,y,w,T,S,I)=>{const P=p.component=_h(p,w,T);if(ll(p)&&(P.ctx.renderer=D),bh(P,!1,I),P.asyncDep){if(T&&T.registerDep(P,le,I),!p.el){const C=P.subTree=Ae(qt);E(null,C,g,y),p.placeholder=C.el}}else le(P,p,g,y,T,S,I)},Nt=(p,g,y)=>{const w=g.component=p.component;if(Zu(p,g,y))if(w.asyncDep&&!w.asyncResolved){z(w,g,y);return}else w.next=g,w.update();else g.el=p.el,w.vnode=g},le=(p,g,y,w,T,S,I)=>{const P=()=>{if(p.isMounted){let{next:N,bu:U,u:K,parent:X,vnode:se}=p;{const st=Cl(p);if(st){N&&(N.el=se.el,z(p,N,I)),st.asyncDep.then(()=>{Ne(()=>{p.isUnmounted||R()},T)});return}}let ie=N,pe;zt(p,!1),N?(N.el=se.el,z(p,N,I)):N=se,U&&Ns(U),(pe=N.props&&N.props.onVnodeBeforeUpdate)&&it(pe,X,N,se),zt(p,!0);const _e=io(p),rt=p.subTree;p.subTree=_e,v(rt,_e,h(rt.el),k(rt),p,T,S),N.el=_e.el,ie===null&&eh(p,_e.el),K&&Ne(K,T),(pe=N.props&&N.props.onVnodeUpdated)&&Ne(()=>it(pe,X,N,se),T)}else{let N;const{el:U,props:K}=g,{bm:X,m:se,parent:ie,root:pe,type:_e}=p,rt=zr(g);zt(p,!1),X&&Ns(X),!rt&&(N=K&&K.onVnodeBeforeMount)&&it(N,ie,g),zt(p,!0);{pe.ce&&pe.ce._hasShadowRoot()&&pe.ce._injectChildStyle(_e,p.parent?p.parent.type:void 0);const st=p.subTree=io(p);v(null,st,y,w,p,T,S),g.el=st.el}if(se&&Ne(se,T),!rt&&(N=K&&K.onVnodeMounted)){const st=g;Ne(()=>it(N,ie,st),T)}(g.shapeFlag&256||ie&&zr(ie.vnode)&&ie.vnode.shapeFlag&256)&&p.a&&Ne(p.a,T),p.isMounted=!0,g=y=w=null}};p.scope.on();const C=p.effect=new La(P);p.scope.off();const R=p.update=C.run.bind(C),H=p.job=C.runIfDirty.bind(C);H.i=p,H.id=p.uid,C.scheduler=()=>ji(H),zt(p,!0),R()},z=(p,g,y)=>{g.component=p;const w=p.vnode.props;p.vnode=g,p.next=null,rh(p,g.props,w,y),oh(p,g.children,y),Ot(),Xi(p),Ct()},Z=(p,g,y,w,T,S,I,P,C=!1)=>{const R=p&&p.children,H=p?p.shapeFlag:0,N=g.children,{patchFlag:U,shapeFlag:K}=g;if(U>0){if(U&128){$t(R,N,y,w,T,S,I,P,C);return}else if(U&256){mt(R,N,y,w,T,S,I,P,C);return}}K&8?(H&16&&Fe(R,T,S),N!==R&&u(y,N)):H&16?K&16?$t(R,N,y,w,T,S,I,P,C):Fe(R,T,S,!0):(H&8&&u(y,""),K&16&&J(N,y,w,T,S,I,P,C))},mt=(p,g,y,w,T,S,I,P,C)=>{p=p||_r,g=g||_r;const R=p.length,H=g.length,N=Math.min(R,H);let U;for(U=0;U<N;U++){const K=g[U]=C?Et(g[U]):ht(g[U]);v(p[U],K,y,null,T,S,I,P,C)}R>H?Fe(p,T,S,!0,!1,N):J(g,y,w,T,S,I,P,C,N)},$t=(p,g,y,w,T,S,I,P,C)=>{let R=0;const H=g.length;let N=p.length-1,U=H-1;for(;R<=N&&R<=U;){const K=p[R],X=g[R]=C?Et(g[R]):ht(g[R]);if($r(K,X))v(K,X,y,null,T,S,I,P,C);else break;R++}for(;R<=N&&R<=U;){const K=p[N],X=g[U]=C?Et(g[U]):ht(g[U]);if($r(K,X))v(K,X,y,null,T,S,I,P,C);else break;N--,U--}if(R>N){if(R<=U){const K=U+1,X=K<H?g[K].el:w;for(;R<=U;)v(null,g[R]=C?Et(g[R]):ht(g[R]),y,X,T,S,I,P,C),R++}}else if(R>U)for(;R<=N;)Ie(p[R],T,S,!0),R++;else{const K=R,X=R,se=new Map;for(R=X;R<=U;R++){const De=g[R]=C?Et(g[R]):ht(g[R]);De.key!=null&&se.set(De.key,R)}let ie,pe=0;const _e=U-X+1;let rt=!1,st=0;const jr=new Array(_e);for(R=0;R<_e;R++)jr[R]=0;for(R=K;R<=N;R++){const De=p[R];if(pe>=_e){Ie(De,T,S,!0);continue}let nt;if(De.key!=null)nt=se.get(De.key);else for(ie=X;ie<=U;ie++)if(jr[ie-X]===0&&$r(De,g[ie])){nt=ie;break}nt===void 0?Ie(De,T,S,!0):(jr[nt-X]=R+1,nt>=st?st=nt:rt=!0,v(De,g[nt],y,null,T,S,I,P,C),pe++)}const qi=rt?uh(jr):_r;for(ie=qi.length-1,R=_e-1;R>=0;R--){const De=X+R,nt=g[De],Vi=g[De+1],Ki=De+1<H?Vi.el||Pl(Vi):w;jr[R]===0?v(null,nt,y,Ki,T,S,I,P,C):rt&&(ie<0||R!==qi[ie]?tt(nt,y,Ki,2):ie--)}}},tt=(p,g,y,w,T=null)=>{const{el:S,type:I,transition:P,children:C,shapeFlag:R}=p;if(R&6){tt(p.component.subTree,g,y,w);return}if(R&128){p.suspense.move(g,y,w);return}if(R&64){I.move(p,g,y,D);return}if(I===ut){s(S,g,y);for(let N=0;N<C.length;N++)tt(C[N],g,y,w);s(p.anchor,g,y);return}if(I===In){b(p,g,y);return}if(w!==2&&R&1&&P)if(w===0)P.beforeEnter(S),s(S,g,y),Ne(()=>P.enter(S),T);else{const{leave:N,delayLeave:U,afterLeave:K}=P,X=()=>{p.ctx.isUnmounted?n(S):s(S,g,y)},se=()=>{S._isLeaving&&S[Au](!0),N(S,()=>{X(),K&&K()})};U?U(S,X,se):se()}else s(S,g,y)},Ie=(p,g,y,w=!1,T=!1)=>{const{type:S,props:I,ref:P,children:C,dynamicChildren:R,shapeFlag:H,patchFlag:N,dirs:U,cacheIndex:K,memo:X}=p;if(N===-2&&(T=!1),P!=null&&(Ot(),Gr(P,null,y,p,!0),Ct()),K!=null&&(g.renderCache[K]=void 0),H&256){g.ctx.deactivate(p);return}const se=H&1&&U,ie=!zr(p);let pe;if(ie&&(pe=I&&I.onVnodeBeforeUnmount)&&it(pe,g,p),H&6)Wt(p.component,y,w);else{if(H&128){p.suspense.unmount(y,w);return}se&&Gt(p,null,g,"beforeUnmount"),H&64?p.type.remove(p,g,y,D,w):R&&!R.hasOnce&&(S!==ut||N>0&&N&64)?Fe(R,g,y,!1,!0):(S===ut&&N&384||!T&&H&16)&&Fe(C,g,y),w&&sr(p)}const _e=X!=null&&K==null;(ie&&(pe=I&&I.onVnodeUnmounted)||se||_e)&&Ne(()=>{pe&&it(pe,g,p),se&&Gt(p,null,g,"unmounted"),_e&&(p.el=null)},y)},sr=p=>{const{type:g,el:y,anchor:w,transition:T}=p;if(g===ut){nr(y,w);return}if(g===In){O(p);return}const S=()=>{n(y),T&&!T.persisted&&T.afterLeave&&T.afterLeave()};if(p.shapeFlag&1&&T&&!T.persisted){const{leave:I,delayLeave:P}=T,C=()=>I(y,S);P?P(p.el,S,C):C()}else S()},nr=(p,g)=>{let y;for(;p!==g;)y=d(p),n(p),p=y;n(g)},Wt=(p,g,y)=>{const{bum:w,scope:T,job:S,subTree:I,um:P,m:C,a:R}=p;lo(C),lo(R),w&&Ns(w),T.stop(),S&&(S.flags|=8,Ie(I,p,g,y)),P&&Ne(P,g),Ne(()=>{p.isUnmounted=!0},g)},Fe=(p,g,y,w=!1,T=!1,S=0)=>{for(let I=S;I<p.length;I++)Ie(p[I],g,y,w,T)},k=p=>{if(p.shapeFlag&6)return k(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const g=d(p.anchor||p.el),y=g&&g[Eu];return y?d(y):g};let $=!1;const j=(p,g,y)=>{let w;p==null?g._vnode&&(Ie(g._vnode,null,null,!0),w=g._vnode.component):v(g._vnode||null,p,g,null,null,null,y),g._vnode=p,$||($=!0,Xi(w),tl(),$=!1)},D={p:v,um:Ie,m:tt,r:sr,mt:Kt,mc:J,pc:Z,pbc:ce,n:k,o:t};return{render:j,hydrate:void 0,createApp:Gu(j)}}function xn({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function zt({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function ch(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Ol(t,e,r=!1){const s=t.children,n=e.children;if(M(s)&&M(n))for(let i=0;i<s.length;i++){const o=s[i];let a=n[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[i]=Et(n[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Ol(o,a)),a.type===gn&&(a.patchFlag===-1&&(a=n[i]=Et(a)),a.el=o.el),a.type===qt&&!a.el&&(a.el=o.el)}}function uh(t){const e=t.slice(),r=[0];let s,n,i,o,a;const l=t.length;for(s=0;s<l;s++){const c=t[s];if(c!==0){if(n=r[r.length-1],t[n]<c){e[s]=n,r.push(s);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[s]=r[i-1]),r[i]=s)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Cl(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Cl(e)}function lo(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Pl(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Pl(e.subTree):null}const xl=t=>t.__isSuspense;function hh(t,e){e&&e.pendingBranch?M(t)?e.effects.push(...t):e.effects.push(t):vu(t)}const ut=Symbol.for("v-fgt"),gn=Symbol.for("v-txt"),qt=Symbol.for("v-cmt"),In=Symbol.for("v-stc"),Yr=[];let Me=null;function Sr(t=!1){Yr.push(Me=t?null:[])}function dh(){Yr.pop(),Me=Yr[Yr.length-1]||null}let is=1;function Vs(t,e=!1){is+=t,t<0&&Me&&e&&(Me.hasOnce=!0)}function Il(t){return t.dynamicChildren=is>0?Me||_r:null,dh(),is>0&&Me&&Me.push(t),t}function ei(t,e,r,s,n,i){return Il(ze(t,e,r,s,n,i,!0))}function Di(t,e,r,s,n){return Il(Ae(t,e,r,s,n,!0))}function Ks(t){return t?t.__v_isVNode===!0:!1}function $r(t,e){return t.type===e.type&&t.key===e.key}const jl=({key:t})=>t??null,Ls=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?ue(t)||fe(t)||G(t)?{i:Be,r:t,k:e,f:!!r}:t:null);function ze(t,e=null,r=null,s=0,n=null,i=t===ut?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&jl(e),ref:e&&Ls(e),scopeId:sl,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Be};return a?(Ui(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=ue(r)?8:16),is>0&&!o&&Me&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Me.push(l),l}const Ae=fh;function fh(t,e=null,r=null,s=0,n=null,i=!1){if((!t||t===fl)&&(t=qt),Ks(t)){const a=Ar(t,e,!0);return r&&Ui(a,r),is>0&&!i&&Me&&(a.shapeFlag&6?Me[Me.indexOf(t)]=a:Me.push(a)),a.patchFlag=-2,a}if(Ah(t)&&(t=t.__vccOpts),e){e=ph(e);let{class:a,style:l}=e;a&&!ue(a)&&(e.class=an(a)),re(l)&&(cn(l)&&!M(l)&&(l=Se({},l)),e.style=ki(l))}const o=ue(t)?1:xl(t)?128:ku(t)?64:re(t)?4:G(t)?2:0;return ze(t,e,r,s,n,o,i,!0)}function ph(t){return t?cn(t)||Sl(t)?Se({},t):t:null}function Ar(t,e,r=!1,s=!1){const{props:n,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?mh(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&jl(c),ref:e&&e.ref?r&&i?M(i)?i.concat(Ls(e)):[i,Ls(e)]:Ls(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ut?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ar(t.ssContent),ssFallback:t.ssFallback&&Ar(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&s&&Ni(u,l.clone(u)),u}function Nl(t=" ",e=0){return Ae(gn,null,t,e)}function gh(t="",e=!1){return e?(Sr(),Di(qt,null,t)):Ae(qt,null,t)}function ht(t){return t==null||typeof t=="boolean"?Ae(qt):M(t)?Ae(ut,null,t.slice()):Ks(t)?Et(t):Ae(gn,null,String(t))}function Et(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ar(t)}function Ui(t,e){let r=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(M(e))r=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Ui(t,n()),n._c&&(n._d=!0));return}else{r=32;const n=e._;!n&&!Sl(e)?e._ctx=Be:n===3&&Be&&(Be.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Be},r=32):(e=String(e),s&64?(r=16,e=[Nl(e)]):r=8);t.children=e,t.shapeFlag|=r}function mh(...t){const e={};for(let r=0;r<t.length;r++){const s=t[r];for(const n in s)if(n==="class")e.class!==s.class&&(e.class=an([e.class,s.class]));else if(n==="style")e.style=ki([e.style,s.style]);else if(Zs(n)){const i=e[n],o=s[n];o&&i!==o&&!(M(i)&&i.includes(o))?e[n]=i?[].concat(i,o):o:o==null&&i==null&&!en(n)&&(e[n]=o)}else n!==""&&(e[n]=s[n])}return e}function it(t,e,r,s=null){gt(t,e,7,[r,s])}const yh=yl();let vh=0;function _h(t,e,r){const s=t.type,n=(e?e.appContext:t.appContext)||yh,i={uid:vh++,vnode:t,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ja(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:kl(s,n),emitsOptions:vl(s,n),emit:null,emitted:null,propsDefaults:ne,inheritAttrs:s.inheritAttrs,ctx:ne,data:ne,props:ne,attrs:ne,slots:ne,refs:ne,setupState:ne,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Ju.bind(null,i),t.ce&&t.ce(i),i}let ke=null;const $l=()=>ke||Be;let Ws,ti;{const t=on(),e=(r,s)=>{let n;return(n=t[r])||(n=t[r]=[]),n.push(s),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};Ws=e("__VUE_INSTANCE_SETTERS__",r=>ke=r),ti=e("__VUE_SSR_SETTERS__",r=>os=r)}const _s=t=>{const e=ke;return Ws(t),t.scope.on(),()=>{t.scope.off(),Ws(e)}},co=()=>{ke&&ke.scope.off(),Ws(null)};function Ll(t){return t.vnode.shapeFlag&4}let os=!1;function bh(t,e=!1,r=!1){e&&ti(e);const{props:s,children:n}=t.vnode,i=Ll(t);th(t,s,i,e),ih(t,n,r||e);const o=i?wh(t,e):void 0;return e&&ti(!1),o}function wh(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Mu);const{setup:s}=r;if(s){Ot();const n=t.setupContext=s.length>1?Eh(t):null,i=_s(t),o=vs(s,t,0,[t.props,n]),a=Ta(o);if(Ct(),i(),(a||t.sp)&&!zr(t)&&al(t),a){if(o.then(co,co),e)return o.then(l=>{uo(t,l)}).catch(l=>{un(l,t,0)});t.asyncDep=o}else uo(t,o)}else Dl(t)}function uo(t,e,r){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:re(e)&&(t.setupState=Qa(e)),Dl(t)}function Dl(t,e,r){const s=t.type;t.render||(t.render=s.render||pt);{const n=_s(t);Ot();try{Hu(t)}finally{Ct(),n()}}}const Sh={get(t,e){return Ee(t,"get",""),t[e]}};function Eh(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Sh),slots:t.slots,emit:t.emit,expose:e}}function mn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Qa(Ii(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in Jr)return Jr[r](t)},has(e,r){return r in e||r in Jr}})):t.proxy}function kh(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Ah(t){return G(t)&&"__vccOpts"in t}const $e=(t,e)=>fu(t,e,os);function as(t,e,r){try{Vs(-1);const s=arguments.length;return s===2?re(e)&&!M(e)?Ks(e)?Ae(t,null,[e]):Ae(t,e):Ae(t,null,e):(s>3?r=Array.prototype.slice.call(arguments,2):s===3&&Ks(r)&&(r=[r]),Ae(t,e,r))}finally{Vs(1)}}const Th="3.5.34";/**
|
|
15
15
|
* @vue/runtime-dom v3.5.34
|
|
16
16
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
17
|
* @license MIT
|
|
18
|
-
**/let
|
|
18
|
+
**/let ri;const ho=typeof window<"u"&&window.trustedTypes;if(ho)try{ri=ho.createPolicy("vue",{createHTML:t=>t})}catch{}const Ul=ri?t=>ri.createHTML(t):t=>t,Rh="http://www.w3.org/2000/svg",Oh="http://www.w3.org/1998/Math/MathML",bt=typeof document<"u"?document:null,fo=bt&&bt.createElement("template"),Ch={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,s)=>{const n=e==="svg"?bt.createElementNS(Rh,t):e==="mathml"?bt.createElementNS(Oh,t):r?bt.createElement(t,{is:r}):bt.createElement(t);return t==="select"&&s&&s.multiple!=null&&n.setAttribute("multiple",s.multiple),n},createText:t=>bt.createTextNode(t),createComment:t=>bt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>bt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,s,n,i){const o=r?r.previousSibling:e.lastChild;if(n&&(n===i||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),r),!(n===i||!(n=n.nextSibling)););else{fo.innerHTML=Ul(s==="svg"?`<svg>${t}</svg>`:s==="mathml"?`<math>${t}</math>`:t);const a=fo.content;if(s==="svg"||s==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[o?o.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},Ph=Symbol("_vtc");function xh(t,e,r){const s=t[Ph];s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const po=Symbol("_vod"),Ih=Symbol("_vsh"),jh=Symbol(""),Nh=/(?:^|;)\s*display\s*:/;function $h(t,e,r){const s=t.style,n=ue(r);let i=!1;if(r&&!n){if(e)if(ue(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&Br(s,a,"")}else for(const o in e)r[o]==null&&Br(s,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?Dh(t,o,!ue(e)&&e?e[o]:void 0,a)||Br(s,o,a):Br(s,o,"")}}else if(n){if(e!==r){const o=s[jh];o&&(r+=";"+o),s.cssText=r,i=Nh.test(r)}}else e&&t.removeAttribute("style");po in t&&(t[po]=i?s.display:"",t[Ih]&&(s.display="none"))}const go=/\s*!important$/;function Br(t,e,r){if(M(r))r.forEach(s=>Br(t,e,s));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const s=Lh(t,e);go.test(r)?t.setProperty(Vt(s),r.replace(go,""),"important"):t[s]=r}}const mo=["Webkit","Moz","ms"],jn={};function Lh(t,e){const r=jn[e];if(r)return r;let s=Pe(e);if(s!=="filter"&&s in t)return jn[e]=s;s=sn(s);for(let n=0;n<mo.length;n++){const i=mo[n]+s;if(i in t)return jn[e]=i}return e}function Dh(t,e,r,s){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&ue(s)&&r===s}const yo="http://www.w3.org/1999/xlink";function vo(t,e,r,s,n,i=Uc(e)){s&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(yo,e.slice(6,e.length)):t.setAttributeNS(yo,e,r):r==null||i&&!Pa(r)?t.removeAttribute(e):t.setAttribute(e,i?"":Ke(r)?String(r):r)}function _o(t,e,r,s,n){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?Ul(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let o=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=Pa(r):r==null&&a==="string"?(r="",o=!0):a==="number"&&(r=0,o=!0)}try{t[e]=r}catch{}o&&t.removeAttribute(n||e)}function Mt(t,e,r,s){t.addEventListener(e,r,s)}function Uh(t,e,r,s){t.removeEventListener(e,r,s)}const bo=Symbol("_vei");function Bh(t,e,r,s,n=null){const i=t[bo]||(t[bo]={}),o=i[e];if(s&&o)o.value=s;else{const[a,l]=Mh(e);if(s){const c=i[e]=qh(s,n);Mt(t,a,c,l)}else o&&(Uh(t,a,o,l),i[e]=void 0)}}const wo=/(?:Once|Passive|Capture)$/;function Mh(t){let e;if(wo.test(t)){e={};let s;for(;s=t.match(wo);)t=t.slice(0,t.length-s[0].length),e[s[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Vt(t.slice(2)),e]}let Nn=0;const Hh=Promise.resolve(),Fh=()=>Nn||(Hh.then(()=>Nn=0),Nn=Date.now());function qh(t,e){const r=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=r.attached)return;gt(Vh(s,r.value),e,5,[s])};return r.value=t,r.attached=Fh(),r}function Vh(t,e){if(M(e)){const r=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{r.call(t),t._stopped=!0},e.map(s=>n=>!n._stopped&&s&&s(n))}else return e}const So=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Kh=(t,e,r,s,n,i)=>{const o=n==="svg";e==="class"?xh(t,s,o):e==="style"?$h(t,r,s):Zs(e)?en(e)||Bh(t,e,r,s,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Wh(t,e,s,o))?(_o(t,e,s),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&vo(t,e,s,o,i,e!=="value")):t._isVueCE&&(Gh(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!ue(s)))?_o(t,Pe(e),s,i,e):(e==="true-value"?t._trueValue=s:e==="false-value"&&(t._falseValue=s),vo(t,e,s,o))};function Wh(t,e,r,s){if(s)return!!(e==="innerHTML"||e==="textContent"||e in t&&So(e)&&G(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return So(e)&&ue(r)?!1:e in t}function Gh(t,e){const r=t._def.props;if(!r)return!1;const s=Pe(e);return Array.isArray(r)?r.some(n=>Pe(n)===s):Object.keys(r).some(n=>Pe(n)===s)}const Tr=t=>{const e=t.props["onUpdate:modelValue"]||!1;return M(e)?r=>Ns(e,r):e};function zh(t){t.target.composing=!0}function Eo(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Rt=Symbol("_assign");function ko(t,e,r){return e&&(t=t.trim()),r&&(t=nn(t)),t}const qm={created(t,{modifiers:{lazy:e,trim:r,number:s}},n){t[Rt]=Tr(n);const i=s||n.props&&n.props.type==="number";Mt(t,e?"change":"input",o=>{o.target.composing||t[Rt](ko(t.value,r,i))}),(r||i)&&Mt(t,"change",()=>{t.value=ko(t.value,r,i)}),e||(Mt(t,"compositionstart",zh),Mt(t,"compositionend",Eo),Mt(t,"change",Eo))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:s,trim:n,number:i}},o){if(t[Rt]=Tr(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?nn(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(s&&e===r||n&&t.value.trim()===l)||(t.value=l)}},Vm={deep:!0,created(t,e,r){t[Rt]=Tr(r),Mt(t,"change",()=>{const s=t._modelValue,n=ls(t),i=t.checked,o=t[Rt];if(M(s)){const a=Ai(s,n),l=a!==-1;if(i&&!l)o(s.concat(n));else if(!i&&l){const c=[...s];c.splice(a,1),o(c)}}else if(Pr(s)){const a=new Set(s);i?a.add(n):a.delete(n),o(a)}else o(Bl(t,i))})},mounted:Ao,beforeUpdate(t,e,r){t[Rt]=Tr(r),Ao(t,e,r)}};function Ao(t,{value:e,oldValue:r},s){t._modelValue=e;let n;if(M(e))n=Ai(e,s.props.value)>-1;else if(Pr(e))n=e.has(s.props.value);else{if(e===r)return;n=xr(e,Bl(t,!0))}t.checked!==n&&(t.checked=n)}const Km={deep:!0,created(t,{value:e,modifiers:{number:r}},s){const n=Pr(e);Mt(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?nn(ls(o)):ls(o));t[Rt](t.multiple?n?new Set(i):i:i[0]),t._assigning=!0,hn(()=>{t._assigning=!1})}),t[Rt]=Tr(s)},mounted(t,{value:e}){To(t,e)},beforeUpdate(t,e,r){t[Rt]=Tr(r)},updated(t,{value:e}){t._assigning||To(t,e)}};function To(t,e){const r=t.multiple,s=M(e);if(!(r&&!s&&!Pr(e))){for(let n=0,i=t.options.length;n<i;n++){const o=t.options[n],a=ls(o);if(r)if(s){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=Ai(e,a)>-1}else o.selected=e.has(a);else if(xr(ls(o),e)){t.selectedIndex!==n&&(t.selectedIndex=n);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function ls(t){return"_value"in t?t._value:t.value}function Bl(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const Jh=["ctrl","shift","alt","meta"],Yh={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Jh.some(r=>t[`${r}Key`]&&!e.includes(r))},Wm=(t,e)=>{if(!t)return t;const r=t._withMods||(t._withMods={}),s=e.join(".");return r[s]||(r[s]=((n,...i)=>{for(let o=0;o<e.length;o++){const a=Yh[e[o]];if(a&&a(n,e))return}return t(n,...i)}))},Xh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Gm=(t,e)=>{const r=t._withKeys||(t._withKeys={}),s=e.join(".");return r[s]||(r[s]=(n=>{if(!("key"in n))return;const i=Vt(n.key);if(e.some(o=>o===i||Xh[o]===i))return t(n)}))},Qh=Se({patchProp:Kh},Ch);let Ro;function Zh(){return Ro||(Ro=ah(Qh))}const ed=((...t)=>{const e=Zh().createApp(...t),{mount:r}=e;return e.mount=s=>{const n=rd(s);if(!n)return;const i=e._component;!G(i)&&!i.render&&!i.template&&(i.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=r(n,!1,td(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function td(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function rd(t){return ue(t)?document.querySelector(t):t}/*!
|
|
19
19
|
* pinia v3.0.4
|
|
20
20
|
* (c) 2025 Eduardo San Martin Morote
|
|
21
21
|
* @license MIT
|
|
22
|
-
*/let Ml;const
|
|
22
|
+
*/let Ml;const yn=t=>Ml=t,Hl=Symbol();function si(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Xr;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Xr||(Xr={}));function sd(){const t=Na(!0),e=t.run(()=>Kr({}));let r=[],s=[];const n=Ii({install(i){yn(n),n._a=i,i.provide(Hl,n),i.config.globalProperties.$pinia=n,s.forEach(o=>r.push(o)),s=[]},use(i){return this._a?r.push(i):s.push(i),this},_p:r,_a:null,_e:t,_s:new Map,state:e});return n}const Fl=()=>{};function Oo(t,e,r,s=Fl){t.add(e);const n=()=>{t.delete(e)&&s()};return!r&&$a()&&Mc(n),n}function or(t,...e){t.forEach(r=>{r(...e)})}const nd=t=>t(),Co=Symbol(),$n=Symbol();function ni(t,e){t instanceof Map&&e instanceof Map?e.forEach((r,s)=>t.set(s,r)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const r in e){if(!e.hasOwnProperty(r))continue;const s=e[r],n=t[r];si(n)&&si(s)&&t.hasOwnProperty(r)&&!fe(s)&&!Tt(s)?t[r]=ni(n,s):t[r]=s}return t}const id=Symbol();function od(t){return!si(t)||!Object.prototype.hasOwnProperty.call(t,id)}const{assign:Dt}=Object;function ad(t){return!!(fe(t)&&t.effect)}function ld(t,e,r,s){const{state:n,actions:i,getters:o}=e,a=r.state.value[t];let l;function c(){a||(r.state.value[t]=n?n():{});const u=cu(r.state.value[t]);return Dt(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=Ii($e(()=>{yn(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=ql(t,c,e,r,s,!0),l}function ql(t,e,r={},s,n,i){let o;const a=Dt({actions:{}},r),l={deep:!0};let c,u,h=new Set,d=new Set,f;const m=s.state.value[t];!i&&!m&&(s.state.value[t]={});let v;function A(J){let V;c=u=!1,typeof J=="function"?(J(s.state.value[t]),V={type:Xr.patchFunction,storeId:t,events:f}):(ni(s.state.value[t],J),V={type:Xr.patchObject,payload:J,storeId:t,events:f});const ce=v=Symbol();hn().then(()=>{v===ce&&(c=!0)}),u=!0,or(h,V,s.state.value[t])}const E=i?function(){const{state:V}=r,ce=V?V():{};this.$patch(Te=>{Dt(Te,ce)})}:Fl;function _(){o.stop(),h.clear(),d.clear(),s._s.delete(t)}const b=(J,V="")=>{if(Co in J)return J[$n]=V,J;const ce=function(){yn(s);const Te=Array.from(arguments),Le=new Set,xe=new Set;function Kt(z){Le.add(z)}function Nt(z){xe.add(z)}or(d,{args:Te,name:ce[$n],store:B,after:Kt,onError:Nt});let le;try{le=J.apply(this&&this.$id===t?this:B,Te)}catch(z){throw or(xe,z),z}return le instanceof Promise?le.then(z=>(or(Le,z),z)).catch(z=>(or(xe,z),Promise.reject(z))):(or(Le,le),le)};return ce[Co]=!0,ce[$n]=V,ce},O={_p:s,$id:t,$onAction:Oo.bind(null,d),$patch:A,$reset:E,$subscribe(J,V={}){const ce=Oo(h,J,V.detached,()=>Te()),Te=o.run(()=>Wr(()=>s.state.value[t],Le=>{(V.flush==="sync"?u:c)&&J({storeId:t,type:Xr.direct,events:f},Le)},Dt({},l,V)));return ce},$dispose:_},B=ys(O);s._s.set(t,B);const q=(s._a&&s._a.runWithContext||nd)(()=>s._e.run(()=>(o=Na()).run(()=>e({action:b}))));for(const J in q){const V=q[J];if(fe(V)&&!ad(V)||Tt(V))i||(m&&od(V)&&(fe(V)?V.value=m[J]:ni(V,m[J])),s.state.value[t][J]=V);else if(typeof V=="function"){const ce=b(V,J);q[J]=ce,a.actions[J]=V}}return Dt(B,q),Dt(Q(B),q),Object.defineProperty(B,"$state",{get:()=>s.state.value[t],set:J=>{A(V=>{Dt(V,J)})}}),s._p.forEach(J=>{Dt(B,o.run(()=>J({store:B,app:s._a,pinia:s,options:a})))}),m&&i&&r.hydrate&&r.hydrate(B.$state,m),c=!0,u=!0,B}/*! #__NO_SIDE_EFFECTS__ */function cd(t,e,r){let s;const n=typeof e=="function";s=n?r:e;function i(o,a){const l=_u();return o=o||(l?Ve(Hl,null):null),o&&yn(o),o=Ml,o._s.has(t)||(n?ql(t,e,s,o):ld(t,s,o)),o._s.get(t)}return i.$id=t,i}/*!
|
|
23
23
|
* vue-router v4.6.4
|
|
24
24
|
* (c) 2025 Eduardo San Martin Morote
|
|
25
25
|
* @license MIT
|
|
26
|
-
*/const fr=typeof document<"u";function Vl(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function
|
|
26
|
+
*/const fr=typeof document<"u";function Vl(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function ud(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Vl(t.default)}const ee=Object.assign;function Ln(t,e){const r={};for(const s in e){const n=e[s];r[s]=et(n)?n.map(t):t(n)}return r}const Qr=()=>{},et=Array.isArray;function Po(t,e){const r={};for(const s in t)r[s]=s in e?e[s]:t[s];return r}const Kl=/#/g,hd=/&/g,dd=/\//g,fd=/=/g,pd=/\?/g,Wl=/\+/g,gd=/%5B/g,md=/%5D/g,Gl=/%5E/g,yd=/%60/g,zl=/%7B/g,vd=/%7C/g,Jl=/%7D/g,_d=/%20/g;function Bi(t){return t==null?"":encodeURI(""+t).replace(vd,"|").replace(gd,"[").replace(md,"]")}function bd(t){return Bi(t).replace(zl,"{").replace(Jl,"}").replace(Gl,"^")}function ii(t){return Bi(t).replace(Wl,"%2B").replace(_d,"+").replace(Kl,"%23").replace(hd,"%26").replace(yd,"`").replace(zl,"{").replace(Jl,"}").replace(Gl,"^")}function wd(t){return ii(t).replace(fd,"%3D")}function Sd(t){return Bi(t).replace(Kl,"%23").replace(pd,"%3F")}function Ed(t){return Sd(t).replace(dd,"%2F")}function cs(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const kd=/\/$/,Ad=t=>t.replace(kd,"");function Dn(t,e,r="/"){let s,n={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(s=e.slice(0,l),i=e.slice(l,a>0?a:e.length),n=t(i.slice(1))),a>=0&&(s=s||e.slice(0,a),o=e.slice(a,e.length)),s=Cd(s??e,r),{fullPath:s+i+o,path:s,query:n,hash:cs(o)}}function Td(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function xo(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Rd(t,e,r){const s=e.matched.length-1,n=r.matched.length-1;return s>-1&&s===n&&Rr(e.matched[s],r.matched[n])&&Yl(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function Rr(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!Od(t[r],e[r]))return!1;return!0}function Od(t,e){return et(t)?Io(t,e):et(e)?Io(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Io(t,e){return et(e)?t.length===e.length&&t.every((r,s)=>r===e[s]):t.length===1&&t[0]===e}function Cd(t,e){if(t.startsWith("/"))return t;if(!t)return e;const r=e.split("/"),s=t.split("/"),n=s[s.length-1];(n===".."||n===".")&&s.push("");let i=r.length-1,o,a;for(o=0;o<s.length;o++)if(a=s[o],a!==".")if(a==="..")i>1&&i--;else break;return r.slice(0,i).join("/")+"/"+s.slice(o).join("/")}const Lt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let oi=(function(t){return t.pop="pop",t.push="push",t})({}),Un=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function Pd(t){if(!t)if(fr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Ad(t)}const xd=/^[^#]+#/;function Id(t,e){return t.replace(xd,"#")+e}function jd(t,e){const r=document.documentElement.getBoundingClientRect(),s=t.getBoundingClientRect();return{behavior:e.behavior,left:s.left-r.left-(e.left||0),top:s.top-r.top-(e.top||0)}}const vn=()=>({left:window.scrollX,top:window.scrollY});function Nd(t){let e;if("el"in t){const r=t.el,s=typeof r=="string"&&r.startsWith("#"),n=typeof r=="string"?s?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!n)return;e=jd(n,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function jo(t,e){return(history.state?history.state.position-e:-1)+t}const ai=new Map;function $d(t,e){ai.set(t,e)}function Ld(t){const e=ai.get(t);return ai.delete(t),e}function Dd(t){return typeof t=="string"||t&&typeof t=="object"}function Xl(t){return typeof t=="string"||typeof t=="symbol"}let he=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const Ql=Symbol("");he.MATCHER_NOT_FOUND+"",he.NAVIGATION_GUARD_REDIRECT+"",he.NAVIGATION_ABORTED+"",he.NAVIGATION_CANCELLED+"",he.NAVIGATION_DUPLICATED+"";function Or(t,e){return ee(new Error,{type:t,[Ql]:!0},e)}function vt(t,e){return t instanceof Error&&Ql in t&&(e==null||!!(t.type&e))}const Ud=["params","query","hash"];function Bd(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of Ud)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Md(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;s<r.length;++s){const n=r[s].replace(Wl," "),i=n.indexOf("="),o=cs(i<0?n:n.slice(0,i)),a=i<0?null:cs(n.slice(i+1));if(o in e){let l=e[o];et(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function No(t){let e="";for(let r in t){const s=t[r];if(r=wd(r),s==null){s!==void 0&&(e+=(e.length?"&":"")+r);continue}(et(s)?s.map(n=>n&&ii(n)):[s&&ii(s)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+r,n!=null&&(e+="="+n))})}return e}function Hd(t){const e={};for(const r in t){const s=t[r];s!==void 0&&(e[r]=et(s)?s.map(n=>n==null?null:""+n):s==null?s:""+s)}return e}const Fd=Symbol(""),$o=Symbol(""),_n=Symbol(""),Mi=Symbol(""),li=Symbol("");function Lr(){let t=[];function e(s){return t.push(s),()=>{const n=t.indexOf(s);n>-1&&t.splice(n,1)}}function r(){t=[]}return{add:e,list:()=>t.slice(),reset:r}}function Bt(t,e,r,s,n,i=o=>o()){const o=s&&(s.enterCallbacks[n]=s.enterCallbacks[n]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(Or(he.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):Dd(d)?l(Or(he.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&s.enterCallbacks[n]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(s&&s.instances[n],e,r,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Bn(t,e,r,s,n=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(Vl(l)){const c=(l.__vccOpts||l)[e];c&&i.push(Bt(c,r,s,o,a,n))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=ud(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&Bt(d,r,s,o,a,n)()}))}}return i}function qd(t,e){const r=[],s=[],n=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>Rr(c,a))?s.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>Rr(c,l))||n.push(l))}return[r,s,n]}/*!
|
|
27
27
|
* vue-router v4.6.4
|
|
28
28
|
* (c) 2025 Eduardo San Martin Morote
|
|
29
29
|
* @license MIT
|
|
30
|
-
*/let Fd=()=>location.protocol+"//"+location.host;function Zl(t,e){const{pathname:r,search:s,hash:n}=e,i=t.indexOf("#");if(i>-1){let o=n.includes(t.slice(i))?t.slice(i).length:1,a=n.slice(o);return a[0]!=="/"&&(a="/"+a),Po(a,"")}return Po(r,t)+s+n}function qd(t,e,r,s){let n=[],i=[],o=null;const a=({state:d})=>{const f=Zl(t,location),m=r.value,v=e.value;let A=0;if(d){if(r.value=f,e.value=d,o&&o===m){o=null;return}A=v?d.position-v.position:0}else s(f);n.forEach(E=>{E(r.value,m,{delta:A,type:ii.pop,direction:A?A>0?Ln.forward:Ln.back:Ln.unknown})})};function l(){o=r.value}function c(d){n.push(d);const f=()=>{const m=n.indexOf(d);m>-1&&n.splice(m,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(ee({},d.state,{scroll:yn()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function $o(t,e,r,s=!1,n=!1){return{back:t,current:e,forward:r,replaced:s,position:window.history.length,scroll:n?yn():null}}function Vd(t){const{history:e,location:r}=window,s={value:Zl(t,r)},n={value:e.state};n.value||i(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:Fd()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),n.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,ee({},e.state,$o(n.value.back,l,n.value.forward,!0),c,{position:n.value.position}),!0),s.value=l}function a(l,c){const u=ee({},n.value,e.state,{forward:l,scroll:yn()});i(u.current,u,!0),i(l,ee({},$o(s.value,l,null),{position:u.position+1},c),!1),s.value=l}return{location:s,state:n,push:a,replace:o}}function Kd(t){t=Od(t);const e=Vd(t),r=qd(t,e.state,e.location,e.replace);function s(i,o=!0){o||r.pauseListeners(),history.go(i)}const n=ee({location:"",base:t,go:s,createHref:Pd.bind(null,t)},e,r);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}let Zt=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var me=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(me||{});const Wd={type:Zt.Static,value:""},Gd=/[a-zA-Z0-9_]/;function zd(t){if(!t)return[[]];if(t==="/")return[[Wd]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=me.Static,s=r;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===me.Static?i.push({type:Zt.Static,value:c}):r===me.Param||r===me.ParamRegExp||r===me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Zt.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==me.ParamRegExp){s=r,r=me.EscapeNext;continue}switch(r){case me.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=me.Param):d();break;case me.EscapeNext:d(),r=s;break;case me.Param:l==="("?r=me.ParamRegExp:Gd.test(l)?d():(h(),r=me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=me.ParamRegExpEnd:u+=l;break;case me.ParamRegExpEnd:h(),r=me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===me.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),n}const Lo="[^/]+?",Jd={sensitive:!1,strict:!1,start:!0,end:!0};var Oe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(Oe||{});const Yd=/[.+*?^${}()[\]/\\]/g;function Xd(t,e){const r=ee({},Jd,e),s=[];let n=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[Oe.Root];r.strict&&!c.length&&(n+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=Oe.Segment+(r.sensitive?Oe.BonusCaseSensitive:0);if(d.type===Zt.Static)h||(n+="/"),n+=d.value.replace(Yd,"\\$&"),f+=Oe.Static;else if(d.type===Zt.Param){const{value:m,repeatable:v,optional:A,regexp:E}=d;i.push({name:m,repeatable:v,optional:A});const _=E||Lo;if(_!==Lo){f+=Oe.BonusCustomRegExp;try{`${_}`}catch(O){throw new Error(`Invalid custom RegExp for param "${m}" (${_}): `+O.message)}}let b=v?`((?:${_})(?:/(?:${_}))*)`:`(${_})`;h||(b=A&&c.length<2?`(?:/${b})`:"/"+b),A&&(b+="?"),n+=b,f+=Oe.Dynamic,A&&(f+=Oe.BonusOptional),v&&(f+=Oe.BonusRepeatable),_===".*"&&(f+=Oe.BonusWildcard)}u.push(f)}s.push(u)}if(r.strict&&r.end){const c=s.length-1;s[c][s[c].length-1]+=Oe.BonusStrict}r.strict||(n+="/?"),r.end?n+="$":r.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",m=i[d-1];h[m.name]=f&&m.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Zt.Static)u+=f.value;else if(f.type===Zt.Param){const{value:m,repeatable:v,optional:A}=f,E=m in c?c[m]:"";if(Ze(E)&&!v)throw new Error(`Provided param "${m}" is an array but it is not repeatable (* or + modifiers)`);const _=Ze(E)?E.join("/"):E;if(!_)if(A)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${m}"`);u+=_}}return u||"/"}return{re:o,score:s,keys:i,parse:a,stringify:l}}function Qd(t,e){let r=0;for(;r<t.length&&r<e.length;){const s=e[r]-t[r];if(s)return s;r++}return t.length<e.length?t.length===1&&t[0]===Oe.Static+Oe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===Oe.Static+Oe.Segment?1:-1:0}function ec(t,e){let r=0;const s=t.score,n=e.score;for(;r<s.length&&r<n.length;){const i=Qd(s[r],n[r]);if(i)return i;r++}if(Math.abs(n.length-s.length)===1){if(Do(s))return 1;if(Do(n))return-1}return n.length-s.length}function Do(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Zd={strict:!1,end:!0,sensitive:!1};function ef(t,e,r){const s=Xd(zd(t.path),r),n=ee(s,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function tf(t,e){const r=[],s=new Map;e=Co(Zd,e);function n(h){return s.get(h)}function i(h,d,f){const m=!f,v=Bo(h);v.aliasOf=f&&f.record;const A=Co(e,h),E=[v];if("alias"in h){const O=typeof h.alias=="string"?[h.alias]:h.alias;for(const B of O)E.push(Bo(ee({},v,{components:f?f.record.components:v.components,path:B,aliasOf:f?f.record:v})))}let _,b;for(const O of E){const{path:B}=O;if(d&&B[0]!=="/"){const W=d.record.path,q=W[W.length-1]==="/"?"":"/";O.path=d.record.path+(B&&q+B)}if(_=ef(O,d,A),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),m&&h.name&&!Mo(_)&&o(h.name)),tc(_)&&l(_),v.children){const W=v.children;for(let q=0;q<W.length;q++)i(W[q],_,f&&f.children[q])}f=f||_}return b?()=>{o(b)}:Qr}function o(h){if(Xl(h)){const d=s.get(h);d&&(s.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&s.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=nf(h,r);r.splice(d,0,h),h.record.name&&!Mo(h)&&s.set(h.record.name,h)}function c(h,d){let f,m={},v,A;if("name"in h&&h.name){if(f=s.get(h.name),!f)throw Or(he.MATCHER_NOT_FOUND,{location:h});A=f.record.name,m=ee(Uo(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Uo(h.params,f.keys.map(b=>b.name))),v=f.stringify(m)}else if(h.path!=null)v=h.path,f=r.find(b=>b.re.test(v)),f&&(m=f.parse(v),A=f.record.name);else{if(f=d.name?s.get(d.name):r.find(b=>b.re.test(d.path)),!f)throw Or(he.MATCHER_NOT_FOUND,{location:h,currentLocation:d});A=f.record.name,m=ee({},d.params,h.params),v=f.stringify(m)}const E=[];let _=f;for(;_;)E.unshift(_.record),_=_.parent;return{name:A,path:v,params:m,matched:E,meta:sf(E)}}t.forEach(h=>i(h));function u(){r.length=0,s.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:n}}function Uo(t,e){const r={};for(const s of e)s in t&&(r[s]=t[s]);return r}function Bo(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:rf(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function rf(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const s in t.components)e[s]=typeof r=="object"?r[s]:r;return e}function Mo(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function sf(t){return t.reduce((e,r)=>ee(e,r.meta),{})}function nf(t,e){let r=0,s=e.length;for(;r!==s;){const i=r+s>>1;ec(t,e[i])<0?s=i:r=i+1}const n=of(t);return n&&(s=e.lastIndexOf(n,s-1)),s}function of(t){let e=t;for(;e=e.parent;)if(tc(e)&&ec(t,e)===0)return e}function tc({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Ho(t){const e=Ve(vn),r=Ve(Bi),s=$e(()=>{const l=Ye(t.to);return e.resolve(l)}),n=$e(()=>{const{matched:l}=s.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(Rr.bind(null,u));if(d>-1)return d;const f=Fo(l[c-2]);return c>1&&Fo(u)===f&&h[h.length-1].path!==f?h.findIndex(Rr.bind(null,l[c-2])):d}),i=$e(()=>n.value>-1&&hf(r.params,s.value.params)),o=$e(()=>n.value>-1&&n.value===r.matched.length-1&&Yl(r.params,s.value.params));function a(l={}){if(uf(l)){const c=e[Ye(t.replace)?"replace":"push"](Ye(t.to)).catch(Qr);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:s,href:$e(()=>s.value.href),isActive:i,isExactActive:o,navigate:a}}function af(t){return t.length===1?t[0]:t}const lf=hn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Ho,setup(t,{slots:e}){const r=ys(Ho(t)),{options:s}=Ve(vn),n=$e(()=>({[qo(t.activeClass,s.linkActiveClass,"router-link-active")]:r.isActive,[qo(t.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&af(e.default(r));return t.custom?i:as("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:n.value},i)}}}),cf=lf;function uf(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function hf(t,e){for(const r in e){const s=e[r],n=t[r];if(typeof s=="string"){if(s!==n)return!1}else if(!Ze(n)||n.length!==s.length||s.some((i,o)=>i.valueOf()!==n[o].valueOf()))return!1}return!0}function Fo(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const qo=(t,e,r)=>t??e??r,df=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const s=Ve(ai),n=$e(()=>t.route||s.value),i=Ve(No,0),o=$e(()=>{let c=Ye(i);const{matched:u}=n.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=$e(()=>n.value.matched[o.value]);Ns(No,$e(()=>o.value+1)),Ns(Md,a),Ns(ai,n);const l=Kr();return Wr(()=>[l.value,a.value,t.name],([c,u,h],[d,f,m])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!Rr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(v=>v(c))},{flush:"post"}),()=>{const c=n.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return Vo(r.default,{Component:d,route:c});const f=h.props[u],m=f?f===!0?c.params:typeof f=="function"?f(c):f:null,A=as(d,ee({},m,e,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Vo(r.default,{Component:A,route:c})||A}}});function Vo(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const ff=df;function pf(t){const e=tf(t.routes,t),r=t.parseQuery||Ud,s=t.stringifyQuery||jo,n=t.history,i=Lr(),o=Lr(),a=Lr(),l=nu(Lt);let c=Lt;fr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Nn.bind(null,k=>""+k),h=Nn.bind(null,wd),d=Nn.bind(null,cs);function f(k,$){let j,D;return Xl(k)?(j=e.getRecordMatcher(k),D=$):D=k,e.addRoute(D,j)}function m(k){const $=e.getRecordMatcher(k);$&&e.removeRoute($)}function v(){return e.getRoutes().map(k=>k.record)}function A(k){return!!e.getRecordMatcher(k)}function E(k,$){if($=ee({},$||l.value),typeof k=="string"){const y=$n(r,k,$.path),w=e.resolve({path:y.path},$),T=n.createHref(y.fullPath);return ee(y,w,{params:d(w.params),hash:cs(y.hash),redirectedFrom:void 0,href:T})}let j;if(k.path!=null)j=ee({},k,{path:$n(r,k.path,$.path).path});else{const y=ee({},k.params);for(const w in y)y[w]==null&&delete y[w];j=ee({},k,{params:h(y)}),$.params=h($.params)}const D=e.resolve(j,$),Y=k.hash||"";D.params=u(d(D.params));const p=kd(s,ee({},k,{hash:vd(Y),path:D.path})),g=n.createHref(p);return ee({fullPath:p,hash:Y,query:s===jo?Bd(k.query):k.query||{}},D,{redirectedFrom:void 0,href:g})}function _(k){return typeof k=="string"?$n(r,k,l.value.path):ee({},k)}function b(k,$){if(c!==k)return Or(he.NAVIGATION_CANCELLED,{from:$,to:k})}function O(k){return q(k)}function B(k){return O(ee(_(k),{replace:!0}))}function W(k,$){const j=k.matched[k.matched.length-1];if(j&&j.redirect){const{redirect:D}=j;let Y=typeof D=="function"?D(k,$):D;return typeof Y=="string"&&(Y=Y.includes("?")||Y.includes("#")?Y=_(Y):{path:Y},Y.params={}),ee({query:k.query,hash:k.hash,params:Y.path!=null?{}:k.params},Y)}}function q(k,$){const j=c=E(k),D=l.value,Y=k.state,p=k.force,g=k.replace===!0,y=W(j,D);if(y)return q(ee(_(y),{state:typeof y=="object"?ee({},Y,y.state):Y,force:p,replace:g}),$||j);const w=j;w.redirectedFrom=$;let T;return!p&&Ad(s,D,j)&&(T=Or(he.NAVIGATION_DUPLICATED,{to:w,from:D}),et(D,D,!0,!1)),(T?Promise.resolve(T):ce(w,D)).catch(S=>vt(S)?vt(S,he.NAVIGATION_GUARD_REDIRECT)?S:$t(S):Z(S,w,D)).then(S=>{if(S){if(vt(S,he.NAVIGATION_GUARD_REDIRECT))return q(ee({replace:g},_(S.to),{state:typeof S.to=="object"?ee({},Y,S.to.state):Y,force:p}),$||w)}else S=Le(w,D,!0,g,Y);return Te(w,D,S),S})}function J(k,$){const j=b(k,$);return j?Promise.reject(j):Promise.resolve()}function V(k){const $=nr.values().next().value;return $&&typeof $.runWithContext=="function"?$.runWithContext(k):k()}function ce(k,$){let j;const[D,Y,p]=Hd(k,$);j=Dn(D.reverse(),"beforeRouteLeave",k,$);for(const y of D)y.leaveGuards.forEach(w=>{j.push(Bt(w,k,$))});const g=J.bind(null,k,$);return j.push(g),Fe(j).then(()=>{j=[];for(const y of i.list())j.push(Bt(y,k,$));return j.push(g),Fe(j)}).then(()=>{j=Dn(Y,"beforeRouteUpdate",k,$);for(const y of Y)y.updateGuards.forEach(w=>{j.push(Bt(w,k,$))});return j.push(g),Fe(j)}).then(()=>{j=[];for(const y of p)if(y.beforeEnter)if(Ze(y.beforeEnter))for(const w of y.beforeEnter)j.push(Bt(w,k,$));else j.push(Bt(y.beforeEnter,k,$));return j.push(g),Fe(j)}).then(()=>(k.matched.forEach(y=>y.enterCallbacks={}),j=Dn(p,"beforeRouteEnter",k,$,V),j.push(g),Fe(j))).then(()=>{j=[];for(const y of o.list())j.push(Bt(y,k,$));return j.push(g),Fe(j)}).catch(y=>vt(y,he.NAVIGATION_CANCELLED)?y:Promise.reject(y))}function Te(k,$,j){a.list().forEach(D=>V(()=>D(k,$,j)))}function Le(k,$,j,D,Y){const p=b(k,$);if(p)return p;const g=$===Lt,y=fr?history.state:{};j&&(D||g?n.replace(k.fullPath,ee({scroll:g&&y&&y.scroll},Y)):n.push(k.fullPath,Y)),l.value=k,et(k,$,j,g),$t()}let xe;function Kt(){xe||(xe=n.listen((k,$,j)=>{if(!Wt.listening)return;const D=E(k),Y=W(D,Wt.currentRoute.value);if(Y){q(ee(Y,{replace:!0,force:!0}),D).catch(Qr);return}c=D;const p=l.value;fr&&jd(Io(p.fullPath,j.delta),yn()),ce(D,p).catch(g=>vt(g,he.NAVIGATION_ABORTED|he.NAVIGATION_CANCELLED)?g:vt(g,he.NAVIGATION_GUARD_REDIRECT)?(q(ee(_(g.to),{force:!0}),D).then(y=>{vt(y,he.NAVIGATION_ABORTED|he.NAVIGATION_DUPLICATED)&&!j.delta&&j.type===ii.pop&&n.go(-1,!1)}).catch(Qr),Promise.reject()):(j.delta&&n.go(-j.delta,!1),Z(g,D,p))).then(g=>{g=g||Le(D,p,!1),g&&(j.delta&&!vt(g,he.NAVIGATION_CANCELLED)?n.go(-j.delta,!1):j.type===ii.pop&&vt(g,he.NAVIGATION_ABORTED|he.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),Te(D,p,g)}).catch(Qr)}))}let Nt=Lr(),le=Lr(),z;function Z(k,$,j){$t(k);const D=le.list();return D.length?D.forEach(Y=>Y(k,$,j)):console.error(k),Promise.reject(k)}function mt(){return z&&l.value!==Lt?Promise.resolve():new Promise((k,$)=>{Nt.add([k,$])})}function $t(k){return z||(z=!k,Kt(),Nt.list().forEach(([$,j])=>k?j(k):$()),Nt.reset()),k}function et(k,$,j,D){const{scrollBehavior:Y}=t;if(!fr||!Y)return Promise.resolve();const p=!j&&Nd(Io(k.fullPath,0))||(D||!j)&&history.state&&history.state.scroll||null;return un().then(()=>Y(k,$,p)).then(g=>g&&Id(g)).catch(g=>Z(g,k,$))}const Ie=k=>n.go(k);let sr;const nr=new Set,Wt={currentRoute:l,listening:!0,addRoute:f,removeRoute:m,clearRoutes:e.clearRoutes,hasRoute:A,getRoutes:v,resolve:E,options:t,push:O,replace:B,go:Ie,back:()=>Ie(-1),forward:()=>Ie(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:le.add,isReady:mt,install(k){k.component("RouterLink",cf),k.component("RouterView",ff),k.config.globalProperties.$router=Wt,Object.defineProperty(k.config.globalProperties,"$route",{enumerable:!0,get:()=>Ye(l)}),fr&&!sr&&l.value===Lt&&(sr=!0,O(n.location).catch(D=>{}));const $={};for(const D in Lt)Object.defineProperty($,D,{get:()=>l.value[D],enumerable:!0});k.provide(vn,Wt),k.provide(Bi,Ya($)),k.provide(ai,l);const j=k.unmount;nr.add(k),k.unmount=function(){nr.delete(k),nr.size<1&&(c=Lt,xe&&xe(),xe=null,l.value=Lt,sr=!1,z=!1),j()}}};function Fe(k){return k.reduce(($,j)=>$.then(()=>V(j)),Promise.resolve())}return Wt}function gf(){return Ve(vn)}function rc(t){return Ve(Bi)}function _n(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function mf(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(h){o(h)}}function l(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,e||[])).next())})}const yf=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Mi extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class vf extends Mi{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Ko extends Mi{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Wo extends Mi{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var li;(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"})(li||(li={}));class _f{constructor(e,{headers:r={},customFetch:s,region:n=li.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=yf(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return mf(this,arguments,void 0,function*(r,s={}){var n;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=s;let d={},{region:f}=s;f||(f=this.region);const m=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(d["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(d["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let A=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(A=o.signal,u.addEventListener("abort",()=>o.abort())):A=o.signal);const E=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:v,signal:A}).catch(B=>{throw new vf(B)}),_=E.headers.get("x-relay-error");if(_&&_==="true")throw new Ko(E);if(!E.ok)throw new Wo(E);let b=((n=E.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),O;return b==="application/json"?O=yield E.json():b==="application/octet-stream"||b==="application/pdf"?O=yield E.blob():b==="text/event-stream"?O=E:b==="multipart/form-data"?O=yield E.formData():O=yield E.text(),{data:O,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof Wo||a instanceof Ko?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const sc=3,Go=t=>Math.min(1e3*2**t,3e4),bf=[520,503],nc=["GET","HEAD","OPTIONS"];var wf=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 zo(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const s=setTimeout(()=>{e==null||e.removeEventListener("abort",n),r()},t);function n(){clearTimeout(s),r()}e==null||e.addEventListener("abort",n)})}function Sf(t,e,r,s){return!(!s||r>=sc||!nc.includes(t)||!bf.includes(e))}var Ef=class{constructor(t){var e,r,s,n,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=(s=t.shouldStripNulls)!==null&&s!==void 0?s:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n: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 s=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await s(r.url.toString(),{method:r.method,headers:c,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"||!nc.includes(r.method))throw h;if(r.retryEnabled&&o<sc){const d=Go(o);o++,await zo(d,r.signal);continue}throw h}if(Sf(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.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:Go(o);await u.text(),o++,await zo(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,m,v;const _=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
30
|
+
*/let Vd=()=>location.protocol+"//"+location.host;function Zl(t,e){const{pathname:r,search:s,hash:n}=e,i=t.indexOf("#");if(i>-1){let o=n.includes(t.slice(i))?t.slice(i).length:1,a=n.slice(o);return a[0]!=="/"&&(a="/"+a),xo(a,"")}return xo(r,t)+s+n}function Kd(t,e,r,s){let n=[],i=[],o=null;const a=({state:d})=>{const f=Zl(t,location),m=r.value,v=e.value;let A=0;if(d){if(r.value=f,e.value=d,o&&o===m){o=null;return}A=v?d.position-v.position:0}else s(f);n.forEach(E=>{E(r.value,m,{delta:A,type:oi.pop,direction:A?A>0?Un.forward:Un.back:Un.unknown})})};function l(){o=r.value}function c(d){n.push(d);const f=()=>{const m=n.indexOf(d);m>-1&&n.splice(m,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(ee({},d.state,{scroll:vn()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Lo(t,e,r,s=!1,n=!1){return{back:t,current:e,forward:r,replaced:s,position:window.history.length,scroll:n?vn():null}}function Wd(t){const{history:e,location:r}=window,s={value:Zl(t,r)},n={value:e.state};n.value||i(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:Vd()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),n.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,ee({},e.state,Lo(n.value.back,l,n.value.forward,!0),c,{position:n.value.position}),!0),s.value=l}function a(l,c){const u=ee({},n.value,e.state,{forward:l,scroll:vn()});i(u.current,u,!0),i(l,ee({},Lo(s.value,l,null),{position:u.position+1},c),!1),s.value=l}return{location:s,state:n,push:a,replace:o}}function Gd(t){t=Pd(t);const e=Wd(t),r=Kd(t,e.state,e.location,e.replace);function s(i,o=!0){o||r.pauseListeners(),history.go(i)}const n=ee({location:"",base:t,go:s,createHref:Id.bind(null,t)},e,r);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}let Zt=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var me=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(me||{});const zd={type:Zt.Static,value:""},Jd=/[a-zA-Z0-9_]/;function Yd(t){if(!t)return[[]];if(t==="/")return[[zd]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=me.Static,s=r;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===me.Static?i.push({type:Zt.Static,value:c}):r===me.Param||r===me.ParamRegExp||r===me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Zt.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==me.ParamRegExp){s=r,r=me.EscapeNext;continue}switch(r){case me.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=me.Param):d();break;case me.EscapeNext:d(),r=s;break;case me.Param:l==="("?r=me.ParamRegExp:Jd.test(l)?d():(h(),r=me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=me.ParamRegExpEnd:u+=l;break;case me.ParamRegExpEnd:h(),r=me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===me.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),n}const Do="[^/]+?",Xd={sensitive:!1,strict:!1,start:!0,end:!0};var Oe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(Oe||{});const Qd=/[.+*?^${}()[\]/\\]/g;function Zd(t,e){const r=ee({},Xd,e),s=[];let n=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[Oe.Root];r.strict&&!c.length&&(n+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=Oe.Segment+(r.sensitive?Oe.BonusCaseSensitive:0);if(d.type===Zt.Static)h||(n+="/"),n+=d.value.replace(Qd,"\\$&"),f+=Oe.Static;else if(d.type===Zt.Param){const{value:m,repeatable:v,optional:A,regexp:E}=d;i.push({name:m,repeatable:v,optional:A});const _=E||Do;if(_!==Do){f+=Oe.BonusCustomRegExp;try{`${_}`}catch(O){throw new Error(`Invalid custom RegExp for param "${m}" (${_}): `+O.message)}}let b=v?`((?:${_})(?:/(?:${_}))*)`:`(${_})`;h||(b=A&&c.length<2?`(?:/${b})`:"/"+b),A&&(b+="?"),n+=b,f+=Oe.Dynamic,A&&(f+=Oe.BonusOptional),v&&(f+=Oe.BonusRepeatable),_===".*"&&(f+=Oe.BonusWildcard)}u.push(f)}s.push(u)}if(r.strict&&r.end){const c=s.length-1;s[c][s[c].length-1]+=Oe.BonusStrict}r.strict||(n+="/?"),r.end?n+="$":r.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",m=i[d-1];h[m.name]=f&&m.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Zt.Static)u+=f.value;else if(f.type===Zt.Param){const{value:m,repeatable:v,optional:A}=f,E=m in c?c[m]:"";if(et(E)&&!v)throw new Error(`Provided param "${m}" is an array but it is not repeatable (* or + modifiers)`);const _=et(E)?E.join("/"):E;if(!_)if(A)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${m}"`);u+=_}}return u||"/"}return{re:o,score:s,keys:i,parse:a,stringify:l}}function ef(t,e){let r=0;for(;r<t.length&&r<e.length;){const s=e[r]-t[r];if(s)return s;r++}return t.length<e.length?t.length===1&&t[0]===Oe.Static+Oe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===Oe.Static+Oe.Segment?1:-1:0}function ec(t,e){let r=0;const s=t.score,n=e.score;for(;r<s.length&&r<n.length;){const i=ef(s[r],n[r]);if(i)return i;r++}if(Math.abs(n.length-s.length)===1){if(Uo(s))return 1;if(Uo(n))return-1}return n.length-s.length}function Uo(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const tf={strict:!1,end:!0,sensitive:!1};function rf(t,e,r){const s=Zd(Yd(t.path),r),n=ee(s,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function sf(t,e){const r=[],s=new Map;e=Po(tf,e);function n(h){return s.get(h)}function i(h,d,f){const m=!f,v=Mo(h);v.aliasOf=f&&f.record;const A=Po(e,h),E=[v];if("alias"in h){const O=typeof h.alias=="string"?[h.alias]:h.alias;for(const B of O)E.push(Mo(ee({},v,{components:f?f.record.components:v.components,path:B,aliasOf:f?f.record:v})))}let _,b;for(const O of E){const{path:B}=O;if(d&&B[0]!=="/"){const W=d.record.path,q=W[W.length-1]==="/"?"":"/";O.path=d.record.path+(B&&q+B)}if(_=rf(O,d,A),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),m&&h.name&&!Ho(_)&&o(h.name)),tc(_)&&l(_),v.children){const W=v.children;for(let q=0;q<W.length;q++)i(W[q],_,f&&f.children[q])}f=f||_}return b?()=>{o(b)}:Qr}function o(h){if(Xl(h)){const d=s.get(h);d&&(s.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&s.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=af(h,r);r.splice(d,0,h),h.record.name&&!Ho(h)&&s.set(h.record.name,h)}function c(h,d){let f,m={},v,A;if("name"in h&&h.name){if(f=s.get(h.name),!f)throw Or(he.MATCHER_NOT_FOUND,{location:h});A=f.record.name,m=ee(Bo(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Bo(h.params,f.keys.map(b=>b.name))),v=f.stringify(m)}else if(h.path!=null)v=h.path,f=r.find(b=>b.re.test(v)),f&&(m=f.parse(v),A=f.record.name);else{if(f=d.name?s.get(d.name):r.find(b=>b.re.test(d.path)),!f)throw Or(he.MATCHER_NOT_FOUND,{location:h,currentLocation:d});A=f.record.name,m=ee({},d.params,h.params),v=f.stringify(m)}const E=[];let _=f;for(;_;)E.unshift(_.record),_=_.parent;return{name:A,path:v,params:m,matched:E,meta:of(E)}}t.forEach(h=>i(h));function u(){r.length=0,s.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:n}}function Bo(t,e){const r={};for(const s of e)s in t&&(r[s]=t[s]);return r}function Mo(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:nf(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function nf(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const s in t.components)e[s]=typeof r=="object"?r[s]:r;return e}function Ho(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function of(t){return t.reduce((e,r)=>ee(e,r.meta),{})}function af(t,e){let r=0,s=e.length;for(;r!==s;){const i=r+s>>1;ec(t,e[i])<0?s=i:r=i+1}const n=lf(t);return n&&(s=e.lastIndexOf(n,s-1)),s}function lf(t){let e=t;for(;e=e.parent;)if(tc(e)&&ec(t,e)===0)return e}function tc({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Fo(t){const e=Ve(_n),r=Ve(Mi),s=$e(()=>{const l=Xe(t.to);return e.resolve(l)}),n=$e(()=>{const{matched:l}=s.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(Rr.bind(null,u));if(d>-1)return d;const f=qo(l[c-2]);return c>1&&qo(u)===f&&h[h.length-1].path!==f?h.findIndex(Rr.bind(null,l[c-2])):d}),i=$e(()=>n.value>-1&&ff(r.params,s.value.params)),o=$e(()=>n.value>-1&&n.value===r.matched.length-1&&Yl(r.params,s.value.params));function a(l={}){if(df(l)){const c=e[Xe(t.replace)?"replace":"push"](Xe(t.to)).catch(Qr);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:s,href:$e(()=>s.value.href),isActive:i,isExactActive:o,navigate:a}}function cf(t){return t.length===1?t[0]:t}const uf=dn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Fo,setup(t,{slots:e}){const r=ys(Fo(t)),{options:s}=Ve(_n),n=$e(()=>({[Vo(t.activeClass,s.linkActiveClass,"router-link-active")]:r.isActive,[Vo(t.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&cf(e.default(r));return t.custom?i:as("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:n.value},i)}}}),hf=uf;function df(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function ff(t,e){for(const r in e){const s=e[r],n=t[r];if(typeof s=="string"){if(s!==n)return!1}else if(!et(n)||n.length!==s.length||s.some((i,o)=>i.valueOf()!==n[o].valueOf()))return!1}return!0}function qo(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Vo=(t,e,r)=>t??e??r,pf=dn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const s=Ve(li),n=$e(()=>t.route||s.value),i=Ve($o,0),o=$e(()=>{let c=Xe(i);const{matched:u}=n.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=$e(()=>n.value.matched[o.value]);$s($o,$e(()=>o.value+1)),$s(Fd,a),$s(li,n);const l=Kr();return Wr(()=>[l.value,a.value,t.name],([c,u,h],[d,f,m])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!Rr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(v=>v(c))},{flush:"post"}),()=>{const c=n.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return Ko(r.default,{Component:d,route:c});const f=h.props[u],m=f?f===!0?c.params:typeof f=="function"?f(c):f:null,A=as(d,ee({},m,e,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Ko(r.default,{Component:A,route:c})||A}}});function Ko(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const gf=pf;function mf(t){const e=sf(t.routes,t),r=t.parseQuery||Md,s=t.stringifyQuery||No,n=t.history,i=Lr(),o=Lr(),a=Lr(),l=ou(Lt);let c=Lt;fr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ln.bind(null,k=>""+k),h=Ln.bind(null,Ed),d=Ln.bind(null,cs);function f(k,$){let j,D;return Xl(k)?(j=e.getRecordMatcher(k),D=$):D=k,e.addRoute(D,j)}function m(k){const $=e.getRecordMatcher(k);$&&e.removeRoute($)}function v(){return e.getRoutes().map(k=>k.record)}function A(k){return!!e.getRecordMatcher(k)}function E(k,$){if($=ee({},$||l.value),typeof k=="string"){const y=Dn(r,k,$.path),w=e.resolve({path:y.path},$),T=n.createHref(y.fullPath);return ee(y,w,{params:d(w.params),hash:cs(y.hash),redirectedFrom:void 0,href:T})}let j;if(k.path!=null)j=ee({},k,{path:Dn(r,k.path,$.path).path});else{const y=ee({},k.params);for(const w in y)y[w]==null&&delete y[w];j=ee({},k,{params:h(y)}),$.params=h($.params)}const D=e.resolve(j,$),Y=k.hash||"";D.params=u(d(D.params));const p=Td(s,ee({},k,{hash:bd(Y),path:D.path})),g=n.createHref(p);return ee({fullPath:p,hash:Y,query:s===No?Hd(k.query):k.query||{}},D,{redirectedFrom:void 0,href:g})}function _(k){return typeof k=="string"?Dn(r,k,l.value.path):ee({},k)}function b(k,$){if(c!==k)return Or(he.NAVIGATION_CANCELLED,{from:$,to:k})}function O(k){return q(k)}function B(k){return O(ee(_(k),{replace:!0}))}function W(k,$){const j=k.matched[k.matched.length-1];if(j&&j.redirect){const{redirect:D}=j;let Y=typeof D=="function"?D(k,$):D;return typeof Y=="string"&&(Y=Y.includes("?")||Y.includes("#")?Y=_(Y):{path:Y},Y.params={}),ee({query:k.query,hash:k.hash,params:Y.path!=null?{}:k.params},Y)}}function q(k,$){const j=c=E(k),D=l.value,Y=k.state,p=k.force,g=k.replace===!0,y=W(j,D);if(y)return q(ee(_(y),{state:typeof y=="object"?ee({},Y,y.state):Y,force:p,replace:g}),$||j);const w=j;w.redirectedFrom=$;let T;return!p&&Rd(s,D,j)&&(T=Or(he.NAVIGATION_DUPLICATED,{to:w,from:D}),tt(D,D,!0,!1)),(T?Promise.resolve(T):ce(w,D)).catch(S=>vt(S)?vt(S,he.NAVIGATION_GUARD_REDIRECT)?S:$t(S):Z(S,w,D)).then(S=>{if(S){if(vt(S,he.NAVIGATION_GUARD_REDIRECT))return q(ee({replace:g},_(S.to),{state:typeof S.to=="object"?ee({},Y,S.to.state):Y,force:p}),$||w)}else S=Le(w,D,!0,g,Y);return Te(w,D,S),S})}function J(k,$){const j=b(k,$);return j?Promise.reject(j):Promise.resolve()}function V(k){const $=nr.values().next().value;return $&&typeof $.runWithContext=="function"?$.runWithContext(k):k()}function ce(k,$){let j;const[D,Y,p]=qd(k,$);j=Bn(D.reverse(),"beforeRouteLeave",k,$);for(const y of D)y.leaveGuards.forEach(w=>{j.push(Bt(w,k,$))});const g=J.bind(null,k,$);return j.push(g),Fe(j).then(()=>{j=[];for(const y of i.list())j.push(Bt(y,k,$));return j.push(g),Fe(j)}).then(()=>{j=Bn(Y,"beforeRouteUpdate",k,$);for(const y of Y)y.updateGuards.forEach(w=>{j.push(Bt(w,k,$))});return j.push(g),Fe(j)}).then(()=>{j=[];for(const y of p)if(y.beforeEnter)if(et(y.beforeEnter))for(const w of y.beforeEnter)j.push(Bt(w,k,$));else j.push(Bt(y.beforeEnter,k,$));return j.push(g),Fe(j)}).then(()=>(k.matched.forEach(y=>y.enterCallbacks={}),j=Bn(p,"beforeRouteEnter",k,$,V),j.push(g),Fe(j))).then(()=>{j=[];for(const y of o.list())j.push(Bt(y,k,$));return j.push(g),Fe(j)}).catch(y=>vt(y,he.NAVIGATION_CANCELLED)?y:Promise.reject(y))}function Te(k,$,j){a.list().forEach(D=>V(()=>D(k,$,j)))}function Le(k,$,j,D,Y){const p=b(k,$);if(p)return p;const g=$===Lt,y=fr?history.state:{};j&&(D||g?n.replace(k.fullPath,ee({scroll:g&&y&&y.scroll},Y)):n.push(k.fullPath,Y)),l.value=k,tt(k,$,j,g),$t()}let xe;function Kt(){xe||(xe=n.listen((k,$,j)=>{if(!Wt.listening)return;const D=E(k),Y=W(D,Wt.currentRoute.value);if(Y){q(ee(Y,{replace:!0,force:!0}),D).catch(Qr);return}c=D;const p=l.value;fr&&$d(jo(p.fullPath,j.delta),vn()),ce(D,p).catch(g=>vt(g,he.NAVIGATION_ABORTED|he.NAVIGATION_CANCELLED)?g:vt(g,he.NAVIGATION_GUARD_REDIRECT)?(q(ee(_(g.to),{force:!0}),D).then(y=>{vt(y,he.NAVIGATION_ABORTED|he.NAVIGATION_DUPLICATED)&&!j.delta&&j.type===oi.pop&&n.go(-1,!1)}).catch(Qr),Promise.reject()):(j.delta&&n.go(-j.delta,!1),Z(g,D,p))).then(g=>{g=g||Le(D,p,!1),g&&(j.delta&&!vt(g,he.NAVIGATION_CANCELLED)?n.go(-j.delta,!1):j.type===oi.pop&&vt(g,he.NAVIGATION_ABORTED|he.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),Te(D,p,g)}).catch(Qr)}))}let Nt=Lr(),le=Lr(),z;function Z(k,$,j){$t(k);const D=le.list();return D.length?D.forEach(Y=>Y(k,$,j)):console.error(k),Promise.reject(k)}function mt(){return z&&l.value!==Lt?Promise.resolve():new Promise((k,$)=>{Nt.add([k,$])})}function $t(k){return z||(z=!k,Kt(),Nt.list().forEach(([$,j])=>k?j(k):$()),Nt.reset()),k}function tt(k,$,j,D){const{scrollBehavior:Y}=t;if(!fr||!Y)return Promise.resolve();const p=!j&&Ld(jo(k.fullPath,0))||(D||!j)&&history.state&&history.state.scroll||null;return hn().then(()=>Y(k,$,p)).then(g=>g&&Nd(g)).catch(g=>Z(g,k,$))}const Ie=k=>n.go(k);let sr;const nr=new Set,Wt={currentRoute:l,listening:!0,addRoute:f,removeRoute:m,clearRoutes:e.clearRoutes,hasRoute:A,getRoutes:v,resolve:E,options:t,push:O,replace:B,go:Ie,back:()=>Ie(-1),forward:()=>Ie(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:le.add,isReady:mt,install(k){k.component("RouterLink",hf),k.component("RouterView",gf),k.config.globalProperties.$router=Wt,Object.defineProperty(k.config.globalProperties,"$route",{enumerable:!0,get:()=>Xe(l)}),fr&&!sr&&l.value===Lt&&(sr=!0,O(n.location).catch(D=>{}));const $={};for(const D in Lt)Object.defineProperty($,D,{get:()=>l.value[D],enumerable:!0});k.provide(_n,Wt),k.provide(Mi,Ya($)),k.provide(li,l);const j=k.unmount;nr.add(k),k.unmount=function(){nr.delete(k),nr.size<1&&(c=Lt,xe&&xe(),xe=null,l.value=Lt,sr=!1,z=!1),j()}}};function Fe(k){return k.reduce(($,j)=>$.then(()=>V(j)),Promise.resolve())}return Wt}function yf(){return Ve(_n)}function rc(t){return Ve(Mi)}function bn(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function vf(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(h){o(h)}}function l(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,e||[])).next())})}const _f=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Hi extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class bf extends Hi{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Wo extends Hi{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Go extends Hi{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ci;(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"})(ci||(ci={}));class wf{constructor(e,{headers:r={},customFetch:s,region:n=ci.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=_f(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return vf(this,arguments,void 0,function*(r,s={}){var n;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=s;let d={},{region:f}=s;f||(f=this.region);const m=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(d["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(d["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let A=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(A=o.signal,u.addEventListener("abort",()=>o.abort())):A=o.signal);const E=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:v,signal:A}).catch(B=>{throw new bf(B)}),_=E.headers.get("x-relay-error");if(_&&_==="true")throw new Wo(E);if(!E.ok)throw new Go(E);let b=((n=E.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),O;return b==="application/json"?O=yield E.json():b==="application/octet-stream"||b==="application/pdf"?O=yield E.blob():b==="text/event-stream"?O=E:b==="multipart/form-data"?O=yield E.formData():O=yield E.text(),{data:O,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof Go||a instanceof Wo?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const sc=3,zo=t=>Math.min(1e3*2**t,3e4),Sf=[520,503],nc=["GET","HEAD","OPTIONS"];var Ef=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 Jo(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const s=setTimeout(()=>{e==null||e.removeEventListener("abort",n),r()},t);function n(){clearTimeout(s),r()}e==null||e.addEventListener("abort",n)})}function kf(t,e,r,s){return!(!s||r>=sc||!nc.includes(t)||!Sf.includes(e))}var Af=class{constructor(t){var e,r,s,n,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=(s=t.shouldStripNulls)!==null&&s!==void 0?s:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n: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 s=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await s(r.url.toString(),{method:r.method,headers:c,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"||!nc.includes(r.method))throw h;if(r.retryEnabled&&o<sc){const d=zo(o);o++,await Jo(d,r.signal);continue}throw h}if(kf(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.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:zo(o);await u.text(),o++,await Jo(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,m,v;const _=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
31
31
|
|
|
32
32
|
Caused by: ${(v=h==null?void 0:h.name)!==null&&v!==void 0?v:"Error"}: ${_}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
|
|
33
|
-
${h.stack}`)}else{var A;l=(A=o==null?void 0:o.stack)!==null&&A!==void 0?A:""}const E=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} 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")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} 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:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,s=null,n=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?s=d:s=JSON.parse(d))}const u=(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("/");u&&h&&h.length>1&&(n=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(s)&&(s.length>1?(r={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,n=null,i=406,o="Not Acceptable"):s.length===1?s=s[0]:s=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(s=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new wf(r)}return{success:r===null,error:r,data:s,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},kf=class extends Ef{select(t){let e=!1;const r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.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 s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){const n=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${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:s=!1,wal:n=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,n?"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 Jo=new RegExp("[,()]");var pr=class extends kf{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(s=>typeof s=="string"&&Jo.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Jo.test(s)?`"${s}"`:`${s}`).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:s}={}){let n="";s==="plain"?n="pl":s==="phrase"?n="ph":s==="websearch"&&(n="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${n}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 s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Af=class{constructor(t,{headers:e={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:s}=e??{},n=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),s&&l.append("Prefer",`count=${s}`),new pr({method:n,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;const n="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,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new pr({method:n,url:i,headers:o,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!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),s&&l.append("Prefer",`count=${s}`),n||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new pr({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 s="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new pr({method:s,url:n,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:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new pr({method:r,url:s,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function us(t){"@babel/helpers - typeof";return us=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},us(t)}function Tf(t,e){if(us(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(us(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rf(t){var e=Tf(t,"string");return us(e)=="symbol"?e:e+""}function Of(t,e,r){return(e=Rf(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function ks(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Yo(Object(r),!0).forEach(function(s){Of(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yo(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var Cf=class ic{constructor(e,{headers:r={},schema:s,fetch:n,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=o;const l=n??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const m=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",m,{once:!0}),l(c,ks(ks({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,ks(ks({},u),{},{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 Af(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 ic(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:s=!1,get:n=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=s&&Object.values(r).some(u);h?(a="POST",c=r):s||n?(a=s?"HEAD":"GET",Object.entries(r).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{l.searchParams.append(f,m)})):(a="POST",c=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 pr({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Pf{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 s=typeof global<"u"?global:void 0;if(s&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.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 n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
33
|
+
${h.stack}`)}else{var A;l=(A=o==null?void 0:o.stack)!==null&&A!==void 0?A:""}const E=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} 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")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} 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:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,s=null,n=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?s=d:s=JSON.parse(d))}const u=(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("/");u&&h&&h.length>1&&(n=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(s)&&(s.length>1?(r={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,n=null,i=406,o="Not Acceptable"):s.length===1?s=s[0]:s=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(s=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Ef(r)}return{success:r===null,error:r,data:s,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Tf=class extends Af{select(t){let e=!1;const r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.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 s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){const n=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${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:s=!1,wal:n=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,n?"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 Yo=new RegExp("[,()]");var pr=class extends Tf{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(s=>typeof s=="string"&&Yo.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Yo.test(s)?`"${s}"`:`${s}`).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:s}={}){let n="";s==="plain"?n="pl":s==="phrase"?n="ph":s==="websearch"&&(n="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${n}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 s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Rf=class{constructor(t,{headers:e={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:s}=e??{},n=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),s&&l.append("Prefer",`count=${s}`),new pr({method:n,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;const n="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,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new pr({method:n,url:i,headers:o,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!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),s&&l.append("Prefer",`count=${s}`),n||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new pr({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 s="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new pr({method:s,url:n,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:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new pr({method:r,url:s,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function us(t){"@babel/helpers - typeof";return us=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},us(t)}function Of(t,e){if(us(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(us(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cf(t){var e=Of(t,"string");return us(e)=="symbol"?e:e+""}function Pf(t,e,r){return(e=Cf(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function ks(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(r),!0).forEach(function(s){Pf(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xo(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var xf=class ic{constructor(e,{headers:r={},schema:s,fetch:n,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=o;const l=n??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const m=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",m,{once:!0}),l(c,ks(ks({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,ks(ks({},u),{},{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 Rf(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 ic(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:s=!1,get:n=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=s&&Object.values(r).some(u);h?(a="POST",c=r):s||n?(a=s?"HEAD":"GET",Object.entries(r).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{l.searchParams.append(f,m)})):(a="POST",c=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 pr({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class If{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 s=typeof global<"u"?global:void 0;if(s&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.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 n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
34
34
|
import ws from "ws"
|
|
35
35
|
new RealtimeClient(url, { transport: ws })`}}}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+=`
|
|
36
36
|
|
|
37
|
-
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const xf="2.106.2",If=`realtime-js/${xf}`,jf="1.0.0",oc="2.0.0",Nf=oc,$f=1e4,Lf=100,Ht={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ac={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ci={connecting:"connecting",closing:"closing",closed:"closed"};class Df{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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(s))}_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,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var r,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},o=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,s){var n,i;const o=e.topic,a=(n=e.ref)!==null&&n!==void 0?n:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let m=new DataView(f),v=0;m.setUint8(v++,this.KINDS.userBroadcastPush),m.setUint8(v++,l.length),m.setUint8(v++,a.length),m.setUint8(v++,o.length),m.setUint8(v++,c.length),m.setUint8(v++,h.length),m.setUint8(v++,r),Array.from(l,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(a,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(o,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(c,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(h,E=>m.setUint8(v++,E.charCodeAt(0)));var A=new Uint8Array(f.byteLength+s.byteLength);return A.set(new Uint8Array(f),0),A.set(new Uint8Array(s),f.byteLength),A.buffer}decode(e,r){if(this._isArrayBuffer(e)){let s=this._binaryDecode(e);return r(s)}if(typeof e=="string"){const s=JSON.parse(e),[n,i,o,a,l]=s;return r({join_ref:n,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),s=r.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,n)}}_decodeUserBroadcast(e,r,s){const n=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=s.decode(e.slice(l,l+n));l=l+n;const u=s.decode(e.slice(l,l+i));l=l+i;const h=s.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(s.decode(d)):d,m={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_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(([s])=>r.includes(s)))}}var oe;(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"})(oe||(oe={}));const Xo=(t,e,r={})=>{var s;const n=(s=r.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Uf(o,t,e,n),i),{}):{}},Uf=(t,e,r,s)=>{const n=e.find(a=>a.name===t),i=n==null?void 0:n.type,o=r[t];return i&&!s.includes(i)?lc(i,o):ui(o)},lc=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Ff(e,r)}switch(t){case oe.bool:return Bf(e);case oe.float4:case oe.float8:case oe.int2:case oe.int4:case oe.int8:case oe.numeric:case oe.oid:return Mf(e);case oe.json:case oe.jsonb:return Hf(e);case oe.timestamp:return qf(e);case oe.abstime:case oe.date:case oe.daterange:case oe.int4range:case oe.int8range:case oe.money:case oe.reltime:case oe.text:case oe.time:case oe.timestamptz:case oe.timetz:case oe.tsrange:case oe.tstzrange:return ui(e);default:return ui(e)}},ui=t=>t,Bf=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Mf=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Hf=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Ff=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,s=t[r];if(t[0]==="{"&&s==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>lc(e,a))}return t},qf=t=>typeof t=="string"?t.replace(" ","T"):t,cc=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 Zr=t=>typeof t=="function"?t:function(){return t},Vf=typeof self<"u"?self:null,gr=typeof window<"u"?window:null,lt=Vf||gr||globalThis,Kf="2.0.0",Wf=1e4,Gf=1e3,dt={connecting:0,open:1,closing:2,closed:3},je={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},wt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},hi={longpoll:"longpoll",websocket:"websocket"},zf={complete:4},di="base64url.bearer.phx.",As=class{constructor(t,e,r,s){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=s,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(s=>s.status===t).forEach(s=>s.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})}},uc=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))}},Jf=class{constructor(t,e,r){this.state=je.closed,this.topic=t,this.params=Zr(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new As(this,wt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new uc(()=>{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=je.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=je.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=je.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=je.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 As(this,wt.leave,Zr({}),this.timeout).send(),this.state=je.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(wt.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}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=je.closed,this.bindings=[]}onClose(t){this.on(wt.close,t)}onError(t){return this.on(wt.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 s=new As(this,t,function(){return e},r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=je.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(wt.close,"leave")},r=new As(this,wt.leave,Zr({}),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,s){return this.topic!==t?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=je.joining,this.joinPush.resend(t))}trigger(t,e,r,s){let n=this.onMessage(t,e,r,s);if(e&&!n)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(n,r,s||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===je.closed}isErrored(){return this.state===je.errored}isJoined(){return this.state===je.joined}isJoining(){return this.state===je.joining}isLeaving(){return this.state===je.leaving}},Ws=class{static request(t,e,r,s,n,i,o){if(lt.XDomainRequest){let a=new lt.XDomainRequest;return this.xdomainRequest(a,t,e,s,n,i,o)}else if(lt.XMLHttpRequest){let a=new lt.XMLHttpRequest;return this.xhrRequest(a,t,e,r,s,n,i,o)}else{if(lt.fetch&<.AbortController)return this.fetchRequest(t,e,r,s,n,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,s,n,i,o){let a={method:t,headers:r,body:s},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),a.signal=l.signal),lt.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,s,n,i,o){return t.timeout=n,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(s),t}static xhrRequest(t,e,r,s,n,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(s))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===zf.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(n),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 s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e?`${e}[${s}]`:s,i=t[s];typeof i=="object"?r.push(this.serialize(i,n)):r.push(encodeURIComponent(n)+"="+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)}`}},Yf=t=>{let e="",r=new Uint8Array(t),s=r.byteLength;for(let n=0;n<s;n++)e+=String.fromCharCode(r[n]);return btoa(e)},ar=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(di)&&(this.authToken=atob(e[1].slice(di.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=dt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+hi.websocket),"$1/"+hi.longpoll)}endpointURL(){return Ws.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=dt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===dt.open||this.readyState===dt.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:s,messages:n}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else r=0;switch(r){case 200:n.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=dt.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=Yf(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){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
38
|
-
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let n of this.reqs)n.abort();this.readyState=dt.closed;let s=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",s)):this.onclose(s)}ajax(t,e,r,s,n){let i,o=()=>{this.reqs.delete(i),s()};i=Ws.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Xf=class Mr{constructor(e,r={}){let s=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(s.state,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Mr.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Mr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(s.diff,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Mr.syncDiff(this.state,n,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Mr.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,s,n){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(v=>v.phx_ref),d=u.metas.map(v=>v.phx_ref),f=c.metas.filter(v=>d.indexOf(v.phx_ref)<0),m=u.metas.filter(v=>h.indexOf(v.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),m.length>0&&(a[l]=this.clone(u),a[l].metas=m)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},s,n)}static syncDiff(e,r,s,n){let{joins:i,leaves:o}=this.clone(r);return s||(s=function(){}),n||(n=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}s(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),n(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(s,n){return n}),this.map(e,(s,n)=>r(s,n))}static map(e,r){return Object.getOwnPropertyNames(e).map(s=>r(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Ts={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,s,n,i,o]=JSON.parse(t);return e({join_ref:r,ref:s,topic:n,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:s,topic:n,payload:i}=t,o=this.META_LENGTH+e.length+r.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,s);case this.KINDS.reply:return this.decodeReply(t,e,s);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,s)}},decodePush(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+s));o=o+s;let l=r.decode(t.slice(o,o+n));o=o+n;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let s=e.getUint8(1),n=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+s));a=a+s;let c=r.decode(t.slice(a,a+n));a=a+n;let u=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),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:wt.reply,payload:f}},decodeBroadcast(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+s));i=i+s;let a=r.decode(t.slice(i,i+n));i=i+n;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Qf=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Wf,this.transport=e.transport||lt.WebSocket||ar,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=lt&<.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Ts.encode.bind(Ts),this.defaultDecoder=Ts.decode.bind(Ts),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!==ar?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;gr&&gr.addEventListener&&(gr.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),s=this.connectClock)}),gr.addEventListener("pageshow",n=>{s===this.connectClock&&(s=null,this.connect())}),gr.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=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,i,o)=>{console.log(`${n}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Zr(e.params||{}),this.endPoint=`${t}/${hi.websocket}`,this.vsn=e.vsn||Kf,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new uc(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return ar}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=Ws.appendParams(Ws.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=Zr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ar?this.connectWithFallback(ar,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 s=this.onMessage(n=>{n.ref===e&&(this.off([s]),t(Date.now()-r))});return!0}transportName(t){switch(t){case ar:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${di}${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,s=!0,n,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([n,i]),s=!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),s&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!s){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(),Gf,"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 s=this.conn;this.waitForBufferDone(s,()=>{e?s.close(e,r||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(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===dt.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(wt.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case dt.connecting:return"connecting";case dt.open:return"open";case dt.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 Jf(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:s,ref:n,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${n})`,s)}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:s,payload:n,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(n.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",`${n.status||""} ${r} ${s} ${i&&"("+i+")"||""}`.trim(),n);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,s,n,o)&&l.trigger(s,n,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,s])=>{try{s(...e)}catch(n){this.log("error",`error in ${t} callback`,n)}})}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 es{constructor(e,r){const s=ep(r);this.presence=new Xf(e.getChannel(),s),this.presence.onJoin((n,i,o)=>{const a=es.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=es.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return es.transformState(this.presence.state)}static transformState(e){return e=Zf(e),Object.getOwnPropertyNames(e).reduce((r,s)=>{const n=e[s];return r[s]=Ls(n),r},{})}static onJoinPayload(e,r,s){const n=Qo(r),i=Ls(s);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,r,s){const n=Qo(r),i=Ls(s);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Ls(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Zf(t){return JSON.parse(JSON.stringify(t))}function ep(t){return(t==null?void 0:t.events)&&{events:t.events}}function Qo(t){return t!=null&&t.metas?Ls(t):[]}var Zo;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Zo||(Zo={}));class tp{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new es(this.channel.channelAdapter,r)}}function rp(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 sp{constructor(e,r,s){const n=np(s);this.channel=e.getSocket().channel(r,n),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,s){let n;try{n=this.channel.push(e,r,s)}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>Lf){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return n}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===Ht.joined}isJoined(){return this.state===Ht.joined}isJoining(){return this.state===Ht.joining}isClosed(){return this.state===Ht.closed}isLeaving(){return this.state===Ht.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function np(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var ea;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ea||(ea={}));var vr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(vr||(vr={}));var St;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(St||(St={}));class ts{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:{}},s){var n,i;if(this.topic=e,this.params=r,this.socket=s,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 sp(this.socket.socketAdapter,e,this.params),this.presence=new tp(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=cc(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(n=this.params.config)===null||n===void 0?void 0:n.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 s,n,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(n=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(f=>f.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[vr.PRESENCE]&&this.bindings[vr.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:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(St.CHANNEL_ERROR,rp(f))}),this._onClose(()=>e==null?void 0:e(St.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(St.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=Ht.errored;const m=Object.values(f).join(", ")||"error";e==null||e(St.CHANNEL_ERROR,new Error(m,{cause:f}))}).receive("timeout",()=>{e==null||e(St.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var s;const n=this.bindings.postgres_changes,i=(s=n==null?void 0:n.length)!==null&&s!==void 0?s:0,o=[];for(let a=0;a<i;a++){const l=n[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&ts.isFilterValueEqual(f.schema,u)&&ts.isFilterValueEqual(f.table,h)&&ts.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=Ht.errored,r==null||r(St.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Ht.errored&&r&&r(St.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,s){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===vr.PRESENCE||e===vr.POSTGRES_CHANGES;if(n&&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,s)}async httpSend(e,r,s={}){var n;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,r={}){var s,n;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 c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=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"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.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,s){const n=new AbortController,i=setTimeout(()=>n.abort(),s),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:n.signal}));return clearTimeout(i),o}_on(e,r,s){const n=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,s),o={type:n,filter:r,callback:s,ref:i};return this.bindings[n]?this.bindings[n].push(o):this.bindings[n]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,s)=>{var n,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,s))return!1;const d=(n=this.bindings[h])===null||n===void 0?void 0:n.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,m=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:s,error:n,leave:i,join:o}=ac;return r&&[s,n,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,s)=>{if(typeof r=="object"&&"ids"in r){const n=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const s of e.bindings[r])this._on(s.type,s.filter,s.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=Xo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Xo(e.columns,e.old_record)),r}}class ip{constructor(e,r){this.socket=new Qf(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,s,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},r,s)})}push(e){this.socket.push(e)}log(e,r,s){this.socket.log(e,r,s)}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()==ci.connecting}isDisconnecting(){return this.socket.connectionState()==ci.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ta={HEARTBEAT_INTERVAL:25e3},op=[1e3,2e3,5e3,1e4],ap=1e4;function lp(){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 cp(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return lp()}const up=`
|
|
37
|
+
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const jf="2.106.2",Nf=`realtime-js/${jf}`,$f="1.0.0",oc="2.0.0",Lf=oc,Df=1e4,Uf=100,Ht={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ac={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ui={connecting:"connecting",closing:"closing",closed:"closed"};class Bf{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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(s))}_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,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var r,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},o=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,s){var n,i;const o=e.topic,a=(n=e.ref)!==null&&n!==void 0?n:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let m=new DataView(f),v=0;m.setUint8(v++,this.KINDS.userBroadcastPush),m.setUint8(v++,l.length),m.setUint8(v++,a.length),m.setUint8(v++,o.length),m.setUint8(v++,c.length),m.setUint8(v++,h.length),m.setUint8(v++,r),Array.from(l,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(a,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(o,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(c,E=>m.setUint8(v++,E.charCodeAt(0))),Array.from(h,E=>m.setUint8(v++,E.charCodeAt(0)));var A=new Uint8Array(f.byteLength+s.byteLength);return A.set(new Uint8Array(f),0),A.set(new Uint8Array(s),f.byteLength),A.buffer}decode(e,r){if(this._isArrayBuffer(e)){let s=this._binaryDecode(e);return r(s)}if(typeof e=="string"){const s=JSON.parse(e),[n,i,o,a,l]=s;return r({join_ref:n,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),s=r.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,n)}}_decodeUserBroadcast(e,r,s){const n=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=s.decode(e.slice(l,l+n));l=l+n;const u=s.decode(e.slice(l,l+i));l=l+i;const h=s.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(s.decode(d)):d,m={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_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(([s])=>r.includes(s)))}}var oe;(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"})(oe||(oe={}));const Qo=(t,e,r={})=>{var s;const n=(s=r.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Mf(o,t,e,n),i),{}):{}},Mf=(t,e,r,s)=>{const n=e.find(a=>a.name===t),i=n==null?void 0:n.type,o=r[t];return i&&!s.includes(i)?lc(i,o):hi(o)},lc=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Vf(e,r)}switch(t){case oe.bool:return Hf(e);case oe.float4:case oe.float8:case oe.int2:case oe.int4:case oe.int8:case oe.numeric:case oe.oid:return Ff(e);case oe.json:case oe.jsonb:return qf(e);case oe.timestamp:return Kf(e);case oe.abstime:case oe.date:case oe.daterange:case oe.int4range:case oe.int8range:case oe.money:case oe.reltime:case oe.text:case oe.time:case oe.timestamptz:case oe.timetz:case oe.tsrange:case oe.tstzrange:return hi(e);default:return hi(e)}},hi=t=>t,Hf=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Ff=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},qf=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Vf=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,s=t[r];if(t[0]==="{"&&s==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>lc(e,a))}return t},Kf=t=>typeof t=="string"?t.replace(" ","T"):t,cc=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 Zr=t=>typeof t=="function"?t:function(){return t},Wf=typeof self<"u"?self:null,gr=typeof window<"u"?window:null,lt=Wf||gr||globalThis,Gf="2.0.0",zf=1e4,Jf=1e3,dt={connecting:0,open:1,closing:2,closed:3},je={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},wt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},di={longpoll:"longpoll",websocket:"websocket"},Yf={complete:4},fi="base64url.bearer.phx.",As=class{constructor(t,e,r,s){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=s,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(s=>s.status===t).forEach(s=>s.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})}},uc=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))}},Xf=class{constructor(t,e,r){this.state=je.closed,this.topic=t,this.params=Zr(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new As(this,wt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new uc(()=>{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=je.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=je.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=je.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=je.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 As(this,wt.leave,Zr({}),this.timeout).send(),this.state=je.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(wt.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}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=je.closed,this.bindings=[]}onClose(t){this.on(wt.close,t)}onError(t){return this.on(wt.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 s=new As(this,t,function(){return e},r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=je.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(wt.close,"leave")},r=new As(this,wt.leave,Zr({}),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,s){return this.topic!==t?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=je.joining,this.joinPush.resend(t))}trigger(t,e,r,s){let n=this.onMessage(t,e,r,s);if(e&&!n)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(n,r,s||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===je.closed}isErrored(){return this.state===je.errored}isJoined(){return this.state===je.joined}isJoining(){return this.state===je.joining}isLeaving(){return this.state===je.leaving}},Gs=class{static request(t,e,r,s,n,i,o){if(lt.XDomainRequest){let a=new lt.XDomainRequest;return this.xdomainRequest(a,t,e,s,n,i,o)}else if(lt.XMLHttpRequest){let a=new lt.XMLHttpRequest;return this.xhrRequest(a,t,e,r,s,n,i,o)}else{if(lt.fetch&<.AbortController)return this.fetchRequest(t,e,r,s,n,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,s,n,i,o){let a={method:t,headers:r,body:s},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),a.signal=l.signal),lt.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,s,n,i,o){return t.timeout=n,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(s),t}static xhrRequest(t,e,r,s,n,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(s))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===Yf.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(n),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 s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e?`${e}[${s}]`:s,i=t[s];typeof i=="object"?r.push(this.serialize(i,n)):r.push(encodeURIComponent(n)+"="+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)}`}},Qf=t=>{let e="",r=new Uint8Array(t),s=r.byteLength;for(let n=0;n<s;n++)e+=String.fromCharCode(r[n]);return btoa(e)},ar=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(fi)&&(this.authToken=atob(e[1].slice(fi.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=dt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+di.websocket),"$1/"+di.longpoll)}endpointURL(){return Gs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=dt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===dt.open||this.readyState===dt.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:s,messages:n}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else r=0;switch(r){case 200:n.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=dt.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=Qf(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){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
38
|
+
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let n of this.reqs)n.abort();this.readyState=dt.closed;let s=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",s)):this.onclose(s)}ajax(t,e,r,s,n){let i,o=()=>{this.reqs.delete(i),s()};i=Gs.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Zf=class Mr{constructor(e,r={}){let s=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(s.state,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Mr.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Mr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(s.diff,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Mr.syncDiff(this.state,n,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Mr.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,s,n){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(v=>v.phx_ref),d=u.metas.map(v=>v.phx_ref),f=c.metas.filter(v=>d.indexOf(v.phx_ref)<0),m=u.metas.filter(v=>h.indexOf(v.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),m.length>0&&(a[l]=this.clone(u),a[l].metas=m)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},s,n)}static syncDiff(e,r,s,n){let{joins:i,leaves:o}=this.clone(r);return s||(s=function(){}),n||(n=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}s(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),n(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(s,n){return n}),this.map(e,(s,n)=>r(s,n))}static map(e,r){return Object.getOwnPropertyNames(e).map(s=>r(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Ts={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,s,n,i,o]=JSON.parse(t);return e({join_ref:r,ref:s,topic:n,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:s,topic:n,payload:i}=t,o=this.META_LENGTH+e.length+r.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,s);case this.KINDS.reply:return this.decodeReply(t,e,s);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,s)}},decodePush(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+s));o=o+s;let l=r.decode(t.slice(o,o+n));o=o+n;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let s=e.getUint8(1),n=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+s));a=a+s;let c=r.decode(t.slice(a,a+n));a=a+n;let u=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),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:wt.reply,payload:f}},decodeBroadcast(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+s));i=i+s;let a=r.decode(t.slice(i,i+n));i=i+n;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},ep=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||zf,this.transport=e.transport||lt.WebSocket||ar,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=lt&<.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Ts.encode.bind(Ts),this.defaultDecoder=Ts.decode.bind(Ts),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!==ar?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;gr&&gr.addEventListener&&(gr.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),s=this.connectClock)}),gr.addEventListener("pageshow",n=>{s===this.connectClock&&(s=null,this.connect())}),gr.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=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,i,o)=>{console.log(`${n}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Zr(e.params||{}),this.endPoint=`${t}/${di.websocket}`,this.vsn=e.vsn||Gf,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new uc(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return ar}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=Gs.appendParams(Gs.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=Zr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ar?this.connectWithFallback(ar,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 s=this.onMessage(n=>{n.ref===e&&(this.off([s]),t(Date.now()-r))});return!0}transportName(t){switch(t){case ar:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${fi}${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,s=!0,n,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([n,i]),s=!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),s&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!s){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(),Jf,"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 s=this.conn;this.waitForBufferDone(s,()=>{e?s.close(e,r||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(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===dt.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(wt.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case dt.connecting:return"connecting";case dt.open:return"open";case dt.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 Xf(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:s,ref:n,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${n})`,s)}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:s,payload:n,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(n.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",`${n.status||""} ${r} ${s} ${i&&"("+i+")"||""}`.trim(),n);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,s,n,o)&&l.trigger(s,n,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,s])=>{try{s(...e)}catch(n){this.log("error",`error in ${t} callback`,n)}})}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 es{constructor(e,r){const s=rp(r);this.presence=new Zf(e.getChannel(),s),this.presence.onJoin((n,i,o)=>{const a=es.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=es.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return es.transformState(this.presence.state)}static transformState(e){return e=tp(e),Object.getOwnPropertyNames(e).reduce((r,s)=>{const n=e[s];return r[s]=Ds(n),r},{})}static onJoinPayload(e,r,s){const n=Zo(r),i=Ds(s);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,r,s){const n=Zo(r),i=Ds(s);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Ds(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function tp(t){return JSON.parse(JSON.stringify(t))}function rp(t){return(t==null?void 0:t.events)&&{events:t.events}}function Zo(t){return t!=null&&t.metas?Ds(t):[]}var ea;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ea||(ea={}));class sp{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new es(this.channel.channelAdapter,r)}}function np(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 ip{constructor(e,r,s){const n=op(s);this.channel=e.getSocket().channel(r,n),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,s){let n;try{n=this.channel.push(e,r,s)}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>Uf){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return n}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===Ht.joined}isJoined(){return this.state===Ht.joined}isJoining(){return this.state===Ht.joining}isClosed(){return this.state===Ht.closed}isLeaving(){return this.state===Ht.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function op(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var ta;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ta||(ta={}));var vr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(vr||(vr={}));var St;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(St||(St={}));class ts{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:{}},s){var n,i;if(this.topic=e,this.params=r,this.socket=s,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 ip(this.socket.socketAdapter,e,this.params),this.presence=new sp(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=cc(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(n=this.params.config)===null||n===void 0?void 0:n.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 s,n,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(n=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(f=>f.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[vr.PRESENCE]&&this.bindings[vr.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:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(St.CHANNEL_ERROR,np(f))}),this._onClose(()=>e==null?void 0:e(St.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(St.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=Ht.errored;const m=Object.values(f).join(", ")||"error";e==null||e(St.CHANNEL_ERROR,new Error(m,{cause:f}))}).receive("timeout",()=>{e==null||e(St.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var s;const n=this.bindings.postgres_changes,i=(s=n==null?void 0:n.length)!==null&&s!==void 0?s:0,o=[];for(let a=0;a<i;a++){const l=n[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&ts.isFilterValueEqual(f.schema,u)&&ts.isFilterValueEqual(f.table,h)&&ts.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=Ht.errored,r==null||r(St.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Ht.errored&&r&&r(St.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,s){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===vr.PRESENCE||e===vr.POSTGRES_CHANGES;if(n&&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,s)}async httpSend(e,r,s={}){var n;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,r={}){var s,n;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 c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=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"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.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,s){const n=new AbortController,i=setTimeout(()=>n.abort(),s),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:n.signal}));return clearTimeout(i),o}_on(e,r,s){const n=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,s),o={type:n,filter:r,callback:s,ref:i};return this.bindings[n]?this.bindings[n].push(o):this.bindings[n]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,s)=>{var n,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,s))return!1;const d=(n=this.bindings[h])===null||n===void 0?void 0:n.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,m=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:s,error:n,leave:i,join:o}=ac;return r&&[s,n,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,s)=>{if(typeof r=="object"&&"ids"in r){const n=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const s of e.bindings[r])this._on(s.type,s.filter,s.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=Qo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Qo(e.columns,e.old_record)),r}}class ap{constructor(e,r){this.socket=new ep(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,s,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},r,s)})}push(e){this.socket.push(e)}log(e,r,s){this.socket.log(e,r,s)}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()==ui.connecting}isDisconnecting(){return this.socket.connectionState()==ui.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ra={HEARTBEAT_INTERVAL:25e3},lp=[1e3,2e3,5e3,1e4],cp=1e4;function up(){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 hp(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return up()}const dp=`
|
|
39
39
|
addEventListener("message", (e) => {
|
|
40
40
|
if (e.data.event === "start") {
|
|
41
41
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
42
42
|
}
|
|
43
|
-
});`;class
|
|
43
|
+
});`;class fp{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 s;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 Bf,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),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const n=this._initializeOptions(r);this.socketAdapter=new ap(e,n),this.httpEndpoint=cc(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 r.includes("Node.js")?new Error(`${r}
|
|
44
44
|
|
|
45
45
|
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
46
46
|
|
|
@@ -53,8 +53,8 @@ Option 2: Install and provide the "ws" package:
|
|
|
53
53
|
const client = new RealtimeClient(url, {
|
|
54
54
|
...options,
|
|
55
55
|
transport: ws
|
|
56
|
-
})`):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 s=>{const n=await s.unsubscribe();return s.teardown(),n}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,s){this.socketAdapter.log(e,r,s)}connectionState(){return this.socketAdapter.connectionState()||ci.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const s=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===s);if(n)return n;{const i=new ts(`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,s=!1;if(e)r=e,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{const i={access_token:r,version:If};r&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(ac.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,s)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,s)}}_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 s=new Blob([up],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(e){var r,s,n,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(s=e==null?void 0:e.accessToken)!==null&&s!==void 0?s:null;const m={};m.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:$f,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ta.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:ta.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Pf.getWebSocketConstructor(),m.params=e==null?void 0:e.params,m.logger=e==null?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),m.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:cp(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>op[_-1]||ap);let v,A;const E=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Nf;switch(E){case jf:v=(_,b)=>b(JSON.stringify(_)),A=(_,b)=>b(JSON.parse(_));break;case oc:v=this.serializer.encode.bind(this.serializer),A=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=E,m.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:v,m.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:A,m.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.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,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var hs=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 dp(t,e,r){const s=new URL(e,t);if(r)for(const[n,i]of Object.entries(r))i!==void 0&&s.searchParams.set(n,i);return s.toString()}async function fp(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 pp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:n,body:i,headers:o}){const a=dp(t.baseUrl,s,n),l=await fp(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,m=f==null?void 0:f.error;throw new hs((m==null?void 0:m.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function Rs(t){return t.join("")}var gp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Rs(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(s=>({namespace:s}))}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/${Rs(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Rs(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Rs(t.namespace)}`}),!0}catch(e){if(e instanceof hs&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof hs&&r.status===409)return;throw r}}};function lr(t){return t.join("")}var mp=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/${lr(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/${lr(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/${lr(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/${lr(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/${lr(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/${lr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof hs&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof hs&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},yp=class{constructor(t){var s;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=pp({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(s=t.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new gp(this.client,e),this.tableOps=new mp(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 ds(t){"@babel/helpers - typeof";return ds=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},ds(t)}function vp(t,e){if(ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(ds(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _p(t){var e=vp(t,"string");return ds(e)=="symbol"?e:e+""}function bp(t,e,r){return(e=_p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function F(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(r),!0).forEach(function(s){bp(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ra(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var bn=class extends Error{constructor(t,e="storage",r,s){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function wn(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var fi=class extends bn{constructor(t,e,r,s="storage"){super(t,s,e,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return F({},super.toJSON())}},hc=class extends bn{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Gs(t,e,r){const s=F({},t),n=e.toLowerCase();for(const i of Object.keys(s))i.toLowerCase()===n&&delete s[i];return s[n]=r,s}function wp(t){const e={};for(const[r,s]of Object.entries(t))e[r.toLowerCase()]=s;return e}const Sp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ep=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)},pi=t=>{if(Array.isArray(t))return t.map(r=>pi(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,s])=>{const n=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=pi(s)}),e},kp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),sa=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)},Ap=async(t,e,r,s)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const n=t;let i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new fi(sa(o),i,a,s))}).catch(()=>{const o=i+"";e(new fi(n.statusText||`HTTP ${i} error`,i,o,s))})}else e(new hc(sa(t),t,s))},Tp=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!s)return F(F({},n),r);if(Ep(s)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);n.headers=Gs(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),n.body=JSON.stringify(s)}else n.body=s;return e!=null&&e.duplex&&(n.duplex=e.duplex),F(F({},n),r)};async function Dr(t,e,r,s,n,i,o){return new Promise((a,l)=>{t(r,Tp(e,s,n,i)).then(c=>{if(!c.ok)throw c;if(s!=null&&s.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Ap(c,l,s,o))})}function dc(t="storage"){return{get:async(e,r,s,n)=>Dr(e,"GET",r,s,n,void 0,t),post:async(e,r,s,n,i)=>Dr(e,"POST",r,n,i,s,t),put:async(e,r,s,n,i)=>Dr(e,"PUT",r,n,i,s,t),head:async(e,r,s,n)=>Dr(e,"HEAD",r,F(F({},s),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,r,s,n,i)=>Dr(e,"DELETE",r,n,i,s,t)}}const Rp=dc("storage"),{get:fs,post:ze,put:gi,head:Op,remove:Hi}=Rp,Ue=dc("vectors");var Ir=class{constructor(t,e={},r,s="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=wp(e),this.fetch=Sp(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Gs(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(wn(r))return{data:null,error:r};throw r}}};let fc;fc=Symbol.toStringTag;var Cp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[fc]="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(wn(e))return{data:null,error:e};throw e}}};let pc;pc=Symbol.toStringTag;var Pp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[pc]="BlobDownloadBuilder",this.promise=null}asStream(){return new Cp(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(wn(e))return{data:null,error:e};throw e}}};const xp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},na={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Ip=class extends Ir{constructor(t,e={},r,s){super(t,e,s,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,s){var n=this;return n.handleOperation(async()=>{let i;const o=F(F({},na),s);let a=F(F({},n.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",n.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",n.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),s!=null&&s.headers)for(const[d,f]of Object.entries(s.headers))a=Gs(a,d,f);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),h=await(t=="PUT"?gi:ze)(n.fetch,`${n.url}/object/${u}`,i,F({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,s){var n=this;const i=n._removeEmptyFolders(t),o=n._getFinalPath(i),a=new URL(n.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),n.handleOperation(async()=>{let l;const c=F(F({},na),s);let u=F(F({},n.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",n.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(h))):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),s!=null&&s.headers)for(const[d,f]of Object.entries(s.headers))u=Gs(u,d,f);return{path:i,fullPath:(await gi(n.fetch,a.toString(),l,F({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(t);const n=F({},r.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=await ze(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:n}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new bn("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 s=this;return s.handleOperation(async()=>await ze(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(t,e,r){var s=this;return s.handleOperation(async()=>({path:(await ze(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(t,e,r){var s=this;return s.handleOperation(async()=>{let n=s._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await ze(s.fetch,`${s.url}/object/sign/${n}`,F({expiresIn:e},i?{transform:r.transform}:{}),{headers:s.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(`${s.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var s=this;return s.handleOperation(async()=>{const n=await ze(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:e,paths:t},{headers:s.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 n.map(a=>F(F({},a),{},{signedUrl:a.signedURL?encodeURI(`${s.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const s=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),o=this._getFinalPath(t),a=()=>fs(this.fetch,`${this.url}/${s}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Pp(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>pi(await fs(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Op(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(wn(n)){var s;const i=n instanceof fi?n.status:n instanceof hc?(s=n.originalError)===null||s===void 0?void 0:s.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const r=this._getFinalPath(t),s=new URLSearchParams;e!=null&&e.download&&s.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const n=s.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}`)+(n?`?${n}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Hi(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var s=this;return s.handleOperation(async()=>{const n=F(F(F({},xp),e),{},{prefix:t||""});return await ze(s.fetch,`${s.url}/object/list/${s.bucketId}`,n,{headers:s.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const s=F({},t);return await ze(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{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 jp="2.106.2",bs={"X-Client-Info":`storage-js/${jp}`};var Np=class extends Ir{constructor(t,e={},r,s){const n=new URL(t);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const i=n.href.replace(/\/$/,""),o=F(F({},bs),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await fs(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await fs(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ze(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 gi(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 ze(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Hi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}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():""}},$p=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),e);super(s,n,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ze(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 s=r.toString(),n=s?`${e.url}/bucket?${s}`:`${e.url}/bucket`;return await fs(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Hi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!kp(t))throw new bn("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 yp({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(n,i){const o=n[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(n,a),error:null}}catch(l){if(s)throw l;return{data:null,error:l}}}}})}},Lp=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Ue.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Ue.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Dp=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,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 Ue.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ue.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 Ue.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ue.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 Ue.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},Up=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Bp=class extends Up{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Mp(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)}},Mp=class extends Lp{constructor(t,e,r,s){super(t,e,s),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,F(F({},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 Hp(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Hp=class extends Dp{constructor(t,e,r,s,n){super(t,e,n),this.vectorBucketName=r,this.indexName=s}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Fp=class extends Np{constructor(t,e={},r,s){super(t,e,r,s)}from(t){return new Ip(this.url,this.headers,t,this.fetch)}get vectors(){return new Bp(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new $p(this.url+"/iceberg",this.headers,this.fetch)}};const gc="2.106.2",mr=30*1e3,mi=3,Un=mi*mr,qp="http://localhost:9999",Vp="supabase.auth.token",Kp={"X-Client-Info":`gotrue-js/${gc}`},yi="X-Supabase-Api-Version",mc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Wp=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Gp=600*1e3;class Cr extends Error{constructor(e,r,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}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 zp extends Cr{constructor(e,r,s){super(e,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Jp(t){return x(t)&&t.name==="AuthApiError"}class Je extends Cr{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class It extends Cr{constructor(e,r,s,n){super(e,s,n),this.name=r,this.status=s}}class ve extends It{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Os(t){return x(t)&&t.name==="AuthSessionMissingError"}class cr 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 Ps 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 Yp(t){return x(t)&&t.name==="AuthImplicitGrantRedirectError"}class ia 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 Xp 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 vi extends It{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Bn(t){return x(t)&&t.name==="AuthRetryableFetchError"}class oa extends It{constructor(e,r,s){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class _i extends It{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const zs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),aa=`
|
|
57
|
-
\r=`.split(""),Qp=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<aa.length;e+=1)t[aa[e].charCodeAt(0)]=-2;for(let e=0;e<zs.length;e+=1)t[zs[e].charCodeAt(0)]=e;return t})();function la(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(zs[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(zs[s]),e.queuedBits-=6}}function yc(t,e,r){const s=Qp[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ca(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{tg(o,s,r)};for(let o=0;o<t.length;o+=1)yc(t.charCodeAt(o),n,i);return e.join("")}function Zp(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 eg(t,e){for(let r=0;r<t.length;r+=1){let s=t.charCodeAt(r);if(s>55295&&s<=56319){const n=(s-55296)*1024&65535;s=(t.charCodeAt(r+1)-56320&65535|n)+65536,r+=1}Zp(s,e)}}function tg(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let s=1;s<6;s+=1)if((t>>7-s&1)===0){e.utf8seq=s;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 Er(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)yc(t.charCodeAt(n),r,s);return new Uint8Array(e)}function rg(t){const e=[];return eg(t,r=>e.push(r)),new Uint8Array(e)}function er(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};return t.forEach(n=>la(n,r,s)),la(null,r,s),e.join("")}function sg(t){return Math.round(Date.now()/1e3)+t}function ng(){return Symbol("auth-callback")}const we=()=>typeof window<"u"&&typeof document<"u",Jt={tested:!1,writable:!1},vc=()=>{if(!we())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Jt.tested)return Jt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Jt.tested=!0,Jt.writable=!0}catch{Jt.tested=!0,Jt.writable=!1}return Jt.writable};function ig(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return r.searchParams.forEach((s,n)=>{e[n]=s}),e}const _c=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),og=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",yr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Yt=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},be=async(t,e)=>{await t.removeItem(e)};class Sn{constructor(){this.promise=new Sn.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}Sn.promiseConstructor=Promise;function xs(t){const e=t.split(".");if(e.length!==3)throw new _i("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!Wp.test(e[s]))throw new _i("JWT not in base64url format");return{header:JSON.parse(ca(e[0])),payload:JSON.parse(ca(e[1])),signature:Er(e[2]),raw:{header:e[0],payload:e[1]}}}async function ag(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function lg(t,e){return new Promise((s,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){s(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function cg(t){return("0"+t.toString(16)).substr(-2)}function ug(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let n="";for(let i=0;i<56;i++)n+=r.charAt(Math.floor(Math.random()*s));return n}return crypto.getRandomValues(e),Array.from(e,cg).join("")}async function hg(t){const r=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(s);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function dg(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 hg(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ur(t,e,r=!1){const s=ug();let n=s;r&&(n+="/recovery"),await yr(t,`${e}-code-verifier`,n);const i=await dg(s);return[i,s===i?"plain":"s256"]}const fg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function pg(t){const e=t.headers.get(yi);if(!e||!e.match(fg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function gg(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 mg(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 yg=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function _t(t){if(!yg.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function We(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 Mn(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 vg(t,e){return new Proxy(t,{get:(r,s,n)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const i=s.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,s,n)}return!e.value&&typeof s=="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,s,n)}})}function ua(t){return JSON.parse(JSON.stringify(t))}const Qt=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)},_g=[502,503,504,520,521,522,523,524,530];async function ha(t){var e;if(!og(t))throw new vi(Qt(t),0);if(_g.includes(t.status))throw new vi(Qt(t),t.status);let r;try{r=await t.json()}catch(i){throw new Je(Qt(i),i)}let s;const n=pg(t);if(n&&n.getTime()>=mc["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new oa(Qt(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ve}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 oa(Qt(r),t.status,r.weak_password.reasons);throw new zp(Qt(r),t.status||500,s)}const bg=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),r))};async function L(t,e,r,s){var n;const i=Object.assign({},s==null?void 0:s.headers);i[yi]||(i[yi]=mc["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(n=s==null?void 0:s.query)!==null&&n!==void 0?n:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await wg(t,e,r+a,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function wg(t,e,r,s,n,i){const o=bg(e,s,n,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new vi(Qt(l),0)}if(a.ok||await ha(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(l){await ha(l)}}function qe(t){var e;let r=null;kg(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=sg(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:s},error:null}}function da(t){const e=qe(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,s)=>r&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Ft(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Sg(t){return{data:t,error:null}}function Eg(t){const{action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i}=t,o=_n(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function fa(t){return t}function kg(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Hn=["global","local","others"];class Ag{_encodePathSegment(e){if(e==="."||e==="..")throw new Cr("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:s,experimental:n}){this.url=e,this.headers=r,this.fetch=_c(s),this.experimental=n??{},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=Hn[0]){if(Hn.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Hn.join(", ")}`);try{return await L(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(x(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,r={}){try{return await L(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:r}=e,s=_n(e,["options"]),n=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(n.new_email=s==null?void 0:s.newEmail,delete n.newEmail),await L(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Eg,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 L(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ft})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await L(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:fa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(x(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){_t(e);try{return await L(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ft})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){_t(e);try{return await L(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,r=!1){_t(e);try{return await L(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){_t(e.userId);try{const{data:r,error:s}=await L(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:s}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _deleteFactor(e){_t(e.userId),_t(e.id);try{return{data:await L(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,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await L(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:fa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(x(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await L(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{const r=this._encodePathSegment(e);return await L(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const s=this._encodePathSegment(e);return await L(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(s){if(x(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await L(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{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{const r=this._encodePathSegment(e);return await L(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,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 L(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var n;return{data:{providers:(n=s==null?void 0:s.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(r){if(x(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await L(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{const r=this._encodePathSegment(e);return await L(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const s=this._encodePathSegment(e);return await L(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(s){if(x(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await L(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){We(this.experimental),_t(e.userId);try{return await L(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){We(this.experimental),_t(e.userId),_t(e.passkeyId);try{return await L(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 pa(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const it={debug:!!(globalThis&&vc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class bc extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ga extends bc{}async function Tg(t,e,r){it.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{s.abort(),it.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){clearTimeout(n),it.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{it.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw it.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new ga(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(it.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(n),await r()}})}catch(i){if(e>0&&clearTimeout(n),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(s.signal.aborted)return it.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){it.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{it.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw it.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new ga(`Lock "${t}" was released because another request stole it`)}throw i}}function Rg(){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 wc(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Og(t){return parseInt(t,16)}function Cg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function Pg(t){var e;const{chainId:r,domain:s,expirationTime:n,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,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(!s)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(`
|
|
56
|
+
})`):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 s=>{const n=await s.unsubscribe();return s.teardown(),n}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,s){this.socketAdapter.log(e,r,s)}connectionState(){return this.socketAdapter.connectionState()||ui.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const s=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===s);if(n)return n;{const i=new ts(`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,s=!1;if(e)r=e,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{const i={access_token:r,version:Nf};r&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(ac.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,s)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,s)}}_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 s=new Blob([dp],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(e){var r,s,n,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(s=e==null?void 0:e.accessToken)!==null&&s!==void 0?s:null;const m={};m.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Df,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ra.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:ra.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:If.getWebSocketConstructor(),m.params=e==null?void 0:e.params,m.logger=e==null?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),m.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:hp(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>lp[_-1]||cp);let v,A;const E=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Lf;switch(E){case $f:v=(_,b)=>b(JSON.stringify(_)),A=(_,b)=>b(JSON.parse(_));break;case oc:v=this.serializer.encode.bind(this.serializer),A=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=E,m.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:v,m.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:A,m.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.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,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var hs=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 pp(t,e,r){const s=new URL(e,t);if(r)for(const[n,i]of Object.entries(r))i!==void 0&&s.searchParams.set(n,i);return s.toString()}async function gp(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 mp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:n,body:i,headers:o}){const a=pp(t.baseUrl,s,n),l=await gp(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,m=f==null?void 0:f.error;throw new hs((m==null?void 0:m.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function Rs(t){return t.join("")}var yp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Rs(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(s=>({namespace:s}))}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/${Rs(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Rs(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Rs(t.namespace)}`}),!0}catch(e){if(e instanceof hs&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof hs&&r.status===409)return;throw r}}};function lr(t){return t.join("")}var vp=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/${lr(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/${lr(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/${lr(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/${lr(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/${lr(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/${lr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof hs&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof hs&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},_p=class{constructor(t){var s;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=mp({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(s=t.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new yp(this.client,e),this.tableOps=new vp(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 ds(t){"@babel/helpers - typeof";return ds=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},ds(t)}function bp(t,e){if(ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(ds(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wp(t){var e=bp(t,"string");return ds(e)=="symbol"?e:e+""}function Sp(t,e,r){return(e=wp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sa(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function F(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sa(Object(r),!0).forEach(function(s){Sp(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sa(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var wn=class extends Error{constructor(t,e="storage",r,s){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Sn(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var pi=class extends wn{constructor(t,e,r,s="storage"){super(t,s,e,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return F({},super.toJSON())}},hc=class extends wn{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function zs(t,e,r){const s=F({},t),n=e.toLowerCase();for(const i of Object.keys(s))i.toLowerCase()===n&&delete s[i];return s[n]=r,s}function Ep(t){const e={};for(const[r,s]of Object.entries(t))e[r.toLowerCase()]=s;return e}const kp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ap=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)},gi=t=>{if(Array.isArray(t))return t.map(r=>gi(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,s])=>{const n=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=gi(s)}),e},Tp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),na=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)},Rp=async(t,e,r,s)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const n=t;let i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new pi(na(o),i,a,s))}).catch(()=>{const o=i+"";e(new pi(n.statusText||`HTTP ${i} error`,i,o,s))})}else e(new hc(na(t),t,s))},Op=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!s)return F(F({},n),r);if(Ap(s)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);n.headers=zs(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),n.body=JSON.stringify(s)}else n.body=s;return e!=null&&e.duplex&&(n.duplex=e.duplex),F(F({},n),r)};async function Dr(t,e,r,s,n,i,o){return new Promise((a,l)=>{t(r,Op(e,s,n,i)).then(c=>{if(!c.ok)throw c;if(s!=null&&s.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Rp(c,l,s,o))})}function dc(t="storage"){return{get:async(e,r,s,n)=>Dr(e,"GET",r,s,n,void 0,t),post:async(e,r,s,n,i)=>Dr(e,"POST",r,n,i,s,t),put:async(e,r,s,n,i)=>Dr(e,"PUT",r,n,i,s,t),head:async(e,r,s,n)=>Dr(e,"HEAD",r,F(F({},s),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,r,s,n,i)=>Dr(e,"DELETE",r,n,i,s,t)}}const Cp=dc("storage"),{get:fs,post:Je,put:mi,head:Pp,remove:Fi}=Cp,Ue=dc("vectors");var Ir=class{constructor(t,e={},r,s="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Ep(e),this.fetch=kp(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=zs(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(Sn(r))return{data:null,error:r};throw r}}};let fc;fc=Symbol.toStringTag;var xp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[fc]="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(Sn(e))return{data:null,error:e};throw e}}};let pc;pc=Symbol.toStringTag;var Ip=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[pc]="BlobDownloadBuilder",this.promise=null}asStream(){return new xp(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(Sn(e))return{data:null,error:e};throw e}}};const jp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ia={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Np=class extends Ir{constructor(t,e={},r,s){super(t,e,s,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,s){var n=this;return n.handleOperation(async()=>{let i;const o=F(F({},ia),s);let a=F(F({},n.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",n.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",n.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),s!=null&&s.headers)for(const[d,f]of Object.entries(s.headers))a=zs(a,d,f);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),h=await(t=="PUT"?mi:Je)(n.fetch,`${n.url}/object/${u}`,i,F({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,s){var n=this;const i=n._removeEmptyFolders(t),o=n._getFinalPath(i),a=new URL(n.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),n.handleOperation(async()=>{let l;const c=F(F({},ia),s);let u=F(F({},n.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",n.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(h))):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),s!=null&&s.headers)for(const[d,f]of Object.entries(s.headers))u=zs(u,d,f);return{path:i,fullPath:(await mi(n.fetch,a.toString(),l,F({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(t);const n=F({},r.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=await Je(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:n}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new wn("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 s=this;return s.handleOperation(async()=>await Je(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(t,e,r){var s=this;return s.handleOperation(async()=>({path:(await Je(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(t,e,r){var s=this;return s.handleOperation(async()=>{let n=s._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await Je(s.fetch,`${s.url}/object/sign/${n}`,F({expiresIn:e},i?{transform:r.transform}:{}),{headers:s.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(`${s.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var s=this;return s.handleOperation(async()=>{const n=await Je(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:e,paths:t},{headers:s.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 n.map(a=>F(F({},a),{},{signedUrl:a.signedURL?encodeURI(`${s.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const s=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),o=this._getFinalPath(t),a=()=>fs(this.fetch,`${this.url}/${s}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Ip(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>gi(await fs(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Pp(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Sn(n)){var s;const i=n instanceof pi?n.status:n instanceof hc?(s=n.originalError)===null||s===void 0?void 0:s.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const r=this._getFinalPath(t),s=new URLSearchParams;e!=null&&e.download&&s.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const n=s.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}`)+(n?`?${n}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Fi(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var s=this;return s.handleOperation(async()=>{const n=F(F(F({},jp),e),{},{prefix:t||""});return await Je(s.fetch,`${s.url}/object/list/${s.bucketId}`,n,{headers:s.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const s=F({},t);return await Je(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{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 $p="2.106.2",bs={"X-Client-Info":`storage-js/${$p}`};var Lp=class extends Ir{constructor(t,e={},r,s){const n=new URL(t);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const i=n.href.replace(/\/$/,""),o=F(F({},bs),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await fs(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await fs(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Je(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 mi(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 Je(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Fi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}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():""}},Dp=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),e);super(s,n,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Je(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 s=r.toString(),n=s?`${e.url}/bucket?${s}`:`${e.url}/bucket`;return await fs(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Fi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Tp(t))throw new wn("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 _p({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(n,i){const o=n[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(n,a),error:null}}catch(l){if(s)throw l;return{data:null,error:l}}}}})}},Up=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Ue.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Ue.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Bp=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,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 Ue.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ue.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 Ue.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ue.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 Ue.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},Mp=class extends Ir{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},bs),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ue.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Hp=class extends Mp{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Fp(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)}},Fp=class extends Up{constructor(t,e,r,s){super(t,e,s),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,F(F({},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 qp(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},qp=class extends Bp{constructor(t,e,r,s,n){super(t,e,n),this.vectorBucketName=r,this.indexName=s}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,F(F({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Vp=class extends Lp{constructor(t,e={},r,s){super(t,e,r,s)}from(t){return new Np(this.url,this.headers,t,this.fetch)}get vectors(){return new Hp(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Dp(this.url+"/iceberg",this.headers,this.fetch)}};const gc="2.106.2",mr=30*1e3,yi=3,Mn=yi*mr,Kp="http://localhost:9999",Wp="supabase.auth.token",Gp={"X-Client-Info":`gotrue-js/${gc}`},vi="X-Supabase-Api-Version",mc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},zp=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Jp=600*1e3;class Cr extends Error{constructor(e,r,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}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 Yp extends Cr{constructor(e,r,s){super(e,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Xp(t){return x(t)&&t.name==="AuthApiError"}class Ye extends Cr{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class It extends Cr{constructor(e,r,s,n){super(e,s,n),this.name=r,this.status=s}}class ve extends It{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Os(t){return x(t)&&t.name==="AuthSessionMissingError"}class cr 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 Ps 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 Qp(t){return x(t)&&t.name==="AuthImplicitGrantRedirectError"}class oa 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 Zp 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 _i extends It{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Hn(t){return x(t)&&t.name==="AuthRetryableFetchError"}class aa extends It{constructor(e,r,s){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class bi extends It{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),la=`
|
|
57
|
+
\r=`.split(""),eg=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<la.length;e+=1)t[la[e].charCodeAt(0)]=-2;for(let e=0;e<Js.length;e+=1)t[Js[e].charCodeAt(0)]=e;return t})();function ca(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(Js[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(Js[s]),e.queuedBits-=6}}function yc(t,e,r){const s=eg[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ua(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{sg(o,s,r)};for(let o=0;o<t.length;o+=1)yc(t.charCodeAt(o),n,i);return e.join("")}function tg(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 rg(t,e){for(let r=0;r<t.length;r+=1){let s=t.charCodeAt(r);if(s>55295&&s<=56319){const n=(s-55296)*1024&65535;s=(t.charCodeAt(r+1)-56320&65535|n)+65536,r+=1}tg(s,e)}}function sg(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let s=1;s<6;s+=1)if((t>>7-s&1)===0){e.utf8seq=s;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 Er(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)yc(t.charCodeAt(n),r,s);return new Uint8Array(e)}function ng(t){const e=[];return rg(t,r=>e.push(r)),new Uint8Array(e)}function er(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};return t.forEach(n=>ca(n,r,s)),ca(null,r,s),e.join("")}function ig(t){return Math.round(Date.now()/1e3)+t}function og(){return Symbol("auth-callback")}const we=()=>typeof window<"u"&&typeof document<"u",Jt={tested:!1,writable:!1},vc=()=>{if(!we())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Jt.tested)return Jt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Jt.tested=!0,Jt.writable=!0}catch{Jt.tested=!0,Jt.writable=!1}return Jt.writable};function ag(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return r.searchParams.forEach((s,n)=>{e[n]=s}),e}const _c=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),lg=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",yr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Yt=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},be=async(t,e)=>{await t.removeItem(e)};class En{constructor(){this.promise=new En.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}En.promiseConstructor=Promise;function xs(t){const e=t.split(".");if(e.length!==3)throw new bi("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!zp.test(e[s]))throw new bi("JWT not in base64url format");return{header:JSON.parse(ua(e[0])),payload:JSON.parse(ua(e[1])),signature:Er(e[2]),raw:{header:e[0],payload:e[1]}}}async function cg(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function ug(t,e){return new Promise((s,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){s(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function hg(t){return("0"+t.toString(16)).substr(-2)}function dg(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let n="";for(let i=0;i<56;i++)n+=r.charAt(Math.floor(Math.random()*s));return n}return crypto.getRandomValues(e),Array.from(e,hg).join("")}async function fg(t){const r=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(s);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function pg(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 fg(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ur(t,e,r=!1){const s=dg();let n=s;r&&(n+="/recovery"),await yr(t,`${e}-code-verifier`,n);const i=await pg(s);return[i,s===i?"plain":"s256"]}const gg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function mg(t){const e=t.headers.get(vi);if(!e||!e.match(gg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function yg(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 vg(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 _g=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function _t(t){if(!_g.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ge(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 Fn(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 bg(t,e){return new Proxy(t,{get:(r,s,n)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const i=s.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,s,n)}return!e.value&&typeof s=="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,s,n)}})}function ha(t){return JSON.parse(JSON.stringify(t))}const Qt=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)},wg=[502,503,504,520,521,522,523,524,530];async function da(t){var e;if(!lg(t))throw new _i(Qt(t),0);if(wg.includes(t.status))throw new _i(Qt(t),t.status);let r;try{r=await t.json()}catch(i){throw new Ye(Qt(i),i)}let s;const n=mg(t);if(n&&n.getTime()>=mc["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new aa(Qt(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ve}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 aa(Qt(r),t.status,r.weak_password.reasons);throw new Yp(Qt(r),t.status||500,s)}const Sg=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),r))};async function L(t,e,r,s){var n;const i=Object.assign({},s==null?void 0:s.headers);i[vi]||(i[vi]=mc["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(n=s==null?void 0:s.query)!==null&&n!==void 0?n:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Eg(t,e,r+a,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function Eg(t,e,r,s,n,i){const o=Sg(e,s,n,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new _i(Qt(l),0)}if(a.ok||await da(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(l){await da(l)}}function qe(t){var e;let r=null;Tg(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=ig(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:s},error:null}}function fa(t){const e=qe(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,s)=>r&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Ft(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function kg(t){return{data:t,error:null}}function Ag(t){const{action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i}=t,o=bn(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function pa(t){return t}function Tg(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const qn=["global","local","others"];class Rg{_encodePathSegment(e){if(e==="."||e==="..")throw new Cr("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:s,experimental:n}){this.url=e,this.headers=r,this.fetch=_c(s),this.experimental=n??{},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=qn[0]){if(qn.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${qn.join(", ")}`);try{return await L(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(x(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,r={}){try{return await L(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:r}=e,s=bn(e,["options"]),n=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(n.new_email=s==null?void 0:s.newEmail,delete n.newEmail),await L(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Ag,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 L(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ft})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await L(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(x(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){_t(e);try{return await L(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ft})}catch(r){if(x(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){_t(e);try{return await L(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,r=!1){_t(e);try{return await L(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ft})}catch(s){if(x(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){_t(e.userId);try{const{data:r,error:s}=await L(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:s}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _deleteFactor(e){_t(e.userId),_t(e.id);try{return{data:await L(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,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await L(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(x(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await L(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{const r=this._encodePathSegment(e);return await L(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const s=this._encodePathSegment(e);return await L(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(s){if(x(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await L(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{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{const r=this._encodePathSegment(e);return await L(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,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 L(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var n;return{data:{providers:(n=s==null?void 0:s.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(r){if(x(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await L(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{const r=this._encodePathSegment(e);return await L(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(x(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const s=this._encodePathSegment(e);return await L(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(s){if(x(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await L(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(x(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){Ge(this.experimental),_t(e.userId);try{return await L(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){Ge(this.experimental),_t(e.userId),_t(e.passkeyId);try{return await L(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 ga(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const ot={debug:!!(globalThis&&vc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class bc extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ma extends bc{}async function Og(t,e,r){ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{s.abort(),ot.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){clearTimeout(n),ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new ma(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ot.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(n),await r()}})}catch(i){if(e>0&&clearTimeout(n),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(s.signal.aborted)return ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw ot.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new ma(`Lock "${t}" was released because another request stole it`)}throw i}}function Cg(){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 wc(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Pg(t){return parseInt(t,16)}function xg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function Ig(t){var e;const{chainId:r,domain:s,expirationTime:n,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,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(!s)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(`
|
|
58
58
|
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=wc(t.address),m=u?`${u}://${s}`:s,v=t.statement?`${t.statement}
|
|
59
59
|
`:"",A=`${m} wants you to sign in with your Ethereum account:
|
|
60
60
|
${f}
|
|
@@ -69,70 +69,70 @@ Not Before: ${a.toISOString()}`),l&&(E+=`
|
|
|
69
69
|
Request ID: ${l}`),c){let _=`
|
|
70
70
|
Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);_+=`
|
|
71
71
|
- ${b}`}E+=_}return`${A}
|
|
72
|
-
${E}`}class ge extends Error{constructor({message:e,code:r,cause:s,name:n}){var i;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(i=n??(s instanceof Error?s.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 Js extends ge{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function xg({error:t,options:e}){var r,s,n;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 ge({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 ge({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ge({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ge({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 ge({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ge({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 ge({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ge({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(Sc(o)){if(i.rp.id!==o)return new ge({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({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 ge({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 ge({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 ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Ig({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 ge({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ge({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(Sc(s)){if(r.rpId!==s)return new ge({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ge({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 ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class jg{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 bi=new jg;function ma(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:s}=t,n=_n(t,["challenge","user","excludeCredentials"]),i=Er(e).buffer,o=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),a=Object.assign(Object.assign({},n),{challenge:i,user:o});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let l=0;l<s.length;l++){const c=s[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Er(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function ya(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,s=_n(t,["challenge","allowCredentials"]),n=Er(e).buffer,i=Object.assign(Object.assign({},s),{challenge:n});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:Er(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function va(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:er(new Uint8Array(t.response.attestationObject)),clientDataJSON:er(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _a(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,s=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:er(new Uint8Array(n.authenticatorData)),clientDataJSON:er(new Uint8Array(n.clientDataJSON)),signature:er(new Uint8Array(n.signature)),userHandle:n.userHandle?er(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Sc(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Ys(){var t,e;return!!(we()&&"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 Ec(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Js("Browser returned unexpected credential type",e)}:{data:null,error:new Js("Empty credential response",e)}}catch(e){return{data:null,error:xg({error:e,options:t})}}}async function kc(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Js("Browser returned unexpected credential type",e)}:{data:null,error:new Js("Empty credential response",e)}}catch(e){return{data:null,error:Ig({error:e,options:t})}}}const Ng={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},$g={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Xs(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),r=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),s={};for(const n of t)if(n)for(const i in n){const o=n[i];if(o!==void 0)if(Array.isArray(o))s[i]=o;else if(r(o))s[i]=o;else if(e(o)){const a=s[i];e(a)?s[i]=Xs(a,o):s[i]=Xs(o)}else s[i]=o}return s}function Lg(t,e){return Xs(Ng,t,e||{})}function Dg(t,e){return Xs($g,t,e||{})}class Ug{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:s,signal:n},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 c=n??bi.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=s;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,m=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${m}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Lg(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Ec({publicKey:u,signal:c});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 u=Dg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await kc(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));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 Je("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:s})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new Cr("rpId is required for WebAuthn authentication")};try{if(!Ys())return{data:null,error:new Je("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:s},signal:n},{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:s,credential_response:l.credential_response}})}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Je("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new Cr("rpId is required for WebAuthn registration")};try{if(!Ys())return{data:null,error:new Je("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(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:n},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:s,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Je("Unexpected error in register",o)}}}}Rg();const Bg={url:qp,storageKey:Vp,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Kp,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function ba(t,e,r){return await r()}const hr={};class ps{get jwks(){var e,r;return(r=(e=hr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=hr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{cachedAt:e})}constructor(e){var r,s,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},Bg),e);if(this.storageKey=o.storageKey,this.instanceID=(r=ps.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,ps.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&we()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(s=o.experimental)!==null&&s!==void 0?s:{},this.admin=new Ag({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=_c(o.fetch),this.lock=o.lock||ba,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&we()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Tg:this.lock=ba,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 Ug(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?(o.storage?this.storage=o.storage:vc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=pa(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=pa(this.memoryStorage)),we()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${gc}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},s="none";if(we()&&(r=ig(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),we()&&this.detectSessionInUrl&&s!=="none"){const{data:n,error:i}=await this._getSessionFromURL(r,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Yp(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}=n;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 Je("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,s,n;try{const i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:qe}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,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,s,n;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await ur(this.storage,this.storageKey)),i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,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:f,code_challenge_method:m},xform:qe})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},channel:(n=d==null?void 0:d.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:qe})}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 be(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await be(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 L(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:da})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await L(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:da})}else throw new Cs("You must provide either an email or phone number and a password");const{data:s,error:n}=r;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!s||!s.session||!s.user){const i=new cr;return this._returnResult({data:{user:null,session:null},error:i})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:n})}catch(r){if(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,s,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>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,s,n,i,o,a,l,c,u,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{const{chain:v,wallet:A,statement:E,options:_}=e;let b;if(we())if(typeof A=="object")b=A;else{const V=window;if("ethereum"in V&&typeof V.ethereum=="object"&&"request"in V.ethereum&&typeof V.ethereum.request=="function")b=V.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 A!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=A}const O=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href),B=await b.request({method:"eth_requestAccounts"}).then(V=>V).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!B||B.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const W=wc(B[0]);let q=(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!q){const V=await b.request({method:"eth_chainId"});q=Og(V)}const J={domain:O.host,address:W,statement:E,uri:O.href,version:"1",chainId:q,nonce:(n=_==null?void 0:_.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Pg(J),m=await b.request({method:"personal_sign",params:[Cg(f),W]})}try{const{data:v,error:A}=await L(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((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:qe});if(A)throw A;if(!v||!v.session||!v.user){const E=new cr;return this._returnResult({data:{user:null,session:null},error:E})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:A})}catch(v){if(x(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async signInWithSolana(e){var r,s,n,i,o,a,l,c,u,h,d,f;let m,v;if("message"in e)m=e.message,v=e.signature;else{const{chain:A,wallet:E,statement:_,options:b}=e;let O;if(we())if(typeof E=="object")O=E;else{const W=window;if("solana"in W&&typeof W.solana=="object"&&("signIn"in W.solana&&typeof W.solana.signIn=="function"||"signMessage"in W.solana&&typeof W.solana.signMessage=="function"))O=W.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 E!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=E}const B=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in O&&O.signIn){const W=await O.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:B.host,uri:B.href}),_?{statement:_}:null));let q;if(Array.isArray(W)&&W[0]&&typeof W[0]=="object")q=W[0];else if(W&&typeof W=="object"&&"signedMessage"in W&&"signature"in W)q=W;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in q&&"signature"in q&&(typeof q.signedMessage=="string"||q.signedMessage instanceof Uint8Array)&&q.signature instanceof Uint8Array)m=typeof q.signedMessage=="string"?q.signedMessage:new TextDecoder().decode(q.signedMessage),v=q.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in O)||typeof O.signMessage!="function"||!("publicKey"in O)||typeof O!="object"||!O.publicKey||!("toBase58"in O.publicKey)||typeof O.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${B.host} wants you to sign in with your Solana account:`,O.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${B.href}`,`Issued At: ${(n=(s=b==null?void 0:b.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(q=>`- ${q}`)]:[]].join(`
|
|
73
|
-
`);const W=await O.signMessage(new TextEncoder().encode(m),"utf8");if(!W||!(W instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=W}}try{const{data:A,error:E}=await L(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:er(v)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:qe});if(E)throw E;if(!A||!A.session||!A.user){const _=new cr;return this._returnResult({data:{user:null,session:null},error:_})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:E})}catch(A){if(x(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async _exchangeCodeForSession(e){const r=await Yt(this.storage,`${this.storageKey}-code-verifier`),[s,n]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new Xp;const{data:i,error:o}=await L(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:qe});if(await be(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new cr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(n==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(await be(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:s,token:n,access_token:i,nonce:o}=e,a=await L(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:qe}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new cr;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,s,n,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await ur(this.storage,this.storageKey));const{error:h}=await L(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:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},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:c,error:u}=await L(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},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:c==null?void 0:c.message_id},error:u})}throw new Cs("You must provide either an email or phone number.")}catch(a){if(await be(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,s;try{let n,i;"options"in e&&(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:a}=await L(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:qe});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=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:c,session:l},error:null})}catch(n){if(x(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var r,s,n,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await ur(this.storage,this.storageKey));const c=await L(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:(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.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:Sg});return!((i=c.data)===null||i===void 0)&&i.url&&we()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)throw s;if(!r)throw new ve;const{error:n}=await L(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}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:s,type:n,options:i}=e,{error:o}=await L(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:s,type:n,options:i}=e,{data:o,error:a}=await L(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:n,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(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await s}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.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Yt(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 s=e.expires_at?e.expires_at*1e3-Date.now()<Un:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.userStorage){const o=await Yt(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Mn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=vg(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ft}):await this._useSession(async r=>{var s,n,i;const{data:o,error:a}=r;if(a)throw a;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ve}:await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Ft})})}catch(r){if(x(r))return Os(r)&&(await this._removeSession(),await be(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async s=>{const{data:n,error:i}=s;if(i)throw i;if(!n.session)throw new ve;const o=n.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await ur(this.storage,this.storageKey));const{data:c,error:u}=await L(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:Ft});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(s){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ve;const r=Date.now()/1e3;let s=r,n=!0,i=null;const{payload:o}=xs(e.access_token);if(o.exp&&(s=o.exp,n=s<=r),n){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:s-r,expires_at:s},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,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var s;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new ve;const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},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 s;try{if(!we())throw new Ps("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ps(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 ia("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ps("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 ia("No code detected.");const{data:b,error:O}=await this._exchangeCodeForSession(e.code);if(O)throw O;const B=new URL(window.location.href);return B.searchParams.delete("code"),window.history.replaceState(window.history.state,"",B.toString()),{data:{session:b.session,redirectType:(s=b.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new Ps("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const m=f-h;m*1e3<=mr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const v=f-d;h-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,f,h):h-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,f,h);const{data:A,error:E}=await this._getUser(o);if(E)throw E;const _={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(n){if(x(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Yt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i&&!Os(i))return this._returnResult({error:i});const o=(s=n.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(Jp(a)&&(a.status===404||a.status===401||a.status===403)||Os(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await be(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=ng(),s={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,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async r=>{var s,n;try{const{data:{session:i},error:o}=r;if(o)throw o;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),Os(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let s=null,n=null;this.flowType==="pkce"&&([s,n]=await ur(this.storage,this.storageKey,!0));try{return await L(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await be(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:s}=await this.getUser();if(s)throw s;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:s,error:n}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=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 L(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return we()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:e.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(x(s))return this._returnResult({data:{provider:e.provider,url:null},error:s});throw s}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var s;try{const{error:n,data:{session:i}}=r;if(n)throw n;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await L(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=i==null?void 0:i.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:qe}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new cr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(n){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var s,n;const{data:i,error:o}=r;if(o)throw o;return await L(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await lg(async n=>(n>0&&await ag(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await L(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:qe})),(n,i)=>{const o=200*Math.pow(2,n);return i&&Bn(i)&&Date.now()+o-s<mr})}catch(s){if(this._debug(r,"error",s),x(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}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 s=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",s),we()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const n=await Yt(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Yt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await yr(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Mn()}else if(n&&!n.user&&!n.user){const o=await Yt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await be(this.storage,this.storageKey+"-user"),await yr(this.storage,this.storageKey,n)):n.user=Mn()}if(this._debug(s,"session from storage",n),!this._isValidSession(n)){this._debug(s,"session is not valid"),n!==null&&await this._removeSession();return}const i=((r=n.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Un;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${Un}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),Bn(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(n.access_token);!a&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(s,"error",n),console.error(n);return}finally{this._debug(s,"end")}}async _callRefreshToken(e){var r,s;if(!e)throw new ve;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Sn;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new ve;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(n,"error",i),x(i)){const o={data:null,error:i};return Bn(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,r,s=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&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(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await be(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&await yr(this.userStorage,this.storageKey+"-user",{user:r.user});const n=Object.assign({},r);delete n.user;const i=ua(n);await yr(this.storage,this.storageKey,i)}else{const n=ua(r);await yr(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await be(this.storage,this.storageKey),await be(this.storage,this.storageKey+"-code-verifier"),await be(this.storage,this.storageKey+"-user"),this.userStorage&&await be(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&we()&&(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(),mr);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 _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/mr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${mr}ms, refresh threshold is ${mi} ticks`),n<=mi&&await this._callRefreshToken(s.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 bc)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!we()||!(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})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,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()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,s){const n=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&n.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&n.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await ur(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(a.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);n.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&n.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;return i?this._returnResult({data:null,error:i}):await L(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.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 s,n;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:c}=await L(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.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){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?va(e.webauthn.credential_response):_a(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ma(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ya(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const n={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])n.all.push(i),i.status==="verified"&&n[i.factor_type].push(i);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,s,n,i;if(e)try{const{payload:f}=xs(e);let m=null;f.aal&&(m=f.aal);let v=m;const{data:{user:A},error:E}=await this.getUser(e);if(E)return this._returnResult({data:null,error:E});((s=(r=A==null?void 0:A.factors)===null||r===void 0?void 0:r.filter(O=>O.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(v="aal2");const b=f.amr||[];return{data:{currentLevel:m,nextLevel:v,currentAuthenticationMethods:b},error:null}}catch(f){if(x(f))return this._returnResult({data:null,error:f});throw f}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}=xs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(n=o.user.factors)===null||n===void 0?void 0:n.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;return n?this._returnResult({data:null,error:n}):s?await L(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ve})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ve});const o=await L(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&we()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ve});const o=await L(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&we()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;return s?this._returnResult({data:null,error:s}):r?await L(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new ve})})}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:s},error:n}=r;return n?this._returnResult({data:null,error:n}):s?(await L(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ve})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let s=r.keys.find(a=>a.kid===e);if(s)return s;const n=Date.now();if(s=this.jwks.keys.find(a=>a.kid===e),s&&this.jwks_cached_at+Gp>n)return s;const{data:i,error:o}=await L(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=n,s=i.keys.find(a=>a.kid===e),!s)?null:s}async getClaims(e,r={}){try{let s=e;if(!s){const{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});s=f.session.access_token}const{header:n,payload:i,signature:o,raw:{header:a,payload:l}}=xs(s);r!=null&&r.allowExpired||gg(i.exp);const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(s);if(f)throw f;return{data:{claims:i,header:n,signature:o},error:null}}const u=mg(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,rg(`${a}.${l}`)))throw new _i("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(e){var r,s,n;We(this.experimental);try{if(!Ys())return this._returnResult({data:null,error:new Je("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=ya(i.options),l=(n=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:bi.createNewAbortSignal(),{data:c,error:u}=await kc({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Je("WebAuthn ceremony failed",null)});const h=_a(c);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,s;We(this.experimental);try{if(!Ys())return this._returnResult({data:null,error:new Je("Browser does not support WebAuthn",null)});const{data:n,error:i}=await this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});const o=ma(n.options),a=(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:bi.createNewAbortSignal(),{data:l,error:c}=await Ec({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new Je("WebAuthn ceremony failed",null)});const u=va(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){We(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ve});const{data:n,error:i}=await L(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:n,error:null})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){We(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{data:i,error:o}=await L(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.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;We(this.experimental);try{const{data:s,error:n}=await L(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 n?this._returnResult({data:null,error:n}):this._returnResult({data:s,error:null})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(e){We(this.experimental);try{const{data:r,error:s}=await L(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:qe});return s?this._returnResult({data:null,error:s}):(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(){We(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ve});const{data:n,error:i}=await L(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:n,error:null})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){We(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{data:i,error:o}=await L(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.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){We(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{error:i}=await L(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.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}}}ps.nextInstanceID={};const Mg=ps,Hg="2.106.2";let Hr="";typeof Deno<"u"?Hr="deno":typeof document<"u"?Hr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Hr="react-native":Hr="node";const Fg={"X-Client-Info":`supabase-js-${Hr}/${Hg}`},qg={headers:Fg},Vg={schema:"public"},Kg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Wg={},Gg={enabled:!1,respectSamplingDecision:!0};function zg(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(h){o(h)}}function l(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,[])).next())})}let Fn=null;const Jg="@opentelemetry/api";function Yg(){return Fn===null&&(Fn=import(Jg).catch(()=>null)),Fn}function Xg(){return zg(this,void 0,void 0,function*(){try{const t=yield Yg();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 Qg(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,s,n,i]=e;if(r.length!==2||s.length!==32||n.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(s)||!o.test(n)||!o.test(i)||s==="00000000000000000000000000000000"||n==="0000000000000000"?null:{version:r,traceId:s,parentId:n,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function Zg(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 s of e)try{if(typeof s=="string"){if(em(r.hostname,s))return!0}else if(s instanceof RegExp){if(s.test(r.hostname))return!0}else if(typeof s=="function"&&s(r))return!0}catch{continue}return!1}function em(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 tm(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 gs(t){"@babel/helpers - typeof";return gs=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},gs(t)}function rm(t,e){if(gs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(gs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sm(t){var e=rm(t,"string");return gs(e)=="symbol"?e:e+""}function nm(t,e,r){return(e=sm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wa(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function de(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(r),!0).forEach(function(s){nm(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wa(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}const im=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),om=()=>Headers,am=(t,e,r,s,n)=>{const i=im(s),o=om(),a=(n==null?void 0:n.enabled)===!0,l=(n==null?void 0:n.respectSamplingDecision)!==!1,c=a?tm(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let m=new o(h==null?void 0:h.headers);if(m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${f}`),c){const v=await lm(u,c,l);v&&(v.traceparent&&!m.has("traceparent")&&m.set("traceparent",v.traceparent),v.tracestate&&!m.has("tracestate")&&m.set("tracestate",v.tracestate),v.baggage&&!m.has("baggage")&&m.set("baggage",v.baggage))}return i(u,de(de({},h),{},{headers:m}))}};async function lm(t,e,r){if(!Zg(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const s=await Xg();if(!s||!s.traceparent)return null;if(r){const n=Qg(s.traceparent);if(n&&!n.isSampled)return null}return s}function Sa(t){return typeof t=="boolean"?{enabled:t}:t}function cm(t){return t.endsWith("/")?t:t+"/"}function um(t,e){var r,s,n,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:m,global:v}=e,A=Sa(t.tracePropagation),E=Sa(e.tracePropagation),_={db:de(de({},d),l),auth:de(de({},f),c),realtime:de(de({},m),u),storage:{},global:de(de(de({},v),h),{},{headers:de(de({},(r=v==null?void 0:v.headers)!==null&&r!==void 0?r:{}),(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{})}),tracePropagation:{enabled:(n=(i=A==null?void 0:A.enabled)!==null&&i!==void 0?i:E==null?void 0:E.enabled)!==null&&n!==void 0?n:!1,respectSamplingDecision:(o=(a=A==null?void 0:A.respectSamplingDecision)!==null&&a!==void 0?a:E==null?void 0:E.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function hm(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(cm(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var dm=class extends Mg{constructor(t){super(t)}},fm=class{constructor(t,e,r){var s,n;this.supabaseUrl=t,this.supabaseKey=e;const i=hm(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Vg,realtime:Wg,auth:de(de({},Kg),{},{storageKey:o}),global:qg,tracePropagation:Gg},l=um(r??{},a);if(this.settings=l,this.storageKey=(s=l.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=am(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(de({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new Cf(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 Fp(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new _f(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}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 _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:s}=await t.auth.getSession();return(e=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,m){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new dm({url:this.authUrl.href,headers:de(de({},v),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:m,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(A=>A.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new hp(this.realtimeUrl.href,de(de({},t),{},{params:de(de({},{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")&&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 pm=(t,e,r)=>new fm(t,e,r);function gm(){if(typeof window<"u")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)<=18:!1}gm()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let Ac=null,Ea=!1;async function mm(){if(!Ea){Ea=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Ac=pm(e,r))}catch{}}}function qn(){return Ac}const Fi=ad("auth",()=>{const t=Kr(localStorage.getItem("io_token")),e=Kr(localStorage.getItem("io_email")),r=Kr(!1),s=$e(()=>!!t.value);async function n(a,l){var u,h;const c=qn();if(!c)throw new Error("Auth not configured");r.value=!0;try{const{data:d,error:f}=await c.auth.signInWithPassword({email:a,password:l});if(f)throw f;t.value=((u=d.session)==null?void 0:u.access_token)??null,e.value=((h=d.user)==null?void 0:h.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function i(){const a=qn();a&&await a.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email")}async function o(){const a=qn();if(!a)return;const{data:l}=await a.auth.getSession();l.session&&(t.value=l.session.access_token,localStorage.setItem("io_token",l.session.access_token))}return{token:t,email:e,loading:r,isAuthenticated:s,login:n,logout:i,refreshToken:o}});/**
|
|
72
|
+
${E}`}class ge extends Error{constructor({message:e,code:r,cause:s,name:n}){var i;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(i=n??(s instanceof Error?s.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 Ys extends ge{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function jg({error:t,options:e}){var r,s,n;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 ge({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 ge({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ge({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ge({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 ge({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ge({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 ge({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ge({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(Sc(o)){if(i.rp.id!==o)return new ge({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({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 ge({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 ge({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 ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Ng({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 ge({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ge({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(Sc(s)){if(r.rpId!==s)return new ge({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ge({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 ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class $g{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 wi=new $g;function ya(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:s}=t,n=bn(t,["challenge","user","excludeCredentials"]),i=Er(e).buffer,o=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),a=Object.assign(Object.assign({},n),{challenge:i,user:o});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let l=0;l<s.length;l++){const c=s[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Er(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function va(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,s=bn(t,["challenge","allowCredentials"]),n=Er(e).buffer,i=Object.assign(Object.assign({},s),{challenge:n});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:Er(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function _a(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:er(new Uint8Array(t.response.attestationObject)),clientDataJSON:er(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ba(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,s=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:er(new Uint8Array(n.authenticatorData)),clientDataJSON:er(new Uint8Array(n.clientDataJSON)),signature:er(new Uint8Array(n.signature)),userHandle:n.userHandle?er(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Sc(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Xs(){var t,e;return!!(we()&&"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 Ec(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ys("Browser returned unexpected credential type",e)}:{data:null,error:new Ys("Empty credential response",e)}}catch(e){return{data:null,error:jg({error:e,options:t})}}}async function kc(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ys("Browser returned unexpected credential type",e)}:{data:null,error:new Ys("Empty credential response",e)}}catch(e){return{data:null,error:Ng({error:e,options:t})}}}const Lg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Dg={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Qs(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),r=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),s={};for(const n of t)if(n)for(const i in n){const o=n[i];if(o!==void 0)if(Array.isArray(o))s[i]=o;else if(r(o))s[i]=o;else if(e(o)){const a=s[i];e(a)?s[i]=Qs(a,o):s[i]=Qs(o)}else s[i]=o}return s}function Ug(t,e){return Qs(Lg,t,e||{})}function Bg(t,e){return Qs(Dg,t,e||{})}class Mg{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:s,signal:n},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 c=n??wi.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=s;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,m=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${m}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Ug(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Ec({publicKey:u,signal:c});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 u=Bg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await kc(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));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 Ye("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:s})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new Cr("rpId is required for WebAuthn authentication")};try{if(!Xs())return{data:null,error:new Ye("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:s},signal:n},{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:s,credential_response:l.credential_response}})}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Ye("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new Cr("rpId is required for WebAuthn registration")};try{if(!Xs())return{data:null,error:new Ye("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(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:n},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:s,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return x(o)?{data:null,error:o}:{data:null,error:new Ye("Unexpected error in register",o)}}}}Cg();const Hg={url:Kp,storageKey:Wp,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Gp,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function wa(t,e,r){return await r()}const hr={};class ps{get jwks(){var e,r;return(r=(e=hr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=hr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{cachedAt:e})}constructor(e){var r,s,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},Hg),e);if(this.storageKey=o.storageKey,this.instanceID=(r=ps.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,ps.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&we()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(s=o.experimental)!==null&&s!==void 0?s:{},this.admin=new Rg({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=_c(o.fetch),this.lock=o.lock||wa,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&we()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Og:this.lock=wa,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 Mg(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?(o.storage?this.storage=o.storage:vc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ga(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=ga(this.memoryStorage)),we()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${gc}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},s="none";if(we()&&(r=ag(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),we()&&this.detectSessionInUrl&&s!=="none"){const{data:n,error:i}=await this._getSessionFromURL(r,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Qp(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}=n;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 Ye("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,s,n;try{const i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:qe}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,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,s,n;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await ur(this.storage,this.storageKey)),i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,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:f,code_challenge_method:m},xform:qe})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},channel:(n=d==null?void 0:d.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:qe})}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 be(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await be(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 L(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:fa})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await L(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:fa})}else throw new Cs("You must provide either an email or phone number and a password");const{data:s,error:n}=r;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!s||!s.session||!s.user){const i=new cr;return this._returnResult({data:{user:null,session:null},error:i})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:n})}catch(r){if(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,s,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>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,s,n,i,o,a,l,c,u,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{const{chain:v,wallet:A,statement:E,options:_}=e;let b;if(we())if(typeof A=="object")b=A;else{const V=window;if("ethereum"in V&&typeof V.ethereum=="object"&&"request"in V.ethereum&&typeof V.ethereum.request=="function")b=V.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 A!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=A}const O=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href),B=await b.request({method:"eth_requestAccounts"}).then(V=>V).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!B||B.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const W=wc(B[0]);let q=(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!q){const V=await b.request({method:"eth_chainId"});q=Pg(V)}const J={domain:O.host,address:W,statement:E,uri:O.href,version:"1",chainId:q,nonce:(n=_==null?void 0:_.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Ig(J),m=await b.request({method:"personal_sign",params:[xg(f),W]})}try{const{data:v,error:A}=await L(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((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:qe});if(A)throw A;if(!v||!v.session||!v.user){const E=new cr;return this._returnResult({data:{user:null,session:null},error:E})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:A})}catch(v){if(x(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async signInWithSolana(e){var r,s,n,i,o,a,l,c,u,h,d,f;let m,v;if("message"in e)m=e.message,v=e.signature;else{const{chain:A,wallet:E,statement:_,options:b}=e;let O;if(we())if(typeof E=="object")O=E;else{const W=window;if("solana"in W&&typeof W.solana=="object"&&("signIn"in W.solana&&typeof W.solana.signIn=="function"||"signMessage"in W.solana&&typeof W.solana.signMessage=="function"))O=W.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 E!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=E}const B=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in O&&O.signIn){const W=await O.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:B.host,uri:B.href}),_?{statement:_}:null));let q;if(Array.isArray(W)&&W[0]&&typeof W[0]=="object")q=W[0];else if(W&&typeof W=="object"&&"signedMessage"in W&&"signature"in W)q=W;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in q&&"signature"in q&&(typeof q.signedMessage=="string"||q.signedMessage instanceof Uint8Array)&&q.signature instanceof Uint8Array)m=typeof q.signedMessage=="string"?q.signedMessage:new TextDecoder().decode(q.signedMessage),v=q.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in O)||typeof O.signMessage!="function"||!("publicKey"in O)||typeof O!="object"||!O.publicKey||!("toBase58"in O.publicKey)||typeof O.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${B.host} wants you to sign in with your Solana account:`,O.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${B.href}`,`Issued At: ${(n=(s=b==null?void 0:b.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(q=>`- ${q}`)]:[]].join(`
|
|
73
|
+
`);const W=await O.signMessage(new TextEncoder().encode(m),"utf8");if(!W||!(W instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=W}}try{const{data:A,error:E}=await L(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:er(v)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:qe});if(E)throw E;if(!A||!A.session||!A.user){const _=new cr;return this._returnResult({data:{user:null,session:null},error:_})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:E})}catch(A){if(x(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async _exchangeCodeForSession(e){const r=await Yt(this.storage,`${this.storageKey}-code-verifier`),[s,n]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new Zp;const{data:i,error:o}=await L(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:qe});if(await be(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new cr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(n==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(await be(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:s,token:n,access_token:i,nonce:o}=e,a=await L(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:qe}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new cr;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,s,n,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await ur(this.storage,this.storageKey));const{error:h}=await L(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:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},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:c,error:u}=await L(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},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:c==null?void 0:c.message_id},error:u})}throw new Cs("You must provide either an email or phone number.")}catch(a){if(await be(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,s;try{let n,i;"options"in e&&(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:a}=await L(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:qe});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=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:c,session:l},error:null})}catch(n){if(x(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var r,s,n,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await ur(this.storage,this.storageKey));const c=await L(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:(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.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:kg});return!((i=c.data)===null||i===void 0)&&i.url&&we()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)throw s;if(!r)throw new ve;const{error:n}=await L(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}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:s,type:n,options:i}=e,{error:o}=await L(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:s,type:n,options:i}=e,{data:o,error:a}=await L(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:n,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(x(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await s}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.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Yt(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 s=e.expires_at?e.expires_at*1e3-Date.now()<Mn:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.userStorage){const o=await Yt(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Fn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=bg(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ft}):await this._useSession(async r=>{var s,n,i;const{data:o,error:a}=r;if(a)throw a;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ve}:await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Ft})})}catch(r){if(x(r))return Os(r)&&(await this._removeSession(),await be(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async s=>{const{data:n,error:i}=s;if(i)throw i;if(!n.session)throw new ve;const o=n.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await ur(this.storage,this.storageKey));const{data:c,error:u}=await L(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:Ft});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(s){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ve;const r=Date.now()/1e3;let s=r,n=!0,i=null;const{payload:o}=xs(e.access_token);if(o.exp&&(s=o.exp,n=s<=r),n){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:s-r,expires_at:s},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,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var s;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new ve;const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},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 s;try{if(!we())throw new Ps("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ps(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 oa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ps("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 oa("No code detected.");const{data:b,error:O}=await this._exchangeCodeForSession(e.code);if(O)throw O;const B=new URL(window.location.href);return B.searchParams.delete("code"),window.history.replaceState(window.history.state,"",B.toString()),{data:{session:b.session,redirectType:(s=b.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new Ps("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const m=f-h;m*1e3<=mr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const v=f-d;h-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,f,h):h-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,f,h);const{data:A,error:E}=await this._getUser(o);if(E)throw E;const _={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(n){if(x(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Yt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i&&!Os(i))return this._returnResult({error:i});const o=(s=n.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(Xp(a)&&(a.status===404||a.status===401||a.status===403)||Os(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await be(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=og(),s={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,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async r=>{var s,n;try{const{data:{session:i},error:o}=r;if(o)throw o;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),Os(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let s=null,n=null;this.flowType==="pkce"&&([s,n]=await ur(this.storage,this.storageKey,!0));try{return await L(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await be(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:s}=await this.getUser();if(s)throw s;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:s,error:n}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=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 L(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return we()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:e.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(x(s))return this._returnResult({data:{provider:e.provider,url:null},error:s});throw s}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var s;try{const{error:n,data:{session:i}}=r;if(n)throw n;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await L(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=i==null?void 0:i.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:qe}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new cr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(n){if(await be(this.storage,`${this.storageKey}-code-verifier`),x(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var s,n;const{data:i,error:o}=r;if(o)throw o;return await L(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await ug(async n=>(n>0&&await cg(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await L(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:qe})),(n,i)=>{const o=200*Math.pow(2,n);return i&&Hn(i)&&Date.now()+o-s<mr})}catch(s){if(this._debug(r,"error",s),x(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}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 s=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",s),we()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const n=await Yt(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Yt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await yr(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Fn()}else if(n&&!n.user&&!n.user){const o=await Yt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await be(this.storage,this.storageKey+"-user"),await yr(this.storage,this.storageKey,n)):n.user=Fn()}if(this._debug(s,"session from storage",n),!this._isValidSession(n)){this._debug(s,"session is not valid"),n!==null&&await this._removeSession();return}const i=((r=n.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Mn;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${Mn}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),Hn(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(n.access_token);!a&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(s,"error",n),console.error(n);return}finally{this._debug(s,"end")}}async _callRefreshToken(e){var r,s;if(!e)throw new ve;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new En;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new ve;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(n,"error",i),x(i)){const o={data:null,error:i};return Hn(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,r,s=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&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(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await be(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&await yr(this.userStorage,this.storageKey+"-user",{user:r.user});const n=Object.assign({},r);delete n.user;const i=ha(n);await yr(this.storage,this.storageKey,i)}else{const n=ha(r);await yr(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await be(this.storage,this.storageKey),await be(this.storage,this.storageKey+"-code-verifier"),await be(this.storage,this.storageKey+"-user"),this.userStorage&&await be(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&we()&&(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(),mr);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 _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/mr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${mr}ms, refresh threshold is ${yi} ticks`),n<=yi&&await this._callRefreshToken(s.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 bc)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!we()||!(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})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,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()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,s){const n=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&n.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&n.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await ur(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(a.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);n.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&n.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;return i?this._returnResult({data:null,error:i}):await L(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.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 s,n;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:c}=await L(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.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){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?_a(e.webauthn.credential_response):ba(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:n,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ya(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:va(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const n={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])n.all.push(i),i.status==="verified"&&n[i.factor_type].push(i);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,s,n,i;if(e)try{const{payload:f}=xs(e);let m=null;f.aal&&(m=f.aal);let v=m;const{data:{user:A},error:E}=await this.getUser(e);if(E)return this._returnResult({data:null,error:E});((s=(r=A==null?void 0:A.factors)===null||r===void 0?void 0:r.filter(O=>O.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(v="aal2");const b=f.amr||[];return{data:{currentLevel:m,nextLevel:v,currentAuthenticationMethods:b},error:null}}catch(f){if(x(f))return this._returnResult({data:null,error:f});throw f}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}=xs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(n=o.user.factors)===null||n===void 0?void 0:n.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;return n?this._returnResult({data:null,error:n}):s?await L(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ve})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ve});const o=await L(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&we()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ve});const o=await L(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&we()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;return s?this._returnResult({data:null,error:s}):r?await L(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new ve})})}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:s},error:n}=r;return n?this._returnResult({data:null,error:n}):s?(await L(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ve})})}catch(r){if(x(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let s=r.keys.find(a=>a.kid===e);if(s)return s;const n=Date.now();if(s=this.jwks.keys.find(a=>a.kid===e),s&&this.jwks_cached_at+Jp>n)return s;const{data:i,error:o}=await L(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=n,s=i.keys.find(a=>a.kid===e),!s)?null:s}async getClaims(e,r={}){try{let s=e;if(!s){const{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});s=f.session.access_token}const{header:n,payload:i,signature:o,raw:{header:a,payload:l}}=xs(s);r!=null&&r.allowExpired||yg(i.exp);const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(s);if(f)throw f;return{data:{claims:i,header:n,signature:o},error:null}}const u=vg(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,ng(`${a}.${l}`)))throw new bi("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(e){var r,s,n;Ge(this.experimental);try{if(!Xs())return this._returnResult({data:null,error:new Ye("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=va(i.options),l=(n=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:wi.createNewAbortSignal(),{data:c,error:u}=await kc({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Ye("WebAuthn ceremony failed",null)});const h=ba(c);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,s;Ge(this.experimental);try{if(!Xs())return this._returnResult({data:null,error:new Ye("Browser does not support WebAuthn",null)});const{data:n,error:i}=await this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});const o=ya(n.options),a=(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:wi.createNewAbortSignal(),{data:l,error:c}=await Ec({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new Ye("WebAuthn ceremony failed",null)});const u=_a(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(x(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){Ge(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ve});const{data:n,error:i}=await L(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:n,error:null})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){Ge(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{data:i,error:o}=await L(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.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;Ge(this.experimental);try{const{data:s,error:n}=await L(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 n?this._returnResult({data:null,error:n}):this._returnResult({data:s,error:null})}catch(s){if(x(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(e){Ge(this.experimental);try{const{data:r,error:s}=await L(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:qe});return s?this._returnResult({data:null,error:s}):(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(){Ge(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ve});const{data:n,error:i}=await L(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:n,error:null})})}catch(e){if(x(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){Ge(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{data:i,error:o}=await L(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.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){Ge(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ve});const{error:i}=await L(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.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}}}ps.nextInstanceID={};const Fg=ps,qg="2.106.2";let Hr="";typeof Deno<"u"?Hr="deno":typeof document<"u"?Hr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Hr="react-native":Hr="node";const Vg={"X-Client-Info":`supabase-js-${Hr}/${qg}`},Kg={headers:Vg},Wg={schema:"public"},Gg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},zg={},Jg={enabled:!1,respectSamplingDecision:!0};function Yg(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(h){o(h)}}function l(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,[])).next())})}let Vn=null;const Xg="@opentelemetry/api";function Qg(){return Vn===null&&(Vn=import(Xg).catch(()=>null)),Vn}function Zg(){return Yg(this,void 0,void 0,function*(){try{const t=yield Qg();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 em(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,s,n,i]=e;if(r.length!==2||s.length!==32||n.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(s)||!o.test(n)||!o.test(i)||s==="00000000000000000000000000000000"||n==="0000000000000000"?null:{version:r,traceId:s,parentId:n,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function tm(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 s of e)try{if(typeof s=="string"){if(rm(r.hostname,s))return!0}else if(s instanceof RegExp){if(s.test(r.hostname))return!0}else if(typeof s=="function"&&s(r))return!0}catch{continue}return!1}function rm(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 sm(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 gs(t){"@babel/helpers - typeof";return gs=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},gs(t)}function nm(t,e){if(gs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(gs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function im(t){var e=nm(t,"string");return gs(e)=="symbol"?e:e+""}function om(t,e,r){return(e=im(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sa(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function de(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(r),!0).forEach(function(s){om(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sa(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}const am=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),lm=()=>Headers,cm=(t,e,r,s,n)=>{const i=am(s),o=lm(),a=(n==null?void 0:n.enabled)===!0,l=(n==null?void 0:n.respectSamplingDecision)!==!1,c=a?sm(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let m=new o(h==null?void 0:h.headers);if(m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${f}`),c){const v=await um(u,c,l);v&&(v.traceparent&&!m.has("traceparent")&&m.set("traceparent",v.traceparent),v.tracestate&&!m.has("tracestate")&&m.set("tracestate",v.tracestate),v.baggage&&!m.has("baggage")&&m.set("baggage",v.baggage))}return i(u,de(de({},h),{},{headers:m}))}};async function um(t,e,r){if(!tm(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const s=await Zg();if(!s||!s.traceparent)return null;if(r){const n=em(s.traceparent);if(n&&!n.isSampled)return null}return s}function Ea(t){return typeof t=="boolean"?{enabled:t}:t}function hm(t){return t.endsWith("/")?t:t+"/"}function dm(t,e){var r,s,n,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:m,global:v}=e,A=Ea(t.tracePropagation),E=Ea(e.tracePropagation),_={db:de(de({},d),l),auth:de(de({},f),c),realtime:de(de({},m),u),storage:{},global:de(de(de({},v),h),{},{headers:de(de({},(r=v==null?void 0:v.headers)!==null&&r!==void 0?r:{}),(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{})}),tracePropagation:{enabled:(n=(i=A==null?void 0:A.enabled)!==null&&i!==void 0?i:E==null?void 0:E.enabled)!==null&&n!==void 0?n:!1,respectSamplingDecision:(o=(a=A==null?void 0:A.respectSamplingDecision)!==null&&a!==void 0?a:E==null?void 0:E.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function fm(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(hm(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var pm=class extends Fg{constructor(t){super(t)}},gm=class{constructor(t,e,r){var s,n;this.supabaseUrl=t,this.supabaseKey=e;const i=fm(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Wg,realtime:zg,auth:de(de({},Gg),{},{storageKey:o}),global:Kg,tracePropagation:Jg},l=dm(r??{},a);if(this.settings=l,this.storageKey=(s=l.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=cm(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(de({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new xf(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 Vp(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new wf(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}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 _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:s}=await t.auth.getSession();return(e=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,m){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new pm({url:this.authUrl.href,headers:de(de({},v),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:m,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(A=>A.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new fp(this.realtimeUrl.href,de(de({},t),{},{params:de(de({},{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")&&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 mm=(t,e,r)=>new gm(t,e,r);function ym(){if(typeof window<"u")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)<=18:!1}ym()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let Ac=null,ka=!1;async function vm(){if(!ka){ka=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Ac=mm(e,r))}catch{}}}function Is(){return Ac}const kn=cd("auth",()=>{const t=Kr(localStorage.getItem("io_token")),e=Kr(localStorage.getItem("io_email")),r=Kr(!1),s=$e(()=>!!t.value);function n(){const l=Is();l&&l.auth.onAuthStateChange((c,u)=>{var h,d;u?(t.value=u.access_token,e.value=((h=u.user)==null?void 0:h.email)??null,localStorage.setItem("io_token",u.access_token),(d=u.user)!=null&&d.email&&localStorage.setItem("io_email",u.user.email)):(t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"))})}async function i(l,c){var h,d;const u=Is();if(!u)throw new Error("Auth not configured");r.value=!0;try{const{data:f,error:m}=await u.auth.signInWithPassword({email:l,password:c});if(m)throw m;t.value=((h=f.session)==null?void 0:h.access_token)??null,e.value=((d=f.user)==null?void 0:d.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function o(){const l=Is();l&&await l.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email")}async function a(){const l=Is();if(!l)return;const{data:c,error:u}=await l.auth.refreshSession();u||!c.session||(t.value=c.session.access_token,localStorage.setItem("io_token",c.session.access_token))}return{token:t,email:e,loading:r,isAuthenticated:s,login:i,logout:o,refreshToken:a,initAuthListener:n}}),_m=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:kn},Symbol.toStringTag,{value:"Module"}));/**
|
|
74
74
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
75
75
|
*
|
|
76
76
|
* This source code is licensed under the ISC license.
|
|
77
77
|
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
-
*/const
|
|
78
|
+
*/const bm=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
79
79
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the ISC license.
|
|
82
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/var
|
|
83
|
+
*/var js={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
|
84
84
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
85
85
|
*
|
|
86
86
|
* This source code is licensed under the ISC license.
|
|
87
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/const
|
|
88
|
+
*/const wm=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:s,iconNode:n,name:i,class:o,...a},{slots:l})=>as("svg",{...js,width:t||js.width,height:t||js.height,stroke:s||js.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${bm(i??"icon")}`],...a},[...n.map(c=>as(...c)),...l.default?[l.default()]:[]]);/**
|
|
89
89
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
90
90
|
*
|
|
91
91
|
* This source code is licensed under the ISC license.
|
|
92
92
|
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/const jt=(t,e)=>(r,{slots:s})=>as(
|
|
93
|
+
*/const jt=(t,e)=>(r,{slots:s})=>as(wm,{...r,iconNode:e,name:t},s);/**
|
|
94
94
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
95
95
|
*
|
|
96
96
|
* This source code is licensed under the ISC license.
|
|
97
97
|
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/const
|
|
98
|
+
*/const Sm=jt("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
99
99
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
100
100
|
*
|
|
101
101
|
* This source code is licensed under the ISC license.
|
|
102
102
|
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/const
|
|
103
|
+
*/const Em=jt("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
104
104
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
105
105
|
*
|
|
106
106
|
* This source code is licensed under the ISC license.
|
|
107
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/const
|
|
108
|
+
*/const km=jt("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
|
|
109
109
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
110
110
|
*
|
|
111
111
|
* This source code is licensed under the ISC license.
|
|
112
112
|
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/const
|
|
113
|
+
*/const Am=jt("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
114
114
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
115
115
|
*
|
|
116
116
|
* This source code is licensed under the ISC license.
|
|
117
117
|
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/const
|
|
118
|
+
*/const Tm=jt("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
119
119
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
120
120
|
*
|
|
121
121
|
* This source code is licensed under the ISC license.
|
|
122
122
|
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
-
*/const
|
|
123
|
+
*/const Rm=jt("PuzzleIcon",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
|
|
124
124
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
125
125
|
*
|
|
126
126
|
* This source code is licensed under the ISC license.
|
|
127
127
|
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
-
*/const
|
|
128
|
+
*/const Om=jt("ServerIcon",[["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"}]]);/**
|
|
129
129
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
130
130
|
*
|
|
131
131
|
* This source code is licensed under the ISC license.
|
|
132
132
|
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
-
*/const
|
|
133
|
+
*/const Cm=jt("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
134
134
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
135
135
|
*
|
|
136
136
|
* This source code is licensed under the ISC license.
|
|
137
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/const
|
|
138
|
+
*/const Pm=jt("UsersIcon",[["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"}]]),xm={class:"w-64 border-r border-border bg-card flex flex-col h-full shrink-0"},Im={class:"flex-1 p-2 space-y-1 overflow-y-auto"},jm={class:"p-3 border-t border-border"},Nm={class:"flex items-center justify-between"},$m={class:"text-xs text-muted-foreground truncate"},Lm=dn({__name:"AppSidebar",setup(t){const e=rc(),r=yf(),s=kn(),n=[{name:"Chat",icon:Tm,path:"/"},{name:"Squads",icon:Pm,path:"/squads"},{name:"Feed",icon:km,path:"/feed"},{name:"Skills",icon:Rm,path:"/skills"},{name:"MCP Servers",icon:Om,path:"/mcp"},{name:"Schedules",icon:Em,path:"/schedules"},{name:"Wiki",icon:Sm,path:"/wiki"},{name:"Settings",icon:Cm,path:"/settings"}];async function i(){await s.logout(),r.push("/login")}return(o,a)=>{const l=dl("router-link");return Sr(),ei("aside",xm,[a[0]||(a[0]=ze("div",{class:"p-4 border-b border-border"},[ze("h1",{class:"text-xl font-bold tracking-tight"},"🤖 IO"),ze("p",{class:"text-xs text-muted-foreground mt-1"},"Personal AI Assistant")],-1)),ze("nav",Im,[(Sr(),ei(ut,null,Bu(n,c=>Ae(l,{key:c.path,to:c.path,class:an(["flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",[Xe(e).path===c.path||c.path!=="/"&&Xe(e).path.startsWith(c.path)?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground"]])},{default:nl(()=>[(Sr(),Di(Uu(c.icon),{class:"w-4 h-4"})),Nl(" "+Kn(c.name),1)]),_:2},1032,["to","class"])),64))]),ze("div",jm,[ze("div",Nm,[ze("span",$m,Kn(Xe(s).email),1),ze("button",{onClick:i,class:"p-1.5 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[Ae(Xe(Am),{class:"w-4 h-4"})])])])])}}}),Dm={class:"flex h-screen overflow-hidden"},Um={class:"flex-1 overflow-auto"},Bm=dn({__name:"App",setup(t){const e=kn(),r=rc(),s=$e(()=>e.isAuthenticated&&r.name!=="login");return(n,i)=>{const o=dl("router-view");return Sr(),ei("div",Dm,[s.value?(Sr(),Di(Lm,{key:0})):gh("",!0),ze("main",Um,[Ae(o)])])}}}),Mm=[{path:"/login",name:"login",component:()=>We(()=>import("./LoginView-CIP77sJH.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>We(()=>import("./ChatView-B9WVD6tx.js"),__vite__mapDeps([0,1,2]))},{path:"/squads",name:"squads",component:()=>We(()=>import("./SquadsView-DaFexZRB.js"),__vite__mapDeps([3,1]))},{path:"/squads/:id",name:"squad-detail",component:()=>We(()=>import("./SquadDetailView-BM0HhBdq.js"),__vite__mapDeps([4,1]))},{path:"/feed",name:"feed",component:()=>We(()=>import("./FeedView-CpzIivbf.js"),__vite__mapDeps([5,1,2,6]))},{path:"/skills",name:"skills",component:()=>We(()=>import("./SkillsView-DfS8e6eK.js"),__vite__mapDeps([7,1,8,6]))},{path:"/mcp",name:"mcp",component:()=>We(()=>import("./McpView-Czjm3SHm.js"),__vite__mapDeps([9,1,8,6]))},{path:"/schedules",name:"schedules",component:()=>We(()=>import("./SchedulesView-DD_f5CP5.js"),__vite__mapDeps([10,1,8,6]))},{path:"/wiki",name:"wiki",component:()=>We(()=>import("./WikiView-BcQO6_oh.js"),__vite__mapDeps([11,1,2,8,6]))},{path:"/settings",name:"settings",component:()=>We(()=>import("./SettingsView-BXYd-jo1.js"),__vite__mapDeps([12,1]))}],Tc=mf({history:Gd(),routes:Mm});Tc.beforeEach(t=>{const e=kn();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function Hm(){await vm();const t=ed(Bm);t.use(sd()),t.use(Tc);const{useAuthStore:e}=await We(async()=>{const{useAuthStore:s}=await Promise.resolve().then(()=>_m);return{useAuthStore:s}},void 0);e().initAuthListener(),t.mount("#app")}Hm();export{qm as A,Sm as B,Em as C,Wr as D,nl as E,ut as F,Fm as G,Gm as H,km as I,Wm as J,Rm as P,Om as S,Pm as U,ze as a,Di as b,$e as c,gh as d,ei as e,jt as f,Nl as g,Ae as h,dn as i,cd as j,an as k,ki as l,Sr as m,hn as n,Pu as o,Bu as p,dl as q,Kr as r,Tc as s,Kn as t,Xe as u,kn as v,rc as w,yf as x,Vm as y,Km as z};
|