heyio 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-dist/assets/AgentActivityView-9D_RDmmt.js +1 -0
- package/web-dist/assets/ChatView-5ySvKPi9.js +4 -0
- package/web-dist/assets/FeedView-BDaNijfW.js +1 -0
- package/web-dist/assets/InboxView-DKP-ahnW.js +1 -0
- package/web-dist/assets/LoginView-BHp6tqp8.js +1 -0
- package/web-dist/assets/McpView-CWYN7lRW.js +1 -0
- package/web-dist/assets/SchedulesView-BpcU8RrX.js +1 -0
- package/web-dist/assets/SettingsTabs.vue_vue_type_script_setup_true_lang-CYIbgQ2F.js +1 -0
- package/web-dist/assets/SkillsView-BHoQKBHu.js +1 -0
- package/web-dist/assets/SquadsView-Bg--LUPA.js +1 -0
- package/web-dist/assets/StatusIndicator.vue_vue_type_script_setup_true_lang-BpggUfx8.js +1 -0
- package/web-dist/assets/WikiView-CqfWT-Hg.js +1 -0
- package/web-dist/assets/index-Cilo_iXJ.js +81 -0
- package/web-dist/assets/index-VErxBQJ_.css +10 -0
- package/web-dist/index.html +4 -4
- package/web-dist/assets/AgentActivityView-Cp2AGg_k.js +0 -1
- package/web-dist/assets/ChatView-DqdUHOl_.js +0 -4
- package/web-dist/assets/FeedView-DH9WLqhr.js +0 -1
- package/web-dist/assets/InboxView-D90afpiV.js +0 -1
- package/web-dist/assets/LoginView-Bb_buJKq.js +0 -1
- package/web-dist/assets/McpView-jWdO4DNx.js +0 -2
- package/web-dist/assets/SchedulesView-CAlROQw9.js +0 -1
- package/web-dist/assets/SkillsView-BbYlyzi8.js +0 -1
- package/web-dist/assets/SquadsView-BSumqJUP.js +0 -1
- package/web-dist/assets/WikiView-B5l50ReV.js +0 -3
- package/web-dist/assets/index-CngfLq9l.js +0 -80
- package/web-dist/assets/index-D3JETrwn.css +0 -10
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
|
|
2
|
-
* @vue/shared v3.5.34
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/function ro(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const ye={},Fn=[],Nt=()=>{},Tl=()=>!1,$s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),js=e=>e.startsWith("onUpdate:"),je=Object.assign,so=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ch=Object.prototype.hasOwnProperty,ge=(e,t)=>ch.call(e,t),Q=Array.isArray,Kn=e=>Wr(e)==="[object Map]",Zn=e=>Wr(e)==="[object Set]",$o=e=>Wr(e)==="[object Date]",ie=e=>typeof e=="function",Ee=e=>typeof e=="string",ut=e=>typeof e=="symbol",me=e=>e!==null&&typeof e=="object",Rl=e=>(me(e)||ie(e))&&ie(e.then)&&ie(e.catch),xl=Object.prototype.toString,Wr=e=>xl.call(e),uh=e=>Wr(e).slice(8,-1),Ol=e=>Wr(e)==="[object Object]",Ds=e=>Ee(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,fr=ro(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ms=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},hh=/-\w/g,gt=Ms(e=>e.replace(hh,t=>t.slice(1).toUpperCase())),dh=/\B([A-Z])/g,an=Ms(e=>e.replace(dh,"-$1").toLowerCase()),Cl=Ms(e=>e.charAt(0).toUpperCase()+e.slice(1)),ri=Ms(e=>e?`on${Cl(e)}`:""),Ct=(e,t)=>!Object.is(e,t),hs=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Nl=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Us=e=>{const t=parseFloat(e);return isNaN(t)?e:t},fh=e=>{const t=Ee(e)?Number(e):NaN;return isNaN(t)?e:t};let jo;const Bs=()=>jo||(jo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function io(e){if(Q(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Ee(r)?bh(r):io(r);if(s)for(const i in s)t[i]=s[i]}return t}else if(Ee(e)||me(e))return e}const ph=/;(?![^(]*\))/g,gh=/:([^]+)/,mh=/\/\*[^]*?\*\//g;function bh(e){const t={};return e.replace(mh,"").split(ph).forEach(n=>{if(n){const r=n.split(gh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Ft(e){let t="";if(Ee(e))t=e;else if(Q(e))for(let n=0;n<e.length;n++){const r=Ft(e[n]);r&&(t+=r+" ")}else if(me(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const yh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",_h=ro(yh);function Il(e){return!!e||e===""}function vh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Xn(e[r],t[r]);return n}function Xn(e,t){if(e===t)return!0;let n=$o(e),r=$o(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ut(e),r=ut(t),n||r)return e===t;if(n=Q(e),r=Q(t),n||r)return n&&r?vh(e,t):!1;if(n=me(e),r=me(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,i=Object.keys(t).length;if(s!==i)return!1;for(const o in e){const a=e.hasOwnProperty(o),l=t.hasOwnProperty(o);if(a&&!l||!a&&l||!Xn(e[o],t[o]))return!1}}return String(e)===String(t)}function oo(e,t){return e.findIndex(n=>Xn(n,t))}const Pl=e=>!!(e&&e.__v_isRef===!0),we=e=>Ee(e)?e:e==null?"":Q(e)||me(e)&&(e.toString===xl||!ie(e.toString))?Pl(e)?we(e.value):JSON.stringify(e,Ll,2):String(e),Ll=(e,t)=>Pl(t)?Ll(e,t.value):Kn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],i)=>(n[si(r,i)+" =>"]=s,n),{})}:Zn(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>si(n))}:ut(t)?si(t):me(t)&&!Q(t)&&!Ol(t)?String(t):t,si=(e,t="")=>{var n;return ut(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
6
|
-
* @vue/reactivity v3.5.34
|
|
7
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
-
* @license MIT
|
|
9
|
-
**/let $e;class $l{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&$e&&($e.active?(this.parent=$e,this.index=($e.scopes||($e.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=$e;try{return $e=this,t()}finally{$e=n}}}on(){++this._on===1&&(this.prevScope=$e,$e=this)}off(){if(this._on>0&&--this._on===0){if($e===this)$e=this.prevScope;else{let t=$e;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function jl(e){return new $l(e)}function Dl(){return $e}function wh(e,t=!1){$e&&$e.cleanups.push(e)}let ve;const ii=new WeakSet;class Ml{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,$e&&($e.active?$e.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ii.has(this)&&(ii.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Bl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Do(this),Hl(this);const t=ve,n=mt;ve=this,mt=!0;try{return this.fn()}finally{Fl(this),ve=t,mt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)co(t);this.deps=this.depsTail=void 0,Do(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ii.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ai(this)&&this.run()}get dirty(){return Ai(this)}}let Ul=0,pr,gr;function Bl(e,t=!1){if(e.flags|=8,t){e.next=gr,gr=e;return}e.next=pr,pr=e}function ao(){Ul++}function lo(){if(--Ul>0)return;if(gr){let t=gr;for(gr=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;pr;){let t=pr;for(pr=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Hl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Fl(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),co(r),Eh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Ai(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Kl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Kl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ar)||(e.globalVersion=Ar,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ai(e))))return;e.flags|=2;const t=e.dep,n=ve,r=mt;ve=e,mt=!0;try{Hl(e);const s=e.fn(e._value);(t.version===0||Ct(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{ve=n,mt=r,Fl(e),e.flags&=-3}}function co(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)co(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Eh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let mt=!0;const ql=[];function Wt(){ql.push(mt),mt=!1}function Vt(){const e=ql.pop();mt=e===void 0?!0:e}function Do(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ve;ve=void 0;try{t()}finally{ve=n}}}let Ar=0;class Sh{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class uo{constructor(t){this.computed=t,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(t){if(!ve||!mt||ve===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ve)n=this.activeLink=new Sh(ve,this),ve.deps?(n.prevDep=ve.depsTail,ve.depsTail.nextDep=n,ve.depsTail=n):ve.deps=ve.depsTail=n,Wl(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=ve.depsTail,n.nextDep=void 0,ve.depsTail.nextDep=n,ve.depsTail=n,ve.deps===n&&(ve.deps=r)}return n}trigger(t){this.version++,Ar++,this.notify(t)}notify(t){ao();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{lo()}}}function Wl(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Wl(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const bs=new WeakMap,wn=Symbol(""),Ti=Symbol(""),Tr=Symbol("");function qe(e,t,n){if(mt&&ve){let r=bs.get(e);r||bs.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new uo),s.map=r,s.key=n),s.track()}}function Bt(e,t,n,r,s,i){const o=bs.get(e);if(!o){Ar++;return}const a=l=>{l&&l.trigger()};if(ao(),t==="clear")o.forEach(a);else{const l=Q(e),c=l&&Ds(n);if(l&&n==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===Tr||!ut(d)&&d>=u)&&a(h)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(Tr)),t){case"add":l?c&&a(o.get("length")):(a(o.get(wn)),Kn(e)&&a(o.get(Ti)));break;case"delete":l||(a(o.get(wn)),Kn(e)&&a(o.get(Ti)));break;case"set":Kn(e)&&a(o.get(wn));break}}lo()}function kh(e,t){const n=bs.get(e);return n&&n.get(t)}function Tn(e){const t=he(e);return t===e?t:(qe(t,"iterate",Tr),st(e)?t:t.map(bt))}function Hs(e){return qe(e=he(e),"iterate",Tr),e}function Rt(e,t){return Gt(e)?Vn(Kt(e)?bt(t):t):bt(t)}const Ah={__proto__:null,[Symbol.iterator](){return oi(this,Symbol.iterator,e=>Rt(this,e))},concat(...e){return Tn(this).concat(...e.map(t=>Q(t)?Tn(t):t))},entries(){return oi(this,"entries",e=>(e[1]=Rt(this,e[1]),e))},every(e,t){return It(this,"every",e,t,void 0,arguments)},filter(e,t){return It(this,"filter",e,t,n=>n.map(r=>Rt(this,r)),arguments)},find(e,t){return It(this,"find",e,t,n=>Rt(this,n),arguments)},findIndex(e,t){return It(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return It(this,"findLast",e,t,n=>Rt(this,n),arguments)},findLastIndex(e,t){return It(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return It(this,"forEach",e,t,void 0,arguments)},includes(...e){return ai(this,"includes",e)},indexOf(...e){return ai(this,"indexOf",e)},join(e){return Tn(this).join(e)},lastIndexOf(...e){return ai(this,"lastIndexOf",e)},map(e,t){return It(this,"map",e,t,void 0,arguments)},pop(){return rr(this,"pop")},push(...e){return rr(this,"push",e)},reduce(e,...t){return Mo(this,"reduce",e,t)},reduceRight(e,...t){return Mo(this,"reduceRight",e,t)},shift(){return rr(this,"shift")},some(e,t){return It(this,"some",e,t,void 0,arguments)},splice(...e){return rr(this,"splice",e)},toReversed(){return Tn(this).toReversed()},toSorted(e){return Tn(this).toSorted(e)},toSpliced(...e){return Tn(this).toSpliced(...e)},unshift(...e){return rr(this,"unshift",e)},values(){return oi(this,"values",e=>Rt(this,e))}};function oi(e,t,n){const r=Hs(e),s=r[t]();return r!==e&&!st(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const Th=Array.prototype;function It(e,t,n,r,s,i){const o=Hs(e),a=o!==e&&!st(e),l=o[t];if(l!==Th[t]){const h=l.apply(e,i);return a?bt(h):h}let c=n;o!==e&&(a?c=function(h,d){return n.call(this,Rt(e,h),d,e)}:n.length>2&&(c=function(h,d){return n.call(this,h,d,e)}));const u=l.call(o,c,r);return a&&s?s(u):u}function Mo(e,t,n,r){const s=Hs(e),i=s!==e&&!st(e);let o=n,a=!1;s!==e&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=Rt(e,c)),n.call(this,c,Rt(e,u),h,e)}):n.length>3&&(o=function(c,u,h){return n.call(this,c,u,h,e)}));const l=s[t](o,...r);return a?Rt(e,l):l}function ai(e,t,n){const r=he(e);qe(r,"iterate",Tr);const s=r[t](...n);return(s===-1||s===!1)&&Fs(n[0])?(n[0]=he(n[0]),r[t](...n)):s}function rr(e,t,n=[]){Wt(),ao();const r=he(e)[t].apply(e,n);return lo(),Vt(),r}const Rh=ro("__proto__,__v_isRef,__isVue"),Vl=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ut));function xh(e){ut(e)||(e=String(e));const t=he(this);return qe(t,"has",e),t.hasOwnProperty(e)}class Gl{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Mh:Zl:i?Yl:Jl).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=Q(t);if(!s){let l;if(o&&(l=Ah[n]))return l;if(n==="hasOwnProperty")return xh}const a=Reflect.get(t,n,Te(t)?t:r);if((ut(n)?Vl.has(n):Rh(n))||(s||qe(t,"get",n),i))return a;if(Te(a)){const l=o&&Ds(n)?a:a.value;return s&&me(l)?xi(l):l}return me(a)?s?xi(a):Vr(a):a}}class zl extends Gl{constructor(t=!1){super(!1,t)}set(t,n,r,s){let i=t[n];const o=Q(t)&&Ds(n);if(!this._isShallow){const c=Gt(i);if(!st(r)&&!Gt(r)&&(i=he(i),r=he(r)),!o&&Te(i)&&!Te(r))return c||(i.value=r),!0}const a=o?Number(n)<t.length:ge(t,n),l=Reflect.set(t,n,r,Te(t)?t:s);return t===he(s)&&(a?Ct(r,i)&&Bt(t,"set",n,r):Bt(t,"add",n,r)),l}deleteProperty(t,n){const r=ge(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Bt(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ut(n)||!Vl.has(n))&&qe(t,"has",n),r}ownKeys(t){return qe(t,"iterate",Q(t)?"length":wn),Reflect.ownKeys(t)}}class Oh extends Gl{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Ch=new zl,Nh=new Oh,Ih=new zl(!0);const Ri=e=>e,Zr=e=>Reflect.getPrototypeOf(e);function Ph(e,t,n){return function(...r){const s=this.__v_raw,i=he(s),o=Kn(i),a=e==="entries"||e===Symbol.iterator&&o,l=e==="keys"&&o,c=s[e](...r),u=n?Ri:t?Vn:bt;return!t&&qe(i,"iterate",l?Ti:wn),je(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 Xr(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Lh(e,t){const n={get(s){const i=this.__v_raw,o=he(i),a=he(s);e||(Ct(s,a)&&qe(o,"get",s),qe(o,"get",a));const{has:l}=Zr(o),c=t?Ri:e?Vn:bt;if(l.call(o,s))return c(i.get(s));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!e&&qe(he(s),"iterate",wn),s.size},has(s){const i=this.__v_raw,o=he(i),a=he(s);return e||(Ct(s,a)&&qe(o,"has",s),qe(o,"has",a)),s===a?i.has(s):i.has(s)||i.has(a)},forEach(s,i){const o=this,a=o.__v_raw,l=he(a),c=t?Ri:e?Vn:bt;return!e&&qe(l,"iterate",wn),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return je(n,e?{add:Xr("add"),set:Xr("set"),delete:Xr("delete"),clear:Xr("clear")}:{add(s){const i=he(this),o=Zr(i),a=he(s),l=!t&&!st(s)&&!Gt(s)?a:s;return o.has.call(i,l)||Ct(s,l)&&o.has.call(i,s)||Ct(a,l)&&o.has.call(i,a)||(i.add(l),Bt(i,"add",l,l)),this},set(s,i){!t&&!st(i)&&!Gt(i)&&(i=he(i));const o=he(this),{has:a,get:l}=Zr(o);let c=a.call(o,s);c||(s=he(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Ct(i,u)&&Bt(o,"set",s,i):Bt(o,"add",s,i),this},delete(s){const i=he(this),{has:o,get:a}=Zr(i);let l=o.call(i,s);l||(s=he(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Bt(i,"delete",s,void 0),c},clear(){const s=he(this),i=s.size!==0,o=s.clear();return i&&Bt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Ph(s,e,t)}),n}function ho(e,t){const n=Lh(e,t);return(r,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ge(n,s)&&s in r?n:r,s,i)}const $h={get:ho(!1,!1)},jh={get:ho(!1,!0)},Dh={get:ho(!0,!1)};const Jl=new WeakMap,Yl=new WeakMap,Zl=new WeakMap,Mh=new WeakMap;function Uh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Bh(e){return e.__v_skip||!Object.isExtensible(e)?0:Uh(uh(e))}function Vr(e){return Gt(e)?e:fo(e,!1,Ch,$h,Jl)}function Xl(e){return fo(e,!1,Ih,jh,Yl)}function xi(e){return fo(e,!0,Nh,Dh,Zl)}function fo(e,t,n,r,s){if(!me(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Bh(e);if(i===0)return e;const o=s.get(e);if(o)return o;const a=new Proxy(e,i===2?r:n);return s.set(e,a),a}function Kt(e){return Gt(e)?Kt(e.__v_raw):!!(e&&e.__v_isReactive)}function Gt(e){return!!(e&&e.__v_isReadonly)}function st(e){return!!(e&&e.__v_isShallow)}function Fs(e){return e?!!e.__v_raw:!1}function he(e){const t=e&&e.__v_raw;return t?he(t):e}function po(e){return!ge(e,"__v_skip")&&Object.isExtensible(e)&&Nl(e,"__v_skip",!0),e}const bt=e=>me(e)?Vr(e):e,Vn=e=>me(e)?xi(e):e;function Te(e){return e?e.__v_isRef===!0:!1}function Ae(e){return Ql(e,!1)}function Hh(e){return Ql(e,!0)}function Ql(e,t){return Te(e)?e:new Fh(e,t)}class Fh{constructor(t,n){this.dep=new uo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:he(t),this._value=n?t:bt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||st(t)||Gt(t);t=r?t:he(t),Ct(t,n)&&(this._rawValue=t,this._value=r?t:bt(t),this.dep.trigger())}}function Xe(e){return Te(e)?e.value:e}const Kh={get:(e,t,n)=>t==="__v_raw"?e:Xe(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Te(s)&&!Te(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function ec(e){return Kt(e)?e:new Proxy(e,Kh)}function qh(e){const t=Q(e)?new Array(e.length):{};for(const n in e)t[n]=Vh(e,n);return t}class Wh{constructor(t,n,r){this._object=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=ut(n)?n:String(n),this._raw=he(t);let s=!0,i=t;if(!Q(t)||ut(this._key)||!Ds(this._key))do s=!Fs(i)||st(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=Xe(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Te(this._raw[this._key])){const n=this._object[this._key];if(Te(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return kh(this._raw,this._key)}}function Vh(e,t,n){return new Wh(e,t,n)}class Gh{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new uo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ar-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ve!==this)return Bl(this,!0),!0}get value(){const t=this.dep.track();return Kl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function zh(e,t,n=!1){let r,s;return ie(e)?r=e:(r=e.get,s=e.set),new Gh(r,s,n)}const Qr={},ys=new WeakMap;let mn;function Jh(e,t=!1,n=mn){if(n){let r=ys.get(n);r||ys.set(n,r=[]),r.push(e)}}function Yh(e,t,n=ye){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=n,c=x=>s?x:st(x)||s===!1||s===0?Ht(x,1):Ht(x);let u,h,d,f,g=!1,b=!1;if(Te(e)?(h=()=>e.value,g=st(e)):Kt(e)?(h=()=>c(e),g=!0):Q(e)?(b=!0,g=e.some(x=>Kt(x)||st(x)),h=()=>e.map(x=>{if(Te(x))return x.value;if(Kt(x))return c(x);if(ie(x))return l?l(x,2):x()})):ie(e)?t?h=l?()=>l(e,2):e:h=()=>{if(d){Wt();try{d()}finally{Vt()}}const x=mn;mn=u;try{return l?l(e,3,[f]):e(f)}finally{mn=x}}:h=Nt,t&&s){const x=h,M=s===!0?1/0:s;h=()=>Ht(x(),M)}const E=Dl(),w=()=>{u.stop(),E&&E.active&&so(E.effects,u)};if(i&&t){const x=t;t=(...M)=>{x(...M),w()}}let v=b?new Array(e.length).fill(Qr):Qr;const _=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(t){const M=u.run();if(s||g||(b?M.some((B,z)=>Ct(B,v[z])):Ct(M,v))){d&&d();const B=mn;mn=u;try{const z=[M,v===Qr?void 0:b&&v[0]===Qr?[]:v,f];v=M,l?l(t,3,z):t(...z)}finally{mn=B}}}else u.run()};return a&&a(_),u=new Ml(h),u.scheduler=o?()=>o(_,!1):_,f=x=>Jh(x,!1,u),d=u.onStop=()=>{const x=ys.get(u);if(x){if(l)l(x,4);else for(const M of x)M();ys.delete(u)}},t?r?_(!0):v=u.run():o?o(_.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function Ht(e,t=1/0,n){if(t<=0||!me(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Te(e))Ht(e.value,t,n);else if(Q(e))for(let r=0;r<e.length;r++)Ht(e[r],t,n);else if(Zn(e)||Kn(e))e.forEach(r=>{Ht(r,t,n)});else if(Ol(e)){for(const r in e)Ht(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ht(e[r],t,n)}return e}/**
|
|
10
|
-
* @vue/runtime-core v3.5.34
|
|
11
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
-
* @license MIT
|
|
13
|
-
**/function Gr(e,t,n,r){try{return r?e(...r):e()}catch(s){Ks(s,t,n)}}function yt(e,t,n,r){if(ie(e)){const s=Gr(e,t,n,r);return s&&Rl(s)&&s.catch(i=>{Ks(i,t,n)}),s}if(Q(e)){const s=[];for(let i=0;i<e.length;i++)s.push(yt(e[i],t,n,r));return s}}function Ks(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||ye;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,c)===!1)return}a=a.parent}if(i){Wt(),Gr(i,null,10,[e,l,c]),Vt();return}}Zh(e,n,s,r,o)}function Zh(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const ze=[];let kt=-1;const qn=[];let Qt=null,Ln=0;const tc=Promise.resolve();let _s=null;function Qn(e){const t=_s||tc;return e?t.then(this?e.bind(this):e):t}function Xh(e){let t=kt+1,n=ze.length;for(;t<n;){const r=t+n>>>1,s=ze[r],i=Rr(s);i<e||i===e&&s.flags&2?t=r+1:n=r}return t}function go(e){if(!(e.flags&1)){const t=Rr(e),n=ze[ze.length-1];!n||!(e.flags&2)&&t>=Rr(n)?ze.push(e):ze.splice(Xh(t),0,e),e.flags|=1,nc()}}function nc(){_s||(_s=tc.then(sc))}function Qh(e){Q(e)?qn.push(...e):Qt&&e.id===-1?Qt.splice(Ln+1,0,e):e.flags&1||(qn.push(e),e.flags|=1),nc()}function Uo(e,t,n=kt+1){for(;n<ze.length;n++){const r=ze[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;ze.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function rc(e){if(qn.length){const t=[...new Set(qn)].sort((n,r)=>Rr(n)-Rr(r));if(qn.length=0,Qt){Qt.push(...t);return}for(Qt=t,Ln=0;Ln<Qt.length;Ln++){const n=Qt[Ln];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Qt=null,Ln=0}}const Rr=e=>e.id==null?e.flags&2?-1:1/0:e.id;function sc(e){try{for(kt=0;kt<ze.length;kt++){const t=ze[kt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Gr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;kt<ze.length;kt++){const t=ze[kt];t&&(t.flags&=-2)}kt=-1,ze.length=0,rc(),_s=null,(ze.length||qn.length)&&sc()}}let lt=null,ic=null;function vs(e){const t=lt;return lt=e,ic=e&&e.type.__scopeId||null,t}function mo(e,t=lt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&ks(-1);const i=vs(t);let o;try{o=e(...s)}finally{vs(i),r._d&&ks(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function oc(e,t){if(lt===null)return e;const n=zs(lt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[i,o,a,l=ye]=t[s];i&&(ie(i)&&(i={mounted:i,updated:i}),i.deep&&Ht(o),r.push({dir:i,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return e}function un(e,t,n,r){const s=e.dirs,i=t&&t.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(Wt(),yt(l,n,8,[e.el,a,e,t]),Vt())}}function ds(e,t){if(Ze){let n=Ze.provides;const r=Ze.parent&&Ze.parent.provides;r===n&&(n=Ze.provides=Object.create(r)),n[e]=t}}function ct(e,t,n=!1){const r=wo();if(r||Sn){let s=Sn?Sn._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&ie(t)?t.call(r&&r.proxy):t}}function ed(){return!!(wo()||Sn)}const td=Symbol.for("v-scx"),nd=()=>ct(td);function En(e,t,n){return ac(e,t,n)}function ac(e,t,n=ye){const{immediate:r,deep:s,flush:i,once:o}=n,a=je({},n),l=t&&r||!t&&i!=="post";let c;if(Nr){if(i==="sync"){const f=nd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Nt,f.resume=Nt,f.pause=Nt,f}}const u=Ze;a.call=(f,g,b)=>yt(f,u,g,b);let h=!1;i==="post"?a.scheduler=f=>{et(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,g)=>{g?f():go(f)}),a.augmentJob=f=>{t&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Yh(e,t,a);return Nr&&(c?c.push(d):l&&d()),d}function rd(e,t,n){const r=this.proxy,s=Ee(e)?e.includes(".")?lc(r,e):()=>r[e]:e.bind(r,r);let i;ie(t)?i=t:(i=t.handler,n=t);const o=zr(this),a=ac(s,i.bind(r),n);return o(),a}function lc(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const sd=Symbol("_vte"),cc=e=>e.__isTeleport,At=Symbol("_leaveCb"),sr=Symbol("_enterCb");function id(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return er(()=>{e.isMounted=!0}),bc(()=>{e.isUnmounting=!0}),e}const ot=[Function,Array],uc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ot,onEnter:ot,onAfterEnter:ot,onEnterCancelled:ot,onBeforeLeave:ot,onLeave:ot,onAfterLeave:ot,onLeaveCancelled:ot,onBeforeAppear:ot,onAppear:ot,onAfterAppear:ot,onAppearCancelled:ot},hc=e=>{const t=e.subTree;return t.component?hc(t.component):t},od={name:"BaseTransition",props:uc,setup(e,{slots:t}){const n=wo(),r=id();return()=>{const s=t.default&&pc(t.default(),!0),i=s&&s.length?dc(s):n.subTree?Cr():void 0;if(!i)return;const o=he(e),{mode:a}=o;if(r.isLeaving)return li(i);const l=Bo(i);if(!l)return li(i);let c=Oi(l,o,r,n,h=>c=h);l.type!==Ye&&xr(l,c);let u=n.subTree&&Bo(n.subTree);if(u&&u.type!==Ye&&!yn(u,l)&&hc(n).type!==Ye){let h=Oi(u,o,r,n);if(xr(u,h),a==="out-in"&&l.type!==Ye)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,u=void 0},li(i);a==="in-out"&&l.type!==Ye?h.delayLeave=(d,f,g)=>{const b=fc(r,u);b[String(u.key)]=u,d[At]=()=>{f(),d[At]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{g(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function dc(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ye){t=n;break}}return t}const ad=od;function fc(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Oi(e,t,n,r,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:g,onLeaveCancelled:b,onBeforeAppear:E,onAppear:w,onAfterAppear:v,onAppearCancelled:_}=t,x=String(e.key),M=fc(n,e),B=(L,ee)=>{L&&yt(L,r,9,ee)},z=(L,ee)=>{const le=ee[1];B(L,ee),Q(L)?L.every(F=>F.length<=1)&&le():L.length<=1&&le()},J={mode:o,persisted:a,beforeEnter(L){let ee=l;if(!n.isMounted)if(i)ee=E||l;else return;L[At]&&L[At](!0);const le=M[x];le&&yn(e,le)&&le.el[At]&&le.el[At](),B(ee,[L])},enter(L){if(M[x]===e)return;let ee=c,le=u,F=h;if(!n.isMounted)if(i)ee=w||c,le=v||u,F=_||h;else return;let oe=!1;L[sr]=Re=>{oe||(oe=!0,Re?B(F,[L]):B(le,[L]),J.delayedLeave&&J.delayedLeave(),L[sr]=void 0)};const be=L[sr].bind(null,!1);ee?z(ee,[L,be]):be()},leave(L,ee){const le=String(e.key);if(L[sr]&&L[sr](!0),n.isUnmounting)return ee();B(d,[L]);let F=!1;L[At]=be=>{F||(F=!0,ee(),be?B(b,[L]):B(g,[L]),L[At]=void 0,M[le]===e&&delete M[le])};const oe=L[At].bind(null,!1);M[le]=e,f?z(f,[L,oe]):oe()},clone(L){const ee=Oi(L,t,n,r,s);return s&&s(ee),ee}};return J}function li(e){if(qs(e))return e=on(e),e.children=null,e}function Bo(e){if(!qs(e))return cc(e.type)&&e.children?dc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ie(n.default))return n.default()}}function xr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,xr(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function pc(e,t=!1,n){let r=[],s=0;for(let i=0;i<e.length;i++){let o=e[i];const a=n==null?o.key:String(n)+String(o.key!=null?o.key:i);o.type===Je?(o.patchFlag&128&&s++,r=r.concat(pc(o.children,t,a))):(t||o.type!==Ye)&&r.push(a!=null?on(o,{key:a}):o)}if(s>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function ln(e,t){return ie(e)?je({name:e.name},t,{setup:e}):e}function gc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Ho(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ws=new WeakMap;function mr(e,t,n,r,s=!1){if(Q(e)){e.forEach((b,E)=>mr(b,t&&(Q(t)?t[E]:t),n,r,s));return}if(br(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&mr(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?zs(r.component):r.el,o=s?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===ye?a.refs={}:a.refs,h=a.setupState,d=he(h),f=h===ye?Tl:b=>Ho(u,b)?!1:ge(d,b),g=(b,E)=>!(E&&Ho(u,E));if(c!=null&&c!==l){if(Fo(t),Ee(c))u[c]=null,f(c)&&(h[c]=null);else if(Te(c)){const b=t;g(c,b.k)&&(c.value=null),b.k&&(u[b.k]=null)}}if(ie(l))Gr(l,a,12,[o,u]);else{const b=Ee(l),E=Te(l);if(b||E){const w=()=>{if(e.f){const v=b?f(l)?h[l]:u[l]:g()||!e.k?l.value:u[e.k];if(s)Q(v)&&so(v,i);else if(Q(v))v.includes(i)||v.push(i);else if(b)u[l]=[i],f(l)&&(h[l]=u[l]);else{const _=[i];g(l,e.k)&&(l.value=_),e.k&&(u[e.k]=_)}}else b?(u[l]=o,f(l)&&(h[l]=o)):E&&(g(l,e.k)&&(l.value=o),e.k&&(u[e.k]=o))};if(o){const v=()=>{w(),ws.delete(e)};v.id=-1,ws.set(e,v),et(v,n)}else Fo(e),w()}}}function Fo(e){const t=ws.get(e);t&&(t.flags|=8,ws.delete(e))}Bs().requestIdleCallback;Bs().cancelIdleCallback;const br=e=>!!e.type.__asyncLoader,qs=e=>e.type.__isKeepAlive;function ld(e,t){mc(e,"a",t)}function cd(e,t){mc(e,"da",t)}function mc(e,t,n=Ze){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Ws(t,r,n),n){let s=n.parent;for(;s&&s.parent;)qs(s.parent.vnode)&&ud(r,t,n,s),s=s.parent}}function ud(e,t,n,r){const s=Ws(t,e,r,!0);tr(()=>{so(r[t],s)},n)}function Ws(e,t,n=Ze,r=!1){if(n){const s=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{Wt();const a=zr(n),l=yt(t,n,e,o);return a(),Vt(),l});return r?s.unshift(i):s.push(i),i}}const zt=e=>(t,n=Ze)=>{(!Nr||e==="sp")&&Ws(e,(...r)=>t(...r),n)},hd=zt("bm"),er=zt("m"),dd=zt("bu"),fd=zt("u"),bc=zt("bum"),tr=zt("um"),pd=zt("sp"),gd=zt("rtg"),md=zt("rtc");function bd(e,t=Ze){Ws("ec",e,t)}const yd=Symbol.for("v-ndc");function Es(e,t,n,r){let s;const i=n,o=Q(e);if(o||Ee(e)){const a=o&&Kt(e);let l=!1,c=!1;a&&(l=!st(e),c=Gt(e),e=Hs(e)),s=new Array(e.length);for(let u=0,h=e.length;u<h;u++)s[u]=t(l?c?Vn(bt(e[u])):bt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,i)}else if(me(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,i));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=t(e[u],u,l,i)}}else s=[];return s}const Ci=e=>e?Dc(e)?zs(e):Ci(e.parent):null,yr=je(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ci(e.parent),$root:e=>Ci(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>_c(e),$forceUpdate:e=>e.f||(e.f=()=>{go(e.update)}),$nextTick:e=>e.n||(e.n=Qn.bind(e.proxy)),$watch:e=>rd.bind(e)}),ci=(e,t)=>e!==ye&&!e.__isScriptSetup&&ge(e,t),_d={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:i,accessCache:o,type:a,appContext:l}=e;if(t[0]!=="$"){const d=o[t];if(d!==void 0)switch(d){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return i[t]}else{if(ci(r,t))return o[t]=1,r[t];if(s!==ye&&ge(s,t))return o[t]=2,s[t];if(ge(i,t))return o[t]=3,i[t];if(n!==ye&&ge(n,t))return o[t]=4,n[t];Ni&&(o[t]=0)}}const c=yr[t];let u,h;if(c)return t==="$attrs"&&qe(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==ye&&ge(n,t))return o[t]=4,n[t];if(h=l.config.globalProperties,ge(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:i}=e;return ci(s,t)?(s[t]=n,!0):r!==ye&&ge(r,t)?(r[t]=n,!0):ge(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:i,type:o}},a){let l;return!!(n[a]||e!==ye&&a[0]!=="$"&&ge(e,a)||ci(t,a)||ge(i,a)||ge(r,a)||ge(yr,a)||ge(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ge(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ko(e){return Q(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ni=!0;function vd(e){const t=_c(e),n=e.proxy,r=e.ctx;Ni=!1,t.beforeCreate&&qo(t.beforeCreate,e,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:g,activated:b,deactivated:E,beforeDestroy:w,beforeUnmount:v,destroyed:_,unmounted:x,render:M,renderTracked:B,renderTriggered:z,errorCaptured:J,serverPrefetch:L,expose:ee,inheritAttrs:le,components:F,directives:oe,filters:be}=t;if(c&&wd(c,r,null),o)for(const I in o){const $=o[I];ie($)&&(r[I]=$.bind(n))}if(s){const I=s.call(n,n);me(I)&&(e.data=Vr(I))}if(Ni=!0,i)for(const I in i){const $=i[I],te=ie($)?$.bind(n,n):ie($.get)?$.get.bind(n,n):Nt,ae=!ie($)&&ie($.set)?$.set.bind(n):Nt,de=Be({get:te,set:ae});Object.defineProperty(r,I,{enumerable:!0,configurable:!0,get:()=>de.value,set:fe=>de.value=fe})}if(a)for(const I in a)yc(a[I],r,n,I);if(l){const I=ie(l)?l.call(n):l;Reflect.ownKeys(I).forEach($=>{ds($,I[$])})}u&&qo(u,e,"c");function A(I,$){Q($)?$.forEach(te=>I(te.bind(n))):$&&I($.bind(n))}if(A(hd,h),A(er,d),A(dd,f),A(fd,g),A(ld,b),A(cd,E),A(bd,J),A(md,B),A(gd,z),A(bc,v),A(tr,x),A(pd,L),Q(ee))if(ee.length){const I=e.exposed||(e.exposed={});ee.forEach($=>{Object.defineProperty(I,$,{get:()=>n[$],set:te=>n[$]=te,enumerable:!0})})}else e.exposed||(e.exposed={});M&&e.render===Nt&&(e.render=M),le!=null&&(e.inheritAttrs=le),F&&(e.components=F),oe&&(e.directives=oe),L&&gc(e)}function wd(e,t,n=Nt){Q(e)&&(e=Ii(e));for(const r in e){const s=e[r];let i;me(s)?"default"in s?i=ct(s.from||r,s.default,!0):i=ct(s.from||r):i=ct(s),Te(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[r]=i}}function qo(e,t,n){yt(Q(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function yc(e,t,n,r){let s=r.includes(".")?lc(n,r):()=>n[r];if(Ee(e)){const i=t[e];ie(i)&&En(s,i)}else if(ie(e))En(s,e.bind(n));else if(me(e))if(Q(e))e.forEach(i=>yc(i,t,n,r));else{const i=ie(e.handler)?e.handler.bind(n):t[e.handler];ie(i)&&En(s,i,e)}}function _c(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,a=i.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(c=>Ss(l,c,o,!0)),Ss(l,t,o)),me(t)&&i.set(t,l),l}function Ss(e,t,n,r=!1){const{mixins:s,extends:i}=t;i&&Ss(e,i,n,!0),s&&s.forEach(o=>Ss(e,o,n,!0));for(const o in t)if(!(r&&o==="expose")){const a=Ed[o]||n&&n[o];e[o]=a?a(e[o],t[o]):t[o]}return e}const Ed={data:Wo,props:Vo,emits:Vo,methods:lr,computed:lr,beforeCreate:Ve,created:Ve,beforeMount:Ve,mounted:Ve,beforeUpdate:Ve,updated:Ve,beforeDestroy:Ve,beforeUnmount:Ve,destroyed:Ve,unmounted:Ve,activated:Ve,deactivated:Ve,errorCaptured:Ve,serverPrefetch:Ve,components:lr,directives:lr,watch:kd,provide:Wo,inject:Sd};function Wo(e,t){return t?e?function(){return je(ie(e)?e.call(this,this):e,ie(t)?t.call(this,this):t)}:t:e}function Sd(e,t){return lr(Ii(e),Ii(t))}function Ii(e){if(Q(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ve(e,t){return e?[...new Set([].concat(e,t))]:t}function lr(e,t){return e?je(Object.create(null),e,t):t}function Vo(e,t){return e?Q(e)&&Q(t)?[...new Set([...e,...t])]:je(Object.create(null),Ko(e),Ko(t??{})):t}function kd(e,t){if(!e)return t;if(!t)return e;const n=je(Object.create(null),e);for(const r in t)n[r]=Ve(e[r],t[r]);return n}function vc(){return{app:null,config:{isNativeTag:Tl,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 Ad=0;function Td(e,t){return function(r,s=null){ie(r)||(r=je({},r)),s!=null&&!me(s)&&(s=null);const i=vc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Ad++,_component:r,_props:s,_container:null,_context:i,_instance:null,version:rf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&ie(u.install)?(o.add(u),u.install(c,...h)):ie(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||xe(r,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),e(f,u,d),l=!0,c._container=u,u.__vue_app__=c,zs(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(yt(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=Sn;Sn=c;try{return u()}finally{Sn=h}}};return c}}let Sn=null;const Rd=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${gt(t)}Modifiers`]||e[`${an(t)}Modifiers`];function xd(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||ye;let s=n;const i=t.startsWith("update:"),o=i&&Rd(r,t.slice(7));o&&(o.trim&&(s=n.map(u=>Ee(u)?u.trim():u)),o.number&&(s=n.map(Us)));let a,l=r[a=ri(t)]||r[a=ri(gt(t))];!l&&i&&(l=r[a=ri(an(t))]),l&&yt(l,e,6,s);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,yt(c,e,6,s)}}const Od=new WeakMap;function wc(e,t,n=!1){const r=n?Od:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const i=e.emits;let o={},a=!1;if(!ie(e)){const l=c=>{const u=wc(c,t,!0);u&&(a=!0,je(o,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(me(e)&&r.set(e,null),null):(Q(i)?i.forEach(l=>o[l]=null):je(o,i),me(e)&&r.set(e,o),o)}function Vs(e,t){return!e||!$s(t)?!1:(t=t.slice(2).replace(/Once$/,""),ge(e,t[0].toLowerCase()+t.slice(1))||ge(e,an(t))||ge(e,t))}function Go(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:g,inheritAttrs:b}=e,E=vs(e);let w,v;try{if(n.shapeFlag&4){const x=s||r,M=x;w=xt(c.call(M,x,u,h,f,d,g)),v=a}else{const x=t;w=xt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),v=t.props?a:Cd(a)}}catch(x){_r.length=0,Ks(x,e,1),w=xe(Ye)}let _=w;if(v&&b!==!1){const x=Object.keys(v),{shapeFlag:M}=_;x.length&&M&7&&(i&&x.some(js)&&(v=Nd(v,i)),_=on(_,v,!1,!0))}return n.dirs&&(_=on(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(n.dirs):n.dirs),n.transition&&xr(_,n.transition),w=_,vs(E),w}const Cd=e=>{let t;for(const n in e)(n==="class"||n==="style"||$s(n))&&((t||(t={}))[n]=e[n]);return t},Nd=(e,t)=>{const n={};for(const r in e)(!js(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Id(e,t,n){const{props:r,children:s,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?zo(r,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Ec(o,r,d)&&!Vs(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?zo(r,o,c):!0:!!o;return!1}function zo(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const i=r[s];if(Ec(t,e,i)&&!Vs(n,i))return!0}return!1}function Ec(e,t,n){const r=e[n],s=t[n];return n==="style"&&me(r)&&me(s)?!Xn(r,s):r!==s}function Pd({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Sc={},kc=()=>Object.create(Sc),Ac=e=>Object.getPrototypeOf(e)===Sc;function Ld(e,t,n,r=!1){const s={},i=kc();e.propsDefaults=Object.create(null),Tc(e,t,s,i);for(const o in e.propsOptions[0])o in s||(s[o]=void 0);n?e.props=r?s:Xl(s):e.type.props?e.props=s:e.props=i,e.attrs=i}function $d(e,t,n,r){const{props:s,attrs:i,vnode:{patchFlag:o}}=e,a=he(s),[l]=e.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Vs(e.emitsOptions,d))continue;const f=t[d];if(l)if(ge(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const g=gt(d);s[g]=Pi(l,a,g,f,e,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Tc(e,t,s,i)&&(c=!0);let u;for(const h in a)(!t||!ge(t,h)&&((u=an(h))===h||!ge(t,u)))&&(l?n&&(n[h]!==void 0||n[u]!==void 0)&&(s[h]=Pi(l,a,h,void 0,e,!0)):delete s[h]);if(i!==a)for(const h in i)(!t||!ge(t,h))&&(delete i[h],c=!0)}c&&Bt(e.attrs,"set","")}function Tc(e,t,n,r){const[s,i]=e.propsOptions;let o=!1,a;if(t)for(let l in t){if(fr(l))continue;const c=t[l];let u;s&&ge(s,u=gt(l))?!i||!i.includes(u)?n[u]=c:(a||(a={}))[u]=c:Vs(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=he(n),c=a||ye;for(let u=0;u<i.length;u++){const h=i[u];n[h]=Pi(s,l,h,c[h],e,!ge(c,h))}}return o}function Pi(e,t,n,r,s,i){const o=e[n];if(o!=null){const a=ge(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ie(l)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=zr(s);r=c[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===an(n))&&(r=!0))}return r}const jd=new WeakMap;function Rc(e,t,n=!1){const r=n?jd:t.propsCache,s=r.get(e);if(s)return s;const i=e.props,o={},a=[];let l=!1;if(!ie(e)){const u=h=>{l=!0;const[d,f]=Rc(h,t,!0);je(o,d),f&&a.push(...f)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return me(e)&&r.set(e,Fn),Fn;if(Q(i))for(let u=0;u<i.length;u++){const h=gt(i[u]);Jo(h)&&(o[h]=ye)}else if(i)for(const u in i){const h=gt(u);if(Jo(h)){const d=i[u],f=o[h]=Q(d)||ie(d)?{type:d}:je({},d),g=f.type;let b=!1,E=!0;if(Q(g))for(let w=0;w<g.length;++w){const v=g[w],_=ie(v)&&v.name;if(_==="Boolean"){b=!0;break}else _==="String"&&(E=!1)}else b=ie(g)&&g.name==="Boolean";f[0]=b,f[1]=E,(b||ge(f,"default"))&&a.push(h)}}const c=[o,a];return me(e)&&r.set(e,c),c}function Jo(e){return e[0]!=="$"&&!fr(e)}const bo=e=>e==="_"||e==="_ctx"||e==="$stable",yo=e=>Q(e)?e.map(xt):[xt(e)],Dd=(e,t,n)=>{if(t._n)return t;const r=mo((...s)=>yo(t(...s)),n);return r._c=!1,r},xc=(e,t,n)=>{const r=e._ctx;for(const s in e){if(bo(s))continue;const i=e[s];if(ie(i))t[s]=Dd(s,i,r);else if(i!=null){const o=yo(i);t[s]=()=>o}}},Oc=(e,t)=>{const n=yo(t);e.slots.default=()=>n},Cc=(e,t,n)=>{for(const r in t)(n||!bo(r))&&(e[r]=t[r])},Md=(e,t,n)=>{const r=e.slots=kc();if(e.vnode.shapeFlag&32){const s=t._;s?(Cc(r,t,n),n&&Nl(r,"_",s,!0)):xc(t,r)}else t&&Oc(e,t)},Ud=(e,t,n)=>{const{vnode:r,slots:s}=e;let i=!0,o=ye;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Cc(s,t,n):(i=!t.$stable,xc(t,s)),o=t}else t&&(Oc(e,t),o={default:1});if(i)for(const a in s)!bo(a)&&o[a]==null&&delete s[a]},et=qd;function Bd(e){return Hd(e)}function Hd(e,t){const n=Bs();n.__VUE__=!0;const{insert:r,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Nt,insertStaticContent:g}=e,b=(p,m,y,S=null,C=null,T=null,R=void 0,U=null,P=!!m.dynamicChildren)=>{if(p===m)return;p&&!yn(p,m)&&(S=O(p),fe(p,C,T,!0),p=null),m.patchFlag===-2&&(P=!1,m.dynamicChildren=null);const{type:k,ref:X,shapeFlag:H}=m;switch(k){case Gs:E(p,m,y,S);break;case Ye:w(p,m,y,S);break;case fs:p==null&&v(m,y,S,R);break;case Je:F(p,m,y,S,C,T,R,U,P);break;default:H&1?M(p,m,y,S,C,T,R,U,P):H&6?oe(p,m,y,S,C,T,R,U,P):(H&64||H&128)&&k.process(p,m,y,S,C,T,R,U,P,Z)}X!=null&&C?mr(X,p&&p.ref,T,m||p,!m):X==null&&p&&p.ref!=null&&mr(p.ref,null,T,p,!0)},E=(p,m,y,S)=>{if(p==null)r(m.el=a(m.children),y,S);else{const C=m.el=p.el;m.children!==p.children&&c(C,m.children)}},w=(p,m,y,S)=>{p==null?r(m.el=l(m.children||""),y,S):m.el=p.el},v=(p,m,y,S)=>{[p.el,p.anchor]=g(p.children,m,y,S,p.el,p.anchor)},_=({el:p,anchor:m},y,S)=>{let C;for(;p&&p!==m;)C=d(p),r(p,y,S),p=C;r(m,y,S)},x=({el:p,anchor:m})=>{let y;for(;p&&p!==m;)y=d(p),s(p),p=y;s(m)},M=(p,m,y,S,C,T,R,U,P)=>{if(m.type==="svg"?R="svg":m.type==="math"&&(R="mathml"),p==null)B(m,y,S,C,T,R,U,P);else{const k=p.el&&p.el._isVueCE?p.el:null;try{k&&k._beginPatch(),L(p,m,C,T,R,U,P)}finally{k&&k._endPatch()}}},B=(p,m,y,S,C,T,R,U)=>{let P,k;const{props:X,shapeFlag:H,transition:Y,dirs:ne}=p;if(P=p.el=o(p.type,T,X&&X.is,X),H&8?u(P,p.children):H&16&&J(p.children,P,null,S,C,ui(p,T),R,U),ne&&un(p,null,S,"created"),z(P,p,p.scopeId,R,S),X){for(const D in X)D!=="value"&&!fr(D)&&i(P,D,null,X[D],T,S);"value"in X&&i(P,"value",null,X.value,T),(k=X.onVnodeBeforeMount)&&wt(k,S,p)}ne&&un(p,null,S,"beforeMount");const N=Fd(C,Y);N&&Y.beforeEnter(P),r(P,m,y),((k=X&&X.onVnodeMounted)||N||ne)&&et(()=>{try{k&&wt(k,S,p),N&&Y.enter(P),ne&&un(p,null,S,"mounted")}finally{}},C)},z=(p,m,y,S,C)=>{if(y&&f(p,y),S)for(let T=0;T<S.length;T++)f(p,S[T]);if(C){let T=C.subTree;if(m===T||Lc(T.type)&&(T.ssContent===m||T.ssFallback===m)){const R=C.vnode;z(p,R,R.scopeId,R.slotScopeIds,C.parent)}}},J=(p,m,y,S,C,T,R,U,P=0)=>{for(let k=P;k<p.length;k++){const X=p[k]=U?Ut(p[k]):xt(p[k]);b(null,X,m,y,S,C,T,R,U)}},L=(p,m,y,S,C,T,R)=>{const U=m.el=p.el;let{patchFlag:P,dynamicChildren:k,dirs:X}=m;P|=p.patchFlag&16;const H=p.props||ye,Y=m.props||ye;let ne;if(y&&hn(y,!1),(ne=Y.onVnodeBeforeUpdate)&&wt(ne,y,m,p),X&&un(m,p,y,"beforeUpdate"),y&&hn(y,!0),(H.innerHTML&&Y.innerHTML==null||H.textContent&&Y.textContent==null)&&u(U,""),k?ee(p.dynamicChildren,k,U,y,S,ui(m,C),T):R||$(p,m,U,null,y,S,ui(m,C),T,!1),P>0){if(P&16)le(U,H,Y,y,C);else if(P&2&&H.class!==Y.class&&i(U,"class",null,Y.class,C),P&4&&i(U,"style",H.style,Y.style,C),P&8){const N=m.dynamicProps;for(let D=0;D<N.length;D++){const V=N[D],re=H[V],ue=Y[V];(ue!==re||V==="value")&&i(U,V,re,ue,C,y)}}P&1&&p.children!==m.children&&u(U,m.children)}else!R&&k==null&&le(U,H,Y,y,C);((ne=Y.onVnodeUpdated)||X)&&et(()=>{ne&&wt(ne,y,m,p),X&&un(m,p,y,"updated")},S)},ee=(p,m,y,S,C,T,R)=>{for(let U=0;U<m.length;U++){const P=p[U],k=m[U],X=P.el&&(P.type===Je||!yn(P,k)||P.shapeFlag&198)?h(P.el):y;b(P,k,X,null,S,C,T,R,!0)}},le=(p,m,y,S,C)=>{if(m!==y){if(m!==ye)for(const T in m)!fr(T)&&!(T in y)&&i(p,T,m[T],null,C,S);for(const T in y){if(fr(T))continue;const R=y[T],U=m[T];R!==U&&T!=="value"&&i(p,T,U,R,C,S)}"value"in y&&i(p,"value",m.value,y.value,C)}},F=(p,m,y,S,C,T,R,U,P)=>{const k=m.el=p?p.el:a(""),X=m.anchor=p?p.anchor:a("");let{patchFlag:H,dynamicChildren:Y,slotScopeIds:ne}=m;ne&&(U=U?U.concat(ne):ne),p==null?(r(k,y,S),r(X,y,S),J(m.children||[],y,X,C,T,R,U,P)):H>0&&H&64&&Y&&p.dynamicChildren&&p.dynamicChildren.length===Y.length?(ee(p.dynamicChildren,Y,y,C,T,R,U),(m.key!=null||C&&m===C.subTree)&&Nc(p,m,!0)):$(p,m,y,X,C,T,R,U,P)},oe=(p,m,y,S,C,T,R,U,P)=>{m.slotScopeIds=U,p==null?m.shapeFlag&512?C.ctx.activate(m,y,S,R,P):be(m,y,S,C,T,R,P):Re(p,m,P)},be=(p,m,y,S,C,T,R)=>{const U=p.component=Zd(p,S,C);if(qs(p)&&(U.ctx.renderer=Z),Xd(U,!1,R),U.asyncDep){if(C&&C.registerDep(U,A,R),!p.el){const P=U.subTree=xe(Ye);w(null,P,m,y),p.placeholder=P.el}}else A(U,p,m,y,C,T,R)},Re=(p,m,y)=>{const S=m.component=p.component;if(Id(p,m,y))if(S.asyncDep&&!S.asyncResolved){I(S,m,y);return}else S.next=m,S.update();else m.el=p.el,S.vnode=m},A=(p,m,y,S,C,T,R)=>{const U=()=>{if(p.isMounted){let{next:H,bu:Y,u:ne,parent:N,vnode:D}=p;{const it=Ic(p);if(it){H&&(H.el=D.el,I(p,H,R)),it.asyncDep.then(()=>{et(()=>{p.isUnmounted||k()},C)});return}}let V=H,re;hn(p,!1),H?(H.el=D.el,I(p,H,R)):H=D,Y&&hs(Y),(re=H.props&&H.props.onVnodeBeforeUpdate)&&wt(re,N,H,D),hn(p,!0);const ue=Go(p),Ne=p.subTree;p.subTree=ue,b(Ne,ue,h(Ne.el),O(Ne),p,C,T),H.el=ue.el,V===null&&Pd(p,ue.el),ne&&et(ne,C),(re=H.props&&H.props.onVnodeUpdated)&&et(()=>wt(re,N,H,D),C)}else{let H;const{el:Y,props:ne}=m,{bm:N,m:D,parent:V,root:re,type:ue}=p,Ne=br(m);hn(p,!1),N&&hs(N),!Ne&&(H=ne&&ne.onVnodeBeforeMount)&&wt(H,V,m),hn(p,!0);{re.ce&&re.ce._hasShadowRoot()&&re.ce._injectChildStyle(ue,p.parent?p.parent.type:void 0);const it=p.subTree=Go(p);b(null,it,y,S,p,C,T),m.el=it.el}if(D&&et(D,C),!Ne&&(H=ne&&ne.onVnodeMounted)){const it=m;et(()=>wt(H,V,it),C)}(m.shapeFlag&256||V&&br(V.vnode)&&V.vnode.shapeFlag&256)&&p.a&&et(p.a,C),p.isMounted=!0,m=y=S=null}};p.scope.on();const P=p.effect=new Ml(U);p.scope.off();const k=p.update=P.run.bind(P),X=p.job=P.runIfDirty.bind(P);X.i=p,X.id=p.uid,P.scheduler=()=>go(X),hn(p,!0),k()},I=(p,m,y)=>{m.component=p;const S=p.vnode.props;p.vnode=m,p.next=null,$d(p,m.props,S,y),Ud(p,m.children,y),Wt(),Uo(p),Vt()},$=(p,m,y,S,C,T,R,U,P=!1)=>{const k=p&&p.children,X=p?p.shapeFlag:0,H=m.children,{patchFlag:Y,shapeFlag:ne}=m;if(Y>0){if(Y&128){ae(k,H,y,S,C,T,R,U,P);return}else if(Y&256){te(k,H,y,S,C,T,R,U,P);return}}ne&8?(X&16&&We(k,C,T),H!==k&&u(y,H)):X&16?ne&16?ae(k,H,y,S,C,T,R,U,P):We(k,C,T,!0):(X&8&&u(y,""),ne&16&&J(H,y,S,C,T,R,U,P))},te=(p,m,y,S,C,T,R,U,P)=>{p=p||Fn,m=m||Fn;const k=p.length,X=m.length,H=Math.min(k,X);let Y;for(Y=0;Y<H;Y++){const ne=m[Y]=P?Ut(m[Y]):xt(m[Y]);b(p[Y],ne,y,null,C,T,R,U,P)}k>X?We(p,C,T,!0,!1,H):J(m,y,S,C,T,R,U,P,H)},ae=(p,m,y,S,C,T,R,U,P)=>{let k=0;const X=m.length;let H=p.length-1,Y=X-1;for(;k<=H&&k<=Y;){const ne=p[k],N=m[k]=P?Ut(m[k]):xt(m[k]);if(yn(ne,N))b(ne,N,y,null,C,T,R,U,P);else break;k++}for(;k<=H&&k<=Y;){const ne=p[H],N=m[Y]=P?Ut(m[Y]):xt(m[Y]);if(yn(ne,N))b(ne,N,y,null,C,T,R,U,P);else break;H--,Y--}if(k>H){if(k<=Y){const ne=Y+1,N=ne<X?m[ne].el:S;for(;k<=Y;)b(null,m[k]=P?Ut(m[k]):xt(m[k]),y,N,C,T,R,U,P),k++}}else if(k>Y)for(;k<=H;)fe(p[k],C,T,!0),k++;else{const ne=k,N=k,D=new Map;for(k=N;k<=Y;k++){const tt=m[k]=P?Ut(m[k]):xt(m[k]);tt.key!=null&&D.set(tt.key,k)}let V,re=0;const ue=Y-N+1;let Ne=!1,it=0;const cn=new Array(ue);for(k=0;k<ue;k++)cn[k]=0;for(k=ne;k<=H;k++){const tt=p[k];if(re>=ue){fe(tt,C,T,!0);continue}let vt;if(tt.key!=null)vt=D.get(tt.key);else for(V=N;V<=Y;V++)if(cn[V-N]===0&&yn(tt,m[V])){vt=V;break}vt===void 0?fe(tt,C,T,!0):(cn[vt-N]=k+1,vt>=it?it=vt:Ne=!0,b(tt,m[vt],y,null,C,T,R,U,P),re++)}const Io=Ne?Kd(cn):Fn;for(V=Io.length-1,k=ue-1;k>=0;k--){const tt=N+k,vt=m[tt],Po=m[tt+1],Lo=tt+1<X?Po.el||Pc(Po):S;cn[k]===0?b(null,vt,y,Lo,C,T,R,U,P):Ne&&(V<0||k!==Io[V]?de(vt,y,Lo,2):V--)}}},de=(p,m,y,S,C=null)=>{const{el:T,type:R,transition:U,children:P,shapeFlag:k}=p;if(k&6){de(p.component.subTree,m,y,S);return}if(k&128){p.suspense.move(m,y,S);return}if(k&64){R.move(p,m,y,Z);return}if(R===Je){r(T,m,y);for(let H=0;H<P.length;H++)de(P[H],m,y,S);r(p.anchor,m,y);return}if(R===fs){_(p,m,y);return}if(S!==2&&k&1&&U)if(S===0)U.beforeEnter(T),r(T,m,y),et(()=>U.enter(T),C);else{const{leave:H,delayLeave:Y,afterLeave:ne}=U,N=()=>{p.ctx.isUnmounted?s(T):r(T,m,y)},D=()=>{T._isLeaving&&T[At](!0),H(T,()=>{N(),ne&&ne()})};Y?Y(T,N,D):D()}else r(T,m,y)},fe=(p,m,y,S=!1,C=!1)=>{const{type:T,props:R,ref:U,children:P,dynamicChildren:k,shapeFlag:X,patchFlag:H,dirs:Y,cacheIndex:ne,memo:N}=p;if(H===-2&&(C=!1),U!=null&&(Wt(),mr(U,null,y,p,!0),Vt()),ne!=null&&(m.renderCache[ne]=void 0),X&256){m.ctx.deactivate(p);return}const D=X&1&&Y,V=!br(p);let re;if(V&&(re=R&&R.onVnodeBeforeUnmount)&&wt(re,m,p),X&6)De(p.component,y,S);else{if(X&128){p.suspense.unmount(y,S);return}D&&un(p,null,m,"beforeUnmount"),X&64?p.type.remove(p,m,y,Z,S):k&&!k.hasOnce&&(T!==Je||H>0&&H&64)?We(k,m,y,!1,!0):(T===Je&&H&384||!C&&X&16)&&We(P,m,y),S&&He(p)}const ue=N!=null&&ne==null;(V&&(re=R&&R.onVnodeUnmounted)||D||ue)&&et(()=>{re&&wt(re,m,p),D&&un(p,null,m,"unmounted"),ue&&(p.el=null)},y)},He=p=>{const{type:m,el:y,anchor:S,transition:C}=p;if(m===Je){Ce(y,S);return}if(m===fs){x(p);return}const T=()=>{s(y),C&&!C.persisted&&C.afterLeave&&C.afterLeave()};if(p.shapeFlag&1&&C&&!C.persisted){const{leave:R,delayLeave:U}=C,P=()=>R(y,T);U?U(p.el,T,P):P()}else T()},Ce=(p,m)=>{let y;for(;p!==m;)y=d(p),s(p),p=y;s(m)},De=(p,m,y)=>{const{bum:S,scope:C,job:T,subTree:R,um:U,m:P,a:k}=p;Yo(P),Yo(k),S&&hs(S),C.stop(),T&&(T.flags|=8,fe(R,p,m,y)),U&&et(U,m),et(()=>{p.isUnmounted=!0},m)},We=(p,m,y,S=!1,C=!1,T=0)=>{for(let R=T;R<p.length;R++)fe(p[R],m,y,S,C)},O=p=>{if(p.shapeFlag&6)return O(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const m=d(p.anchor||p.el),y=m&&m[sd];return y?d(y):m};let W=!1;const q=(p,m,y)=>{let S;p==null?m._vnode&&(fe(m._vnode,null,null,!0),S=m._vnode.component):b(m._vnode||null,p,m,null,null,null,y),m._vnode=p,W||(W=!0,Uo(S),rc(),W=!1)},Z={p:b,um:fe,m:de,r:He,mt:be,mc:J,pc:$,pbc:ee,n:O,o:e};return{render:q,hydrate:void 0,createApp:Td(q)}}function ui({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function hn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Fd(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Nc(e,t,n=!1){const r=e.children,s=t.children;if(Q(r)&&Q(s))for(let i=0;i<r.length;i++){const o=r[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Ut(s[i]),a.el=o.el),!n&&a.patchFlag!==-2&&Nc(o,a)),a.type===Gs&&(a.patchFlag===-1&&(a=s[i]=Ut(a)),a.el=o.el),a.type===Ye&&!a.el&&(a.el=o.el)}}function Kd(e){const t=e.slice(),n=[0];let r,s,i,o,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(s=n[n.length-1],e[s]<c){t[r]=s,n.push(r);continue}for(i=0,o=n.length-1;i<o;)a=i+o>>1,e[n[a]]<c?i=a+1:o=a;c<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Ic(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ic(t)}function Yo(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Pc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Pc(t.subTree):null}const Lc=e=>e.__isSuspense;function qd(e,t){t&&t.pendingBranch?Q(e)?t.effects.push(...e):t.effects.push(e):Qh(e)}const Je=Symbol.for("v-fgt"),Gs=Symbol.for("v-txt"),Ye=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),_r=[];let rt=null;function Oe(e=!1){_r.push(rt=e?null:[])}function Wd(){_r.pop(),rt=_r[_r.length-1]||null}let Or=1;function ks(e,t=!1){Or+=e,e<0&&rt&&t&&(rt.hasOnce=!0)}function $c(e){return e.dynamicChildren=Or>0?rt||Fn:null,Wd(),Or>0&&rt&&rt.push(e),e}function Ue(e,t,n,r,s,i){return $c(j(e,t,n,r,s,i,!0))}function _o(e,t,n,r,s){return $c(xe(e,t,n,r,s,!0))}function As(e){return e?e.__v_isVNode===!0:!1}function yn(e,t){return e.type===t.type&&e.key===t.key}const jc=({key:e})=>e??null,ps=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ee(e)||Te(e)||ie(e)?{i:lt,r:e,k:t,f:!!n}:e:null);function j(e,t=null,n=null,r=0,s=null,i=e===Je?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&jc(t),ref:t&&ps(t),scopeId:ic,slotScopeIds:null,children:n,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:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:lt};return a?(vo(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Ee(n)?8:16),Or>0&&!o&&rt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&rt.push(l),l}const xe=Vd;function Vd(e,t=null,n=null,r=0,s=null,i=!1){if((!e||e===yd)&&(e=Ye),As(e)){const a=on(e,t,!0);return n&&vo(a,n),Or>0&&!i&&rt&&(a.shapeFlag&6?rt[rt.indexOf(e)]=a:rt.push(a)),a.patchFlag=-2,a}if(nf(e)&&(e=e.__vccOpts),t){t=Gd(t);let{class:a,style:l}=t;a&&!Ee(a)&&(t.class=Ft(a)),me(l)&&(Fs(l)&&!Q(l)&&(l=je({},l)),t.style=io(l))}const o=Ee(e)?1:Lc(e)?128:cc(e)?64:me(e)?4:ie(e)?2:0;return j(e,t,n,r,s,o,i,!0)}function Gd(e){return e?Fs(e)||Ac(e)?je({},e):e:null}function on(e,t,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?zd(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&jc(c),ref:t&&t.ref?n&&i?Q(i)?i.concat(ps(t)):[i,ps(t)]:ps(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Je?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&on(e.ssContent),ssFallback:e.ssFallback&&on(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&xr(u,l.clone(u)),u}function $n(e=" ",t=0){return xe(Gs,null,e,t)}function mv(e,t){const n=xe(fs,null,e);return n.staticCount=t,n}function Cr(e="",t=!1){return t?(Oe(),_o(Ye,null,e)):xe(Ye,null,e)}function xt(e){return e==null||typeof e=="boolean"?xe(Ye):Q(e)?xe(Je,null,e.slice()):As(e)?Ut(e):xe(Gs,null,String(e))}function Ut(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:on(e)}function vo(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Q(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),vo(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Ac(t)?t._ctx=lt:s===3&<&&(lt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ie(t)?(t={default:t,_ctx:lt},n=32):(t=String(t),r&64?(n=16,t=[$n(t)]):n=8);e.children=t,e.shapeFlag|=n}function zd(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=Ft([t.class,r.class]));else if(s==="style")t.style=io([t.style,r.style]);else if($s(s)){const i=t[s],o=r[s];o&&i!==o&&!(Q(i)&&i.includes(o))?t[s]=i?[].concat(i,o):o:o==null&&i==null&&!js(s)&&(t[s]=o)}else s!==""&&(t[s]=r[s])}return t}function wt(e,t,n,r=null){yt(e,t,7,[n,r])}const Jd=vc();let Yd=0;function Zd(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Jd,i={uid:Yd++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new $l(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Rc(r,s),emitsOptions:wc(r,s),emit:null,emitted:null,propsDefaults:ye,inheritAttrs:r.inheritAttrs,ctx:ye,data:ye,props:ye,attrs:ye,slots:ye,refs:ye,setupState:ye,setupContext:null,suspense:n,suspenseId:n?n.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=t?t.root:i,i.emit=xd.bind(null,i),e.ce&&e.ce(i),i}let Ze=null;const wo=()=>Ze||lt;let Ts,Li;{const e=Bs(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Ts=t("__VUE_INSTANCE_SETTERS__",n=>Ze=n),Li=t("__VUE_SSR_SETTERS__",n=>Nr=n)}const zr=e=>{const t=Ze;return Ts(e),e.scope.on(),()=>{e.scope.off(),Ts(t)}},Zo=()=>{Ze&&Ze.scope.off(),Ts(null)};function Dc(e){return e.vnode.shapeFlag&4}let Nr=!1;function Xd(e,t=!1,n=!1){t&&Li(t);const{props:r,children:s}=e.vnode,i=Dc(e);Ld(e,r,i,t),Md(e,s,n||t);const o=i?Qd(e,t):void 0;return t&&Li(!1),o}function Qd(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,_d);const{setup:r}=n;if(r){Wt();const s=e.setupContext=r.length>1?tf(e):null,i=zr(e),o=Gr(r,e,0,[e.props,s]),a=Rl(o);if(Vt(),i(),(a||e.sp)&&!br(e)&&gc(e),a){if(o.then(Zo,Zo),t)return o.then(l=>{Xo(e,l)}).catch(l=>{Ks(l,e,0)});e.asyncDep=o}else Xo(e,o)}else Mc(e)}function Xo(e,t,n){ie(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:me(t)&&(e.setupState=ec(t)),Mc(e)}function Mc(e,t,n){const r=e.type;e.render||(e.render=r.render||Nt);{const s=zr(e);Wt();try{vd(e)}finally{Vt(),s()}}}const ef={get(e,t){return qe(e,"get",""),e[t]}};function tf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,ef),slots:e.slots,emit:e.emit,expose:t}}function zs(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ec(po(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in yr)return yr[n](e)},has(t,n){return n in t||n in yr}})):e.proxy}function nf(e){return ie(e)&&"__vccOpts"in e}const Be=(e,t)=>zh(e,t,Nr);function Eo(e,t,n){try{ks(-1);const r=arguments.length;return r===2?me(t)&&!Q(t)?As(t)?xe(e,null,[t]):xe(e,t):xe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&As(n)&&(n=[n]),xe(e,t,n))}finally{ks(1)}}const rf="3.5.34";/**
|
|
14
|
-
* @vue/runtime-dom v3.5.34
|
|
15
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
-
* @license MIT
|
|
17
|
-
**/let $i;const Qo=typeof window<"u"&&window.trustedTypes;if(Qo)try{$i=Qo.createPolicy("vue",{createHTML:e=>e})}catch{}const Uc=$i?e=>$i.createHTML(e):e=>e,sf="http://www.w3.org/2000/svg",of="http://www.w3.org/1998/Math/MathML",jt=typeof document<"u"?document:null,ea=jt&&jt.createElement("template"),af={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?jt.createElementNS(sf,e):t==="mathml"?jt.createElementNS(of,e):n?jt.createElement(e,{is:n}):jt.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>jt.createTextNode(e),createComment:e=>jt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>jt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,i){const o=n?n.previousSibling:t.lastChild;if(s&&(s===i||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{ea.innerHTML=Uc(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ea.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Yt="transition",ir="animation",Ir=Symbol("_vtc"),Bc={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},lf=je({},uc,Bc),cf=e=>(e.displayName="Transition",e.props=lf,e),uf=cf((e,{slots:t})=>Eo(ad,hf(e),t)),dn=(e,t=[])=>{Q(e)?e.forEach(n=>n(...t)):e&&e(...t)},ta=e=>e?Q(e)?e.some(t=>t.length>1):e.length>1:!1;function hf(e){const t={};for(const F in e)F in Bc||(t[F]=e[F]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:f=`${n}-leave-to`}=e,g=df(s),b=g&&g[0],E=g&&g[1],{onBeforeEnter:w,onEnter:v,onEnterCancelled:_,onLeave:x,onLeaveCancelled:M,onBeforeAppear:B=w,onAppear:z=v,onAppearCancelled:J=_}=t,L=(F,oe,be,Re)=>{F._enterCancelled=Re,fn(F,oe?u:a),fn(F,oe?c:o),be&&be()},ee=(F,oe)=>{F._isLeaving=!1,fn(F,h),fn(F,f),fn(F,d),oe&&oe()},le=F=>(oe,be)=>{const Re=F?z:v,A=()=>L(oe,F,be);dn(Re,[oe,A]),na(()=>{fn(oe,F?l:i),Pt(oe,F?u:a),ta(Re)||ra(oe,r,b,A)})};return je(t,{onBeforeEnter(F){dn(w,[F]),Pt(F,i),Pt(F,o)},onBeforeAppear(F){dn(B,[F]),Pt(F,l),Pt(F,c)},onEnter:le(!1),onAppear:le(!0),onLeave(F,oe){F._isLeaving=!0;const be=()=>ee(F,oe);Pt(F,h),F._enterCancelled?(Pt(F,d),oa(F)):(oa(F),Pt(F,d)),na(()=>{F._isLeaving&&(fn(F,h),Pt(F,f),ta(x)||ra(F,r,E,be))}),dn(x,[F,be])},onEnterCancelled(F){L(F,!1,void 0,!0),dn(_,[F])},onAppearCancelled(F){L(F,!0,void 0,!0),dn(J,[F])},onLeaveCancelled(F){ee(F),dn(M,[F])}})}function df(e){if(e==null)return null;if(me(e))return[hi(e.enter),hi(e.leave)];{const t=hi(e);return[t,t]}}function hi(e){return fh(e)}function Pt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ir]||(e[Ir]=new Set)).add(t)}function fn(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ir];n&&(n.delete(t),n.size||(e[Ir]=void 0))}function na(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let ff=0;function ra(e,t,n,r){const s=e._endId=++ff,i=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=pf(e,t);if(!o)return r();const c=o+"end";let u=0;const h=()=>{e.removeEventListener(c,d),i()},d=f=>{f.target===e&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),e.addEventListener(c,d)}function pf(e,t){const n=window.getComputedStyle(e),r=g=>(n[g]||"").split(", "),s=r(`${Yt}Delay`),i=r(`${Yt}Duration`),o=sa(s,i),a=r(`${ir}Delay`),l=r(`${ir}Duration`),c=sa(a,l);let u=null,h=0,d=0;t===Yt?o>0&&(u=Yt,h=o,d=i.length):t===ir?c>0&&(u=ir,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?Yt:ir:null,d=u?u===Yt?i.length:l.length:0);const f=u===Yt&&/\b(?:transform|all)(?:,|$)/.test(r(`${Yt}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function sa(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ia(n)+ia(e[r])))}function ia(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function oa(e){return(e?e.ownerDocument:document).body.offsetHeight}function gf(e,t,n){const r=e[Ir];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const aa=Symbol("_vod"),mf=Symbol("_vsh"),bf=Symbol(""),yf=/(?:^|;)\s*display\s*:/;function _f(e,t,n){const r=e.style,s=Ee(n);let i=!1;if(n&&!s){if(t)if(Ee(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&cr(r,a,"")}else for(const o in t)n[o]==null&&cr(r,o,"");for(const o in n){o==="display"&&(i=!0);const a=n[o];a!=null?wf(e,o,!Ee(t)&&t?t[o]:void 0,a)||cr(r,o,a):cr(r,o,"")}}else if(s){if(t!==n){const o=r[bf];o&&(n+=";"+o),r.cssText=n,i=yf.test(n)}}else t&&e.removeAttribute("style");aa in e&&(e[aa]=i?r.display:"",e[mf]&&(r.display="none"))}const la=/\s*!important$/;function cr(e,t,n){if(Q(n))n.forEach(r=>cr(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=vf(e,t);la.test(n)?e.setProperty(an(r),n.replace(la,""),"important"):e[r]=n}}const ca=["Webkit","Moz","ms"],di={};function vf(e,t){const n=di[t];if(n)return n;let r=gt(t);if(r!=="filter"&&r in e)return di[t]=r;r=Cl(r);for(let s=0;s<ca.length;s++){const i=ca[s]+r;if(i in e)return di[t]=i}return t}function wf(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Ee(r)&&n===r}const ua="http://www.w3.org/1999/xlink";function ha(e,t,n,r,s,i=_h(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(ua,t.slice(6,t.length)):e.setAttributeNS(ua,t,n):n==null||i&&!Il(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ut(n)?String(n):n)}function da(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Uc(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Il(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(s||t)}function tn(e,t,n,r){e.addEventListener(t,n,r)}function Ef(e,t,n,r){e.removeEventListener(t,n,r)}const fa=Symbol("_vei");function Sf(e,t,n,r,s=null){const i=e[fa]||(e[fa]={}),o=i[t];if(r&&o)o.value=r;else{const[a,l]=kf(t);if(r){const c=i[t]=Rf(r,s);tn(e,a,c,l)}else o&&(Ef(e,a,o,l),i[t]=void 0)}}const pa=/(?:Once|Passive|Capture)$/;function kf(e){let t;if(pa.test(e)){t={};let r;for(;r=e.match(pa);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):an(e.slice(2)),t]}let fi=0;const Af=Promise.resolve(),Tf=()=>fi||(Af.then(()=>fi=0),fi=Date.now());function Rf(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;yt(xf(r,n.value),t,5,[r])};return n.value=e,n.attached=Tf(),n}function xf(e,t){if(Q(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const ga=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Of=(e,t,n,r,s,i)=>{const o=s==="svg";t==="class"?gf(e,r,o):t==="style"?_f(e,n,r):$s(t)?js(t)||Sf(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Cf(e,t,r,o))?(da(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&ha(e,t,r,o,i,t!=="value")):e._isVueCE&&(Nf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Ee(r)))?da(e,gt(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),ha(e,t,r,o))};function Cf(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&ga(t)&&ie(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return ga(t)&&Ee(n)?!1:t in e}function Nf(e,t){const n=e._def.props;if(!n)return!1;const r=gt(t);return Array.isArray(n)?n.some(s=>gt(s)===r):Object.keys(n).some(s=>gt(s)===r)}const Gn=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Q(t)?n=>hs(t,n):t};function If(e){e.target.composing=!0}function ma(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const qt=Symbol("_assign");function ba(e,t,n){return t&&(e=e.trim()),n&&(e=Us(e)),e}const Hc={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[qt]=Gn(s);const i=r||s.props&&s.props.type==="number";tn(e,t?"change":"input",o=>{o.target.composing||e[qt](ba(e.value,n,i))}),(n||i)&&tn(e,"change",()=>{e.value=ba(e.value,n,i)}),t||(tn(e,"compositionstart",If),tn(e,"compositionend",ma),tn(e,"change",ma))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},o){if(e[qt]=Gn(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Us(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},bv={deep:!0,created(e,t,n){e[qt]=Gn(n),tn(e,"change",()=>{const r=e._modelValue,s=Pr(e),i=e.checked,o=e[qt];if(Q(r)){const a=oo(r,s),l=a!==-1;if(i&&!l)o(r.concat(s));else if(!i&&l){const c=[...r];c.splice(a,1),o(c)}}else if(Zn(r)){const a=new Set(r);i?a.add(s):a.delete(s),o(a)}else o(Fc(e,i))})},mounted:ya,beforeUpdate(e,t,n){e[qt]=Gn(n),ya(e,t,n)}};function ya(e,{value:t,oldValue:n},r){e._modelValue=t;let s;if(Q(t))s=oo(t,r.props.value)>-1;else if(Zn(t))s=t.has(r.props.value);else{if(t===n)return;s=Xn(t,Fc(e,!0))}e.checked!==s&&(e.checked=s)}const yv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=Zn(t);tn(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Us(Pr(o)):Pr(o));e[qt](e.multiple?s?new Set(i):i:i[0]),e._assigning=!0,Qn(()=>{e._assigning=!1})}),e[qt]=Gn(r)},mounted(e,{value:t}){_a(e,t)},beforeUpdate(e,t,n){e[qt]=Gn(n)},updated(e,{value:t}){e._assigning||_a(e,t)}};function _a(e,t){const n=e.multiple,r=Q(t);if(!(n&&!r&&!Zn(t))){for(let s=0,i=e.options.length;s<i;s++){const o=e.options[s],a=Pr(o);if(n)if(r){const l=typeof a;l==="string"||l==="number"?o.selected=t.some(c=>String(c)===String(a)):o.selected=oo(t,a)>-1}else o.selected=t.has(a);else if(Xn(Pr(o),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Pr(e){return"_value"in e?e._value:e.value}function Fc(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Pf=["ctrl","shift","alt","meta"],Lf={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Pf.some(n=>e[`${n}Key`]&&!t.includes(n))},gs=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(s,...i)=>{for(let o=0;o<t.length;o++){const a=Lf[t[o]];if(a&&a(s,t))return}return e(s,...i)})},$f={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ji=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=s=>{if(!("key"in s))return;const i=an(s.key);if(t.some(o=>o===i||$f[o]===i))return e(s)})},jf=je({patchProp:Of},af);let va;function Df(){return va||(va=Bd(jf))}const Mf=(...e)=>{const t=Df().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Bf(r);if(!s)return;const i=t._component;!ie(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,Uf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},t};function Uf(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Bf(e){return Ee(e)?document.querySelector(e):e}/*!
|
|
18
|
-
* pinia v2.3.1
|
|
19
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
-
* @license MIT
|
|
21
|
-
*/let Kc;const Js=e=>Kc=e,qc=Symbol();function Di(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var vr;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(vr||(vr={}));function Hf(){const e=jl(!0),t=e.run(()=>Ae({}));let n=[],r=[];const s=po({install(i){Js(s),s._a=i,i.provide(qc,s),i.config.globalProperties.$pinia=s,r.forEach(o=>n.push(o)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return s}const Wc=()=>{};function wa(e,t,n,r=Wc){e.push(t);const s=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),r())};return!n&&Dl()&&wh(s),s}function Rn(e,...t){e.slice().forEach(n=>{n(...t)})}const Ff=e=>e(),Ea=Symbol(),pi=Symbol();function Mi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],s=e[n];Di(s)&&Di(r)&&e.hasOwnProperty(n)&&!Te(r)&&!Kt(r)?e[n]=Mi(s,r):e[n]=r}return e}const Kf=Symbol();function qf(e){return!Di(e)||!e.hasOwnProperty(Kf)}const{assign:Xt}=Object;function Wf(e){return!!(Te(e)&&e.effect)}function Vf(e,t,n,r){const{state:s,actions:i,getters:o}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=s?s():{});const u=qh(n.state.value[e]);return Xt(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=po(Be(()=>{Js(n);const f=n._s.get(e);return o[d].call(f,f)})),h),{}))}return l=Vc(e,c,t,n,r,!0),l}function Vc(e,t,n={},r,s,i){let o;const a=Xt({actions:{}},n),l={deep:!0};let c,u,h=[],d=[],f;const g=r.state.value[e];!i&&!g&&(r.state.value[e]={});let b;function E(J){let L;c=u=!1,typeof J=="function"?(J(r.state.value[e]),L={type:vr.patchFunction,storeId:e,events:f}):(Mi(r.state.value[e],J),L={type:vr.patchObject,payload:J,storeId:e,events:f});const ee=b=Symbol();Qn().then(()=>{b===ee&&(c=!0)}),u=!0,Rn(h,L,r.state.value[e])}const w=i?function(){const{state:L}=n,ee=L?L():{};this.$patch(le=>{Xt(le,ee)})}:Wc;function v(){o.stop(),h=[],d=[],r._s.delete(e)}const _=(J,L="")=>{if(Ea in J)return J[pi]=L,J;const ee=function(){Js(r);const le=Array.from(arguments),F=[],oe=[];function be(I){F.push(I)}function Re(I){oe.push(I)}Rn(d,{args:le,name:ee[pi],store:M,after:be,onError:Re});let A;try{A=J.apply(this&&this.$id===e?this:M,le)}catch(I){throw Rn(oe,I),I}return A instanceof Promise?A.then(I=>(Rn(F,I),I)).catch(I=>(Rn(oe,I),Promise.reject(I))):(Rn(F,A),A)};return ee[Ea]=!0,ee[pi]=L,ee},x={_p:r,$id:e,$onAction:wa.bind(null,d),$patch:E,$reset:w,$subscribe(J,L={}){const ee=wa(h,J,L.detached,()=>le()),le=o.run(()=>En(()=>r.state.value[e],F=>{(L.flush==="sync"?u:c)&&J({storeId:e,type:vr.direct,events:f},F)},Xt({},l,L)));return ee},$dispose:v},M=Vr(x);r._s.set(e,M);const z=(r._a&&r._a.runWithContext||Ff)(()=>r._e.run(()=>(o=jl()).run(()=>t({action:_}))));for(const J in z){const L=z[J];if(Te(L)&&!Wf(L)||Kt(L))i||(g&&qf(L)&&(Te(L)?L.value=g[J]:Mi(L,g[J])),r.state.value[e][J]=L);else if(typeof L=="function"){const ee=_(L,J);z[J]=ee,a.actions[J]=L}}return Xt(M,z),Xt(he(M),z),Object.defineProperty(M,"$state",{get:()=>r.state.value[e],set:J=>{E(L=>{Xt(L,J)})}}),r._p.forEach(J=>{Xt(M,o.run(()=>J({store:M,app:r._a,pinia:r,options:a})))}),g&&i&&n.hydrate&&n.hydrate(M.$state,g),c=!0,u=!0,M}/*! #__NO_SIDE_EFFECTS__ */function Gc(e,t,n){let r,s;const i=typeof t=="function";typeof e=="string"?(r=e,s=i?n:t):(s=e,r=e.id);function o(a,l){const c=ed();return a=a||(c?ct(qc,null):null),a&&Js(a),a=Kc,a._s.has(r)||(i?Vc(r,t,s,a):Vf(r,s,a)),a._s.get(r)}return o.$id=r,o}/*!
|
|
22
|
-
* vue-router v4.6.4
|
|
23
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
-
* @license MIT
|
|
25
|
-
*/const jn=typeof document<"u";function zc(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Gf(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&zc(e.default)}const pe=Object.assign;function gi(e,t){const n={};for(const r in t){const s=t[r];n[r]=_t(s)?s.map(e):e(s)}return n}const wr=()=>{},_t=Array.isArray;function Sa(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Jc=/#/g,zf=/&/g,Jf=/\//g,Yf=/=/g,Zf=/\?/g,Yc=/\+/g,Xf=/%5B/g,Qf=/%5D/g,Zc=/%5E/g,ep=/%60/g,Xc=/%7B/g,tp=/%7C/g,Qc=/%7D/g,np=/%20/g;function So(e){return e==null?"":encodeURI(""+e).replace(tp,"|").replace(Xf,"[").replace(Qf,"]")}function rp(e){return So(e).replace(Xc,"{").replace(Qc,"}").replace(Zc,"^")}function Ui(e){return So(e).replace(Yc,"%2B").replace(np,"+").replace(Jc,"%23").replace(zf,"%26").replace(ep,"`").replace(Xc,"{").replace(Qc,"}").replace(Zc,"^")}function sp(e){return Ui(e).replace(Yf,"%3D")}function ip(e){return So(e).replace(Jc,"%23").replace(Zf,"%3F")}function op(e){return ip(e).replace(Jf,"%2F")}function Lr(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const ap=/\/$/,lp=e=>e.replace(ap,"");function mi(e,t,n="/"){let r,s={},i="",o="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),i=t.slice(l,a>0?a:t.length),s=e(i.slice(1))),a>=0&&(r=r||t.slice(0,a),o=t.slice(a,t.length)),r=dp(r??t,n),{fullPath:r+i+o,path:r,query:s,hash:Lr(o)}}function cp(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function ka(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function up(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&zn(t.matched[r],n.matched[s])&&eu(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function zn(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function eu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!hp(e[n],t[n]))return!1;return!0}function hp(e,t){return _t(e)?Aa(e,t):_t(t)?Aa(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Aa(e,t){return _t(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function dp(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let i=n.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const Zt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Bi=function(e){return e.pop="pop",e.push="push",e}({}),bi=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function fp(e){if(!e)if(jn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),lp(e)}const pp=/^[^#]+#/;function gp(e,t){return e.replace(pp,"#")+t}function mp(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Ys=()=>({left:window.scrollX,top:window.scrollY});function bp(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=mp(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ta(e,t){return(history.state?history.state.position-t:-1)+e}const Hi=new Map;function yp(e,t){Hi.set(e,t)}function _p(e){const t=Hi.get(e);return Hi.delete(e),t}function vp(e){return typeof e=="string"||e&&typeof e=="object"}function tu(e){return typeof e=="string"||typeof e=="symbol"}let Se=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const nu=Symbol("");Se.MATCHER_NOT_FOUND+"",Se.NAVIGATION_GUARD_REDIRECT+"",Se.NAVIGATION_ABORTED+"",Se.NAVIGATION_CANCELLED+"",Se.NAVIGATION_DUPLICATED+"";function Jn(e,t){return pe(new Error,{type:e,[nu]:!0},t)}function Lt(e,t){return e instanceof Error&&nu in e&&(t==null||!!(e.type&t))}const wp=["params","query","hash"];function Ep(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of wp)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Sp(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(Yc," "),i=s.indexOf("="),o=Lr(i<0?s:s.slice(0,i)),a=i<0?null:Lr(s.slice(i+1));if(o in t){let l=t[o];_t(l)||(l=t[o]=[l]),l.push(a)}else t[o]=a}return t}function Ra(e){let t="";for(let n in e){const r=e[n];if(n=sp(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(_t(r)?r.map(s=>s&&Ui(s)):[r&&Ui(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function kp(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=_t(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Ap=Symbol(""),xa=Symbol(""),Zs=Symbol(""),ko=Symbol(""),Fi=Symbol("");function or(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function en(e,t,n,r,s,i=o=>o()){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(Jn(Se.NAVIGATION_ABORTED,{from:n,to:t})):d instanceof Error?l(d):vp(d)?l(Jn(Se.NAVIGATION_GUARD_REDIRECT,{from:t,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>e.call(r&&r.instances[s],t,n,c));let h=Promise.resolve(u);e.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function yi(e,t,n,r,s=i=>i()){const i=[];for(const o of e)for(const a in o.components){let l=o.components[a];if(!(t!=="beforeRouteEnter"&&!o.instances[a]))if(zc(l)){const c=(l.__vccOpts||l)[t];c&&i.push(en(c,n,r,o,a,s))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=Gf(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[t];return d&&en(d,n,r,o,a,s)()}))}}return i}function Tp(e,t){const n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;o<i;o++){const a=t.matched[o];a&&(e.matched.find(c=>zn(c,a))?r.push(a):n.push(a));const l=e.matched[o];l&&(t.matched.find(c=>zn(c,l))||s.push(l))}return[n,r,s]}/*!
|
|
26
|
-
* vue-router v4.6.4
|
|
27
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
28
|
-
* @license MIT
|
|
29
|
-
*/let Rp=()=>location.protocol+"//"+location.host;function ru(e,t){const{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let o=s.includes(e.slice(i))?e.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),ka(a,"")}return ka(n,e)+r+s}function xp(e,t,n,r){let s=[],i=[],o=null;const a=({state:d})=>{const f=ru(e,location),g=n.value,b=t.value;let E=0;if(d){if(n.value=f,t.value=d,o&&o===g){o=null;return}E=b?d.position-b.position:0}else r(f);s.forEach(w=>{w(n.value,g,{delta:E,type:Bi.pop,direction:E?E>0?bi.forward:bi.back:bi.unknown})})};function l(){o=n.value}function c(d){s.push(d);const f=()=>{const g=s.indexOf(d);g>-1&&s.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(pe({},d.state,{scroll:Ys()}),"")}}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 Oa(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Ys():null}}function Op(e){const{history:t,location:n}=window,r={value:ru(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=e.indexOf("#"),d=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Rp()+e+l;try{t[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),n[u?"replace":"assign"](d)}}function o(l,c){i(l,pe({},t.state,Oa(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=l}function a(l,c){const u=pe({},s.value,t.state,{forward:l,scroll:Ys()});i(u.current,u,!0),i(l,pe({},Oa(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:s,push:a,replace:o}}function Cp(e){e=fp(e);const t=Op(e),n=xp(e,t.state,t.location,t.replace);function r(i,o=!0){o||n.pauseListeners(),history.go(i)}const s=pe({location:"",base:e,go:r,createHref:gp.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}let _n=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Le=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e}(Le||{});const Np={type:_n.Static,value:""},Ip=/[a-zA-Z0-9_]/;function Pp(e){if(!e)return[[]];if(e==="/")return[[Np]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=Le.Static,r=n;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(n===Le.Static?i.push({type:_n.Static,value:c}):n===Le.Param||n===Le.ParamRegExp||n===Le.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:_n.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Le.ParamRegExp){r=n,n=Le.EscapeNext;continue}switch(n){case Le.Static:l==="/"?(c&&h(),o()):l===":"?(h(),n=Le.Param):d();break;case Le.EscapeNext:d(),n=r;break;case Le.Param:l==="("?n=Le.ParamRegExp:Ip.test(l)?d():(h(),n=Le.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Le.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Le.ParamRegExpEnd:u+=l;break;case Le.ParamRegExpEnd:h(),n=Le.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Le.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Ca="[^/]+?",Lp={sensitive:!1,strict:!1,start:!0,end:!0};var Ge=function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e}(Ge||{});const $p=/[.+*?^${}()[\]/\\]/g;function jp(e,t){const n=pe({},Lp,t),r=[];let s=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[Ge.Root];n.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=Ge.Segment+(n.sensitive?Ge.BonusCaseSensitive:0);if(d.type===_n.Static)h||(s+="/"),s+=d.value.replace($p,"\\$&"),f+=Ge.Static;else if(d.type===_n.Param){const{value:g,repeatable:b,optional:E,regexp:w}=d;i.push({name:g,repeatable:b,optional:E});const v=w||Ca;if(v!==Ca){f+=Ge.BonusCustomRegExp;try{`${v}`}catch(x){throw new Error(`Invalid custom RegExp for param "${g}" (${v}): `+x.message)}}let _=b?`((?:${v})(?:/(?:${v}))*)`:`(${v})`;h||(_=E&&c.length<2?`(?:/${_})`:"/"+_),E&&(_+="?"),s+=_,f+=Ge.Dynamic,E&&(f+=Ge.BonusOptional),b&&(f+=Ge.BonusRepeatable),v===".*"&&(f+=Ge.BonusWildcard)}u.push(f)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=Ge.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,n.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]||"",g=i[d-1];h[g.name]=f&&g.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of e){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===_n.Static)u+=f.value;else if(f.type===_n.Param){const{value:g,repeatable:b,optional:E}=f,w=g in c?c[g]:"";if(_t(w)&&!b)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const v=_t(w)?w.join("/"):w;if(!v)if(E)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${g}"`);u+=v}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function Dp(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===Ge.Static+Ge.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Ge.Static+Ge.Segment?1:-1:0}function su(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const i=Dp(r[n],s[n]);if(i)return i;n++}if(Math.abs(s.length-r.length)===1){if(Na(r))return 1;if(Na(s))return-1}return s.length-r.length}function Na(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Mp={strict:!1,end:!0,sensitive:!1};function Up(e,t,n){const r=jp(Pp(e.path),n),s=pe(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Bp(e,t){const n=[],r=new Map;t=Sa(Mp,t);function s(h){return r.get(h)}function i(h,d,f){const g=!f,b=Pa(h);b.aliasOf=f&&f.record;const E=Sa(t,h),w=[b];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const M of x)w.push(Pa(pe({},b,{components:f?f.record.components:b.components,path:M,aliasOf:f?f.record:b})))}let v,_;for(const x of w){const{path:M}=x;if(d&&M[0]!=="/"){const B=d.record.path,z=B[B.length-1]==="/"?"":"/";x.path=d.record.path+(M&&z+M)}if(v=Up(x,d,E),f?f.alias.push(v):(_=_||v,_!==v&&_.alias.push(v),g&&h.name&&!La(v)&&o(h.name)),iu(v)&&l(v),b.children){const B=b.children;for(let z=0;z<B.length;z++)i(B[z],v,f&&f.children[z])}f=f||v}return _?()=>{o(_)}:wr}function o(h){if(tu(h)){const d=r.get(h);d&&(r.delete(h),n.splice(n.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=n.indexOf(h);d>-1&&(n.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return n}function l(h){const d=Kp(h,n);n.splice(d,0,h),h.record.name&&!La(h)&&r.set(h.record.name,h)}function c(h,d){let f,g={},b,E;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw Jn(Se.MATCHER_NOT_FOUND,{location:h});E=f.record.name,g=pe(Ia(d.params,f.keys.filter(_=>!_.optional).concat(f.parent?f.parent.keys.filter(_=>_.optional):[]).map(_=>_.name)),h.params&&Ia(h.params,f.keys.map(_=>_.name))),b=f.stringify(g)}else if(h.path!=null)b=h.path,f=n.find(_=>_.re.test(b)),f&&(g=f.parse(b),E=f.record.name);else{if(f=d.name?r.get(d.name):n.find(_=>_.re.test(d.path)),!f)throw Jn(Se.MATCHER_NOT_FOUND,{location:h,currentLocation:d});E=f.record.name,g=pe({},d.params,h.params),b=f.stringify(g)}const w=[];let v=f;for(;v;)w.unshift(v.record),v=v.parent;return{name:E,path:b,params:g,matched:w,meta:Fp(w)}}e.forEach(h=>i(h));function u(){n.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Ia(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Pa(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Hp(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function Hp(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function La(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Fp(e){return e.reduce((t,n)=>pe(t,n.meta),{})}function Kp(e,t){let n=0,r=t.length;for(;n!==r;){const i=n+r>>1;su(e,t[i])<0?r=i:n=i+1}const s=qp(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function qp(e){let t=e;for(;t=t.parent;)if(iu(t)&&su(e,t)===0)return t}function iu({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function $a(e){const t=ct(Zs),n=ct(ko),r=Be(()=>{const l=Xe(e.to);return t.resolve(l)}),s=Be(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=n.matched;if(!u||!h.length)return-1;const d=h.findIndex(zn.bind(null,u));if(d>-1)return d;const f=ja(l[c-2]);return c>1&&ja(u)===f&&h[h.length-1].path!==f?h.findIndex(zn.bind(null,l[c-2])):d}),i=Be(()=>s.value>-1&&zp(n.params,r.value.params)),o=Be(()=>s.value>-1&&s.value===n.matched.length-1&&eu(n.params,r.value.params));function a(l={}){if(Gp(l)){const c=t[Xe(e.replace)?"replace":"push"](Xe(e.to)).catch(wr);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:Be(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function Wp(e){return e.length===1?e[0]:e}const Vp=ln({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:$a,setup(e,{slots:t}){const n=Vr($a(e)),{options:r}=ct(Zs),s=Be(()=>({[Da(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Da(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&Wp(t.default(n));return e.custom?i:Eo("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},i)}}}),ou=Vp;function Gp(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function zp(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!_t(s)||s.length!==r.length||r.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function ja(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Da=(e,t,n)=>e??t??n,Jp=ln({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=ct(Fi),s=Be(()=>e.route||r.value),i=ct(xa,0),o=Be(()=>{let c=Xe(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Be(()=>s.value.matched[o.value]);ds(xa,Be(()=>o.value+1)),ds(Ap,a),ds(Fi,s);const l=Ae();return En(()=>[l.value,a.value,e.name],([c,u,h],[d,f,g])=>{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||!zn(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(b=>b(c))},{flush:"post"}),()=>{const c=s.value,u=e.name,h=a.value,d=h&&h.components[u];if(!d)return Ma(n.default,{Component:d,route:c});const f=h.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,E=Eo(d,pe({},g,t,{onVnodeUnmounted:w=>{w.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Ma(n.default,{Component:E,route:c})||E}}});function Ma(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ki=Jp;function Yp(e){const t=Bp(e.routes,e),n=e.parseQuery||Sp,r=e.stringifyQuery||Ra,s=e.history,i=or(),o=or(),a=or(),l=Hh(Zt);let c=Zt;jn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=gi.bind(null,O=>""+O),h=gi.bind(null,op),d=gi.bind(null,Lr);function f(O,W){let q,Z;return tu(O)?(q=t.getRecordMatcher(O),Z=W):Z=O,t.addRoute(Z,q)}function g(O){const W=t.getRecordMatcher(O);W&&t.removeRoute(W)}function b(){return t.getRoutes().map(O=>O.record)}function E(O){return!!t.getRecordMatcher(O)}function w(O,W){if(W=pe({},W||l.value),typeof O=="string"){const y=mi(n,O,W.path),S=t.resolve({path:y.path},W),C=s.createHref(y.fullPath);return pe(y,S,{params:d(S.params),hash:Lr(y.hash),redirectedFrom:void 0,href:C})}let q;if(O.path!=null)q=pe({},O,{path:mi(n,O.path,W.path).path});else{const y=pe({},O.params);for(const S in y)y[S]==null&&delete y[S];q=pe({},O,{params:h(y)}),W.params=h(W.params)}const Z=t.resolve(q,W),ce=O.hash||"";Z.params=u(d(Z.params));const p=cp(r,pe({},O,{hash:rp(ce),path:Z.path})),m=s.createHref(p);return pe({fullPath:p,hash:ce,query:r===Ra?kp(O.query):O.query||{}},Z,{redirectedFrom:void 0,href:m})}function v(O){return typeof O=="string"?mi(n,O,l.value.path):pe({},O)}function _(O,W){if(c!==O)return Jn(Se.NAVIGATION_CANCELLED,{from:W,to:O})}function x(O){return z(O)}function M(O){return x(pe(v(O),{replace:!0}))}function B(O,W){const q=O.matched[O.matched.length-1];if(q&&q.redirect){const{redirect:Z}=q;let ce=typeof Z=="function"?Z(O,W):Z;return typeof ce=="string"&&(ce=ce.includes("?")||ce.includes("#")?ce=v(ce):{path:ce},ce.params={}),pe({query:O.query,hash:O.hash,params:ce.path!=null?{}:O.params},ce)}}function z(O,W){const q=c=w(O),Z=l.value,ce=O.state,p=O.force,m=O.replace===!0,y=B(q,Z);if(y)return z(pe(v(y),{state:typeof y=="object"?pe({},ce,y.state):ce,force:p,replace:m}),W||q);const S=q;S.redirectedFrom=W;let C;return!p&&up(r,Z,q)&&(C=Jn(Se.NAVIGATION_DUPLICATED,{to:S,from:Z}),de(Z,Z,!0,!1)),(C?Promise.resolve(C):ee(S,Z)).catch(T=>Lt(T)?Lt(T,Se.NAVIGATION_GUARD_REDIRECT)?T:ae(T):$(T,S,Z)).then(T=>{if(T){if(Lt(T,Se.NAVIGATION_GUARD_REDIRECT))return z(pe({replace:m},v(T.to),{state:typeof T.to=="object"?pe({},ce,T.to.state):ce,force:p}),W||S)}else T=F(S,Z,!0,m,ce);return le(S,Z,T),T})}function J(O,W){const q=_(O,W);return q?Promise.reject(q):Promise.resolve()}function L(O){const W=Ce.values().next().value;return W&&typeof W.runWithContext=="function"?W.runWithContext(O):O()}function ee(O,W){let q;const[Z,ce,p]=Tp(O,W);q=yi(Z.reverse(),"beforeRouteLeave",O,W);for(const y of Z)y.leaveGuards.forEach(S=>{q.push(en(S,O,W))});const m=J.bind(null,O,W);return q.push(m),We(q).then(()=>{q=[];for(const y of i.list())q.push(en(y,O,W));return q.push(m),We(q)}).then(()=>{q=yi(ce,"beforeRouteUpdate",O,W);for(const y of ce)y.updateGuards.forEach(S=>{q.push(en(S,O,W))});return q.push(m),We(q)}).then(()=>{q=[];for(const y of p)if(y.beforeEnter)if(_t(y.beforeEnter))for(const S of y.beforeEnter)q.push(en(S,O,W));else q.push(en(y.beforeEnter,O,W));return q.push(m),We(q)}).then(()=>(O.matched.forEach(y=>y.enterCallbacks={}),q=yi(p,"beforeRouteEnter",O,W,L),q.push(m),We(q))).then(()=>{q=[];for(const y of o.list())q.push(en(y,O,W));return q.push(m),We(q)}).catch(y=>Lt(y,Se.NAVIGATION_CANCELLED)?y:Promise.reject(y))}function le(O,W,q){a.list().forEach(Z=>L(()=>Z(O,W,q)))}function F(O,W,q,Z,ce){const p=_(O,W);if(p)return p;const m=W===Zt,y=jn?history.state:{};q&&(Z||m?s.replace(O.fullPath,pe({scroll:m&&y&&y.scroll},ce)):s.push(O.fullPath,ce)),l.value=O,de(O,W,q,m),ae()}let oe;function be(){oe||(oe=s.listen((O,W,q)=>{if(!De.listening)return;const Z=w(O),ce=B(Z,De.currentRoute.value);if(ce){z(pe(ce,{replace:!0,force:!0}),Z).catch(wr);return}c=Z;const p=l.value;jn&&yp(Ta(p.fullPath,q.delta),Ys()),ee(Z,p).catch(m=>Lt(m,Se.NAVIGATION_ABORTED|Se.NAVIGATION_CANCELLED)?m:Lt(m,Se.NAVIGATION_GUARD_REDIRECT)?(z(pe(v(m.to),{force:!0}),Z).then(y=>{Lt(y,Se.NAVIGATION_ABORTED|Se.NAVIGATION_DUPLICATED)&&!q.delta&&q.type===Bi.pop&&s.go(-1,!1)}).catch(wr),Promise.reject()):(q.delta&&s.go(-q.delta,!1),$(m,Z,p))).then(m=>{m=m||F(Z,p,!1),m&&(q.delta&&!Lt(m,Se.NAVIGATION_CANCELLED)?s.go(-q.delta,!1):q.type===Bi.pop&&Lt(m,Se.NAVIGATION_ABORTED|Se.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),le(Z,p,m)}).catch(wr)}))}let Re=or(),A=or(),I;function $(O,W,q){ae(O);const Z=A.list();return Z.length?Z.forEach(ce=>ce(O,W,q)):console.error(O),Promise.reject(O)}function te(){return I&&l.value!==Zt?Promise.resolve():new Promise((O,W)=>{Re.add([O,W])})}function ae(O){return I||(I=!O,be(),Re.list().forEach(([W,q])=>O?q(O):W()),Re.reset()),O}function de(O,W,q,Z){const{scrollBehavior:ce}=e;if(!jn||!ce)return Promise.resolve();const p=!q&&_p(Ta(O.fullPath,0))||(Z||!q)&&history.state&&history.state.scroll||null;return Qn().then(()=>ce(O,W,p)).then(m=>m&&bp(m)).catch(m=>$(m,O,W))}const fe=O=>s.go(O);let He;const Ce=new Set,De={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:E,getRoutes:b,resolve:w,options:e,push:x,replace:M,go:fe,back:()=>fe(-1),forward:()=>fe(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:A.add,isReady:te,install(O){O.component("RouterLink",ou),O.component("RouterView",Ki),O.config.globalProperties.$router=De,Object.defineProperty(O.config.globalProperties,"$route",{enumerable:!0,get:()=>Xe(l)}),jn&&!He&&l.value===Zt&&(He=!0,x(s.location).catch(Z=>{}));const W={};for(const Z in Zt)Object.defineProperty(W,Z,{get:()=>l.value[Z],enumerable:!0});O.provide(Zs,De),O.provide(ko,Xl(W)),O.provide(Fi,l);const q=O.unmount;Ce.add(O),O.unmount=function(){Ce.delete(O),Ce.size<1&&(c=Zt,oe&&oe(),oe=null,l.value=Zt,He=!1,I=!1),q()}}};function We(O){return O.reduce((W,q)=>W.then(()=>L(q)),Promise.resolve())}return De}function au(){return ct(Zs)}function lu(e){return ct(ko)}function Xs(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Zp(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}const Xp=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Ao extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Qp extends Ao{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ua extends Ao{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Ba extends Ao{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var qi;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(qi||(qi={}));class eg{constructor(t,{headers:n={},customFetch:r,region:s=qi.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=Xp(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Zp(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const g=new URL(`${this.url}/${n}`);f&&f!=="any"&&(d["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let b;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",b=c):typeof c=="string"?(d["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(d["Content-Type"]="application/json",b=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?b=JSON.stringify(c):b=c;let E=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(E=o.signal,u.addEventListener("abort",()=>o.abort())):E=o.signal);const w=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:b,signal:E}).catch(M=>{throw new Qp(M)}),v=w.headers.get("x-relay-error");if(v&&v==="true")throw new Ua(w);if(!w.ok)throw new Ba(w);let _=((s=w.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return _==="application/json"?x=yield w.json():_==="application/octet-stream"||_==="application/pdf"?x=yield w.blob():_==="text/event-stream"?x=w:_==="multipart/form-data"?x=yield w.formData():x=yield w.text(),{data:x,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof Ba||a instanceof Ua?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const cu=3,Ha=e=>Math.min(1e3*2**e,3e4),tg=[520,503],uu=["GET","HEAD","OPTIONS"];var ng=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Fa(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",s),n()},e);function s(){clearTimeout(r),n()}t==null||t.addEventListener("abort",s)})}function rg(e,t,n,r){return!(!r||n>=cu||!uu.includes(e)||!tg.includes(t))}var sg=class{constructor(e){var t,n,r,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=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 r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(n.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:n.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!uu.includes(n.method))throw h;if(n.retryEnabled&&o<cu){const d=Ha(o);o++,await Fa(d,n.signal);continue}throw h}if(rg(n.method,u.status,o,n.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:Ha(o);await u.text(),o++,await Fa(d,n.signal);continue}return await n.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,g,b;const v=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",_=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(g=o==null?void 0:o.name)!==null&&g!==void 0?g:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
30
|
-
|
|
31
|
-
Caused by: ${(b=h==null?void 0:h.name)!==null&&b!==void 0?b:"Error"}: ${v}`,_&&(l+=` (${_})`),h!=null&&h.stack&&(l+=`
|
|
32
|
-
${h.stack}`)}else{var E;l=(E=o==null?void 0:o.stack)!==null&&E!==void 0?E:""}const w=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)",w>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${w} 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)",w>this.urlLengthLimit&&(c+=`. Your request URL is ${w} 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(e,t)}async processResponse(e){var t=this;let n=null,r=null,s=null,i=e.status,o=e.statusText;if(e.ok){var a,l;if(t.method!=="HEAD"){var c;const d=await e.text();d===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=t.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(r=[],n=null,i=200,o="OK")}catch{e.status===404&&u===""?(i=204,o="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new ng(n)}return{success:n===null,error:n,data:r,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},ig=class extends sg{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const Ka=new RegExp("[,()]");var Dn=class extends ig{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Ka.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Ka.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},og=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new Dn({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.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 Dn({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),r&&l.append("Prefer",`count=${r}`),s||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.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 Dn({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Dn({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Dn({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function $r(e){"@babel/helpers - typeof";return $r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$r(e)}function ag(e,t){if($r(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if($r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lg(e){var t=ag(e,"string");return $r(t)=="symbol"?t:t+""}function cg(e,t,n){return(t=lg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function es(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qa(Object(n),!0).forEach(function(r){cg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qa(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ug=class hu{constructor(t,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const l=s??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 g=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,es(es({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",g)})}return l(c,es(es({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new og(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new hu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(n).some(u);h?(a="POST",c=n):r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(a="POST",c=n);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 Dn({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 hg{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.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"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
33
|
-
import ws from "ws"
|
|
34
|
-
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 t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
|
|
35
|
-
|
|
36
|
-
Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const dg="2.105.4",fg=`realtime-js/${dg}`,pg="1.0.0",du="2.0.0",gg=du,mg=1e4,bg=100,nn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},fu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Wi={connecting:"connecting",closing:"closing",closed:"closed"};class yg{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var s,i;const o=t.topic,a=(s=t.ref)!==null&&s!==void 0?s:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.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 g=new DataView(f),b=0;g.setUint8(b++,this.KINDS.userBroadcastPush),g.setUint8(b++,l.length),g.setUint8(b++,a.length),g.setUint8(b++,o.length),g.setUint8(b++,c.length),g.setUint8(b++,h.length),g.setUint8(b++,n),Array.from(l,w=>g.setUint8(b++,w.charCodeAt(0))),Array.from(a,w=>g.setUint8(b++,w.charCodeAt(0))),Array.from(o,w=>g.setUint8(b++,w.charCodeAt(0))),Array.from(c,w=>g.setUint8(b++,w.charCodeAt(0))),Array.from(h,w=>g.setUint8(b++,w.charCodeAt(0)));var E=new Uint8Array(f.byteLength+r.byteLength);return E.set(new Uint8Array(f),0),E.set(new Uint8Array(r),f.byteLength),E.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,i,o,a,l]=r;return n({join_ref:s,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,s)}}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(t.slice(l,l+s));l=l+s;const u=r.decode(t.slice(l,l+i));l=l+i;const h=r.decode(t.slice(l,l+o));l=l+o;const d=t.slice(l,t.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.decode(d)):d,g={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(g.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}var _e;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(_e||(_e={}));const Wa=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=_g(o,e,t,s),i),{}):{}},_g=(e,t,n,r)=>{const s=t.find(a=>a.name===e),i=s==null?void 0:s.type,o=n[e];return i&&!r.includes(i)?pu(i,o):Vi(o)},pu=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Sg(t,n)}switch(e){case _e.bool:return vg(t);case _e.float4:case _e.float8:case _e.int2:case _e.int4:case _e.int8:case _e.numeric:case _e.oid:return wg(t);case _e.json:case _e.jsonb:return Eg(t);case _e.timestamp:return kg(t);case _e.abstime:case _e.date:case _e.daterange:case _e.int4range:case _e.int8range:case _e.money:case _e.reltime:case _e.text:case _e.time:case _e.timestamptz:case _e.timetz:case _e.tsrange:case _e.tstzrange:return Vi(t);default:return Vi(t)}},Vi=e=>e,vg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},wg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Eg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Sg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>pu(t,a))}return e},kg=e=>typeof e=="string"?e.replace(" ","T"):e,gu=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var Er=e=>typeof e=="function"?e:function(){return e},Ag=typeof self<"u"?self:null,Mn=typeof window<"u"?window:null,Tt=Ag||Mn||globalThis,Tg="2.0.0",Rg=1e4,xg=1e3,Ot={connecting:0,open:1,closing:2,closed:3},Qe={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Dt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Gi={longpoll:"longpoll",websocket:"websocket"},Og={complete:4},zi="base64url.bearer.phx.",ts=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},mu=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Cg=class{constructor(e,t,n){this.state=Qe.closed,this.topic=e,this.params=Er(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ts(this,Dt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new mu(()=>{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=Qe.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=Qe.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Qe.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=Qe.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 ts(this,Dt.leave,Er({}),this.timeout).send(),this.state=Qe.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Dt.reply,(r,s)=>{this.trigger(this.replyEventName(s),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Qe.closed,this.bindings=[]}onClose(e){this.on(Dt.close,e)}onError(e){return this.on(Dt.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ts(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Qe.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Dt.close,"leave")},n=new ts(this,Dt.leave,Er({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Qe.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Qe.closed}isErrored(){return this.state===Qe.errored}isJoined(){return this.state===Qe.joined}isJoining(){return this.state===Qe.joining}isLeaving(){return this.state===Qe.leaving}},Rs=class{static request(e,t,n,r,s,i,o){if(Tt.XDomainRequest){let a=new Tt.XDomainRequest;return this.xdomainRequest(a,e,t,r,s,i,o)}else if(Tt.XMLHttpRequest){let a=new Tt.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,i,o)}else{if(Tt.fetch&&Tt.AbortController)return this.fetchRequest(e,t,n,r,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,s,i,o){let a={method:e,headers:n,body:r},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Tt.fetch(t,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(e,t,n,r,s,i,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,i,o,a){e.open(t,n,!0),e.timeout=i;for(let[l,c]of Object.entries(r))e.setRequestHeader(l,c);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Og.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,i=e[r];typeof i=="object"?n.push(this.serialize(i,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Ng=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let s=0;s<r;s++)t+=String.fromCharCode(n[s]);return btoa(t)},xn=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(zi)&&(this.authToken=atob(t[1].slice(zi.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Ot.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Gi.websocket),"$1/"+Gi.longpoll)}endpointURL(){return Rs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Ot.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ot.open||this.readyState===Ot.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:s}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ot.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 ${n}`)}})}send(e){typeof e!="string"&&(e=Ng(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
|
|
37
|
-
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=Ot.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let i,o=()=>{this.reqs.delete(i),r()};i=Rs.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},Ig=class ur{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=ur.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=ur.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=ur.syncDiff(this.state,s,i,o),a())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return ur.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,s){let i=this.clone(t),o={},a={};return this.map(i,(l,c)=>{n[l]||(a[l]=c)}),this.map(n,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(b=>b.phx_ref),d=u.metas.map(b=>b.phx_ref),f=c.metas.filter(b=>d.indexOf(b.phx_ref)<0),g=u.metas.filter(b=>h.indexOf(b.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),g.length>0&&(a[l]=this.clone(u),a[l].metas=g)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},r,s)}static syncDiff(t,n,r,s){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=t[a];if(t[a]=this.clone(l),c){let u=t[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);t[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=t[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),s(a,c,l),c.metas.length===0&&delete t[a]}),t}static list(t,n){return n||(n=function(r,s){return s}),this.map(t,(r,s)=>n(r,s))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},ns={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,i,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:i}=e,o=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),Array.from(t,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))),Array.from(r,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(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+r));o=o+r;let l=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+i));o=o+i;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+r));a=a+r;let c=n.decode(e.slice(a,a+s));a=a+s;let u=n.decode(e.slice(a,a+i));a=a+i;let h=n.decode(e.slice(a,a+o));a=a+o;let d=e.slice(a,e.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Dt.reply,payload:f}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+r));i=i+r;let a=n.decode(e.slice(i,i+s));i=i+s;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Pg=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Rg,this.transport=t.transport||Tt.WebSocket||xn,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Tt&&Tt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=ns.encode.bind(ns),this.defaultDecoder=ns.decode.bind(ns),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==xn?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Mn&&Mn.addEventListener&&(Mn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Mn.addEventListener("pageshow",s=>{r===this.connectClock&&(r=null,this.connect())}),Mn.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Er(t.params||{}),this.endPoint=`${e}/${Gi.websocket}`,this.vsn=t.vsn||Tg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new mu(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return xn}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Rs.appendParams(Rs.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Er(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==xn?this.connectWithFallback(xn,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case xn:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${zi}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,s,i,o=this.transportName(e),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),i=this.onError(l=>{this.log("transport","error",l),r&&!n&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let l=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),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(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),xg,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Ot.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Dt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ot.connecting:return"connecting";case Ot.open:return"open";case Ot.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new Cg(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${s})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:s,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(n,r,s,o)&&l.trigger(r,s,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Sr{constructor(t,n){const r=$g(n);this.presence=new Ig(t.getChannel(),r),this.presence.onJoin((s,i,o)=>{const a=Sr.onJoinPayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Sr.onLeavePayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Sr.transformState(this.presence.state)}static transformState(t){return t=Lg(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const s=t[r];return n[r]=ms(s),n},{})}static onJoinPayload(t,n,r){const s=Va(n),i=ms(r);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,n,r){const s=Va(n),i=ms(r);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function ms(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function Lg(e){return JSON.parse(JSON.stringify(e))}function $g(e){return(e==null?void 0:e.events)&&{events:e.events}}function Va(e){return e!=null&&e.metas?ms(e):[]}var Ga;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Ga||(Ga={}));class jg{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Sr(this.channel.channelAdapter,n)}}function Dg(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class Mg{constructor(t,n,r){const s=Ug(r);this.channel=t.getSocket().channel(n,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let s;try{s=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>bg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===nn.joined}isJoined(){return this.state===nn.joined}isJoining(){return this.state===nn.joining}isClosed(){return this.state===nn.closed}isLeaving(){return this.state===nn.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Ug(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var za;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(za||(za={}));var Hn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Hn||(Hn={}));var Mt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Mt||(Mt={}));class kr{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var s,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new Mg(this.socket.socketAdapter,t,this.params),this.presence=new jg(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=gu(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Hn.PRESENCE]&&this.bindings[Hn.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=>{t==null||t(Mt.CHANNEL_ERROR,Dg(f))}),this._onClose(()=>t==null?void 0:t(Mt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(Mt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=nn.errored;const g=Object.values(f).join(", ")||"error";t==null||t(Mt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{t==null||t(Mt.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const s=this.bindings.postgres_changes,i=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=t&&t[a];if(f&&f.event===c&&kr.isFilterValueEqual(f.schema,u)&&kr.isFilterValueEqual(f.table,h)&&kr.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=nn.errored,n==null||n(Mt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=nn.errored&&n&&n(Mt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Hn.PRESENCE||t===Hn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==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:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=r.timeout)!==null&&s!==void 0?s: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(t,n={}){var r,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,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,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.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(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_on(t,n,r){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,r),o={type:s,filter:n,callback:r,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var s,i,o,a,l,c,u;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===t.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,g=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=n.ids)===null||o===void 0?void 0:o.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((a=n.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=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,n){const{close:r,error:s,leave:i,join:o}=fu;return n&&[r,s,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const s=n.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Wa(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Wa(t.columns,t.old_record)),n}}class Bg{constructor(t,n){this.socket=new Pg(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Wi.connecting}isDisconnecting(){return this.socket.connectionState()==Wi.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Ja={HEARTBEAT_INTERVAL:25e3},Hg=[1e3,2e3,5e3,1e4],Fg=1e4;function Kg(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function qg(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Kg()}const Wg=`
|
|
38
|
-
addEventListener("message", (e) => {
|
|
39
|
-
if (e.data.event === "start") {
|
|
40
|
-
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
41
|
-
}
|
|
42
|
-
});`;class Vg{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;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 yg,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),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const s=this._initializeOptions(n);this.socketAdapter=new Bg(t,s),this.httpEndpoint=gu(t),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n}
|
|
43
|
-
|
|
44
|
-
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
45
|
-
|
|
46
|
-
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
47
|
-
Option 2: Install and provide the "ws" package:
|
|
48
|
-
|
|
49
|
-
npm install ws
|
|
50
|
-
|
|
51
|
-
import ws from "ws"
|
|
52
|
-
const client = new RealtimeClient(url, {
|
|
53
|
-
...options,
|
|
54
|
-
transport: ws
|
|
55
|
-
})`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const s=await r.unsubscribe();return r.teardown(),s}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||Wi.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new kr(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:fg};n&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(fu.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([Wg],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,s,i,o,a,l,c,u,h,d,f;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const g={};g.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:mg,g.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:Ja.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:Ja.HEARTBEAT_INTERVAL),g.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:hg.getWebSocketConstructor(),g.params=t==null?void 0:t.params,g.logger=t==null?void 0:t.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),g.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:qg(),g.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:v=>Hg[v-1]||Fg;let b,E;const w=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:gg;switch(w){case pg:b=(v,_)=>_(JSON.stringify(v)),E=(v,_)=>_(JSON.parse(v));break;case du:b=this.serializer.encode.bind(this.serializer),E=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=w,g.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:b,g.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:E,g.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,g.params=Object.assign(Object.assign({},g.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var jr=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Gg(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function zg(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Jg(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=Gg(e.baseUrl,r,s),l=await zg(e.auth),c=await t(a,{method:n,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,g=f==null?void 0:f.error;throw new jr((g==null?void 0:g.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function rs(e){return e.join("")}var Yg=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:rs(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${rs(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${rs(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${rs(e.namespace)}`}),!0}catch(t){if(t instanceof jr&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof jr&&n.status===409)return;throw n}}};function On(e){return e.join("")}var Zg=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${On(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof jr&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof jr&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Xg=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Jg({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new Yg(this.client,t),this.tableOps=new Zg(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function Dr(e){"@babel/helpers - typeof";return Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(e)}function Qg(e,t){if(Dr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function em(e){var t=Qg(e,"string");return Dr(t)=="symbol"?t:t+""}function tm(e,t,n){return(t=em(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ya(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function se(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ya(Object(n),!0).forEach(function(r){tm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ya(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qs=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ei(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Ji=class extends Qs{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return se({},super.toJSON())}},bu=class extends Qs{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function xs(e,t,n){const r=se({},e),s=t.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===s&&delete r[i];return r[s]=n,r}function nm(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const rm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),sm=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Yi=e=>{if(Array.isArray(e))return e.map(n=>Yi(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=Yi(r)}),t},im=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),Za=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},om=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new Ji(Za(o),i,a,r))}).catch(()=>{const o=i+"";t(new Ji(s.statusText||`HTTP ${i} error`,i,o,r))})}else t(new bu(Za(e),e,r))},am=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return se(se({},s),n);if(sm(r)){var i;const o=(t==null?void 0:t.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=xs(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(r)}else s.body=r;return t!=null&&t.duplex&&(s.duplex=t.duplex),se(se({},s),n)};async function ar(e,t,n,r,s,i,o){return new Promise((a,l)=>{e(n,am(t,r,s,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.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=>om(c,l,r,o))})}function yu(e="storage"){return{get:async(t,n,r,s)=>ar(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>ar(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>ar(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>ar(t,"HEAD",n,se(se({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>ar(t,"DELETE",n,s,i,r,e)}}const lm=yu("storage"),{get:Mr,post:dt,put:Zi,head:cm,remove:To}=lm,nt=yu("vectors");var nr=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=nm(t),this.fetch=rm(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=xs(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(ei(n))return{data:null,error:n};throw n}}},um=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(ei(t))return{data:null,error:t};throw t}}};let _u;_u=Symbol.toStringTag;var hm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[_u]="BlobDownloadBuilder",this.promise=null}asStream(){return new um(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(ei(t))return{data:null,error:t};throw t}}};const dm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Xa={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var fm=class extends nr{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=se(se({},Xa),r);let a=se(se({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=xs(a,d,f);const c=s._removeEmptyFolders(t),u=s._getFinalPath(c),h=await(e=="PUT"?Zi:dt)(s.fetch,`${s.url}/object/${u}`,i,se({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let l;const c=se(se({},Xa),r);let u=se(se({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=xs(u,d,f);return{path:i,fullPath:(await Zi(s.fetch,a.toString(),l,se({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=se({},n.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await dt(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new Qs("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await dt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await dt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await dt(r.fetch,`${r.url}/object/sign/${s}`,se({expiresIn:t},i?{transform:n.transform}:{}),{headers:r.headers});const a=new URLSearchParams;n!=null&&n.download&&a.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&a.set("cacheNonce",String(n.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await dt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return s.map(a=>se(se({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),o=this._getFinalPath(e),a=()=>Mr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new hm(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>Yi(await Mr(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await cm(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(ei(s)){var r;const i=s instanceof Ji?s.status:s instanceof bu?(r=s.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const s=r.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await To(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=se(se(se({},dm),t),{},{prefix:e||""});return await dt(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=se({},e);return await dt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const pm="2.105.4",Jr={"X-Client-Info":`storage-js/${pm}`};var gm=class extends nr{constructor(e,t={},n,r){const s=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=se(se({},Jr),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Mr(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Mr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await dt(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await Zi(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await dt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await To(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},mm=class extends nr{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=se(se({},Jr),t);super(r,s,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await dt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Mr(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await To(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!im(e))throw new Qs("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 n=new Xg({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},bm=class extends nr{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=se(se({},Jr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await nt.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await nt.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},ym=class extends nr{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=se(se({},Jr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},_m=class extends nr{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=se(se({},Jr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await nt.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},vm=class extends _m{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new wm(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},wm=class extends bm{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Em(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Em=class extends ym{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,se(se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Sm=class extends gm{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new fm(this.url,this.headers,e,this.fetch)}get vectors(){return new vm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new mm(this.url+"/iceberg",this.headers,this.fetch)}};const vu="2.105.4",Un=30*1e3,Xi=3,_i=Xi*Un,km="http://localhost:9999",Am="supabase.auth.token",Tm={"X-Client-Info":`gotrue-js/${vu}`},Qi="X-Supabase-Api-Version",wu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Rm=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,xm=10*60*1e3;class Ur extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function K(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Om extends Ur{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function Cm(e){return K(e)&&e.name==="AuthApiError"}class pt extends Ur{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Jt extends Ur{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class Me extends Jt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function ss(e){return K(e)&&e.name==="AuthSessionMissingError"}class Cn extends Jt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class is extends Jt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class os extends Jt{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Nm(e){return K(e)&&e.name==="AuthImplicitGrantRedirectError"}class Qa extends Jt{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Im extends Jt{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class eo extends Jt{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function vi(e){return K(e)&&e.name==="AuthRetryableFetchError"}class el extends Jt{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class to extends Jt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tl=`
|
|
56
|
-
\r=`.split(""),Pm=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<tl.length;t+=1)e[tl[t].charCodeAt(0)]=-2;for(let t=0;t<Os.length;t+=1)e[Os[t].charCodeAt(0)]=t;return e})();function nl(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Os[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Os[r]),t.queuedBits-=6}}function Eu(e,t,n){const r=Pm[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function rl(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{jm(o,r,n)};for(let o=0;o<e.length;o+=1)Eu(e.charCodeAt(o),s,i);return t.join("")}function Lm(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function $m(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}Lm(r,t)}}function jm(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Wn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Eu(e.charCodeAt(s),n,r);return new Uint8Array(t)}function Dm(e){const t=[];return $m(e,n=>t.push(n)),new Uint8Array(t)}function vn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>nl(s,n,r)),nl(null,n,r),t.join("")}function Mm(e){return Math.round(Date.now()/1e3)+e}function Um(){return Symbol("auth-callback")}const Ke=()=>typeof window<"u"&&typeof document<"u",pn={tested:!1,writable:!1},Su=()=>{if(!Ke())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(pn.tested)return pn.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),pn.tested=!0,pn.writable=!0}catch{pn.tested=!0,pn.writable=!1}return pn.writable};function Bm(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const ku=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Hm=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Bn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},gn=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},Fe=async(e,t)=>{await e.removeItem(t)};class ti{constructor(){this.promise=new ti.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ti.promiseConstructor=Promise;function as(e){const t=e.split(".");if(t.length!==3)throw new to("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!Rm.test(t[r]))throw new to("JWT not in base64url format");return{header:JSON.parse(rl(t[0])),payload:JSON.parse(rl(t[1])),signature:Wn(t[2]),raw:{header:t[0],payload:t[1]}}}async function Fm(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function Km(e,t){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function qm(e){return("0"+e.toString(16)).substr(-2)}function Wm(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,qm).join("")}async function Vm(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Gm(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Vm(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Nn(e,t,n=!1){const r=Wm();let s=r;n&&(s+="/recovery"),await Bn(e,`${t}-code-verifier`,s);const i=await Gm(r);return[i,r===i?"plain":"s256"]}const zm=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Jm(e){const t=e.headers.get(Qi);if(!t||!t.match(zm))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Ym(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Zm(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Xm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function $t(e){if(!Xm.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ht(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function wi(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Qm(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function sl(e){return JSON.parse(JSON.stringify(e))}const bn=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},eb=[502,503,504,520,521,522,523,524,530];async function il(e){var t;if(!Hm(e))throw new eo(bn(e),0);if(eb.includes(e.status))throw new eo(bn(e),e.status);let n;try{n=await e.json()}catch(i){throw new pt(bn(i),i)}let r;const s=Jm(e);if(s&&s.getTime()>=wu["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new el(bn(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Me}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new el(bn(n),e.status,n.weak_password.reasons);throw new Om(bn(n),e.status||500,r)}const tb=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function G(e,t,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[Qi]||(i[Qi]=wu["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await nb(e,t,n+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function nb(e,t,n,r,s,i){const o=tb(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new eo(bn(l),0)}if(a.ok||await il(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await il(l)}}function at(e){var t;let n=null;ib(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Mm(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function ol(e){const t=at(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function rn(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function rb(e){return{data:e,error:null}}function sb(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=Xs(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function al(e){return e}function ib(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ei=["global","local","others"];class ob{constructor({url:t="",headers:n={},fetch:r,experimental:s}){this.url=t,this.headers=n,this.fetch=ku(r),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=Ei[0]){if(Ei.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ei.join(", ")}`);try{return await G(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(K(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await G(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:rn})}catch(r){if(K(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=Xs(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await G(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:sb,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(K(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await G(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:rn})}catch(n){if(K(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await G(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:al});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(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(g.split(";")[1].split("=")[1]);c[`${E}Page`]=b}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(K(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){$t(t);try{return await G(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:rn})}catch(n){if(K(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){$t(t);try{return await G(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:rn})}catch(r){if(K(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){$t(t);try{return await G(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:rn})}catch(r){if(K(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){$t(t.userId);try{const{data:n,error:r}=await G(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(K(n))return{data:null,error:n};throw n}}async _deleteFactor(t){$t(t.userId),$t(t.id);try{return{data:await G(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(K(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await G(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:al});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(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(g.split(";")[1].split("=")[1]);c[`${E}Page`]=b}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(K(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await G(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await G(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await G(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(K(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await G(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(K(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await G(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await G(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var s;return{data:{providers:(s=r==null?void 0:r.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(n){if(K(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await G(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await G(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await G(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(K(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await G(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(K(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){ht(this.experimental),$t(t.userId);try{return await G(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(K(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){ht(this.experimental),$t(t.userId),$t(t.passkeyId);try{return await G(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(K(n))return{data:null,error:n};throw n}}}function ll(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Et={debug:!!(globalThis&&Su()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Au extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class cl extends Au{}async function ab(e,t,n){Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{r.abort(),Et.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(s),Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new cl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Et.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(s),await n()}})}catch(i){if(t>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(r.signal.aborted)return Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}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(e,{mode:"exclusive",steal:!0},async o=>{if(o){Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Et.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new cl(`Lock "${e}" was released because another request stole it`)}throw i}}function lb(){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 Tu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function cb(e){return parseInt(e,16)}function ub(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function hb(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)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(!((t=e.statement)===null||t===void 0)&&t.includes(`
|
|
57
|
-
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=Tu(e.address),g=u?`${u}://${r}`:r,b=e.statement?`${e.statement}
|
|
58
|
-
`:"",E=`${g} wants you to sign in with your Ethereum account:
|
|
59
|
-
${f}
|
|
60
|
-
|
|
61
|
-
${b}`;let w=`URI: ${h}
|
|
62
|
-
Version: ${d}
|
|
63
|
-
Chain ID: ${n}${o?`
|
|
64
|
-
Nonce: ${o}`:""}
|
|
65
|
-
Issued At: ${i.toISOString()}`;if(s&&(w+=`
|
|
66
|
-
Expiration Time: ${s.toISOString()}`),a&&(w+=`
|
|
67
|
-
Not Before: ${a.toISOString()}`),l&&(w+=`
|
|
68
|
-
Request ID: ${l}`),c){let v=`
|
|
69
|
-
Resources:`;for(const _ of c){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);v+=`
|
|
70
|
-
- ${_}`}w+=v}return`${E}
|
|
71
|
-
${w}`}class Ie extends Error{constructor({message:t,code:n,cause:r,name:s}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Cs extends Ie{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function db({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ie({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ie({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Ie({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ie({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Ie({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Ie({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Ie({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Ie({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(Ru(o)){if(i.rp.id!==o)return new Ie({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ie({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Ie({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Ie({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Ie({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function fb({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ie({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Ie({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Ru(r)){if(n.rpId!==r)return new Ie({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ie({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Ie({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Ie({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class pb{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const no=new pb;function ul(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=Xs(e,["challenge","user","excludeCredentials"]),i=Wn(t).buffer,o=Object.assign(Object.assign({},n),{id:Wn(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Wn(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function hl(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=Xs(e,["challenge","allowCredentials"]),s=Wn(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Wn(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function dl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:vn(new Uint8Array(e.response.attestationObject)),clientDataJSON:vn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function fl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:vn(new Uint8Array(s.authenticatorData)),clientDataJSON:vn(new Uint8Array(s.clientDataJSON)),signature:vn(new Uint8Array(s.signature)),userHandle:s.userHandle?vn(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Ru(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ns(){var e,t;return!!(Ke()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function xu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Cs("Browser returned unexpected credential type",t)}:{data:null,error:new Cs("Empty credential response",t)}}catch(t){return{data:null,error:db({error:t,options:e})}}}async function Ou(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Cs("Browser returned unexpected credential type",t)}:{data:null,error:new Cs("Empty credential response",t)}}catch(t){return{data:null,error:fb({error:t,options:e})}}}const gb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},mb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Is(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const a=r[i];t(a)?r[i]=Is(a,o):r[i]=Is(o)}else r[i]=o}return r}function bb(e,t){return Is(gb,e,t||{})}function yb(e,t){return Is(mb,e,t||{})}class _b{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const c=s??no.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,g=((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}:${g}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=bb(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await xu({publicKey:u,signal:c});return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=yb(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Ou(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return K(a)?{data:null,error:a}:{data:null,error:new pt("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new Ur("rpId is required for WebAuthn authentication")};try{if(!Ns())return{data:null,error:new pt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return K(o)?{data:null,error:o}:{data:null,error:new pt("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new Ur("rpId is required for WebAuthn registration")};try{if(!Ns())return{data:null,error:new pt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});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===t&&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:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return K(o)?{data:null,error:o}:{data:null,error:new pt("Unexpected error in register",o)}}}}lb();const vb={url:km,storageKey:Am,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Tm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function pl(e,t,n){return await n()}const In={};class Br{get jwks(){var t,n;return(n=(t=In[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){In[this.storageKey]=Object.assign(Object.assign({},In[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=In[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){In[this.storageKey]=Object.assign(Object.assign({},In[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s,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({},vb),t);if(this.storageKey=o.storageKey,this.instanceID=(n=Br.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Br.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ke()){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=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new ob({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=ku(o.fetch),this.lock=o.lock||pl,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&&Ke()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=ab:this.lock=pl,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 _b(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:Su()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ll(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=ll(this.memoryStorage)),Ke()&&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(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${vu}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),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 t;try{let n={},r="none";if(Ke()&&(n=Bm(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ke()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Nm(i)){const l=(t=i.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return K(n)?this._returnResult({error:n}):this._returnResult({error:new pt("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:at}),{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(K(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,s;try{let i;if("email"in t){const{email:u,password:h,options:d}=t;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await Nn(this.storage,this.storageKey)),i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:g},xform:at})}else if("phone"in t){const{phone:u,password:h,options:d}=t;i=await G(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:at})}else throw new is("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Fe(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 Fe(this.storage,`${this.storageKey}-code-verifier`),K(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await G(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:ol})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await G(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:ol})}else throw new is("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new Cn;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(K(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,i,o,a,l,c,u,h,d;let f,g;if("message"in t)f=t.message,g=t.signature;else{const{chain:b,wallet:E,statement:w,options:v}=t;let _;if(Ke())if(typeof E=="object")_=E;else{const L=window;if("ethereum"in L&&typeof L.ethereum=="object"&&"request"in L.ethereum&&typeof L.ethereum.request=="function")_=L.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 E!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=E}const x=new URL((n=v==null?void 0:v.url)!==null&&n!==void 0?n:window.location.href),M=await _.request({method:"eth_requestAccounts"}).then(L=>L).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!M||M.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const B=Tu(M[0]);let z=(r=v==null?void 0:v.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!z){const L=await _.request({method:"eth_chainId"});z=cb(L)}const J={domain:x.host,address:B,statement:w,uri:x.href,version:"1",chainId:z,nonce:(s=v==null?void 0:v.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=v==null?void 0:v.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=v==null?void 0:v.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=v==null?void 0:v.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=v==null?void 0:v.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=v==null?void 0:v.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=hb(J),g=await _.request({method:"personal_sign",params:[ub(f),B]})}try{const{data:b,error:E}=await G(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=t.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:at});if(E)throw E;if(!b||!b.session||!b.user){const w=new Cn;return this._returnResult({data:{user:null,session:null},error:w})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:E})}catch(b){if(K(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(t){var n,r,s,i,o,a,l,c,u,h,d,f;let g,b;if("message"in t)g=t.message,b=t.signature;else{const{chain:E,wallet:w,statement:v,options:_}=t;let x;if(Ke())if(typeof w=="object")x=w;else{const B=window;if("solana"in B&&typeof B.solana=="object"&&("signIn"in B.solana&&typeof B.solana.signIn=="function"||"signMessage"in B.solana&&typeof B.solana.signMessage=="function"))x=B.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 w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const M=new URL((n=_==null?void 0:_.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in x&&x.signIn){const B=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:M.host,uri:M.href}),v?{statement:v}:null));let z;if(Array.isArray(B)&&B[0]&&typeof B[0]=="object")z=B[0];else if(B&&typeof B=="object"&&"signedMessage"in B&&"signature"in B)z=B;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in z&&"signature"in z&&(typeof z.signedMessage=="string"||z.signedMessage instanceof Uint8Array)&&z.signature instanceof Uint8Array)g=typeof z.signedMessage=="string"?z.signedMessage:new TextDecoder().decode(z.signedMessage),b=z.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${M.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${M.href}`,`Issued At: ${(s=(r=_==null?void 0:_.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(u=_==null?void 0:_.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(z=>`- ${z}`)]:[]].join(`
|
|
72
|
-
`);const B=await x.signMessage(new TextEncoder().encode(g),"utf8");if(!B||!(B instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=B}}try{const{data:E,error:w}=await G(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:vn(b)},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:at});if(w)throw w;if(!E||!E.session||!E.user){const v=new Cn;return this._returnResult({data:{user:null,session:null},error:v})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:w})}catch(E){if(K(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(t){const n=await gn(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Im;const{data:i,error:o}=await G(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:at});if(await Fe(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Cn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=t,a=await G(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:at}),{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 Cn;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(n){if(K(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,i,o;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Nn(this.storage,this.storageKey));const{error:h}=await G(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!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 t){const{phone:a,options:l}=t,{data:c,error:u}=await G(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new is("You must provide either an email or phone number.")}catch(a){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,r;try{let s,i;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await G(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:at});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(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(K(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Nn(this.storage,this.storageKey));const c=await G(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:rb});return!((i=c.data)===null||i===void 0)&&i.url&&Ke()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(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 t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Me;const{error:s}=await G(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(K(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:i}=t,{error:o}=await G(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,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 t){const{phone:r,type:s,options:i}=t,{data:o,error:a}=await G(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new is("You must provide either an email or phone number and a type")}catch(n){if(K(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}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 t=null;const n=await gn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<_i:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await gn(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=wi()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Qm(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await G(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:rn}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Me}:await G(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:rn})})}catch(n){if(K(n))return ss(n)&&(await this._removeSession(),await Fe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Me;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await Nn(this.storage,this.storageKey));const{data:c,error:u}=await G(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:rn});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(r){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Me;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=as(t.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.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(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(K(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new Me;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(K(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var r;try{if(!Ke())throw new os("No browser detected.");if(t.error||t.error_description||t.error_code)throw new os(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Qa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new os("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new Qa("No code detected.");const{data:_,error:x}=await this._exchangeCodeForSession(t.code);if(x)throw x;const M=new URL(window.location.href);return M.searchParams.delete("code"),window.history.replaceState(window.history.state,"",M.toString()),{data:{session:_.session,redirectType:(r=_.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=t;if(!o||!l||!a||!u)throw new os("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const g=f-h;g*1e3<=Un&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${d}s`);const b=f-d;h-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,f,h):h-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,f,h);const{data:E,error:w}=await this._getUser(o);if(w)throw w;const v={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:t.type},error:null})}catch(s){if(K(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await gn(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!ss(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(Cm(a)&&(a.status===404||a.status===401||a.status===403)||ss(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await Fe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=Um(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),ss(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Nn(this.storage,this.storageKey,!0));try{return await G(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=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`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await G(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(s)throw s;return Ke()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(K(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=t,h=await G(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r: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:at}),{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 Cn}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await Fe(this.storage,`${this.storageKey}-code-verifier`),K(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await G(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await Km(async s=>(s>0&&await Fm(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await G(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:at})),(s,i)=>{const o=200*Math.pow(2,s);return i&&vi(i)&&Date.now()+o-r<Un})}catch(r){if(this._debug(n,"error",r),K(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Ke()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await gn(this.storage,this.storageKey);if(s&&this.userStorage){let o=await gn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Bn(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:wi()}else if(s&&!s.user&&!s.user){const o=await gn(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Fe(this.storage,this.storageKey+"-user"),await Bn(this.storage,this.storageKey,s)):s.user=wi()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<_i;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${_i}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),vi(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Me;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ti;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Me;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(s,"error",i),K(i)){const o={data:null,error:i};return vi(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Fe(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Bn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=sl(s);await Bn(this.storage,this.storageKey,i)}else{const s=sl(n);await Bn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Fe(this.storage,this.storageKey),await Fe(this.storage,this.storageKey+"-code-verifier"),await Fe(this.storage,this.storageKey+"-user"),this.userStorage&&await Fe(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ke()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Un);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/Un);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Un}ms, refresh threshold is ${Xi} ticks`),s<=Xi&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Au)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ke()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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(t,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Nn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?this._returnResult({data:null,error:i}):await G(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await G(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?dl(t.webauthn.credential_response):fl(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await G(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.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(n){if(K(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await G(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.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:ul(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:hl(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,s,i;if(t)try{const{payload:f}=as(t);let g=null;f.aal&&(g=f.aal);let b=g;const{data:{user:E},error:w}=await this.getUser(t);if(w)return this._returnResult({data:null,error:w});((r=(n=E==null?void 0:E.factors)===null||n===void 0?void 0:n.filter(x=>x.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(b="aal2");const _=f.amr||[];return{data:{currentLevel:g,nextLevel:b,currentAuthenticationMethods:_},error:null}}catch(f){if(K(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}=as(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.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(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await G(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Me})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Me});const o=await G(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ke()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(K(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Me});const o=await G(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ke()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(K(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await G(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Me})})}catch(t){if(K(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await G(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Me})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(a=>a.kid===t);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===t),r&&this.jwks_cached_at+xm>s)return r;const{data:i,error:o}=await G(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=as(r);n!=null&&n.allowExpired||Ym(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Zm(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,Dm(`${a}.${l}`)))throw new to("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(K(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var n,r,s;ht(this.experimental);try{if(!Ns())return this._returnResult({data:null,error:new pt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=hl(i.options),l=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:no.createNewAbortSignal(),{data:c,error:u}=await Ou({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new pt("WebAuthn ceremony failed",null)});const h=fl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(K(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,r;ht(this.experimental);try{if(!Ns())return this._returnResult({data:null,error:new pt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=ul(s.options),a=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:no.createNewAbortSignal(),{data:l,error:c}=await xu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new pt("WebAuthn ceremony failed",null)});const u=dl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(K(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){ht(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Me});const{data:s,error:i}=await G(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(K(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){ht(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Me});const{data:i,error:o}=await G(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;ht(this.experimental);try{const{data:r,error:s}=await G(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:r,error:null})}catch(r){if(K(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){ht(this.experimental);try{const{data:n,error:r}=await G(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:at});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){ht(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Me});const{data:s,error:i}=await G(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(K(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){ht(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Me});const{data:i,error:o}=await G(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){ht(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Me});const{error:i}=await G(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(K(n))return this._returnResult({data:null,error:n});throw n}}}Br.nextInstanceID={};const wb=Br,Eb="2.105.4";let hr="";typeof Deno<"u"?hr="deno":typeof document<"u"?hr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?hr="react-native":hr="node";const Sb={"X-Client-Info":`supabase-js-${hr}/${Eb}`},kb={headers:Sb},Ab={schema:"public"},Tb={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Rb={};function Hr(e){"@babel/helpers - typeof";return Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(e)}function xb(e,t){if(Hr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ob(e){var t=xb(e,"string");return Hr(t)=="symbol"?t:t+""}function Cb(e,t,n){return(t=Ob(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ke(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gl(Object(n),!0).forEach(function(r){Cb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const Nb=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Ib=()=>Headers,Pb=(e,t,n)=>{const r=Nb(n),s=Ib();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let c=new s(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,ke(ke({},o),{},{headers:c}))}};function Lb(e){return e.endsWith("/")?e:e+"/"}function $b(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:l,auth:c,realtime:u,global:h}=t,d={db:ke(ke({},l),s),auth:ke(ke({},c),i),realtime:ke(ke({},u),o),storage:{},global:ke(ke(ke({},h),a),{},{headers:ke(ke({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}function jb(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Lb(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Db=class extends wb{constructor(e){super(e)}},Mb=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=jb(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Ab,realtime:Rb,auth:ke(ke({},Tb),{},{storageKey:o}),global:kb},l=$b(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},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=Pb(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(ke({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 ug(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 Sm(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new eg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,g){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Db({url:this.authUrl.href,headers:ke(ke({},b),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(E=>E.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Vg(this.realtimeUrl.href,ke(ke({},e),{},{params:ke(ke({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Ub=(e,t,n)=>new Mb(e,t,n);function Bb(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Bb()&&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 ls=null,cs=null;async function Cu(){if(ls)return ls;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.json();return ls={authEnabled:t.authEnabled,supabaseUrl:t.supabaseUrl??void 0,supabaseAnonKey:t.supabaseAnonKey??void 0},ls}catch{return{authEnabled:!1}}}async function dr(){if(cs)return cs;const e=await Cu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(cs=Ub(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),cs)}const Yr=Gc("auth",()=>{const e=Ae(null),t=Ae(null),n=Ae(!1),r=Ae(!1),s=Ae(!1),i=Be(()=>!r.value||!!e.value);let o=!1;async function a(){var g;const d=await dr();if(!d){t.value=null,e.value=null;return}const{data:f}=await d.auth.getSession();t.value=f.session??null,e.value=((g=f.session)==null?void 0:g.user)??null}async function l(d=!1){if(n.value&&!d)return;s.value=!0;const f=await Cu();if(r.value=!!f.authEnabled,!r.value){n.value=!0,s.value=!1;return}await a();const g=await dr();g&&!o&&(g.auth.onAuthStateChange((b,E)=>{t.value=E,e.value=(E==null?void 0:E.user)??null,n.value=!0}),o=!0),n.value=!0,s.value=!1}async function c(d,f){s.value=!0;try{const g=await dr();if(!g)throw new Error("Authentication is disabled for this workspace.");const{error:b}=await g.auth.signInWithPassword({email:d,password:f});if(b)throw b;await a()}finally{s.value=!1,n.value=!0}}async function u(){if(!r.value){e.value=null,t.value=null;return}const d=await dr();await(d==null?void 0:d.auth.signOut()),e.value=null,t.value=null}async function h(){var d,f;return r.value?(n.value||await l(),(d=t.value)!=null&&d.access_token?t.value.access_token:(await a(),((f=t.value)==null?void 0:f.access_token)??null)):null}return{user:e,session:t,initialized:n,authEnabled:r,loading:s,isAuthenticated:i,init:l,signIn:c,signOut:u,getAccessToken:h}}),Hb={class:"relative z-10 px-4 pt-4"},Fb={class:"panel-shell flex items-center justify-between gap-4 rounded-[22px] border-b border-cyan/40 bg-surface/90 px-5 py-3 shadow-glow"},Kb={class:"min-w-0"},qb={class:"flex items-center gap-3"},Wb={class:"font-mono text-[11px] uppercase tracking-[0.35em] text-cyan"},Vb={class:"mt-2 flex flex-wrap items-end gap-x-4 gap-y-1"},Gb={class:"text-2xl font-semibold tracking-tight text-white"},zb={class:"font-mono text-xs text-mist"},Jb={class:"flex items-center gap-3"},Yb={class:"hidden rounded-2xl border border-line bg-black/25 px-3 py-2 text-right font-mono text-[11px] text-mist xl:block"},Zb={class:"text-cyan"},Xb={class:"flex items-center gap-3 rounded-2xl border border-line bg-panel px-3 py-2"},Qb={class:"flex h-9 w-9 items-center justify-center rounded-xl border border-violet/40 bg-violet/10 font-mono text-xs font-semibold text-violet"},ey={class:"hidden min-w-0 sm:block"},ty={class:"max-w-44 truncate text-sm text-white"},ny=ln({__name:"AppHeader",emits:["open-command","open-chat"],setup(e,{emit:t}){const n=t,r=lu(),s=au(),i=Yr(),o=Ae(new Date);let a=0;const l=Be(()=>String(r.meta.title??"Mission Control")),c=Be(()=>String(r.meta.subtitle??"Operational surface")),u=Be(()=>{var d,f;return((f=(d=i.user)==null?void 0:d.email)==null?void 0:f.slice(0,2).toUpperCase())??"IO"});async function h(){await i.signOut(),s.push("/login")}return er(()=>{a=window.setInterval(()=>{o.value=new Date},1e3)}),tr(()=>{window.clearInterval(a)}),(d,f)=>{var g;return Oe(),Ue("header",Hb,[j("div",Fb,[j("div",Kb,[j("div",qb,[j("span",Wb,we(Xe(r).name),1),f[2]||(f[2]=j("span",{class:"rounded-full border border-violet/40 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.25em] text-violet"},"live surface",-1))]),j("div",Vb,[j("h1",Gb,we(l.value),1),j("p",zb,we(c.value),1)])]),j("div",Jb,[j("div",Yb,[j("div",null,we(o.value.toLocaleDateString()),1),j("div",Zb,we(o.value.toLocaleTimeString()),1)]),j("button",{class:"rounded-2xl border border-line bg-panel px-3 py-2 font-mono text-xs text-mist transition hover:border-cyan hover:text-white",onClick:f[0]||(f[0]=b=>n("open-command"))}," ⌘K Command "),j("button",{class:"rounded-2xl border border-cyan/40 bg-cyan/10 px-3 py-2 font-mono text-xs text-cyan transition hover:bg-cyan/20",onClick:f[1]||(f[1]=b=>n("open-chat"))}," Quick chat "),j("div",Xb,[j("div",Qb,we(u.value),1),j("div",ey,[j("div",ty,we(((g=Xe(i).user)==null?void 0:g.email)??"guest mode"),1),f[3]||(f[3]=j("div",{class:"font-mono text-[11px] uppercase tracking-[0.24em] text-mist"},"operator",-1))]),j("button",{class:"rounded-xl border border-line px-2 py-1 font-mono text-[11px] text-mist transition hover:border-danger hover:text-danger",onClick:h}," sign out ")])])])])}}});function Nu(e){return/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`}async function Fr(e,t){const n=Yr(),r=Nu(e),s=new Headers(t==null?void 0:t.headers),i=await n.getAccessToken();i&&s.set("Authorization",`Bearer ${i}`);const o=await fetch(r,{...t,headers:s});if(o.status===401&&n.authEnabled){const a=await dr();if(a){const{data:l,error:c}=await a.auth.refreshSession();if(l.session){const u=new Headers(t==null?void 0:t.headers);return u.set("Authorization",`Bearer ${l.session.access_token}`),fetch(r,{...t,headers:u})}c||await n.signOut()}}return o}async function ry(e){const n=await Yr().getAccessToken(),r=Nu(e),s=/^https?:\/\//i.test(r)?new URL(r):new URL(r,window.location.origin);return n&&s.searchParams.set("token",n),s.toString()}const sy={class:"hidden h-full w-[290px] shrink-0 flex-col border-r border-line bg-[#09090d]/95 px-4 py-4 lg:flex"},iy={class:"mt-4 rounded-[22px] border border-line bg-surface/90 px-4 py-3 font-mono text-[11px] uppercase tracking-[0.22em] text-mist"},oy={class:"flex items-center justify-between"},ay={class:"mt-3 grid grid-cols-2 gap-3 text-[10px] tracking-[0.18em]"},ly={class:"rounded-2xl border border-line bg-panel px-3 py-2"},cy={class:"mt-1 text-lg text-white"},uy={class:"rounded-2xl border border-line bg-panel px-3 py-2"},hy={class:"mt-1 text-lg text-white"},dy={class:"mt-4 min-h-0 flex-1 overflow-y-auto pr-1"},fy={class:"mb-3 px-2 font-mono text-[10px] uppercase tracking-[0.3em] text-mist"},py={class:"space-y-2"},gy=["onClick"],my={class:"min-w-0 flex-1"},by={class:"block text-sm font-medium text-white"},yy={class:"block font-mono text-[11px] uppercase tracking-[0.2em] text-mist"},_y={key:0,class:"rounded-full border border-danger/50 bg-danger/10 px-2 py-1 font-mono text-[10px] text-danger"},vy=ln({__name:"AppSidebar",setup(e){const t=[{title:"runtime",items:[{to:"/chat",label:"Chat",code:"CH",tone:"border-cyan/50 text-cyan"},{to:"/activity",label:"Activity",code:"AC",tone:"border-violet/50 text-violet"},{to:"/feed",label:"Feed",code:"FD",tone:"border-danger/50 text-danger",badge:"feed"},{to:"/inbox",label:"Inbox",code:"IB",tone:"border-success/50 text-success",badge:"inbox"}]},{title:"systems",items:[{to:"/squads",label:"Squads",code:"SQ",tone:"border-violet/50 text-violet"},{to:"/schedules",label:"Schedules",code:"CR",tone:"border-cyan/50 text-cyan"},{to:"/skills",label:"Skills",code:"SK",tone:"border-success/50 text-success"},{to:"/wiki",label:"Wiki",code:"WK",tone:"border-line-bright text-slate-200"},{to:"/mcp",label:"MCP",code:"MP",tone:"border-danger/50 text-danger"}]}],n=Ae(0),r=Ae(0),s=Ae("syncing");let i=0;function o(l){return l.badge==="feed"?n.value:l.badge==="inbox"?r.value:0}async function a(){try{const[l,c]=await Promise.all([Fr("/api/feed/count"),Fr("/api/inbox/count")]);n.value=l.ok?Number((await l.json()).count??0):0,r.value=c.ok?Number((await c.json()).count??0):0,s.value="linked"}catch{s.value="degraded"}}return er(()=>{a(),i=window.setInterval(a,15e3)}),tr(()=>{window.clearInterval(i)}),(l,c)=>(Oe(),Ue("aside",sy,[c[3]||(c[3]=j("div",{class:"rounded-[26px] border border-cyan/35 bg-gradient-to-br from-cyan/14 via-panel to-panel px-4 py-5 shadow-glow"},[j("div",{class:"font-mono text-[11px] uppercase tracking-[0.4em] text-cyan"},"io / mission control"),j("div",{class:"mt-3 text-3xl font-semibold text-white"},"Operator Deck"),j("div",{class:"mt-2 max-w-xs text-sm leading-6 text-mist"},"Dense control surface for squads, automations, docs, and live agent streams.")],-1)),j("div",iy,[j("div",oy,[c[0]||(c[0]=j("span",null,"link state",-1)),j("span",{class:Ft(s.value==="linked"?"text-success":s.value==="degraded"?"text-danger":"text-cyan")},we(s.value),3)]),j("div",ay,[j("div",ly,[c[1]||(c[1]=j("div",{class:"text-mist"},"feed",-1)),j("div",cy,we(n.value),1)]),j("div",uy,[c[2]||(c[2]=j("div",{class:"text-mist"},"inbox",-1)),j("div",hy,we(r.value),1)])])]),j("div",dy,[(Oe(),Ue(Je,null,Es(t,u=>j("section",{key:u.title,class:"mb-6"},[j("div",fy,we(u.title),1),j("div",py,[(Oe(!0),Ue(Je,null,Es(u.items,h=>(Oe(),_o(Xe(ou),{key:h.to,to:h.to,custom:""},{default:mo(({isActive:d,navigate:f})=>[j("button",{class:Ft(["group flex w-full items-center gap-3 rounded-[20px] border px-3 py-3 text-left transition",d?"border-cyan bg-cyan/10 shadow-glow":"border-line bg-panel hover:border-bright hover:bg-elevated"]),onClick:f},[j("span",{class:Ft(["flex h-11 w-11 items-center justify-center rounded-2xl border bg-black/20 font-mono text-xs font-semibold",h.tone])},we(h.code),3),j("span",my,[j("span",by,we(h.label),1),j("span",yy,"/"+we(h.label.toLowerCase()),1)]),o(h)?(Oe(),Ue("span",_y,we(o(h)),1)):Cr("",!0)],10,gy)]),_:2},1032,["to"]))),128))])])),64))])]))}}),wy={class:"border-t border-line/80 bg-[#09090d]/95 px-4 py-2"},Ey={class:"flex flex-wrap items-center gap-x-6 gap-y-2 font-mono text-[11px] uppercase tracking-[0.18em] text-mist"},Sy={class:"flex items-center gap-2"},ky={class:"text-slate-100"},Ay={class:"text-cyan"},Ty={class:"text-violet"},Ry={class:"text-white"},xy={class:"text-success"},Oy=ln({__name:"AppStatusBar",setup(e){const t=Ae({}),n=Ae("syncing");let r=0;function s(o){const a=Math.max(0,Math.floor(o??0)),l=Math.floor(a/3600),c=Math.floor(a%3600/60),u=a%60;return[l,c,u].map(h=>String(h).padStart(2,"0")).join(":")}async function i(){try{const o=await Fr("/api/status");if(!o.ok)throw new Error("status failed");t.value=await o.json(),n.value="online"}catch{n.value="offline"}}return er(()=>{i(),r=window.setInterval(i,2e4)}),tr(()=>{window.clearInterval(r)}),(o,a)=>(Oe(),Ue("footer",wy,[j("div",Ey,[j("div",Sy,[j("span",{class:Ft(["h-2 w-2 rounded-full",n.value==="online"?"animate-pulse-line bg-success":n.value==="offline"?"bg-danger":"bg-cyan"])},null,2),j("span",null,we(n.value),1)]),j("div",null,[a[0]||(a[0]=$n("version ",-1)),j("span",ky,we(t.value.version??"—"),1)]),j("div",null,[a[1]||(a[1]=$n("skills ",-1)),j("span",Ay,we(t.value.skills??"—"),1)]),j("div",null,[a[2]||(a[2]=$n("squads ",-1)),j("span",Ty,we(t.value.squads??"—"),1)]),j("div",null,[a[3]||(a[3]=$n("instances ",-1)),j("span",Ry,we(t.value.instances??"—"),1)]),j("div",null,[a[4]||(a[4]=$n("uptime ",-1)),j("span",xy,we(s(t.value.uptime)),1)])])]))}}),Cy={class:"w-full max-w-2xl rounded-[28px] border border-cyan/35 bg-[#09090d]/96 shadow-glow"},Ny={class:"border-b border-line px-5 py-4"},Iy={class:"max-h-[420px] overflow-y-auto p-3"},Py=["onClick"],Ly={class:"block text-sm font-medium text-white"},$y={class:"block font-mono text-[11px] uppercase tracking-[0.18em] text-mist"},jy={key:0,class:"rounded-2xl border border-dashed border-line px-4 py-10 text-center font-mono text-xs uppercase tracking-[0.25em] text-mist"},Dy=ln({__name:"CommandBar",props:{open:{type:Boolean}},emits:["close","open-chat"],setup(e,{emit:t}){const n=e,r=t,s=au(),i=Ae(""),o=Ae(null),a=[{label:"Open chat",detail:"Jump to /chat",to:"/chat"},{label:"View squads",detail:"Project crews, branches, and decisions",to:"/squads"},{label:"Inspect activity",detail:"Task list and live event stream",to:"/activity"},{label:"Review feed",detail:"Notifications and durable updates",to:"/feed"},{label:"Open inbox",detail:"Operator-facing inbox messages",to:"/inbox"},{label:"Browse schedules",detail:"Cron schedules and run history",to:"/schedules"},{label:"Browse skills",detail:"Installed skill markdown",to:"/skills"},{label:"Browse wiki",detail:"Workspace docs and reference",to:"/wiki"},{label:"Manage MCP",detail:"Server transports and toggles",to:"/mcp"},{label:"Open quick chat",detail:"Floating prompt surface",action:"chat"}],l=Be(()=>{const u=i.value.trim().toLowerCase();return u?a.filter(h=>`${h.label} ${h.detail}`.toLowerCase().includes(u)):a});function c(u){u.action==="chat"?r("open-chat"):u.to&&s.push(u.to),r("close")}return En(()=>n.open,async u=>{var h;u&&(i.value="",await Qn(),(h=o.value)==null||h.focus())}),(u,h)=>e.open?(Oe(),Ue("div",{key:0,class:"absolute inset-0 z-40 flex items-start justify-center bg-black/60 px-4 py-20 backdrop-blur-sm",onClick:h[3]||(h[3]=gs(d=>r("close"),["self"]))},[j("div",Cy,[j("div",Ny,[h[4]||(h[4]=j("div",{class:"font-mono text-[10px] uppercase tracking-[0.35em] text-cyan"},"command bar",-1)),oc(j("input",{ref_key:"input",ref:o,"onUpdate:modelValue":h[0]||(h[0]=d=>i.value=d),class:"mt-3 w-full border-none bg-transparent text-2xl font-semibold text-white placeholder:text-slate-500",placeholder:"route, surface, or action",onKeydown:[h[1]||(h[1]=ji(gs(d=>r("close"),["prevent"]),["esc"])),h[2]||(h[2]=ji(gs(d=>l.value[0]&&c(l.value[0]),["prevent"]),["enter"]))]},null,544),[[Hc,i.value]])]),j("div",Iy,[(Oe(!0),Ue(Je,null,Es(l.value,d=>(Oe(),Ue("button",{key:d.label,class:"mb-2 flex w-full items-center justify-between rounded-2xl border border-line bg-panel px-4 py-3 text-left transition hover:border-cyan hover:bg-cyan/10",onClick:f=>c(d)},[j("span",null,[j("span",Ly,we(d.label),1),j("span",$y,we(d.detail),1)]),h[5]||(h[5]=j("span",{class:"font-mono text-[10px] uppercase tracking-[0.25em] text-cyan"},"run",-1))],8,Py))),128)),l.value.length?Cr("",!0):(Oe(),Ue("div",jy," no command match "))])])])):Cr("",!0)}}),My=Gc("chat",()=>{const e=Ae([]),t=Ae(!1);let n=null,r=null;function s(d){return e.value.length?d?e.value.find(f=>f.id===d)??null:e.value[e.value.length-1]??null:null}function i(d){const f={id:d.id??crypto.randomUUID(),createdAt:d.createdAt??new Date().toISOString(),streaming:d.streaming??!1,role:d.role,text:d.text,kind:d.kind};return e.value.push(f),f}function o(d,f){const g=s(f??r??void 0);g&&(g.text+=d)}function a(d,f){const g=s(f??r??void 0);g&&(g.streaming=d)}function l(){n==null||n.close(),n=null,r=null,t.value=!1}async function c(d,f=[]){const g=d.trim();if(!g)return;l(),i({role:"user",text:g});const b=i({role:"assistant",text:"",streaming:!0});r=b.id,t.value=!0;const E=await ry("/api/events");n=new EventSource(E),n.onmessage=v=>{try{const _=JSON.parse(v.data);if(_.type==="delta"){o(String(_.text??""),b.id);return}if(_.type==="done"){a(!1,b.id),l();return}_.type==="feed"&&i({role:"system",kind:"feed",text:[_.title,_.body].filter(Boolean).join(`
|
|
73
|
-
`)||JSON.stringify(_,null,2)})}catch{o(v.data,b.id)}},n.onerror=()=>{b.text||(b.text="stream disconnected"),a(!1,b.id),l()};const w=await Fr("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:g,attachments:f})});if(!w.ok){const v=await w.text();b.text=v||`Request failed (${w.status})`,a(!1,b.id),l()}}async function u(){await Fr("/api/orchestrator/abort",{method:"POST"}).catch(()=>null),a(!1),l()}function h(){l(),e.value=[]}return{messages:e,isLoading:t,addMessage:i,appendToLast:o,setLastStreaming:a,sendMessage:c,abortRun:u,clearMessages:h}});function Uy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Iu(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Iu(n)}),e}class ml{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Pu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function sn(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const By="</span>",bl=e=>!!e.scope,Hy=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class Fy{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Pu(t)}openNode(t){if(!bl(t))return;const n=Hy(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){bl(t)&&(this.buffer+=By)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const yl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Ro{constructor(){this.rootNode=yl(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=yl({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Ro._collapse(n)}))}}class Ky extends Ro{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Fy(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Kr(e){return e?typeof e=="string"?e:e.source:null}function Lu(e){return An("(?=",e,")")}function qy(e){return An("(?:",e,")*")}function Wy(e){return An("(?:",e,")?")}function An(...e){return e.map(n=>Kr(n)).join("")}function Vy(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function xo(...e){return"("+(Vy(e).capture?"":"?:")+e.map(r=>Kr(r)).join("|")+")"}function $u(e){return new RegExp(e.toString()+"|").exec("").length-1}function Gy(e,t){const n=e&&e.exec(t);return n&&n.index===0}const zy=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Oo(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Kr(r),o="";for(;i.length>0;){const a=zy.exec(i);if(!a){o+=i;break}o+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+s):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}const Jy=/\b\B/,ju="[a-zA-Z]\\w*",Co="[a-zA-Z_]\\w*",Du="\\b\\d+(\\.\\d+)?",Mu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Uu="\\b(0b[01]+)",Yy="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Zy=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=An(t,/.*\b/,e.binary,/\b.*/)),sn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},qr={begin:"\\\\[\\s\\S]",relevance:0},Xy={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[qr]},Qy={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[qr]},e_={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ni=function(e,t,n={}){const r=sn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=xo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:An(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},t_=ni("//","$"),n_=ni("/\\*","\\*/"),r_=ni("#","$"),s_={scope:"number",begin:Du,relevance:0},i_={scope:"number",begin:Mu,relevance:0},o_={scope:"number",begin:Uu,relevance:0},a_={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[qr,{begin:/\[/,end:/\]/,relevance:0,contains:[qr]}]},l_={scope:"title",begin:ju,relevance:0},c_={scope:"title",begin:Co,relevance:0},u_={begin:"\\.\\s*"+Co,relevance:0},h_=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var us=Object.freeze({__proto__:null,APOS_STRING_MODE:Xy,BACKSLASH_ESCAPE:qr,BINARY_NUMBER_MODE:o_,BINARY_NUMBER_RE:Uu,COMMENT:ni,C_BLOCK_COMMENT_MODE:n_,C_LINE_COMMENT_MODE:t_,C_NUMBER_MODE:i_,C_NUMBER_RE:Mu,END_SAME_AS_BEGIN:h_,HASH_COMMENT_MODE:r_,IDENT_RE:ju,MATCH_NOTHING_RE:Jy,METHOD_GUARD:u_,NUMBER_MODE:s_,NUMBER_RE:Du,PHRASAL_WORDS_MODE:e_,QUOTE_STRING_MODE:Qy,REGEXP_MODE:a_,RE_STARTERS_RE:Yy,SHEBANG:Zy,TITLE_MODE:l_,UNDERSCORE_IDENT_RE:Co,UNDERSCORE_TITLE_MODE:c_});function d_(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function f_(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function p_(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=d_,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function g_(e,t){Array.isArray(e.illegal)&&(e.illegal=xo(...e.illegal))}function m_(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function b_(e,t){e.relevance===void 0&&(e.relevance=1)}const y_=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=An(n.beforeMatch,Lu(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},__=["of","and","for","in","not","or","if","then","parent","list","value"],v_="keyword";function Bu(e,t,n=v_){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Bu(e[i],t,i))}),r;function s(i,o){t&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[i,w_(l[0],l[1])]})}}function w_(e,t){return t?Number(t):E_(e)?0:1}function E_(e){return __.includes(e.toLowerCase())}const _l={},kn=e=>{console.error(e)},vl=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Pn=(e,t)=>{_l[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),_l[`${e}/${t}`]=!0)},Ps=new Error;function Hu(e,t,{key:n}){let r=0;const s=e[n],i={},o={};for(let a=1;a<=t.length;a++)o[a+r]=s[a],i[a+r]=!0,r+=$u(t[a-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function S_(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw kn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ps;if(typeof e.beginScope!="object"||e.beginScope===null)throw kn("beginScope must be object"),Ps;Hu(e,e.begin,{key:"beginScope"}),e.begin=Oo(e.begin,{joinWith:""})}}function k_(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw kn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ps;if(typeof e.endScope!="object"||e.endScope===null)throw kn("endScope must be object"),Ps;Hu(e,e.end,{key:"endScope"}),e.end=Oo(e.end,{joinWith:""})}}function A_(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function T_(e){A_(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),S_(e),k_(e)}function R_(e){function t(o,a){return new RegExp(Kr(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=$u(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=t(Oo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function s(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function i(o,a){const l=o;if(o.isCompiled)return l;[f_,m_,T_,y_].forEach(u=>u(o,a)),e.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[p_,g_,b_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Bu(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Kr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return x_(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,a),l.matcher=s(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=sn(e.classNameAliases||{}),i(e)}function Fu(e){return e?e.endsWithParent||Fu(e.starts):!1}function x_(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return sn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Fu(e)?sn(e,{starts:e.starts?sn(e.starts):null}):Object.isFrozen(e)?sn(e):e}var O_="11.11.1";class C_ extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Si=Pu,wl=sn,El=Symbol("nomatch"),N_=7,Ku=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Ky};function l(A){return a.noHighlightRe.test(A)}function c(A){let I=A.className+" ";I+=A.parentNode?A.parentNode.className:"";const $=a.languageDetectRe.exec(I);if($){const te=J($[1]);return te||(vl(i.replace("{}",$[1])),vl("Falling back to no-highlight mode for this block.",A)),te?$[1]:"no-highlight"}return I.split(/\s+/).find(te=>l(te)||J(te))}function u(A,I,$){let te="",ae="";typeof I=="object"?(te=A,$=I.ignoreIllegals,ae=I.language):(Pn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Pn("10.7.0",`Please use highlight(code, options) instead.
|
|
74
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),ae=A,te=I),$===void 0&&($=!0);const de={code:te,language:ae};be("before:highlight",de);const fe=de.result?de.result:h(de.language,de.code,$);return fe.code=de.code,be("after:highlight",fe),fe}function h(A,I,$,te){const ae=Object.create(null);function de(N,D){return N.keywords[D]}function fe(){if(!R.keywords){P.addText(k);return}let N=0;R.keywordPatternRe.lastIndex=0;let D=R.keywordPatternRe.exec(k),V="";for(;D;){V+=k.substring(N,D.index);const re=S.case_insensitive?D[0].toLowerCase():D[0],ue=de(R,re);if(ue){const[Ne,it]=ue;if(P.addText(V),V="",ae[re]=(ae[re]||0)+1,ae[re]<=N_&&(X+=it),Ne.startsWith("_"))V+=D[0];else{const cn=S.classNameAliases[Ne]||Ne;De(D[0],cn)}}else V+=D[0];N=R.keywordPatternRe.lastIndex,D=R.keywordPatternRe.exec(k)}V+=k.substring(N),P.addText(V)}function He(){if(k==="")return;let N=null;if(typeof R.subLanguage=="string"){if(!t[R.subLanguage]){P.addText(k);return}N=h(R.subLanguage,k,!0,U[R.subLanguage]),U[R.subLanguage]=N._top}else N=f(k,R.subLanguage.length?R.subLanguage:null);R.relevance>0&&(X+=N.relevance),P.__addSublanguage(N._emitter,N.language)}function Ce(){R.subLanguage!=null?He():fe(),k=""}function De(N,D){N!==""&&(P.startScope(D),P.addText(N),P.endScope())}function We(N,D){let V=1;const re=D.length-1;for(;V<=re;){if(!N._emit[V]){V++;continue}const ue=S.classNameAliases[N[V]]||N[V],Ne=D[V];ue?De(Ne,ue):(k=Ne,fe(),k=""),V++}}function O(N,D){return N.scope&&typeof N.scope=="string"&&P.openNode(S.classNameAliases[N.scope]||N.scope),N.beginScope&&(N.beginScope._wrap?(De(k,S.classNameAliases[N.beginScope._wrap]||N.beginScope._wrap),k=""):N.beginScope._multi&&(We(N.beginScope,D),k="")),R=Object.create(N,{parent:{value:R}}),R}function W(N,D,V){let re=Gy(N.endRe,V);if(re){if(N["on:end"]){const ue=new ml(N);N["on:end"](D,ue),ue.isMatchIgnored&&(re=!1)}if(re){for(;N.endsParent&&N.parent;)N=N.parent;return N}}if(N.endsWithParent)return W(N.parent,D,V)}function q(N){return R.matcher.regexIndex===0?(k+=N[0],1):(ne=!0,0)}function Z(N){const D=N[0],V=N.rule,re=new ml(V),ue=[V.__beforeBegin,V["on:begin"]];for(const Ne of ue)if(Ne&&(Ne(N,re),re.isMatchIgnored))return q(D);return V.skip?k+=D:(V.excludeBegin&&(k+=D),Ce(),!V.returnBegin&&!V.excludeBegin&&(k=D)),O(V,N),V.returnBegin?0:D.length}function ce(N){const D=N[0],V=I.substring(N.index),re=W(R,N,V);if(!re)return El;const ue=R;R.endScope&&R.endScope._wrap?(Ce(),De(D,R.endScope._wrap)):R.endScope&&R.endScope._multi?(Ce(),We(R.endScope,N)):ue.skip?k+=D:(ue.returnEnd||ue.excludeEnd||(k+=D),Ce(),ue.excludeEnd&&(k=D));do R.scope&&P.closeNode(),!R.skip&&!R.subLanguage&&(X+=R.relevance),R=R.parent;while(R!==re.parent);return re.starts&&O(re.starts,N),ue.returnEnd?0:D.length}function p(){const N=[];for(let D=R;D!==S;D=D.parent)D.scope&&N.unshift(D.scope);N.forEach(D=>P.openNode(D))}let m={};function y(N,D){const V=D&&D[0];if(k+=N,V==null)return Ce(),0;if(m.type==="begin"&&D.type==="end"&&m.index===D.index&&V===""){if(k+=I.slice(D.index,D.index+1),!s){const re=new Error(`0 width match regex (${A})`);throw re.languageName=A,re.badRule=m.rule,re}return 1}if(m=D,D.type==="begin")return Z(D);if(D.type==="illegal"&&!$){const re=new Error('Illegal lexeme "'+V+'" for mode "'+(R.scope||"<unnamed>")+'"');throw re.mode=R,re}else if(D.type==="end"){const re=ce(D);if(re!==El)return re}if(D.type==="illegal"&&V==="")return k+=`
|
|
75
|
-
`,1;if(Y>1e5&&Y>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return k+=V,V.length}const S=J(A);if(!S)throw kn(i.replace("{}",A)),new Error('Unknown language: "'+A+'"');const C=R_(S);let T="",R=te||C;const U={},P=new a.__emitter(a);p();let k="",X=0,H=0,Y=0,ne=!1;try{if(S.__emitTokens)S.__emitTokens(I,P);else{for(R.matcher.considerAll();;){Y++,ne?ne=!1:R.matcher.considerAll(),R.matcher.lastIndex=H;const N=R.matcher.exec(I);if(!N)break;const D=I.substring(H,N.index),V=y(D,N);H=N.index+V}y(I.substring(H))}return P.finalize(),T=P.toHTML(),{language:A,value:T,relevance:X,illegal:!1,_emitter:P,_top:R}}catch(N){if(N.message&&N.message.includes("Illegal"))return{language:A,value:Si(I),illegal:!0,relevance:0,_illegalBy:{message:N.message,index:H,context:I.slice(H-100,H+100),mode:N.mode,resultSoFar:T},_emitter:P};if(s)return{language:A,value:Si(I),illegal:!1,relevance:0,errorRaised:N,_emitter:P,_top:R};throw N}}function d(A){const I={value:Si(A),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return I._emitter.addText(A),I}function f(A,I){I=I||a.languages||Object.keys(t);const $=d(A),te=I.filter(J).filter(ee).map(Ce=>h(Ce,A,!1));te.unshift($);const ae=te.sort((Ce,De)=>{if(Ce.relevance!==De.relevance)return De.relevance-Ce.relevance;if(Ce.language&&De.language){if(J(Ce.language).supersetOf===De.language)return 1;if(J(De.language).supersetOf===Ce.language)return-1}return 0}),[de,fe]=ae,He=de;return He.secondBest=fe,He}function g(A,I,$){const te=I&&n[I]||$;A.classList.add("hljs"),A.classList.add(`language-${te}`)}function b(A){let I=null;const $=c(A);if(l($))return;if(be("before:highlightElement",{el:A,language:$}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),a.throwUnescapedHTML))throw new C_("One of your code blocks includes unescaped HTML.",A.innerHTML);I=A;const te=I.textContent,ae=$?u(te,{language:$,ignoreIllegals:!0}):f(te);A.innerHTML=ae.value,A.dataset.highlighted="yes",g(A,$,ae.language),A.result={language:ae.language,re:ae.relevance,relevance:ae.relevance},ae.secondBest&&(A.secondBest={language:ae.secondBest.language,relevance:ae.secondBest.relevance}),be("after:highlightElement",{el:A,result:ae,text:te})}function E(A){a=wl(a,A)}const w=()=>{x(),Pn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){x(),Pn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function x(){function A(){x()}if(document.readyState==="loading"){_||window.addEventListener("DOMContentLoaded",A,!1),_=!0;return}document.querySelectorAll(a.cssSelector).forEach(b)}function M(A,I){let $=null;try{$=I(e)}catch(te){if(kn("Language definition for '{}' could not be registered.".replace("{}",A)),s)kn(te);else throw te;$=o}$.name||($.name=A),t[A]=$,$.rawDefinition=I.bind(null,e),$.aliases&&L($.aliases,{languageName:A})}function B(A){delete t[A];for(const I of Object.keys(n))n[I]===A&&delete n[I]}function z(){return Object.keys(t)}function J(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function L(A,{languageName:I}){typeof A=="string"&&(A=[A]),A.forEach($=>{n[$.toLowerCase()]=I})}function ee(A){const I=J(A);return I&&!I.disableAutodetect}function le(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=I=>{A["before:highlightBlock"](Object.assign({block:I.el},I))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=I=>{A["after:highlightBlock"](Object.assign({block:I.el},I))})}function F(A){le(A),r.push(A)}function oe(A){const I=r.indexOf(A);I!==-1&&r.splice(I,1)}function be(A,I){const $=A;r.forEach(function(te){te[$]&&te[$](I)})}function Re(A){return Pn("10.7.0","highlightBlock will be removed entirely in v12.0"),Pn("10.7.0","Please use highlightElement now."),b(A)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:x,highlightElement:b,highlightBlock:Re,configure:E,initHighlighting:w,initHighlightingOnLoad:v,registerLanguage:M,unregisterLanguage:B,listLanguages:z,getLanguage:J,registerAliases:L,autoDetection:ee,inherit:wl,addPlugin:F,removePlugin:oe}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=O_,e.regex={concat:An,lookahead:Lu,either:xo,optional:Wy,anyNumberOfTimes:qy};for(const A in us)typeof us[A]=="object"&&Iu(us[A]);return Object.assign(e,us),e},Yn=Ku({});Yn.newInstance=()=>Ku({});var I_=Yn;Yn.HighlightJS=Yn;Yn.default=Yn;const Pe=Uy(I_),Ls="[A-Za-z$_][0-9A-Za-z$_]*",qu=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Wu=["true","false","null","undefined","NaN","Infinity"],Vu=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Gu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],zu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ju=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Yu=[].concat(zu,Vu,Gu);function P_(e){const t=e.regex,n=($,{after:te})=>{const ae="</"+$[0].slice(1);return $.input.indexOf(ae,te)!==-1},r=Ls,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,te)=>{const ae=$[0].length+$.index,de=$.input[ae];if(de==="<"||de===","){te.ignoreMatch();return}de===">"&&(n($,{after:ae})||te.ignoreMatch());let fe;const He=$.input.substring(ae);if(fe=He.match(/^\s*=/)){te.ignoreMatch();return}if((fe=He.match(/^\s+extends\s+/))&&fe.index===0){te.ignoreMatch();return}}},a={$pattern:Ls,keyword:qu,literal:Wu,built_in:Yu,"variable.language":Ju},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},v={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},_=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,E,{match:/\$\d+/},h];d.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});const x=[].concat(v,d.contains),M=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:M},z={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Vu,...Gu]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F($){return t.concat("(?!",$.join("|"),")")}const oe={match:t.concat(/\b/,F([...zu,"super","import"].map($=>`${$}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},be={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Re={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,E,v,{match:/\$\d+/},h,J,{scope:"attr",match:r+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},be,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},oe,le,z,Re,{match:/\$[(.]/}]}}function Zu(e){const t=e.regex,n=P_(e),r=Ls,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Ls,keyword:qu.concat(l),literal:Wu,built_in:Yu.concat(s),"variable.language":Ju},u={className:"meta",begin:"@"+r},h=(b,E,w)=>{const v=b.contains.findIndex(_=>_.label===E);if(v===-1)throw new Error("can not find mode to replace");b.contains.splice(v,1,w)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(b=>b.scope==="attr"),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,i,o,f]),h(n,"shebang",e.SHEBANG()),h(n,"use_strict",a);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Sl="[A-Za-z$_][0-9A-Za-z$_]*",L_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],$_=["true","false","null","undefined","NaN","Infinity"],Xu=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Qu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],eh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],j_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],D_=[].concat(eh,Xu,Qu);function th(e){const t=e.regex,n=($,{after:te})=>{const ae="</"+$[0].slice(1);return $.input.indexOf(ae,te)!==-1},r=Sl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,te)=>{const ae=$[0].length+$.index,de=$.input[ae];if(de==="<"||de===","){te.ignoreMatch();return}de===">"&&(n($,{after:ae})||te.ignoreMatch());let fe;const He=$.input.substring(ae);if(fe=He.match(/^\s*=/)){te.ignoreMatch();return}if((fe=He.match(/^\s+extends\s+/))&&fe.index===0){te.ignoreMatch();return}}},a={$pattern:Sl,keyword:L_,literal:$_,built_in:D_,"variable.language":j_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},v={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},_=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,E,{match:/\$\d+/},h];d.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});const x=[].concat(v,d.contains),M=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:M},z={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Xu,...Qu]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F($){return t.concat("(?!",$.join("|"),")")}const oe={match:t.concat(/\b/,F([...eh,"super","import"].map($=>`${$}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},be={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Re={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,E,v,{match:/\$\d+/},h,J,{scope:"attr",match:r+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},be,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},oe,le,z,Re,{match:/\$[(.]/}]}}function nh(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,g=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${g})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${d})[jJ](?=${g})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,b,h,e.HASH_COMMENT_MODE]}]};return c.contains=[h,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[w]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,w,h]}]}}function rh(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],w={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],M=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:E,built_in:[...v,..._,"set","shopt",...x,...M]},contains:[f,e.SHEBANG(),g,h,i,o,w,a,l,c,u,n]}}function M_(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const U_=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),B_=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],H_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],F_=[...B_,...H_],K_=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),q_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),W_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),V_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function G_(e){const t=e.regex,n=U_(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+q_.join("|")+")"},{begin:":(:)?("+W_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+V_.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:K_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+F_.join("|")+")\\b"}]}}function sh(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function z_(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,g=[...c,...l].filter(M=>!u.includes(M)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function v(M){return t.concat(/\b/,t.either(...M.map(B=>B.replace(/\s+/,"\\s+"))),/\b/)}const _={scope:"keyword",match:v(d),relevance:0};function x(M,{exceptions:B,when:z}={}){const J=z;return B=B||[],M.map(L=>L.match(/\|\d+$/)||B.includes(L)?L:J(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(g,{when:M=>M.length<3}),literal:i,type:a,built_in:h},contains:[{scope:"type",match:v(o)},_,w,b,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function ih(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,b,i,o],w=[...E];return w.pop(),w.push(a),f.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}function oh(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(c,{contains:[]}),d=e.inherit(u,{contains:[]});c.contains.push(d),u.contains.push(h);let f=[n,l];return[c,u,h,d].forEach(w=>{w.contains=w.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}Pe.registerLanguage("typescript",Zu);Pe.registerLanguage("ts",Zu);Pe.registerLanguage("javascript",th);Pe.registerLanguage("js",th);Pe.registerLanguage("python",nh);Pe.registerLanguage("py",nh);Pe.registerLanguage("bash",rh);Pe.registerLanguage("sh",rh);Pe.registerLanguage("json",M_);Pe.registerLanguage("css",G_);Pe.registerLanguage("html",sh);Pe.registerLanguage("xml",sh);Pe.registerLanguage("sql",z_);Pe.registerLanguage("yaml",ih);Pe.registerLanguage("yml",ih);Pe.registerLanguage("markdown",oh);Pe.registerLanguage("md",oh);function ft(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\*\*\*(.*?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-gray-800 px-1 rounded text-blue-300 font-mono text-xs">$1</code>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,n,r)=>`<a href="${/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("#")?r:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${n}</a>`)}function ah(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function kl(e){return ah(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function ki(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function J_(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function Y_(e){if(e.length<2)return e.map(a=>`<p class="my-1">${ft(a)}</p>`).join(`
|
|
76
|
-
`);const t=ki(e[0]),n=e[1],r=kl(n)?ki(n).map(J_):t.map(()=>"text-left"),s=kl(n)?e.slice(2):e.slice(1),i=t.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${r[l]??"text-left"}">${ft(a)}</th>`).join(""),o=s.map(a=>{const l=ki(a);return`<tr class="border-b border-gray-800">${t.map((u,h)=>`<td class="px-3 py-1.5 text-gray-400 ${r[h]??"text-left"}">${ft(l[h]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function Z_(e){if(!e)return"";const t=e.split(`
|
|
77
|
-
`),n=[];let r=!1,s=null,i=!1,o=!1,a=[],l="",c=[];function u(){s&&(n.push(`</${s}>`),s=null)}function h(){o&&(n.push(Y_(c)),c=[],o=!1)}function d(){i&&(n.push("</blockquote>"),i=!1)}for(const f of t){if(f.startsWith("```")){if(u(),h(),!r)r=!0,l=f.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const M=a.join(`
|
|
78
|
-
`);let B;try{B=l&&Pe.getLanguage(l)?Pe.highlight(M,{language:l,ignoreIllegals:!0}).value:Pe.highlightAuto(M).value}catch{B=M.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const z=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),J=z?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${z}</span>`:"";n.push(`<div class="relative my-2"><pre class="bg-surface-1 border border-edge rounded-xl p-3 overflow-x-auto"><code class="hljs font-mono text-xs">${B}</code></pre>${J}</div>`),r=!1,l="",a=[]}continue}if(r){a.push(f);continue}if(ah(f)){u(),o=!0,c.push(f);continue}o&&h();const g=f.match(/^####\s+(.+)/),b=f.match(/^###\s+(.+)/),E=f.match(/^##\s+(.+)/),w=f.match(/^#\s+(.+)/);if(g){u(),d(),n.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${ft(g[1])}</h4>`);continue}if(b){u(),d(),n.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${ft(b[1])}</h3>`);continue}if(E){u(),d(),n.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${ft(E[1])}</h2>`);continue}if(w){u(),d(),n.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${ft(w[1])}</h1>`);continue}if(/^---+$/.test(f.trim())){u(),d(),n.push('<hr class="border-gray-800 my-4" />');continue}const v=f.match(/^[-*+]\s+(.+)/);if(v){s==="ol"&&u(),d(),s||(n.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),s="ul"),n.push(`<li>${ft(v[1])}</li>`);continue}const _=f.match(/^\d+\.\s+(.+)/);if(_){s==="ul"&&u(),d(),s||(n.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),s="ol"),n.push(`<li>${ft(_[1])}</li>`);continue}const x=f.match(/^>\s?(.*)/);if(x){u(),i||(n.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),n.push(`<p class="my-0">${ft(x[1])}</p>`);continue}if(f.trim()===""){u(),d(),n.push('<div class="my-2"></div>');continue}u(),d(),n.push(`<p class="my-1">${ft(f)}</p>`)}if(r&&a.length){const f=a.join(`
|
|
79
|
-
`).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.push(`<pre class="bg-gray-900 border border-gray-800 rounded p-3 my-2 overflow-x-auto"><code class="font-mono text-xs text-green-300">${f}</code></pre>`)}return h(),u(),d(),n.join(`
|
|
80
|
-
`)}const X_={key:0,class:"absolute inset-y-3 right-3 z-50 flex w-full max-w-xl flex-col rounded-[28px] border border-cyan/40 bg-[#09090d]/98 shadow-glow"},Q_={class:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4"},ev={key:0,class:"whitespace-pre-wrap text-sm text-white"},tv=["innerHTML"],nv={class:"border-t border-line px-4 py-4"},rv=["onKeydown"],sv={class:"mt-3 flex items-center justify-between"},iv={class:"flex items-center gap-2"},ov=ln({__name:"FloatingChat",setup(e,{expose:t}){const n=My(),r=Ae(""),s=Ae(!1),i=Ae(null);async function o(){if(!r.value.trim())return;const c=r.value;r.value="",await n.sendMessage(c)}function a(){s.value=!0}function l(){s.value=!1}return En(s,async c=>{var u;c&&(await Qn(),(u=i.value)==null||u.focus())}),t({open:a,isOpen:s}),(c,u)=>(Oe(),_o(uf,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-x-full opacity-0","enter-to-class":"translate-x-0 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-x-0 opacity-100","leave-to-class":"translate-x-full opacity-0"},{default:mo(()=>[s.value?(Oe(),Ue("div",X_,[j("div",{class:"flex items-center justify-between border-b border-line px-5 py-4"},[u[2]||(u[2]=j("div",null,[j("div",{class:"font-mono text-[10px] uppercase tracking-[0.35em] text-cyan"},"floating chat"),j("div",{class:"mt-1 text-sm text-white"},"Live prompt surface")],-1)),j("button",{class:"rounded-xl border border-line px-3 py-2 font-mono text-xs text-mist transition hover:border-danger hover:text-danger",onClick:l}," close ")]),j("div",Q_,[(Oe(!0),Ue(Je,null,Es(Xe(n).messages.slice(-8),h=>(Oe(),Ue("article",{key:h.id,class:Ft(["rounded-2xl border px-4 py-3",h.role==="user"?"ml-10 border-cyan/40 bg-cyan/10":h.kind==="feed"?"border-violet/40 bg-violet/10":"mr-10 border-line bg-panel"])},[j("div",{class:Ft(["mb-2 font-mono text-[10px] uppercase tracking-[0.25em]",h.role==="user"?"text-cyan":h.kind==="feed"?"text-violet":"text-mist"])},we(h.kind==="feed"?"feed event":h.role),3),h.role==="user"?(Oe(),Ue("div",ev,we(h.text),1)):(Oe(),Ue("div",{key:1,class:"wiki-content text-sm",innerHTML:Xe(Z_)(h.text)},null,8,tv))],2))),128))]),j("div",nv,[oc(j("textarea",{ref_key:"textarea",ref:i,"onUpdate:modelValue":u[0]||(u[0]=h=>r.value=h),rows:"4",class:"focus-ring w-full rounded-2xl border border-line bg-panel px-4 py-3 font-mono text-sm text-white placeholder:text-slate-500",placeholder:"Send an operator prompt…",onKeydown:ji(gs(o,["ctrl","prevent"]),["enter"])},null,40,rv),[[Hc,r.value]]),j("div",sv,[u[3]||(u[3]=j("div",{class:"font-mono text-[11px] uppercase tracking-[0.18em] text-mist"},"Ctrl+Enter to send",-1)),j("div",iv,[j("button",{class:"rounded-xl border border-danger/40 px-3 py-2 font-mono text-xs text-danger transition hover:bg-danger/10",onClick:u[1]||(u[1]=h=>Xe(n).abortRun())}," abort "),j("button",{class:"rounded-xl border border-cyan/40 bg-cyan/10 px-4 py-2 font-mono text-xs text-cyan transition hover:bg-cyan/20",onClick:o}," dispatch ")])])])])):Cr("",!0)]),_:1}))}}),av={class:"relative h-full overflow-hidden bg-obsidian text-ink"},lv={class:"relative flex h-full overflow-hidden"},cv={class:"relative flex min-w-0 flex-1 flex-col overflow-hidden"},uv={class:"min-h-0 flex-1 overflow-hidden px-4 pb-4 pt-2"},hv={key:1,class:"relative h-full"},dv=ln({__name:"App",setup(e){const t=lu(),n=Yr(),r=Ae(!1),s=Ae(null),i=Be(()=>t.path!=="/login"&&n.isAuthenticated);function o(){var l;(l=s.value)==null||l.open()}function a(l){const c=l.key.toLowerCase();(l.metaKey||l.ctrlKey)&&c=="k"&&(l.preventDefault(),r.value=!r.value),(l.metaKey||l.ctrlKey)&&c==="."&&(l.preventDefault(),o())}return er(()=>{n.init(),window.addEventListener("keydown",a)}),tr(()=>{window.removeEventListener("keydown",a)}),(l,c)=>(Oe(),Ue("div",av,[c[2]||(c[2]=j("div",{class:"pointer-events-none absolute inset-0 bg-grid bg-[size:48px_48px] opacity-[0.04]"},null,-1)),c[3]||(c[3]=j("div",{class:"pointer-events-none absolute inset-x-0 top-0 h-48 bg-gradient-to-b from-cyan/10 via-violet/5 to-transparent"},null,-1)),i.value?(Oe(),Ue(Je,{key:0},[j("div",lv,[xe(vy),j("div",cv,[xe(ny,{onOpenCommand:c[0]||(c[0]=u=>r.value=!0),onOpenChat:o}),j("div",uv,[xe(Xe(Ki))]),xe(Oy)])]),xe(Dy,{open:r.value,onClose:c[1]||(c[1]=u=>r.value=!1),onOpenChat:o},null,8,["open"]),xe(ov,{ref_key:"floatingChat",ref:s},null,512)],64)):(Oe(),Ue("div",hv,[xe(Xe(Ki))]))]))}}),fv="modulepreload",pv=function(e){return"/"+e},Al={},St=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=pv(l),l in Al)return;Al[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":fv,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},lh=Yp({history:Cp(),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:()=>St(()=>import("./LoginView-Bb_buJKq.js"),[]),meta:{title:"Login",subtitle:"Authenticate against Supabase",public:!0}},{path:"/chat",name:"chat",component:()=>St(()=>import("./ChatView-DqdUHOl_.js"),[]),meta:{title:"Chat",subtitle:"Live orchestrator stream"}},{path:"/squads",name:"squads",component:()=>St(()=>import("./SquadsView-BSumqJUP.js"),[]),meta:{title:"Squads",subtitle:"Project crews and worktrees"}},{path:"/activity",name:"activity",component:()=>St(()=>import("./AgentActivityView-Cp2AGg_k.js"),[]),meta:{title:"Activity",subtitle:"Task execution and event stream"}},{path:"/schedules",name:"schedules",component:()=>St(()=>import("./SchedulesView-CAlROQw9.js"),[]),meta:{title:"Schedules",subtitle:"Cron-driven automation matrix"}},{path:"/skills",name:"skills",component:()=>St(()=>import("./SkillsView-BbYlyzi8.js"),[]),meta:{title:"Skills",subtitle:"Installed skill manifests and content"}},{path:"/wiki",name:"wiki",component:()=>St(()=>import("./WikiView-B5l50ReV.js"),[]),meta:{title:"Wiki",subtitle:"Workspace knowledge browser"}},{path:"/mcp",name:"mcp",component:()=>St(()=>import("./McpView-jWdO4DNx.js"),[]),meta:{title:"MCP",subtitle:"Server registry and transport health"}},{path:"/feed",name:"feed",component:()=>St(()=>import("./FeedView-DH9WLqhr.js"),[]),meta:{title:"Feed",subtitle:"Notifications and durable activity"}},{path:"/inbox",name:"inbox",component:()=>St(()=>import("./InboxView-D90afpiV.js"),[]),meta:{title:"Inbox",subtitle:"Operator-facing messages"}}]});lh.beforeEach(async e=>{const t=Yr();return await t.init(),e.path==="/"?"/chat":t.authEnabled?!t.user&&e.path!=="/login"&&!e.meta.public?{path:"/login",query:{redirect:e.fullPath}}:t.user&&e.path==="/login"?"/chat":!0:e.path==="/login"?"/chat":!0});const No=Mf(dv),gv=Hf();No.use(gv);No.use(lh);No.mount("#app");export{tr as A,ry as B,yv as C,bv as D,Je as F,j as a,mv as b,Ue as c,ln as d,Xe as e,ji as f,gs as g,Cr as h,au as i,lu as j,Oe as k,My as l,En as m,Qn as n,er as o,Es as p,$n as q,Ae as r,Fr as s,we as t,Yr as u,Hc as v,oc as w,Ft as x,Z_ as y,Be as z};
|