heyio 1.0.1 → 1.0.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/dist/api/server.js +7 -0
- package/package.json +1 -1
- package/web-dist/assets/{ChatView-EFFiln1H.js → ChatView-B9Jmzdk2.js} +1 -1
- package/web-dist/assets/{FeedView-bN4NMOL7.js → FeedView-CrQePc7Q.js} +1 -1
- package/web-dist/assets/{LoginView-CNtasq3n.js → LoginView-CRhhWTr8.js} +1 -1
- package/web-dist/assets/{McpView-C2CHiwsi.js → McpView-D4mCIH7x.js} +1 -1
- package/web-dist/assets/{SchedulesView-CyilLban.js → SchedulesView-4HPWN6_Z.js} +1 -1
- package/web-dist/assets/{SettingsView-1wLXKEF4.js → SettingsView-DGNy9gZw.js} +1 -1
- package/web-dist/assets/{SkillsView-BLsD-0u0.js → SkillsView-DCixj2zS.js} +1 -1
- package/web-dist/assets/{SquadDetailView-CsCw2ZLp.js → SquadDetailView-DfHZ-uwX.js} +1 -1
- package/web-dist/assets/{SquadsView-DQ3vFlyO.js → SquadsView-CNMI4rBM.js} +1 -1
- package/web-dist/assets/{WikiView-19M3oqnq.js → WikiView-DvoG-Zm8.js} +1 -1
- package/web-dist/assets/{api-WGvTsXaE.js → api-Bzs62QeP.js} +1 -1
- package/web-dist/assets/index-BxzKpjKp.js +138 -0
- package/web-dist/assets/{plus-BOvyX1BC.js → plus-C7dsO8j7.js} +1 -1
- package/web-dist/assets/{trash-2-DHoetkC4.js → trash-2-C15lVsPO.js} +1 -1
- package/web-dist/index.html +1 -1
- package/web-dist/assets/index-DZOS9syn.js +0 -95
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-B9Jmzdk2.js","assets/api-Bzs62QeP.js","assets/SquadsView-CNMI4rBM.js","assets/SquadDetailView-DfHZ-uwX.js","assets/FeedView-CrQePc7Q.js","assets/trash-2-C15lVsPO.js","assets/SkillsView-DCixj2zS.js","assets/plus-C7dsO8j7.js","assets/McpView-D4mCIH7x.js","assets/SchedulesView-4HPWN6_Z.js","assets/WikiView-DvoG-Zm8.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)}})();/**
|
|
3
|
+
* @vue/shared v3.5.34
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function wi(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const ne={},vr=[],pt=()=>{},Ea=()=>!1,Qs=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Zs=t=>t.startsWith("onUpdate:"),Ee=Object.assign,Si=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},kc=Object.prototype.hasOwnProperty,te=(t,e)=>kc.call(t,e),F=Array.isArray,_r=t=>ds(t)==="[object Map]",en=t=>ds(t)==="[object Set]",Ki=t=>ds(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",ka=t=>(re(t)||G(t))&&G(t.then)&&G(t.catch),Aa=Object.prototype.toString,ds=t=>Aa.call(t),Ac=t=>ds(t).slice(8,-1),Ta=t=>ds(t)==="[object Object]",tn=t=>ue(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Br=wi(",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)))},Tc=/-\w/g,Pe=rn(t=>t.replace(Tc,e=>e.slice(1).toUpperCase())),Rc=/\B([A-Z])/g,Ft=rn(t=>t.replace(Rc,"-$1").toLowerCase()),sn=rn(t=>t.charAt(0).toUpperCase()+t.slice(1)),kn=rn(t=>t?`on${sn(t)}`:""),ft=(t,e)=>!Object.is(t,e),Ps=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},Ra=(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 Wi;const on=()=>Wi||(Wi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ei(t){if(F(t)){const e={};for(let r=0;r<t.length;r++){const s=t[r],n=ue(s)?xc(s):Ei(s);if(n)for(const i in n)e[i]=n[i]}return e}else if(ue(t)||re(t))return t}const Oc=/;(?![^(]*\))/g,Cc=/:([^]+)/,Pc=/\/\*[^]*?\*\//g;function xc(t){const e={};return t.replace(Pc,"").split(Oc).forEach(r=>{if(r){const s=r.split(Cc);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function an(t){let e="";if(ue(t))e=t;else if(F(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 Ic="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",jc=wi(Ic);function Oa(t){return!!t||t===""}function Nc(t,e){if(t.length!==e.length)return!1;let r=!0;for(let s=0;r&&s<t.length;s++)r=fs(t[s],e[s]);return r}function fs(t,e){if(t===e)return!0;let r=Ki(t),s=Ki(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=F(t),s=F(e),r||s)return r&&s?Nc(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||!fs(t[o],e[o]))return!1}}return String(t)===String(e)}function $c(t,e){return t.findIndex(r=>fs(r,e))}const Ca=t=>!!(t&&t.__v_isRef===!0),Vn=t=>ue(t)?t:t==null?"":F(t)||re(t)&&(t.toString===Aa||!G(t.toString))?Ca(t)?Vn(t.value):JSON.stringify(t,Pa,2):String(t),Pa=(t,e)=>Ca(e)?Pa(t,e.value):_r(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[s,n],i)=>(r[An(s,i)+" =>"]=n,r),{})}:en(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>An(r))}:Ke(e)?An(e):re(e)&&!F(e)&&!Ta(e)?String(e):e,An=(t,e="")=>{var r;return Ke(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
|
|
7
|
+
* @vue/reactivity v3.5.34
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let ye;class xa{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 Ia(t){return new xa(t)}function ja(){return ye}function Lc(t,e=!1){ye&&ye.cleanups.push(t)}let ae;const Tn=new WeakSet;class Na{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,Tn.has(this)&&(Tn.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||La(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Gi(this),Da(this);const e=ae,r=Xe;ae=this,Xe=!0;try{return this.fn()}finally{Ua(this),ae=e,Xe=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ti(e);this.deps=this.depsTail=void 0,Gi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Tn.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Kn(this)&&this.run()}get dirty(){return Kn(this)}}let $a=0,Mr,Hr;function La(t,e=!1){if(t.flags|=8,e){t.next=Hr,Hr=t;return}t.next=Mr,Mr=t}function ki(){$a++}function Ai(){if(--$a>0)return;if(Hr){let e=Hr;for(Hr=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;Mr;){let e=Mr;for(Mr=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 Da(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ua(t){let e,r=t.depsTail,s=r;for(;s;){const n=s.prevDep;s.version===-1?(s===r&&(r=n),Ti(s),Dc(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&&(Ba(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ba(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Zr)||(t.globalVersion=Zr,!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{Da(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,Ua(t),t.flags&=-3}}function Ti(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)Ti(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Dc(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 Ma=[];function Rt(){Ma.push(Xe),Xe=!1}function Ot(){const t=Ma.pop();Xe=t===void 0?!0:t}function Gi(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ae;ae=void 0;try{e()}finally{ae=r}}}let Zr=0;class Uc{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 Ri{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 Uc(ae,this),ae.deps?(r.prevDep=ae.depsTail,ae.depsTail.nextDep=r,ae.depsTail=r):ae.deps=ae.depsTail=r,Ha(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++,Zr++,this.notify(e)}notify(e){ki();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{Ai()}}}function Ha(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)Ha(s)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const $s=new WeakMap,er=Symbol(""),Wn=Symbol(""),es=Symbol("");function ke(t,e,r){if(Xe&&ae){let s=$s.get(t);s||$s.set(t,s=new Map);let n=s.get(r);n||(s.set(r,n=new Ri),n.map=s,n.key=r),n.track()}}function kt(t,e,r,s,n,i){const o=$s.get(t);if(!o){Zr++;return}const a=l=>{l&&l.trigger()};if(ki(),e==="clear")o.forEach(a);else{const l=F(t),c=l&&tn(r);if(l&&r==="length"){const u=Number(s);o.forEach((h,d)=>{(d==="length"||d===es||!Ke(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(es)),e){case"add":l?c&&a(o.get("length")):(a(o.get(er)),_r(t)&&a(o.get(Wn)));break;case"delete":l||(a(o.get(er)),_r(t)&&a(o.get(Wn)));break;case"set":_r(t)&&a(o.get(er));break}}Ai()}function Bc(t,e){const r=$s.get(t);return r&&r.get(e)}function nr(t){const e=Q(t);return e===t?e:(ke(e,"iterate",es),He(t)?e:e.map(Qe))}function ln(t){return ke(t=Q(t),"iterate",es),t}function ct(t,e){return Ct(t)?kr(Tt(t)?Qe(e):e):Qe(e)}const Mc={__proto__:null,[Symbol.iterator](){return Rn(this,Symbol.iterator,t=>ct(this,t))},concat(...t){return nr(this).concat(...t.map(e=>F(e)?nr(e):e))},entries(){return Rn(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 On(this,"includes",t)},indexOf(...t){return On(this,"indexOf",t)},join(t){return nr(this).join(t)},lastIndexOf(...t){return On(this,"lastIndexOf",t)},map(t,e){return yt(this,"map",t,e,void 0,arguments)},pop(){return xr(this,"pop")},push(...t){return xr(this,"push",t)},reduce(t,...e){return zi(this,"reduce",t,e)},reduceRight(t,...e){return zi(this,"reduceRight",t,e)},shift(){return xr(this,"shift")},some(t,e){return yt(this,"some",t,e,void 0,arguments)},splice(...t){return xr(this,"splice",t)},toReversed(){return nr(this).toReversed()},toSorted(t){return nr(this).toSorted(t)},toSpliced(...t){return nr(this).toSpliced(...t)},unshift(...t){return xr(this,"unshift",t)},values(){return Rn(this,"values",t=>ct(this,t))}};function Rn(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 Hc=Array.prototype;function yt(t,e,r,s,n,i){const o=ln(t),a=o!==t&&!He(t),l=o[e];if(l!==Hc[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 zi(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 On(t,e,r){const s=Q(t);ke(s,"iterate",es);const n=s[e](...r);return(n===-1||n===!1)&&cn(r[0])?(r[0]=Q(r[0]),s[e](...r)):n}function xr(t,e,r=[]){Rt(),ki();const s=Q(t)[e].apply(t,r);return Ai(),Ot(),s}const Fc=wi("__proto__,__v_isRef,__isVue"),Fa=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ke));function qc(t){Ke(t)||(t=String(t));const e=Q(this);return ke(e,"has",t),e.hasOwnProperty(t)}class qa{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?Zc:Ga:i?Wa:Ka).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=F(e);if(!n){let l;if(o&&(l=Mc[r]))return l;if(r==="hasOwnProperty")return qc}const a=Reflect.get(e,r,fe(e)?e:s);if((Ke(r)?Fa.has(r):Fc(r))||(n||ke(e,"get",r),i))return a;if(fe(a)){const l=o&&tn(r)?a:a.value;return n&&re(l)?zn(l):l}return re(a)?n?zn(a):ps(a):a}}class Va extends qa{constructor(e=!1){super(!1,e)}set(e,r,s,n){let i=e[r];const o=F(e)&&tn(r);if(!this._isShallow){const c=Ct(i);if(!He(s)&&!Ct(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)||!Fa.has(r))&&ke(e,"has",r),s}ownKeys(e){return ke(e,"iterate",F(e)?"length":er),Reflect.ownKeys(e)}}class Vc extends qa{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Kc=new Va,Wc=new Vc,Gc=new Va(!0);const Gn=t=>t,vs=t=>Reflect.getPrototypeOf(t);function zc(t,e,r){return function(...s){const n=this.__v_raw,i=Q(n),o=_r(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...s),u=r?Gn:e?kr:Qe;return!e&&ke(i,"iterate",l?Wn:er),Ee(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 _s(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Jc(t,e){const r={get(n){const i=this.__v_raw,o=Q(i),a=Q(n);t||(ft(n,a)&&ke(o,"get",n),ke(o,"get",a));const{has:l}=vs(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&&ke(Q(n),"iterate",er),n.size},has(n){const i=this.__v_raw,o=Q(i),a=Q(n);return t||(ft(n,a)&&ke(o,"has",n),ke(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&&ke(l,"iterate",er),a.forEach((u,h)=>n.call(i,c(u),c(h),o))}};return Ee(r,t?{add:_s("add"),set:_s("set"),delete:_s("delete"),clear:_s("clear")}:{add(n){const i=Q(this),o=vs(i),a=Q(n),l=!e&&!He(n)&&!Ct(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)&&!Ct(i)&&(i=Q(i));const o=Q(this),{has:a,get:l}=vs(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}=vs(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]=zc(n,t,e)}),r}function Oi(t,e){const r=Jc(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 Yc={get:Oi(!1,!1)},Xc={get:Oi(!1,!0)},Qc={get:Oi(!0,!1)};const Ka=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,Zc=new WeakMap;function eu(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function tu(t){return t.__v_skip||!Object.isExtensible(t)?0:eu(Ac(t))}function ps(t){return Ct(t)?t:Ci(t,!1,Kc,Yc,Ka)}function za(t){return Ci(t,!1,Gc,Xc,Wa)}function zn(t){return Ci(t,!0,Wc,Qc,Ga)}function Ci(t,e,r,s,n){if(!re(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=tu(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 Ct(t)?Tt(t.__v_raw):!!(t&&t.__v_isReactive)}function Ct(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 Pi(t){return!te(t,"__v_skip")&&Object.isExtensible(t)&&Ra(t,"__v_skip",!0),t}const Qe=t=>re(t)?ps(t):t,kr=t=>re(t)?zn(t):t;function fe(t){return t?t.__v_isRef===!0:!1}function Fr(t){return Ja(t,!1)}function ru(t){return Ja(t,!0)}function Ja(t,e){return fe(t)?t:new su(t,e)}class su{constructor(e,r){this.dep=new Ri,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)||Ct(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 nu={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 Ya(t){return Tt(t)?t:new Proxy(t,nu)}function iu(t){const e=F(t)?new Array(t.length):{};for(const r in t)e[r]=au(t,r);return e}class ou{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(!F(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=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 Bc(this._raw,this._key)}}function au(t,e,r){return new ou(t,e,r)}class lu{constructor(e,r,s){this.fn=e,this.setter=r,this._value=void 0,this.dep=new Ri(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Zr-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 La(this,!0),!0}get value(){const e=this.dep.track();return Ba(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function cu(t,e,r=!1){let s,n;return G(t)?s=t:(s=t.get,n=t.set),new lu(s,n,r)}const bs={},Ls=new WeakMap;let Jt;function uu(t,e=!1,r=Jt){if(r){let s=Ls.get(r);s||Ls.set(r,s=[]),s.push(t)}}function hu(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):F(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){Rt();try{d()}finally{Ot()}}const O=Jt;Jt=u;try{return l?l(t,3,[f]):t(f)}finally{Jt=O}}:h=pt,e&&n){const O=h,B=n===!0?1/0:n;h=()=>At(O(),B)}const A=ja(),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(bs):bs;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=Jt;Jt=u;try{const q=[B,_===bs?void 0:v&&_[0]===bs?[]:_,f];_=B,l?l(e,3,q):e(...q)}finally{Jt=W}}}else u.run()};return a&&a(b),u=new Na(h),u.scheduler=o?()=>o(b,!1):b,f=O=>uu(O,!1,u),d=u.onStop=()=>{const O=Ls.get(u);if(O){if(l)l(O,4);else for(const B of O)B();Ls.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(F(t))for(let s=0;s<t.length;s++)At(t[s],e,r);else if(en(t)||_r(t))t.forEach(s=>{At(s,e,r)});else if(Ta(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
|
+
* @vue/runtime-core v3.5.34
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function gs(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=gs(t,e,r,s);return n&&ka(n)&&n.catch(i=>{un(i,e,r)}),n}if(F(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){Rt(),gs(i,null,10,[t,l,c]),Ot();return}}du(t,r,n,s,o)}function du(t,e,r,s=!0,n=!1){if(n)throw t;console.error(t)}const Ce=[];let at=-1;const br=[];let Dt=null,hr=0;const Xa=Promise.resolve();let Ds=null;function hn(t){const e=Ds||Xa;return t?e.then(this?t.bind(this):t):e}function fu(t){let e=at+1,r=Ce.length;for(;e<r;){const s=e+r>>>1,n=Ce[s],i=ts(n);i<t||i===t&&n.flags&2?e=s+1:r=s}return e}function xi(t){if(!(t.flags&1)){const e=ts(t),r=Ce[Ce.length-1];!r||!(t.flags&2)&&e>=ts(r)?Ce.push(t):Ce.splice(fu(e),0,t),t.flags|=1,Qa()}}function Qa(){Ds||(Ds=Xa.then(el))}function pu(t){F(t)?br.push(...t):Dt&&t.id===-1?Dt.splice(hr+1,0,t):t.flags&1||(br.push(t),t.flags|=1),Qa()}function Ji(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 Za(t){if(br.length){const e=[...new Set(br)].sort((r,s)=>ts(r)-ts(s));if(br.length=0,Dt){Dt.push(...e);return}for(Dt=e,hr=0;hr<Dt.length;hr++){const r=Dt[hr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}Dt=null,hr=0}}const ts=t=>t.id==null?t.flags&2?-1:1/0:t.id;function el(t){try{for(at=0;at<Ce.length;at++){const e=Ce[at];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),gs(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,Za(),Ds=null,(Ce.length||br.length)&&el()}}let Be=null,tl=null;function Us(t){const e=Be;return Be=t,tl=t&&t.type.__scopeId||null,e}function rl(t,e=Be,r){if(!e||t._n)return t;const s=(...n)=>{s._d&&Hs(-1);const i=Us(e);let o;try{o=t(...n)}finally{Us(i),s._d&&Hs(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Bm(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 Kt(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&&(Rt(),gt(l,r,8,[t.el,a,t,e]),Ot())}}function xs(t,e){if(Ae){let r=Ae.provides;const s=Ae.parent&&Ae.parent.provides;s===r&&(r=Ae.provides=Object.create(s)),r[t]=e}}function Ve(t,e,r=!1){const s=jl();if(s||tr){let n=tr?tr._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 gu(){return!!(jl()||tr)}const mu=Symbol.for("v-scx"),yu=()=>Ve(mu);function qr(t,e,r){return sl(t,e,r)}function sl(t,e,r=ne){const{immediate:s,deep:n,flush:i,once:o}=r,a=Ee({},r),l=e&&s||!e&&i!=="post";let c;if(ss){if(i==="sync"){const f=yu();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=pt,f.resume=pt,f.pause=pt,f}}const u=Ae;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():xi(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=hu(t,e,a);return ss&&(c?c.push(d):l&&d()),d}function vu(t,e,r){const s=this.proxy,n=ue(t)?t.includes(".")?nl(s,t):()=>s[t]:t.bind(s,s);let i;G(e)?i=e:(i=e.handler,r=e);const o=ms(this),a=sl(n,i.bind(s),r);return o(),a}function nl(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 _u=Symbol("_vte"),bu=t=>t.__isTeleport,wu=Symbol("_leaveCb");function Ii(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Ii(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)?Ee({name:t.name},e,{setup:t}):t}function il(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Yi(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Bs=new WeakMap;function Vr(t,e,r,s,n=!1){if(F(t)){t.forEach((v,A)=>Vr(v,e&&(F(e)?e[A]:e),r,s,n));return}if(Kr(s)&&!n){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Vr(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?Ea:v=>Yi(u,v)?!1:te(d,v),m=(v,A)=>!(A&&Yi(u,A));if(c!=null&&c!==l){if(Xi(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))gs(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)F(_)&&Si(_,i);else if(F(_))_.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(),Bs.delete(t)};_.id=-1,Bs.set(t,_),Ne(_,r)}else Xi(t),E()}}}function Xi(t){const e=Bs.get(t);e&&(e.flags|=8,Bs.delete(t))}on().requestIdleCallback;on().cancelIdleCallback;const Kr=t=>!!t.type.__asyncLoader,ol=t=>t.type.__isKeepAlive;function Su(t,e){al(t,"a",e)}function Eu(t,e){al(t,"da",e)}function al(t,e,r=Ae){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;)ol(n.parent.vnode)&&ku(s,e,r,n),n=n.parent}}function ku(t,e,r,s){const n=fn(e,t,s,!0);ll(()=>{Si(s[e],n)},r)}function fn(t,e,r=Ae,s=!1){if(r){const n=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Rt();const a=ms(r),l=gt(e,r,t,o);return a(),Ot(),l});return s?n.unshift(i):n.push(i),i}}const Pt=t=>(e,r=Ae)=>{(!ss||t==="sp")&&fn(t,(...s)=>e(...s),r)},Au=Pt("bm"),Tu=Pt("m"),Ru=Pt("bu"),Ou=Pt("u"),Cu=Pt("bum"),ll=Pt("um"),Pu=Pt("sp"),xu=Pt("rtg"),Iu=Pt("rtc");function ju(t,e=Ae){fn("ec",t,e)}const cl="components";function ul(t,e){return dl(cl,t,!0,e)||t}const hl=Symbol.for("v-ndc");function Nu(t){return ue(t)?dl(cl,t,!1)||t:t||hl}function dl(t,e,r=!0,s=!1){const n=Be||Ae;if(n){const i=n.type;{const a=bh(i,!1);if(a&&(a===e||a===Pe(e)||a===sn(Pe(e))))return i}const o=Qi(n[t]||i[t],e)||Qi(n.appContext[t],e);return!o&&s?i:o}}function Qi(t,e){return t&&(t[e]||t[Pe(e)]||t[sn(Pe(e))])}function $u(t,e,r,s){let n;const i=r,o=F(t);if(o||ue(t)){const a=o&&Tt(t);let l=!1,c=!1;a&&(l=!He(t),c=Ct(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(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?Nl(t)?mn(t):Jn(t.parent):null,Wr=Ee(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=>pl(t),$forceUpdate:t=>t.f||(t.f=()=>{xi(t.update)}),$nextTick:t=>t.n||(t.n=hn.bind(t.proxy)),$watch:t=>vu.bind(t)}),Cn=(t,e)=>t!==ne&&!t.__isScriptSetup&&te(t,e),Lu={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(Cn(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=Wr[e];let u,h;if(c)return e==="$attrs"&&ke(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 Cn(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)||Cn(e,a)||te(i,a)||te(s,a)||te(Wr,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 Zi(t){return F(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Yn=!0;function Du(t){const e=pl(t),r=t.proxy,s=t.ctx;Yn=!1,e.beforeCreate&&eo(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:qt}=e;if(c&&Uu(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=ps(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,Nt=!G(Z)&&G(Z.set)?Z.set.bind(r):pt,et=$e({get:mt,set:Nt});Object.defineProperty(s,z,{enumerable:!0,configurable:!0,get:()=>et.value,set:Ie=>et.value=Ie})}if(a)for(const z in a)fl(a[z],s,r,z);if(l){const z=G(l)?l.call(r):l;Reflect.ownKeys(z).forEach(Z=>{xs(Z,z[Z])})}u&&eo(u,t,"c");function le(z,Z){F(Z)?Z.forEach(mt=>z(mt.bind(r))):Z&&z(Z.bind(r))}if(le(Au,h),le(Tu,d),le(Ru,f),le(Ou,m),le(Su,v),le(Eu,A),le(ju,J),le(Iu,W),le(xu,q),le(Cu,_),le(ll,O),le(Pu,V),F(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&&il(t)}function Uu(t,e,r=pt){F(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 eo(t,e,r){gt(F(t)?t.map(s=>s.bind(e.proxy)):t.bind(e.proxy),e,r)}function fl(t,e,r,s){let n=s.includes(".")?nl(r,s):()=>r[s];if(ue(t)){const i=e[t];G(i)&&qr(n,i)}else if(G(t))qr(n,t.bind(r));else if(re(t))if(F(t))t.forEach(i=>fl(i,e,r,s));else{const i=G(t.handler)?t.handler.bind(r):e[t.handler];G(i)&&qr(n,i,t)}}function pl(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=>Ms(l,c,o,!0)),Ms(l,e,o)),re(e)&&i.set(e,l),l}function Ms(t,e,r,s=!1){const{mixins:n,extends:i}=e;i&&Ms(t,i,r,!0),n&&n.forEach(o=>Ms(t,o,r,!0));for(const o in e)if(!(s&&o==="expose")){const a=Bu[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Bu={data:to,props:ro,emits:ro,methods:$r,computed:$r,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:$r,directives:$r,watch:Hu,provide:to,inject:Mu};function to(t,e){return e?t?function(){return Ee(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function Mu(t,e){return $r(Xn(t),Xn(e))}function Xn(t){if(F(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 $r(t,e){return t?Ee(Object.create(null),t,e):e}function ro(t,e){return t?F(t)&&F(e)?[...new Set([...t,...e])]:Ee(Object.create(null),Zi(t),Zi(e??{})):e}function Hu(t,e){if(!t)return e;if(!e)return t;const r=Ee(Object.create(null),t);for(const s in e)r[s]=Re(t[s],e[s]);return r}function gl(){return{app:null,config:{isNativeTag:Ea,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 Fu=0;function qu(t,e){return function(s,n=null){G(s)||(s=Ee({},s)),n!=null&&!re(n)&&(n=null);const i=gl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Fu++,_component:s,_props:n,_container:null,_context:i,_instance:null,version:Sh,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||Se(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=tr;tr=c;try{return u()}finally{tr=h}}};return c}}let tr=null;const Vu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Pe(e)}Modifiers`]||t[`${Ft(e)}Modifiers`];function Ku(t,e,...r){if(t.isUnmounted)return;const s=t.vnode.props||ne;let n=r;const i=e.startsWith("update:"),o=i&&Vu(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=kn(e)]||s[a=kn(Pe(e))];!l&&i&&(l=s[a=kn(Ft(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 Wu=new WeakMap;function ml(t,e,r=!1){const s=r?Wu: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=ml(c,e,!0);u&&(a=!0,Ee(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):(F(i)?i.forEach(l=>o[l]=null):Ee(o,i),re(t)&&s.set(t,o),o)}function pn(t,e){return!t||!Qs(e)?!1:(e=e.slice(2).replace(/Once$/,""),te(t,e[0].toLowerCase()+e.slice(1))||te(t,Ft(e))||te(t,e))}function so(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=Us(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:Gu(a)}}catch(O){Gr.length=0,un(O,t,1),E=Se(Ht)}let b=E;if(_&&v!==!1){const O=Object.keys(_),{shapeFlag:B}=b;O.length&&B&7&&(i&&O.some(Zs)&&(_=zu(_,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&&Ii(b,r.transition),E=b,Us(A),E}const Gu=t=>{let e;for(const r in t)(r==="class"||r==="style"||Qs(r))&&((e||(e={}))[r]=t[r]);return e},zu=(t,e)=>{const r={};for(const s in t)(!Zs(s)||!(s.slice(9)in e))&&(r[s]=t[s]);return r};function Ju(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?no(s,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(yl(o,s,d)&&!pn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?no(s,o,c):!0:!!o;return!1}function no(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(yl(e,t,i)&&!pn(r,i))return!0}return!1}function yl(t,e,r){const s=t[r],n=e[r];return r==="style"&&re(s)&&re(n)?!fs(s,n):s!==n}function Yu({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 vl={},_l=()=>Object.create(vl),bl=t=>Object.getPrototypeOf(t)===vl;function Xu(t,e,r,s=!1){const n={},i=_l();t.propsDefaults=Object.create(null),wl(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);r?t.props=s?n:za(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function Qu(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]=Qn(l,a,m,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{wl(t,e,n,i)&&(c=!0);let u;for(const h in a)(!e||!te(e,h)&&((u=Ft(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 wl(t,e,r,s){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Br(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]=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=ms(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===Ft(r))&&(s=!0))}return s}const Zu=new WeakMap;function Sl(t,e,r=!1){const s=r?Zu: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]=Sl(h,e,!0);Ee(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,vr),vr;if(F(i))for(let u=0;u<i.length;u++){const h=Pe(i[u]);io(h)&&(o[h]=ne)}else if(i)for(const u in i){const h=Pe(u);if(io(h)){const d=i[u],f=o[h]=F(d)||G(d)?{type:d}:Ee({},d),m=f.type;let v=!1,A=!0;if(F(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 io(t){return t[0]!=="$"&&!Br(t)}const ji=t=>t==="_"||t==="_ctx"||t==="$stable",Ni=t=>F(t)?t.map(ht):[ht(t)],eh=(t,e,r)=>{if(e._n)return e;const s=rl((...n)=>Ni(e(...n)),r);return s._c=!1,s},El=(t,e,r)=>{const s=t._ctx;for(const n in t){if(ji(n))continue;const i=t[n];if(G(i))e[n]=eh(n,i,s);else if(i!=null){const o=Ni(i);e[n]=()=>o}}},kl=(t,e)=>{const r=Ni(e);t.slots.default=()=>r},Al=(t,e,r)=>{for(const s in e)(r||!ji(s))&&(t[s]=e[s])},th=(t,e,r)=>{const s=t.slots=_l();if(t.vnode.shapeFlag&32){const n=e._;n?(Al(s,e,r),r&&Ra(s,"_",n,!0)):El(e,s)}else e&&kl(t,e)},rh=(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:Al(n,e,r):(i=!e.$stable,El(e,n)),o=e}else e&&(kl(t,e),o={default:1});if(i)for(const a in n)!ji(a)&&o[a]==null&&delete n[a]},Ne=ah;function sh(t){return nh(t)}function nh(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&&!Ir(p,g)&&(w=k(p),Ie(p,T,S,!0),p=null),g.patchFlag===-2&&(C=!1,g.dynamicChildren=null);const{type:R,ref:M,shapeFlag:N}=g;switch(R){case gn:A(p,g,y,w);break;case Ht:E(p,g,y,w);break;case Is: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)}M!=null&&T?Vr(M,p&&p.ref,S,g||p,!g):M==null&&p&&p.ref!=null&&Vr(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:M,shapeFlag:N,transition:U,dirs:K}=p;if(C=p.el=o(p.type,S,M&&M.is,M),N&8?u(C,p.children):N&16&&J(p.children,C,null,w,T,Pn(p,S),I,P),K&&Kt(p,null,w,"created"),q(C,p,p.scopeId,I,w),M){for(const se in M)se!=="value"&&!Br(se)&&i(C,se,null,M[se],S,w);"value"in M&&i(C,"value",null,M.value,S),(R=M.onVnodeBeforeMount)&&nt(R,w,p)}K&&Kt(p,null,w,"beforeMount");const X=ih(T,U);X&&U.beforeEnter(C),s(C,g,y),((R=M&&M.onVnodeMounted)||X||K)&&Ne(()=>{try{R&&nt(R,w,p),X&&U.enter(C),K&&Kt(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||Cl(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 M=p[R]=P?Et(p[R]):ht(p[R]);v(null,M,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:M}=g;C|=p.patchFlag&16;const N=p.props||ne,U=g.props||ne;let K;if(y&&Wt(y,!1),(K=U.onVnodeBeforeUpdate)&&nt(K,y,g,p),M&&Kt(g,p,y,"beforeUpdate"),y&&Wt(y,!0),(N.innerHTML&&U.innerHTML==null||N.textContent&&U.textContent==null)&&u(P,""),R?ce(p.dynamicChildren,R,P,y,w,Pn(g,T),S):I||Z(p,g,P,null,y,w,Pn(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)||M)&&Ne(()=>{K&&nt(K,y,g,p),M&&Kt(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],M=C.el&&(C.type===ut||!Ir(C,R)||C.shapeFlag&198)?h(C.el):y;v(C,R,M,null,w,T,S,I,!0)}},Te=(p,g,y,w,T)=>{if(g!==y){if(g!==ne)for(const S in g)!Br(S)&&!(S in y)&&i(p,S,g[S],null,T,w);for(const S in y){if(Br(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(""),M=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(M,y,w),J(g.children||[],y,M,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)&&Tl(p,g,!0)):Z(p,g,y,M,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):qt(g,y,w,T,S,I,C):jt(p,g,C)},qt=(p,g,y,w,T,S,I)=>{const P=p.component=gh(p,w,T);if(ol(p)&&(P.ctx.renderer=D),mh(P,!1,I),P.asyncDep){if(T&&T.registerDep(P,le,I),!p.el){const C=P.subTree=Se(Ht);E(null,C,g,y),p.placeholder=C.el}}else le(P,p,g,y,T,S,I)},jt=(p,g,y)=>{const w=g.component=p.component;if(Ju(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=Rl(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;Wt(p,!1),N?(N.el=se.el,z(p,N,I)):N=se,U&&Ps(U),(pe=N.props&&N.props.onVnodeBeforeUpdate)&&nt(pe,X,N,se),Wt(p,!0);const _e=so(p),tt=p.subTree;p.subTree=_e,v(tt,_e,h(tt.el),k(tt),p,T,S),N.el=_e.el,ie===null&&Yu(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=Kr(g);Wt(p,!1),X&&Ps(X),!tt&&(N=K&&K.onVnodeBeforeMount)&&nt(N,ie,g),Wt(p,!0);{pe.ce&&pe.ce._hasShadowRoot()&&pe.ce._injectChildStyle(_e,p.parent?p.parent.type:void 0);const rt=p.subTree=so(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&&Kr(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 Na(P);p.scope.off();const R=p.update=C.run.bind(C),M=p.job=C.runIfDirty.bind(C);M.i=p,M.id=p.uid,C.scheduler=()=>xi(M),Wt(p,!0),R()},z=(p,g,y)=>{g.component=p;const w=p.vnode.props;p.vnode=g,p.next=null,Qu(p,g.props,w,y),rh(p,g.children,y),Rt(),Ji(p),Ot()},Z=(p,g,y,w,T,S,I,P,C=!1)=>{const R=p&&p.children,M=p?p.shapeFlag:0,N=g.children,{patchFlag:U,shapeFlag:K}=g;if(U>0){if(U&128){Nt(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?(M&16&&Fe(R,T,S),N!==R&&u(y,N)):M&16?K&16?Nt(R,N,y,w,T,S,I,P,C):Fe(R,T,S,!0):(M&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||vr,g=g||vr;const R=p.length,M=g.length,N=Math.min(R,M);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>M?Fe(p,T,S,!0,!1,N):J(g,y,w,T,S,I,P,C,N)},Nt=(p,g,y,w,T,S,I,P,C)=>{let R=0;const M=g.length;let N=p.length-1,U=M-1;for(;R<=N&&R<=U;){const K=p[R],X=g[R]=C?Et(g[R]):ht(g[R]);if(Ir(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(Ir(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<M?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 Pr=new Array(_e);for(R=0;R<_e;R++)Pr[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(Pr[ie-X]===0&&Ir(De,g[ie])){st=ie;break}st===void 0?Ie(De,T,S,!0):(Pr[st-X]=R+1,st>=rt?rt=st:tt=!0,v(De,g[st],y,null,T,S,I,P,C),pe++)}const Fi=tt?oh(Pr):vr;for(ie=Fi.length-1,R=_e-1;R>=0;R--){const De=X+R,st=g[De],qi=g[De+1],Vi=De+1<M?qi.el||Ol(qi):w;Pr[R]===0?v(null,st,y,Vi,T,S,I,P,C):tt&&(ie<0||R!==Fi[ie]?et(st,y,Vi,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===Is){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[wu](!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:M,patchFlag:N,dirs:U,cacheIndex:K,memo:X}=p;if(N===-2&&(T=!1),P!=null&&(Rt(),Vr(P,null,y,p,!0),Ot()),K!=null&&(g.renderCache[K]=void 0),M&256){g.ctx.deactivate(p);return}const se=M&1&&U,ie=!Kr(p);let pe;if(ie&&(pe=I&&I.onVnodeBeforeUnmount)&&nt(pe,g,p),M&6)Vt(p.component,y,w);else{if(M&128){p.suspense.unmount(y,w);return}se&&Kt(p,null,g,"beforeUnmount"),M&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&&M&16)&&Fe(C,g,y),w&&rr(p)}const _e=X!=null&&K==null;(ie&&(pe=I&&I.onVnodeUnmounted)||se||_e)&&Ne(()=>{pe&&nt(pe,g,p),se&&Kt(p,null,g,"unmounted"),_e&&(p.el=null)},y)},rr=p=>{const{type:g,el:y,anchor:w,transition:T}=p;if(g===ut){sr(y,w);return}if(g===Is){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()},sr=(p,g)=>{let y;for(;p!==g;)y=d(p),n(p),p=y;n(g)},Vt=(p,g,y)=>{const{bum:w,scope:T,job:S,subTree:I,um:P,m:C,a:R}=p;oo(C),oo(R),w&&Ps(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[_u];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,Ji(w),Za(),$=!1)},D={p:v,um:Ie,m:et,r:rr,mt:qt,mc:J,pc:Z,pbc:ce,n:k,o:t};return{render:j,hydrate:void 0,createApp:qu(j)}}function Pn({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 Wt({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function ih(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Tl(t,e,r=!1){const s=t.children,n=e.children;if(F(s)&&F(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&&Tl(o,a)),a.type===gn&&(a.patchFlag===-1&&(a=n[i]=Et(a)),a.el=o.el),a.type===Ht&&!a.el&&(a.el=o.el)}}function oh(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 Rl(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rl(e)}function oo(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Ol(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Ol(e.subTree):null}const Cl=t=>t.__isSuspense;function ah(t,e){e&&e.pendingBranch?F(t)?e.effects.push(...t):e.effects.push(t):pu(t)}const ut=Symbol.for("v-fgt"),gn=Symbol.for("v-txt"),Ht=Symbol.for("v-cmt"),Is=Symbol.for("v-stc"),Gr=[];let Me=null;function wr(t=!1){Gr.push(Me=t?null:[])}function lh(){Gr.pop(),Me=Gr[Gr.length-1]||null}let rs=1;function Hs(t,e=!1){rs+=t,t<0&&Me&&e&&(Me.hasOnce=!0)}function Pl(t){return t.dynamicChildren=rs>0?Me||vr:null,lh(),rs>0&&Me&&Me.push(t),t}function Zn(t,e,r,s,n,i){return Pl(Ge(t,e,r,s,n,i,!0))}function $i(t,e,r,s,n){return Pl(Se(t,e,r,s,n,!0))}function Fs(t){return t?t.__v_isVNode===!0:!1}function Ir(t,e){return t.type===e.type&&t.key===e.key}const xl=({key:t})=>t??null,js=({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&&xl(e),ref:e&&js(e),scopeId:tl,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?(Li(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=ue(r)?8:16),rs>0&&!o&&Me&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Me.push(l),l}const Se=ch;function ch(t,e=null,r=null,s=0,n=null,i=!1){if((!t||t===hl)&&(t=Ht),Fs(t)){const a=Ar(t,e,!0);return r&&Li(a,r),rs>0&&!i&&Me&&(a.shapeFlag&6?Me[Me.indexOf(t)]=a:Me.push(a)),a.patchFlag=-2,a}if(wh(t)&&(t=t.__vccOpts),e){e=uh(e);let{class:a,style:l}=e;a&&!ue(a)&&(e.class=an(a)),re(l)&&(cn(l)&&!F(l)&&(l=Ee({},l)),e.style=Ei(l))}const o=ue(t)?1:Cl(t)?128:bu(t)?64:re(t)?4:G(t)?2:0;return Ge(t,e,r,s,n,o,i,!0)}function uh(t){return t?cn(t)||bl(t)?Ee({},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?dh(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&xl(c),ref:e&&e.ref?r&&i?F(i)?i.concat(js(e)):[i,js(e)]:js(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&&Ii(u,l.clone(u)),u}function Il(t=" ",e=0){return Se(gn,null,t,e)}function Mm(t,e){const r=Se(Is,null,t);return r.staticCount=e,r}function hh(t="",e=!1){return e?(wr(),$i(Ht,null,t)):Se(Ht,null,t)}function ht(t){return t==null||typeof t=="boolean"?Se(Ht):F(t)?Se(ut,null,t.slice()):Fs(t)?Et(t):Se(gn,null,String(t))}function Et(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ar(t)}function Li(t,e){let r=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(F(e))r=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Li(t,n()),n._c&&(n._d=!0));return}else{r=32;const n=e._;!n&&!bl(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=[Il(e)]):r=8);t.children=e,t.shapeFlag|=r}function dh(...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=Ei([e.style,s.style]);else if(Qs(n)){const i=e[n],o=s[n];o&&i!==o&&!(F(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 fh=gl();let ph=0;function gh(t,e,r){const s=t.type,n=(e?e.appContext:t.appContext)||fh,i={uid:ph++,vnode:t,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new xa(!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:Sl(s,n),emitsOptions:ml(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=Ku.bind(null,i),t.ce&&t.ce(i),i}let Ae=null;const jl=()=>Ae||Be;let qs,ei;{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)}};qs=e("__VUE_INSTANCE_SETTERS__",r=>Ae=r),ei=e("__VUE_SSR_SETTERS__",r=>ss=r)}const ms=t=>{const e=Ae;return qs(t),t.scope.on(),()=>{t.scope.off(),qs(e)}},ao=()=>{Ae&&Ae.scope.off(),qs(null)};function Nl(t){return t.vnode.shapeFlag&4}let ss=!1;function mh(t,e=!1,r=!1){e&&ei(e);const{props:s,children:n}=t.vnode,i=Nl(t);Xu(t,s,i,e),th(t,n,r||e);const o=i?yh(t,e):void 0;return e&&ei(!1),o}function yh(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Lu);const{setup:s}=r;if(s){Rt();const n=t.setupContext=s.length>1?_h(t):null,i=ms(t),o=gs(s,t,0,[t.props,n]),a=ka(o);if(Ot(),i(),(a||t.sp)&&!Kr(t)&&il(t),a){if(o.then(ao,ao),e)return o.then(l=>{lo(t,l)}).catch(l=>{un(l,t,0)});t.asyncDep=o}else lo(t,o)}else $l(t)}function lo(t,e,r){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:re(e)&&(t.setupState=Ya(e)),$l(t)}function $l(t,e,r){const s=t.type;t.render||(t.render=s.render||pt);{const n=ms(t);Rt();try{Du(t)}finally{Ot(),n()}}}const vh={get(t,e){return ke(t,"get",""),t[e]}};function _h(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,vh),slots:t.slots,emit:t.emit,expose:e}}function mn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Ya(Pi(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in Wr)return Wr[r](t)},has(e,r){return r in e||r in Wr}})):t.proxy}function bh(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function wh(t){return G(t)&&"__vccOpts"in t}const $e=(t,e)=>cu(t,e,ss);function ns(t,e,r){try{Hs(-1);const s=arguments.length;return s===2?re(e)&&!F(e)?Fs(e)?Se(t,null,[e]):Se(t,e):Se(t,null,e):(s>3?r=Array.prototype.slice.call(arguments,2):s===3&&Fs(r)&&(r=[r]),Se(t,e,r))}finally{Hs(1)}}const Sh="3.5.34";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.34
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let ti;const co=typeof window<"u"&&window.trustedTypes;if(co)try{ti=co.createPolicy("vue",{createHTML:t=>t})}catch{}const Ll=ti?t=>ti.createHTML(t):t=>t,Eh="http://www.w3.org/2000/svg",kh="http://www.w3.org/1998/Math/MathML",bt=typeof document<"u"?document:null,uo=bt&&bt.createElement("template"),Ah={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(Eh,t):e==="mathml"?bt.createElementNS(kh,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{uo.innerHTML=Ll(s==="svg"?`<svg>${t}</svg>`:s==="mathml"?`<math>${t}</math>`:t);const a=uo.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]}},Th=Symbol("_vtc");function Rh(t,e,r){const s=t[Th];s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const ho=Symbol("_vod"),Oh=Symbol("_vsh"),Ch=Symbol(""),Ph=/(?:^|;)\s*display\s*:/;function xh(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&&Lr(s,a,"")}else for(const o in e)r[o]==null&&Lr(s,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?jh(t,o,!ue(e)&&e?e[o]:void 0,a)||Lr(s,o,a):Lr(s,o,"")}}else if(n){if(e!==r){const o=s[Ch];o&&(r+=";"+o),s.cssText=r,i=Ph.test(r)}}else e&&t.removeAttribute("style");ho in t&&(t[ho]=i?s.display:"",t[Oh]&&(s.display="none"))}const fo=/\s*!important$/;function Lr(t,e,r){if(F(r))r.forEach(s=>Lr(t,e,s));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const s=Ih(t,e);fo.test(r)?t.setProperty(Ft(s),r.replace(fo,""),"important"):t[s]=r}}const po=["Webkit","Moz","ms"],xn={};function Ih(t,e){const r=xn[e];if(r)return r;let s=Pe(e);if(s!=="filter"&&s in t)return xn[e]=s;s=sn(s);for(let n=0;n<po.length;n++){const i=po[n]+s;if(i in t)return xn[e]=i}return e}function jh(t,e,r,s){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&ue(s)&&r===s}const go="http://www.w3.org/1999/xlink";function mo(t,e,r,s,n,i=jc(e)){s&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(go,e.slice(6,e.length)):t.setAttributeNS(go,e,r):r==null||i&&!Oa(r)?t.removeAttribute(e):t.setAttribute(e,i?"":Ke(r)?String(r):r)}function yo(t,e,r,s,n){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?Ll(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=Oa(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 Xt(t,e,r,s){t.addEventListener(e,r,s)}function Nh(t,e,r,s){t.removeEventListener(e,r,s)}const vo=Symbol("_vei");function $h(t,e,r,s,n=null){const i=t[vo]||(t[vo]={}),o=i[e];if(s&&o)o.value=s;else{const[a,l]=Lh(e);if(s){const c=i[e]=Bh(s,n);Xt(t,a,c,l)}else o&&(Nh(t,a,o,l),i[e]=void 0)}}const _o=/(?:Once|Passive|Capture)$/;function Lh(t){let e;if(_o.test(t)){e={};let s;for(;s=t.match(_o);)t=t.slice(0,t.length-s[0].length),e[s[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Ft(t.slice(2)),e]}let In=0;const Dh=Promise.resolve(),Uh=()=>In||(Dh.then(()=>In=0),In=Date.now());function Bh(t,e){const r=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=r.attached)return;gt(Mh(s,r.value),e,5,[s])};return r.value=t,r.attached=Uh(),r}function Mh(t,e){if(F(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 bo=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Hh=(t,e,r,s,n,i)=>{const o=n==="svg";e==="class"?Rh(t,s,o):e==="style"?xh(t,r,s):Qs(e)?Zs(e)||$h(t,e,r,s,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Fh(t,e,s,o))?(yo(t,e,s),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&mo(t,e,s,o,i,e!=="value")):t._isVueCE&&(qh(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!ue(s)))?yo(t,Pe(e),s,i,e):(e==="true-value"?t._trueValue=s:e==="false-value"&&(t._falseValue=s),mo(t,e,s,o))};function Fh(t,e,r,s){if(s)return!!(e==="innerHTML"||e==="textContent"||e in t&&bo(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 bo(e)&&ue(r)?!1:e in t}function qh(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 Vs=t=>{const e=t.props["onUpdate:modelValue"]||!1;return F(e)?r=>Ps(e,r):e};function Vh(t){t.target.composing=!0}function wo(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Sr=Symbol("_assign");function So(t,e,r){return e&&(t=t.trim()),r&&(t=nn(t)),t}const Hm={created(t,{modifiers:{lazy:e,trim:r,number:s}},n){t[Sr]=Vs(n);const i=s||n.props&&n.props.type==="number";Xt(t,e?"change":"input",o=>{o.target.composing||t[Sr](So(t.value,r,i))}),(r||i)&&Xt(t,"change",()=>{t.value=So(t.value,r,i)}),e||(Xt(t,"compositionstart",Vh),Xt(t,"compositionend",wo),Xt(t,"change",wo))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:s,trim:n,number:i}},o){if(t[Sr]=Vs(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)}},Fm={deep:!0,created(t,{value:e,modifiers:{number:r}},s){const n=en(e);Xt(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?nn(Ks(o)):Ks(o));t[Sr](t.multiple?n?new Set(i):i:i[0]),t._assigning=!0,hn(()=>{t._assigning=!1})}),t[Sr]=Vs(s)},mounted(t,{value:e}){Eo(t,e)},beforeUpdate(t,e,r){t[Sr]=Vs(r)},updated(t,{value:e}){t._assigning||Eo(t,e)}};function Eo(t,e){const r=t.multiple,s=F(e);if(!(r&&!s&&!en(e))){for(let n=0,i=t.options.length;n<i;n++){const o=t.options[n],a=Ks(o);if(r)if(s){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=$c(e,a)>-1}else o.selected=e.has(a);else if(fs(Ks(o),e)){t.selectedIndex!==n&&(t.selectedIndex=n);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Ks(t){return"_value"in t?t._value:t.value}const Kh=["ctrl","shift","alt","meta"],Wh={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)=>Kh.some(r=>t[`${r}Key`]&&!e.includes(r))},qm=(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=Wh[e[o]];if(a&&a(n,e))return}return t(n,...i)}))},Gh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Vm=(t,e)=>{const r=t._withKeys||(t._withKeys={}),s=e.join(".");return r[s]||(r[s]=(n=>{if(!("key"in n))return;const i=Ft(n.key);if(e.some(o=>o===i||Gh[o]===i))return t(n)}))},zh=Ee({patchProp:Hh},Ah);let ko;function Jh(){return ko||(ko=sh(zh))}const Yh=((...t)=>{const e=Jh().createApp(...t),{mount:r}=e;return e.mount=s=>{const n=Qh(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,Xh(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function Xh(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Qh(t){return ue(t)?document.querySelector(t):t}/*!
|
|
19
|
+
* pinia v3.0.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/let Dl;const yn=t=>Dl=t,Ul=Symbol();function ri(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var zr;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(zr||(zr={}));function Zh(){const t=Ia(!0),e=t.run(()=>Fr({}));let r=[],s=[];const n=Pi({install(i){yn(n),n._a=i,i.provide(Ul,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 Bl=()=>{};function Ao(t,e,r,s=Bl){t.add(e);const n=()=>{t.delete(e)&&s()};return!r&&ja()&&Lc(n),n}function ir(t,...e){t.forEach(r=>{r(...e)})}const ed=t=>t(),To=Symbol(),jn=Symbol();function si(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];ri(n)&&ri(s)&&t.hasOwnProperty(r)&&!fe(s)&&!Tt(s)?t[r]=si(n,s):t[r]=s}return t}const td=Symbol();function rd(t){return!ri(t)||!Object.prototype.hasOwnProperty.call(t,td)}const{assign:Lt}=Object;function sd(t){return!!(fe(t)&&t.effect)}function nd(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=iu(r.state.value[t]);return Lt(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=Pi($e(()=>{yn(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=Ml(t,c,e,r,s,!0),l}function Ml(t,e,r={},s,n,i){let o;const a=Lt({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:zr.patchFunction,storeId:t,events:f}):(si(s.state.value[t],J),V={type:zr.patchObject,payload:J,storeId:t,events:f});const ce=v=Symbol();hn().then(()=>{v===ce&&(c=!0)}),u=!0,ir(h,V,s.state.value[t])}const E=i?function(){const{state:V}=r,ce=V?V():{};this.$patch(Te=>{Lt(Te,ce)})}:Bl;function _(){o.stop(),h.clear(),d.clear(),s._s.delete(t)}const b=(J,V="")=>{if(To in J)return J[jn]=V,J;const ce=function(){yn(s);const Te=Array.from(arguments),Le=new Set,xe=new Set;function qt(z){Le.add(z)}function jt(z){xe.add(z)}ir(d,{args:Te,name:ce[jn],store:B,after:qt,onError:jt});let le;try{le=J.apply(this&&this.$id===t?this:B,Te)}catch(z){throw ir(xe,z),z}return le instanceof Promise?le.then(z=>(ir(Le,z),z)).catch(z=>(ir(xe,z),Promise.reject(z))):(ir(Le,le),le)};return ce[To]=!0,ce[jn]=V,ce},O={_p:s,$id:t,$onAction:Ao.bind(null,d),$patch:A,$reset:E,$subscribe(J,V={}){const ce=Ao(h,J,V.detached,()=>Te()),Te=o.run(()=>qr(()=>s.state.value[t],Le=>{(V.flush==="sync"?u:c)&&J({storeId:t,type:zr.direct,events:f},Le)},Lt({},l,V)));return ce},$dispose:_},B=ps(O);s._s.set(t,B);const q=(s._a&&s._a.runWithContext||ed)(()=>s._e.run(()=>(o=Ia()).run(()=>e({action:b}))));for(const J in q){const V=q[J];if(fe(V)&&!sd(V)||Tt(V))i||(m&&rd(V)&&(fe(V)?V.value=m[J]:si(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 Lt(B,q),Lt(Q(B),q),Object.defineProperty(B,"$state",{get:()=>s.state.value[t],set:J=>{A(V=>{Lt(V,J)})}}),s._p.forEach(J=>{Lt(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 id(t,e,r){let s;const n=typeof e=="function";s=n?r:e;function i(o,a){const l=gu();return o=o||(l?Ve(Ul,null):null),o&&yn(o),o=Dl,o._s.has(t)||(n?Ml(t,e,s,o):nd(t,s,o)),o._s.get(t)}return i.$id=t,i}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/const dr=typeof document<"u";function Hl(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function od(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Hl(t.default)}const ee=Object.assign;function Nn(t,e){const r={};for(const s in e){const n=e[s];r[s]=Ze(n)?n.map(t):t(n)}return r}const Jr=()=>{},Ze=Array.isArray;function Ro(t,e){const r={};for(const s in t)r[s]=s in e?e[s]:t[s];return r}const Fl=/#/g,ad=/&/g,ld=/\//g,cd=/=/g,ud=/\?/g,ql=/\+/g,hd=/%5B/g,dd=/%5D/g,Vl=/%5E/g,fd=/%60/g,Kl=/%7B/g,pd=/%7C/g,Wl=/%7D/g,gd=/%20/g;function Di(t){return t==null?"":encodeURI(""+t).replace(pd,"|").replace(hd,"[").replace(dd,"]")}function md(t){return Di(t).replace(Kl,"{").replace(Wl,"}").replace(Vl,"^")}function ni(t){return Di(t).replace(ql,"%2B").replace(gd,"+").replace(Fl,"%23").replace(ad,"%26").replace(fd,"`").replace(Kl,"{").replace(Wl,"}").replace(Vl,"^")}function yd(t){return ni(t).replace(cd,"%3D")}function vd(t){return Di(t).replace(Fl,"%23").replace(ud,"%3F")}function _d(t){return vd(t).replace(ld,"%2F")}function is(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const bd=/\/$/,wd=t=>t.replace(bd,"");function $n(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=Ad(s??e,r),{fullPath:s+i+o,path:s,query:n,hash:is(o)}}function Sd(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Oo(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Ed(t,e,r){const s=e.matched.length-1,n=r.matched.length-1;return s>-1&&s===n&&Tr(e.matched[s],r.matched[n])&&Gl(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function Tr(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Gl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!kd(t[r],e[r]))return!1;return!0}function kd(t,e){return Ze(t)?Co(t,e):Ze(e)?Co(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Co(t,e){return Ze(e)?t.length===e.length&&t.every((r,s)=>r===e[s]):t.length===1&&t[0]===e}function Ad(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 $t={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let ii=(function(t){return t.pop="pop",t.push="push",t})({}),Ln=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function Td(t){if(!t)if(dr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),wd(t)}const Rd=/^[^#]+#/;function Od(t,e){return t.replace(Rd,"#")+e}function Cd(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 Pd(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=Cd(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 Po(t,e){return(history.state?history.state.position-e:-1)+t}const oi=new Map;function xd(t,e){oi.set(t,e)}function Id(t){const e=oi.get(t);return oi.delete(t),e}function jd(t){return typeof t=="string"||t&&typeof t=="object"}function zl(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 Jl=Symbol("");he.MATCHER_NOT_FOUND+"",he.NAVIGATION_GUARD_REDIRECT+"",he.NAVIGATION_ABORTED+"",he.NAVIGATION_CANCELLED+"",he.NAVIGATION_DUPLICATED+"";function Rr(t,e){return ee(new Error,{type:t,[Jl]:!0},e)}function vt(t,e){return t instanceof Error&&Jl in t&&(e==null||!!(t.type&e))}const Nd=["params","query","hash"];function $d(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of Nd)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Ld(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(ql," "),i=n.indexOf("="),o=is(i<0?n:n.slice(0,i)),a=i<0?null:is(n.slice(i+1));if(o in e){let l=e[o];Ze(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function xo(t){let e="";for(let r in t){const s=t[r];if(r=yd(r),s==null){s!==void 0&&(e+=(e.length?"&":"")+r);continue}(Ze(s)?s.map(n=>n&&ni(n)):[s&&ni(s)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+r,n!=null&&(e+="="+n))})}return e}function Dd(t){const e={};for(const r in t){const s=t[r];s!==void 0&&(e[r]=Ze(s)?s.map(n=>n==null?null:""+n):s==null?s:""+s)}return e}const Ud=Symbol(""),Io=Symbol(""),_n=Symbol(""),Ui=Symbol(""),ai=Symbol("");function jr(){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 Ut(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(Rr(he.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):jd(d)?l(Rr(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 Dn(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(Hl(l)){const c=(l.__vccOpts||l)[e];c&&i.push(Ut(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=od(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&Ut(d,r,s,o,a,n)()}))}}return i}function Bd(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=>Tr(c,a))?s.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>Tr(c,l))||n.push(l))}return[r,s,n]}/*!
|
|
27
|
+
* vue-router v4.6.4
|
|
28
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
29
|
+
* @license MIT
|
|
30
|
+
*/let Md=()=>location.protocol+"//"+location.host;function Yl(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),Oo(a,"")}return Oo(r,t)+s+n}function Hd(t,e,r,s){let n=[],i=[],o=null;const a=({state:d})=>{const f=Yl(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: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 jo(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 Fd(t){const{history:e,location:r}=window,s={value:Yl(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:Md()+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,jo(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({},jo(s.value,l,null),{position:u.position+1},c),!1),s.value=l}return{location:s,state:n,push:a,replace:o}}function qd(t){t=Td(t);const e=Fd(t),r=Hd(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:Od.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 Qt=(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 Vd={type:Qt.Static,value:""},Kd=/[a-zA-Z0-9_]/;function Wd(t){if(!t)return[[]];if(t==="/")return[[Vd]];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:Qt.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:Qt.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:Kd.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 No="[^/]+?",Gd={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 zd=/[.+*?^${}()[\]/\\]/g;function Jd(t,e){const r=ee({},Gd,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===Qt.Static)h||(n+="/"),n+=d.value.replace(zd,"\\$&"),f+=Oe.Static;else if(d.type===Qt.Param){const{value:m,repeatable:v,optional:A,regexp:E}=d;i.push({name:m,repeatable:v,optional:A});const _=E||No;if(_!==No){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===Qt.Static)u+=f.value;else if(f.type===Qt.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 Yd(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 Xl(t,e){let r=0;const s=t.score,n=e.score;for(;r<s.length&&r<n.length;){const i=Yd(s[r],n[r]);if(i)return i;r++}if(Math.abs(n.length-s.length)===1){if($o(s))return 1;if($o(n))return-1}return n.length-s.length}function $o(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Xd={strict:!1,end:!0,sensitive:!1};function Qd(t,e,r){const s=Jd(Wd(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 Zd(t,e){const r=[],s=new Map;e=Ro(Xd,e);function n(h){return s.get(h)}function i(h,d,f){const m=!f,v=Do(h);v.aliasOf=f&&f.record;const A=Ro(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(Do(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(_=Qd(O,d,A),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),m&&h.name&&!Uo(_)&&o(h.name)),Ql(_)&&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)}:Jr}function o(h){if(zl(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=rf(h,r);r.splice(d,0,h),h.record.name&&!Uo(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 Rr(he.MATCHER_NOT_FOUND,{location:h});A=f.record.name,m=ee(Lo(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Lo(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 Rr(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:tf(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 Lo(t,e){const r={};for(const s of e)s in t&&(r[s]=t[s]);return r}function Do(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:ef(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 ef(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 Uo(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function tf(t){return t.reduce((e,r)=>ee(e,r.meta),{})}function rf(t,e){let r=0,s=e.length;for(;r!==s;){const i=r+s>>1;Xl(t,e[i])<0?s=i:r=i+1}const n=sf(t);return n&&(s=e.lastIndexOf(n,s-1)),s}function sf(t){let e=t;for(;e=e.parent;)if(Ql(e)&&Xl(t,e)===0)return e}function Ql({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Bo(t){const e=Ve(_n),r=Ve(Ui),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(Tr.bind(null,u));if(d>-1)return d;const f=Mo(l[c-2]);return c>1&&Mo(u)===f&&h[h.length-1].path!==f?h.findIndex(Tr.bind(null,l[c-2])):d}),i=$e(()=>n.value>-1&&cf(r.params,s.value.params)),o=$e(()=>n.value>-1&&n.value===r.matched.length-1&&Gl(r.params,s.value.params));function a(l={}){if(lf(l)){const c=e[Ye(t.replace)?"replace":"push"](Ye(t.to)).catch(Jr);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 nf(t){return t.length===1?t[0]:t}const of=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:Bo,setup(t,{slots:e}){const r=ps(Bo(t)),{options:s}=Ve(_n),n=$e(()=>({[Ho(t.activeClass,s.linkActiveClass,"router-link-active")]:r.isActive,[Ho(t.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&nf(e.default(r));return t.custom?i:ns("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:n.value},i)}}}),af=of;function lf(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 cf(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 Mo(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ho=(t,e,r)=>t??e??r,uf=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(ai),n=$e(()=>t.route||s.value),i=Ve(Io,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]);xs(Io,$e(()=>o.value+1)),xs(Ud,a),xs(ai,n);const l=Fr();return qr(()=>[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||!Tr(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 Fo(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=ns(d,ee({},m,e,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Fo(r.default,{Component:A,route:c})||A}}});function Fo(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const hf=uf;function df(t){const e=Zd(t.routes,t),r=t.parseQuery||Ld,s=t.stringifyQuery||xo,n=t.history,i=jr(),o=jr(),a=jr(),l=ru($t);let c=$t;dr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Nn.bind(null,k=>""+k),h=Nn.bind(null,_d),d=Nn.bind(null,is);function f(k,$){let j,D;return zl(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:is(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=Sd(s,ee({},k,{hash:md(Y),path:D.path})),g=n.createHref(p);return ee({fullPath:p,hash:Y,query:s===xo?Dd(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 Rr(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&&Ed(s,D,j)&&(T=Rr(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:Nt(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 $=sr.values().next().value;return $&&typeof $.runWithContext=="function"?$.runWithContext(k):k()}function ce(k,$){let j;const[D,Y,p]=Bd(k,$);j=Dn(D.reverse(),"beforeRouteLeave",k,$);for(const y of D)y.leaveGuards.forEach(w=>{j.push(Ut(w,k,$))});const g=J.bind(null,k,$);return j.push(g),Fe(j).then(()=>{j=[];for(const y of i.list())j.push(Ut(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(Ut(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(Ut(w,k,$));else j.push(Ut(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(Ut(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=$===$t,y=dr?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),Nt()}let xe;function qt(){xe||(xe=n.listen((k,$,j)=>{if(!Vt.listening)return;const D=E(k),Y=W(D,Vt.currentRoute.value);if(Y){q(ee(Y,{replace:!0,force:!0}),D).catch(Jr);return}c=D;const p=l.value;dr&&xd(Po(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===ii.pop&&n.go(-1,!1)}).catch(Jr),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(Jr)}))}let jt=jr(),le=jr(),z;function Z(k,$,j){Nt(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!==$t?Promise.resolve():new Promise((k,$)=>{jt.add([k,$])})}function Nt(k){return z||(z=!k,qt(),jt.list().forEach(([$,j])=>k?j(k):$()),jt.reset()),k}function et(k,$,j,D){const{scrollBehavior:Y}=t;if(!dr||!Y)return Promise.resolve();const p=!j&&Id(Po(k.fullPath,0))||(D||!j)&&history.state&&history.state.scroll||null;return hn().then(()=>Y(k,$,p)).then(g=>g&&Pd(g)).catch(g=>Z(g,k,$))}const Ie=k=>n.go(k);let rr;const sr=new Set,Vt={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",af),k.component("RouterView",hf),k.config.globalProperties.$router=Vt,Object.defineProperty(k.config.globalProperties,"$route",{enumerable:!0,get:()=>Ye(l)}),dr&&!rr&&l.value===$t&&(rr=!0,O(n.location).catch(D=>{}));const $={};for(const D in $t)Object.defineProperty($,D,{get:()=>l.value[D],enumerable:!0});k.provide(_n,Vt),k.provide(Ui,za($)),k.provide(ai,l);const j=k.unmount;sr.add(k),k.unmount=function(){sr.delete(k),sr.size<1&&(c=$t,xe&&xe(),xe=null,l.value=$t,rr=!1,z=!1),j()}}};function Fe(k){return k.reduce(($,j)=>$.then(()=>V(j)),Promise.resolve())}return Vt}function ff(){return Ve(_n)}function Zl(t){return Ve(Ui)}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 pf(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 gf=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Bi 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 mf extends Bi{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class qo extends Bi{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Vo extends Bi{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 yf{constructor(e,{headers:r={},customFetch:s,region:n=li.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=gf(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return pf(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 mf(B)}),_=E.headers.get("x-relay-error");if(_&&_==="true")throw new qo(E);if(!E.ok)throw new Vo(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 Vo||a instanceof qo?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const ec=3,Ko=t=>Math.min(1e3*2**t,3e4),vf=[520,503],tc=["GET","HEAD","OPTIONS"];var _f=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 Wo(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 bf(t,e,r,s){return!(!s||r>=ec||!tc.includes(t)||!vf.includes(e))}var wf=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"||!tc.includes(r.method))throw h;if(r.retryEnabled&&o<ec){const d=Ko(o);o++,await Wo(d,r.signal);continue}throw h}if(bf(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:Ko(o);await u.text(),o++,await Wo(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
|
+
|
|
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 _f(r)}return{success:r===null,error:r,data:s,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Sf=class extends wf{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 Go=new RegExp("[,()]");var fr=class extends Sf{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"&&Go.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"&&Go.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}},Ef=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 fr({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 fr({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 fr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const s="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new fr({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 fr({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 os(t){"@babel/helpers - typeof";return os=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},os(t)}function kf(t,e){if(os(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(os(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Af(t){var e=kf(t,"string");return os(e)=="symbol"?e:e+""}function Tf(t,e,r){return(e=Af(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zo(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 ws(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zo(Object(r),!0).forEach(function(s){Tf(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zo(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var Rf=class rc{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,ws(ws({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,ws(ws({},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 Ef(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 rc(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 fr({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 Of{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
|
+
import ws from "ws"
|
|
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
|
+
|
|
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 Cf="2.106.2",Pf=`realtime-js/${Cf}`,xf="1.0.0",sc="2.0.0",If=sc,jf=1e4,Nf=100,Bt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},nc={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ci={connecting:"connecting",closing:"closing",closed:"closed"};class $f{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 Jo=(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]=Lf(o,t,e,n),i),{}):{}},Lf=(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)?ic(i,o):ui(o)},ic=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Mf(e,r)}switch(t){case oe.bool:return Df(e);case oe.float4:case oe.float8:case oe.int2:case oe.int4:case oe.int8:case oe.numeric:case oe.oid:return Uf(e);case oe.json:case oe.jsonb:return Bf(e);case oe.timestamp:return Hf(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,Df=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Uf=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Bf=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Mf=(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=>ic(e,a))}return t},Hf=t=>typeof t=="string"?t.replace(" ","T"):t,oc=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 Yr=t=>typeof t=="function"?t:function(){return t},Ff=typeof self<"u"?self:null,pr=typeof window<"u"?window:null,lt=Ff||pr||globalThis,qf="2.0.0",Vf=1e4,Kf=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"},Wf={complete:4},di="base64url.bearer.phx.",Ss=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})}},ac=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))}},Gf=class{constructor(t,e,r){this.state=je.closed,this.topic=t,this.params=Yr(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ss(this,wt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new ac(()=>{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 Ss(this,wt.leave,Yr({}),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 Ss(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 Ss(this,wt.leave,Yr({}),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===Wf.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)}`}},zf=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)},or=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=zf(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)}},Jf=class Dr{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=Dr.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Dr.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=Dr.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 Dr.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))}},Es={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}}},Yf=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Vf,this.transport=e.transport||lt.WebSocket||or,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=Es.encode.bind(Es),this.defaultDecoder=Es.decode.bind(Es),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!==or?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;pr&&pr.addEventListener&&(pr.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),s=this.connectClock)}),pr.addEventListener("pageshow",n=>{s===this.connectClock&&(s=null,this.connect())}),pr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=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=Yr(e.params||{}),this.endPoint=`${t}/${hi.websocket}`,this.vsn=e.vsn||qf,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ac(()=>{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 or}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=Yr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==or?this.connectWithFallback(or,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 or: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(),Kf,"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 Gf(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 Xr{constructor(e,r){const s=Qf(r);this.presence=new Jf(e.getChannel(),s),this.presence.onJoin((n,i,o)=>{const a=Xr.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=Xr.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Xr.transformState(this.presence.state)}static transformState(e){return e=Xf(e),Object.getOwnPropertyNames(e).reduce((r,s)=>{const n=e[s];return r[s]=Ns(n),r},{})}static onJoinPayload(e,r,s){const n=Yo(r),i=Ns(s);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,r,s){const n=Yo(r),i=Ns(s);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Ns(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Xf(t){return JSON.parse(JSON.stringify(t))}function Qf(t){return(t==null?void 0:t.events)&&{events:t.events}}function Yo(t){return t!=null&&t.metas?Ns(t):[]}var Xo;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Xo||(Xo={}));class Zf{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Xr(this.channel.channelAdapter,r)}}function ep(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 tp{constructor(e,r,s){const n=rp(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>Nf){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===Bt.joined}isJoined(){return this.state===Bt.joined}isJoining(){return this.state===Bt.joining}isClosed(){return this.state===Bt.closed}isLeaving(){return this.state===Bt.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function rp(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var Qo;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Qo||(Qo={}));var yr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(yr||(yr={}));var St;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(St||(St={}));class Qr{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 tp(this.socket.socketAdapter,e,this.params),this.presence=new Zf(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=oc(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[yr.PRESENCE]&&this.bindings[yr.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,ep(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=Bt.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&&Qr.isFilterValueEqual(f.schema,u)&&Qr.isFilterValueEqual(f.table,h)&&Qr.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=Bt.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!=Bt.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===yr.PRESENCE||e===yr.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}=nc;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=Jo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Jo(e.columns,e.old_record)),r}}class sp{constructor(e,r){this.socket=new Yf(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 Zo={HEARTBEAT_INTERVAL:25e3},np=[1e3,2e3,5e3,1e4],ip=1e4;function op(){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 ap(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return op()}const lp=`
|
|
39
|
+
addEventListener("message", (e) => {
|
|
40
|
+
if (e.data.event === "start") {
|
|
41
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
42
|
+
}
|
|
43
|
+
});`;class cp{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 $f,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 sp(e,n),this.httpEndpoint=oc(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
|
+
|
|
45
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
46
|
+
|
|
47
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
48
|
+
Option 2: Install and provide the "ws" package:
|
|
49
|
+
|
|
50
|
+
npm install ws
|
|
51
|
+
|
|
52
|
+
import ws from "ws"
|
|
53
|
+
const client = new RealtimeClient(url, {
|
|
54
|
+
...options,
|
|
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 Qr(`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:Pf};r&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(nc.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([lp],{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:jf,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:Zo.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:Zo.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Of.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:ap(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>np[_-1]||ip);let v,A;const E=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:If;switch(E){case xf:v=(_,b)=>b(JSON.stringify(_)),A=(_,b)=>b(JSON.parse(_));break;case sc: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 as=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 up(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 hp(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 dp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:n,body:i,headers:o}){const a=up(t.baseUrl,s,n),l=await hp(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 as((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 ks(t){return t.join("")}var fp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:ks(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/${ks(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ks(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ks(t.namespace)}`}),!0}catch(e){if(e instanceof as&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof as&&r.status===409)return;throw r}}};function ar(t){return t.join("")}var pp=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/${ar(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/${ar(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/${ar(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/${ar(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/${ar(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/${ar(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof as&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof as&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},gp=class{constructor(t){var s;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=dp({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(s=t.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new fp(this.client,e),this.tableOps=new pp(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 ls(t){"@babel/helpers - typeof";return ls=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},ls(t)}function mp(t,e){if(ls(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(ls(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yp(t){var e=mp(t,"string");return ls(e)=="symbol"?e:e+""}function vp(t,e,r){return(e=yp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ea(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 H(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ea(Object(r),!0).forEach(function(s){vp(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ea(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 fi=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 H({},super.toJSON())}},lc=class extends wn{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Gs(t,e,r){const s=H({},t),n=e.toLowerCase();for(const i of Object.keys(s))i.toLowerCase()===n&&delete s[i];return s[n]=r,s}function _p(t){const e={};for(const[r,s]of Object.entries(t))e[r.toLowerCase()]=s;return e}const bp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),wp=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},Sp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),ta=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)},Ep=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(ta(o),i,a,s))}).catch(()=>{const o=i+"";e(new fi(n.statusText||`HTTP ${i} error`,i,o,s))})}else e(new lc(ta(t),t,s))},kp=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!s)return H(H({},n),r);if(wp(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),H(H({},n),r)};async function Nr(t,e,r,s,n,i,o){return new Promise((a,l)=>{t(r,kp(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=>Ep(c,l,s,o))})}function cc(t="storage"){return{get:async(e,r,s,n)=>Nr(e,"GET",r,s,n,void 0,t),post:async(e,r,s,n,i)=>Nr(e,"POST",r,n,i,s,t),put:async(e,r,s,n,i)=>Nr(e,"PUT",r,n,i,s,t),head:async(e,r,s,n)=>Nr(e,"HEAD",r,H(H({},s),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,r,s,n,i)=>Nr(e,"DELETE",r,n,i,s,t)}}const Ap=cc("storage"),{get:cs,post:ze,put:gi,head:Tp,remove:Mi}=Ap,Ue=cc("vectors");var Cr=class{constructor(t,e={},r,s="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=_p(e),this.fetch=bp(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(Sn(r))return{data:null,error:r};throw r}}};let uc;uc=Symbol.toStringTag;var Rp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[uc]="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 hc;hc=Symbol.toStringTag;var Op=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[hc]="BlobDownloadBuilder",this.promise=null}asStream(){return new Rp(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 Cp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ra={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Pp=class extends Cr{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=H(H({},ra),s);let a=H(H({},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,H({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=H(H({},ra),s);let u=H(H({},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,H({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=H({},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 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 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}`,H({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=>H(H({},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=()=>cs(this.fetch,`${this.url}/${s}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Op(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>pi(await cs(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Tp(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 fi?n.status:n instanceof lc?(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 Mi(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=H(H(H({},Cp),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=H({},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 xp="2.106.2",ys={"X-Client-Info":`storage-js/${xp}`};var Ip=class extends Cr{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=H(H({},ys),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await cs(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await cs(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 Mi(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():""}},jp=class extends Cr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=H(H({},ys),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 cs(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Mi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Sp(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 gp({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}}}}})}},Np=class extends Cr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=H(H({},ys),{},{"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})||{})}},$p=class extends Cr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=H(H({},ys),{},{"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})||{})}},Lp=class extends Cr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=H(H({},ys),{},{"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})||{})}},Dp=class extends Lp{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Up(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)}},Up=class extends Np{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,H(H({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,H(H({},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 Bp(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Bp=class extends $p{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,H(H({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,H(H({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,H(H({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,H(H({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,H(H({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Mp=class extends Ip{constructor(t,e={},r,s){super(t,e,r,s)}from(t){return new Pp(this.url,this.headers,t,this.fetch)}get vectors(){return new Dp(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new jp(this.url+"/iceberg",this.headers,this.fetch)}};const dc="2.106.2",gr=30*1e3,mi=3,Un=mi*gr,Hp="http://localhost:9999",Fp="supabase.auth.token",qp={"X-Client-Info":`gotrue-js/${dc}`},yi="X-Supabase-Api-Version",fc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Vp=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Kp=600*1e3;class Or 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 Wp extends Or{constructor(e,r,s){super(e,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Gp(t){return x(t)&&t.name==="AuthApiError"}class Je extends Or{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class xt extends Or{constructor(e,r,s,n){super(e,s,n),this.name=r,this.status=s}}class ve extends xt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function As(t){return x(t)&&t.name==="AuthSessionMissingError"}class lr extends xt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ts extends xt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Rs extends xt{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 zp(t){return x(t)&&t.name==="AuthImplicitGrantRedirectError"}class sa extends xt{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 Jp extends xt{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 xt{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Bn(t){return x(t)&&t.name==="AuthRetryableFetchError"}class na extends xt{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 xt{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const zs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ia=`
|
|
57
|
+
\r=`.split(""),Yp=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ia.length;e+=1)t[ia[e].charCodeAt(0)]=-2;for(let e=0;e<zs.length;e+=1)t[zs[e].charCodeAt(0)]=e;return t})();function oa(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 pc(t,e,r){const s=Yp[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 aa(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Zp(o,s,r)};for(let o=0;o<t.length;o+=1)pc(t.charCodeAt(o),n,i);return e.join("")}function Xp(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 Qp(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}Xp(s,e)}}function Zp(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)pc(t.charCodeAt(n),r,s);return new Uint8Array(e)}function eg(t){const e=[];return Qp(t,r=>e.push(r)),new Uint8Array(e)}function Zt(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};return t.forEach(n=>oa(n,r,s)),oa(null,r,s),e.join("")}function tg(t){return Math.round(Date.now()/1e3)+t}function rg(){return Symbol("auth-callback")}const we=()=>typeof window<"u"&&typeof document<"u",Gt={tested:!1,writable:!1},gc=()=>{if(!we())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Gt.tested)return Gt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Gt.tested=!0,Gt.writable=!0}catch{Gt.tested=!0,Gt.writable=!1}return Gt.writable};function sg(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 mc=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ng=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",mr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},zt=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 Os(t){const e=t.split(".");if(e.length!==3)throw new _i("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!Vp.test(e[s]))throw new _i("JWT not in base64url format");return{header:JSON.parse(aa(e[0])),payload:JSON.parse(aa(e[1])),signature:Er(e[2]),raw:{header:e[0],payload:e[1]}}}async function ig(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function og(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 ag(t){return("0"+t.toString(16)).substr(-2)}function lg(){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,ag).join("")}async function cg(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 ug(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 cg(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function cr(t,e,r=!1){const s=lg();let n=s;r&&(n+="/recovery"),await mr(t,`${e}-code-verifier`,n);const i=await ug(s);return[i,s===i?"plain":"s256"]}const hg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function dg(t){const e=t.headers.get(yi);if(!e||!e.match(hg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function fg(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 pg(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 gg=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function _t(t){if(!gg.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 mg(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 la(t){return JSON.parse(JSON.stringify(t))}const Yt=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)},yg=[502,503,504,520,521,522,523,524,530];async function ca(t){var e;if(!ng(t))throw new vi(Yt(t),0);if(yg.includes(t.status))throw new vi(Yt(t),t.status);let r;try{r=await t.json()}catch(i){throw new Je(Yt(i),i)}let s;const n=dg(t);if(n&&n.getTime()>=fc["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 na(Yt(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 na(Yt(r),t.status,r.weak_password.reasons);throw new Wp(Yt(r),t.status||500,s)}const vg=(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]=fc["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 _g(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 _g(t,e,r,s,n,i){const o=vg(e,s,n,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new vi(Yt(l),0)}if(a.ok||await ca(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(l){await ca(l)}}function qe(t){var e;let r=null;Sg(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=tg(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 ua(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 Mt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function bg(t){return{data:t,error:null}}function wg(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 ha(t){return t}function Sg(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Hn=["global","local","others"];class Eg{_encodePathSegment(e){if(e==="."||e==="..")throw new Or("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:s,experimental:n}){this.url=e,this.headers=r,this.fetch=mc(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:Mt})}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:wg,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:Mt})}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:ha});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:Mt})}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:Mt})}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:Mt})}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:ha});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 da(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const it={debug:!!(globalThis&&gc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class yc extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class fa extends yc{}async function kg(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 fa(`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 fa(`Lock "${t}" was released because another request stole it`)}throw i}}function Ag(){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 vc(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Tg(t){return parseInt(t,16)}function Rg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function Og(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
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=vc(t.address),m=u?`${u}://${s}`:s,v=t.statement?`${t.statement}
|
|
59
|
+
`:"",A=`${m} wants you to sign in with your Ethereum account:
|
|
60
|
+
${f}
|
|
61
|
+
|
|
62
|
+
${v}`;let E=`URI: ${h}
|
|
63
|
+
Version: ${d}
|
|
64
|
+
Chain ID: ${r}${o?`
|
|
65
|
+
Nonce: ${o}`:""}
|
|
66
|
+
Issued At: ${i.toISOString()}`;if(n&&(E+=`
|
|
67
|
+
Expiration Time: ${n.toISOString()}`),a&&(E+=`
|
|
68
|
+
Not Before: ${a.toISOString()}`),l&&(E+=`
|
|
69
|
+
Request ID: ${l}`),c){let _=`
|
|
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
|
+
- ${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 Cg({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(_c(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 Pg({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(_c(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 xg{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 xg;function pa(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 ga(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 ma(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:Zt(new Uint8Array(t.response.attestationObject)),clientDataJSON:Zt(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ya(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:Zt(new Uint8Array(n.authenticatorData)),clientDataJSON:Zt(new Uint8Array(n.clientDataJSON)),signature:Zt(new Uint8Array(n.signature)),userHandle:n.userHandle?Zt(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _c(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 bc(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:Cg({error:e,options:t})}}}async function wc(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:Pg({error:e,options:t})}}}const Ig={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},jg={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 Ng(t,e){return Xs(Ig,t,e||{})}function $g(t,e){return Xs(jg,t,e||{})}class Lg{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=Ng(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await bc({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=$g(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await wc(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 Or("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 Or("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)}}}}Ag();const Dg={url:Hp,storageKey:Fp,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:qp,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function va(t,e,r){return await r()}const ur={};class us{get jwks(){var e,r;return(r=(e=ur[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){ur[this.storageKey]=Object.assign(Object.assign({},ur[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=ur[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ur[this.storageKey]=Object.assign(Object.assign({},ur[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({},Dg),e);if(this.storageKey=o.storageKey,this.instanceID=(r=us.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,us.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 Eg({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=mc(o.fetch),this.lock=o.lock||va,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=kg:this.lock=va,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 Lg(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:gc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=da(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=da(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} (${dc}) ${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=sg(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),zp(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 cr(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 Ts("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:ua})}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:ua})}else throw new Ts("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 lr;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=vc(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=Tg(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=Og(J),m=await b.request({method:"personal_sign",params:[Rg(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 lr;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:Zt(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 lr;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 zt(this.storage,`${this.storageKey}-code-verifier`),[s,n]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new Jp;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 lr;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 lr;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 cr(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 Ts("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 cr(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:bg});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 Ts("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 zt(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 zt(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=mg(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:Mt}):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:Mt})})}catch(r){if(x(r))return As(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 cr(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:Mt});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}=Os(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 Rs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Rs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new sa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Rs("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new sa("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 Rs("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<=gr&&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 zt(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&&!As(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&&!(Gp(a)&&(a.status===404||a.status===401||a.status===403)||As(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=rg(),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),As(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let s=null,n=null;this.flowType==="pkce"&&([s,n]=await cr(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 lr}):(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 og(async n=>(n>0&&await ig(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<gr})}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 zt(this.storage,this.storageKey);if(n&&this.userStorage){let o=await zt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await mr(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 zt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await be(this.storage,this.storageKey+"-user"),await mr(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 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 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 mr(this.userStorage,this.storageKey+"-user",{user:r.user});const n=Object.assign({},r);delete n.user;const i=la(n);await mr(this.storage,this.storageKey,i)}else{const n=la(r);await mr(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(),gr);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)/gr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${gr}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 yc)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 cr(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"?ma(e.webauthn.credential_response):ya(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:pa(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:ga(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}=Os(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}=Os(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+Kp>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}}=Os(s);r!=null&&r.allowExpired||fg(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=pg(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,eg(`${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=ga(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 wc({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Je("WebAuthn ceremony failed",null)});const h=ya(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=pa(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 bc({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new Je("WebAuthn ceremony failed",null)});const u=ma(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}}}us.nextInstanceID={};const Ug=us,Bg="2.106.2";let Ur="";typeof Deno<"u"?Ur="deno":typeof document<"u"?Ur="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ur="react-native":Ur="node";const Mg={"X-Client-Info":`supabase-js-${Ur}/${Bg}`},Hg={headers:Mg},Fg={schema:"public"},qg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Vg={},Kg={enabled:!1,respectSamplingDecision:!0};function Wg(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 Gg="@opentelemetry/api";function zg(){return Fn===null&&(Fn=import(Gg).catch(()=>null)),Fn}function Jg(){return Wg(this,void 0,void 0,function*(){try{const t=yield zg();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 Yg(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 Xg(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(Qg(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 Qg(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 Zg(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 hs(t){"@babel/helpers - typeof";return hs=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},hs(t)}function em(t,e){if(hs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(hs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tm(t){var e=em(t,"string");return hs(e)=="symbol"?e:e+""}function rm(t,e,r){return(e=tm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _a(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?_a(Object(r),!0).forEach(function(s){rm(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_a(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}const sm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),nm=()=>Headers,im=(t,e,r,s,n)=>{const i=sm(s),o=nm(),a=(n==null?void 0:n.enabled)===!0,l=(n==null?void 0:n.respectSamplingDecision)!==!1,c=a?Zg(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 om(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 om(t,e,r){if(!Xg(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const s=await Jg();if(!s||!s.traceparent)return null;if(r){const n=Yg(s.traceparent);if(n&&!n.isSampled)return null}return s}function ba(t){return typeof t=="boolean"?{enabled:t}:t}function am(t){return t.endsWith("/")?t:t+"/"}function lm(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=ba(t.tracePropagation),E=ba(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 cm(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(am(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var um=class extends Ug{constructor(t){super(t)}},hm=class{constructor(t,e,r){var s,n;this.supabaseUrl=t,this.supabaseKey=e;const i=cm(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:Fg,realtime:Vg,auth:de(de({},qg),{},{storageKey:o}),global:Hg,tracePropagation:Kg},l=lm(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=im(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 Rf(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 Mp(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new yf(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 um({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 cp(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 dm=(t,e,r)=>new hm(t,e,r);function fm(){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}fm()&&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 Sc=null,wa=!1;async function pm(){if(!wa){wa=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Sc=dm(e,r))}catch{}}}function qn(){return Sc}const Hi=id("auth",()=>{const t=Fr(localStorage.getItem("io_token")),e=Fr(localStorage.getItem("io_email")),r=Fr(!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}});/**
|
|
74
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the ISC license.
|
|
77
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/const gm=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
79
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
80
|
+
*
|
|
81
|
+
* This source code is licensed under the ISC license.
|
|
82
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
+
*/var Cs={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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/const mm=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:s,iconNode:n,name:i,class:o,...a},{slots:l})=>ns("svg",{...Cs,width:t||Cs.width,height:t||Cs.height,stroke:s||Cs.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${gm(i??"icon")}`],...a},[...n.map(c=>ns(...c)),...l.default?[l.default()]:[]]);/**
|
|
89
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/const It=(t,e)=>(r,{slots:s})=>ns(mm,{...r,iconNode:e,name:t},s);/**
|
|
94
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/const ym=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/const vm=It("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
104
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const _m=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const bm=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const wm=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const Sm=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const Em=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const km=It("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
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/const Am=It("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"}]]),Tm={class:"w-64 border-r border-border bg-card flex flex-col h-full shrink-0"},Rm={class:"flex-1 p-2 space-y-1 overflow-y-auto"},Om={class:"p-3 border-t border-border"},Cm={class:"flex items-center justify-between"},Pm={class:"text-xs text-muted-foreground truncate"},xm=dn({__name:"AppSidebar",setup(t){const e=Zl(),r=ff(),s=Hi(),n=[{name:"Chat",icon:wm,path:"/"},{name:"Squads",icon:Am,path:"/squads"},{name:"Feed",icon:_m,path:"/feed"},{name:"Skills",icon:Sm,path:"/skills"},{name:"MCP Servers",icon:Em,path:"/mcp"},{name:"Schedules",icon:vm,path:"/schedules"},{name:"Wiki",icon:ym,path:"/wiki"},{name:"Settings",icon:km,path:"/settings"}];async function i(){await s.logout(),r.push("/login")}return(o,a)=>{const l=ul("router-link");return wr(),Zn("aside",Tm,[a[0]||(a[0]=Ge("div",{class:"p-4 border-b border-border"},[Ge("h1",{class:"text-xl font-bold tracking-tight"},"🤖 IO"),Ge("p",{class:"text-xs text-muted-foreground mt-1"},"Personal AI Assistant")],-1)),Ge("nav",Rm,[(wr(),Zn(ut,null,$u(n,c=>Se(l,{key:c.path,to:c.path,class:an(["flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",[Ye(e).path===c.path||c.path!=="/"&&Ye(e).path.startsWith(c.path)?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground"]])},{default:rl(()=>[(wr(),$i(Nu(c.icon),{class:"w-4 h-4"})),Il(" "+Vn(c.name),1)]),_:2},1032,["to","class"])),64))]),Ge("div",Om,[Ge("div",Cm,[Ge("span",Pm,Vn(Ye(s).email),1),Ge("button",{onClick:i,class:"p-1.5 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[Se(Ye(bm),{class:"w-4 h-4"})])])])])}}}),Im={class:"flex h-screen overflow-hidden"},jm={class:"flex-1 overflow-auto"},Nm=dn({__name:"App",setup(t){const e=Hi(),r=Zl(),s=$e(()=>e.isAuthenticated&&r.name!=="login");return(n,i)=>{const o=ul("router-view");return wr(),Zn("div",Im,[s.value?(wr(),$i(xm,{key:0})):hh("",!0),Ge("main",jm,[Se(o)])])}}}),$m="modulepreload",Lm=function(t){return"/"+t},Sa={},ot=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=Lm(c),c in Sa)return;Sa[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":$m,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)})},Dm=[{path:"/login",name:"login",component:()=>ot(()=>import("./LoginView-CRhhWTr8.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>ot(()=>import("./ChatView-B9Jmzdk2.js"),__vite__mapDeps([0,1]))},{path:"/squads",name:"squads",component:()=>ot(()=>import("./SquadsView-CNMI4rBM.js"),__vite__mapDeps([2,1]))},{path:"/squads/:id",name:"squad-detail",component:()=>ot(()=>import("./SquadDetailView-DfHZ-uwX.js"),__vite__mapDeps([3,1]))},{path:"/feed",name:"feed",component:()=>ot(()=>import("./FeedView-CrQePc7Q.js"),__vite__mapDeps([4,1,5]))},{path:"/skills",name:"skills",component:()=>ot(()=>import("./SkillsView-DCixj2zS.js"),__vite__mapDeps([6,1,7,5]))},{path:"/mcp",name:"mcp",component:()=>ot(()=>import("./McpView-D4mCIH7x.js"),__vite__mapDeps([8,1,7,5]))},{path:"/schedules",name:"schedules",component:()=>ot(()=>import("./SchedulesView-4HPWN6_Z.js"),__vite__mapDeps([9,1,7,5]))},{path:"/wiki",name:"wiki",component:()=>ot(()=>import("./WikiView-DvoG-Zm8.js"),__vite__mapDeps([10,1,5]))},{path:"/settings",name:"settings",component:()=>ot(()=>import("./SettingsView-DGNy9gZw.js"),[])}],Ec=df({history:qd(),routes:Dm});Ec.beforeEach(t=>{const e=Hi();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function Um(){await pm();const t=Yh(Nm);t.use(Zh()),t.use(Ec),t.mount("#app")}Um();export{Vm as A,ym as B,vm as C,qm as D,ut as F,_m as I,Sm as P,Em as S,Am as U,$i as a,hh as b,Ge as c,Zn as d,It as e,Mm as f,Il as g,Se as h,dn as i,id as j,an as k,wr as l,$u as m,hn as n,Tu as o,ul as p,Hi as q,Fr as r,Zl as s,Vn as t,Ye as u,ff as v,Fm as w,Hm as x,rl as y,Bm as z};
|