heyio 0.21.0 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,39 +2,39 @@
2
2
  * @vue/shared v3.5.34
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
- **/function ma(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const Pe={},en=[],Bt=()=>{},Fl=()=>!1,Vr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),qr=e=>e.startsWith("onUpdate:"),Ze=Object.assign,ba=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},Ed=Object.prototype.hasOwnProperty,$e=(e,t)=>Ed.call(e,t),me=Array.isArray,tn=e=>Yn(e)==="[object Map]",zr=e=>Yn(e)==="[object Set]",Wa=e=>Yn(e)==="[object Date]",Ee=e=>typeof e=="function",De=e=>typeof e=="string",_t=e=>typeof e=="symbol",Ne=e=>e!==null&&typeof e=="object",Vl=e=>(Ne(e)||Ee(e))&&Ee(e.then)&&Ee(e.catch),ql=Object.prototype.toString,Yn=e=>ql.call(e),kd=e=>Yn(e).slice(8,-1),zl=e=>Yn(e)==="[object Object]",Kr=e=>De(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,xn=ma(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Wr=e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))},Sd=/-\w/g,at=Wr(e=>e.replace(Sd,t=>t.slice(1).toUpperCase())),Td=/\B([A-Z])/g,Ms=Wr(e=>e.replace(Td,"-$1").toLowerCase()),Gr=Wr(e=>e.charAt(0).toUpperCase()+e.slice(1)),gi=Wr(e=>e?`on${Gr(e)}`:""),Ut=(e,t)=>!Object.is(e,t),_r=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},Kl=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},va=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Ad=e=>{const t=De(e)?Number(e):NaN;return isNaN(t)?e:t};let Ga;const Zr=()=>Ga||(Ga=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ya(e){if(me(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],r=De(n)?$d(n):ya(n);if(r)for(const i in r)t[i]=r[i]}return t}else if(De(e)||Ne(e))return e}const Rd=/;(?![^(]*\))/g,Cd=/:([^]+)/,Od=/\/\*[^]*?\*\//g;function $d(e){const t={};return e.replace(Od,"").split(Rd).forEach(s=>{if(s){const n=s.split(Cd);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ge(e){let t="";if(De(e))t=e;else if(me(e))for(let s=0;s<e.length;s++){const n=ge(e[s]);n&&(t+=n+" ")}else if(Ne(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const Nd="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Id=ma(Nd);function Wl(e){return!!e||e===""}function Pd(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=Xn(e[n],t[n]);return s}function Xn(e,t){if(e===t)return!0;let s=Wa(e),n=Wa(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=_t(e),n=_t(t),s||n)return e===t;if(s=me(e),n=me(t),s||n)return s&&n?Pd(e,t):!1;if(s=Ne(e),n=Ne(t),s||n){if(!s||!n)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const a in e){const o=e.hasOwnProperty(a),l=t.hasOwnProperty(a);if(o&&!l||!o&&l||!Xn(e[a],t[a]))return!1}}return String(e)===String(t)}function Gl(e,t){return e.findIndex(s=>Xn(s,t))}const Zl=e=>!!(e&&e.__v_isRef===!0),I=e=>De(e)?e:e==null?"":me(e)||Ne(e)&&(e.toString===ql||!Ee(e.toString))?Zl(e)?I(e.value):JSON.stringify(e,Jl,2):String(e),Jl=(e,t)=>Zl(t)?Jl(e,t.value):tn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[mi(n,i)+" =>"]=r,s),{})}:zr(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>mi(s))}:_t(t)?mi(t):Ne(t)&&!me(t)&&!zl(t)?String(t):t,mi=(e,t="")=>{var s;return _t(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
5
+ **/function ma(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const Pe={},en=[],Bt=()=>{},Fl=()=>!1,Vr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),qr=e=>e.startsWith("onUpdate:"),Ze=Object.assign,ba=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},Ed=Object.prototype.hasOwnProperty,$e=(e,t)=>Ed.call(e,t),me=Array.isArray,tn=e=>Yn(e)==="[object Map]",zr=e=>Yn(e)==="[object Set]",Wa=e=>Yn(e)==="[object Date]",Ee=e=>typeof e=="function",De=e=>typeof e=="string",_t=e=>typeof e=="symbol",Ne=e=>e!==null&&typeof e=="object",Vl=e=>(Ne(e)||Ee(e))&&Ee(e.then)&&Ee(e.catch),ql=Object.prototype.toString,Yn=e=>ql.call(e),kd=e=>Yn(e).slice(8,-1),zl=e=>Yn(e)==="[object Object]",Kr=e=>De(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,xn=ma(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Wr=e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))},Sd=/-\w/g,at=Wr(e=>e.replace(Sd,t=>t.slice(1).toUpperCase())),Td=/\B([A-Z])/g,js=Wr(e=>e.replace(Td,"-$1").toLowerCase()),Gr=Wr(e=>e.charAt(0).toUpperCase()+e.slice(1)),gi=Wr(e=>e?`on${Gr(e)}`:""),Ut=(e,t)=>!Object.is(e,t),_r=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},Kl=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},va=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Ad=e=>{const t=De(e)?Number(e):NaN;return isNaN(t)?e:t};let Ga;const Zr=()=>Ga||(Ga=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ya(e){if(me(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],r=De(n)?$d(n):ya(n);if(r)for(const i in r)t[i]=r[i]}return t}else if(De(e)||Ne(e))return e}const Rd=/;(?![^(]*\))/g,Cd=/:([^]+)/,Od=/\/\*[^]*?\*\//g;function $d(e){const t={};return e.replace(Od,"").split(Rd).forEach(s=>{if(s){const n=s.split(Cd);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ge(e){let t="";if(De(e))t=e;else if(me(e))for(let s=0;s<e.length;s++){const n=ge(e[s]);n&&(t+=n+" ")}else if(Ne(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const Nd="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Id=ma(Nd);function Wl(e){return!!e||e===""}function Pd(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=Xn(e[n],t[n]);return s}function Xn(e,t){if(e===t)return!0;let s=Wa(e),n=Wa(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=_t(e),n=_t(t),s||n)return e===t;if(s=me(e),n=me(t),s||n)return s&&n?Pd(e,t):!1;if(s=Ne(e),n=Ne(t),s||n){if(!s||!n)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const a in e){const o=e.hasOwnProperty(a),l=t.hasOwnProperty(a);if(o&&!l||!o&&l||!Xn(e[a],t[a]))return!1}}return String(e)===String(t)}function Gl(e,t){return e.findIndex(s=>Xn(s,t))}const Zl=e=>!!(e&&e.__v_isRef===!0),I=e=>De(e)?e:e==null?"":me(e)||Ne(e)&&(e.toString===ql||!Ee(e.toString))?Zl(e)?I(e.value):JSON.stringify(e,Jl,2):String(e),Jl=(e,t)=>Zl(t)?Jl(e,t.value):tn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[mi(n,i)+" =>"]=r,s),{})}:zr(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>mi(s))}:_t(t)?mi(t):Ne(t)&&!me(t)&&!zl(t)?String(t):t,mi=(e,t="")=>{var s;return _t(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
6
6
  * @vue/reactivity v3.5.34
7
7
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
8
  * @license MIT
9
- **/let Ge;class Yl{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&&Ge&&(Ge.active?(this.parent=Ge,this.index=(Ge.scopes||(Ge.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=Ge;try{return Ge=this,t()}finally{Ge=s}}}on(){++this._on===1&&(this.prevScope=Ge,Ge=this)}off(){if(this._on>0&&--this._on===0){if(Ge===this)Ge=this.prevScope;else{let t=Ge;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 s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function Xl(e){return new Yl(e)}function Ql(){return Ge}function Ld(e,t=!1){Ge&&Ge.cleanups.push(e)}let Me;const bi=new WeakSet;class ec{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,Ge&&(Ge.active?Ge.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,bi.has(this)&&(bi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||sc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Za(this),nc(this);const t=Me,s=St;Me=this,St=!0;try{return this.fn()}finally{rc(this),Me=t,St=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)xa(t);this.deps=this.depsTail=void 0,Za(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ji(this)&&this.run()}get dirty(){return ji(this)}}let tc=0,En,kn;function sc(e,t=!1){if(e.flags|=8,t){e.next=kn,kn=e;return}e.next=En,En=e}function _a(){tc++}function wa(){if(--tc>0)return;if(kn){let t=kn;for(kn=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;En;){let t=En;for(En=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function nc(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function rc(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),xa(n),Md(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function ji(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ic(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ic(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Pn)||(e.globalVersion=Pn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ji(e))))return;e.flags|=2;const t=e.dep,s=Me,n=St;Me=e,St=!0;try{nc(e);const r=e.fn(e._value);(t.version===0||Ut(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Me=s,St=n,rc(e),e.flags&=-3}}function xa(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)xa(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function Md(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let St=!0;const ac=[];function ts(){ac.push(St),St=!1}function ss(){const e=ac.pop();St=e===void 0?!0:e}function Za(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Me;Me=void 0;try{t()}finally{Me=s}}}let Pn=0;class jd{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ea{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(!Me||!St||Me===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Me)s=this.activeLink=new jd(Me,this),Me.deps?(s.prevDep=Me.depsTail,Me.depsTail.nextDep=s,Me.depsTail=s):Me.deps=Me.depsTail=s,oc(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Me.depsTail,s.nextDep=void 0,Me.depsTail.nextDep=s,Me.depsTail=s,Me.deps===s&&(Me.deps=n)}return s}trigger(t){this.version++,Pn++,this.notify(t)}notify(t){_a();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{wa()}}}function oc(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let n=t.deps;n;n=n.nextDep)oc(n)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),e.dep.subs=e}}const Sr=new WeakMap,$s=Symbol(""),Di=Symbol(""),Ln=Symbol("");function Qe(e,t,s){if(St&&Me){let n=Sr.get(e);n||Sr.set(e,n=new Map);let r=n.get(s);r||(n.set(s,r=new Ea),r.map=n,r.key=s),r.track()}}function Jt(e,t,s,n,r,i){const a=Sr.get(e);if(!a){Pn++;return}const o=l=>{l&&l.trigger()};if(_a(),t==="clear")a.forEach(o);else{const l=me(e),c=l&&Kr(s);if(l&&s==="length"){const u=Number(n);a.forEach((d,h)=>{(h==="length"||h===Ln||!_t(h)&&h>=u)&&o(d)})}else switch((s!==void 0||a.has(void 0))&&o(a.get(s)),c&&o(a.get(Ln)),t){case"add":l?c&&o(a.get("length")):(o(a.get($s)),tn(e)&&o(a.get(Di)));break;case"delete":l||(o(a.get($s)),tn(e)&&o(a.get(Di)));break;case"set":tn(e)&&o(a.get($s));break}}wa()}function Dd(e,t){const s=Sr.get(e);return s&&s.get(t)}function Ds(e){const t=Ae(e);return t===e?t:(Qe(t,"iterate",Ln),ft(e)?t:t.map(Tt))}function Jr(e){return Qe(e=Ae(e),"iterate",Ln),e}function Mt(e,t){return ns(e)?on(Qt(e)?Tt(t):t):Tt(t)}const Ud={__proto__:null,[Symbol.iterator](){return vi(this,Symbol.iterator,e=>Mt(this,e))},concat(...e){return Ds(this).concat(...e.map(t=>me(t)?Ds(t):t))},entries(){return vi(this,"entries",e=>(e[1]=Mt(this,e[1]),e))},every(e,t){return Ft(this,"every",e,t,void 0,arguments)},filter(e,t){return Ft(this,"filter",e,t,s=>s.map(n=>Mt(this,n)),arguments)},find(e,t){return Ft(this,"find",e,t,s=>Mt(this,s),arguments)},findIndex(e,t){return Ft(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ft(this,"findLast",e,t,s=>Mt(this,s),arguments)},findLastIndex(e,t){return Ft(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ft(this,"forEach",e,t,void 0,arguments)},includes(...e){return yi(this,"includes",e)},indexOf(...e){return yi(this,"indexOf",e)},join(e){return Ds(this).join(e)},lastIndexOf(...e){return yi(this,"lastIndexOf",e)},map(e,t){return Ft(this,"map",e,t,void 0,arguments)},pop(){return hn(this,"pop")},push(...e){return hn(this,"push",e)},reduce(e,...t){return Ja(this,"reduce",e,t)},reduceRight(e,...t){return Ja(this,"reduceRight",e,t)},shift(){return hn(this,"shift")},some(e,t){return Ft(this,"some",e,t,void 0,arguments)},splice(...e){return hn(this,"splice",e)},toReversed(){return Ds(this).toReversed()},toSorted(e){return Ds(this).toSorted(e)},toSpliced(...e){return Ds(this).toSpliced(...e)},unshift(...e){return hn(this,"unshift",e)},values(){return vi(this,"values",e=>Mt(this,e))}};function vi(e,t,s){const n=Jr(e),r=n[t]();return n!==e&&!ft(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=s(i.value)),i}),r}const Bd=Array.prototype;function Ft(e,t,s,n,r,i){const a=Jr(e),o=a!==e&&!ft(e),l=a[t];if(l!==Bd[t]){const d=l.apply(e,i);return o?Tt(d):d}let c=s;a!==e&&(o?c=function(d,h){return s.call(this,Mt(e,d),h,e)}:s.length>2&&(c=function(d,h){return s.call(this,d,h,e)}));const u=l.call(a,c,n);return o&&r?r(u):u}function Ja(e,t,s,n){const r=Jr(e),i=r!==e&&!ft(e);let a=s,o=!1;r!==e&&(i?(o=n.length===0,a=function(c,u,d){return o&&(o=!1,c=Mt(e,c)),s.call(this,c,Mt(e,u),d,e)}):s.length>3&&(a=function(c,u,d){return s.call(this,c,u,d,e)}));const l=r[t](a,...n);return o?Mt(e,l):l}function yi(e,t,s){const n=Ae(e);Qe(n,"iterate",Ln);const r=n[t](...s);return(r===-1||r===!1)&&Yr(s[0])?(s[0]=Ae(s[0]),n[t](...s)):r}function hn(e,t,s=[]){ts(),_a();const n=Ae(e)[t].apply(e,s);return wa(),ss(),n}const Hd=ma("__proto__,__v_isRef,__isVue"),lc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(_t));function Fd(e){_t(e)||(e=String(e));const t=Ae(this);return Qe(t,"has",e),t.hasOwnProperty(e)}class cc{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,n){if(s==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!r;if(s==="__v_isReadonly")return r;if(s==="__v_isShallow")return i;if(s==="__v_raw")return n===(r?i?Xd:fc:i?hc:dc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const a=me(t);if(!r){let l;if(a&&(l=Ud[s]))return l;if(s==="hasOwnProperty")return Fd}const o=Reflect.get(t,s,Fe(t)?t:n);if((_t(s)?lc.has(s):Hd(s))||(r||Qe(t,"get",s),i))return o;if(Fe(o)){const l=a&&Kr(s)?o:o.value;return r&&Ne(l)?Bi(l):l}return Ne(o)?r?Bi(o):Xt(o):o}}class uc extends cc{constructor(t=!1){super(!1,t)}set(t,s,n,r){let i=t[s];const a=me(t)&&Kr(s);if(!this._isShallow){const c=ns(i);if(!ft(n)&&!ns(n)&&(i=Ae(i),n=Ae(n)),!a&&Fe(i)&&!Fe(n))return c||(i.value=n),!0}const o=a?Number(s)<t.length:$e(t,s),l=Reflect.set(t,s,n,Fe(t)?t:r);return t===Ae(r)&&(o?Ut(n,i)&&Jt(t,"set",s,n):Jt(t,"add",s,n)),l}deleteProperty(t,s){const n=$e(t,s);t[s];const r=Reflect.deleteProperty(t,s);return r&&n&&Jt(t,"delete",s,void 0),r}has(t,s){const n=Reflect.has(t,s);return(!_t(s)||!lc.has(s))&&Qe(t,"has",s),n}ownKeys(t){return Qe(t,"iterate",me(t)?"length":$s),Reflect.ownKeys(t)}}class Vd extends cc{constructor(t=!1){super(!0,t)}set(t,s){return!0}deleteProperty(t,s){return!0}}const qd=new uc,zd=new Vd,Kd=new uc(!0);const Ui=e=>e,ir=e=>Reflect.getPrototypeOf(e);function Wd(e,t,s){return function(...n){const r=this.__v_raw,i=Ae(r),a=tn(i),o=e==="entries"||e===Symbol.iterator&&a,l=e==="keys"&&a,c=r[e](...n),u=s?Ui:t?on:Tt;return!t&&Qe(i,"iterate",l?Di:$s),Ze(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:o?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function ar(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Gd(e,t){const s={get(r){const i=this.__v_raw,a=Ae(i),o=Ae(r);e||(Ut(r,o)&&Qe(a,"get",r),Qe(a,"get",o));const{has:l}=ir(a),c=t?Ui:e?on:Tt;if(l.call(a,r))return c(i.get(r));if(l.call(a,o))return c(i.get(o));i!==a&&i.get(r)},get size(){const r=this.__v_raw;return!e&&Qe(Ae(r),"iterate",$s),r.size},has(r){const i=this.__v_raw,a=Ae(i),o=Ae(r);return e||(Ut(r,o)&&Qe(a,"has",r),Qe(a,"has",o)),r===o?i.has(r):i.has(r)||i.has(o)},forEach(r,i){const a=this,o=a.__v_raw,l=Ae(o),c=t?Ui:e?on:Tt;return!e&&Qe(l,"iterate",$s),o.forEach((u,d)=>r.call(i,c(u),c(d),a))}};return Ze(s,e?{add:ar("add"),set:ar("set"),delete:ar("delete"),clear:ar("clear")}:{add(r){const i=Ae(this),a=ir(i),o=Ae(r),l=!t&&!ft(r)&&!ns(r)?o:r;return a.has.call(i,l)||Ut(r,l)&&a.has.call(i,r)||Ut(o,l)&&a.has.call(i,o)||(i.add(l),Jt(i,"add",l,l)),this},set(r,i){!t&&!ft(i)&&!ns(i)&&(i=Ae(i));const a=Ae(this),{has:o,get:l}=ir(a);let c=o.call(a,r);c||(r=Ae(r),c=o.call(a,r));const u=l.call(a,r);return a.set(r,i),c?Ut(i,u)&&Jt(a,"set",r,i):Jt(a,"add",r,i),this},delete(r){const i=Ae(this),{has:a,get:o}=ir(i);let l=a.call(i,r);l||(r=Ae(r),l=a.call(i,r)),o&&o.call(i,r);const c=i.delete(r);return l&&Jt(i,"delete",r,void 0),c},clear(){const r=Ae(this),i=r.size!==0,a=r.clear();return i&&Jt(r,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(r=>{s[r]=Wd(r,e,t)}),s}function ka(e,t){const s=Gd(e,t);return(n,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?n:Reflect.get($e(s,r)&&r in n?s:n,r,i)}const Zd={get:ka(!1,!1)},Jd={get:ka(!1,!0)},Yd={get:ka(!0,!1)};const dc=new WeakMap,hc=new WeakMap,fc=new WeakMap,Xd=new WeakMap;function Qd(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function eh(e){return e.__v_skip||!Object.isExtensible(e)?0:Qd(kd(e))}function Xt(e){return ns(e)?e:Sa(e,!1,qd,Zd,dc)}function pc(e){return Sa(e,!1,Kd,Jd,hc)}function Bi(e){return Sa(e,!0,zd,Yd,fc)}function Sa(e,t,s,n,r){if(!Ne(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=eh(e);if(i===0)return e;const a=r.get(e);if(a)return a;const o=new Proxy(e,i===2?n:s);return r.set(e,o),o}function Qt(e){return ns(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function ns(e){return!!(e&&e.__v_isReadonly)}function ft(e){return!!(e&&e.__v_isShallow)}function Yr(e){return e?!!e.__v_raw:!1}function Ae(e){const t=e&&e.__v_raw;return t?Ae(t):e}function Ta(e){return!$e(e,"__v_skip")&&Object.isExtensible(e)&&Kl(e,"__v_skip",!0),e}const Tt=e=>Ne(e)?Xt(e):e,on=e=>Ne(e)?Bi(e):e;function Fe(e){return e?e.__v_isRef===!0:!1}function Q(e){return gc(e,!1)}function th(e){return gc(e,!0)}function gc(e,t){return Fe(e)?e:new sh(e,t)}class sh{constructor(t,s){this.dep=new Ea,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:Ae(t),this._value=s?t:Tt(t),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(t){const s=this._rawValue,n=this.__v_isShallow||ft(t)||ns(t);t=n?t:Ae(t),Ut(t,s)&&(this._rawValue=t,this._value=n?t:Tt(t),this.dep.trigger())}}function Ie(e){return Fe(e)?e.value:e}const nh={get:(e,t,s)=>t==="__v_raw"?e:Ie(Reflect.get(e,t,s)),set:(e,t,s,n)=>{const r=e[t];return Fe(r)&&!Fe(s)?(r.value=s,!0):Reflect.set(e,t,s,n)}};function mc(e){return Qt(e)?e:new Proxy(e,nh)}function rh(e){const t=me(e)?new Array(e.length):{};for(const s in e)t[s]=ah(e,s);return t}class ih{constructor(t,s,n){this._object=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=_t(s)?s:String(s),this._raw=Ae(t);let r=!0,i=t;if(!me(t)||_t(this._key)||!Kr(this._key))do r=!Yr(i)||ft(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=Ie(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Fe(this._raw[this._key])){const s=this._object[this._key];if(Fe(s)){s.value=t;return}}this._object[this._key]=t}get dep(){return Dd(this._raw,this._key)}}function ah(e,t,s){return new ih(e,t,s)}class oh{constructor(t,s,n){this.fn=t,this.setter=s,this._value=void 0,this.dep=new Ea(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Pn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Me!==this)return sc(this,!0),!0}get value(){const t=this.dep.track();return ic(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function lh(e,t,s=!1){let n,r;return Ee(e)?n=e:(n=e.get,r=e.set),new oh(n,r,s)}const or={},Tr=new WeakMap;let ks;function ch(e,t=!1,s=ks){if(s){let n=Tr.get(s);n||Tr.set(s,n=[]),n.push(e)}}function uh(e,t,s=Pe){const{immediate:n,deep:r,once:i,scheduler:a,augmentJob:o,call:l}=s,c=P=>r?P:ft(P)||r===!1||r===0?Yt(P,1):Yt(P);let u,d,h,f,g=!1,m=!1;if(Fe(e)?(d=()=>e.value,g=ft(e)):Qt(e)?(d=()=>c(e),g=!0):me(e)?(m=!0,g=e.some(P=>Qt(P)||ft(P)),d=()=>e.map(P=>{if(Fe(P))return P.value;if(Qt(P))return c(P);if(Ee(P))return l?l(P,2):P()})):Ee(e)?t?d=l?()=>l(e,2):e:d=()=>{if(h){ts();try{h()}finally{ss()}}const P=ks;ks=u;try{return l?l(e,3,[f]):e(f)}finally{ks=P}}:d=Bt,t&&r){const P=d,N=r===!0?1/0:r;d=()=>Yt(P(),N)}const S=Ql(),E=()=>{u.stop(),S&&S.active&&ba(S.effects,u)};if(i&&t){const P=t;t=(...N)=>{P(...N),E()}}let x=m?new Array(e.length).fill(or):or;const k=P=>{if(!(!(u.flags&1)||!u.dirty&&!P))if(t){const N=u.run();if(r||g||(m?N.some((R,v)=>Ut(R,x[v])):Ut(N,x))){h&&h();const R=ks;ks=u;try{const v=[N,x===or?void 0:m&&x[0]===or?[]:x,f];x=N,l?l(t,3,v):t(...v)}finally{ks=R}}}else u.run()};return o&&o(k),u=new ec(d),u.scheduler=a?()=>a(k,!1):k,f=P=>ch(P,!1,u),h=u.onStop=()=>{const P=Tr.get(u);if(P){if(l)l(P,4);else for(const N of P)N();Tr.delete(u)}},t?n?k(!0):x=u.run():a?a(k.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Yt(e,t=1/0,s){if(t<=0||!Ne(e)||e.__v_skip||(s=s||new Map,(s.get(e)||0)>=t))return e;if(s.set(e,t),t--,Fe(e))Yt(e.value,t,s);else if(me(e))for(let n=0;n<e.length;n++)Yt(e[n],t,s);else if(zr(e)||tn(e))e.forEach(n=>{Yt(n,t,s)});else if(zl(e)){for(const n in e)Yt(e[n],t,s);for(const n of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,n)&&Yt(e[n],t,s)}return e}/**
9
+ **/let Ge;class Yl{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&&Ge&&(Ge.active?(this.parent=Ge,this.index=(Ge.scopes||(Ge.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=Ge;try{return Ge=this,t()}finally{Ge=s}}}on(){++this._on===1&&(this.prevScope=Ge,Ge=this)}off(){if(this._on>0&&--this._on===0){if(Ge===this)Ge=this.prevScope;else{let t=Ge;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 s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function Xl(e){return new Yl(e)}function Ql(){return Ge}function Ld(e,t=!1){Ge&&Ge.cleanups.push(e)}let Me;const bi=new WeakSet;class ec{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,Ge&&(Ge.active?Ge.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,bi.has(this)&&(bi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||sc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Za(this),nc(this);const t=Me,s=St;Me=this,St=!0;try{return this.fn()}finally{rc(this),Me=t,St=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)xa(t);this.deps=this.depsTail=void 0,Za(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ji(this)&&this.run()}get dirty(){return ji(this)}}let tc=0,En,kn;function sc(e,t=!1){if(e.flags|=8,t){e.next=kn,kn=e;return}e.next=En,En=e}function _a(){tc++}function wa(){if(--tc>0)return;if(kn){let t=kn;for(kn=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;En;){let t=En;for(En=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function nc(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function rc(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),xa(n),Md(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function ji(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ic(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ic(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Pn)||(e.globalVersion=Pn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ji(e))))return;e.flags|=2;const t=e.dep,s=Me,n=St;Me=e,St=!0;try{nc(e);const r=e.fn(e._value);(t.version===0||Ut(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Me=s,St=n,rc(e),e.flags&=-3}}function xa(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)xa(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function Md(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let St=!0;const ac=[];function ts(){ac.push(St),St=!1}function ss(){const e=ac.pop();St=e===void 0?!0:e}function Za(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Me;Me=void 0;try{t()}finally{Me=s}}}let Pn=0;class jd{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ea{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(!Me||!St||Me===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Me)s=this.activeLink=new jd(Me,this),Me.deps?(s.prevDep=Me.depsTail,Me.depsTail.nextDep=s,Me.depsTail=s):Me.deps=Me.depsTail=s,oc(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Me.depsTail,s.nextDep=void 0,Me.depsTail.nextDep=s,Me.depsTail=s,Me.deps===s&&(Me.deps=n)}return s}trigger(t){this.version++,Pn++,this.notify(t)}notify(t){_a();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{wa()}}}function oc(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let n=t.deps;n;n=n.nextDep)oc(n)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),e.dep.subs=e}}const Sr=new WeakMap,Ns=Symbol(""),Di=Symbol(""),Ln=Symbol("");function Qe(e,t,s){if(St&&Me){let n=Sr.get(e);n||Sr.set(e,n=new Map);let r=n.get(s);r||(n.set(s,r=new Ea),r.map=n,r.key=s),r.track()}}function Jt(e,t,s,n,r,i){const a=Sr.get(e);if(!a){Pn++;return}const o=l=>{l&&l.trigger()};if(_a(),t==="clear")a.forEach(o);else{const l=me(e),c=l&&Kr(s);if(l&&s==="length"){const u=Number(n);a.forEach((d,h)=>{(h==="length"||h===Ln||!_t(h)&&h>=u)&&o(d)})}else switch((s!==void 0||a.has(void 0))&&o(a.get(s)),c&&o(a.get(Ln)),t){case"add":l?c&&o(a.get("length")):(o(a.get(Ns)),tn(e)&&o(a.get(Di)));break;case"delete":l||(o(a.get(Ns)),tn(e)&&o(a.get(Di)));break;case"set":tn(e)&&o(a.get(Ns));break}}wa()}function Dd(e,t){const s=Sr.get(e);return s&&s.get(t)}function Us(e){const t=Ae(e);return t===e?t:(Qe(t,"iterate",Ln),ft(e)?t:t.map(Tt))}function Jr(e){return Qe(e=Ae(e),"iterate",Ln),e}function Mt(e,t){return ns(e)?on(Qt(e)?Tt(t):t):Tt(t)}const Ud={__proto__:null,[Symbol.iterator](){return vi(this,Symbol.iterator,e=>Mt(this,e))},concat(...e){return Us(this).concat(...e.map(t=>me(t)?Us(t):t))},entries(){return vi(this,"entries",e=>(e[1]=Mt(this,e[1]),e))},every(e,t){return Ft(this,"every",e,t,void 0,arguments)},filter(e,t){return Ft(this,"filter",e,t,s=>s.map(n=>Mt(this,n)),arguments)},find(e,t){return Ft(this,"find",e,t,s=>Mt(this,s),arguments)},findIndex(e,t){return Ft(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ft(this,"findLast",e,t,s=>Mt(this,s),arguments)},findLastIndex(e,t){return Ft(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ft(this,"forEach",e,t,void 0,arguments)},includes(...e){return yi(this,"includes",e)},indexOf(...e){return yi(this,"indexOf",e)},join(e){return Us(this).join(e)},lastIndexOf(...e){return yi(this,"lastIndexOf",e)},map(e,t){return Ft(this,"map",e,t,void 0,arguments)},pop(){return hn(this,"pop")},push(...e){return hn(this,"push",e)},reduce(e,...t){return Ja(this,"reduce",e,t)},reduceRight(e,...t){return Ja(this,"reduceRight",e,t)},shift(){return hn(this,"shift")},some(e,t){return Ft(this,"some",e,t,void 0,arguments)},splice(...e){return hn(this,"splice",e)},toReversed(){return Us(this).toReversed()},toSorted(e){return Us(this).toSorted(e)},toSpliced(...e){return Us(this).toSpliced(...e)},unshift(...e){return hn(this,"unshift",e)},values(){return vi(this,"values",e=>Mt(this,e))}};function vi(e,t,s){const n=Jr(e),r=n[t]();return n!==e&&!ft(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=s(i.value)),i}),r}const Bd=Array.prototype;function Ft(e,t,s,n,r,i){const a=Jr(e),o=a!==e&&!ft(e),l=a[t];if(l!==Bd[t]){const d=l.apply(e,i);return o?Tt(d):d}let c=s;a!==e&&(o?c=function(d,h){return s.call(this,Mt(e,d),h,e)}:s.length>2&&(c=function(d,h){return s.call(this,d,h,e)}));const u=l.call(a,c,n);return o&&r?r(u):u}function Ja(e,t,s,n){const r=Jr(e),i=r!==e&&!ft(e);let a=s,o=!1;r!==e&&(i?(o=n.length===0,a=function(c,u,d){return o&&(o=!1,c=Mt(e,c)),s.call(this,c,Mt(e,u),d,e)}):s.length>3&&(a=function(c,u,d){return s.call(this,c,u,d,e)}));const l=r[t](a,...n);return o?Mt(e,l):l}function yi(e,t,s){const n=Ae(e);Qe(n,"iterate",Ln);const r=n[t](...s);return(r===-1||r===!1)&&Yr(s[0])?(s[0]=Ae(s[0]),n[t](...s)):r}function hn(e,t,s=[]){ts(),_a();const n=Ae(e)[t].apply(e,s);return wa(),ss(),n}const Hd=ma("__proto__,__v_isRef,__isVue"),lc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(_t));function Fd(e){_t(e)||(e=String(e));const t=Ae(this);return Qe(t,"has",e),t.hasOwnProperty(e)}class cc{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,n){if(s==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!r;if(s==="__v_isReadonly")return r;if(s==="__v_isShallow")return i;if(s==="__v_raw")return n===(r?i?Xd:fc:i?hc:dc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const a=me(t);if(!r){let l;if(a&&(l=Ud[s]))return l;if(s==="hasOwnProperty")return Fd}const o=Reflect.get(t,s,Fe(t)?t:n);if((_t(s)?lc.has(s):Hd(s))||(r||Qe(t,"get",s),i))return o;if(Fe(o)){const l=a&&Kr(s)?o:o.value;return r&&Ne(l)?Bi(l):l}return Ne(o)?r?Bi(o):Xt(o):o}}class uc extends cc{constructor(t=!1){super(!1,t)}set(t,s,n,r){let i=t[s];const a=me(t)&&Kr(s);if(!this._isShallow){const c=ns(i);if(!ft(n)&&!ns(n)&&(i=Ae(i),n=Ae(n)),!a&&Fe(i)&&!Fe(n))return c||(i.value=n),!0}const o=a?Number(s)<t.length:$e(t,s),l=Reflect.set(t,s,n,Fe(t)?t:r);return t===Ae(r)&&(o?Ut(n,i)&&Jt(t,"set",s,n):Jt(t,"add",s,n)),l}deleteProperty(t,s){const n=$e(t,s);t[s];const r=Reflect.deleteProperty(t,s);return r&&n&&Jt(t,"delete",s,void 0),r}has(t,s){const n=Reflect.has(t,s);return(!_t(s)||!lc.has(s))&&Qe(t,"has",s),n}ownKeys(t){return Qe(t,"iterate",me(t)?"length":Ns),Reflect.ownKeys(t)}}class Vd extends cc{constructor(t=!1){super(!0,t)}set(t,s){return!0}deleteProperty(t,s){return!0}}const qd=new uc,zd=new Vd,Kd=new uc(!0);const Ui=e=>e,ir=e=>Reflect.getPrototypeOf(e);function Wd(e,t,s){return function(...n){const r=this.__v_raw,i=Ae(r),a=tn(i),o=e==="entries"||e===Symbol.iterator&&a,l=e==="keys"&&a,c=r[e](...n),u=s?Ui:t?on:Tt;return!t&&Qe(i,"iterate",l?Di:Ns),Ze(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:o?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function ar(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Gd(e,t){const s={get(r){const i=this.__v_raw,a=Ae(i),o=Ae(r);e||(Ut(r,o)&&Qe(a,"get",r),Qe(a,"get",o));const{has:l}=ir(a),c=t?Ui:e?on:Tt;if(l.call(a,r))return c(i.get(r));if(l.call(a,o))return c(i.get(o));i!==a&&i.get(r)},get size(){const r=this.__v_raw;return!e&&Qe(Ae(r),"iterate",Ns),r.size},has(r){const i=this.__v_raw,a=Ae(i),o=Ae(r);return e||(Ut(r,o)&&Qe(a,"has",r),Qe(a,"has",o)),r===o?i.has(r):i.has(r)||i.has(o)},forEach(r,i){const a=this,o=a.__v_raw,l=Ae(o),c=t?Ui:e?on:Tt;return!e&&Qe(l,"iterate",Ns),o.forEach((u,d)=>r.call(i,c(u),c(d),a))}};return Ze(s,e?{add:ar("add"),set:ar("set"),delete:ar("delete"),clear:ar("clear")}:{add(r){const i=Ae(this),a=ir(i),o=Ae(r),l=!t&&!ft(r)&&!ns(r)?o:r;return a.has.call(i,l)||Ut(r,l)&&a.has.call(i,r)||Ut(o,l)&&a.has.call(i,o)||(i.add(l),Jt(i,"add",l,l)),this},set(r,i){!t&&!ft(i)&&!ns(i)&&(i=Ae(i));const a=Ae(this),{has:o,get:l}=ir(a);let c=o.call(a,r);c||(r=Ae(r),c=o.call(a,r));const u=l.call(a,r);return a.set(r,i),c?Ut(i,u)&&Jt(a,"set",r,i):Jt(a,"add",r,i),this},delete(r){const i=Ae(this),{has:a,get:o}=ir(i);let l=a.call(i,r);l||(r=Ae(r),l=a.call(i,r)),o&&o.call(i,r);const c=i.delete(r);return l&&Jt(i,"delete",r,void 0),c},clear(){const r=Ae(this),i=r.size!==0,a=r.clear();return i&&Jt(r,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(r=>{s[r]=Wd(r,e,t)}),s}function ka(e,t){const s=Gd(e,t);return(n,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?n:Reflect.get($e(s,r)&&r in n?s:n,r,i)}const Zd={get:ka(!1,!1)},Jd={get:ka(!1,!0)},Yd={get:ka(!0,!1)};const dc=new WeakMap,hc=new WeakMap,fc=new WeakMap,Xd=new WeakMap;function Qd(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function eh(e){return e.__v_skip||!Object.isExtensible(e)?0:Qd(kd(e))}function Xt(e){return ns(e)?e:Sa(e,!1,qd,Zd,dc)}function pc(e){return Sa(e,!1,Kd,Jd,hc)}function Bi(e){return Sa(e,!0,zd,Yd,fc)}function Sa(e,t,s,n,r){if(!Ne(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=eh(e);if(i===0)return e;const a=r.get(e);if(a)return a;const o=new Proxy(e,i===2?n:s);return r.set(e,o),o}function Qt(e){return ns(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function ns(e){return!!(e&&e.__v_isReadonly)}function ft(e){return!!(e&&e.__v_isShallow)}function Yr(e){return e?!!e.__v_raw:!1}function Ae(e){const t=e&&e.__v_raw;return t?Ae(t):e}function Ta(e){return!$e(e,"__v_skip")&&Object.isExtensible(e)&&Kl(e,"__v_skip",!0),e}const Tt=e=>Ne(e)?Xt(e):e,on=e=>Ne(e)?Bi(e):e;function Fe(e){return e?e.__v_isRef===!0:!1}function Q(e){return gc(e,!1)}function th(e){return gc(e,!0)}function gc(e,t){return Fe(e)?e:new sh(e,t)}class sh{constructor(t,s){this.dep=new Ea,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:Ae(t),this._value=s?t:Tt(t),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(t){const s=this._rawValue,n=this.__v_isShallow||ft(t)||ns(t);t=n?t:Ae(t),Ut(t,s)&&(this._rawValue=t,this._value=n?t:Tt(t),this.dep.trigger())}}function Ie(e){return Fe(e)?e.value:e}const nh={get:(e,t,s)=>t==="__v_raw"?e:Ie(Reflect.get(e,t,s)),set:(e,t,s,n)=>{const r=e[t];return Fe(r)&&!Fe(s)?(r.value=s,!0):Reflect.set(e,t,s,n)}};function mc(e){return Qt(e)?e:new Proxy(e,nh)}function rh(e){const t=me(e)?new Array(e.length):{};for(const s in e)t[s]=ah(e,s);return t}class ih{constructor(t,s,n){this._object=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=_t(s)?s:String(s),this._raw=Ae(t);let r=!0,i=t;if(!me(t)||_t(this._key)||!Kr(this._key))do r=!Yr(i)||ft(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=Ie(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Fe(this._raw[this._key])){const s=this._object[this._key];if(Fe(s)){s.value=t;return}}this._object[this._key]=t}get dep(){return Dd(this._raw,this._key)}}function ah(e,t,s){return new ih(e,t,s)}class oh{constructor(t,s,n){this.fn=t,this.setter=s,this._value=void 0,this.dep=new Ea(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Pn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Me!==this)return sc(this,!0),!0}get value(){const t=this.dep.track();return ic(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function lh(e,t,s=!1){let n,r;return Ee(e)?n=e:(n=e.get,r=e.set),new oh(n,r,s)}const or={},Tr=new WeakMap;let ks;function ch(e,t=!1,s=ks){if(s){let n=Tr.get(s);n||Tr.set(s,n=[]),n.push(e)}}function uh(e,t,s=Pe){const{immediate:n,deep:r,once:i,scheduler:a,augmentJob:o,call:l}=s,c=P=>r?P:ft(P)||r===!1||r===0?Yt(P,1):Yt(P);let u,d,h,f,g=!1,b=!1;if(Fe(e)?(d=()=>e.value,g=ft(e)):Qt(e)?(d=()=>c(e),g=!0):me(e)?(b=!0,g=e.some(P=>Qt(P)||ft(P)),d=()=>e.map(P=>{if(Fe(P))return P.value;if(Qt(P))return c(P);if(Ee(P))return l?l(P,2):P()})):Ee(e)?t?d=l?()=>l(e,2):e:d=()=>{if(h){ts();try{h()}finally{ss()}}const P=ks;ks=u;try{return l?l(e,3,[f]):e(f)}finally{ks=P}}:d=Bt,t&&r){const P=d,N=r===!0?1/0:r;d=()=>Yt(P(),N)}const S=Ql(),E=()=>{u.stop(),S&&S.active&&ba(S.effects,u)};if(i&&t){const P=t;t=(...N)=>{P(...N),E()}}let x=b?new Array(e.length).fill(or):or;const k=P=>{if(!(!(u.flags&1)||!u.dirty&&!P))if(t){const N=u.run();if(r||g||(b?N.some((R,v)=>Ut(R,x[v])):Ut(N,x))){h&&h();const R=ks;ks=u;try{const v=[N,x===or?void 0:b&&x[0]===or?[]:x,f];x=N,l?l(t,3,v):t(...v)}finally{ks=R}}}else u.run()};return o&&o(k),u=new ec(d),u.scheduler=a?()=>a(k,!1):k,f=P=>ch(P,!1,u),h=u.onStop=()=>{const P=Tr.get(u);if(P){if(l)l(P,4);else for(const N of P)N();Tr.delete(u)}},t?n?k(!0):x=u.run():a?a(k.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Yt(e,t=1/0,s){if(t<=0||!Ne(e)||e.__v_skip||(s=s||new Map,(s.get(e)||0)>=t))return e;if(s.set(e,t),t--,Fe(e))Yt(e.value,t,s);else if(me(e))for(let n=0;n<e.length;n++)Yt(e[n],t,s);else if(zr(e)||tn(e))e.forEach(n=>{Yt(n,t,s)});else if(zl(e)){for(const n in e)Yt(e[n],t,s);for(const n of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,n)&&Yt(e[n],t,s)}return e}/**
10
10
  * @vue/runtime-core v3.5.34
11
11
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
12
  * @license MIT
13
- **/function Qn(e,t,s,n){try{return n?e(...n):e()}catch(r){Xr(r,t,s)}}function At(e,t,s,n){if(Ee(e)){const r=Qn(e,t,s,n);return r&&Vl(r)&&r.catch(i=>{Xr(i,t,s)}),r}if(me(e)){const r=[];for(let i=0;i<e.length;i++)r.push(At(e[i],t,s,n));return r}}function Xr(e,t,s,n=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||Pe;if(t){let o=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${s}`;for(;o;){const u=o.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,l,c)===!1)return}o=o.parent}if(i){ts(),Qn(i,null,10,[e,l,c]),ss();return}}dh(e,s,r,n,a)}function dh(e,t,s,n=!0,r=!1){if(r)throw e;console.error(e)}const rt=[];let Nt=-1;const sn=[];let us=null,Ks=0;const bc=Promise.resolve();let Ar=null;function Ns(e){const t=Ar||bc;return e?t.then(this?e.bind(this):e):t}function hh(e){let t=Nt+1,s=rt.length;for(;t<s;){const n=t+s>>>1,r=rt[n],i=Mn(r);i<e||i===e&&r.flags&2?t=n+1:s=n}return t}function Aa(e){if(!(e.flags&1)){const t=Mn(e),s=rt[rt.length-1];!s||!(e.flags&2)&&t>=Mn(s)?rt.push(e):rt.splice(hh(t),0,e),e.flags|=1,vc()}}function vc(){Ar||(Ar=bc.then(_c))}function fh(e){me(e)?sn.push(...e):us&&e.id===-1?us.splice(Ks+1,0,e):e.flags&1||(sn.push(e),e.flags|=1),vc()}function Ya(e,t,s=Nt+1){for(;s<rt.length;s++){const n=rt[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;rt.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function yc(e){if(sn.length){const t=[...new Set(sn)].sort((s,n)=>Mn(s)-Mn(n));if(sn.length=0,us){us.push(...t);return}for(us=t,Ks=0;Ks<us.length;Ks++){const s=us[Ks];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}us=null,Ks=0}}const Mn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function _c(e){try{for(Nt=0;Nt<rt.length;Nt++){const t=rt[Nt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Qn(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Nt<rt.length;Nt++){const t=rt[Nt];t&&(t.flags&=-2)}Nt=-1,rt.length=0,yc(),Ar=null,(rt.length||sn.length)&&_c()}}let ut=null,wc=null;function Rr(e){const t=ut;return ut=e,wc=e&&e.type.__scopeId||null,t}function gs(e,t=ut,s){if(!t||e._n)return e;const n=(...r)=>{n._d&&$r(-1);const i=Rr(t);let a;try{a=e(...r)}finally{Rr(i),n._d&&$r(1)}return a};return n._n=!0,n._c=!0,n._d=!0,n}function dt(e,t){if(ut===null)return e;const s=ri(ut),n=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,a,o,l=Pe]=t[r];i&&(Ee(i)&&(i={mounted:i,updated:i}),i.deep&&Yt(a),n.push({dir:i,instance:s,value:a,oldValue:void 0,arg:o,modifiers:l}))}return e}function vs(e,t,s,n){const r=e.dirs,i=t&&t.dirs;for(let a=0;a<r.length;a++){const o=r[a];i&&(o.oldValue=i[a].value);let l=o.dir[n];l&&(ts(),At(l,s,8,[e.el,o,e,t]),ss())}}function wr(e,t){if(et){let s=et.provides;const n=et.parent&&et.parent.provides;n===s&&(s=et.provides=Object.create(n)),s[e]=t}}function vt(e,t,s=!1){const n=Ia();if(n||Is){let r=Is?Is._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return s&&Ee(t)?t.call(n&&n.proxy):t}}function ph(){return!!(Ia()||Is)}const gh=Symbol.for("v-scx"),mh=()=>vt(gh);function es(e,t,s){return xc(e,t,s)}function xc(e,t,s=Pe){const{immediate:n,deep:r,flush:i,once:a}=s,o=Ze({},s),l=t&&n||!t&&i!=="post";let c;if(Un){if(i==="sync"){const f=mh();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Bt,f.resume=Bt,f.pause=Bt,f}}const u=et;o.call=(f,g,m)=>At(f,u,g,m);let d=!1;i==="post"?o.scheduler=f=>{st(f,u&&u.suspense)}:i!=="sync"&&(d=!0,o.scheduler=(f,g)=>{g?f():Aa(f)}),o.augmentJob=f=>{t&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=uh(e,t,o);return Un&&(c?c.push(h):l&&h()),h}function bh(e,t,s){const n=this.proxy,r=De(e)?e.includes(".")?Ec(n,e):()=>n[e]:e.bind(n,n);let i;Ee(t)?i=t:(i=t.handler,s=t);const a=tr(this),o=xc(r,i.bind(n),s);return a(),o}function Ec(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;r<s.length&&n;r++)n=n[s[r]];return n}}const ls=new WeakMap,kc=Symbol("_vte"),Sc=e=>e.__isTeleport,Ts=e=>e&&(e.disabled||e.disabled===""),vh=e=>e&&(e.defer||e.defer===""),Xa=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qa=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Hi=(e,t)=>{const s=e&&e.to;return De(s)?t?t(s):null:s},yh={name:"Teleport",__isTeleport:!0,process(e,t,s,n,r,i,a,o,l,c){const{mc:u,pc:d,pbc:h,o:{insert:f,querySelector:g,createText:m,createComment:S,parentNode:E}}=c,x=Ts(t.props);let{dynamicChildren:k}=t;const P=(v,C,j)=>{v.shapeFlag&16&&u(v.children,C,j,r,i,a,o,l)},N=(v=t)=>{const C=Ts(v.props),j=v.target=Hi(v.props,g),V=Fi(j,v,m,f);j&&(a!=="svg"&&Xa(j)?a="svg":a!=="mathml"&&Qa(j)&&(a="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(j),C||(P(v,j,V),bn(v,!1)))},R=v=>{const C=()=>{if(ls.get(v)===C){if(ls.delete(v),Ts(v.props)){const j=E(v.el)||s;P(v,j,v.anchor),bn(v,!0)}N(v)}};ls.set(v,C),st(C,i)};if(e==null){const v=t.el=m(""),C=t.anchor=m("");if(f(v,s,n),f(C,s,n),vh(t.props)||i&&i.pendingBranch){R(t);return}x&&(P(t,s,C),bn(t,!0)),N()}else{t.el=e.el;const v=t.anchor=e.anchor,C=ls.get(e);if(C){C.flags|=8,ls.delete(e),R(t);return}t.targetStart=e.targetStart;const j=t.target=e.target,V=t.targetAnchor=e.targetAnchor,Z=Ts(e.props),$=Z?s:j,W=Z?v:V;if(a==="svg"||Xa(j)?a="svg":(a==="mathml"||Qa(j))&&(a="mathml"),k?(h(e.dynamicChildren,k,$,r,i,a,o),$a(e,t,!0)):l||d(e,t,$,W,r,i,a,o,!1),x)Z?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):lr(t,s,v,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const L=t.target=Hi(t.props,g);L&&lr(t,L,null,c,0)}else Z&&lr(t,j,V,c,1);bn(t,x)}},remove(e,t,s,{um:n,o:{remove:r}},i){const{shapeFlag:a,children:o,anchor:l,targetStart:c,targetAnchor:u,target:d,props:h}=e;let f=i||!Ts(h);const g=ls.get(e);if(g&&(g.flags|=8,ls.delete(e),f=!1),d&&(r(c),r(u)),i&&r(l),a&16)for(let m=0;m<o.length;m++){const S=o[m];n(S,t,s,f,!!S.dynamicChildren)}},move:lr,hydrate:_h};function lr(e,t,s,{o:{insert:n},m:r},i=2){i===0&&n(e.targetAnchor,t,s);const{el:a,anchor:o,shapeFlag:l,children:c,props:u}=e,d=i===2;if(d&&n(a,t,s),!ls.has(e)&&(!d||Ts(u))&&l&16)for(let h=0;h<c.length;h++)r(c[h],t,s,2);d&&n(o,t,s)}function _h(e,t,s,n,r,i,{o:{nextSibling:a,parentNode:o,querySelector:l,insert:c,createText:u}},d){function h(S,E){let x=E;for(;x;){if(x&&x.nodeType===8){if(x.data==="teleport start anchor")t.targetStart=x;else if(x.data==="teleport anchor"){t.targetAnchor=x,S._lpa=t.targetAnchor&&a(t.targetAnchor);break}}x=a(x)}}function f(S,E){E.anchor=d(a(S),E,o(S),s,n,r,i)}const g=t.target=Hi(t.props,l),m=Ts(t.props);if(g){const S=g._lpa||g.firstChild;t.shapeFlag&16&&(m?(f(e,t),h(g,S),t.targetAnchor||Fi(g,t,u,c,o(e)===g?e:null)):(t.anchor=a(e),h(g,S),t.targetAnchor||Fi(g,t,u,c),d(S&&a(S),t,g,s,n,r,i))),bn(t,m)}else m&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=a(e));return t.anchor&&a(t.anchor)}const wh=yh;function bn(e,t){const s=e.ctx;if(s&&s.ut){let n,r;for(t?(n=e.el,r=e.anchor):(n=e.targetStart,r=e.targetAnchor);n&&n!==r;)n.nodeType===1&&n.setAttribute("data-v-owner",s.uid),n=n.nextSibling;s.ut()}}function Fi(e,t,s,n,r=null){const i=t.targetStart=s(""),a=t.targetAnchor=s("");return i[kc]=a,e&&(n(i,e,r),n(a,e,r)),a}const It=Symbol("_leaveCb"),fn=Symbol("_enterCb");function xh(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ht(()=>{e.isMounted=!0}),Ra(()=>{e.isUnmounting=!0}),e}const mt=[Function,Array],Tc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:mt,onEnter:mt,onAfterEnter:mt,onEnterCancelled:mt,onBeforeLeave:mt,onLeave:mt,onAfterLeave:mt,onLeaveCancelled:mt,onBeforeAppear:mt,onAppear:mt,onAfterAppear:mt,onAppearCancelled:mt},Ac=e=>{const t=e.subTree;return t.component?Ac(t.component):t},Eh={name:"BaseTransition",props:Tc,setup(e,{slots:t}){const s=Ia(),n=xh();return()=>{const r=t.default&&Oc(t.default(),!0),i=r&&r.length?Rc(r):s.subTree?ee():void 0;if(!i)return;const a=Ae(e),{mode:o}=a;if(n.isLeaving)return _i(i);const l=eo(i);if(!l)return _i(i);let c=Vi(l,a,n,s,d=>c=d);l.type!==it&&jn(l,c);let u=s.subTree&&eo(s.subTree);if(u&&u.type!==it&&!As(u,l)&&Ac(s).type!==it){let d=Vi(u,a,n,s);if(jn(u,d),o==="out-in"&&l.type!==it)return n.isLeaving=!0,d.afterLeave=()=>{n.isLeaving=!1,s.job.flags&8||s.update(),delete d.afterLeave,u=void 0},_i(i);o==="in-out"&&l.type!==it?d.delayLeave=(h,f,g)=>{const m=Cc(n,u);m[String(u.key)]=u,h[It]=()=>{f(),h[It]=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 Rc(e){let t=e[0];if(e.length>1){for(const s of e)if(s.type!==it){t=s;break}}return t}const kh=Eh;function Cc(e,t){const{leavingVNodes:s}=e;let n=s.get(t.type);return n||(n=Object.create(null),s.set(t.type,n)),n}function Vi(e,t,s,n,r){const{appear:i,mode:a,persisted:o=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:h,onLeave:f,onAfterLeave:g,onLeaveCancelled:m,onBeforeAppear:S,onAppear:E,onAfterAppear:x,onAppearCancelled:k}=t,P=String(e.key),N=Cc(s,e),R=(j,V)=>{j&&At(j,n,9,V)},v=(j,V)=>{const Z=V[1];R(j,V),me(j)?j.every($=>$.length<=1)&&Z():j.length<=1&&Z()},C={mode:a,persisted:o,beforeEnter(j){let V=l;if(!s.isMounted)if(i)V=S||l;else return;j[It]&&j[It](!0);const Z=N[P];Z&&As(e,Z)&&Z.el[It]&&Z.el[It](),R(V,[j])},enter(j){if(N[P]===e)return;let V=c,Z=u,$=d;if(!s.isMounted)if(i)V=E||c,Z=x||u,$=k||d;else return;let W=!1;j[fn]=pe=>{W||(W=!0,pe?R($,[j]):R(Z,[j]),C.delayedLeave&&C.delayedLeave(),j[fn]=void 0)};const L=j[fn].bind(null,!1);V?v(V,[j,L]):L()},leave(j,V){const Z=String(e.key);if(j[fn]&&j[fn](!0),s.isUnmounting)return V();R(h,[j]);let $=!1;j[It]=L=>{$||($=!0,V(),L?R(m,[j]):R(g,[j]),j[It]=void 0,N[Z]===e&&delete N[Z])};const W=j[It].bind(null,!1);N[Z]=e,f?v(f,[j,W]):W()},clone(j){const V=Vi(j,t,s,n,r);return r&&r(V),V}};return C}function _i(e){if(Qr(e))return e=ms(e),e.children=null,e}function eo(e){if(!Qr(e))return Sc(e.type)&&e.children?Rc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:s}=e;if(s){if(t&16)return s[0];if(t&32&&Ee(s.default))return s.default()}}function jn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,jn(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 Oc(e,t=!1,s){let n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i];const o=s==null?a.key:String(s)+String(a.key!=null?a.key:i);a.type===ke?(a.patchFlag&128&&r++,n=n.concat(Oc(a.children,t,o))):(t||a.type!==it)&&n.push(o!=null?ms(a,{key:o}):a)}if(r>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function pt(e,t){return Ee(e)?Ze({name:e.name},t,{setup:e}):e}function $c(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function to(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const Cr=new WeakMap;function Sn(e,t,s,n,r=!1){if(me(e)){e.forEach((m,S)=>Sn(m,t&&(me(t)?t[S]:t),s,n,r));return}if(Tn(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Sn(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?ri(n.component):n.el,a=r?null:i,{i:o,r:l}=e,c=t&&t.r,u=o.refs===Pe?o.refs={}:o.refs,d=o.setupState,h=Ae(d),f=d===Pe?Fl:m=>to(u,m)?!1:$e(h,m),g=(m,S)=>!(S&&to(u,S));if(c!=null&&c!==l){if(so(t),De(c))u[c]=null,f(c)&&(d[c]=null);else if(Fe(c)){const m=t;g(c,m.k)&&(c.value=null),m.k&&(u[m.k]=null)}}if(Ee(l))Qn(l,o,12,[a,u]);else{const m=De(l),S=Fe(l);if(m||S){const E=()=>{if(e.f){const x=m?f(l)?d[l]:u[l]:g()||!e.k?l.value:u[e.k];if(r)me(x)&&ba(x,i);else if(me(x))x.includes(i)||x.push(i);else if(m)u[l]=[i],f(l)&&(d[l]=u[l]);else{const k=[i];g(l,e.k)&&(l.value=k),e.k&&(u[e.k]=k)}}else m?(u[l]=a,f(l)&&(d[l]=a)):S&&(g(l,e.k)&&(l.value=a),e.k&&(u[e.k]=a))};if(a){const x=()=>{E(),Cr.delete(e)};x.id=-1,Cr.set(e,x),st(x,s)}else so(e),E()}}}function so(e){const t=Cr.get(e);t&&(t.flags|=8,Cr.delete(e))}Zr().requestIdleCallback;Zr().cancelIdleCallback;const Tn=e=>!!e.type.__asyncLoader,Qr=e=>e.type.__isKeepAlive;function Sh(e,t){Nc(e,"a",t)}function Th(e,t){Nc(e,"da",t)}function Nc(e,t,s=et){const n=e.__wdc||(e.__wdc=()=>{let r=s;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ei(t,n,s),s){let r=s.parent;for(;r&&r.parent;)Qr(r.parent.vnode)&&Ah(n,t,s,r),r=r.parent}}function Ah(e,t,s,n){const r=ei(t,e,n,!0);ti(()=>{ba(n[t],r)},s)}function ei(e,t,s=et,n=!1){if(s){const r=s[e]||(s[e]=[]),i=t.__weh||(t.__weh=(...a)=>{ts();const o=tr(s),l=At(t,s,e,a);return o(),ss(),l});return n?r.unshift(i):r.push(i),i}}const rs=e=>(t,s=et)=>{(!Un||e==="sp")&&ei(e,(...n)=>t(...n),s)},Rh=rs("bm"),Ht=rs("m"),Ch=rs("bu"),Oh=rs("u"),Ra=rs("bum"),ti=rs("um"),$h=rs("sp"),Nh=rs("rtg"),Ih=rs("rtc");function Ph(e,t=et){ei("ec",e,t)}const Lh="components",Ic=Symbol.for("v-ndc");function Mh(e){return De(e)?jh(Lh,e,!1)||e:e||Ic}function jh(e,t,s=!0,n=!1){const r=ut||et;if(r){const i=r.type;{const o=xf(i,!1);if(o&&(o===t||o===at(t)||o===Gr(at(t))))return i}const a=no(r[e]||i[e],t)||no(r.appContext[e],t);return!a&&n?i:a}}function no(e,t){return e&&(e[t]||e[at(t)]||e[Gr(at(t))])}function ze(e,t,s,n){let r;const i=s,a=me(e);if(a||De(e)){const o=a&&Qt(e);let l=!1,c=!1;o&&(l=!ft(e),c=ns(e),e=Jr(e)),r=new Array(e.length);for(let u=0,d=e.length;u<d;u++)r[u]=t(l?c?on(Tt(e[u])):Tt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){r=new Array(e);for(let o=0;o<e;o++)r[o]=t(o+1,o,void 0,i)}else if(Ne(e))if(e[Symbol.iterator])r=Array.from(e,(o,l)=>t(o,l,void 0,i));else{const o=Object.keys(e);r=new Array(o.length);for(let l=0,c=o.length;l<c;l++){const u=o[l];r[l]=t(e[u],u,l,i)}}else r=[];return r}const qi=e=>e?Xc(e)?ri(e):qi(e.parent):null,An=Ze(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=>qi(e.parent),$root:e=>qi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Lc(e),$forceUpdate:e=>e.f||(e.f=()=>{Aa(e.update)}),$nextTick:e=>e.n||(e.n=Ns.bind(e.proxy)),$watch:e=>bh.bind(e)}),wi=(e,t)=>e!==Pe&&!e.__isScriptSetup&&$e(e,t),Dh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:s,setupState:n,data:r,props:i,accessCache:a,type:o,appContext:l}=e;if(t[0]!=="$"){const h=a[t];if(h!==void 0)switch(h){case 1:return n[t];case 2:return r[t];case 4:return s[t];case 3:return i[t]}else{if(wi(n,t))return a[t]=1,n[t];if(r!==Pe&&$e(r,t))return a[t]=2,r[t];if($e(i,t))return a[t]=3,i[t];if(s!==Pe&&$e(s,t))return a[t]=4,s[t];zi&&(a[t]=0)}}const c=An[t];let u,d;if(c)return t==="$attrs"&&Qe(e.attrs,"get",""),c(e);if((u=o.__cssModules)&&(u=u[t]))return u;if(s!==Pe&&$e(s,t))return a[t]=4,s[t];if(d=l.config.globalProperties,$e(d,t))return d[t]},set({_:e},t,s){const{data:n,setupState:r,ctx:i}=e;return wi(r,t)?(r[t]=s,!0):n!==Pe&&$e(n,t)?(n[t]=s,!0):$e(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=s,!0)},has({_:{data:e,setupState:t,accessCache:s,ctx:n,appContext:r,props:i,type:a}},o){let l;return!!(s[o]||e!==Pe&&o[0]!=="$"&&$e(e,o)||wi(t,o)||$e(i,o)||$e(n,o)||$e(An,o)||$e(r.config.globalProperties,o)||(l=a.__cssModules)&&l[o])},defineProperty(e,t,s){return s.get!=null?e._.accessCache[t]=0:$e(s,"value")&&this.set(e,t,s.value,null),Reflect.defineProperty(e,t,s)}};function ro(e){return me(e)?e.reduce((t,s)=>(t[s]=null,t),{}):e}let zi=!0;function Uh(e){const t=Lc(e),s=e.proxy,n=e.ctx;zi=!1,t.beforeCreate&&io(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:a,watch:o,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:g,activated:m,deactivated:S,beforeDestroy:E,beforeUnmount:x,destroyed:k,unmounted:P,render:N,renderTracked:R,renderTriggered:v,errorCaptured:C,serverPrefetch:j,expose:V,inheritAttrs:Z,components:$,directives:W,filters:L}=t;if(c&&Bh(c,n,null),a)for(const z in a){const Y=a[z];Ee(Y)&&(n[z]=Y.bind(s))}if(r){const z=r.call(s,s);Ne(z)&&(e.data=Xt(z))}if(zi=!0,i)for(const z in i){const Y=i[z],ue=Ee(Y)?Y.bind(s,s):Ee(Y.get)?Y.get.bind(s,s):Bt,xe=!Ee(Y)&&Ee(Y.set)?Y.set.bind(s):Bt,q=je({get:ue,set:xe});Object.defineProperty(n,z,{enumerable:!0,configurable:!0,get:()=>q.value,set:T=>q.value=T})}if(o)for(const z in o)Pc(o[z],n,s,z);if(l){const z=Ee(l)?l.call(s):l;Reflect.ownKeys(z).forEach(Y=>{wr(Y,z[Y])})}u&&io(u,e,"c");function M(z,Y){me(Y)?Y.forEach(ue=>z(ue.bind(s))):Y&&z(Y.bind(s))}if(M(Rh,d),M(Ht,h),M(Ch,f),M(Oh,g),M(Sh,m),M(Th,S),M(Ph,C),M(Ih,R),M(Nh,v),M(Ra,x),M(ti,P),M($h,j),me(V))if(V.length){const z=e.exposed||(e.exposed={});V.forEach(Y=>{Object.defineProperty(z,Y,{get:()=>s[Y],set:ue=>s[Y]=ue,enumerable:!0})})}else e.exposed||(e.exposed={});N&&e.render===Bt&&(e.render=N),Z!=null&&(e.inheritAttrs=Z),$&&(e.components=$),W&&(e.directives=W),j&&$c(e)}function Bh(e,t,s=Bt){me(e)&&(e=Ki(e));for(const n in e){const r=e[n];let i;Ne(r)?"default"in r?i=vt(r.from||n,r.default,!0):i=vt(r.from||n):i=vt(r),Fe(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:a=>i.value=a}):t[n]=i}}function io(e,t,s){At(me(e)?e.map(n=>n.bind(t.proxy)):e.bind(t.proxy),t,s)}function Pc(e,t,s,n){let r=n.includes(".")?Ec(s,n):()=>s[n];if(De(e)){const i=t[e];Ee(i)&&es(r,i)}else if(Ee(e))es(r,e.bind(s));else if(Ne(e))if(me(e))e.forEach(i=>Pc(i,t,s,n));else{const i=Ee(e.handler)?e.handler.bind(s):t[e.handler];Ee(i)&&es(r,i,e)}}function Lc(e){const t=e.type,{mixins:s,extends:n}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:a}}=e.appContext,o=i.get(t);let l;return o?l=o:!r.length&&!s&&!n?l=t:(l={},r.length&&r.forEach(c=>Or(l,c,a,!0)),Or(l,t,a)),Ne(t)&&i.set(t,l),l}function Or(e,t,s,n=!1){const{mixins:r,extends:i}=t;i&&Or(e,i,s,!0),r&&r.forEach(a=>Or(e,a,s,!0));for(const a in t)if(!(n&&a==="expose")){const o=Hh[a]||s&&s[a];e[a]=o?o(e[a],t[a]):t[a]}return e}const Hh={data:ao,props:oo,emits:oo,methods:vn,computed:vn,beforeCreate:tt,created:tt,beforeMount:tt,mounted:tt,beforeUpdate:tt,updated:tt,beforeDestroy:tt,beforeUnmount:tt,destroyed:tt,unmounted:tt,activated:tt,deactivated:tt,errorCaptured:tt,serverPrefetch:tt,components:vn,directives:vn,watch:Vh,provide:ao,inject:Fh};function ao(e,t){return t?e?function(){return Ze(Ee(e)?e.call(this,this):e,Ee(t)?t.call(this,this):t)}:t:e}function Fh(e,t){return vn(Ki(e),Ki(t))}function Ki(e){if(me(e)){const t={};for(let s=0;s<e.length;s++)t[e[s]]=e[s];return t}return e}function tt(e,t){return e?[...new Set([].concat(e,t))]:t}function vn(e,t){return e?Ze(Object.create(null),e,t):t}function oo(e,t){return e?me(e)&&me(t)?[...new Set([...e,...t])]:Ze(Object.create(null),ro(e),ro(t??{})):t}function Vh(e,t){if(!e)return t;if(!t)return e;const s=Ze(Object.create(null),e);for(const n in t)s[n]=tt(e[n],t[n]);return s}function Mc(){return{app:null,config:{isNativeTag:Fl,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 qh=0;function zh(e,t){return function(n,r=null){Ee(n)||(n=Ze({},n)),r!=null&&!Ne(r)&&(r=null);const i=Mc(),a=new WeakSet,o=[];let l=!1;const c=i.app={_uid:qh++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:kf,get config(){return i.config},set config(u){},use(u,...d){return a.has(u)||(u&&Ee(u.install)?(a.add(u),u.install(c,...d)):Ee(u)&&(a.add(u),u(c,...d))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!l){const f=c._ceVNode||be(n,r);return f.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),e(f,u,h),l=!0,c._container=u,u.__vue_app__=c,ri(f.component)}},onUnmount(u){o.push(u)},unmount(){l&&(At(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=Is;Is=c;try{return u()}finally{Is=d}}};return c}}let Is=null;const Kh=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${at(t)}Modifiers`]||e[`${Ms(t)}Modifiers`];function Wh(e,t,...s){if(e.isUnmounted)return;const n=e.vnode.props||Pe;let r=s;const i=t.startsWith("update:"),a=i&&Kh(n,t.slice(7));a&&(a.trim&&(r=s.map(u=>De(u)?u.trim():u)),a.number&&(r=s.map(va)));let o,l=n[o=gi(t)]||n[o=gi(at(t))];!l&&i&&(l=n[o=gi(Ms(t))]),l&&At(l,e,6,r);const c=n[o+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,At(c,e,6,r)}}const Gh=new WeakMap;function jc(e,t,s=!1){const n=s?Gh:t.emitsCache,r=n.get(e);if(r!==void 0)return r;const i=e.emits;let a={},o=!1;if(!Ee(e)){const l=c=>{const u=jc(c,t,!0);u&&(o=!0,Ze(a,u))};!s&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!o?(Ne(e)&&n.set(e,null),null):(me(i)?i.forEach(l=>a[l]=null):Ze(a,i),Ne(e)&&n.set(e,a),a)}function si(e,t){return!e||!Vr(t)?!1:(t=t.slice(2).replace(/Once$/,""),$e(e,t[0].toLowerCase()+t.slice(1))||$e(e,Ms(t))||$e(e,t))}function lo(e){const{type:t,vnode:s,proxy:n,withProxy:r,propsOptions:[i],slots:a,attrs:o,emit:l,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:g,inheritAttrs:m}=e,S=Rr(e);let E,x;try{if(s.shapeFlag&4){const P=r||n,N=P;E=jt(c.call(N,P,u,d,f,h,g)),x=o}else{const P=t;E=jt(P.length>1?P(d,{attrs:o,slots:a,emit:l}):P(d,null)),x=t.props?o:Zh(o)}}catch(P){Rn.length=0,Xr(P,e,1),E=be(it)}let k=E;if(x&&m!==!1){const P=Object.keys(x),{shapeFlag:N}=k;P.length&&N&7&&(i&&P.some(qr)&&(x=Jh(x,i)),k=ms(k,x,!1,!0))}return s.dirs&&(k=ms(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(s.dirs):s.dirs),s.transition&&jn(k,s.transition),E=k,Rr(S),E}const Zh=e=>{let t;for(const s in e)(s==="class"||s==="style"||Vr(s))&&((t||(t={}))[s]=e[s]);return t},Jh=(e,t)=>{const s={};for(const n in e)(!qr(n)||!(n.slice(9)in t))&&(s[n]=e[n]);return s};function Yh(e,t,s){const{props:n,children:r,component:i}=e,{props:a,children:o,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(s&&l>=0){if(l&1024)return!0;if(l&16)return n?co(n,a,c):!!a;if(l&8){const u=t.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(Dc(a,n,h)&&!si(c,h))return!0}}}else return(r||o)&&(!o||!o.$stable)?!0:n===a?!1:n?a?co(n,a,c):!0:!!a;return!1}function co(e,t,s){const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(let r=0;r<n.length;r++){const i=n[r];if(Dc(t,e,i)&&!si(s,i))return!0}return!1}function Dc(e,t,s){const n=e[s],r=t[s];return s==="style"&&Ne(n)&&Ne(r)?!Xn(n,r):n!==r}function Xh({vnode:e,parent:t,suspense:s},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=n,e=r),r===e)(e=t.vnode).el=n,t=t.parent;else break}s&&s.activeBranch===e&&(s.vnode.el=n)}const Uc={},Bc=()=>Object.create(Uc),Hc=e=>Object.getPrototypeOf(e)===Uc;function Qh(e,t,s,n=!1){const r={},i=Bc();e.propsDefaults=Object.create(null),Fc(e,t,r,i);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);s?e.props=n?r:pc(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function ef(e,t,s,n){const{props:r,attrs:i,vnode:{patchFlag:a}}=e,o=Ae(r),[l]=e.propsOptions;let c=!1;if((n||a>0)&&!(a&16)){if(a&8){const u=e.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(si(e.emitsOptions,h))continue;const f=t[h];if(l)if($e(i,h))f!==i[h]&&(i[h]=f,c=!0);else{const g=at(h);r[g]=Wi(l,o,g,f,e,!1)}else f!==i[h]&&(i[h]=f,c=!0)}}}else{Fc(e,t,r,i)&&(c=!0);let u;for(const d in o)(!t||!$e(t,d)&&((u=Ms(d))===d||!$e(t,u)))&&(l?s&&(s[d]!==void 0||s[u]!==void 0)&&(r[d]=Wi(l,o,d,void 0,e,!0)):delete r[d]);if(i!==o)for(const d in i)(!t||!$e(t,d))&&(delete i[d],c=!0)}c&&Jt(e.attrs,"set","")}function Fc(e,t,s,n){const[r,i]=e.propsOptions;let a=!1,o;if(t)for(let l in t){if(xn(l))continue;const c=t[l];let u;r&&$e(r,u=at(l))?!i||!i.includes(u)?s[u]=c:(o||(o={}))[u]=c:si(e.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,a=!0)}if(i){const l=Ae(s),c=o||Pe;for(let u=0;u<i.length;u++){const d=i[u];s[d]=Wi(r,l,d,c[d],e,!$e(c,d))}}return a}function Wi(e,t,s,n,r,i){const a=e[s];if(a!=null){const o=$e(a,"default");if(o&&n===void 0){const l=a.default;if(a.type!==Function&&!a.skipFactory&&Ee(l)){const{propsDefaults:c}=r;if(s in c)n=c[s];else{const u=tr(r);n=c[s]=l.call(null,t),u()}}else n=l;r.ce&&r.ce._setProp(s,n)}a[0]&&(i&&!o?n=!1:a[1]&&(n===""||n===Ms(s))&&(n=!0))}return n}const tf=new WeakMap;function Vc(e,t,s=!1){const n=s?tf:t.propsCache,r=n.get(e);if(r)return r;const i=e.props,a={},o=[];let l=!1;if(!Ee(e)){const u=d=>{l=!0;const[h,f]=Vc(d,t,!0);Ze(a,h),f&&o.push(...f)};!s&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return Ne(e)&&n.set(e,en),en;if(me(i))for(let u=0;u<i.length;u++){const d=at(i[u]);uo(d)&&(a[d]=Pe)}else if(i)for(const u in i){const d=at(u);if(uo(d)){const h=i[u],f=a[d]=me(h)||Ee(h)?{type:h}:Ze({},h),g=f.type;let m=!1,S=!0;if(me(g))for(let E=0;E<g.length;++E){const x=g[E],k=Ee(x)&&x.name;if(k==="Boolean"){m=!0;break}else k==="String"&&(S=!1)}else m=Ee(g)&&g.name==="Boolean";f[0]=m,f[1]=S,(m||$e(f,"default"))&&o.push(d)}}const c=[a,o];return Ne(e)&&n.set(e,c),c}function uo(e){return e[0]!=="$"&&!xn(e)}const Ca=e=>e==="_"||e==="_ctx"||e==="$stable",Oa=e=>me(e)?e.map(jt):[jt(e)],sf=(e,t,s)=>{if(t._n)return t;const n=gs((...r)=>Oa(t(...r)),s);return n._c=!1,n},qc=(e,t,s)=>{const n=e._ctx;for(const r in e){if(Ca(r))continue;const i=e[r];if(Ee(i))t[r]=sf(r,i,n);else if(i!=null){const a=Oa(i);t[r]=()=>a}}},zc=(e,t)=>{const s=Oa(t);e.slots.default=()=>s},Kc=(e,t,s)=>{for(const n in t)(s||!Ca(n))&&(e[n]=t[n])},nf=(e,t,s)=>{const n=e.slots=Bc();if(e.vnode.shapeFlag&32){const r=t._;r?(Kc(n,t,s),s&&Kl(n,"_",r,!0)):qc(t,n)}else t&&zc(e,t)},rf=(e,t,s)=>{const{vnode:n,slots:r}=e;let i=!0,a=Pe;if(n.shapeFlag&32){const o=t._;o?s&&o===1?i=!1:Kc(r,t,s):(i=!t.$stable,qc(t,r)),a=t}else t&&(zc(e,t),a={default:1});if(i)for(const o in r)!Ca(o)&&a[o]==null&&delete r[o]},st=uf;function af(e){return of(e)}function of(e,t){const s=Zr();s.__VUE__=!0;const{insert:n,remove:r,patchProp:i,createElement:a,createText:o,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=Bt,insertStaticContent:g}=e,m=(b,y,A,D=null,K=null,B=null,H=void 0,se=null,J=!!y.dynamicChildren)=>{if(b===y)return;b&&!As(b,y)&&(D=F(b),T(b,K,B,!0),b=null),y.patchFlag===-2&&(J=!1,y.dynamicChildren=null);const{type:U,ref:fe,shapeFlag:ne}=y;switch(U){case ni:S(b,y,A,D);break;case it:E(b,y,A,D);break;case xr:b==null&&x(y,A,D,H);break;case ke:$(b,y,A,D,K,B,H,se,J);break;default:ne&1?N(b,y,A,D,K,B,H,se,J):ne&6?W(b,y,A,D,K,B,H,se,J):(ne&64||ne&128)&&U.process(b,y,A,D,K,B,H,se,J,he)}fe!=null&&K?Sn(fe,b&&b.ref,B,y||b,!y):fe==null&&b&&b.ref!=null&&Sn(b.ref,null,B,b,!0)},S=(b,y,A,D)=>{if(b==null)n(y.el=o(y.children),A,D);else{const K=y.el=b.el;y.children!==b.children&&c(K,y.children)}},E=(b,y,A,D)=>{b==null?n(y.el=l(y.children||""),A,D):y.el=b.el},x=(b,y,A,D)=>{[b.el,b.anchor]=g(b.children,y,A,D,b.el,b.anchor)},k=({el:b,anchor:y},A,D)=>{let K;for(;b&&b!==y;)K=h(b),n(b,A,D),b=K;n(y,A,D)},P=({el:b,anchor:y})=>{let A;for(;b&&b!==y;)A=h(b),r(b),b=A;r(y)},N=(b,y,A,D,K,B,H,se,J)=>{if(y.type==="svg"?H="svg":y.type==="math"&&(H="mathml"),b==null)R(y,A,D,K,B,H,se,J);else{const U=b.el&&b.el._isVueCE?b.el:null;try{U&&U._beginPatch(),j(b,y,K,B,H,se,J)}finally{U&&U._endPatch()}}},R=(b,y,A,D,K,B,H,se)=>{let J,U;const{props:fe,shapeFlag:ne,transition:de,dirs:ye}=b;if(J=b.el=a(b.type,B,fe&&fe.is,fe),ne&8?u(J,b.children):ne&16&&C(b.children,J,null,D,K,xi(b,B),H,se),ye&&vs(b,null,D,"created"),v(J,b,b.scopeId,H,D),fe){for(const te in fe)te!=="value"&&!xn(te)&&i(J,te,null,fe[te],B,D);"value"in fe&&i(J,"value",null,fe.value,B),(U=fe.onVnodeBeforeMount)&&Ot(U,D,b)}ye&&vs(b,null,D,"beforeMount");const G=lf(K,de);G&&de.beforeEnter(J),n(J,y,A),((U=fe&&fe.onVnodeMounted)||G||ye)&&st(()=>{try{U&&Ot(U,D,b),G&&de.enter(J),ye&&vs(b,null,D,"mounted")}finally{}},K)},v=(b,y,A,D,K)=>{if(A&&f(b,A),D)for(let B=0;B<D.length;B++)f(b,D[B]);if(K){let B=K.subTree;if(y===B||Zc(B.type)&&(B.ssContent===y||B.ssFallback===y)){const H=K.vnode;v(b,H,H.scopeId,H.slotScopeIds,K.parent)}}},C=(b,y,A,D,K,B,H,se,J=0)=>{for(let U=J;U<b.length;U++){const fe=b[U]=se?Zt(b[U]):jt(b[U]);m(null,fe,y,A,D,K,B,H,se)}},j=(b,y,A,D,K,B,H)=>{const se=y.el=b.el;let{patchFlag:J,dynamicChildren:U,dirs:fe}=y;J|=b.patchFlag&16;const ne=b.props||Pe,de=y.props||Pe;let ye;if(A&&ys(A,!1),(ye=de.onVnodeBeforeUpdate)&&Ot(ye,A,y,b),fe&&vs(y,b,A,"beforeUpdate"),A&&ys(A,!0),(ne.innerHTML&&de.innerHTML==null||ne.textContent&&de.textContent==null)&&u(se,""),U?V(b.dynamicChildren,U,se,A,D,xi(y,K),B):H||Y(b,y,se,null,A,D,xi(y,K),B,!1),J>0){if(J&16)Z(se,ne,de,A,K);else if(J&2&&ne.class!==de.class&&i(se,"class",null,de.class,K),J&4&&i(se,"style",ne.style,de.style,K),J&8){const G=y.dynamicProps;for(let te=0;te<G.length;te++){const oe=G[te],_e=ne[oe],Te=de[oe];(Te!==_e||oe==="value")&&i(se,oe,_e,Te,K,A)}}J&1&&b.children!==y.children&&u(se,y.children)}else!H&&U==null&&Z(se,ne,de,A,K);((ye=de.onVnodeUpdated)||fe)&&st(()=>{ye&&Ot(ye,A,y,b),fe&&vs(y,b,A,"updated")},D)},V=(b,y,A,D,K,B,H)=>{for(let se=0;se<y.length;se++){const J=b[se],U=y[se],fe=J.el&&(J.type===ke||!As(J,U)||J.shapeFlag&198)?d(J.el):A;m(J,U,fe,null,D,K,B,H,!0)}},Z=(b,y,A,D,K)=>{if(y!==A){if(y!==Pe)for(const B in y)!xn(B)&&!(B in A)&&i(b,B,y[B],null,K,D);for(const B in A){if(xn(B))continue;const H=A[B],se=y[B];H!==se&&B!=="value"&&i(b,B,se,H,K,D)}"value"in A&&i(b,"value",y.value,A.value,K)}},$=(b,y,A,D,K,B,H,se,J)=>{const U=y.el=b?b.el:o(""),fe=y.anchor=b?b.anchor:o("");let{patchFlag:ne,dynamicChildren:de,slotScopeIds:ye}=y;ye&&(se=se?se.concat(ye):ye),b==null?(n(U,A,D),n(fe,A,D),C(y.children||[],A,fe,K,B,H,se,J)):ne>0&&ne&64&&de&&b.dynamicChildren&&b.dynamicChildren.length===de.length?(V(b.dynamicChildren,de,A,K,B,H,se),(y.key!=null||K&&y===K.subTree)&&$a(b,y,!0)):Y(b,y,A,fe,K,B,H,se,J)},W=(b,y,A,D,K,B,H,se,J)=>{y.slotScopeIds=se,b==null?y.shapeFlag&512?K.ctx.activate(y,A,D,H,J):L(y,A,D,K,B,H,J):pe(b,y,J)},L=(b,y,A,D,K,B,H)=>{const se=b.component=bf(b,D,K);if(Qr(b)&&(se.ctx.renderer=he),vf(se,!1,H),se.asyncDep){if(K&&K.registerDep(se,M,H),!b.el){const J=se.subTree=be(it);E(null,J,y,A),b.placeholder=J.el}}else M(se,b,y,A,K,B,H)},pe=(b,y,A)=>{const D=y.component=b.component;if(Yh(b,y,A))if(D.asyncDep&&!D.asyncResolved){z(D,y,A);return}else D.next=y,D.update();else y.el=b.el,D.vnode=y},M=(b,y,A,D,K,B,H)=>{const se=()=>{if(b.isMounted){let{next:ne,bu:de,u:ye,parent:G,vnode:te}=b;{const gt=Wc(b);if(gt){ne&&(ne.el=te.el,z(b,ne,H)),gt.asyncDep.then(()=>{st(()=>{b.isUnmounted||U()},K)});return}}let oe=ne,_e;ys(b,!1),ne?(ne.el=te.el,z(b,ne,H)):ne=te,de&&_r(de),(_e=ne.props&&ne.props.onVnodeBeforeUpdate)&&Ot(_e,G,ne,te),ys(b,!0);const Te=lo(b),Ve=b.subTree;b.subTree=Te,m(Ve,Te,d(Ve.el),F(Ve),b,K,B),ne.el=Te.el,oe===null&&Xh(b,Te.el),ye&&st(ye,K),(_e=ne.props&&ne.props.onVnodeUpdated)&&st(()=>Ot(_e,G,ne,te),K)}else{let ne;const{el:de,props:ye}=y,{bm:G,m:te,parent:oe,root:_e,type:Te}=b,Ve=Tn(y);ys(b,!1),G&&_r(G),!Ve&&(ne=ye&&ye.onVnodeBeforeMount)&&Ot(ne,oe,y),ys(b,!0);{_e.ce&&_e.ce._hasShadowRoot()&&_e.ce._injectChildStyle(Te,b.parent?b.parent.type:void 0);const gt=b.subTree=lo(b);m(null,gt,A,D,b,K,B),y.el=gt.el}if(te&&st(te,K),!Ve&&(ne=ye&&ye.onVnodeMounted)){const gt=y;st(()=>Ot(ne,oe,gt),K)}(y.shapeFlag&256||oe&&Tn(oe.vnode)&&oe.vnode.shapeFlag&256)&&b.a&&st(b.a,K),b.isMounted=!0,y=A=D=null}};b.scope.on();const J=b.effect=new ec(se);b.scope.off();const U=b.update=J.run.bind(J),fe=b.job=J.runIfDirty.bind(J);fe.i=b,fe.id=b.uid,J.scheduler=()=>Aa(fe),ys(b,!0),U()},z=(b,y,A)=>{y.component=b;const D=b.vnode.props;b.vnode=y,b.next=null,ef(b,y.props,D,A),rf(b,y.children,A),ts(),Ya(b),ss()},Y=(b,y,A,D,K,B,H,se,J=!1)=>{const U=b&&b.children,fe=b?b.shapeFlag:0,ne=y.children,{patchFlag:de,shapeFlag:ye}=y;if(de>0){if(de&128){xe(U,ne,A,D,K,B,H,se,J);return}else if(de&256){ue(U,ne,A,D,K,B,H,se,J);return}}ye&8?(fe&16&&Ue(U,K,B),ne!==U&&u(A,ne)):fe&16?ye&16?xe(U,ne,A,D,K,B,H,se,J):Ue(U,K,B,!0):(fe&8&&u(A,""),ye&16&&C(ne,A,D,K,B,H,se,J))},ue=(b,y,A,D,K,B,H,se,J)=>{b=b||en,y=y||en;const U=b.length,fe=y.length,ne=Math.min(U,fe);let de;for(de=0;de<ne;de++){const ye=y[de]=J?Zt(y[de]):jt(y[de]);m(b[de],ye,A,null,K,B,H,se,J)}U>fe?Ue(b,K,B,!0,!1,ne):C(y,A,D,K,B,H,se,J,ne)},xe=(b,y,A,D,K,B,H,se,J)=>{let U=0;const fe=y.length;let ne=b.length-1,de=fe-1;for(;U<=ne&&U<=de;){const ye=b[U],G=y[U]=J?Zt(y[U]):jt(y[U]);if(As(ye,G))m(ye,G,A,null,K,B,H,se,J);else break;U++}for(;U<=ne&&U<=de;){const ye=b[ne],G=y[de]=J?Zt(y[de]):jt(y[de]);if(As(ye,G))m(ye,G,A,null,K,B,H,se,J);else break;ne--,de--}if(U>ne){if(U<=de){const ye=de+1,G=ye<fe?y[ye].el:D;for(;U<=de;)m(null,y[U]=J?Zt(y[U]):jt(y[U]),A,G,K,B,H,se,J),U++}}else if(U>de)for(;U<=ne;)T(b[U],K,B,!0),U++;else{const ye=U,G=U,te=new Map;for(U=G;U<=de;U++){const lt=y[U]=J?Zt(y[U]):jt(y[U]);lt.key!=null&&te.set(lt.key,U)}let oe,_e=0;const Te=de-G+1;let Ve=!1,gt=0;const bs=new Array(Te);for(U=0;U<Te;U++)bs[U]=0;for(U=ye;U<=ne;U++){const lt=b[U];if(_e>=Te){T(lt,K,B,!0);continue}let Ct;if(lt.key!=null)Ct=te.get(lt.key);else for(oe=G;oe<=de;oe++)if(bs[oe-G]===0&&As(lt,y[oe])){Ct=oe;break}Ct===void 0?T(lt,K,B,!0):(bs[Ct-G]=U+1,Ct>=gt?gt=Ct:Ve=!0,m(lt,y[Ct],A,null,K,B,H,se,J),_e++)}const qa=Ve?cf(bs):en;for(oe=qa.length-1,U=Te-1;U>=0;U--){const lt=G+U,Ct=y[lt],za=y[lt+1],Ka=lt+1<fe?za.el||Gc(za):D;bs[U]===0?m(null,Ct,A,Ka,K,B,H,se,J):Ve&&(oe<0||U!==qa[oe]?q(Ct,A,Ka,2):oe--)}}},q=(b,y,A,D,K=null)=>{const{el:B,type:H,transition:se,children:J,shapeFlag:U}=b;if(U&6){q(b.component.subTree,y,A,D);return}if(U&128){b.suspense.move(y,A,D);return}if(U&64){H.move(b,y,A,he);return}if(H===ke){n(B,y,A);for(let ne=0;ne<J.length;ne++)q(J[ne],y,A,D);n(b.anchor,y,A);return}if(H===xr){k(b,y,A);return}if(D!==2&&U&1&&se)if(D===0)se.beforeEnter(B),n(B,y,A),st(()=>se.enter(B),K);else{const{leave:ne,delayLeave:de,afterLeave:ye}=se,G=()=>{b.ctx.isUnmounted?r(B):n(B,y,A)},te=()=>{B._isLeaving&&B[It](!0),ne(B,()=>{G(),ye&&ye()})};de?de(B,G,te):te()}else n(B,y,A)},T=(b,y,A,D=!1,K=!1)=>{const{type:B,props:H,ref:se,children:J,dynamicChildren:U,shapeFlag:fe,patchFlag:ne,dirs:de,cacheIndex:ye,memo:G}=b;if(ne===-2&&(K=!1),se!=null&&(ts(),Sn(se,null,A,b,!0),ss()),ye!=null&&(y.renderCache[ye]=void 0),fe&256){y.ctx.deactivate(b);return}const te=fe&1&&de,oe=!Tn(b);let _e;if(oe&&(_e=H&&H.onVnodeBeforeUnmount)&&Ot(_e,y,b),fe&6)ce(b.component,A,D);else{if(fe&128){b.suspense.unmount(A,D);return}te&&vs(b,null,y,"beforeUnmount"),fe&64?b.type.remove(b,y,A,he,D):U&&!U.hasOnce&&(B!==ke||ne>0&&ne&64)?Ue(U,y,A,!1,!0):(B===ke&&ne&384||!K&&fe&16)&&Ue(J,y,A),D&&O(b)}const Te=G!=null&&ye==null;(oe&&(_e=H&&H.onVnodeUnmounted)||te||Te)&&st(()=>{_e&&Ot(_e,y,b),te&&vs(b,null,y,"unmounted"),Te&&(b.el=null)},A)},O=b=>{const{type:y,el:A,anchor:D,transition:K}=b;if(y===ke){X(A,D);return}if(y===xr){P(b);return}const B=()=>{r(A),K&&!K.persisted&&K.afterLeave&&K.afterLeave()};if(b.shapeFlag&1&&K&&!K.persisted){const{leave:H,delayLeave:se}=K,J=()=>H(A,B);se?se(b.el,B,J):J()}else B()},X=(b,y)=>{let A;for(;b!==y;)A=h(b),r(b),b=A;r(y)},ce=(b,y,A)=>{const{bum:D,scope:K,job:B,subTree:H,um:se,m:J,a:U}=b;ho(J),ho(U),D&&_r(D),K.stop(),B&&(B.flags|=8,T(H,b,y,A)),se&&st(se,y),st(()=>{b.isUnmounted=!0},y)},Ue=(b,y,A,D=!1,K=!1,B=0)=>{for(let H=B;H<b.length;H++)T(b[H],y,A,D,K)},F=b=>{if(b.shapeFlag&6)return F(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const y=h(b.anchor||b.el),A=y&&y[kc];return A?h(A):y};let ae=!1;const ie=(b,y,A)=>{let D;b==null?y._vnode&&(T(y._vnode,null,null,!0),D=y._vnode.component):m(y._vnode||null,b,y,null,null,null,A),y._vnode=b,ae||(ae=!0,Ya(D),yc(),ae=!1)},he={p:m,um:T,m:q,r:O,mt:L,mc:C,pc:Y,pbc:V,n:F,o:e};return{render:ie,hydrate:void 0,createApp:zh(ie)}}function xi({type:e,props:t},s){return s==="svg"&&e==="foreignObject"||s==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:s}function ys({effect:e,job:t},s){s?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function lf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function $a(e,t,s=!1){const n=e.children,r=t.children;if(me(n)&&me(r))for(let i=0;i<n.length;i++){const a=n[i];let o=r[i];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=r[i]=Zt(r[i]),o.el=a.el),!s&&o.patchFlag!==-2&&$a(a,o)),o.type===ni&&(o.patchFlag===-1&&(o=r[i]=Zt(o)),o.el=a.el),o.type===it&&!o.el&&(o.el=a.el)}}function cf(e){const t=e.slice(),s=[0];let n,r,i,a,o;const l=e.length;for(n=0;n<l;n++){const c=e[n];if(c!==0){if(r=s[s.length-1],e[r]<c){t[n]=r,s.push(n);continue}for(i=0,a=s.length-1;i<a;)o=i+a>>1,e[s[o]]<c?i=o+1:a=o;c<e[s[i]]&&(i>0&&(t[n]=s[i-1]),s[i]=n)}}for(i=s.length,a=s[i-1];i-- >0;)s[i]=a,a=t[a];return s}function Wc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Wc(t)}function ho(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Gc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Gc(t.subTree):null}const Zc=e=>e.__isSuspense;function uf(e,t){t&&t.pendingBranch?me(e)?t.effects.push(...e):t.effects.push(e):fh(e)}const ke=Symbol.for("v-fgt"),ni=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),xr=Symbol.for("v-stc"),Rn=[];let ht=null;function _(e=!1){Rn.push(ht=e?null:[])}function df(){Rn.pop(),ht=Rn[Rn.length-1]||null}let Dn=1;function $r(e,t=!1){Dn+=e,e<0&&ht&&t&&(ht.hasOnce=!0)}function Jc(e){return e.dynamicChildren=Dn>0?ht||en:null,df(),Dn>0&&ht&&ht.push(e),e}function w(e,t,s,n,r,i){return Jc(p(e,t,s,n,r,i,!0))}function nn(e,t,s,n,r){return Jc(be(e,t,s,n,r,!0))}function Nr(e){return e?e.__v_isVNode===!0:!1}function As(e,t){return e.type===t.type&&e.key===t.key}const Yc=({key:e})=>e??null,Er=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?De(e)||Fe(e)||Ee(e)?{i:ut,r:e,k:t,f:!!s}:e:null);function p(e,t=null,s=null,n=0,r=null,i=e===ke?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Yc(t),ref:t&&Er(t),scopeId:wc,slotScopeIds:null,children:s,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:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ut};return o?(Na(l,s),i&128&&e.normalize(l)):s&&(l.shapeFlag|=De(s)?8:16),Dn>0&&!a&&ht&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ht.push(l),l}const be=hf;function hf(e,t=null,s=null,n=0,r=null,i=!1){if((!e||e===Ic)&&(e=it),Nr(e)){const o=ms(e,t,!0);return s&&Na(o,s),Dn>0&&!i&&ht&&(o.shapeFlag&6?ht[ht.indexOf(e)]=o:ht.push(o)),o.patchFlag=-2,o}if(Ef(e)&&(e=e.__vccOpts),t){t=ff(t);let{class:o,style:l}=t;o&&!De(o)&&(t.class=ge(o)),Ne(l)&&(Yr(l)&&!me(l)&&(l=Ze({},l)),t.style=ya(l))}const a=De(e)?1:Zc(e)?128:Sc(e)?64:Ne(e)?4:Ee(e)?2:0;return p(e,t,s,n,r,a,i,!0)}function ff(e){return e?Yr(e)||Hc(e)?Ze({},e):e:null}function ms(e,t,s=!1,n=!1){const{props:r,ref:i,patchFlag:a,children:o,transition:l}=e,c=t?pf(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Yc(c),ref:t&&t.ref?s&&i?me(i)?i.concat(Er(t)):[i,Er(t)]:Er(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:o,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ke?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ms(e.ssContent),ssFallback:e.ssFallback&&ms(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&n&&jn(u,l.clone(u)),u}function ve(e=" ",t=0){return be(ni,null,e,t)}function er(e,t){const s=be(xr,null,e);return s.staticCount=t,s}function ee(e="",t=!1){return t?(_(),nn(it,null,e)):be(it,null,e)}function jt(e){return e==null||typeof e=="boolean"?be(it):me(e)?be(ke,null,e.slice()):Nr(e)?Zt(e):be(ni,null,String(e))}function Zt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ms(e)}function Na(e,t){let s=0;const{shapeFlag:n}=e;if(t==null)t=null;else if(me(t))s=16;else if(typeof t=="object")if(n&65){const r=t.default;r&&(r._c&&(r._d=!1),Na(e,r()),r._c&&(r._d=!0));return}else{s=32;const r=t._;!r&&!Hc(t)?t._ctx=ut:r===3&&ut&&(ut.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ee(t)?(t={default:t,_ctx:ut},s=32):(t=String(t),n&64?(s=16,t=[ve(t)]):s=8);e.children=t,e.shapeFlag|=s}function pf(...e){const t={};for(let s=0;s<e.length;s++){const n=e[s];for(const r in n)if(r==="class")t.class!==n.class&&(t.class=ge([t.class,n.class]));else if(r==="style")t.style=ya([t.style,n.style]);else if(Vr(r)){const i=t[r],a=n[r];a&&i!==a&&!(me(i)&&i.includes(a))?t[r]=i?[].concat(i,a):a:a==null&&i==null&&!qr(r)&&(t[r]=a)}else r!==""&&(t[r]=n[r])}return t}function Ot(e,t,s,n=null){At(e,t,7,[s,n])}const gf=Mc();let mf=0;function bf(e,t,s){const n=e.type,r=(t?t.appContext:e.appContext)||gf,i={uid:mf++,vnode:e,type:n,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Vc(n,r),emitsOptions:jc(n,r),emit:null,emitted:null,propsDefaults:Pe,inheritAttrs:n.inheritAttrs,ctx:Pe,data:Pe,props:Pe,attrs:Pe,slots:Pe,refs:Pe,setupState:Pe,setupContext:null,suspense:s,suspenseId:s?s.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=Wh.bind(null,i),e.ce&&e.ce(i),i}let et=null;const Ia=()=>et||ut;let Ir,Gi;{const e=Zr(),t=(s,n)=>{let r;return(r=e[s])||(r=e[s]=[]),r.push(n),i=>{r.length>1?r.forEach(a=>a(i)):r[0](i)}};Ir=t("__VUE_INSTANCE_SETTERS__",s=>et=s),Gi=t("__VUE_SSR_SETTERS__",s=>Un=s)}const tr=e=>{const t=et;return Ir(e),e.scope.on(),()=>{e.scope.off(),Ir(t)}},fo=()=>{et&&et.scope.off(),Ir(null)};function Xc(e){return e.vnode.shapeFlag&4}let Un=!1;function vf(e,t=!1,s=!1){t&&Gi(t);const{props:n,children:r}=e.vnode,i=Xc(e);Qh(e,n,i,t),nf(e,r,s||t);const a=i?yf(e,t):void 0;return t&&Gi(!1),a}function yf(e,t){const s=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Dh);const{setup:n}=s;if(n){ts();const r=e.setupContext=n.length>1?wf(e):null,i=tr(e),a=Qn(n,e,0,[e.props,r]),o=Vl(a);if(ss(),i(),(o||e.sp)&&!Tn(e)&&$c(e),o){if(a.then(fo,fo),t)return a.then(l=>{po(e,l)}).catch(l=>{Xr(l,e,0)});e.asyncDep=a}else po(e,a)}else Qc(e)}function po(e,t,s){Ee(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ne(t)&&(e.setupState=mc(t)),Qc(e)}function Qc(e,t,s){const n=e.type;e.render||(e.render=n.render||Bt);{const r=tr(e);ts();try{Uh(e)}finally{ss(),r()}}}const _f={get(e,t){return Qe(e,"get",""),e[t]}};function wf(e){const t=s=>{e.exposed=s||{}};return{attrs:new Proxy(e.attrs,_f),slots:e.slots,emit:e.emit,expose:t}}function ri(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(mc(Ta(e.exposed)),{get(t,s){if(s in t)return t[s];if(s in An)return An[s](e)},has(t,s){return s in t||s in An}})):e.proxy}function xf(e,t=!0){return Ee(e)?e.displayName||e.name:e.name||t&&e.__name}function Ef(e){return Ee(e)&&"__vccOpts"in e}const je=(e,t)=>lh(e,t,Un);function Pa(e,t,s){try{$r(-1);const n=arguments.length;return n===2?Ne(t)&&!me(t)?Nr(t)?be(e,null,[t]):be(e,t):be(e,null,t):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&Nr(s)&&(s=[s]),be(e,t,s))}finally{$r(1)}}const kf="3.5.34";/**
13
+ **/function Qn(e,t,s,n){try{return n?e(...n):e()}catch(r){Xr(r,t,s)}}function At(e,t,s,n){if(Ee(e)){const r=Qn(e,t,s,n);return r&&Vl(r)&&r.catch(i=>{Xr(i,t,s)}),r}if(me(e)){const r=[];for(let i=0;i<e.length;i++)r.push(At(e[i],t,s,n));return r}}function Xr(e,t,s,n=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||Pe;if(t){let o=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${s}`;for(;o;){const u=o.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,l,c)===!1)return}o=o.parent}if(i){ts(),Qn(i,null,10,[e,l,c]),ss();return}}dh(e,s,r,n,a)}function dh(e,t,s,n=!0,r=!1){if(r)throw e;console.error(e)}const rt=[];let Nt=-1;const sn=[];let us=null,Ws=0;const bc=Promise.resolve();let Ar=null;function Is(e){const t=Ar||bc;return e?t.then(this?e.bind(this):e):t}function hh(e){let t=Nt+1,s=rt.length;for(;t<s;){const n=t+s>>>1,r=rt[n],i=Mn(r);i<e||i===e&&r.flags&2?t=n+1:s=n}return t}function Aa(e){if(!(e.flags&1)){const t=Mn(e),s=rt[rt.length-1];!s||!(e.flags&2)&&t>=Mn(s)?rt.push(e):rt.splice(hh(t),0,e),e.flags|=1,vc()}}function vc(){Ar||(Ar=bc.then(_c))}function fh(e){me(e)?sn.push(...e):us&&e.id===-1?us.splice(Ws+1,0,e):e.flags&1||(sn.push(e),e.flags|=1),vc()}function Ya(e,t,s=Nt+1){for(;s<rt.length;s++){const n=rt[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;rt.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function yc(e){if(sn.length){const t=[...new Set(sn)].sort((s,n)=>Mn(s)-Mn(n));if(sn.length=0,us){us.push(...t);return}for(us=t,Ws=0;Ws<us.length;Ws++){const s=us[Ws];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}us=null,Ws=0}}const Mn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function _c(e){try{for(Nt=0;Nt<rt.length;Nt++){const t=rt[Nt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Qn(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Nt<rt.length;Nt++){const t=rt[Nt];t&&(t.flags&=-2)}Nt=-1,rt.length=0,yc(),Ar=null,(rt.length||sn.length)&&_c()}}let ut=null,wc=null;function Rr(e){const t=ut;return ut=e,wc=e&&e.type.__scopeId||null,t}function gs(e,t=ut,s){if(!t||e._n)return e;const n=(...r)=>{n._d&&$r(-1);const i=Rr(t);let a;try{a=e(...r)}finally{Rr(i),n._d&&$r(1)}return a};return n._n=!0,n._c=!0,n._d=!0,n}function dt(e,t){if(ut===null)return e;const s=ri(ut),n=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,a,o,l=Pe]=t[r];i&&(Ee(i)&&(i={mounted:i,updated:i}),i.deep&&Yt(a),n.push({dir:i,instance:s,value:a,oldValue:void 0,arg:o,modifiers:l}))}return e}function vs(e,t,s,n){const r=e.dirs,i=t&&t.dirs;for(let a=0;a<r.length;a++){const o=r[a];i&&(o.oldValue=i[a].value);let l=o.dir[n];l&&(ts(),At(l,s,8,[e.el,o,e,t]),ss())}}function wr(e,t){if(et){let s=et.provides;const n=et.parent&&et.parent.provides;n===s&&(s=et.provides=Object.create(n)),s[e]=t}}function vt(e,t,s=!1){const n=Ia();if(n||Ps){let r=Ps?Ps._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return s&&Ee(t)?t.call(n&&n.proxy):t}}function ph(){return!!(Ia()||Ps)}const gh=Symbol.for("v-scx"),mh=()=>vt(gh);function es(e,t,s){return xc(e,t,s)}function xc(e,t,s=Pe){const{immediate:n,deep:r,flush:i,once:a}=s,o=Ze({},s),l=t&&n||!t&&i!=="post";let c;if(Un){if(i==="sync"){const f=mh();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Bt,f.resume=Bt,f.pause=Bt,f}}const u=et;o.call=(f,g,b)=>At(f,u,g,b);let d=!1;i==="post"?o.scheduler=f=>{st(f,u&&u.suspense)}:i!=="sync"&&(d=!0,o.scheduler=(f,g)=>{g?f():Aa(f)}),o.augmentJob=f=>{t&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=uh(e,t,o);return Un&&(c?c.push(h):l&&h()),h}function bh(e,t,s){const n=this.proxy,r=De(e)?e.includes(".")?Ec(n,e):()=>n[e]:e.bind(n,n);let i;Ee(t)?i=t:(i=t.handler,s=t);const a=tr(this),o=xc(r,i.bind(n),s);return a(),o}function Ec(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;r<s.length&&n;r++)n=n[s[r]];return n}}const ls=new WeakMap,kc=Symbol("_vte"),Sc=e=>e.__isTeleport,Ts=e=>e&&(e.disabled||e.disabled===""),vh=e=>e&&(e.defer||e.defer===""),Xa=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qa=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Hi=(e,t)=>{const s=e&&e.to;return De(s)?t?t(s):null:s},yh={name:"Teleport",__isTeleport:!0,process(e,t,s,n,r,i,a,o,l,c){const{mc:u,pc:d,pbc:h,o:{insert:f,querySelector:g,createText:b,createComment:S,parentNode:E}}=c,x=Ts(t.props);let{dynamicChildren:k}=t;const P=(v,C,j)=>{v.shapeFlag&16&&u(v.children,C,j,r,i,a,o,l)},N=(v=t)=>{const C=Ts(v.props),j=v.target=Hi(v.props,g),V=Fi(j,v,b,f);j&&(a!=="svg"&&Xa(j)?a="svg":a!=="mathml"&&Qa(j)&&(a="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(j),C||(P(v,j,V),bn(v,!1)))},R=v=>{const C=()=>{if(ls.get(v)===C){if(ls.delete(v),Ts(v.props)){const j=E(v.el)||s;P(v,j,v.anchor),bn(v,!0)}N(v)}};ls.set(v,C),st(C,i)};if(e==null){const v=t.el=b(""),C=t.anchor=b("");if(f(v,s,n),f(C,s,n),vh(t.props)||i&&i.pendingBranch){R(t);return}x&&(P(t,s,C),bn(t,!0)),N()}else{t.el=e.el;const v=t.anchor=e.anchor,C=ls.get(e);if(C){C.flags|=8,ls.delete(e),R(t);return}t.targetStart=e.targetStart;const j=t.target=e.target,V=t.targetAnchor=e.targetAnchor,Z=Ts(e.props),$=Z?s:j,W=Z?v:V;if(a==="svg"||Xa(j)?a="svg":(a==="mathml"||Qa(j))&&(a="mathml"),k?(h(e.dynamicChildren,k,$,r,i,a,o),$a(e,t,!0)):l||d(e,t,$,W,r,i,a,o,!1),x)Z?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):lr(t,s,v,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const L=t.target=Hi(t.props,g);L&&lr(t,L,null,c,0)}else Z&&lr(t,j,V,c,1);bn(t,x)}},remove(e,t,s,{um:n,o:{remove:r}},i){const{shapeFlag:a,children:o,anchor:l,targetStart:c,targetAnchor:u,target:d,props:h}=e;let f=i||!Ts(h);const g=ls.get(e);if(g&&(g.flags|=8,ls.delete(e),f=!1),d&&(r(c),r(u)),i&&r(l),a&16)for(let b=0;b<o.length;b++){const S=o[b];n(S,t,s,f,!!S.dynamicChildren)}},move:lr,hydrate:_h};function lr(e,t,s,{o:{insert:n},m:r},i=2){i===0&&n(e.targetAnchor,t,s);const{el:a,anchor:o,shapeFlag:l,children:c,props:u}=e,d=i===2;if(d&&n(a,t,s),!ls.has(e)&&(!d||Ts(u))&&l&16)for(let h=0;h<c.length;h++)r(c[h],t,s,2);d&&n(o,t,s)}function _h(e,t,s,n,r,i,{o:{nextSibling:a,parentNode:o,querySelector:l,insert:c,createText:u}},d){function h(S,E){let x=E;for(;x;){if(x&&x.nodeType===8){if(x.data==="teleport start anchor")t.targetStart=x;else if(x.data==="teleport anchor"){t.targetAnchor=x,S._lpa=t.targetAnchor&&a(t.targetAnchor);break}}x=a(x)}}function f(S,E){E.anchor=d(a(S),E,o(S),s,n,r,i)}const g=t.target=Hi(t.props,l),b=Ts(t.props);if(g){const S=g._lpa||g.firstChild;t.shapeFlag&16&&(b?(f(e,t),h(g,S),t.targetAnchor||Fi(g,t,u,c,o(e)===g?e:null)):(t.anchor=a(e),h(g,S),t.targetAnchor||Fi(g,t,u,c),d(S&&a(S),t,g,s,n,r,i))),bn(t,b)}else b&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=a(e));return t.anchor&&a(t.anchor)}const wh=yh;function bn(e,t){const s=e.ctx;if(s&&s.ut){let n,r;for(t?(n=e.el,r=e.anchor):(n=e.targetStart,r=e.targetAnchor);n&&n!==r;)n.nodeType===1&&n.setAttribute("data-v-owner",s.uid),n=n.nextSibling;s.ut()}}function Fi(e,t,s,n,r=null){const i=t.targetStart=s(""),a=t.targetAnchor=s("");return i[kc]=a,e&&(n(i,e,r),n(a,e,r)),a}const It=Symbol("_leaveCb"),fn=Symbol("_enterCb");function xh(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ht(()=>{e.isMounted=!0}),Ra(()=>{e.isUnmounting=!0}),e}const mt=[Function,Array],Tc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:mt,onEnter:mt,onAfterEnter:mt,onEnterCancelled:mt,onBeforeLeave:mt,onLeave:mt,onAfterLeave:mt,onLeaveCancelled:mt,onBeforeAppear:mt,onAppear:mt,onAfterAppear:mt,onAppearCancelled:mt},Ac=e=>{const t=e.subTree;return t.component?Ac(t.component):t},Eh={name:"BaseTransition",props:Tc,setup(e,{slots:t}){const s=Ia(),n=xh();return()=>{const r=t.default&&Oc(t.default(),!0),i=r&&r.length?Rc(r):s.subTree?ee():void 0;if(!i)return;const a=Ae(e),{mode:o}=a;if(n.isLeaving)return _i(i);const l=eo(i);if(!l)return _i(i);let c=Vi(l,a,n,s,d=>c=d);l.type!==it&&jn(l,c);let u=s.subTree&&eo(s.subTree);if(u&&u.type!==it&&!As(u,l)&&Ac(s).type!==it){let d=Vi(u,a,n,s);if(jn(u,d),o==="out-in"&&l.type!==it)return n.isLeaving=!0,d.afterLeave=()=>{n.isLeaving=!1,s.job.flags&8||s.update(),delete d.afterLeave,u=void 0},_i(i);o==="in-out"&&l.type!==it?d.delayLeave=(h,f,g)=>{const b=Cc(n,u);b[String(u.key)]=u,h[It]=()=>{f(),h[It]=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 Rc(e){let t=e[0];if(e.length>1){for(const s of e)if(s.type!==it){t=s;break}}return t}const kh=Eh;function Cc(e,t){const{leavingVNodes:s}=e;let n=s.get(t.type);return n||(n=Object.create(null),s.set(t.type,n)),n}function Vi(e,t,s,n,r){const{appear:i,mode:a,persisted:o=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:h,onLeave:f,onAfterLeave:g,onLeaveCancelled:b,onBeforeAppear:S,onAppear:E,onAfterAppear:x,onAppearCancelled:k}=t,P=String(e.key),N=Cc(s,e),R=(j,V)=>{j&&At(j,n,9,V)},v=(j,V)=>{const Z=V[1];R(j,V),me(j)?j.every($=>$.length<=1)&&Z():j.length<=1&&Z()},C={mode:a,persisted:o,beforeEnter(j){let V=l;if(!s.isMounted)if(i)V=S||l;else return;j[It]&&j[It](!0);const Z=N[P];Z&&As(e,Z)&&Z.el[It]&&Z.el[It](),R(V,[j])},enter(j){if(N[P]===e)return;let V=c,Z=u,$=d;if(!s.isMounted)if(i)V=E||c,Z=x||u,$=k||d;else return;let W=!1;j[fn]=pe=>{W||(W=!0,pe?R($,[j]):R(Z,[j]),C.delayedLeave&&C.delayedLeave(),j[fn]=void 0)};const L=j[fn].bind(null,!1);V?v(V,[j,L]):L()},leave(j,V){const Z=String(e.key);if(j[fn]&&j[fn](!0),s.isUnmounting)return V();R(h,[j]);let $=!1;j[It]=L=>{$||($=!0,V(),L?R(b,[j]):R(g,[j]),j[It]=void 0,N[Z]===e&&delete N[Z])};const W=j[It].bind(null,!1);N[Z]=e,f?v(f,[j,W]):W()},clone(j){const V=Vi(j,t,s,n,r);return r&&r(V),V}};return C}function _i(e){if(Qr(e))return e=ms(e),e.children=null,e}function eo(e){if(!Qr(e))return Sc(e.type)&&e.children?Rc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:s}=e;if(s){if(t&16)return s[0];if(t&32&&Ee(s.default))return s.default()}}function jn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,jn(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 Oc(e,t=!1,s){let n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i];const o=s==null?a.key:String(s)+String(a.key!=null?a.key:i);a.type===ke?(a.patchFlag&128&&r++,n=n.concat(Oc(a.children,t,o))):(t||a.type!==it)&&n.push(o!=null?ms(a,{key:o}):a)}if(r>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function pt(e,t){return Ee(e)?Ze({name:e.name},t,{setup:e}):e}function $c(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function to(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const Cr=new WeakMap;function Sn(e,t,s,n,r=!1){if(me(e)){e.forEach((b,S)=>Sn(b,t&&(me(t)?t[S]:t),s,n,r));return}if(Tn(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Sn(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?ri(n.component):n.el,a=r?null:i,{i:o,r:l}=e,c=t&&t.r,u=o.refs===Pe?o.refs={}:o.refs,d=o.setupState,h=Ae(d),f=d===Pe?Fl:b=>to(u,b)?!1:$e(h,b),g=(b,S)=>!(S&&to(u,S));if(c!=null&&c!==l){if(so(t),De(c))u[c]=null,f(c)&&(d[c]=null);else if(Fe(c)){const b=t;g(c,b.k)&&(c.value=null),b.k&&(u[b.k]=null)}}if(Ee(l))Qn(l,o,12,[a,u]);else{const b=De(l),S=Fe(l);if(b||S){const E=()=>{if(e.f){const x=b?f(l)?d[l]:u[l]:g()||!e.k?l.value:u[e.k];if(r)me(x)&&ba(x,i);else if(me(x))x.includes(i)||x.push(i);else if(b)u[l]=[i],f(l)&&(d[l]=u[l]);else{const k=[i];g(l,e.k)&&(l.value=k),e.k&&(u[e.k]=k)}}else b?(u[l]=a,f(l)&&(d[l]=a)):S&&(g(l,e.k)&&(l.value=a),e.k&&(u[e.k]=a))};if(a){const x=()=>{E(),Cr.delete(e)};x.id=-1,Cr.set(e,x),st(x,s)}else so(e),E()}}}function so(e){const t=Cr.get(e);t&&(t.flags|=8,Cr.delete(e))}Zr().requestIdleCallback;Zr().cancelIdleCallback;const Tn=e=>!!e.type.__asyncLoader,Qr=e=>e.type.__isKeepAlive;function Sh(e,t){Nc(e,"a",t)}function Th(e,t){Nc(e,"da",t)}function Nc(e,t,s=et){const n=e.__wdc||(e.__wdc=()=>{let r=s;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ei(t,n,s),s){let r=s.parent;for(;r&&r.parent;)Qr(r.parent.vnode)&&Ah(n,t,s,r),r=r.parent}}function Ah(e,t,s,n){const r=ei(t,e,n,!0);ti(()=>{ba(n[t],r)},s)}function ei(e,t,s=et,n=!1){if(s){const r=s[e]||(s[e]=[]),i=t.__weh||(t.__weh=(...a)=>{ts();const o=tr(s),l=At(t,s,e,a);return o(),ss(),l});return n?r.unshift(i):r.push(i),i}}const rs=e=>(t,s=et)=>{(!Un||e==="sp")&&ei(e,(...n)=>t(...n),s)},Rh=rs("bm"),Ht=rs("m"),Ch=rs("bu"),Oh=rs("u"),Ra=rs("bum"),ti=rs("um"),$h=rs("sp"),Nh=rs("rtg"),Ih=rs("rtc");function Ph(e,t=et){ei("ec",e,t)}const Lh="components",Ic=Symbol.for("v-ndc");function Mh(e){return De(e)?jh(Lh,e,!1)||e:e||Ic}function jh(e,t,s=!0,n=!1){const r=ut||et;if(r){const i=r.type;{const o=xf(i,!1);if(o&&(o===t||o===at(t)||o===Gr(at(t))))return i}const a=no(r[e]||i[e],t)||no(r.appContext[e],t);return!a&&n?i:a}}function no(e,t){return e&&(e[t]||e[at(t)]||e[Gr(at(t))])}function ze(e,t,s,n){let r;const i=s,a=me(e);if(a||De(e)){const o=a&&Qt(e);let l=!1,c=!1;o&&(l=!ft(e),c=ns(e),e=Jr(e)),r=new Array(e.length);for(let u=0,d=e.length;u<d;u++)r[u]=t(l?c?on(Tt(e[u])):Tt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){r=new Array(e);for(let o=0;o<e;o++)r[o]=t(o+1,o,void 0,i)}else if(Ne(e))if(e[Symbol.iterator])r=Array.from(e,(o,l)=>t(o,l,void 0,i));else{const o=Object.keys(e);r=new Array(o.length);for(let l=0,c=o.length;l<c;l++){const u=o[l];r[l]=t(e[u],u,l,i)}}else r=[];return r}const qi=e=>e?Xc(e)?ri(e):qi(e.parent):null,An=Ze(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=>qi(e.parent),$root:e=>qi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Lc(e),$forceUpdate:e=>e.f||(e.f=()=>{Aa(e.update)}),$nextTick:e=>e.n||(e.n=Is.bind(e.proxy)),$watch:e=>bh.bind(e)}),wi=(e,t)=>e!==Pe&&!e.__isScriptSetup&&$e(e,t),Dh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:s,setupState:n,data:r,props:i,accessCache:a,type:o,appContext:l}=e;if(t[0]!=="$"){const h=a[t];if(h!==void 0)switch(h){case 1:return n[t];case 2:return r[t];case 4:return s[t];case 3:return i[t]}else{if(wi(n,t))return a[t]=1,n[t];if(r!==Pe&&$e(r,t))return a[t]=2,r[t];if($e(i,t))return a[t]=3,i[t];if(s!==Pe&&$e(s,t))return a[t]=4,s[t];zi&&(a[t]=0)}}const c=An[t];let u,d;if(c)return t==="$attrs"&&Qe(e.attrs,"get",""),c(e);if((u=o.__cssModules)&&(u=u[t]))return u;if(s!==Pe&&$e(s,t))return a[t]=4,s[t];if(d=l.config.globalProperties,$e(d,t))return d[t]},set({_:e},t,s){const{data:n,setupState:r,ctx:i}=e;return wi(r,t)?(r[t]=s,!0):n!==Pe&&$e(n,t)?(n[t]=s,!0):$e(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=s,!0)},has({_:{data:e,setupState:t,accessCache:s,ctx:n,appContext:r,props:i,type:a}},o){let l;return!!(s[o]||e!==Pe&&o[0]!=="$"&&$e(e,o)||wi(t,o)||$e(i,o)||$e(n,o)||$e(An,o)||$e(r.config.globalProperties,o)||(l=a.__cssModules)&&l[o])},defineProperty(e,t,s){return s.get!=null?e._.accessCache[t]=0:$e(s,"value")&&this.set(e,t,s.value,null),Reflect.defineProperty(e,t,s)}};function ro(e){return me(e)?e.reduce((t,s)=>(t[s]=null,t),{}):e}let zi=!0;function Uh(e){const t=Lc(e),s=e.proxy,n=e.ctx;zi=!1,t.beforeCreate&&io(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:a,watch:o,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:g,activated:b,deactivated:S,beforeDestroy:E,beforeUnmount:x,destroyed:k,unmounted:P,render:N,renderTracked:R,renderTriggered:v,errorCaptured:C,serverPrefetch:j,expose:V,inheritAttrs:Z,components:$,directives:W,filters:L}=t;if(c&&Bh(c,n,null),a)for(const z in a){const Y=a[z];Ee(Y)&&(n[z]=Y.bind(s))}if(r){const z=r.call(s,s);Ne(z)&&(e.data=Xt(z))}if(zi=!0,i)for(const z in i){const Y=i[z],ue=Ee(Y)?Y.bind(s,s):Ee(Y.get)?Y.get.bind(s,s):Bt,xe=!Ee(Y)&&Ee(Y.set)?Y.set.bind(s):Bt,q=je({get:ue,set:xe});Object.defineProperty(n,z,{enumerable:!0,configurable:!0,get:()=>q.value,set:T=>q.value=T})}if(o)for(const z in o)Pc(o[z],n,s,z);if(l){const z=Ee(l)?l.call(s):l;Reflect.ownKeys(z).forEach(Y=>{wr(Y,z[Y])})}u&&io(u,e,"c");function M(z,Y){me(Y)?Y.forEach(ue=>z(ue.bind(s))):Y&&z(Y.bind(s))}if(M(Rh,d),M(Ht,h),M(Ch,f),M(Oh,g),M(Sh,b),M(Th,S),M(Ph,C),M(Ih,R),M(Nh,v),M(Ra,x),M(ti,P),M($h,j),me(V))if(V.length){const z=e.exposed||(e.exposed={});V.forEach(Y=>{Object.defineProperty(z,Y,{get:()=>s[Y],set:ue=>s[Y]=ue,enumerable:!0})})}else e.exposed||(e.exposed={});N&&e.render===Bt&&(e.render=N),Z!=null&&(e.inheritAttrs=Z),$&&(e.components=$),W&&(e.directives=W),j&&$c(e)}function Bh(e,t,s=Bt){me(e)&&(e=Ki(e));for(const n in e){const r=e[n];let i;Ne(r)?"default"in r?i=vt(r.from||n,r.default,!0):i=vt(r.from||n):i=vt(r),Fe(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:a=>i.value=a}):t[n]=i}}function io(e,t,s){At(me(e)?e.map(n=>n.bind(t.proxy)):e.bind(t.proxy),t,s)}function Pc(e,t,s,n){let r=n.includes(".")?Ec(s,n):()=>s[n];if(De(e)){const i=t[e];Ee(i)&&es(r,i)}else if(Ee(e))es(r,e.bind(s));else if(Ne(e))if(me(e))e.forEach(i=>Pc(i,t,s,n));else{const i=Ee(e.handler)?e.handler.bind(s):t[e.handler];Ee(i)&&es(r,i,e)}}function Lc(e){const t=e.type,{mixins:s,extends:n}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:a}}=e.appContext,o=i.get(t);let l;return o?l=o:!r.length&&!s&&!n?l=t:(l={},r.length&&r.forEach(c=>Or(l,c,a,!0)),Or(l,t,a)),Ne(t)&&i.set(t,l),l}function Or(e,t,s,n=!1){const{mixins:r,extends:i}=t;i&&Or(e,i,s,!0),r&&r.forEach(a=>Or(e,a,s,!0));for(const a in t)if(!(n&&a==="expose")){const o=Hh[a]||s&&s[a];e[a]=o?o(e[a],t[a]):t[a]}return e}const Hh={data:ao,props:oo,emits:oo,methods:vn,computed:vn,beforeCreate:tt,created:tt,beforeMount:tt,mounted:tt,beforeUpdate:tt,updated:tt,beforeDestroy:tt,beforeUnmount:tt,destroyed:tt,unmounted:tt,activated:tt,deactivated:tt,errorCaptured:tt,serverPrefetch:tt,components:vn,directives:vn,watch:Vh,provide:ao,inject:Fh};function ao(e,t){return t?e?function(){return Ze(Ee(e)?e.call(this,this):e,Ee(t)?t.call(this,this):t)}:t:e}function Fh(e,t){return vn(Ki(e),Ki(t))}function Ki(e){if(me(e)){const t={};for(let s=0;s<e.length;s++)t[e[s]]=e[s];return t}return e}function tt(e,t){return e?[...new Set([].concat(e,t))]:t}function vn(e,t){return e?Ze(Object.create(null),e,t):t}function oo(e,t){return e?me(e)&&me(t)?[...new Set([...e,...t])]:Ze(Object.create(null),ro(e),ro(t??{})):t}function Vh(e,t){if(!e)return t;if(!t)return e;const s=Ze(Object.create(null),e);for(const n in t)s[n]=tt(e[n],t[n]);return s}function Mc(){return{app:null,config:{isNativeTag:Fl,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 qh=0;function zh(e,t){return function(n,r=null){Ee(n)||(n=Ze({},n)),r!=null&&!Ne(r)&&(r=null);const i=Mc(),a=new WeakSet,o=[];let l=!1;const c=i.app={_uid:qh++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:kf,get config(){return i.config},set config(u){},use(u,...d){return a.has(u)||(u&&Ee(u.install)?(a.add(u),u.install(c,...d)):Ee(u)&&(a.add(u),u(c,...d))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!l){const f=c._ceVNode||be(n,r);return f.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),e(f,u,h),l=!0,c._container=u,u.__vue_app__=c,ri(f.component)}},onUnmount(u){o.push(u)},unmount(){l&&(At(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=Ps;Ps=c;try{return u()}finally{Ps=d}}};return c}}let Ps=null;const Kh=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${at(t)}Modifiers`]||e[`${js(t)}Modifiers`];function Wh(e,t,...s){if(e.isUnmounted)return;const n=e.vnode.props||Pe;let r=s;const i=t.startsWith("update:"),a=i&&Kh(n,t.slice(7));a&&(a.trim&&(r=s.map(u=>De(u)?u.trim():u)),a.number&&(r=s.map(va)));let o,l=n[o=gi(t)]||n[o=gi(at(t))];!l&&i&&(l=n[o=gi(js(t))]),l&&At(l,e,6,r);const c=n[o+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,At(c,e,6,r)}}const Gh=new WeakMap;function jc(e,t,s=!1){const n=s?Gh:t.emitsCache,r=n.get(e);if(r!==void 0)return r;const i=e.emits;let a={},o=!1;if(!Ee(e)){const l=c=>{const u=jc(c,t,!0);u&&(o=!0,Ze(a,u))};!s&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!o?(Ne(e)&&n.set(e,null),null):(me(i)?i.forEach(l=>a[l]=null):Ze(a,i),Ne(e)&&n.set(e,a),a)}function si(e,t){return!e||!Vr(t)?!1:(t=t.slice(2).replace(/Once$/,""),$e(e,t[0].toLowerCase()+t.slice(1))||$e(e,js(t))||$e(e,t))}function lo(e){const{type:t,vnode:s,proxy:n,withProxy:r,propsOptions:[i],slots:a,attrs:o,emit:l,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:g,inheritAttrs:b}=e,S=Rr(e);let E,x;try{if(s.shapeFlag&4){const P=r||n,N=P;E=jt(c.call(N,P,u,d,f,h,g)),x=o}else{const P=t;E=jt(P.length>1?P(d,{attrs:o,slots:a,emit:l}):P(d,null)),x=t.props?o:Zh(o)}}catch(P){Rn.length=0,Xr(P,e,1),E=be(it)}let k=E;if(x&&b!==!1){const P=Object.keys(x),{shapeFlag:N}=k;P.length&&N&7&&(i&&P.some(qr)&&(x=Jh(x,i)),k=ms(k,x,!1,!0))}return s.dirs&&(k=ms(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(s.dirs):s.dirs),s.transition&&jn(k,s.transition),E=k,Rr(S),E}const Zh=e=>{let t;for(const s in e)(s==="class"||s==="style"||Vr(s))&&((t||(t={}))[s]=e[s]);return t},Jh=(e,t)=>{const s={};for(const n in e)(!qr(n)||!(n.slice(9)in t))&&(s[n]=e[n]);return s};function Yh(e,t,s){const{props:n,children:r,component:i}=e,{props:a,children:o,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(s&&l>=0){if(l&1024)return!0;if(l&16)return n?co(n,a,c):!!a;if(l&8){const u=t.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(Dc(a,n,h)&&!si(c,h))return!0}}}else return(r||o)&&(!o||!o.$stable)?!0:n===a?!1:n?a?co(n,a,c):!0:!!a;return!1}function co(e,t,s){const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(let r=0;r<n.length;r++){const i=n[r];if(Dc(t,e,i)&&!si(s,i))return!0}return!1}function Dc(e,t,s){const n=e[s],r=t[s];return s==="style"&&Ne(n)&&Ne(r)?!Xn(n,r):n!==r}function Xh({vnode:e,parent:t,suspense:s},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=n,e=r),r===e)(e=t.vnode).el=n,t=t.parent;else break}s&&s.activeBranch===e&&(s.vnode.el=n)}const Uc={},Bc=()=>Object.create(Uc),Hc=e=>Object.getPrototypeOf(e)===Uc;function Qh(e,t,s,n=!1){const r={},i=Bc();e.propsDefaults=Object.create(null),Fc(e,t,r,i);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);s?e.props=n?r:pc(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function ef(e,t,s,n){const{props:r,attrs:i,vnode:{patchFlag:a}}=e,o=Ae(r),[l]=e.propsOptions;let c=!1;if((n||a>0)&&!(a&16)){if(a&8){const u=e.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(si(e.emitsOptions,h))continue;const f=t[h];if(l)if($e(i,h))f!==i[h]&&(i[h]=f,c=!0);else{const g=at(h);r[g]=Wi(l,o,g,f,e,!1)}else f!==i[h]&&(i[h]=f,c=!0)}}}else{Fc(e,t,r,i)&&(c=!0);let u;for(const d in o)(!t||!$e(t,d)&&((u=js(d))===d||!$e(t,u)))&&(l?s&&(s[d]!==void 0||s[u]!==void 0)&&(r[d]=Wi(l,o,d,void 0,e,!0)):delete r[d]);if(i!==o)for(const d in i)(!t||!$e(t,d))&&(delete i[d],c=!0)}c&&Jt(e.attrs,"set","")}function Fc(e,t,s,n){const[r,i]=e.propsOptions;let a=!1,o;if(t)for(let l in t){if(xn(l))continue;const c=t[l];let u;r&&$e(r,u=at(l))?!i||!i.includes(u)?s[u]=c:(o||(o={}))[u]=c:si(e.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,a=!0)}if(i){const l=Ae(s),c=o||Pe;for(let u=0;u<i.length;u++){const d=i[u];s[d]=Wi(r,l,d,c[d],e,!$e(c,d))}}return a}function Wi(e,t,s,n,r,i){const a=e[s];if(a!=null){const o=$e(a,"default");if(o&&n===void 0){const l=a.default;if(a.type!==Function&&!a.skipFactory&&Ee(l)){const{propsDefaults:c}=r;if(s in c)n=c[s];else{const u=tr(r);n=c[s]=l.call(null,t),u()}}else n=l;r.ce&&r.ce._setProp(s,n)}a[0]&&(i&&!o?n=!1:a[1]&&(n===""||n===js(s))&&(n=!0))}return n}const tf=new WeakMap;function Vc(e,t,s=!1){const n=s?tf:t.propsCache,r=n.get(e);if(r)return r;const i=e.props,a={},o=[];let l=!1;if(!Ee(e)){const u=d=>{l=!0;const[h,f]=Vc(d,t,!0);Ze(a,h),f&&o.push(...f)};!s&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return Ne(e)&&n.set(e,en),en;if(me(i))for(let u=0;u<i.length;u++){const d=at(i[u]);uo(d)&&(a[d]=Pe)}else if(i)for(const u in i){const d=at(u);if(uo(d)){const h=i[u],f=a[d]=me(h)||Ee(h)?{type:h}:Ze({},h),g=f.type;let b=!1,S=!0;if(me(g))for(let E=0;E<g.length;++E){const x=g[E],k=Ee(x)&&x.name;if(k==="Boolean"){b=!0;break}else k==="String"&&(S=!1)}else b=Ee(g)&&g.name==="Boolean";f[0]=b,f[1]=S,(b||$e(f,"default"))&&o.push(d)}}const c=[a,o];return Ne(e)&&n.set(e,c),c}function uo(e){return e[0]!=="$"&&!xn(e)}const Ca=e=>e==="_"||e==="_ctx"||e==="$stable",Oa=e=>me(e)?e.map(jt):[jt(e)],sf=(e,t,s)=>{if(t._n)return t;const n=gs((...r)=>Oa(t(...r)),s);return n._c=!1,n},qc=(e,t,s)=>{const n=e._ctx;for(const r in e){if(Ca(r))continue;const i=e[r];if(Ee(i))t[r]=sf(r,i,n);else if(i!=null){const a=Oa(i);t[r]=()=>a}}},zc=(e,t)=>{const s=Oa(t);e.slots.default=()=>s},Kc=(e,t,s)=>{for(const n in t)(s||!Ca(n))&&(e[n]=t[n])},nf=(e,t,s)=>{const n=e.slots=Bc();if(e.vnode.shapeFlag&32){const r=t._;r?(Kc(n,t,s),s&&Kl(n,"_",r,!0)):qc(t,n)}else t&&zc(e,t)},rf=(e,t,s)=>{const{vnode:n,slots:r}=e;let i=!0,a=Pe;if(n.shapeFlag&32){const o=t._;o?s&&o===1?i=!1:Kc(r,t,s):(i=!t.$stable,qc(t,r)),a=t}else t&&(zc(e,t),a={default:1});if(i)for(const o in r)!Ca(o)&&a[o]==null&&delete r[o]},st=uf;function af(e){return of(e)}function of(e,t){const s=Zr();s.__VUE__=!0;const{insert:n,remove:r,patchProp:i,createElement:a,createText:o,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=Bt,insertStaticContent:g}=e,b=(m,y,A,D=null,K=null,B=null,H=void 0,se=null,J=!!y.dynamicChildren)=>{if(m===y)return;m&&!As(m,y)&&(D=F(m),T(m,K,B,!0),m=null),y.patchFlag===-2&&(J=!1,y.dynamicChildren=null);const{type:U,ref:fe,shapeFlag:ne}=y;switch(U){case ni:S(m,y,A,D);break;case it:E(m,y,A,D);break;case xr:m==null&&x(y,A,D,H);break;case ke:$(m,y,A,D,K,B,H,se,J);break;default:ne&1?N(m,y,A,D,K,B,H,se,J):ne&6?W(m,y,A,D,K,B,H,se,J):(ne&64||ne&128)&&U.process(m,y,A,D,K,B,H,se,J,he)}fe!=null&&K?Sn(fe,m&&m.ref,B,y||m,!y):fe==null&&m&&m.ref!=null&&Sn(m.ref,null,B,m,!0)},S=(m,y,A,D)=>{if(m==null)n(y.el=o(y.children),A,D);else{const K=y.el=m.el;y.children!==m.children&&c(K,y.children)}},E=(m,y,A,D)=>{m==null?n(y.el=l(y.children||""),A,D):y.el=m.el},x=(m,y,A,D)=>{[m.el,m.anchor]=g(m.children,y,A,D,m.el,m.anchor)},k=({el:m,anchor:y},A,D)=>{let K;for(;m&&m!==y;)K=h(m),n(m,A,D),m=K;n(y,A,D)},P=({el:m,anchor:y})=>{let A;for(;m&&m!==y;)A=h(m),r(m),m=A;r(y)},N=(m,y,A,D,K,B,H,se,J)=>{if(y.type==="svg"?H="svg":y.type==="math"&&(H="mathml"),m==null)R(y,A,D,K,B,H,se,J);else{const U=m.el&&m.el._isVueCE?m.el:null;try{U&&U._beginPatch(),j(m,y,K,B,H,se,J)}finally{U&&U._endPatch()}}},R=(m,y,A,D,K,B,H,se)=>{let J,U;const{props:fe,shapeFlag:ne,transition:de,dirs:ye}=m;if(J=m.el=a(m.type,B,fe&&fe.is,fe),ne&8?u(J,m.children):ne&16&&C(m.children,J,null,D,K,xi(m,B),H,se),ye&&vs(m,null,D,"created"),v(J,m,m.scopeId,H,D),fe){for(const te in fe)te!=="value"&&!xn(te)&&i(J,te,null,fe[te],B,D);"value"in fe&&i(J,"value",null,fe.value,B),(U=fe.onVnodeBeforeMount)&&Ot(U,D,m)}ye&&vs(m,null,D,"beforeMount");const G=lf(K,de);G&&de.beforeEnter(J),n(J,y,A),((U=fe&&fe.onVnodeMounted)||G||ye)&&st(()=>{try{U&&Ot(U,D,m),G&&de.enter(J),ye&&vs(m,null,D,"mounted")}finally{}},K)},v=(m,y,A,D,K)=>{if(A&&f(m,A),D)for(let B=0;B<D.length;B++)f(m,D[B]);if(K){let B=K.subTree;if(y===B||Zc(B.type)&&(B.ssContent===y||B.ssFallback===y)){const H=K.vnode;v(m,H,H.scopeId,H.slotScopeIds,K.parent)}}},C=(m,y,A,D,K,B,H,se,J=0)=>{for(let U=J;U<m.length;U++){const fe=m[U]=se?Zt(m[U]):jt(m[U]);b(null,fe,y,A,D,K,B,H,se)}},j=(m,y,A,D,K,B,H)=>{const se=y.el=m.el;let{patchFlag:J,dynamicChildren:U,dirs:fe}=y;J|=m.patchFlag&16;const ne=m.props||Pe,de=y.props||Pe;let ye;if(A&&ys(A,!1),(ye=de.onVnodeBeforeUpdate)&&Ot(ye,A,y,m),fe&&vs(y,m,A,"beforeUpdate"),A&&ys(A,!0),(ne.innerHTML&&de.innerHTML==null||ne.textContent&&de.textContent==null)&&u(se,""),U?V(m.dynamicChildren,U,se,A,D,xi(y,K),B):H||Y(m,y,se,null,A,D,xi(y,K),B,!1),J>0){if(J&16)Z(se,ne,de,A,K);else if(J&2&&ne.class!==de.class&&i(se,"class",null,de.class,K),J&4&&i(se,"style",ne.style,de.style,K),J&8){const G=y.dynamicProps;for(let te=0;te<G.length;te++){const oe=G[te],_e=ne[oe],Te=de[oe];(Te!==_e||oe==="value")&&i(se,oe,_e,Te,K,A)}}J&1&&m.children!==y.children&&u(se,y.children)}else!H&&U==null&&Z(se,ne,de,A,K);((ye=de.onVnodeUpdated)||fe)&&st(()=>{ye&&Ot(ye,A,y,m),fe&&vs(y,m,A,"updated")},D)},V=(m,y,A,D,K,B,H)=>{for(let se=0;se<y.length;se++){const J=m[se],U=y[se],fe=J.el&&(J.type===ke||!As(J,U)||J.shapeFlag&198)?d(J.el):A;b(J,U,fe,null,D,K,B,H,!0)}},Z=(m,y,A,D,K)=>{if(y!==A){if(y!==Pe)for(const B in y)!xn(B)&&!(B in A)&&i(m,B,y[B],null,K,D);for(const B in A){if(xn(B))continue;const H=A[B],se=y[B];H!==se&&B!=="value"&&i(m,B,se,H,K,D)}"value"in A&&i(m,"value",y.value,A.value,K)}},$=(m,y,A,D,K,B,H,se,J)=>{const U=y.el=m?m.el:o(""),fe=y.anchor=m?m.anchor:o("");let{patchFlag:ne,dynamicChildren:de,slotScopeIds:ye}=y;ye&&(se=se?se.concat(ye):ye),m==null?(n(U,A,D),n(fe,A,D),C(y.children||[],A,fe,K,B,H,se,J)):ne>0&&ne&64&&de&&m.dynamicChildren&&m.dynamicChildren.length===de.length?(V(m.dynamicChildren,de,A,K,B,H,se),(y.key!=null||K&&y===K.subTree)&&$a(m,y,!0)):Y(m,y,A,fe,K,B,H,se,J)},W=(m,y,A,D,K,B,H,se,J)=>{y.slotScopeIds=se,m==null?y.shapeFlag&512?K.ctx.activate(y,A,D,H,J):L(y,A,D,K,B,H,J):pe(m,y,J)},L=(m,y,A,D,K,B,H)=>{const se=m.component=bf(m,D,K);if(Qr(m)&&(se.ctx.renderer=he),vf(se,!1,H),se.asyncDep){if(K&&K.registerDep(se,M,H),!m.el){const J=se.subTree=be(it);E(null,J,y,A),m.placeholder=J.el}}else M(se,m,y,A,K,B,H)},pe=(m,y,A)=>{const D=y.component=m.component;if(Yh(m,y,A))if(D.asyncDep&&!D.asyncResolved){z(D,y,A);return}else D.next=y,D.update();else y.el=m.el,D.vnode=y},M=(m,y,A,D,K,B,H)=>{const se=()=>{if(m.isMounted){let{next:ne,bu:de,u:ye,parent:G,vnode:te}=m;{const gt=Wc(m);if(gt){ne&&(ne.el=te.el,z(m,ne,H)),gt.asyncDep.then(()=>{st(()=>{m.isUnmounted||U()},K)});return}}let oe=ne,_e;ys(m,!1),ne?(ne.el=te.el,z(m,ne,H)):ne=te,de&&_r(de),(_e=ne.props&&ne.props.onVnodeBeforeUpdate)&&Ot(_e,G,ne,te),ys(m,!0);const Te=lo(m),Ve=m.subTree;m.subTree=Te,b(Ve,Te,d(Ve.el),F(Ve),m,K,B),ne.el=Te.el,oe===null&&Xh(m,Te.el),ye&&st(ye,K),(_e=ne.props&&ne.props.onVnodeUpdated)&&st(()=>Ot(_e,G,ne,te),K)}else{let ne;const{el:de,props:ye}=y,{bm:G,m:te,parent:oe,root:_e,type:Te}=m,Ve=Tn(y);ys(m,!1),G&&_r(G),!Ve&&(ne=ye&&ye.onVnodeBeforeMount)&&Ot(ne,oe,y),ys(m,!0);{_e.ce&&_e.ce._hasShadowRoot()&&_e.ce._injectChildStyle(Te,m.parent?m.parent.type:void 0);const gt=m.subTree=lo(m);b(null,gt,A,D,m,K,B),y.el=gt.el}if(te&&st(te,K),!Ve&&(ne=ye&&ye.onVnodeMounted)){const gt=y;st(()=>Ot(ne,oe,gt),K)}(y.shapeFlag&256||oe&&Tn(oe.vnode)&&oe.vnode.shapeFlag&256)&&m.a&&st(m.a,K),m.isMounted=!0,y=A=D=null}};m.scope.on();const J=m.effect=new ec(se);m.scope.off();const U=m.update=J.run.bind(J),fe=m.job=J.runIfDirty.bind(J);fe.i=m,fe.id=m.uid,J.scheduler=()=>Aa(fe),ys(m,!0),U()},z=(m,y,A)=>{y.component=m;const D=m.vnode.props;m.vnode=y,m.next=null,ef(m,y.props,D,A),rf(m,y.children,A),ts(),Ya(m),ss()},Y=(m,y,A,D,K,B,H,se,J=!1)=>{const U=m&&m.children,fe=m?m.shapeFlag:0,ne=y.children,{patchFlag:de,shapeFlag:ye}=y;if(de>0){if(de&128){xe(U,ne,A,D,K,B,H,se,J);return}else if(de&256){ue(U,ne,A,D,K,B,H,se,J);return}}ye&8?(fe&16&&Ue(U,K,B),ne!==U&&u(A,ne)):fe&16?ye&16?xe(U,ne,A,D,K,B,H,se,J):Ue(U,K,B,!0):(fe&8&&u(A,""),ye&16&&C(ne,A,D,K,B,H,se,J))},ue=(m,y,A,D,K,B,H,se,J)=>{m=m||en,y=y||en;const U=m.length,fe=y.length,ne=Math.min(U,fe);let de;for(de=0;de<ne;de++){const ye=y[de]=J?Zt(y[de]):jt(y[de]);b(m[de],ye,A,null,K,B,H,se,J)}U>fe?Ue(m,K,B,!0,!1,ne):C(y,A,D,K,B,H,se,J,ne)},xe=(m,y,A,D,K,B,H,se,J)=>{let U=0;const fe=y.length;let ne=m.length-1,de=fe-1;for(;U<=ne&&U<=de;){const ye=m[U],G=y[U]=J?Zt(y[U]):jt(y[U]);if(As(ye,G))b(ye,G,A,null,K,B,H,se,J);else break;U++}for(;U<=ne&&U<=de;){const ye=m[ne],G=y[de]=J?Zt(y[de]):jt(y[de]);if(As(ye,G))b(ye,G,A,null,K,B,H,se,J);else break;ne--,de--}if(U>ne){if(U<=de){const ye=de+1,G=ye<fe?y[ye].el:D;for(;U<=de;)b(null,y[U]=J?Zt(y[U]):jt(y[U]),A,G,K,B,H,se,J),U++}}else if(U>de)for(;U<=ne;)T(m[U],K,B,!0),U++;else{const ye=U,G=U,te=new Map;for(U=G;U<=de;U++){const lt=y[U]=J?Zt(y[U]):jt(y[U]);lt.key!=null&&te.set(lt.key,U)}let oe,_e=0;const Te=de-G+1;let Ve=!1,gt=0;const bs=new Array(Te);for(U=0;U<Te;U++)bs[U]=0;for(U=ye;U<=ne;U++){const lt=m[U];if(_e>=Te){T(lt,K,B,!0);continue}let Ct;if(lt.key!=null)Ct=te.get(lt.key);else for(oe=G;oe<=de;oe++)if(bs[oe-G]===0&&As(lt,y[oe])){Ct=oe;break}Ct===void 0?T(lt,K,B,!0):(bs[Ct-G]=U+1,Ct>=gt?gt=Ct:Ve=!0,b(lt,y[Ct],A,null,K,B,H,se,J),_e++)}const qa=Ve?cf(bs):en;for(oe=qa.length-1,U=Te-1;U>=0;U--){const lt=G+U,Ct=y[lt],za=y[lt+1],Ka=lt+1<fe?za.el||Gc(za):D;bs[U]===0?b(null,Ct,A,Ka,K,B,H,se,J):Ve&&(oe<0||U!==qa[oe]?q(Ct,A,Ka,2):oe--)}}},q=(m,y,A,D,K=null)=>{const{el:B,type:H,transition:se,children:J,shapeFlag:U}=m;if(U&6){q(m.component.subTree,y,A,D);return}if(U&128){m.suspense.move(y,A,D);return}if(U&64){H.move(m,y,A,he);return}if(H===ke){n(B,y,A);for(let ne=0;ne<J.length;ne++)q(J[ne],y,A,D);n(m.anchor,y,A);return}if(H===xr){k(m,y,A);return}if(D!==2&&U&1&&se)if(D===0)se.beforeEnter(B),n(B,y,A),st(()=>se.enter(B),K);else{const{leave:ne,delayLeave:de,afterLeave:ye}=se,G=()=>{m.ctx.isUnmounted?r(B):n(B,y,A)},te=()=>{B._isLeaving&&B[It](!0),ne(B,()=>{G(),ye&&ye()})};de?de(B,G,te):te()}else n(B,y,A)},T=(m,y,A,D=!1,K=!1)=>{const{type:B,props:H,ref:se,children:J,dynamicChildren:U,shapeFlag:fe,patchFlag:ne,dirs:de,cacheIndex:ye,memo:G}=m;if(ne===-2&&(K=!1),se!=null&&(ts(),Sn(se,null,A,m,!0),ss()),ye!=null&&(y.renderCache[ye]=void 0),fe&256){y.ctx.deactivate(m);return}const te=fe&1&&de,oe=!Tn(m);let _e;if(oe&&(_e=H&&H.onVnodeBeforeUnmount)&&Ot(_e,y,m),fe&6)ce(m.component,A,D);else{if(fe&128){m.suspense.unmount(A,D);return}te&&vs(m,null,y,"beforeUnmount"),fe&64?m.type.remove(m,y,A,he,D):U&&!U.hasOnce&&(B!==ke||ne>0&&ne&64)?Ue(U,y,A,!1,!0):(B===ke&&ne&384||!K&&fe&16)&&Ue(J,y,A),D&&O(m)}const Te=G!=null&&ye==null;(oe&&(_e=H&&H.onVnodeUnmounted)||te||Te)&&st(()=>{_e&&Ot(_e,y,m),te&&vs(m,null,y,"unmounted"),Te&&(m.el=null)},A)},O=m=>{const{type:y,el:A,anchor:D,transition:K}=m;if(y===ke){X(A,D);return}if(y===xr){P(m);return}const B=()=>{r(A),K&&!K.persisted&&K.afterLeave&&K.afterLeave()};if(m.shapeFlag&1&&K&&!K.persisted){const{leave:H,delayLeave:se}=K,J=()=>H(A,B);se?se(m.el,B,J):J()}else B()},X=(m,y)=>{let A;for(;m!==y;)A=h(m),r(m),m=A;r(y)},ce=(m,y,A)=>{const{bum:D,scope:K,job:B,subTree:H,um:se,m:J,a:U}=m;ho(J),ho(U),D&&_r(D),K.stop(),B&&(B.flags|=8,T(H,m,y,A)),se&&st(se,y),st(()=>{m.isUnmounted=!0},y)},Ue=(m,y,A,D=!1,K=!1,B=0)=>{for(let H=B;H<m.length;H++)T(m[H],y,A,D,K)},F=m=>{if(m.shapeFlag&6)return F(m.component.subTree);if(m.shapeFlag&128)return m.suspense.next();const y=h(m.anchor||m.el),A=y&&y[kc];return A?h(A):y};let ae=!1;const ie=(m,y,A)=>{let D;m==null?y._vnode&&(T(y._vnode,null,null,!0),D=y._vnode.component):b(y._vnode||null,m,y,null,null,null,A),y._vnode=m,ae||(ae=!0,Ya(D),yc(),ae=!1)},he={p:b,um:T,m:q,r:O,mt:L,mc:C,pc:Y,pbc:V,n:F,o:e};return{render:ie,hydrate:void 0,createApp:zh(ie)}}function xi({type:e,props:t},s){return s==="svg"&&e==="foreignObject"||s==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:s}function ys({effect:e,job:t},s){s?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function lf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function $a(e,t,s=!1){const n=e.children,r=t.children;if(me(n)&&me(r))for(let i=0;i<n.length;i++){const a=n[i];let o=r[i];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=r[i]=Zt(r[i]),o.el=a.el),!s&&o.patchFlag!==-2&&$a(a,o)),o.type===ni&&(o.patchFlag===-1&&(o=r[i]=Zt(o)),o.el=a.el),o.type===it&&!o.el&&(o.el=a.el)}}function cf(e){const t=e.slice(),s=[0];let n,r,i,a,o;const l=e.length;for(n=0;n<l;n++){const c=e[n];if(c!==0){if(r=s[s.length-1],e[r]<c){t[n]=r,s.push(n);continue}for(i=0,a=s.length-1;i<a;)o=i+a>>1,e[s[o]]<c?i=o+1:a=o;c<e[s[i]]&&(i>0&&(t[n]=s[i-1]),s[i]=n)}}for(i=s.length,a=s[i-1];i-- >0;)s[i]=a,a=t[a];return s}function Wc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Wc(t)}function ho(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Gc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Gc(t.subTree):null}const Zc=e=>e.__isSuspense;function uf(e,t){t&&t.pendingBranch?me(e)?t.effects.push(...e):t.effects.push(e):fh(e)}const ke=Symbol.for("v-fgt"),ni=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),xr=Symbol.for("v-stc"),Rn=[];let ht=null;function _(e=!1){Rn.push(ht=e?null:[])}function df(){Rn.pop(),ht=Rn[Rn.length-1]||null}let Dn=1;function $r(e,t=!1){Dn+=e,e<0&&ht&&t&&(ht.hasOnce=!0)}function Jc(e){return e.dynamicChildren=Dn>0?ht||en:null,df(),Dn>0&&ht&&ht.push(e),e}function w(e,t,s,n,r,i){return Jc(p(e,t,s,n,r,i,!0))}function nn(e,t,s,n,r){return Jc(be(e,t,s,n,r,!0))}function Nr(e){return e?e.__v_isVNode===!0:!1}function As(e,t){return e.type===t.type&&e.key===t.key}const Yc=({key:e})=>e??null,Er=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?De(e)||Fe(e)||Ee(e)?{i:ut,r:e,k:t,f:!!s}:e:null);function p(e,t=null,s=null,n=0,r=null,i=e===ke?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Yc(t),ref:t&&Er(t),scopeId:wc,slotScopeIds:null,children:s,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:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ut};return o?(Na(l,s),i&128&&e.normalize(l)):s&&(l.shapeFlag|=De(s)?8:16),Dn>0&&!a&&ht&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ht.push(l),l}const be=hf;function hf(e,t=null,s=null,n=0,r=null,i=!1){if((!e||e===Ic)&&(e=it),Nr(e)){const o=ms(e,t,!0);return s&&Na(o,s),Dn>0&&!i&&ht&&(o.shapeFlag&6?ht[ht.indexOf(e)]=o:ht.push(o)),o.patchFlag=-2,o}if(Ef(e)&&(e=e.__vccOpts),t){t=ff(t);let{class:o,style:l}=t;o&&!De(o)&&(t.class=ge(o)),Ne(l)&&(Yr(l)&&!me(l)&&(l=Ze({},l)),t.style=ya(l))}const a=De(e)?1:Zc(e)?128:Sc(e)?64:Ne(e)?4:Ee(e)?2:0;return p(e,t,s,n,r,a,i,!0)}function ff(e){return e?Yr(e)||Hc(e)?Ze({},e):e:null}function ms(e,t,s=!1,n=!1){const{props:r,ref:i,patchFlag:a,children:o,transition:l}=e,c=t?pf(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Yc(c),ref:t&&t.ref?s&&i?me(i)?i.concat(Er(t)):[i,Er(t)]:Er(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:o,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ke?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ms(e.ssContent),ssFallback:e.ssFallback&&ms(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&n&&jn(u,l.clone(u)),u}function ve(e=" ",t=0){return be(ni,null,e,t)}function er(e,t){const s=be(xr,null,e);return s.staticCount=t,s}function ee(e="",t=!1){return t?(_(),nn(it,null,e)):be(it,null,e)}function jt(e){return e==null||typeof e=="boolean"?be(it):me(e)?be(ke,null,e.slice()):Nr(e)?Zt(e):be(ni,null,String(e))}function Zt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ms(e)}function Na(e,t){let s=0;const{shapeFlag:n}=e;if(t==null)t=null;else if(me(t))s=16;else if(typeof t=="object")if(n&65){const r=t.default;r&&(r._c&&(r._d=!1),Na(e,r()),r._c&&(r._d=!0));return}else{s=32;const r=t._;!r&&!Hc(t)?t._ctx=ut:r===3&&ut&&(ut.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ee(t)?(t={default:t,_ctx:ut},s=32):(t=String(t),n&64?(s=16,t=[ve(t)]):s=8);e.children=t,e.shapeFlag|=s}function pf(...e){const t={};for(let s=0;s<e.length;s++){const n=e[s];for(const r in n)if(r==="class")t.class!==n.class&&(t.class=ge([t.class,n.class]));else if(r==="style")t.style=ya([t.style,n.style]);else if(Vr(r)){const i=t[r],a=n[r];a&&i!==a&&!(me(i)&&i.includes(a))?t[r]=i?[].concat(i,a):a:a==null&&i==null&&!qr(r)&&(t[r]=a)}else r!==""&&(t[r]=n[r])}return t}function Ot(e,t,s,n=null){At(e,t,7,[s,n])}const gf=Mc();let mf=0;function bf(e,t,s){const n=e.type,r=(t?t.appContext:e.appContext)||gf,i={uid:mf++,vnode:e,type:n,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Vc(n,r),emitsOptions:jc(n,r),emit:null,emitted:null,propsDefaults:Pe,inheritAttrs:n.inheritAttrs,ctx:Pe,data:Pe,props:Pe,attrs:Pe,slots:Pe,refs:Pe,setupState:Pe,setupContext:null,suspense:s,suspenseId:s?s.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=Wh.bind(null,i),e.ce&&e.ce(i),i}let et=null;const Ia=()=>et||ut;let Ir,Gi;{const e=Zr(),t=(s,n)=>{let r;return(r=e[s])||(r=e[s]=[]),r.push(n),i=>{r.length>1?r.forEach(a=>a(i)):r[0](i)}};Ir=t("__VUE_INSTANCE_SETTERS__",s=>et=s),Gi=t("__VUE_SSR_SETTERS__",s=>Un=s)}const tr=e=>{const t=et;return Ir(e),e.scope.on(),()=>{e.scope.off(),Ir(t)}},fo=()=>{et&&et.scope.off(),Ir(null)};function Xc(e){return e.vnode.shapeFlag&4}let Un=!1;function vf(e,t=!1,s=!1){t&&Gi(t);const{props:n,children:r}=e.vnode,i=Xc(e);Qh(e,n,i,t),nf(e,r,s||t);const a=i?yf(e,t):void 0;return t&&Gi(!1),a}function yf(e,t){const s=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Dh);const{setup:n}=s;if(n){ts();const r=e.setupContext=n.length>1?wf(e):null,i=tr(e),a=Qn(n,e,0,[e.props,r]),o=Vl(a);if(ss(),i(),(o||e.sp)&&!Tn(e)&&$c(e),o){if(a.then(fo,fo),t)return a.then(l=>{po(e,l)}).catch(l=>{Xr(l,e,0)});e.asyncDep=a}else po(e,a)}else Qc(e)}function po(e,t,s){Ee(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ne(t)&&(e.setupState=mc(t)),Qc(e)}function Qc(e,t,s){const n=e.type;e.render||(e.render=n.render||Bt);{const r=tr(e);ts();try{Uh(e)}finally{ss(),r()}}}const _f={get(e,t){return Qe(e,"get",""),e[t]}};function wf(e){const t=s=>{e.exposed=s||{}};return{attrs:new Proxy(e.attrs,_f),slots:e.slots,emit:e.emit,expose:t}}function ri(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(mc(Ta(e.exposed)),{get(t,s){if(s in t)return t[s];if(s in An)return An[s](e)},has(t,s){return s in t||s in An}})):e.proxy}function xf(e,t=!0){return Ee(e)?e.displayName||e.name:e.name||t&&e.__name}function Ef(e){return Ee(e)&&"__vccOpts"in e}const je=(e,t)=>lh(e,t,Un);function Pa(e,t,s){try{$r(-1);const n=arguments.length;return n===2?Ne(t)&&!me(t)?Nr(t)?be(e,null,[t]):be(e,t):be(e,null,t):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&Nr(s)&&(s=[s]),be(e,t,s))}finally{$r(1)}}const kf="3.5.34";/**
14
14
  * @vue/runtime-dom v3.5.34
15
15
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
16
  * @license MIT
17
- **/let Zi;const go=typeof window<"u"&&window.trustedTypes;if(go)try{Zi=go.createPolicy("vue",{createHTML:e=>e})}catch{}const eu=Zi?e=>Zi.createHTML(e):e=>e,Sf="http://www.w3.org/2000/svg",Tf="http://www.w3.org/1998/Math/MathML",Kt=typeof document<"u"?document:null,mo=Kt&&Kt.createElement("template"),Af={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?Kt.createElementNS(Sf,e):t==="mathml"?Kt.createElementNS(Tf,e):s?Kt.createElement(e,{is:s}):Kt.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>Kt.createTextNode(e),createComment:e=>Kt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Kt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const a=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{mo.innerHTML=eu(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const o=mo.content;if(n==="svg"||n==="mathml"){const l=o.firstChild;for(;l.firstChild;)o.appendChild(l.firstChild);o.removeChild(l)}t.insertBefore(o,s)}return[a?a.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},as="transition",pn="animation",Bn=Symbol("_vtc"),tu={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},Rf=Ze({},Tc,tu),Cf=e=>(e.displayName="Transition",e.props=Rf,e),ii=Cf((e,{slots:t})=>Pa(kh,Of(e),t)),_s=(e,t=[])=>{me(e)?e.forEach(s=>s(...t)):e&&e(...t)},bo=e=>e?me(e)?e.some(t=>t.length>1):e.length>1:!1;function Of(e){const t={};for(const $ in e)$ in tu||(t[$]=e[$]);if(e.css===!1)return t;const{name:s="v",type:n,duration:r,enterFromClass:i=`${s}-enter-from`,enterActiveClass:a=`${s}-enter-active`,enterToClass:o=`${s}-enter-to`,appearFromClass:l=i,appearActiveClass:c=a,appearToClass:u=o,leaveFromClass:d=`${s}-leave-from`,leaveActiveClass:h=`${s}-leave-active`,leaveToClass:f=`${s}-leave-to`}=e,g=$f(r),m=g&&g[0],S=g&&g[1],{onBeforeEnter:E,onEnter:x,onEnterCancelled:k,onLeave:P,onLeaveCancelled:N,onBeforeAppear:R=E,onAppear:v=x,onAppearCancelled:C=k}=t,j=($,W,L,pe)=>{$._enterCancelled=pe,ws($,W?u:o),ws($,W?c:a),L&&L()},V=($,W)=>{$._isLeaving=!1,ws($,d),ws($,f),ws($,h),W&&W()},Z=$=>(W,L)=>{const pe=$?v:x,M=()=>j(W,$,L);_s(pe,[W,M]),vo(()=>{ws(W,$?l:i),Vt(W,$?u:o),bo(pe)||yo(W,n,m,M)})};return Ze(t,{onBeforeEnter($){_s(E,[$]),Vt($,i),Vt($,a)},onBeforeAppear($){_s(R,[$]),Vt($,l),Vt($,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave($,W){$._isLeaving=!0;const L=()=>V($,W);Vt($,d),$._enterCancelled?(Vt($,h),xo($)):(xo($),Vt($,h)),vo(()=>{$._isLeaving&&(ws($,d),Vt($,f),bo(P)||yo($,n,S,L))}),_s(P,[$,L])},onEnterCancelled($){j($,!1,void 0,!0),_s(k,[$])},onAppearCancelled($){j($,!0,void 0,!0),_s(C,[$])},onLeaveCancelled($){V($),_s(N,[$])}})}function $f(e){if(e==null)return null;if(Ne(e))return[Ei(e.enter),Ei(e.leave)];{const t=Ei(e);return[t,t]}}function Ei(e){return Ad(e)}function Vt(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.add(s)),(e[Bn]||(e[Bn]=new Set)).add(t)}function ws(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.remove(n));const s=e[Bn];s&&(s.delete(t),s.size||(e[Bn]=void 0))}function vo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Nf=0;function yo(e,t,s,n){const r=e._endId=++Nf,i=()=>{r===e._endId&&n()};if(s!=null)return setTimeout(i,s);const{type:a,timeout:o,propCount:l}=If(e,t);if(!a)return n();const c=a+"end";let u=0;const d=()=>{e.removeEventListener(c,h),i()},h=f=>{f.target===e&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},o+1),e.addEventListener(c,h)}function If(e,t){const s=window.getComputedStyle(e),n=g=>(s[g]||"").split(", "),r=n(`${as}Delay`),i=n(`${as}Duration`),a=_o(r,i),o=n(`${pn}Delay`),l=n(`${pn}Duration`),c=_o(o,l);let u=null,d=0,h=0;t===as?a>0&&(u=as,d=a,h=i.length):t===pn?c>0&&(u=pn,d=c,h=l.length):(d=Math.max(a,c),u=d>0?a>c?as:pn:null,h=u?u===as?i.length:l.length:0);const f=u===as&&/\b(?:transform|all)(?:,|$)/.test(n(`${as}Property`).toString());return{type:u,timeout:d,propCount:h,hasTransform:f}}function _o(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((s,n)=>wo(s)+wo(e[n])))}function wo(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function xo(e){return(e?e.ownerDocument:document).body.offsetHeight}function Pf(e,t,s){const n=e[Bn];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const Eo=Symbol("_vod"),Lf=Symbol("_vsh"),Mf=Symbol(""),jf=/(?:^|;)\s*display\s*:/;function Df(e,t,s){const n=e.style,r=De(s);let i=!1;if(s&&!r){if(t)if(De(t))for(const a of t.split(";")){const o=a.slice(0,a.indexOf(":")).trim();s[o]==null&&yn(n,o,"")}else for(const a in t)s[a]==null&&yn(n,a,"");for(const a in s){a==="display"&&(i=!0);const o=s[a];o!=null?Bf(e,a,!De(t)&&t?t[a]:void 0,o)||yn(n,a,o):yn(n,a,"")}}else if(r){if(t!==s){const a=n[Mf];a&&(s+=";"+a),n.cssText=s,i=jf.test(s)}}else t&&e.removeAttribute("style");Eo in e&&(e[Eo]=i?n.display:"",e[Lf]&&(n.display="none"))}const ko=/\s*!important$/;function yn(e,t,s){if(me(s))s.forEach(n=>yn(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=Uf(e,t);ko.test(s)?e.setProperty(Ms(n),s.replace(ko,""),"important"):e[n]=s}}const So=["Webkit","Moz","ms"],ki={};function Uf(e,t){const s=ki[t];if(s)return s;let n=at(t);if(n!=="filter"&&n in e)return ki[t]=n;n=Gr(n);for(let r=0;r<So.length;r++){const i=So[r]+n;if(i in e)return ki[t]=i}return t}function Bf(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&De(n)&&s===n}const To="http://www.w3.org/1999/xlink";function Ao(e,t,s,n,r,i=Id(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(To,t.slice(6,t.length)):e.setAttributeNS(To,t,s):s==null||i&&!Wl(s)?e.removeAttribute(t):e.setAttribute(t,i?"":_t(s)?String(s):s)}function Ro(e,t,s,n,r){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?eu(s):s);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const o=i==="OPTION"?e.getAttribute("value")||"":e.value,l=s==null?e.type==="checkbox"?"on":"":String(s);(o!==l||!("_value"in e))&&(e.value=l),s==null&&e.removeAttribute(t),e._value=s;return}let a=!1;if(s===""||s==null){const o=typeof e[t];o==="boolean"?s=Wl(s):s==null&&o==="string"?(s="",a=!0):o==="number"&&(s=0,a=!0)}try{e[t]=s}catch{}a&&e.removeAttribute(r||t)}function Rs(e,t,s,n){e.addEventListener(t,s,n)}function Hf(e,t,s,n){e.removeEventListener(t,s,n)}const Co=Symbol("_vei");function Ff(e,t,s,n,r=null){const i=e[Co]||(e[Co]={}),a=i[t];if(n&&a)a.value=n;else{const[o,l]=Vf(t);if(n){const c=i[t]=Kf(n,r);Rs(e,o,c,l)}else a&&(Hf(e,o,a,l),i[t]=void 0)}}const Oo=/(?:Once|Passive|Capture)$/;function Vf(e){let t;if(Oo.test(e)){t={};let n;for(;n=e.match(Oo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Ms(e.slice(2)),t]}let Si=0;const qf=Promise.resolve(),zf=()=>Si||(qf.then(()=>Si=0),Si=Date.now());function Kf(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;At(Wf(n,s.value),t,5,[n])};return s.value=e,s.attached=zf(),s}function Wf(e,t){if(me(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>r=>!r._stopped&&n&&n(r))}else return t}const $o=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Gf=(e,t,s,n,r,i)=>{const a=r==="svg";t==="class"?Pf(e,n,a):t==="style"?Df(e,s,n):Vr(t)?qr(t)||Ff(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Zf(e,t,n,a))?(Ro(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ao(e,t,n,a,i,t!=="value")):e._isVueCE&&(Jf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!De(n)))?Ro(e,at(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),Ao(e,t,n,a))};function Zf(e,t,s,n){if(n)return!!(t==="innerHTML"||t==="textContent"||t in e&&$o(t)&&Ee(s));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 r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return $o(t)&&De(s)?!1:t in e}function Jf(e,t){const s=e._def.props;if(!s)return!1;const n=at(t);return Array.isArray(s)?s.some(r=>at(r)===n):Object.keys(s).some(r=>at(r)===n)}const Pr=e=>{const t=e.props["onUpdate:modelValue"]||!1;return me(t)?s=>_r(t,s):t};function Yf(e){e.target.composing=!0}function No(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const rn=Symbol("_assign");function Io(e,t,s){return t&&(e=e.trim()),s&&(e=va(e)),e}const kt={created(e,{modifiers:{lazy:t,trim:s,number:n}},r){e[rn]=Pr(r);const i=n||r.props&&r.props.type==="number";Rs(e,t?"change":"input",a=>{a.target.composing||e[rn](Io(e.value,s,i))}),(s||i)&&Rs(e,"change",()=>{e.value=Io(e.value,s,i)}),t||(Rs(e,"compositionstart",Yf),Rs(e,"compositionend",No),Rs(e,"change",No))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:n,trim:r,number:i}},a){if(e[rn]=Pr(a),e.composing)return;const o=(i||e.type==="number")&&!/^0\d/.test(e.value)?va(e.value):e.value,l=t??"";if(o===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(n&&t===s||r&&e.value.trim()===l)||(e.value=l)}},su={deep:!0,created(e,t,s){e[rn]=Pr(s),Rs(e,"change",()=>{const n=e._modelValue,r=Xf(e),i=e.checked,a=e[rn];if(me(n)){const o=Gl(n,r),l=o!==-1;if(i&&!l)a(n.concat(r));else if(!i&&l){const c=[...n];c.splice(o,1),a(c)}}else if(zr(n)){const o=new Set(n);i?o.add(r):o.delete(r),a(o)}else a(nu(e,i))})},mounted:Po,beforeUpdate(e,t,s){e[rn]=Pr(s),Po(e,t,s)}};function Po(e,{value:t,oldValue:s},n){e._modelValue=t;let r;if(me(t))r=Gl(t,n.props.value)>-1;else if(zr(t))r=t.has(n.props.value);else{if(t===s)return;r=Xn(t,nu(e,!0))}e.checked!==r&&(e.checked=r)}function Xf(e){return"_value"in e?e._value:e.value}function nu(e,t){const s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}const Qf=["ctrl","shift","alt","meta"],ep={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)=>Qf.some(s=>e[`${s}Key`]&&!t.includes(s))},yt=(e,t)=>{if(!e)return e;const s=e._withMods||(e._withMods={}),n=t.join(".");return s[n]||(s[n]=(r,...i)=>{for(let a=0;a<t.length;a++){const o=ep[t[a]];if(o&&o(r,t))return}return e(r,...i)})},tp=Ze({patchProp:Gf},Af);let Lo;function sp(){return Lo||(Lo=af(tp))}const np=(...e)=>{const t=sp().createApp(...e),{mount:s}=t;return t.mount=n=>{const r=ip(n);if(!r)return;const i=t._component;!Ee(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const a=s(r,!1,rp(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function rp(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ip(e){return De(e)?document.querySelector(e):e}/*!
17
+ **/let Zi;const go=typeof window<"u"&&window.trustedTypes;if(go)try{Zi=go.createPolicy("vue",{createHTML:e=>e})}catch{}const eu=Zi?e=>Zi.createHTML(e):e=>e,Sf="http://www.w3.org/2000/svg",Tf="http://www.w3.org/1998/Math/MathML",Kt=typeof document<"u"?document:null,mo=Kt&&Kt.createElement("template"),Af={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?Kt.createElementNS(Sf,e):t==="mathml"?Kt.createElementNS(Tf,e):s?Kt.createElement(e,{is:s}):Kt.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>Kt.createTextNode(e),createComment:e=>Kt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Kt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const a=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{mo.innerHTML=eu(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const o=mo.content;if(n==="svg"||n==="mathml"){const l=o.firstChild;for(;l.firstChild;)o.appendChild(l.firstChild);o.removeChild(l)}t.insertBefore(o,s)}return[a?a.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},as="transition",pn="animation",Bn=Symbol("_vtc"),tu={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},Rf=Ze({},Tc,tu),Cf=e=>(e.displayName="Transition",e.props=Rf,e),ii=Cf((e,{slots:t})=>Pa(kh,Of(e),t)),_s=(e,t=[])=>{me(e)?e.forEach(s=>s(...t)):e&&e(...t)},bo=e=>e?me(e)?e.some(t=>t.length>1):e.length>1:!1;function Of(e){const t={};for(const $ in e)$ in tu||(t[$]=e[$]);if(e.css===!1)return t;const{name:s="v",type:n,duration:r,enterFromClass:i=`${s}-enter-from`,enterActiveClass:a=`${s}-enter-active`,enterToClass:o=`${s}-enter-to`,appearFromClass:l=i,appearActiveClass:c=a,appearToClass:u=o,leaveFromClass:d=`${s}-leave-from`,leaveActiveClass:h=`${s}-leave-active`,leaveToClass:f=`${s}-leave-to`}=e,g=$f(r),b=g&&g[0],S=g&&g[1],{onBeforeEnter:E,onEnter:x,onEnterCancelled:k,onLeave:P,onLeaveCancelled:N,onBeforeAppear:R=E,onAppear:v=x,onAppearCancelled:C=k}=t,j=($,W,L,pe)=>{$._enterCancelled=pe,ws($,W?u:o),ws($,W?c:a),L&&L()},V=($,W)=>{$._isLeaving=!1,ws($,d),ws($,f),ws($,h),W&&W()},Z=$=>(W,L)=>{const pe=$?v:x,M=()=>j(W,$,L);_s(pe,[W,M]),vo(()=>{ws(W,$?l:i),Vt(W,$?u:o),bo(pe)||yo(W,n,b,M)})};return Ze(t,{onBeforeEnter($){_s(E,[$]),Vt($,i),Vt($,a)},onBeforeAppear($){_s(R,[$]),Vt($,l),Vt($,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave($,W){$._isLeaving=!0;const L=()=>V($,W);Vt($,d),$._enterCancelled?(Vt($,h),xo($)):(xo($),Vt($,h)),vo(()=>{$._isLeaving&&(ws($,d),Vt($,f),bo(P)||yo($,n,S,L))}),_s(P,[$,L])},onEnterCancelled($){j($,!1,void 0,!0),_s(k,[$])},onAppearCancelled($){j($,!0,void 0,!0),_s(C,[$])},onLeaveCancelled($){V($),_s(N,[$])}})}function $f(e){if(e==null)return null;if(Ne(e))return[Ei(e.enter),Ei(e.leave)];{const t=Ei(e);return[t,t]}}function Ei(e){return Ad(e)}function Vt(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.add(s)),(e[Bn]||(e[Bn]=new Set)).add(t)}function ws(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.remove(n));const s=e[Bn];s&&(s.delete(t),s.size||(e[Bn]=void 0))}function vo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Nf=0;function yo(e,t,s,n){const r=e._endId=++Nf,i=()=>{r===e._endId&&n()};if(s!=null)return setTimeout(i,s);const{type:a,timeout:o,propCount:l}=If(e,t);if(!a)return n();const c=a+"end";let u=0;const d=()=>{e.removeEventListener(c,h),i()},h=f=>{f.target===e&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},o+1),e.addEventListener(c,h)}function If(e,t){const s=window.getComputedStyle(e),n=g=>(s[g]||"").split(", "),r=n(`${as}Delay`),i=n(`${as}Duration`),a=_o(r,i),o=n(`${pn}Delay`),l=n(`${pn}Duration`),c=_o(o,l);let u=null,d=0,h=0;t===as?a>0&&(u=as,d=a,h=i.length):t===pn?c>0&&(u=pn,d=c,h=l.length):(d=Math.max(a,c),u=d>0?a>c?as:pn:null,h=u?u===as?i.length:l.length:0);const f=u===as&&/\b(?:transform|all)(?:,|$)/.test(n(`${as}Property`).toString());return{type:u,timeout:d,propCount:h,hasTransform:f}}function _o(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((s,n)=>wo(s)+wo(e[n])))}function wo(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function xo(e){return(e?e.ownerDocument:document).body.offsetHeight}function Pf(e,t,s){const n=e[Bn];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const Eo=Symbol("_vod"),Lf=Symbol("_vsh"),Mf=Symbol(""),jf=/(?:^|;)\s*display\s*:/;function Df(e,t,s){const n=e.style,r=De(s);let i=!1;if(s&&!r){if(t)if(De(t))for(const a of t.split(";")){const o=a.slice(0,a.indexOf(":")).trim();s[o]==null&&yn(n,o,"")}else for(const a in t)s[a]==null&&yn(n,a,"");for(const a in s){a==="display"&&(i=!0);const o=s[a];o!=null?Bf(e,a,!De(t)&&t?t[a]:void 0,o)||yn(n,a,o):yn(n,a,"")}}else if(r){if(t!==s){const a=n[Mf];a&&(s+=";"+a),n.cssText=s,i=jf.test(s)}}else t&&e.removeAttribute("style");Eo in e&&(e[Eo]=i?n.display:"",e[Lf]&&(n.display="none"))}const ko=/\s*!important$/;function yn(e,t,s){if(me(s))s.forEach(n=>yn(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=Uf(e,t);ko.test(s)?e.setProperty(js(n),s.replace(ko,""),"important"):e[n]=s}}const So=["Webkit","Moz","ms"],ki={};function Uf(e,t){const s=ki[t];if(s)return s;let n=at(t);if(n!=="filter"&&n in e)return ki[t]=n;n=Gr(n);for(let r=0;r<So.length;r++){const i=So[r]+n;if(i in e)return ki[t]=i}return t}function Bf(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&De(n)&&s===n}const To="http://www.w3.org/1999/xlink";function Ao(e,t,s,n,r,i=Id(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(To,t.slice(6,t.length)):e.setAttributeNS(To,t,s):s==null||i&&!Wl(s)?e.removeAttribute(t):e.setAttribute(t,i?"":_t(s)?String(s):s)}function Ro(e,t,s,n,r){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?eu(s):s);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const o=i==="OPTION"?e.getAttribute("value")||"":e.value,l=s==null?e.type==="checkbox"?"on":"":String(s);(o!==l||!("_value"in e))&&(e.value=l),s==null&&e.removeAttribute(t),e._value=s;return}let a=!1;if(s===""||s==null){const o=typeof e[t];o==="boolean"?s=Wl(s):s==null&&o==="string"?(s="",a=!0):o==="number"&&(s=0,a=!0)}try{e[t]=s}catch{}a&&e.removeAttribute(r||t)}function Rs(e,t,s,n){e.addEventListener(t,s,n)}function Hf(e,t,s,n){e.removeEventListener(t,s,n)}const Co=Symbol("_vei");function Ff(e,t,s,n,r=null){const i=e[Co]||(e[Co]={}),a=i[t];if(n&&a)a.value=n;else{const[o,l]=Vf(t);if(n){const c=i[t]=Kf(n,r);Rs(e,o,c,l)}else a&&(Hf(e,o,a,l),i[t]=void 0)}}const Oo=/(?:Once|Passive|Capture)$/;function Vf(e){let t;if(Oo.test(e)){t={};let n;for(;n=e.match(Oo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):js(e.slice(2)),t]}let Si=0;const qf=Promise.resolve(),zf=()=>Si||(qf.then(()=>Si=0),Si=Date.now());function Kf(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;At(Wf(n,s.value),t,5,[n])};return s.value=e,s.attached=zf(),s}function Wf(e,t){if(me(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>r=>!r._stopped&&n&&n(r))}else return t}const $o=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Gf=(e,t,s,n,r,i)=>{const a=r==="svg";t==="class"?Pf(e,n,a):t==="style"?Df(e,s,n):Vr(t)?qr(t)||Ff(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Zf(e,t,n,a))?(Ro(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ao(e,t,n,a,i,t!=="value")):e._isVueCE&&(Jf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!De(n)))?Ro(e,at(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),Ao(e,t,n,a))};function Zf(e,t,s,n){if(n)return!!(t==="innerHTML"||t==="textContent"||t in e&&$o(t)&&Ee(s));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 r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return $o(t)&&De(s)?!1:t in e}function Jf(e,t){const s=e._def.props;if(!s)return!1;const n=at(t);return Array.isArray(s)?s.some(r=>at(r)===n):Object.keys(s).some(r=>at(r)===n)}const Pr=e=>{const t=e.props["onUpdate:modelValue"]||!1;return me(t)?s=>_r(t,s):t};function Yf(e){e.target.composing=!0}function No(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const rn=Symbol("_assign");function Io(e,t,s){return t&&(e=e.trim()),s&&(e=va(e)),e}const kt={created(e,{modifiers:{lazy:t,trim:s,number:n}},r){e[rn]=Pr(r);const i=n||r.props&&r.props.type==="number";Rs(e,t?"change":"input",a=>{a.target.composing||e[rn](Io(e.value,s,i))}),(s||i)&&Rs(e,"change",()=>{e.value=Io(e.value,s,i)}),t||(Rs(e,"compositionstart",Yf),Rs(e,"compositionend",No),Rs(e,"change",No))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:n,trim:r,number:i}},a){if(e[rn]=Pr(a),e.composing)return;const o=(i||e.type==="number")&&!/^0\d/.test(e.value)?va(e.value):e.value,l=t??"";if(o===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(n&&t===s||r&&e.value.trim()===l)||(e.value=l)}},su={deep:!0,created(e,t,s){e[rn]=Pr(s),Rs(e,"change",()=>{const n=e._modelValue,r=Xf(e),i=e.checked,a=e[rn];if(me(n)){const o=Gl(n,r),l=o!==-1;if(i&&!l)a(n.concat(r));else if(!i&&l){const c=[...n];c.splice(o,1),a(c)}}else if(zr(n)){const o=new Set(n);i?o.add(r):o.delete(r),a(o)}else a(nu(e,i))})},mounted:Po,beforeUpdate(e,t,s){e[rn]=Pr(s),Po(e,t,s)}};function Po(e,{value:t,oldValue:s},n){e._modelValue=t;let r;if(me(t))r=Gl(t,n.props.value)>-1;else if(zr(t))r=t.has(n.props.value);else{if(t===s)return;r=Xn(t,nu(e,!0))}e.checked!==r&&(e.checked=r)}function Xf(e){return"_value"in e?e._value:e.value}function nu(e,t){const s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}const Qf=["ctrl","shift","alt","meta"],ep={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)=>Qf.some(s=>e[`${s}Key`]&&!t.includes(s))},yt=(e,t)=>{if(!e)return e;const s=e._withMods||(e._withMods={}),n=t.join(".");return s[n]||(s[n]=(r,...i)=>{for(let a=0;a<t.length;a++){const o=ep[t[a]];if(o&&o(r,t))return}return e(r,...i)})},tp=Ze({patchProp:Gf},Af);let Lo;function sp(){return Lo||(Lo=af(tp))}const np=(...e)=>{const t=sp().createApp(...e),{mount:s}=t;return t.mount=n=>{const r=ip(n);if(!r)return;const i=t._component;!Ee(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const a=s(r,!1,rp(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function rp(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ip(e){return De(e)?document.querySelector(e):e}/*!
18
18
  * pinia v2.3.1
19
19
  * (c) 2025 Eduardo San Martin Morote
20
20
  * @license MIT
21
- */let ru;const ai=e=>ru=e,iu=Symbol();function Ji(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Cn;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Cn||(Cn={}));function ap(){const e=Xl(!0),t=e.run(()=>Q({}));let s=[],n=[];const r=Ta({install(i){ai(r),r._a=i,i.provide(iu,r),i.config.globalProperties.$pinia=r,n.forEach(a=>s.push(a)),n=[]},use(i){return this._a?s.push(i):n.push(i),this},_p:s,_a:null,_e:e,_s:new Map,state:t});return r}const au=()=>{};function Mo(e,t,s,n=au){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),n())};return!s&&Ql()&&Ld(r),r}function Us(e,...t){e.slice().forEach(s=>{s(...t)})}const op=e=>e(),jo=Symbol(),Ti=Symbol();function Yi(e,t){e instanceof Map&&t instanceof Map?t.forEach((s,n)=>e.set(n,s)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const s in t){if(!t.hasOwnProperty(s))continue;const n=t[s],r=e[s];Ji(r)&&Ji(n)&&e.hasOwnProperty(s)&&!Fe(n)&&!Qt(n)?e[s]=Yi(r,n):e[s]=n}return e}const lp=Symbol();function cp(e){return!Ji(e)||!e.hasOwnProperty(lp)}const{assign:cs}=Object;function up(e){return!!(Fe(e)&&e.effect)}function dp(e,t,s,n){const{state:r,actions:i,getters:a}=t,o=s.state.value[e];let l;function c(){o||(s.state.value[e]=r?r():{});const u=rh(s.state.value[e]);return cs(u,i,Object.keys(a||{}).reduce((d,h)=>(d[h]=Ta(je(()=>{ai(s);const f=s._s.get(e);return a[h].call(f,f)})),d),{}))}return l=ou(e,c,t,s,n,!0),l}function ou(e,t,s={},n,r,i){let a;const o=cs({actions:{}},s),l={deep:!0};let c,u,d=[],h=[],f;const g=n.state.value[e];!i&&!g&&(n.state.value[e]={});let m;function S(C){let j;c=u=!1,typeof C=="function"?(C(n.state.value[e]),j={type:Cn.patchFunction,storeId:e,events:f}):(Yi(n.state.value[e],C),j={type:Cn.patchObject,payload:C,storeId:e,events:f});const V=m=Symbol();Ns().then(()=>{m===V&&(c=!0)}),u=!0,Us(d,j,n.state.value[e])}const E=i?function(){const{state:j}=s,V=j?j():{};this.$patch(Z=>{cs(Z,V)})}:au;function x(){a.stop(),d=[],h=[],n._s.delete(e)}const k=(C,j="")=>{if(jo in C)return C[Ti]=j,C;const V=function(){ai(n);const Z=Array.from(arguments),$=[],W=[];function L(z){$.push(z)}function pe(z){W.push(z)}Us(h,{args:Z,name:V[Ti],store:N,after:L,onError:pe});let M;try{M=C.apply(this&&this.$id===e?this:N,Z)}catch(z){throw Us(W,z),z}return M instanceof Promise?M.then(z=>(Us($,z),z)).catch(z=>(Us(W,z),Promise.reject(z))):(Us($,M),M)};return V[jo]=!0,V[Ti]=j,V},P={_p:n,$id:e,$onAction:Mo.bind(null,h),$patch:S,$reset:E,$subscribe(C,j={}){const V=Mo(d,C,j.detached,()=>Z()),Z=a.run(()=>es(()=>n.state.value[e],$=>{(j.flush==="sync"?u:c)&&C({storeId:e,type:Cn.direct,events:f},$)},cs({},l,j)));return V},$dispose:x},N=Xt(P);n._s.set(e,N);const v=(n._a&&n._a.runWithContext||op)(()=>n._e.run(()=>(a=Xl()).run(()=>t({action:k}))));for(const C in v){const j=v[C];if(Fe(j)&&!up(j)||Qt(j))i||(g&&cp(j)&&(Fe(j)?j.value=g[C]:Yi(j,g[C])),n.state.value[e][C]=j);else if(typeof j=="function"){const V=k(j,C);v[C]=V,o.actions[C]=j}}return cs(N,v),cs(Ae(N),v),Object.defineProperty(N,"$state",{get:()=>n.state.value[e],set:C=>{S(j=>{cs(j,C)})}}),n._p.forEach(C=>{cs(N,a.run(()=>C({store:N,app:n._a,pinia:n,options:o})))}),g&&i&&s.hydrate&&s.hydrate(N.$state,g),c=!0,u=!0,N}/*! #__NO_SIDE_EFFECTS__ */function lu(e,t,s){let n,r;const i=typeof t=="function";typeof e=="string"?(n=e,r=i?s:t):(r=e,n=e.id);function a(o,l){const c=ph();return o=o||(c?vt(iu,null):null),o&&ai(o),o=ru,o._s.has(n)||(i?ou(n,t,r,o):dp(n,r,o)),o._s.get(n)}return a.$id=n,a}/*!
21
+ */let ru;const ai=e=>ru=e,iu=Symbol();function Ji(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Cn;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Cn||(Cn={}));function ap(){const e=Xl(!0),t=e.run(()=>Q({}));let s=[],n=[];const r=Ta({install(i){ai(r),r._a=i,i.provide(iu,r),i.config.globalProperties.$pinia=r,n.forEach(a=>s.push(a)),n=[]},use(i){return this._a?s.push(i):n.push(i),this},_p:s,_a:null,_e:e,_s:new Map,state:t});return r}const au=()=>{};function Mo(e,t,s,n=au){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),n())};return!s&&Ql()&&Ld(r),r}function Bs(e,...t){e.slice().forEach(s=>{s(...t)})}const op=e=>e(),jo=Symbol(),Ti=Symbol();function Yi(e,t){e instanceof Map&&t instanceof Map?t.forEach((s,n)=>e.set(n,s)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const s in t){if(!t.hasOwnProperty(s))continue;const n=t[s],r=e[s];Ji(r)&&Ji(n)&&e.hasOwnProperty(s)&&!Fe(n)&&!Qt(n)?e[s]=Yi(r,n):e[s]=n}return e}const lp=Symbol();function cp(e){return!Ji(e)||!e.hasOwnProperty(lp)}const{assign:cs}=Object;function up(e){return!!(Fe(e)&&e.effect)}function dp(e,t,s,n){const{state:r,actions:i,getters:a}=t,o=s.state.value[e];let l;function c(){o||(s.state.value[e]=r?r():{});const u=rh(s.state.value[e]);return cs(u,i,Object.keys(a||{}).reduce((d,h)=>(d[h]=Ta(je(()=>{ai(s);const f=s._s.get(e);return a[h].call(f,f)})),d),{}))}return l=ou(e,c,t,s,n,!0),l}function ou(e,t,s={},n,r,i){let a;const o=cs({actions:{}},s),l={deep:!0};let c,u,d=[],h=[],f;const g=n.state.value[e];!i&&!g&&(n.state.value[e]={});let b;function S(C){let j;c=u=!1,typeof C=="function"?(C(n.state.value[e]),j={type:Cn.patchFunction,storeId:e,events:f}):(Yi(n.state.value[e],C),j={type:Cn.patchObject,payload:C,storeId:e,events:f});const V=b=Symbol();Is().then(()=>{b===V&&(c=!0)}),u=!0,Bs(d,j,n.state.value[e])}const E=i?function(){const{state:j}=s,V=j?j():{};this.$patch(Z=>{cs(Z,V)})}:au;function x(){a.stop(),d=[],h=[],n._s.delete(e)}const k=(C,j="")=>{if(jo in C)return C[Ti]=j,C;const V=function(){ai(n);const Z=Array.from(arguments),$=[],W=[];function L(z){$.push(z)}function pe(z){W.push(z)}Bs(h,{args:Z,name:V[Ti],store:N,after:L,onError:pe});let M;try{M=C.apply(this&&this.$id===e?this:N,Z)}catch(z){throw Bs(W,z),z}return M instanceof Promise?M.then(z=>(Bs($,z),z)).catch(z=>(Bs(W,z),Promise.reject(z))):(Bs($,M),M)};return V[jo]=!0,V[Ti]=j,V},P={_p:n,$id:e,$onAction:Mo.bind(null,h),$patch:S,$reset:E,$subscribe(C,j={}){const V=Mo(d,C,j.detached,()=>Z()),Z=a.run(()=>es(()=>n.state.value[e],$=>{(j.flush==="sync"?u:c)&&C({storeId:e,type:Cn.direct,events:f},$)},cs({},l,j)));return V},$dispose:x},N=Xt(P);n._s.set(e,N);const v=(n._a&&n._a.runWithContext||op)(()=>n._e.run(()=>(a=Xl()).run(()=>t({action:k}))));for(const C in v){const j=v[C];if(Fe(j)&&!up(j)||Qt(j))i||(g&&cp(j)&&(Fe(j)?j.value=g[C]:Yi(j,g[C])),n.state.value[e][C]=j);else if(typeof j=="function"){const V=k(j,C);v[C]=V,o.actions[C]=j}}return cs(N,v),cs(Ae(N),v),Object.defineProperty(N,"$state",{get:()=>n.state.value[e],set:C=>{S(j=>{cs(j,C)})}}),n._p.forEach(C=>{cs(N,a.run(()=>C({store:N,app:n._a,pinia:n,options:o})))}),g&&i&&s.hydrate&&s.hydrate(N.$state,g),c=!0,u=!0,N}/*! #__NO_SIDE_EFFECTS__ */function lu(e,t,s){let n,r;const i=typeof t=="function";typeof e=="string"?(n=e,r=i?s:t):(r=e,n=e.id);function a(o,l){const c=ph();return o=o||(c?vt(iu,null):null),o&&ai(o),o=ru,o._s.has(n)||(i?ou(n,t,r,o):dp(n,r,o)),o._s.get(n)}return a.$id=n,a}/*!
22
22
  * vue-router v4.6.4
23
23
  * (c) 2025 Eduardo San Martin Morote
24
24
  * @license MIT
25
- */const Ws=typeof document<"u";function cu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&cu(e.default)}const Oe=Object.assign;function Ai(e,t){const s={};for(const n in t){const r=t[n];s[n]=Rt(r)?r.map(e):e(r)}return s}const On=()=>{},Rt=Array.isArray;function Do(e,t){const s={};for(const n in e)s[n]=n in t?t[n]:e[n];return s}const uu=/#/g,fp=/&/g,pp=/\//g,gp=/=/g,mp=/\?/g,du=/\+/g,bp=/%5B/g,vp=/%5D/g,hu=/%5E/g,yp=/%60/g,fu=/%7B/g,_p=/%7C/g,pu=/%7D/g,wp=/%20/g;function La(e){return e==null?"":encodeURI(""+e).replace(_p,"|").replace(bp,"[").replace(vp,"]")}function xp(e){return La(e).replace(fu,"{").replace(pu,"}").replace(hu,"^")}function Xi(e){return La(e).replace(du,"%2B").replace(wp,"+").replace(uu,"%23").replace(fp,"%26").replace(yp,"`").replace(fu,"{").replace(pu,"}").replace(hu,"^")}function Ep(e){return Xi(e).replace(gp,"%3D")}function kp(e){return La(e).replace(uu,"%23").replace(mp,"%3F")}function Sp(e){return kp(e).replace(pp,"%2F")}function Hn(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Tp=/\/$/,Ap=e=>e.replace(Tp,"");function Ri(e,t,s="/"){let n,r={},i="",a="";const o=t.indexOf("#");let l=t.indexOf("?");return l=o>=0&&l>o?-1:l,l>=0&&(n=t.slice(0,l),i=t.slice(l,o>0?o:t.length),r=e(i.slice(1))),o>=0&&(n=n||t.slice(0,o),a=t.slice(o,t.length)),n=$p(n??t,s),{fullPath:n+i+a,path:n,query:r,hash:Hn(a)}}function Rp(e,t){const s=t.query?e(t.query):"";return t.path+(s&&"?")+s+(t.hash||"")}function Uo(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Cp(e,t,s){const n=t.matched.length-1,r=s.matched.length-1;return n>-1&&n===r&&ln(t.matched[n],s.matched[r])&&gu(t.params,s.params)&&e(t.query)===e(s.query)&&t.hash===s.hash}function ln(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function gu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var s in e)if(!Op(e[s],t[s]))return!1;return!0}function Op(e,t){return Rt(e)?Bo(e,t):Rt(t)?Bo(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Bo(e,t){return Rt(t)?e.length===t.length&&e.every((s,n)=>s===t[n]):e.length===1&&e[0]===t}function $p(e,t){if(e.startsWith("/"))return e;if(!e)return t;const s=t.split("/"),n=e.split("/"),r=n[n.length-1];(r===".."||r===".")&&n.push("");let i=s.length-1,a,o;for(a=0;a<n.length;a++)if(o=n[a],o!==".")if(o==="..")i>1&&i--;else break;return s.slice(0,i).join("/")+"/"+n.slice(a).join("/")}const os={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Qi=function(e){return e.pop="pop",e.push="push",e}({}),Ci=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Np(e){if(!e)if(Ws){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Ap(e)}const Ip=/^[^#]+#/;function Pp(e,t){return e.replace(Ip,"#")+t}function Lp(e,t){const s=document.documentElement.getBoundingClientRect(),n=e.getBoundingClientRect();return{behavior:t.behavior,left:n.left-s.left-(t.left||0),top:n.top-s.top-(t.top||0)}}const oi=()=>({left:window.scrollX,top:window.scrollY});function Mp(e){let t;if("el"in e){const s=e.el,n=typeof s=="string"&&s.startsWith("#"),r=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!r)return;t=Lp(r,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 Ho(e,t){return(history.state?history.state.position-t:-1)+e}const ea=new Map;function jp(e,t){ea.set(e,t)}function Dp(e){const t=ea.get(e);return ea.delete(e),t}function Up(e){return typeof e=="string"||e&&typeof e=="object"}function mu(e){return typeof e=="string"||typeof e=="symbol"}let Be=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 bu=Symbol("");Be.MATCHER_NOT_FOUND+"",Be.NAVIGATION_GUARD_REDIRECT+"",Be.NAVIGATION_ABORTED+"",Be.NAVIGATION_CANCELLED+"",Be.NAVIGATION_DUPLICATED+"";function cn(e,t){return Oe(new Error,{type:e,[bu]:!0},t)}function qt(e,t){return e instanceof Error&&bu in e&&(t==null||!!(e.type&t))}const Bp=["params","query","hash"];function Hp(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const s of Bp)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Fp(e){const t={};if(e===""||e==="?")return t;const s=(e[0]==="?"?e.slice(1):e).split("&");for(let n=0;n<s.length;++n){const r=s[n].replace(du," "),i=r.indexOf("="),a=Hn(i<0?r:r.slice(0,i)),o=i<0?null:Hn(r.slice(i+1));if(a in t){let l=t[a];Rt(l)||(l=t[a]=[l]),l.push(o)}else t[a]=o}return t}function Fo(e){let t="";for(let s in e){const n=e[s];if(s=Ep(s),n==null){n!==void 0&&(t+=(t.length?"&":"")+s);continue}(Rt(n)?n.map(r=>r&&Xi(r)):[n&&Xi(n)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+s,r!=null&&(t+="="+r))})}return t}function Vp(e){const t={};for(const s in e){const n=e[s];n!==void 0&&(t[s]=Rt(n)?n.map(r=>r==null?null:""+r):n==null?n:""+n)}return t}const qp=Symbol(""),Vo=Symbol(""),li=Symbol(""),Ma=Symbol(""),ta=Symbol("");function gn(){let e=[];function t(n){return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function ds(e,t,s,n,r,i=a=>a()){const a=n&&(n.enterCallbacks[r]=n.enterCallbacks[r]||[]);return()=>new Promise((o,l)=>{const c=h=>{h===!1?l(cn(Be.NAVIGATION_ABORTED,{from:s,to:t})):h instanceof Error?l(h):Up(h)?l(cn(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:h})):(a&&n.enterCallbacks[r]===a&&typeof h=="function"&&a.push(h),o())},u=i(()=>e.call(n&&n.instances[r],t,s,c));let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(h=>l(h))})}function Oi(e,t,s,n,r=i=>i()){const i=[];for(const a of e)for(const o in a.components){let l=a.components[o];if(!(t!=="beforeRouteEnter"&&!a.instances[o]))if(cu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(ds(c,s,n,a,o,r))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${o}" at "${a.path}"`);const d=hp(u)?u.default:u;a.mods[o]=u,a.components[o]=d;const h=(d.__vccOpts||d)[t];return h&&ds(h,s,n,a,o,r)()}))}}return i}function zp(e,t){const s=[],n=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;a<i;a++){const o=t.matched[a];o&&(e.matched.find(c=>ln(c,o))?n.push(o):s.push(o));const l=e.matched[a];l&&(t.matched.find(c=>ln(c,l))||r.push(l))}return[s,n,r]}/*!
25
+ */const Gs=typeof document<"u";function cu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&cu(e.default)}const Oe=Object.assign;function Ai(e,t){const s={};for(const n in t){const r=t[n];s[n]=Rt(r)?r.map(e):e(r)}return s}const On=()=>{},Rt=Array.isArray;function Do(e,t){const s={};for(const n in e)s[n]=n in t?t[n]:e[n];return s}const uu=/#/g,fp=/&/g,pp=/\//g,gp=/=/g,mp=/\?/g,du=/\+/g,bp=/%5B/g,vp=/%5D/g,hu=/%5E/g,yp=/%60/g,fu=/%7B/g,_p=/%7C/g,pu=/%7D/g,wp=/%20/g;function La(e){return e==null?"":encodeURI(""+e).replace(_p,"|").replace(bp,"[").replace(vp,"]")}function xp(e){return La(e).replace(fu,"{").replace(pu,"}").replace(hu,"^")}function Xi(e){return La(e).replace(du,"%2B").replace(wp,"+").replace(uu,"%23").replace(fp,"%26").replace(yp,"`").replace(fu,"{").replace(pu,"}").replace(hu,"^")}function Ep(e){return Xi(e).replace(gp,"%3D")}function kp(e){return La(e).replace(uu,"%23").replace(mp,"%3F")}function Sp(e){return kp(e).replace(pp,"%2F")}function Hn(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Tp=/\/$/,Ap=e=>e.replace(Tp,"");function Ri(e,t,s="/"){let n,r={},i="",a="";const o=t.indexOf("#");let l=t.indexOf("?");return l=o>=0&&l>o?-1:l,l>=0&&(n=t.slice(0,l),i=t.slice(l,o>0?o:t.length),r=e(i.slice(1))),o>=0&&(n=n||t.slice(0,o),a=t.slice(o,t.length)),n=$p(n??t,s),{fullPath:n+i+a,path:n,query:r,hash:Hn(a)}}function Rp(e,t){const s=t.query?e(t.query):"";return t.path+(s&&"?")+s+(t.hash||"")}function Uo(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Cp(e,t,s){const n=t.matched.length-1,r=s.matched.length-1;return n>-1&&n===r&&ln(t.matched[n],s.matched[r])&&gu(t.params,s.params)&&e(t.query)===e(s.query)&&t.hash===s.hash}function ln(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function gu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var s in e)if(!Op(e[s],t[s]))return!1;return!0}function Op(e,t){return Rt(e)?Bo(e,t):Rt(t)?Bo(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Bo(e,t){return Rt(t)?e.length===t.length&&e.every((s,n)=>s===t[n]):e.length===1&&e[0]===t}function $p(e,t){if(e.startsWith("/"))return e;if(!e)return t;const s=t.split("/"),n=e.split("/"),r=n[n.length-1];(r===".."||r===".")&&n.push("");let i=s.length-1,a,o;for(a=0;a<n.length;a++)if(o=n[a],o!==".")if(o==="..")i>1&&i--;else break;return s.slice(0,i).join("/")+"/"+n.slice(a).join("/")}const os={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Qi=function(e){return e.pop="pop",e.push="push",e}({}),Ci=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Np(e){if(!e)if(Gs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Ap(e)}const Ip=/^[^#]+#/;function Pp(e,t){return e.replace(Ip,"#")+t}function Lp(e,t){const s=document.documentElement.getBoundingClientRect(),n=e.getBoundingClientRect();return{behavior:t.behavior,left:n.left-s.left-(t.left||0),top:n.top-s.top-(t.top||0)}}const oi=()=>({left:window.scrollX,top:window.scrollY});function Mp(e){let t;if("el"in e){const s=e.el,n=typeof s=="string"&&s.startsWith("#"),r=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!r)return;t=Lp(r,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 Ho(e,t){return(history.state?history.state.position-t:-1)+e}const ea=new Map;function jp(e,t){ea.set(e,t)}function Dp(e){const t=ea.get(e);return ea.delete(e),t}function Up(e){return typeof e=="string"||e&&typeof e=="object"}function mu(e){return typeof e=="string"||typeof e=="symbol"}let Be=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 bu=Symbol("");Be.MATCHER_NOT_FOUND+"",Be.NAVIGATION_GUARD_REDIRECT+"",Be.NAVIGATION_ABORTED+"",Be.NAVIGATION_CANCELLED+"",Be.NAVIGATION_DUPLICATED+"";function cn(e,t){return Oe(new Error,{type:e,[bu]:!0},t)}function qt(e,t){return e instanceof Error&&bu in e&&(t==null||!!(e.type&t))}const Bp=["params","query","hash"];function Hp(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const s of Bp)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Fp(e){const t={};if(e===""||e==="?")return t;const s=(e[0]==="?"?e.slice(1):e).split("&");for(let n=0;n<s.length;++n){const r=s[n].replace(du," "),i=r.indexOf("="),a=Hn(i<0?r:r.slice(0,i)),o=i<0?null:Hn(r.slice(i+1));if(a in t){let l=t[a];Rt(l)||(l=t[a]=[l]),l.push(o)}else t[a]=o}return t}function Fo(e){let t="";for(let s in e){const n=e[s];if(s=Ep(s),n==null){n!==void 0&&(t+=(t.length?"&":"")+s);continue}(Rt(n)?n.map(r=>r&&Xi(r)):[n&&Xi(n)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+s,r!=null&&(t+="="+r))})}return t}function Vp(e){const t={};for(const s in e){const n=e[s];n!==void 0&&(t[s]=Rt(n)?n.map(r=>r==null?null:""+r):n==null?n:""+n)}return t}const qp=Symbol(""),Vo=Symbol(""),li=Symbol(""),Ma=Symbol(""),ta=Symbol("");function gn(){let e=[];function t(n){return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function ds(e,t,s,n,r,i=a=>a()){const a=n&&(n.enterCallbacks[r]=n.enterCallbacks[r]||[]);return()=>new Promise((o,l)=>{const c=h=>{h===!1?l(cn(Be.NAVIGATION_ABORTED,{from:s,to:t})):h instanceof Error?l(h):Up(h)?l(cn(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:h})):(a&&n.enterCallbacks[r]===a&&typeof h=="function"&&a.push(h),o())},u=i(()=>e.call(n&&n.instances[r],t,s,c));let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(h=>l(h))})}function Oi(e,t,s,n,r=i=>i()){const i=[];for(const a of e)for(const o in a.components){let l=a.components[o];if(!(t!=="beforeRouteEnter"&&!a.instances[o]))if(cu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(ds(c,s,n,a,o,r))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${o}" at "${a.path}"`);const d=hp(u)?u.default:u;a.mods[o]=u,a.components[o]=d;const h=(d.__vccOpts||d)[t];return h&&ds(h,s,n,a,o,r)()}))}}return i}function zp(e,t){const s=[],n=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;a<i;a++){const o=t.matched[a];o&&(e.matched.find(c=>ln(c,o))?n.push(o):s.push(o));const l=e.matched[a];l&&(t.matched.find(c=>ln(c,l))||r.push(l))}return[s,n,r]}/*!
26
26
  * vue-router v4.6.4
27
27
  * (c) 2025 Eduardo San Martin Morote
28
28
  * @license MIT
29
- */let Kp=()=>location.protocol+"//"+location.host;function vu(e,t){const{pathname:s,search:n,hash:r}=t,i=e.indexOf("#");if(i>-1){let a=r.includes(e.slice(i))?e.slice(i).length:1,o=r.slice(a);return o[0]!=="/"&&(o="/"+o),Uo(o,"")}return Uo(s,e)+n+r}function Wp(e,t,s,n){let r=[],i=[],a=null;const o=({state:h})=>{const f=vu(e,location),g=s.value,m=t.value;let S=0;if(h){if(s.value=f,t.value=h,a&&a===g){a=null;return}S=m?h.position-m.position:0}else n(f);r.forEach(E=>{E(s.value,g,{delta:S,type:Qi.pop,direction:S?S>0?Ci.forward:Ci.back:Ci.unknown})})};function l(){a=s.value}function c(h){r.push(h);const f=()=>{const g=r.indexOf(h);g>-1&&r.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:h}=window;if(!h.state)return;h.replaceState(Oe({},h.state,{scroll:oi()}),"")}}function d(){for(const h of i)h();i=[],window.removeEventListener("popstate",o),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",o),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:d}}function qo(e,t,s,n=!1,r=!1){return{back:e,current:t,forward:s,replaced:n,position:window.history.length,scroll:r?oi():null}}function Gp(e){const{history:t,location:s}=window,n={value:vu(e,s)},r={value:t.state};r.value||i(n.value,{back:null,current:n.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const d=e.indexOf("#"),h=d>-1?(s.host&&document.querySelector("base")?e:e.slice(d))+l:Kp()+e+l;try{t[u?"replaceState":"pushState"](c,"",h),r.value=c}catch(f){console.error(f),s[u?"replace":"assign"](h)}}function a(l,c){i(l,Oe({},t.state,qo(r.value.back,l,r.value.forward,!0),c,{position:r.value.position}),!0),n.value=l}function o(l,c){const u=Oe({},r.value,t.state,{forward:l,scroll:oi()});i(u.current,u,!0),i(l,Oe({},qo(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:r,push:o,replace:a}}function Zp(e){e=Np(e);const t=Gp(e),s=Wp(e,t.state,t.location,t.replace);function n(i,a=!0){a||s.pauseListeners(),history.go(i)}const r=Oe({location:"",base:e,go:n,createHref:Pp.bind(null,e)},t,s);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let Cs=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var We=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}(We||{});const Jp={type:Cs.Static,value:""},Yp=/[a-zA-Z0-9_]/;function Xp(e){if(!e)return[[]];if(e==="/")return[[Jp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=We.Static,n=s;const r=[];let i;function a(){i&&r.push(i),i=[]}let o=0,l,c="",u="";function d(){c&&(s===We.Static?i.push({type:Cs.Static,value:c}):s===We.Param||s===We.ParamRegExp||s===We.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Cs.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;o<e.length;){if(l=e[o++],l==="\\"&&s!==We.ParamRegExp){n=s,s=We.EscapeNext;continue}switch(s){case We.Static:l==="/"?(c&&d(),a()):l===":"?(d(),s=We.Param):h();break;case We.EscapeNext:h(),s=n;break;case We.Param:l==="("?s=We.ParamRegExp:Yp.test(l)?h():(d(),s=We.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--);break;case We.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=We.ParamRegExpEnd:u+=l;break;case We.ParamRegExpEnd:d(),s=We.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--,u="";break;default:t("Unknown state");break}}return s===We.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),d(),a(),r}const zo="[^/]+?",Qp={sensitive:!1,strict:!1,start:!0,end:!0};var nt=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}(nt||{});const eg=/[.+*?^${}()[\]/\\]/g;function tg(e,t){const s=Oe({},Qp,t),n=[];let r=s.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[nt.Root];s.strict&&!c.length&&(r+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=nt.Segment+(s.sensitive?nt.BonusCaseSensitive:0);if(h.type===Cs.Static)d||(r+="/"),r+=h.value.replace(eg,"\\$&"),f+=nt.Static;else if(h.type===Cs.Param){const{value:g,repeatable:m,optional:S,regexp:E}=h;i.push({name:g,repeatable:m,optional:S});const x=E||zo;if(x!==zo){f+=nt.BonusCustomRegExp;try{`${x}`}catch(P){throw new Error(`Invalid custom RegExp for param "${g}" (${x}): `+P.message)}}let k=m?`((?:${x})(?:/(?:${x}))*)`:`(${x})`;d||(k=S&&c.length<2?`(?:/${k})`:"/"+k),S&&(k+="?"),r+=k,f+=nt.Dynamic,S&&(f+=nt.BonusOptional),m&&(f+=nt.BonusRepeatable),x===".*"&&(f+=nt.BonusWildcard)}u.push(f)}n.push(u)}if(s.strict&&s.end){const c=n.length-1;n[c][n[c].length-1]+=nt.BonusStrict}s.strict||(r+="/?"),s.end?r+="$":s.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const a=new RegExp(r,s.sensitive?"":"i");function o(c){const u=c.match(a),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",g=i[h-1];d[g.name]=f&&g.repeatable?f.split("/"):f}return d}function l(c){let u="",d=!1;for(const h of e){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===Cs.Static)u+=f.value;else if(f.type===Cs.Param){const{value:g,repeatable:m,optional:S}=f,E=g in c?c[g]:"";if(Rt(E)&&!m)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const x=Rt(E)?E.join("/"):E;if(!x)if(S)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${g}"`);u+=x}}return u||"/"}return{re:a,score:n,keys:i,parse:o,stringify:l}}function sg(e,t){let s=0;for(;s<e.length&&s<t.length;){const n=t[s]-e[s];if(n)return n;s++}return e.length<t.length?e.length===1&&e[0]===nt.Static+nt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===nt.Static+nt.Segment?1:-1:0}function yu(e,t){let s=0;const n=e.score,r=t.score;for(;s<n.length&&s<r.length;){const i=sg(n[s],r[s]);if(i)return i;s++}if(Math.abs(r.length-n.length)===1){if(Ko(n))return 1;if(Ko(r))return-1}return r.length-n.length}function Ko(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const ng={strict:!1,end:!0,sensitive:!1};function rg(e,t,s){const n=tg(Xp(e.path),s),r=Oe(n,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function ig(e,t){const s=[],n=new Map;t=Do(ng,t);function r(d){return n.get(d)}function i(d,h,f){const g=!f,m=Go(d);m.aliasOf=f&&f.record;const S=Do(t,d),E=[m];if("alias"in d){const P=typeof d.alias=="string"?[d.alias]:d.alias;for(const N of P)E.push(Go(Oe({},m,{components:f?f.record.components:m.components,path:N,aliasOf:f?f.record:m})))}let x,k;for(const P of E){const{path:N}=P;if(h&&N[0]!=="/"){const R=h.record.path,v=R[R.length-1]==="/"?"":"/";P.path=h.record.path+(N&&v+N)}if(x=rg(P,h,S),f?f.alias.push(x):(k=k||x,k!==x&&k.alias.push(x),g&&d.name&&!Zo(x)&&a(d.name)),_u(x)&&l(x),m.children){const R=m.children;for(let v=0;v<R.length;v++)i(R[v],x,f&&f.children[v])}f=f||x}return k?()=>{a(k)}:On}function a(d){if(mu(d)){const h=n.get(d);h&&(n.delete(d),s.splice(s.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=s.indexOf(d);h>-1&&(s.splice(h,1),d.record.name&&n.delete(d.record.name),d.children.forEach(a),d.alias.forEach(a))}}function o(){return s}function l(d){const h=lg(d,s);s.splice(h,0,d),d.record.name&&!Zo(d)&&n.set(d.record.name,d)}function c(d,h){let f,g={},m,S;if("name"in d&&d.name){if(f=n.get(d.name),!f)throw cn(Be.MATCHER_NOT_FOUND,{location:d});S=f.record.name,g=Oe(Wo(h.params,f.keys.filter(k=>!k.optional).concat(f.parent?f.parent.keys.filter(k=>k.optional):[]).map(k=>k.name)),d.params&&Wo(d.params,f.keys.map(k=>k.name))),m=f.stringify(g)}else if(d.path!=null)m=d.path,f=s.find(k=>k.re.test(m)),f&&(g=f.parse(m),S=f.record.name);else{if(f=h.name?n.get(h.name):s.find(k=>k.re.test(h.path)),!f)throw cn(Be.MATCHER_NOT_FOUND,{location:d,currentLocation:h});S=f.record.name,g=Oe({},h.params,d.params),m=f.stringify(g)}const E=[];let x=f;for(;x;)E.unshift(x.record),x=x.parent;return{name:S,path:m,params:g,matched:E,meta:og(E)}}e.forEach(d=>i(d));function u(){s.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:a,clearRoutes:u,getRoutes:o,getRecordMatcher:r}}function Wo(e,t){const s={};for(const n of t)n in e&&(s[n]=e[n]);return s}function Go(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ag(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 ag(e){const t={},s=e.props||!1;if("component"in e)t.default=s;else for(const n in e.components)t[n]=typeof s=="object"?s[n]:s;return t}function Zo(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function og(e){return e.reduce((t,s)=>Oe(t,s.meta),{})}function lg(e,t){let s=0,n=t.length;for(;s!==n;){const i=s+n>>1;yu(e,t[i])<0?n=i:s=i+1}const r=cg(e);return r&&(n=t.lastIndexOf(r,n-1)),n}function cg(e){let t=e;for(;t=t.parent;)if(_u(t)&&yu(e,t)===0)return t}function _u({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Jo(e){const t=vt(li),s=vt(Ma),n=je(()=>{const l=Ie(e.to);return t.resolve(l)}),r=je(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const h=d.findIndex(ln.bind(null,u));if(h>-1)return h;const f=Yo(l[c-2]);return c>1&&Yo(u)===f&&d[d.length-1].path!==f?d.findIndex(ln.bind(null,l[c-2])):h}),i=je(()=>r.value>-1&&fg(s.params,n.value.params)),a=je(()=>r.value>-1&&r.value===s.matched.length-1&&gu(s.params,n.value.params));function o(l={}){if(hg(l)){const c=t[Ie(e.replace)?"replace":"push"](Ie(e.to)).catch(On);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:je(()=>n.value.href),isActive:i,isExactActive:a,navigate:o}}function ug(e){return e.length===1?e[0]:e}const dg=pt({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:Jo,setup(e,{slots:t}){const s=Xt(Jo(e)),{options:n}=vt(li),r=je(()=>({[Xo(e.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Xo(e.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=t.default&&ug(t.default(s));return e.custom?i:Pa("a",{"aria-current":s.isExactActive?e.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:r.value},i)}}}),sa=dg;function hg(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 fg(e,t){for(const s in t){const n=t[s],r=e[s];if(typeof n=="string"){if(n!==r)return!1}else if(!Rt(r)||r.length!==n.length||n.some((i,a)=>i.valueOf()!==r[a].valueOf()))return!1}return!0}function Yo(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xo=(e,t,s)=>e??t??s,pg=pt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:s}){const n=vt(ta),r=je(()=>e.route||n.value),i=vt(Vo,0),a=je(()=>{let c=Ie(i);const{matched:u}=r.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),o=je(()=>r.value.matched[a.value]);wr(Vo,je(()=>a.value+1)),wr(qp,o),wr(ta,r);const l=Q();return es(()=>[l.value,o.value,e.name],([c,u,d],[h,f,g])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!ln(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=r.value,u=e.name,d=o.value,h=d&&d.components[u];if(!h)return Qo(s.default,{Component:h,route:c});const f=d.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,S=Pa(h,Oe({},g,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Qo(s.default,{Component:S,route:c})||S}}});function Qo(e,t){if(!e)return null;const s=e(t);return s.length===1?s[0]:s}const wu=pg;function gg(e){const t=ig(e.routes,e),s=e.parseQuery||Fp,n=e.stringifyQuery||Fo,r=e.history,i=gn(),a=gn(),o=gn(),l=th(os);let c=os;Ws&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ai.bind(null,F=>""+F),d=Ai.bind(null,Sp),h=Ai.bind(null,Hn);function f(F,ae){let ie,he;return mu(F)?(ie=t.getRecordMatcher(F),he=ae):he=F,t.addRoute(he,ie)}function g(F){const ae=t.getRecordMatcher(F);ae&&t.removeRoute(ae)}function m(){return t.getRoutes().map(F=>F.record)}function S(F){return!!t.getRecordMatcher(F)}function E(F,ae){if(ae=Oe({},ae||l.value),typeof F=="string"){const A=Ri(s,F,ae.path),D=t.resolve({path:A.path},ae),K=r.createHref(A.fullPath);return Oe(A,D,{params:h(D.params),hash:Hn(A.hash),redirectedFrom:void 0,href:K})}let ie;if(F.path!=null)ie=Oe({},F,{path:Ri(s,F.path,ae.path).path});else{const A=Oe({},F.params);for(const D in A)A[D]==null&&delete A[D];ie=Oe({},F,{params:d(A)}),ae.params=d(ae.params)}const he=t.resolve(ie,ae),Se=F.hash||"";he.params=u(h(he.params));const b=Rp(n,Oe({},F,{hash:xp(Se),path:he.path})),y=r.createHref(b);return Oe({fullPath:b,hash:Se,query:n===Fo?Vp(F.query):F.query||{}},he,{redirectedFrom:void 0,href:y})}function x(F){return typeof F=="string"?Ri(s,F,l.value.path):Oe({},F)}function k(F,ae){if(c!==F)return cn(Be.NAVIGATION_CANCELLED,{from:ae,to:F})}function P(F){return v(F)}function N(F){return P(Oe(x(F),{replace:!0}))}function R(F,ae){const ie=F.matched[F.matched.length-1];if(ie&&ie.redirect){const{redirect:he}=ie;let Se=typeof he=="function"?he(F,ae):he;return typeof Se=="string"&&(Se=Se.includes("?")||Se.includes("#")?Se=x(Se):{path:Se},Se.params={}),Oe({query:F.query,hash:F.hash,params:Se.path!=null?{}:F.params},Se)}}function v(F,ae){const ie=c=E(F),he=l.value,Se=F.state,b=F.force,y=F.replace===!0,A=R(ie,he);if(A)return v(Oe(x(A),{state:typeof A=="object"?Oe({},Se,A.state):Se,force:b,replace:y}),ae||ie);const D=ie;D.redirectedFrom=ae;let K;return!b&&Cp(n,he,ie)&&(K=cn(Be.NAVIGATION_DUPLICATED,{to:D,from:he}),q(he,he,!0,!1)),(K?Promise.resolve(K):V(D,he)).catch(B=>qt(B)?qt(B,Be.NAVIGATION_GUARD_REDIRECT)?B:xe(B):Y(B,D,he)).then(B=>{if(B){if(qt(B,Be.NAVIGATION_GUARD_REDIRECT))return v(Oe({replace:y},x(B.to),{state:typeof B.to=="object"?Oe({},Se,B.to.state):Se,force:b}),ae||D)}else B=$(D,he,!0,y,Se);return Z(D,he,B),B})}function C(F,ae){const ie=k(F,ae);return ie?Promise.reject(ie):Promise.resolve()}function j(F){const ae=X.values().next().value;return ae&&typeof ae.runWithContext=="function"?ae.runWithContext(F):F()}function V(F,ae){let ie;const[he,Se,b]=zp(F,ae);ie=Oi(he.reverse(),"beforeRouteLeave",F,ae);for(const A of he)A.leaveGuards.forEach(D=>{ie.push(ds(D,F,ae))});const y=C.bind(null,F,ae);return ie.push(y),Ue(ie).then(()=>{ie=[];for(const A of i.list())ie.push(ds(A,F,ae));return ie.push(y),Ue(ie)}).then(()=>{ie=Oi(Se,"beforeRouteUpdate",F,ae);for(const A of Se)A.updateGuards.forEach(D=>{ie.push(ds(D,F,ae))});return ie.push(y),Ue(ie)}).then(()=>{ie=[];for(const A of b)if(A.beforeEnter)if(Rt(A.beforeEnter))for(const D of A.beforeEnter)ie.push(ds(D,F,ae));else ie.push(ds(A.beforeEnter,F,ae));return ie.push(y),Ue(ie)}).then(()=>(F.matched.forEach(A=>A.enterCallbacks={}),ie=Oi(b,"beforeRouteEnter",F,ae,j),ie.push(y),Ue(ie))).then(()=>{ie=[];for(const A of a.list())ie.push(ds(A,F,ae));return ie.push(y),Ue(ie)}).catch(A=>qt(A,Be.NAVIGATION_CANCELLED)?A:Promise.reject(A))}function Z(F,ae,ie){o.list().forEach(he=>j(()=>he(F,ae,ie)))}function $(F,ae,ie,he,Se){const b=k(F,ae);if(b)return b;const y=ae===os,A=Ws?history.state:{};ie&&(he||y?r.replace(F.fullPath,Oe({scroll:y&&A&&A.scroll},Se)):r.push(F.fullPath,Se)),l.value=F,q(F,ae,ie,y),xe()}let W;function L(){W||(W=r.listen((F,ae,ie)=>{if(!ce.listening)return;const he=E(F),Se=R(he,ce.currentRoute.value);if(Se){v(Oe(Se,{replace:!0,force:!0}),he).catch(On);return}c=he;const b=l.value;Ws&&jp(Ho(b.fullPath,ie.delta),oi()),V(he,b).catch(y=>qt(y,Be.NAVIGATION_ABORTED|Be.NAVIGATION_CANCELLED)?y:qt(y,Be.NAVIGATION_GUARD_REDIRECT)?(v(Oe(x(y.to),{force:!0}),he).then(A=>{qt(A,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&!ie.delta&&ie.type===Qi.pop&&r.go(-1,!1)}).catch(On),Promise.reject()):(ie.delta&&r.go(-ie.delta,!1),Y(y,he,b))).then(y=>{y=y||$(he,b,!1),y&&(ie.delta&&!qt(y,Be.NAVIGATION_CANCELLED)?r.go(-ie.delta,!1):ie.type===Qi.pop&&qt(y,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),Z(he,b,y)}).catch(On)}))}let pe=gn(),M=gn(),z;function Y(F,ae,ie){xe(F);const he=M.list();return he.length?he.forEach(Se=>Se(F,ae,ie)):console.error(F),Promise.reject(F)}function ue(){return z&&l.value!==os?Promise.resolve():new Promise((F,ae)=>{pe.add([F,ae])})}function xe(F){return z||(z=!F,L(),pe.list().forEach(([ae,ie])=>F?ie(F):ae()),pe.reset()),F}function q(F,ae,ie,he){const{scrollBehavior:Se}=e;if(!Ws||!Se)return Promise.resolve();const b=!ie&&Dp(Ho(F.fullPath,0))||(he||!ie)&&history.state&&history.state.scroll||null;return Ns().then(()=>Se(F,ae,b)).then(y=>y&&Mp(y)).catch(y=>Y(y,F,ae))}const T=F=>r.go(F);let O;const X=new Set,ce={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:S,getRoutes:m,resolve:E,options:e,push:P,replace:N,go:T,back:()=>T(-1),forward:()=>T(1),beforeEach:i.add,beforeResolve:a.add,afterEach:o.add,onError:M.add,isReady:ue,install(F){F.component("RouterLink",sa),F.component("RouterView",wu),F.config.globalProperties.$router=ce,Object.defineProperty(F.config.globalProperties,"$route",{enumerable:!0,get:()=>Ie(l)}),Ws&&!O&&l.value===os&&(O=!0,P(r.location).catch(he=>{}));const ae={};for(const he in os)Object.defineProperty(ae,he,{get:()=>l.value[he],enumerable:!0});F.provide(li,ce),F.provide(Ma,pc(ae)),F.provide(ta,l);const ie=F.unmount;X.add(F),F.unmount=function(){X.delete(F),X.size<1&&(c=os,W&&W(),W=null,l.value=os,O=!1,z=!1),ie()}}};function Ue(F){return F.reduce((ae,ie)=>ae.then(()=>j(ie)),Promise.resolve())}return ce}function xu(){return vt(li)}function Eu(e){return vt(Ma)}const mg=["width","height","viewBox","innerHTML"],Re=pt({__name:"FluentIcon",props:{paths:{},size:{default:20},viewBox:{default:20}},setup(e){return(t,s)=>(_(),w("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.size,height:e.size,viewBox:`0 0 ${e.viewBox} ${e.viewBox}`,fill:"currentColor","aria-hidden":"true",innerHTML:e.paths},null,8,mg))}});function ci(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(s[n[r]]=e[n[r]]);return s}function bg(e,t,s,n){function r(i){return i instanceof s?i:new s(function(a){a(i)})}return new(s||(s=Promise))(function(i,a){function o(u){try{c(n.next(u))}catch(d){a(d)}}function l(u){try{c(n.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}const vg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class ja extends Error{constructor(t,s="FunctionsError",n){super(t),this.name=s,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class yg extends ja{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class el extends ja{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class tl extends ja{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var na;(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"})(na||(na={}));class _g{constructor(t,{headers:s={},customFetch:n,region:r=na.Any}={}){this.url=t,this.headers=s,this.region=r,this.fetch=vg(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return bg(this,arguments,void 0,function*(s,n={}){var r;let i,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=n;let h={},{region:f}=n;f||(f=this.region);const g=new URL(`${this.url}/${s}`);f&&f!=="any"&&(h["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let m;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(h["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(h["Content-Type"]="application/json",m=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?m=JSON.stringify(c):m=c;let S=u;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),u?(S=a.signal,u.addEventListener("abort",()=>a.abort())):S=a.signal);const E=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),o),body:m,signal:S}).catch(N=>{throw new yg(N)}),x=E.headers.get("x-relay-error");if(x&&x==="true")throw new el(E);if(!E.ok)throw new tl(E);let k=((r=E.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),P;return k==="application/json"?P=yield E.json():k==="application/octet-stream"||k==="application/pdf"?P=yield E.blob():k==="text/event-stream"?P=E:k==="multipart/form-data"?P=yield E.formData():P=yield E.text(),{data:P,error:null,response:E}}catch(o){return{data:null,error:o,response:o instanceof tl||o instanceof el?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const ku=3,sl=e=>Math.min(1e3*2**e,3e4),wg=[520,503],Su=["GET","HEAD","OPTIONS"];var xg=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 nl(e,t){return new Promise(s=>{if(t!=null&&t.aborted){s();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",r),s()},e);function r(){clearTimeout(n),s()}t==null||t.addEventListener("abort",r)})}function Eg(e,t,s,n){return!(!n||s>=ku||!Su.includes(e)||!wg.includes(t))}var kg=class{constructor(e){var t,s,n,r,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=(s=e.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=e.urlLengthLimit)!==null&&r!==void 0?r: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 s=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const c=new Headers(s.headers);a>0&&c.set("X-Retry-Count",String(a));let u;try{u=await n(s.url.toString(),{method:s.method,headers:c,body:JSON.stringify(s.body,(d,h)=>typeof h=="bigint"?h.toString():h),signal:s.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!Su.includes(s.method))throw d;if(s.retryEnabled&&a<ku){const h=sl(a);a++,await nl(h,s.signal);continue}throw d}if(Eg(s.method,u.status,a,s.retryEnabled)){var o,l;const d=(o=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&o!==void 0?o:null,h=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:sl(a);await u.text(),a++,await nl(h,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let l="",c="",u="";const d=a==null?void 0:a.cause;if(d){var h,f,g,m;const x=(h=d==null?void 0:d.message)!==null&&h!==void 0?h:"",k=(f=d==null?void 0:d.code)!==null&&f!==void 0?f:"";l=`${(g=a==null?void 0:a.name)!==null&&g!==void 0?g:"FetchError"}: ${a==null?void 0:a.message}`,l+=`
29
+ */let Kp=()=>location.protocol+"//"+location.host;function vu(e,t){const{pathname:s,search:n,hash:r}=t,i=e.indexOf("#");if(i>-1){let a=r.includes(e.slice(i))?e.slice(i).length:1,o=r.slice(a);return o[0]!=="/"&&(o="/"+o),Uo(o,"")}return Uo(s,e)+n+r}function Wp(e,t,s,n){let r=[],i=[],a=null;const o=({state:h})=>{const f=vu(e,location),g=s.value,b=t.value;let S=0;if(h){if(s.value=f,t.value=h,a&&a===g){a=null;return}S=b?h.position-b.position:0}else n(f);r.forEach(E=>{E(s.value,g,{delta:S,type:Qi.pop,direction:S?S>0?Ci.forward:Ci.back:Ci.unknown})})};function l(){a=s.value}function c(h){r.push(h);const f=()=>{const g=r.indexOf(h);g>-1&&r.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:h}=window;if(!h.state)return;h.replaceState(Oe({},h.state,{scroll:oi()}),"")}}function d(){for(const h of i)h();i=[],window.removeEventListener("popstate",o),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",o),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:d}}function qo(e,t,s,n=!1,r=!1){return{back:e,current:t,forward:s,replaced:n,position:window.history.length,scroll:r?oi():null}}function Gp(e){const{history:t,location:s}=window,n={value:vu(e,s)},r={value:t.state};r.value||i(n.value,{back:null,current:n.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const d=e.indexOf("#"),h=d>-1?(s.host&&document.querySelector("base")?e:e.slice(d))+l:Kp()+e+l;try{t[u?"replaceState":"pushState"](c,"",h),r.value=c}catch(f){console.error(f),s[u?"replace":"assign"](h)}}function a(l,c){i(l,Oe({},t.state,qo(r.value.back,l,r.value.forward,!0),c,{position:r.value.position}),!0),n.value=l}function o(l,c){const u=Oe({},r.value,t.state,{forward:l,scroll:oi()});i(u.current,u,!0),i(l,Oe({},qo(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:r,push:o,replace:a}}function Zp(e){e=Np(e);const t=Gp(e),s=Wp(e,t.state,t.location,t.replace);function n(i,a=!0){a||s.pauseListeners(),history.go(i)}const r=Oe({location:"",base:e,go:n,createHref:Pp.bind(null,e)},t,s);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let Os=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var We=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}(We||{});const Jp={type:Os.Static,value:""},Yp=/[a-zA-Z0-9_]/;function Xp(e){if(!e)return[[]];if(e==="/")return[[Jp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=We.Static,n=s;const r=[];let i;function a(){i&&r.push(i),i=[]}let o=0,l,c="",u="";function d(){c&&(s===We.Static?i.push({type:Os.Static,value:c}):s===We.Param||s===We.ParamRegExp||s===We.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Os.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;o<e.length;){if(l=e[o++],l==="\\"&&s!==We.ParamRegExp){n=s,s=We.EscapeNext;continue}switch(s){case We.Static:l==="/"?(c&&d(),a()):l===":"?(d(),s=We.Param):h();break;case We.EscapeNext:h(),s=n;break;case We.Param:l==="("?s=We.ParamRegExp:Yp.test(l)?h():(d(),s=We.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--);break;case We.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=We.ParamRegExpEnd:u+=l;break;case We.ParamRegExpEnd:d(),s=We.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--,u="";break;default:t("Unknown state");break}}return s===We.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),d(),a(),r}const zo="[^/]+?",Qp={sensitive:!1,strict:!1,start:!0,end:!0};var nt=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}(nt||{});const eg=/[.+*?^${}()[\]/\\]/g;function tg(e,t){const s=Oe({},Qp,t),n=[];let r=s.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[nt.Root];s.strict&&!c.length&&(r+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=nt.Segment+(s.sensitive?nt.BonusCaseSensitive:0);if(h.type===Os.Static)d||(r+="/"),r+=h.value.replace(eg,"\\$&"),f+=nt.Static;else if(h.type===Os.Param){const{value:g,repeatable:b,optional:S,regexp:E}=h;i.push({name:g,repeatable:b,optional:S});const x=E||zo;if(x!==zo){f+=nt.BonusCustomRegExp;try{`${x}`}catch(P){throw new Error(`Invalid custom RegExp for param "${g}" (${x}): `+P.message)}}let k=b?`((?:${x})(?:/(?:${x}))*)`:`(${x})`;d||(k=S&&c.length<2?`(?:/${k})`:"/"+k),S&&(k+="?"),r+=k,f+=nt.Dynamic,S&&(f+=nt.BonusOptional),b&&(f+=nt.BonusRepeatable),x===".*"&&(f+=nt.BonusWildcard)}u.push(f)}n.push(u)}if(s.strict&&s.end){const c=n.length-1;n[c][n[c].length-1]+=nt.BonusStrict}s.strict||(r+="/?"),s.end?r+="$":s.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const a=new RegExp(r,s.sensitive?"":"i");function o(c){const u=c.match(a),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",g=i[h-1];d[g.name]=f&&g.repeatable?f.split("/"):f}return d}function l(c){let u="",d=!1;for(const h of e){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===Os.Static)u+=f.value;else if(f.type===Os.Param){const{value:g,repeatable:b,optional:S}=f,E=g in c?c[g]:"";if(Rt(E)&&!b)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const x=Rt(E)?E.join("/"):E;if(!x)if(S)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${g}"`);u+=x}}return u||"/"}return{re:a,score:n,keys:i,parse:o,stringify:l}}function sg(e,t){let s=0;for(;s<e.length&&s<t.length;){const n=t[s]-e[s];if(n)return n;s++}return e.length<t.length?e.length===1&&e[0]===nt.Static+nt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===nt.Static+nt.Segment?1:-1:0}function yu(e,t){let s=0;const n=e.score,r=t.score;for(;s<n.length&&s<r.length;){const i=sg(n[s],r[s]);if(i)return i;s++}if(Math.abs(r.length-n.length)===1){if(Ko(n))return 1;if(Ko(r))return-1}return r.length-n.length}function Ko(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const ng={strict:!1,end:!0,sensitive:!1};function rg(e,t,s){const n=tg(Xp(e.path),s),r=Oe(n,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function ig(e,t){const s=[],n=new Map;t=Do(ng,t);function r(d){return n.get(d)}function i(d,h,f){const g=!f,b=Go(d);b.aliasOf=f&&f.record;const S=Do(t,d),E=[b];if("alias"in d){const P=typeof d.alias=="string"?[d.alias]:d.alias;for(const N of P)E.push(Go(Oe({},b,{components:f?f.record.components:b.components,path:N,aliasOf:f?f.record:b})))}let x,k;for(const P of E){const{path:N}=P;if(h&&N[0]!=="/"){const R=h.record.path,v=R[R.length-1]==="/"?"":"/";P.path=h.record.path+(N&&v+N)}if(x=rg(P,h,S),f?f.alias.push(x):(k=k||x,k!==x&&k.alias.push(x),g&&d.name&&!Zo(x)&&a(d.name)),_u(x)&&l(x),b.children){const R=b.children;for(let v=0;v<R.length;v++)i(R[v],x,f&&f.children[v])}f=f||x}return k?()=>{a(k)}:On}function a(d){if(mu(d)){const h=n.get(d);h&&(n.delete(d),s.splice(s.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=s.indexOf(d);h>-1&&(s.splice(h,1),d.record.name&&n.delete(d.record.name),d.children.forEach(a),d.alias.forEach(a))}}function o(){return s}function l(d){const h=lg(d,s);s.splice(h,0,d),d.record.name&&!Zo(d)&&n.set(d.record.name,d)}function c(d,h){let f,g={},b,S;if("name"in d&&d.name){if(f=n.get(d.name),!f)throw cn(Be.MATCHER_NOT_FOUND,{location:d});S=f.record.name,g=Oe(Wo(h.params,f.keys.filter(k=>!k.optional).concat(f.parent?f.parent.keys.filter(k=>k.optional):[]).map(k=>k.name)),d.params&&Wo(d.params,f.keys.map(k=>k.name))),b=f.stringify(g)}else if(d.path!=null)b=d.path,f=s.find(k=>k.re.test(b)),f&&(g=f.parse(b),S=f.record.name);else{if(f=h.name?n.get(h.name):s.find(k=>k.re.test(h.path)),!f)throw cn(Be.MATCHER_NOT_FOUND,{location:d,currentLocation:h});S=f.record.name,g=Oe({},h.params,d.params),b=f.stringify(g)}const E=[];let x=f;for(;x;)E.unshift(x.record),x=x.parent;return{name:S,path:b,params:g,matched:E,meta:og(E)}}e.forEach(d=>i(d));function u(){s.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:a,clearRoutes:u,getRoutes:o,getRecordMatcher:r}}function Wo(e,t){const s={};for(const n of t)n in e&&(s[n]=e[n]);return s}function Go(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ag(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 ag(e){const t={},s=e.props||!1;if("component"in e)t.default=s;else for(const n in e.components)t[n]=typeof s=="object"?s[n]:s;return t}function Zo(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function og(e){return e.reduce((t,s)=>Oe(t,s.meta),{})}function lg(e,t){let s=0,n=t.length;for(;s!==n;){const i=s+n>>1;yu(e,t[i])<0?n=i:s=i+1}const r=cg(e);return r&&(n=t.lastIndexOf(r,n-1)),n}function cg(e){let t=e;for(;t=t.parent;)if(_u(t)&&yu(e,t)===0)return t}function _u({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Jo(e){const t=vt(li),s=vt(Ma),n=je(()=>{const l=Ie(e.to);return t.resolve(l)}),r=je(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const h=d.findIndex(ln.bind(null,u));if(h>-1)return h;const f=Yo(l[c-2]);return c>1&&Yo(u)===f&&d[d.length-1].path!==f?d.findIndex(ln.bind(null,l[c-2])):h}),i=je(()=>r.value>-1&&fg(s.params,n.value.params)),a=je(()=>r.value>-1&&r.value===s.matched.length-1&&gu(s.params,n.value.params));function o(l={}){if(hg(l)){const c=t[Ie(e.replace)?"replace":"push"](Ie(e.to)).catch(On);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:je(()=>n.value.href),isActive:i,isExactActive:a,navigate:o}}function ug(e){return e.length===1?e[0]:e}const dg=pt({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:Jo,setup(e,{slots:t}){const s=Xt(Jo(e)),{options:n}=vt(li),r=je(()=>({[Xo(e.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Xo(e.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=t.default&&ug(t.default(s));return e.custom?i:Pa("a",{"aria-current":s.isExactActive?e.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:r.value},i)}}}),sa=dg;function hg(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 fg(e,t){for(const s in t){const n=t[s],r=e[s];if(typeof n=="string"){if(n!==r)return!1}else if(!Rt(r)||r.length!==n.length||n.some((i,a)=>i.valueOf()!==r[a].valueOf()))return!1}return!0}function Yo(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xo=(e,t,s)=>e??t??s,pg=pt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:s}){const n=vt(ta),r=je(()=>e.route||n.value),i=vt(Vo,0),a=je(()=>{let c=Ie(i);const{matched:u}=r.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),o=je(()=>r.value.matched[a.value]);wr(Vo,je(()=>a.value+1)),wr(qp,o),wr(ta,r);const l=Q();return es(()=>[l.value,o.value,e.name],([c,u,d],[h,f,g])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!ln(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(b=>b(c))},{flush:"post"}),()=>{const c=r.value,u=e.name,d=o.value,h=d&&d.components[u];if(!h)return Qo(s.default,{Component:h,route:c});const f=d.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,S=Pa(h,Oe({},g,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Qo(s.default,{Component:S,route:c})||S}}});function Qo(e,t){if(!e)return null;const s=e(t);return s.length===1?s[0]:s}const wu=pg;function gg(e){const t=ig(e.routes,e),s=e.parseQuery||Fp,n=e.stringifyQuery||Fo,r=e.history,i=gn(),a=gn(),o=gn(),l=th(os);let c=os;Gs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ai.bind(null,F=>""+F),d=Ai.bind(null,Sp),h=Ai.bind(null,Hn);function f(F,ae){let ie,he;return mu(F)?(ie=t.getRecordMatcher(F),he=ae):he=F,t.addRoute(he,ie)}function g(F){const ae=t.getRecordMatcher(F);ae&&t.removeRoute(ae)}function b(){return t.getRoutes().map(F=>F.record)}function S(F){return!!t.getRecordMatcher(F)}function E(F,ae){if(ae=Oe({},ae||l.value),typeof F=="string"){const A=Ri(s,F,ae.path),D=t.resolve({path:A.path},ae),K=r.createHref(A.fullPath);return Oe(A,D,{params:h(D.params),hash:Hn(A.hash),redirectedFrom:void 0,href:K})}let ie;if(F.path!=null)ie=Oe({},F,{path:Ri(s,F.path,ae.path).path});else{const A=Oe({},F.params);for(const D in A)A[D]==null&&delete A[D];ie=Oe({},F,{params:d(A)}),ae.params=d(ae.params)}const he=t.resolve(ie,ae),Se=F.hash||"";he.params=u(h(he.params));const m=Rp(n,Oe({},F,{hash:xp(Se),path:he.path})),y=r.createHref(m);return Oe({fullPath:m,hash:Se,query:n===Fo?Vp(F.query):F.query||{}},he,{redirectedFrom:void 0,href:y})}function x(F){return typeof F=="string"?Ri(s,F,l.value.path):Oe({},F)}function k(F,ae){if(c!==F)return cn(Be.NAVIGATION_CANCELLED,{from:ae,to:F})}function P(F){return v(F)}function N(F){return P(Oe(x(F),{replace:!0}))}function R(F,ae){const ie=F.matched[F.matched.length-1];if(ie&&ie.redirect){const{redirect:he}=ie;let Se=typeof he=="function"?he(F,ae):he;return typeof Se=="string"&&(Se=Se.includes("?")||Se.includes("#")?Se=x(Se):{path:Se},Se.params={}),Oe({query:F.query,hash:F.hash,params:Se.path!=null?{}:F.params},Se)}}function v(F,ae){const ie=c=E(F),he=l.value,Se=F.state,m=F.force,y=F.replace===!0,A=R(ie,he);if(A)return v(Oe(x(A),{state:typeof A=="object"?Oe({},Se,A.state):Se,force:m,replace:y}),ae||ie);const D=ie;D.redirectedFrom=ae;let K;return!m&&Cp(n,he,ie)&&(K=cn(Be.NAVIGATION_DUPLICATED,{to:D,from:he}),q(he,he,!0,!1)),(K?Promise.resolve(K):V(D,he)).catch(B=>qt(B)?qt(B,Be.NAVIGATION_GUARD_REDIRECT)?B:xe(B):Y(B,D,he)).then(B=>{if(B){if(qt(B,Be.NAVIGATION_GUARD_REDIRECT))return v(Oe({replace:y},x(B.to),{state:typeof B.to=="object"?Oe({},Se,B.to.state):Se,force:m}),ae||D)}else B=$(D,he,!0,y,Se);return Z(D,he,B),B})}function C(F,ae){const ie=k(F,ae);return ie?Promise.reject(ie):Promise.resolve()}function j(F){const ae=X.values().next().value;return ae&&typeof ae.runWithContext=="function"?ae.runWithContext(F):F()}function V(F,ae){let ie;const[he,Se,m]=zp(F,ae);ie=Oi(he.reverse(),"beforeRouteLeave",F,ae);for(const A of he)A.leaveGuards.forEach(D=>{ie.push(ds(D,F,ae))});const y=C.bind(null,F,ae);return ie.push(y),Ue(ie).then(()=>{ie=[];for(const A of i.list())ie.push(ds(A,F,ae));return ie.push(y),Ue(ie)}).then(()=>{ie=Oi(Se,"beforeRouteUpdate",F,ae);for(const A of Se)A.updateGuards.forEach(D=>{ie.push(ds(D,F,ae))});return ie.push(y),Ue(ie)}).then(()=>{ie=[];for(const A of m)if(A.beforeEnter)if(Rt(A.beforeEnter))for(const D of A.beforeEnter)ie.push(ds(D,F,ae));else ie.push(ds(A.beforeEnter,F,ae));return ie.push(y),Ue(ie)}).then(()=>(F.matched.forEach(A=>A.enterCallbacks={}),ie=Oi(m,"beforeRouteEnter",F,ae,j),ie.push(y),Ue(ie))).then(()=>{ie=[];for(const A of a.list())ie.push(ds(A,F,ae));return ie.push(y),Ue(ie)}).catch(A=>qt(A,Be.NAVIGATION_CANCELLED)?A:Promise.reject(A))}function Z(F,ae,ie){o.list().forEach(he=>j(()=>he(F,ae,ie)))}function $(F,ae,ie,he,Se){const m=k(F,ae);if(m)return m;const y=ae===os,A=Gs?history.state:{};ie&&(he||y?r.replace(F.fullPath,Oe({scroll:y&&A&&A.scroll},Se)):r.push(F.fullPath,Se)),l.value=F,q(F,ae,ie,y),xe()}let W;function L(){W||(W=r.listen((F,ae,ie)=>{if(!ce.listening)return;const he=E(F),Se=R(he,ce.currentRoute.value);if(Se){v(Oe(Se,{replace:!0,force:!0}),he).catch(On);return}c=he;const m=l.value;Gs&&jp(Ho(m.fullPath,ie.delta),oi()),V(he,m).catch(y=>qt(y,Be.NAVIGATION_ABORTED|Be.NAVIGATION_CANCELLED)?y:qt(y,Be.NAVIGATION_GUARD_REDIRECT)?(v(Oe(x(y.to),{force:!0}),he).then(A=>{qt(A,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&!ie.delta&&ie.type===Qi.pop&&r.go(-1,!1)}).catch(On),Promise.reject()):(ie.delta&&r.go(-ie.delta,!1),Y(y,he,m))).then(y=>{y=y||$(he,m,!1),y&&(ie.delta&&!qt(y,Be.NAVIGATION_CANCELLED)?r.go(-ie.delta,!1):ie.type===Qi.pop&&qt(y,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),Z(he,m,y)}).catch(On)}))}let pe=gn(),M=gn(),z;function Y(F,ae,ie){xe(F);const he=M.list();return he.length?he.forEach(Se=>Se(F,ae,ie)):console.error(F),Promise.reject(F)}function ue(){return z&&l.value!==os?Promise.resolve():new Promise((F,ae)=>{pe.add([F,ae])})}function xe(F){return z||(z=!F,L(),pe.list().forEach(([ae,ie])=>F?ie(F):ae()),pe.reset()),F}function q(F,ae,ie,he){const{scrollBehavior:Se}=e;if(!Gs||!Se)return Promise.resolve();const m=!ie&&Dp(Ho(F.fullPath,0))||(he||!ie)&&history.state&&history.state.scroll||null;return Is().then(()=>Se(F,ae,m)).then(y=>y&&Mp(y)).catch(y=>Y(y,F,ae))}const T=F=>r.go(F);let O;const X=new Set,ce={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:S,getRoutes:b,resolve:E,options:e,push:P,replace:N,go:T,back:()=>T(-1),forward:()=>T(1),beforeEach:i.add,beforeResolve:a.add,afterEach:o.add,onError:M.add,isReady:ue,install(F){F.component("RouterLink",sa),F.component("RouterView",wu),F.config.globalProperties.$router=ce,Object.defineProperty(F.config.globalProperties,"$route",{enumerable:!0,get:()=>Ie(l)}),Gs&&!O&&l.value===os&&(O=!0,P(r.location).catch(he=>{}));const ae={};for(const he in os)Object.defineProperty(ae,he,{get:()=>l.value[he],enumerable:!0});F.provide(li,ce),F.provide(Ma,pc(ae)),F.provide(ta,l);const ie=F.unmount;X.add(F),F.unmount=function(){X.delete(F),X.size<1&&(c=os,W&&W(),W=null,l.value=os,O=!1,z=!1),ie()}}};function Ue(F){return F.reduce((ae,ie)=>ae.then(()=>j(ie)),Promise.resolve())}return ce}function xu(){return vt(li)}function Eu(e){return vt(Ma)}const mg=["width","height","viewBox","innerHTML"],Re=pt({__name:"FluentIcon",props:{paths:{},size:{default:20},viewBox:{default:20}},setup(e){return(t,s)=>(_(),w("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.size,height:e.size,viewBox:`0 0 ${e.viewBox} ${e.viewBox}`,fill:"currentColor","aria-hidden":"true",innerHTML:e.paths},null,8,mg))}});function ci(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(s[n[r]]=e[n[r]]);return s}function bg(e,t,s,n){function r(i){return i instanceof s?i:new s(function(a){a(i)})}return new(s||(s=Promise))(function(i,a){function o(u){try{c(n.next(u))}catch(d){a(d)}}function l(u){try{c(n.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}const vg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class ja extends Error{constructor(t,s="FunctionsError",n){super(t),this.name=s,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class yg extends ja{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class el extends ja{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class tl extends ja{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var na;(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"})(na||(na={}));class _g{constructor(t,{headers:s={},customFetch:n,region:r=na.Any}={}){this.url=t,this.headers=s,this.region=r,this.fetch=vg(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return bg(this,arguments,void 0,function*(s,n={}){var r;let i,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=n;let h={},{region:f}=n;f||(f=this.region);const g=new URL(`${this.url}/${s}`);f&&f!=="any"&&(h["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let b;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",b=c):typeof c=="string"?(h["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(h["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 S=u;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),u?(S=a.signal,u.addEventListener("abort",()=>a.abort())):S=a.signal);const E=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),o),body:b,signal:S}).catch(N=>{throw new yg(N)}),x=E.headers.get("x-relay-error");if(x&&x==="true")throw new el(E);if(!E.ok)throw new tl(E);let k=((r=E.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),P;return k==="application/json"?P=yield E.json():k==="application/octet-stream"||k==="application/pdf"?P=yield E.blob():k==="text/event-stream"?P=E:k==="multipart/form-data"?P=yield E.formData():P=yield E.text(),{data:P,error:null,response:E}}catch(o){return{data:null,error:o,response:o instanceof tl||o instanceof el?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const ku=3,sl=e=>Math.min(1e3*2**e,3e4),wg=[520,503],Su=["GET","HEAD","OPTIONS"];var xg=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 nl(e,t){return new Promise(s=>{if(t!=null&&t.aborted){s();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",r),s()},e);function r(){clearTimeout(n),s()}t==null||t.addEventListener("abort",r)})}function Eg(e,t,s,n){return!(!n||s>=ku||!Su.includes(e)||!wg.includes(t))}var kg=class{constructor(e){var t,s,n,r,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=(s=e.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=e.urlLengthLimit)!==null&&r!==void 0?r: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 s=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const c=new Headers(s.headers);a>0&&c.set("X-Retry-Count",String(a));let u;try{u=await n(s.url.toString(),{method:s.method,headers:c,body:JSON.stringify(s.body,(d,h)=>typeof h=="bigint"?h.toString():h),signal:s.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!Su.includes(s.method))throw d;if(s.retryEnabled&&a<ku){const h=sl(a);a++,await nl(h,s.signal);continue}throw d}if(Eg(s.method,u.status,a,s.retryEnabled)){var o,l;const d=(o=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&o!==void 0?o:null,h=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:sl(a);await u.text(),a++,await nl(h,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let l="",c="",u="";const d=a==null?void 0:a.cause;if(d){var h,f,g,b;const x=(h=d==null?void 0:d.message)!==null&&h!==void 0?h:"",k=(f=d==null?void 0:d.code)!==null&&f!==void 0?f:"";l=`${(g=a==null?void 0:a.name)!==null&&g!==void 0?g:"FetchError"}: ${a==null?void 0:a.message}`,l+=`
30
30
 
31
- Caused by: ${(m=d==null?void 0:d.name)!==null&&m!==void 0?m:"Error"}: ${x}`,k&&(l+=` (${k})`),d!=null&&d.stack&&(l+=`
32
- ${d.stack}`)}else{var S;l=(S=a==null?void 0:a.stack)!==null&&S!==void 0?S:""}const E=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.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 s=null,n=null,r=null,i=e.status,a=e.statusText;if(e.ok){var o,l;if(t.method!=="HEAD"){var c;const h=await e.text();h===""||(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"))?n=h:n=JSON.parse(h))}const u=(o=t.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),d=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(r=parseInt(d[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(s={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,r=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await e.text();try{s=JSON.parse(u),Array.isArray(s)&&e.status===404&&(n=[],s=null,i=200,a="OK")}catch{e.status===404&&u===""?(i=204,a="No Content"):s={message:u}}if(s&&t.shouldThrowOnError)throw new xg(s)}return{success:s===null,error:s,data:n,count:r,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},Sg=class extends kg{select(e){let t=!1;const s=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:n,referencedTable:r=n}={}){const i=r?`${r}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:n=s}={}){const r=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${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:s=!1,buffers:n=!1,wal:r=!1,format:i="text"}={}){var a;const o=[e?"analyze":null,t?"verbose":null,s?"settings":null,n?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const rl=new RegExp("[,()]");var Gs=class extends Sg{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 s=Array.from(new Set(t)).map(n=>typeof n=="string"&&rl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}notIn(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&rl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${s})`),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:s,type:n}={}){let r="";n==="plain"?r="pl":n==="phrase"?r="ph":n==="websearch"&&(r="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${r}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,s])=>s!==void 0).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}},Tg=class{constructor(e,{headers:t={},schema:s,fetch:n,urlLengthLimit:r=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=s,this.fetch=n,this.urlLengthLimit=r,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:s=!1,count:n}=t??{},r=s?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",a),n&&l.append("Prefer",`count=${n}`),new Gs({method:r,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:s=!0}={}){var n;const r="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),s||a.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Gs({method:r,url:i,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:n,defaultToNull:r=!0}={}){var i;const a="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&l.append("Prefer",`count=${n}`),r||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new Gs({method:a,url:o,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 s;const n="PATCH",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Gs({method:n,url:r,headers:i,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const s="DELETE",{url:n,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new Gs({method:s,url:n,headers:r,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fn(e){"@babel/helpers - typeof";return Fn=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},Fn(e)}function Ag(e,t){if(Fn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Fn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rg(e){var t=Ag(e,"string");return Fn(t)=="symbol"?t:t+""}function Cg(e,t,s){return(t=Rg(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function il(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function cr(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?il(Object(s),!0).forEach(function(n){Cg(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):il(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var Og=class Tu{constructor(t,{headers:s={},schema:n,fetch:r,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=t,this.headers=new Headers(s),this.schemaName=n,this.urlLengthLimit=a;const l=r??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const d=new AbortController,h=setTimeout(()=>d.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(h),l(c,u);const g=()=>{clearTimeout(h),d.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(h),f.removeEventListener("abort",g)})}return l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>clearTimeout(h))}:this.fetch=l,this.retry=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Tg(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 Tu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,s={},{head:n=!1,get:r=!1,count:i}={}){var a;let o;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),d=n&&Object.values(s).some(u);d?(o="POST",c=s):n||r?(o=n?"HEAD":"GET",Object.entries(s).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(o="POST",c=s);const h=new Headers(this.headers);return d?h.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&h.set("Prefer",`count=${i}`),new Gs({method:o,url:l,headers:h,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class $g{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof s.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"&&s.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 r=globalThis.process;if(r){const i=r.versions;if(i&&i.node){const a=i.node,o=parseInt(a.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
31
+ Caused by: ${(b=d==null?void 0:d.name)!==null&&b!==void 0?b:"Error"}: ${x}`,k&&(l+=` (${k})`),d!=null&&d.stack&&(l+=`
32
+ ${d.stack}`)}else{var S;l=(S=a==null?void 0:a.stack)!==null&&S!==void 0?S:""}const E=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.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 s=null,n=null,r=null,i=e.status,a=e.statusText;if(e.ok){var o,l;if(t.method!=="HEAD"){var c;const h=await e.text();h===""||(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"))?n=h:n=JSON.parse(h))}const u=(o=t.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),d=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(r=parseInt(d[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(s={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,r=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await e.text();try{s=JSON.parse(u),Array.isArray(s)&&e.status===404&&(n=[],s=null,i=200,a="OK")}catch{e.status===404&&u===""?(i=204,a="No Content"):s={message:u}}if(s&&t.shouldThrowOnError)throw new xg(s)}return{success:s===null,error:s,data:n,count:r,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},Sg=class extends kg{select(e){let t=!1;const s=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:n,referencedTable:r=n}={}){const i=r?`${r}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:n=s}={}){const r=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${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:s=!1,buffers:n=!1,wal:r=!1,format:i="text"}={}){var a;const o=[e?"analyze":null,t?"verbose":null,s?"settings":null,n?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const rl=new RegExp("[,()]");var Zs=class extends Sg{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 s=Array.from(new Set(t)).map(n=>typeof n=="string"&&rl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}notIn(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&rl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${s})`),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:s,type:n}={}){let r="";n==="plain"?r="pl":n==="phrase"?r="ph":n==="websearch"&&(r="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${r}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,s])=>s!==void 0).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}},Tg=class{constructor(e,{headers:t={},schema:s,fetch:n,urlLengthLimit:r=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=s,this.fetch=n,this.urlLengthLimit=r,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:s=!1,count:n}=t??{},r=s?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",a),n&&l.append("Prefer",`count=${n}`),new Zs({method:r,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:s=!0}={}){var n;const r="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),s||a.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Zs({method:r,url:i,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:n,defaultToNull:r=!0}={}){var i;const a="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&l.append("Prefer",`count=${n}`),r||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new Zs({method:a,url:o,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 s;const n="PATCH",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Zs({method:n,url:r,headers:i,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const s="DELETE",{url:n,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new Zs({method:s,url:n,headers:r,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fn(e){"@babel/helpers - typeof";return Fn=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},Fn(e)}function Ag(e,t){if(Fn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Fn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rg(e){var t=Ag(e,"string");return Fn(t)=="symbol"?t:t+""}function Cg(e,t,s){return(t=Rg(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function il(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function cr(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?il(Object(s),!0).forEach(function(n){Cg(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):il(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var Og=class Tu{constructor(t,{headers:s={},schema:n,fetch:r,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=t,this.headers=new Headers(s),this.schemaName=n,this.urlLengthLimit=a;const l=r??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const d=new AbortController,h=setTimeout(()=>d.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(h),l(c,u);const g=()=>{clearTimeout(h),d.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(h),f.removeEventListener("abort",g)})}return l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>clearTimeout(h))}:this.fetch=l,this.retry=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Tg(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 Tu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,s={},{head:n=!1,get:r=!1,count:i}={}){var a;let o;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),d=n&&Object.values(s).some(u);d?(o="POST",c=s):n||r?(o=n?"HEAD":"GET",Object.entries(s).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(o="POST",c=s);const h=new Headers(this.headers);return d?h.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&h.set("Prefer",`count=${i}`),new Zs({method:o,url:l,headers:h,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class $g{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof s.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"&&s.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 r=globalThis.process;if(r){const i=r.versions;if(i&&i.node){const a=i.node,o=parseInt(a.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
33
33
  import ws from "ws"
34
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 s=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(s+=`
35
35
 
36
- Suggested solution: ${t.workaround}`),new Error(s)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Ng="2.105.4",Ig=`realtime-js/${Ng}`,Pg="1.0.0",Au="2.0.0",Lg=Au,Mg=1e4,jg=100,hs={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ru={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ra={connecting:"connecting",closing:"closing",closed:"closed"};class Dg{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,s){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return s(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var s;return this._isArrayBuffer((s=t.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,s,n){var r,i;const a=t.topic,o=(r=t.ref)!==null&&r!==void 0?r:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+d.length,f=new ArrayBuffer(this.HEADER_LENGTH+h);let g=new DataView(f),m=0;g.setUint8(m++,this.KINDS.userBroadcastPush),g.setUint8(m++,l.length),g.setUint8(m++,o.length),g.setUint8(m++,a.length),g.setUint8(m++,c.length),g.setUint8(m++,d.length),g.setUint8(m++,s),Array.from(l,E=>g.setUint8(m++,E.charCodeAt(0))),Array.from(o,E=>g.setUint8(m++,E.charCodeAt(0))),Array.from(a,E=>g.setUint8(m++,E.charCodeAt(0))),Array.from(c,E=>g.setUint8(m++,E.charCodeAt(0))),Array.from(d,E=>g.setUint8(m++,E.charCodeAt(0)));var S=new Uint8Array(f.byteLength+n.byteLength);return S.set(new Uint8Array(f),0),S.set(new Uint8Array(n),f.byteLength),S.buffer}decode(t,s){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return s(n)}if(typeof t=="string"){const n=JSON.parse(t),[r,i,a,o,l]=n;return s({join_ref:r,ref:i,topic:a,event:o,payload:l})}return s({})}_binaryDecode(t){const s=new DataView(t),n=s.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,s,r)}}_decodeUserBroadcast(t,s,n){const r=s.getUint8(1),i=s.getUint8(2),a=s.getUint8(3),o=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(t.slice(l,l+r));l=l+r;const u=n.decode(t.slice(l,l+i));l=l+i;const d=n.decode(t.slice(l,l+a));l=l+a;const h=t.slice(l,t.byteLength),f=o===this.JSON_ENCODING?JSON.parse(n.decode(h)):h,g={type:this.BROADCAST_EVENT,event:u,payload:f};return a>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var s;return t instanceof ArrayBuffer||((s=t==null?void 0:t.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(t,s){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>s.includes(n)))}}var Le;(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"})(Le||(Le={}));const al=(e,t,s={})=>{var n;const r=(n=s.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,a)=>(i[a]=Ug(a,e,t,r),i),{}):{}},Ug=(e,t,s,n)=>{const r=t.find(o=>o.name===e),i=r==null?void 0:r.type,a=s[e];return i&&!n.includes(i)?Cu(i,a):ia(a)},Cu=(e,t)=>{if(e.charAt(0)==="_"){const s=e.slice(1,e.length);return Vg(t,s)}switch(e){case Le.bool:return Bg(t);case Le.float4:case Le.float8:case Le.int2:case Le.int4:case Le.int8:case Le.numeric:case Le.oid:return Hg(t);case Le.json:case Le.jsonb:return Fg(t);case Le.timestamp:return qg(t);case Le.abstime:case Le.date:case Le.daterange:case Le.int4range:case Le.int8range:case Le.money:case Le.reltime:case Le.text:case Le.time:case Le.timestamptz:case Le.timetz:case Le.tsrange:case Le.tstzrange:return ia(t);default:return ia(t)}},ia=e=>e,Bg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Hg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Fg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Vg=(e,t)=>{if(typeof e!="string")return e;const s=e.length-1,n=e[s];if(e[0]==="{"&&n==="}"){let i;const a=e.slice(1,s);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>Cu(t,o))}return e},qg=e=>typeof e=="string"?e.replace(" ","T"):e,Ou=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 $n=e=>typeof e=="function"?e:function(){return e},zg=typeof self<"u"?self:null,Zs=typeof window<"u"?window:null,Pt=zg||Zs||globalThis,Kg="2.0.0",Wg=1e4,Gg=1e3,Dt={connecting:0,open:1,closing:2,closed:3},ot={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Wt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},aa={longpoll:"longpoll",websocket:"websocket"},Zg={complete:4},oa="base64url.bearer.phx.",ur=class{constructor(e,t,s,n){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},$u=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))}},Jg=class{constructor(e,t,s){this.state=ot.closed,this.topic=e,this.params=$n(t||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ur(this,Wt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new $u(()=>{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=ot.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=ot.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ot.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=ot.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 ur(this,Wt.leave,$n({}),this.timeout).send(),this.state=ot.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Wt.reply,(n,r)=>{this.trigger(this.replyEventName(r),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ot.closed,this.bindings=[]}onClose(e){this.on(Wt.close,e)}onError(e){return this.on(Wt.error,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(typeof t>"u"||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new ur(this,e,function(){return t},s);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ot.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Wt.close,"leave")},s=new ur(this,Wt.leave,$n({}),e);return s.receive("ok",()=>t()).receive("timeout",()=>t()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ot.joining,this.joinPush.resend(e))}trigger(e,t,s,n){let r=this.onMessage(e,t,s,n);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,s));for(let a=0;a<i.length;a++)i[a].callback(r,s,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===ot.closed}isErrored(){return this.state===ot.errored}isJoined(){return this.state===ot.joined}isJoining(){return this.state===ot.joining}isLeaving(){return this.state===ot.leaving}},Lr=class{static request(e,t,s,n,r,i,a){if(Pt.XDomainRequest){let o=new Pt.XDomainRequest;return this.xdomainRequest(o,e,t,n,r,i,a)}else if(Pt.XMLHttpRequest){let o=new Pt.XMLHttpRequest;return this.xhrRequest(o,e,t,s,n,r,i,a)}else{if(Pt.fetch&&Pt.AbortController)return this.fetchRequest(e,t,s,n,r,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,s,n,r,i,a){let o={method:e,headers:s,body:n},l=null;return r&&(l=new AbortController,setTimeout(()=>l.abort(),r),o.signal=l.signal),Pt.fetch(t,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&i?i():a&&a(null)}),l}static xdomainRequest(e,t,s,n,r,i,a){return e.timeout=r,e.open(t,s),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,s,n,r,i,a,o){e.open(t,s,!0),e.timeout=i;for(let[l,c]of Object.entries(n))e.setRequestHeader(l,c);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Zg.complete&&o){let l=this.parseJSON(e.responseText);o(l)}},a&&(e.ontimeout=a),e.send(r),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 s=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?s.push(this.serialize(i,r)):s.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return s.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},Yg=e=>{let t="",s=new Uint8Array(e),n=s.byteLength;for(let r=0;r<n;r++)t+=String.fromCharCode(s[r]);return btoa(t)},Bs=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(oa)&&(this.authToken=atob(t[1].slice(oa.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=Dt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+aa.websocket),"$1/"+aa.longpoll)}endpointURL(){return Lr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=Dt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Dt.open||this.readyState===Dt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:s,token:n,messages:r}=t;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else s=0;switch(s){case 200:r.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Dt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(e){typeof e!="string"&&(e=Yg(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,s){for(let r of this.reqs)r.abort();this.readyState=Dt.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,s,n,r){let i,a=()=>{this.reqs.delete(i),n()};i=Lr.request(e,this.endpointURL(),t,s,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&r(o)}),this.reqs.add(i)}},Xg=class _n{constructor(t,s={}){let n=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=_n.syncState(this.state,r,i,a),this.pendingDiffs.forEach(l=>{this.state=_n.syncDiff(this.state,l,i,a)}),this.pendingDiffs=[],o()}),this.channel.on(n.diff,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=_n.syncDiff(this.state,r,i,a),o())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return _n.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,s,n,r){let i=this.clone(t),a={},o={};return this.map(i,(l,c)=>{s[l]||(o[l]=c)}),this.map(s,(l,c)=>{let u=i[l];if(u){let d=c.metas.map(m=>m.phx_ref),h=u.metas.map(m=>m.phx_ref),f=c.metas.filter(m=>h.indexOf(m.phx_ref)<0),g=u.metas.filter(m=>d.indexOf(m.phx_ref)<0);f.length>0&&(a[l]=c,a[l].metas=f),g.length>0&&(o[l]=this.clone(u),o[l].metas=g)}else a[l]=c}),this.syncDiff(i,{joins:a,leaves:o},n,r)}static syncDiff(t,s,n,r){let{joins:i,leaves:a}=this.clone(s);return n||(n=function(){}),r||(r=function(){}),this.map(i,(o,l)=>{let c=t[o];if(t[o]=this.clone(l),c){let u=t[o].metas.map(h=>h.phx_ref),d=c.metas.filter(h=>u.indexOf(h.phx_ref)<0);t[o].metas.unshift(...d)}n(o,c,l)}),this.map(a,(o,l)=>{let c=t[o];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),r(o,c,l),c.metas.length===0&&delete t[o]}),t}static list(t,s){return s||(s=function(n,r){return r}),this.map(t,(n,r)=>s(n,r))}static map(t,s){return Object.getOwnPropertyNames(t).map(n=>s(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},dr={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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,n,r,i,a]=JSON.parse(e);return t({join_ref:s,ref:n,topic:r,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:s,event:n,topic:r,payload:i}=e,a=this.META_LENGTH+t.length+s.length+r.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),Array.from(t,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(s,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(o.byteLength+i.byteLength);return u.set(new Uint8Array(o),0),u.set(new Uint8Array(i),o.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=s.decode(e.slice(a,a+n));a=a+n;let l=s.decode(e.slice(a,a+r));a=a+r;let c=s.decode(e.slice(a,a+i));a=a+i;let u=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(o,o+n));o=o+n;let c=s.decode(e.slice(o,o+r));o=o+r;let u=s.decode(e.slice(o,o+i));o=o+i;let d=s.decode(e.slice(o,o+a));o=o+a;let h=e.slice(o,e.byteLength),f={status:d,response:h};return{join_ref:l,ref:c,topic:u,event:Wt.reply,payload:f}},decodeBroadcast(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=this.HEADER_LENGTH+2,a=s.decode(e.slice(i,i+n));i=i+n;let o=s.decode(e.slice(i,i+r));i=i+r;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:l}}},Qg=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Wg,this.transport=t.transport||Pt.WebSocket||Bs,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=Pt&&Pt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=dr.encode.bind(dr),this.defaultDecoder=dr.decode.bind(dr),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!==Bs?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Zs&&Zs.addEventListener&&(Zs.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Zs.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Zs.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=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,i,a)=>{console.log(`${r}: ${i}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=$n(t.params||{}),this.endPoint=`${e}/${aa.websocket}`,this.vsn=t.vsn||Kg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new $u(()=>{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 Bs}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=Lr.appendParams(Lr.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,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=$n(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Bs?this.connectWithFallback(Bs,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}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(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(r=>{r.ref===t&&(this.off([n]),e(Date.now()-s))});return!0}transportName(e){switch(e){case Bs:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${oa}${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 s=!1,n=!0,r,i,a=this.transportName(e),o=l=>{this.log("transport",`falling back to ${a}...`,l),this.off([r,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(l=>{this.log("transport","error",l),n&&!s&&(clearTimeout(this.fallbackTimer),o(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!n){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(o,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(),Gg,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,s||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){if(s===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s)}waitForSocketClosed(e,t,s=1){if(s===5||e.readyState===Dt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s)}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,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Wt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Dt.connecting:return"connecting";case Dt.open:return"open";case Dt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(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(([s])=>e.indexOf(s)===-1)}channel(e,t={}){let s=new Jg(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:n,ref:r,join_ref:i}=e;this.log("push",`${t} ${s} (${i}, ${r})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:n,payload:r,ref:i,join_ref:a}=t;if(i&&i===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status==="ok"?"ok":"error",o)}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",`${r.status||""} ${s} ${n} ${i&&"("+i+")"||""}`.trim(),r);for(let o=0;o<this.channels.length;o++){const l=this.channels[o];l.isMember(s,n,r,a)&&l.trigger(n,r,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([s,n])=>{try{n(...t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Nn{constructor(t,s){const n=t0(s);this.presence=new Xg(t.getChannel(),n),this.presence.onJoin((r,i,a)=>{const o=Nn.onJoinPayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((r,i,a)=>{const o=Nn.onLeavePayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Nn.transformState(this.presence.state)}static transformState(t){return t=e0(t),Object.getOwnPropertyNames(t).reduce((s,n)=>{const r=t[n];return s[n]=kr(r),s},{})}static onJoinPayload(t,s,n){const r=ol(s),i=kr(n);return{event:"join",key:t,currentPresences:r,newPresences:i}}static onLeavePayload(t,s,n){const r=ol(s),i=kr(n);return{event:"leave",key:t,currentPresences:r,leftPresences:i}}}function kr(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function e0(e){return JSON.parse(JSON.stringify(e))}function t0(e){return(e==null?void 0:e.events)&&{events:e.events}}function ol(e){return e!=null&&e.metas?kr(e):[]}var ll;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(ll||(ll={}));class s0{get state(){return this.presenceAdapter.state}constructor(t,s){this.channel=t,this.presenceAdapter=new Nn(this.channel.channelAdapter,s)}}function n0(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 s=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${s}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class r0{constructor(t,s,n){const r=i0(n);this.channel=t.getSocket().channel(s,r),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,s){return this.channel.on(t,s)}off(t,s){this.channel.off(t,s)}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,s,n){let r;try{r=this.channel.push(t,s,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>jg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return r}updateJoinPayload(t){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),t)}canPush(){return this.socket.isConnected()&&this.state===hs.joined}isJoined(){return this.state===hs.joined}isJoining(){return this.state===hs.joining}isClosed(){return this.state===hs.closed}isLeaving(){return this.state===hs.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function i0(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var cl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(cl||(cl={}));var Xs;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Xs||(Xs={}));var Gt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Gt||(Gt={}));class In{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,s={config:{}},n){var r,i;if(this.topic=t,this.params=s,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new r0(this.socket.socketAdapter,t,this.params),this.presence=new s0(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Ou(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(r=this.params.config)===null||r===void 0?void 0:r.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,s=this.timeout){var n,r,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(r=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&r!==void 0?r:[],u=!!this.bindings[Xs.PRESENCE]&&this.bindings[Xs.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},h={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>{t==null||t(Gt.CHANNEL_ERROR,n0(f))}),this._onClose(()=>t==null?void 0:t(Gt.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(Gt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=hs.errored;const g=Object.values(f).join(", ")||"error";t==null||t(Gt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{t==null||t(Gt.TIMED_OUT)})}return this}_updatePostgresBindings(t,s){var n;const r=this.bindings.postgres_changes,i=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0,a=[];for(let o=0;o<i;o++){const l=r[o],{filter:{event:c,schema:u,table:d,filter:h}}=l,f=t&&t[o];if(f&&f.event===c&&In.isFilterValueEqual(f.schema,u)&&In.isFilterValueEqual(f.table,d)&&In.isFilterValueEqual(f.filter,h))a.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=hs.errored,s==null||s(Gt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=hs.errored&&s&&s(Gt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,s={}){return await this.send({type:"presence",event:"track",payload:t},s.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,s,n){const r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Xs.PRESENCE||t===Xs.POSTGRES_CHANGES;if(r&&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,s,n)}async httpSend(t,s,n={}){var r;if(s==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 a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:s,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,s={}){var n,r;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);return await((r=c.body)===null||r===void 0?void 0:r.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,l;const c=this.channelAdapter.push(t.type,t,s.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.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(s=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,s,n){const r=new AbortController,i=setTimeout(()=>r.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},s),{signal:r.signal}));return clearTimeout(i),a}_on(t,s,n){const r=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,n),a={type:r,filter:s,callback:n,ref:i};return this.bindings[r]?this.bindings[r].push(a):this.bindings[r]=[a],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,s,n)=>{var r,i,a,o,l,c,u;const d=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=(r=this.bindings[d])===null||r===void 0?void 0:r.find(f=>f.ref===t.ref);if(!h)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in h){const f=h.id,g=(i=h.filter)===null||i===void 0?void 0:i.event;return f&&((a=s.ids)===null||a===void 0?void 0:a.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((o=s.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const f=(c=(l=h==null?void 0:h.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(t,s){const{close:n,error:r,leave:i,join:a}=Ru;return s&&[n,r,i,a].includes(t)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,s,n)=>{if(typeof s=="object"&&"ids"in s){const r=s.data,{schema:i,table:a,commit_timestamp:o,type:l,errors:c}=r;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(r))}return s})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in t.bindings)for(const n of t.bindings[s])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,s){return(t??void 0)===(s??void 0)}_getPayloadRecords(t){const s={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(s.new=al(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(s.old=al(t.columns,t.old_record)),s}}class a0{constructor(t,s){this.socket=new Qg(t,s)}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,s,n,r=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),r),this.socket.disconnect(()=>{t(),i("ok")},s,n)})}push(t){this.socket.push(t)}log(t,s,n){this.socket.log(t,s,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==ra.connecting}isDisconnecting(){return this.socket.connectionState()==ra.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ul={HEARTBEAT_INTERVAL:25e3},o0=[1e3,2e3,5e3,1e4],l0=1e4;function c0(){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 s;return(s=Array.from(e.keys())[t])!==null&&s!==void 0?s:null},removeItem(t){e.delete(t)},setItem(t,s){e.set(t,String(s))}}}function u0(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return c0()}const d0=`
36
+ Suggested solution: ${t.workaround}`),new Error(s)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Ng="2.105.4",Ig=`realtime-js/${Ng}`,Pg="1.0.0",Au="2.0.0",Lg=Au,Mg=1e4,jg=100,hs={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ru={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ra={connecting:"connecting",closing:"closing",closed:"closed"};class Dg{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,s){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return s(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var s;return this._isArrayBuffer((s=t.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,s,n){var r,i;const a=t.topic,o=(r=t.ref)!==null&&r!==void 0?r:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+d.length,f=new ArrayBuffer(this.HEADER_LENGTH+h);let g=new DataView(f),b=0;g.setUint8(b++,this.KINDS.userBroadcastPush),g.setUint8(b++,l.length),g.setUint8(b++,o.length),g.setUint8(b++,a.length),g.setUint8(b++,c.length),g.setUint8(b++,d.length),g.setUint8(b++,s),Array.from(l,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(o,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(a,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(c,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(d,E=>g.setUint8(b++,E.charCodeAt(0)));var S=new Uint8Array(f.byteLength+n.byteLength);return S.set(new Uint8Array(f),0),S.set(new Uint8Array(n),f.byteLength),S.buffer}decode(t,s){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return s(n)}if(typeof t=="string"){const n=JSON.parse(t),[r,i,a,o,l]=n;return s({join_ref:r,ref:i,topic:a,event:o,payload:l})}return s({})}_binaryDecode(t){const s=new DataView(t),n=s.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,s,r)}}_decodeUserBroadcast(t,s,n){const r=s.getUint8(1),i=s.getUint8(2),a=s.getUint8(3),o=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(t.slice(l,l+r));l=l+r;const u=n.decode(t.slice(l,l+i));l=l+i;const d=n.decode(t.slice(l,l+a));l=l+a;const h=t.slice(l,t.byteLength),f=o===this.JSON_ENCODING?JSON.parse(n.decode(h)):h,g={type:this.BROADCAST_EVENT,event:u,payload:f};return a>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var s;return t instanceof ArrayBuffer||((s=t==null?void 0:t.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(t,s){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>s.includes(n)))}}var Le;(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"})(Le||(Le={}));const al=(e,t,s={})=>{var n;const r=(n=s.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,a)=>(i[a]=Ug(a,e,t,r),i),{}):{}},Ug=(e,t,s,n)=>{const r=t.find(o=>o.name===e),i=r==null?void 0:r.type,a=s[e];return i&&!n.includes(i)?Cu(i,a):ia(a)},Cu=(e,t)=>{if(e.charAt(0)==="_"){const s=e.slice(1,e.length);return Vg(t,s)}switch(e){case Le.bool:return Bg(t);case Le.float4:case Le.float8:case Le.int2:case Le.int4:case Le.int8:case Le.numeric:case Le.oid:return Hg(t);case Le.json:case Le.jsonb:return Fg(t);case Le.timestamp:return qg(t);case Le.abstime:case Le.date:case Le.daterange:case Le.int4range:case Le.int8range:case Le.money:case Le.reltime:case Le.text:case Le.time:case Le.timestamptz:case Le.timetz:case Le.tsrange:case Le.tstzrange:return ia(t);default:return ia(t)}},ia=e=>e,Bg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Hg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Fg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Vg=(e,t)=>{if(typeof e!="string")return e;const s=e.length-1,n=e[s];if(e[0]==="{"&&n==="}"){let i;const a=e.slice(1,s);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>Cu(t,o))}return e},qg=e=>typeof e=="string"?e.replace(" ","T"):e,Ou=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 $n=e=>typeof e=="function"?e:function(){return e},zg=typeof self<"u"?self:null,Js=typeof window<"u"?window:null,Pt=zg||Js||globalThis,Kg="2.0.0",Wg=1e4,Gg=1e3,Dt={connecting:0,open:1,closing:2,closed:3},ot={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Wt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},aa={longpoll:"longpoll",websocket:"websocket"},Zg={complete:4},oa="base64url.bearer.phx.",ur=class{constructor(e,t,s,n){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},$u=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))}},Jg=class{constructor(e,t,s){this.state=ot.closed,this.topic=e,this.params=$n(t||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ur(this,Wt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new $u(()=>{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=ot.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=ot.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ot.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=ot.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 ur(this,Wt.leave,$n({}),this.timeout).send(),this.state=ot.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Wt.reply,(n,r)=>{this.trigger(this.replyEventName(r),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ot.closed,this.bindings=[]}onClose(e){this.on(Wt.close,e)}onError(e){return this.on(Wt.error,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(typeof t>"u"||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new ur(this,e,function(){return t},s);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ot.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Wt.close,"leave")},s=new ur(this,Wt.leave,$n({}),e);return s.receive("ok",()=>t()).receive("timeout",()=>t()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ot.joining,this.joinPush.resend(e))}trigger(e,t,s,n){let r=this.onMessage(e,t,s,n);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,s));for(let a=0;a<i.length;a++)i[a].callback(r,s,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===ot.closed}isErrored(){return this.state===ot.errored}isJoined(){return this.state===ot.joined}isJoining(){return this.state===ot.joining}isLeaving(){return this.state===ot.leaving}},Lr=class{static request(e,t,s,n,r,i,a){if(Pt.XDomainRequest){let o=new Pt.XDomainRequest;return this.xdomainRequest(o,e,t,n,r,i,a)}else if(Pt.XMLHttpRequest){let o=new Pt.XMLHttpRequest;return this.xhrRequest(o,e,t,s,n,r,i,a)}else{if(Pt.fetch&&Pt.AbortController)return this.fetchRequest(e,t,s,n,r,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,s,n,r,i,a){let o={method:e,headers:s,body:n},l=null;return r&&(l=new AbortController,setTimeout(()=>l.abort(),r),o.signal=l.signal),Pt.fetch(t,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&i?i():a&&a(null)}),l}static xdomainRequest(e,t,s,n,r,i,a){return e.timeout=r,e.open(t,s),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,s,n,r,i,a,o){e.open(t,s,!0),e.timeout=i;for(let[l,c]of Object.entries(n))e.setRequestHeader(l,c);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Zg.complete&&o){let l=this.parseJSON(e.responseText);o(l)}},a&&(e.ontimeout=a),e.send(r),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 s=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?s.push(this.serialize(i,r)):s.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return s.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},Yg=e=>{let t="",s=new Uint8Array(e),n=s.byteLength;for(let r=0;r<n;r++)t+=String.fromCharCode(s[r]);return btoa(t)},Hs=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(oa)&&(this.authToken=atob(t[1].slice(oa.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=Dt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+aa.websocket),"$1/"+aa.longpoll)}endpointURL(){return Lr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=Dt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Dt.open||this.readyState===Dt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:s,token:n,messages:r}=t;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else s=0;switch(s){case 200:r.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Dt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(e){typeof e!="string"&&(e=Yg(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,s){for(let r of this.reqs)r.abort();this.readyState=Dt.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,s,n,r){let i,a=()=>{this.reqs.delete(i),n()};i=Lr.request(e,this.endpointURL(),t,s,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&r(o)}),this.reqs.add(i)}},Xg=class _n{constructor(t,s={}){let n=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=_n.syncState(this.state,r,i,a),this.pendingDiffs.forEach(l=>{this.state=_n.syncDiff(this.state,l,i,a)}),this.pendingDiffs=[],o()}),this.channel.on(n.diff,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=_n.syncDiff(this.state,r,i,a),o())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return _n.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,s,n,r){let i=this.clone(t),a={},o={};return this.map(i,(l,c)=>{s[l]||(o[l]=c)}),this.map(s,(l,c)=>{let u=i[l];if(u){let d=c.metas.map(b=>b.phx_ref),h=u.metas.map(b=>b.phx_ref),f=c.metas.filter(b=>h.indexOf(b.phx_ref)<0),g=u.metas.filter(b=>d.indexOf(b.phx_ref)<0);f.length>0&&(a[l]=c,a[l].metas=f),g.length>0&&(o[l]=this.clone(u),o[l].metas=g)}else a[l]=c}),this.syncDiff(i,{joins:a,leaves:o},n,r)}static syncDiff(t,s,n,r){let{joins:i,leaves:a}=this.clone(s);return n||(n=function(){}),r||(r=function(){}),this.map(i,(o,l)=>{let c=t[o];if(t[o]=this.clone(l),c){let u=t[o].metas.map(h=>h.phx_ref),d=c.metas.filter(h=>u.indexOf(h.phx_ref)<0);t[o].metas.unshift(...d)}n(o,c,l)}),this.map(a,(o,l)=>{let c=t[o];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),r(o,c,l),c.metas.length===0&&delete t[o]}),t}static list(t,s){return s||(s=function(n,r){return r}),this.map(t,(n,r)=>s(n,r))}static map(t,s){return Object.getOwnPropertyNames(t).map(n=>s(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},dr={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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,n,r,i,a]=JSON.parse(e);return t({join_ref:s,ref:n,topic:r,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:s,event:n,topic:r,payload:i}=e,a=this.META_LENGTH+t.length+s.length+r.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),Array.from(t,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(s,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(o.byteLength+i.byteLength);return u.set(new Uint8Array(o),0),u.set(new Uint8Array(i),o.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=s.decode(e.slice(a,a+n));a=a+n;let l=s.decode(e.slice(a,a+r));a=a+r;let c=s.decode(e.slice(a,a+i));a=a+i;let u=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(o,o+n));o=o+n;let c=s.decode(e.slice(o,o+r));o=o+r;let u=s.decode(e.slice(o,o+i));o=o+i;let d=s.decode(e.slice(o,o+a));o=o+a;let h=e.slice(o,e.byteLength),f={status:d,response:h};return{join_ref:l,ref:c,topic:u,event:Wt.reply,payload:f}},decodeBroadcast(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=this.HEADER_LENGTH+2,a=s.decode(e.slice(i,i+n));i=i+n;let o=s.decode(e.slice(i,i+r));i=i+r;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:l}}},Qg=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Wg,this.transport=t.transport||Pt.WebSocket||Hs,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=Pt&&Pt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=dr.encode.bind(dr),this.defaultDecoder=dr.decode.bind(dr),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!==Hs?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Js&&Js.addEventListener&&(Js.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Js.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Js.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=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,i,a)=>{console.log(`${r}: ${i}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=$n(t.params||{}),this.endPoint=`${e}/${aa.websocket}`,this.vsn=t.vsn||Kg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new $u(()=>{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 Hs}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=Lr.appendParams(Lr.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,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=$n(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Hs?this.connectWithFallback(Hs,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}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(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(r=>{r.ref===t&&(this.off([n]),e(Date.now()-s))});return!0}transportName(e){switch(e){case Hs:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${oa}${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 s=!1,n=!0,r,i,a=this.transportName(e),o=l=>{this.log("transport",`falling back to ${a}...`,l),this.off([r,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(l=>{this.log("transport","error",l),n&&!s&&(clearTimeout(this.fallbackTimer),o(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!n){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(o,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(),Gg,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,s||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){if(s===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s)}waitForSocketClosed(e,t,s=1){if(s===5||e.readyState===Dt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s)}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,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Wt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Dt.connecting:return"connecting";case Dt.open:return"open";case Dt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(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(([s])=>e.indexOf(s)===-1)}channel(e,t={}){let s=new Jg(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:n,ref:r,join_ref:i}=e;this.log("push",`${t} ${s} (${i}, ${r})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:n,payload:r,ref:i,join_ref:a}=t;if(i&&i===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status==="ok"?"ok":"error",o)}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",`${r.status||""} ${s} ${n} ${i&&"("+i+")"||""}`.trim(),r);for(let o=0;o<this.channels.length;o++){const l=this.channels[o];l.isMember(s,n,r,a)&&l.trigger(n,r,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([s,n])=>{try{n(...t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Nn{constructor(t,s){const n=t0(s);this.presence=new Xg(t.getChannel(),n),this.presence.onJoin((r,i,a)=>{const o=Nn.onJoinPayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((r,i,a)=>{const o=Nn.onLeavePayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Nn.transformState(this.presence.state)}static transformState(t){return t=e0(t),Object.getOwnPropertyNames(t).reduce((s,n)=>{const r=t[n];return s[n]=kr(r),s},{})}static onJoinPayload(t,s,n){const r=ol(s),i=kr(n);return{event:"join",key:t,currentPresences:r,newPresences:i}}static onLeavePayload(t,s,n){const r=ol(s),i=kr(n);return{event:"leave",key:t,currentPresences:r,leftPresences:i}}}function kr(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function e0(e){return JSON.parse(JSON.stringify(e))}function t0(e){return(e==null?void 0:e.events)&&{events:e.events}}function ol(e){return e!=null&&e.metas?kr(e):[]}var ll;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(ll||(ll={}));class s0{get state(){return this.presenceAdapter.state}constructor(t,s){this.channel=t,this.presenceAdapter=new Nn(this.channel.channelAdapter,s)}}function n0(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 s=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${s}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class r0{constructor(t,s,n){const r=i0(n);this.channel=t.getSocket().channel(s,r),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,s){return this.channel.on(t,s)}off(t,s){this.channel.off(t,s)}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,s,n){let r;try{r=this.channel.push(t,s,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>jg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return r}updateJoinPayload(t){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),t)}canPush(){return this.socket.isConnected()&&this.state===hs.joined}isJoined(){return this.state===hs.joined}isJoining(){return this.state===hs.joining}isClosed(){return this.state===hs.closed}isLeaving(){return this.state===hs.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function i0(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var cl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(cl||(cl={}));var Qs;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Qs||(Qs={}));var Gt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Gt||(Gt={}));class In{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,s={config:{}},n){var r,i;if(this.topic=t,this.params=s,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new r0(this.socket.socketAdapter,t,this.params),this.presence=new s0(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Ou(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(r=this.params.config)===null||r===void 0?void 0:r.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,s=this.timeout){var n,r,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(r=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&r!==void 0?r:[],u=!!this.bindings[Qs.PRESENCE]&&this.bindings[Qs.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},h={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>{t==null||t(Gt.CHANNEL_ERROR,n0(f))}),this._onClose(()=>t==null?void 0:t(Gt.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(Gt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=hs.errored;const g=Object.values(f).join(", ")||"error";t==null||t(Gt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{t==null||t(Gt.TIMED_OUT)})}return this}_updatePostgresBindings(t,s){var n;const r=this.bindings.postgres_changes,i=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0,a=[];for(let o=0;o<i;o++){const l=r[o],{filter:{event:c,schema:u,table:d,filter:h}}=l,f=t&&t[o];if(f&&f.event===c&&In.isFilterValueEqual(f.schema,u)&&In.isFilterValueEqual(f.table,d)&&In.isFilterValueEqual(f.filter,h))a.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=hs.errored,s==null||s(Gt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=hs.errored&&s&&s(Gt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,s={}){return await this.send({type:"presence",event:"track",payload:t},s.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,s,n){const r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Qs.PRESENCE||t===Qs.POSTGRES_CHANGES;if(r&&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,s,n)}async httpSend(t,s,n={}){var r;if(s==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 a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:s,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,s={}){var n,r;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);return await((r=c.body)===null||r===void 0?void 0:r.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,l;const c=this.channelAdapter.push(t.type,t,s.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.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(s=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,s,n){const r=new AbortController,i=setTimeout(()=>r.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},s),{signal:r.signal}));return clearTimeout(i),a}_on(t,s,n){const r=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,n),a={type:r,filter:s,callback:n,ref:i};return this.bindings[r]?this.bindings[r].push(a):this.bindings[r]=[a],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,s,n)=>{var r,i,a,o,l,c,u;const d=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=(r=this.bindings[d])===null||r===void 0?void 0:r.find(f=>f.ref===t.ref);if(!h)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in h){const f=h.id,g=(i=h.filter)===null||i===void 0?void 0:i.event;return f&&((a=s.ids)===null||a===void 0?void 0:a.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((o=s.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const f=(c=(l=h==null?void 0:h.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(t,s){const{close:n,error:r,leave:i,join:a}=Ru;return s&&[n,r,i,a].includes(t)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,s,n)=>{if(typeof s=="object"&&"ids"in s){const r=s.data,{schema:i,table:a,commit_timestamp:o,type:l,errors:c}=r;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(r))}return s})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in t.bindings)for(const n of t.bindings[s])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,s){return(t??void 0)===(s??void 0)}_getPayloadRecords(t){const s={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(s.new=al(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(s.old=al(t.columns,t.old_record)),s}}class a0{constructor(t,s){this.socket=new Qg(t,s)}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,s,n,r=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),r),this.socket.disconnect(()=>{t(),i("ok")},s,n)})}push(t){this.socket.push(t)}log(t,s,n){this.socket.log(t,s,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==ra.connecting}isDisconnecting(){return this.socket.connectionState()==ra.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ul={HEARTBEAT_INTERVAL:25e3},o0=[1e3,2e3,5e3,1e4],l0=1e4;function c0(){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 s;return(s=Array.from(e.keys())[t])!==null&&s!==void 0?s:null},removeItem(t){e.delete(t)},setItem(t,s){e.set(t,String(s))}}}function u0(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return c0()}const d0=`
38
38
  addEventListener("message", (e) => {
39
39
  if (e.data.event === "start") {
40
40
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -52,13 +52,13 @@ Option 2: Install and provide the "ws" package:
52
52
  const client = new RealtimeClient(url, {
53
53
  ...options,
54
54
  transport: ws
55
- })`):new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,s)}getChannels(){return this.channels}async removeChannel(t){const s=await t.unsubscribe();return s==="ok"&&t.teardown(),s}async removeAllChannels(){const t=this.channels.map(async n=>{const r=await n.unsubscribe();return n.teardown(),r}),s=await Promise.all(t);return await this.disconnect(),s}log(t,s,n){this.socketAdapter.log(t,s,n)}connectionState(){return this.socketAdapter.connectionState()||ra.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,s={config:{}}){const n=`realtime:${t}`,r=this.getChannels().find(i=>i.topic===n);if(r)return r;{const i=new In(`realtime:${t}`,s,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(s=>s.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 s,n=!1;if(t)s=t,n=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),s=this.accessTokenValue}else s=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(r=>{const i={access_token:s,version:Ig};s&&r.updateJoinPayload(i),r.joinedOnce&&r.channelAdapter.isJoined()&&r.channelAdapter.push(Ru.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${t}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),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(s,n)=>{s=="sent"&&this._setAuthSafely(),t&&t(s,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.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 s;if(t)s=t;else{const n=new Blob([d0],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_initializeOptions(t){var s,n,r,i,a,o,l,c,u,d,h,f;this.worker=(s=t==null?void 0:t.worker)!==null&&s!==void 0?s:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const g={};g.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:Mg,g.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:ul.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:ul.HEARTBEAT_INTERVAL),g.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:$g.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:u0(),g.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:x=>o0[x-1]||l0;let m,S;const E=(d=t==null?void 0:t.vsn)!==null&&d!==void 0?d:Lg;switch(E){case Pg:m=(x,k)=>k(JSON.stringify(x)),S=(x,k)=>k(JSON.parse(x));break;case Au:m=this.serializer.encode.bind(this.serializer),S=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=E,g.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:m,g.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:S,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 Vn=class extends Error{constructor(e,t){var s;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)&&((s=t.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function f0(e,t,s){const n=new URL(t,e);if(s)for(const[r,i]of Object.entries(s))i!==void 0&&n.searchParams.set(r,i);return n.toString()}async function p0(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 g0(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:s,path:n,query:r,body:i,headers:a}){const o=f0(e.baseUrl,n,r),l=await p0(e.auth),c=await t(o,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},body:i?JSON.stringify(i):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),h=d&&u?JSON.parse(u):u;if(!c.ok){const f=d?h:void 0,g=f==null?void 0:f.error;throw new Vn((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:h}}}}function hr(e){return e.join("")}var m0=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:hr(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const s={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${hr(e.namespace)}`}),!0}catch(t){if(t instanceof Vn&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(s){if(s instanceof Vn&&s.status===409)return;throw s}}};function Hs(e){return e.join("")}var b0=class{constructor(e,t="",s){this.client=e,this.prefix=t,this.accessDelegation=s}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Hs(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Hs(e.namespace)}/tables`,body:t,headers:s})).data.metadata}async updateTable(e,t){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Hs(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Hs(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/${Hs(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/${Hs(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(s){if(s instanceof Vn&&s.status===404)return!1;throw s}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(s){if(s instanceof Vn&&s.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw s}}},v0=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const s=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=g0({baseUrl:s,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new m0(this.client,t),this.tableOps=new b0(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 qn(e){"@babel/helpers - typeof";return qn=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},qn(e)}function y0(e,t){if(qn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _0(e){var t=y0(e,"string");return qn(t)=="symbol"?t:t+""}function w0(e,t,s){return(t=_0(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function dl(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function we(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(s),!0).forEach(function(n){w0(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):dl(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var ui=class extends Error{constructor(e,t="storage",s,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function di(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var la=class extends ui{constructor(e,t,s,n="storage"){super(e,n,t,s),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=s}toJSON(){return we({},super.toJSON())}},Nu=class extends ui{constructor(e,t,s="storage"){super(e,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Mr(e,t,s){const n=we({},e),r=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===r&&delete n[i];return n[r]=s,n}function x0(e){const t={};for(const[s,n]of Object.entries(e))t[s.toLowerCase()]=n;return t}const E0=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),k0=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)},ca=e=>{if(Array.isArray(e))return e.map(s=>ca(s));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([s,n])=>{const r=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[r]=ca(n)}),t},S0=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),hl=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 s=t.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(e)},T0=async(e,t,s,n)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const r=e;let i=parseInt(String(r.status),10);Number.isFinite(i)||(i=500),r.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new la(hl(a),i,o,n))}).catch(()=>{const a=i+"";t(new la(r.statusText||`HTTP ${i} error`,i,a,n))})}else t(new Nu(hl(e),e,n))},A0=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return we(we({},r),s);if(k0(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[l,c]of Object.entries(a))l.toLowerCase()==="content-type"&&(o=c);r.headers=Mr(a,"Content-Type",(i=o)!==null&&i!==void 0?i:"application/json"),r.body=JSON.stringify(n)}else r.body=n;return t!=null&&t.duplex&&(r.duplex=t.duplex),we(we({},r),s)};async function mn(e,t,s,n,r,i,a){return new Promise((o,l)=>{e(s,A0(t,n,r,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="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=>o(c)).catch(c=>T0(c,l,n,a))})}function Iu(e="storage"){return{get:async(t,s,n,r)=>mn(t,"GET",s,n,r,void 0,e),post:async(t,s,n,r,i)=>mn(t,"POST",s,r,i,n,e),put:async(t,s,n,r,i)=>mn(t,"PUT",s,r,i,n,e),head:async(t,s,n,r)=>mn(t,"HEAD",s,we(we({},n),{},{noResolveJson:!0}),r,void 0,e),remove:async(t,s,n,r,i)=>mn(t,"DELETE",s,r,i,n,e)}}const R0=Iu("storage"),{get:zn,post:xt,put:ua,head:C0,remove:Da}=R0,ct=Iu("vectors");var dn=class{constructor(e,t={},s,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=x0(t),this.fetch=E0(s),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Mr(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(di(s))return{data:null,error:s};throw s}}},O0=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(di(t))return{data:null,error:t};throw t}}};let Pu;Pu=Symbol.toStringTag;var $0=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Pu]="BlobDownloadBuilder",this.promise=null}asStream(){return new O0(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(di(t))return{data:null,error:t};throw t}}};const N0={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var I0=class extends dn{constructor(e,t={},s,n){super(e,t,n,"storage"),this.bucketId=s}async uploadOrUpdate(e,t,s,n){var r=this;return r.handleOperation(async()=>{let i;const a=we(we({},fl),n);let o=we(we({},r.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;if(typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),l&&i.append("metadata",r.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",r.encodeMetadata(l))):(i=s,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[h,f]of Object.entries(n.headers))o=Mr(o,h,f);const c=r._removeEmptyFolders(t),u=r._getFinalPath(c),d=await(e=="PUT"?ua:xt)(r.fetch,`${r.url}/object/${u}`,i,we({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,s){return this.uploadOrUpdate("POST",e,t,s)}async uploadToSignedUrl(e,t,s,n){var r=this;const i=r._removeEmptyFolders(e),a=r._getFinalPath(i),o=new URL(r.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),r.handleOperation(async()=>{let l;const c=we(we({},fl),n);let u=we(we({},r.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",r.encodeMetadata(d)),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.append("metadata",r.encodeMetadata(d))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=r.toBase64(r.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[h,f]of Object.entries(n.headers))u=Mr(u,h,f);return{path:i,fullPath:(await ua(r.fetch,o.toString(),l,we({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var s=this;return s.handleOperation(async()=>{let n=s._getFinalPath(e);const r=we({},s.headers);t!=null&&t.upsert&&(r["x-upsert"]="true");const i=await xt(s.fetch,`${s.url}/object/upload/sign/${n}`,{},{headers:r}),a=new URL(s.url+i.url),o=a.searchParams.get("token");if(!o)throw new ui("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}async update(e,t,s){return this.uploadOrUpdate("PUT",e,t,s)}async move(e,t,s){var n=this;return n.handleOperation(async()=>await xt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers}))}async copy(e,t,s){var n=this;return n.handleOperation(async()=>({path:(await xt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,s){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const i=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let a=await xt(n.fetch,`${n.url}/object/sign/${r}`,we({expiresIn:t},i?{transform:s.transform}:{}),{headers:n.headers});const o=new URLSearchParams;s!=null&&s.download&&o.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&o.set("cacheNonce",String(s.cacheNonce));const l=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,s){var n=this;return n.handleOperation(async()=>{const r=await xt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=new URLSearchParams;s!=null&&s.download&&i.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&i.set("cacheNonce",String(s.cacheNonce));const a=i.toString();return r.map(o=>we(we({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,s){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",r=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const i=r.toString(),a=this._getFinalPath(e),o=()=>zn(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new $0(o,this.shouldThrowOnError)}async info(e){var t=this;const s=t._getFinalPath(e);return t.handleOperation(async()=>ca(await zn(t.fetch,`${t.url}/object/info/${s}`,{headers:t.headers})))}async exists(e){var t=this;const s=t._getFinalPath(e);try{return await C0(t.fetch,`${t.url}/object/${s}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(di(r)){var n;const i=r instanceof la?r.status:r instanceof Nu?(n=r.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const s=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const r=n.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}`)+(r?`?${r}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Da(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,s){var n=this;return n.handleOperation(async()=>{const r=we(we(we({},N0),t),{},{prefix:e||""});return await xt(n.fetch,`${n.url}/object/list/${n.bucketId}`,r,{headers:n.headers},s)})}async listV2(e,t){var s=this;return s.handleOperation(async()=>{const n=we({},e);return await xt(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,n,{headers:s.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 P0="2.105.4",sr={"X-Client-Info":`storage-js/${P0}`};var L0=class extends dn{constructor(e,t={},s,n){const r=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase."));const i=r.href.replace(/\/$/,""),a=we(we({},sr),t);super(i,a,s,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=t.listBucketOptionsToQueryString(e);return await zn(t.fetch,`${t.url}/bucket${s}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await zn(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var s=this;return s.handleOperation(async()=>await xt(s.fetch,`${s.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async updateBucket(e,t){var s=this;return s.handleOperation(async()=>await ua(s.fetch,`${s.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await xt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Da(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():""}},M0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),t);super(n,r,s,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await xt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&s.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&s.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&s.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&s.set("sortOrder",e.sortOrder),e!=null&&e.search&&s.set("search",e.search);const n=s.toString(),r=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await zn(t.fetch,r,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Da(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!S0(e))throw new ui("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 s=new v0({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(s,{get(r,i){const a=r[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(r,o),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},j0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var s=this;return s.handleOperation(async()=>await ct.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var s=this;return s.handleOperation(async()=>await ct.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers})||{})}},D0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"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 ct.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ct.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 ct.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ct.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 ct.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},U0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},B0=class extends U0{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new H0(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,s=this;return t().call(s,e)}async getBucket(e){var t=()=>super.getBucket,s=this;return t().call(s,e)}async listBuckets(e={}){var t=()=>super.listBuckets,s=this;return t().call(s,e)}async deleteBucket(e){var t=()=>super.deleteBucket,s=this;return t().call(s,e)}},H0=class extends j0{constructor(e,t,s,n){super(e,t,n),this.vectorBucketName=s}async createIndex(e){var t=()=>super.createIndex,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,s=this;return t().call(s,s.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,s=this;return t().call(s,s.vectorBucketName,e)}index(e){return new F0(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},F0=class extends D0{constructor(e,t,s,n,r){super(e,t,r),this.vectorBucketName=s,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(e){var t=()=>super.getVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},V0=class extends L0{constructor(e,t={},s,n){super(e,t,s,n)}from(e){return new I0(this.url,this.headers,e,this.fetch)}get vectors(){return new B0(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new M0(this.url+"/iceberg",this.headers,this.fetch)}};const Lu="2.105.4",Js=30*1e3,da=3,$i=da*Js,q0="http://localhost:9999",z0="supabase.auth.token",K0={"X-Client-Info":`gotrue-js/${Lu}`},ha="X-Supabase-Api-Version",Mu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},W0=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,G0=10*60*1e3;class Kn extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function re(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Z0 extends Kn{constructor(t,s,n){super(t,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function J0(e){return re(e)&&e.name==="AuthApiError"}class Et extends Kn{constructor(t,s){super(t),this.name="AuthUnknownError",this.originalError=s}}class is extends Kn{constructor(t,s,n,r){super(t,n,r),this.name=s,this.status=n}}class Je extends is{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function fr(e){return re(e)&&e.name==="AuthSessionMissingError"}class Fs extends is{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class pr extends is{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class gr extends is{constructor(t,s=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Y0(e){return re(e)&&e.name==="AuthImplicitGrantRedirectError"}class pl extends is{constructor(t,s=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class X0 extends is{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 fa extends is{constructor(t,s){super(t,"AuthRetryableFetchError",s,void 0)}}function Ni(e){return re(e)&&e.name==="AuthRetryableFetchError"}class gl extends is{constructor(t,s,n){super(t,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class pa extends is{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ml=`
56
- \r=`.split(""),Q0=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<ml.length;t+=1)e[ml[t].charCodeAt(0)]=-2;for(let t=0;t<jr.length;t+=1)e[jr[t].charCodeAt(0)]=t;return e})();function bl(e,t,s){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(jr[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(jr[n]),t.queuedBits-=6}}function ju(e,t,s){const n=Q0[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)s(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function vl(e){const t=[],s=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=a=>{sm(a,n,s)};for(let a=0;a<e.length;a+=1)ju(e.charCodeAt(a),r,i);return t.join("")}function em(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 tm(e,t){for(let s=0;s<e.length;s+=1){let n=e.charCodeAt(s);if(n>55295&&n<=56319){const r=(n-55296)*1024&65535;n=(e.charCodeAt(s+1)-56320&65535|r)+65536,s+=1}em(n,t)}}function sm(e,t,s){if(t.utf8seq===0){if(e<=127){s(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&s(t.codepoint)}}function an(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};for(let r=0;r<e.length;r+=1)ju(e.charCodeAt(r),s,n);return new Uint8Array(t)}function nm(e){const t=[];return tm(e,s=>t.push(s)),new Uint8Array(t)}function Os(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};return e.forEach(r=>bl(r,s,n)),bl(null,s,n),t.join("")}function rm(e){return Math.round(Date.now()/1e3)+e}function im(){return Symbol("auth-callback")}const Xe=()=>typeof window<"u"&&typeof document<"u",xs={tested:!1,writable:!1},Du=()=>{if(!Xe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xs.tested)return xs.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),xs.tested=!0,xs.writable=!0}catch{xs.tested=!0,xs.writable=!1}return xs.writable};function am(e){const t={},s=new URL(e);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((r,i)=>{t[i]=r})}catch{}return s.searchParams.forEach((n,r)=>{t[r]=n}),t}const Uu=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),om=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Ys=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Es=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Ye=async(e,t)=>{await e.removeItem(t)};class hi{constructor(){this.promise=new hi.promiseConstructor((t,s)=>{this.resolve=t,this.reject=s})}}hi.promiseConstructor=Promise;function mr(e){const t=e.split(".");if(t.length!==3)throw new pa("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!W0.test(t[n]))throw new pa("JWT not in base64url format");return{header:JSON.parse(vl(t[0])),payload:JSON.parse(vl(t[1])),signature:an(t[2]),raw:{header:t[0],payload:t[1]}}}async function lm(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function cm(e,t){return new Promise((n,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await e(i);if(!t(i,null,a)){n(a);return}}catch(a){if(!t(i,a)){r(a);return}}})()})}function um(e){return("0"+e.toString(16)).substr(-2)}function dm(){const t=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let r="";for(let i=0;i<56;i++)r+=s.charAt(Math.floor(Math.random()*n));return r}return crypto.getRandomValues(t),Array.from(t,um).join("")}async function hm(e){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(i=>String.fromCharCode(i)).join("")}async function fm(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 s=await hm(e);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Vs(e,t,s=!1){const n=dm();let r=n;s&&(r+="/recovery"),await Ys(e,`${t}-code-verifier`,r);const i=await fm(n);return[i,n===i?"plain":"s256"]}const pm=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function gm(e){const t=e.headers.get(ha);if(!t||!t.match(pm))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function mm(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 bm(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 vm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function zt(e){if(!vm.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function wt(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 Ii(){const e={};return new Proxy(e,{get:(t,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ym(e,t){return new Proxy(e,{get:(s,n,r)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,n,r)}return!t.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(s,n,r)}})}function yl(e){return JSON.parse(JSON.stringify(e))}const Ss=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)},_m=[502,503,504,520,521,522,523,524,530];async function _l(e){var t;if(!om(e))throw new fa(Ss(e),0);if(_m.includes(e.status))throw new fa(Ss(e),e.status);let s;try{s=await e.json()}catch(i){throw new Et(Ss(i),i)}let n;const r=gm(e);if(r&&r.getTime()>=Mu["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new gl(Ss(s),e.status,((t=s.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Je}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new gl(Ss(s),e.status,s.weak_password.reasons);throw new Z0(Ss(s),e.status||500,n)}const wm=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),r.body=JSON.stringify(n),Object.assign(Object.assign({},r),s))};async function le(e,t,s,n){var r;const i=Object.assign({},n==null?void 0:n.headers);i[ha]||(i[ha]=Mu["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(r=n==null?void 0:n.query)!==null&&r!==void 0?r:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await xm(e,t,s+o,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function xm(e,t,s,n,r,i){const a=wm(t,n,r,i);let o;try{o=await e(s,Object.assign({},a))}catch(l){throw console.error(l),new fa(Ss(l),0)}if(o.ok||await _l(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await _l(l)}}function bt(e){var t;let s=null;Sm(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=rm(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:s,user:n},error:null}}function wl(e){const t=bt(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((s,n)=>s&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function fs(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Em(e){return{data:e,error:null}}function km(e){const{action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i}=e,a=ci(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function xl(e){return e}function Sm(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Pi=["global","local","others"];class Tm{constructor({url:t="",headers:s={},fetch:n,experimental:r}){this.url=t,this.headers=s,this.fetch=Uu(n),this.experimental=r??{},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,s=Pi[0]){if(Pi.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Pi.join(", ")}`);try{return await le(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,s={}){try{return await le(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:s}=t,n=ci(t,["options"]),r=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(r.new_email=n==null?void 0:n.newEmail,delete r.newEmail),await le(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:km,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(re(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(t){try{return await le(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:fs})}catch(s){if(re(s))return{data:{user:null},error:s};throw s}}async listUsers(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await le(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const d=await u.json(),h=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const m=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=m}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(re(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){zt(t);try{return await le(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:fs})}catch(s){if(re(s))return{data:{user:null},error:s};throw s}}async updateUserById(t,s){zt(t);try{return await le(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:s,headers:this.headers,xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,s=!1){zt(t);try{return await le(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:s},xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){zt(t.userId);try{const{data:s,error:n}=await le(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:s,error:n}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _deleteFactor(t){zt(t.userId),zt(t.id);try{return{data:await le(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _listOAuthClients(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await le(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const d=await u.json(),h=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const m=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=m}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(re(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await le(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _getOAuthClient(t){try{return await le(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _updateOAuthClient(t,s){try{return await le(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await le(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(t){try{return await le(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _listCustomProviders(t){try{const s={};return t!=null&&t.type&&(s.type=t.type),await le(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:n=>{var r;return{data:{providers:(r=n==null?void 0:n.providers)!==null&&r!==void 0?r:[]},error:null}}})}catch(s){if(re(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(t){try{return await le(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _getCustomProvider(t){try{return await le(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _updateCustomProvider(t,s){try{return await le(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await le(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _adminListPasskeys(t){wt(this.experimental),zt(t.userId);try{return await le(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(t){wt(this.experimental),zt(t.userId),zt(t.passkeyId);try{return await le(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}}function El(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const $t={debug:!!(globalThis&&Du()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Bu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class kl extends Bu{}async function Am(e,t,s){$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let r;t>0&&(r=setTimeout(()=>{n.abort(),$t.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:n.signal},async i=>{if(i){clearTimeout(r),$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await s()}finally{$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw $t.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new kl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if($t.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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(r),await s()}})}catch(i){if(t>0&&clearTimeout(r),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(n.signal.aborted)return $t.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 a=>{if(a){$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,a.name);try{return await s()}finally{$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await s()}));throw $t.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new kl(`Lock "${e}" was released because another request stole it`)}throw i}}function Rm(){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 Hu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Cm(e){return parseInt(e,16)}function Om(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function $m(e){var t;const{chainId:s,domain:n,expirationTime:r,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:h}=e;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);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=Hu(e.address),g=u?`${u}://${n}`:n,m=e.statement?`${e.statement}
55
+ })`):new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,s)}getChannels(){return this.channels}async removeChannel(t){const s=await t.unsubscribe();return s==="ok"&&t.teardown(),s}async removeAllChannels(){const t=this.channels.map(async n=>{const r=await n.unsubscribe();return n.teardown(),r}),s=await Promise.all(t);return await this.disconnect(),s}log(t,s,n){this.socketAdapter.log(t,s,n)}connectionState(){return this.socketAdapter.connectionState()||ra.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,s={config:{}}){const n=`realtime:${t}`,r=this.getChannels().find(i=>i.topic===n);if(r)return r;{const i=new In(`realtime:${t}`,s,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(s=>s.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 s,n=!1;if(t)s=t,n=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),s=this.accessTokenValue}else s=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(r=>{const i={access_token:s,version:Ig};s&&r.updateJoinPayload(i),r.joinedOnce&&r.channelAdapter.isJoined()&&r.channelAdapter.push(Ru.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${t}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),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(s,n)=>{s=="sent"&&this._setAuthSafely(),t&&t(s,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.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 s;if(t)s=t;else{const n=new Blob([d0],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_initializeOptions(t){var s,n,r,i,a,o,l,c,u,d,h,f;this.worker=(s=t==null?void 0:t.worker)!==null&&s!==void 0?s:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const g={};g.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:Mg,g.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:ul.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:ul.HEARTBEAT_INTERVAL),g.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:$g.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:u0(),g.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:x=>o0[x-1]||l0;let b,S;const E=(d=t==null?void 0:t.vsn)!==null&&d!==void 0?d:Lg;switch(E){case Pg:b=(x,k)=>k(JSON.stringify(x)),S=(x,k)=>k(JSON.parse(x));break;case Au:b=this.serializer.encode.bind(this.serializer),S=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=E,g.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:b,g.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:S,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 Vn=class extends Error{constructor(e,t){var s;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)&&((s=t.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function f0(e,t,s){const n=new URL(t,e);if(s)for(const[r,i]of Object.entries(s))i!==void 0&&n.searchParams.set(r,i);return n.toString()}async function p0(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 g0(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:s,path:n,query:r,body:i,headers:a}){const o=f0(e.baseUrl,n,r),l=await p0(e.auth),c=await t(o,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},body:i?JSON.stringify(i):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),h=d&&u?JSON.parse(u):u;if(!c.ok){const f=d?h:void 0,g=f==null?void 0:f.error;throw new Vn((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:h}}}}function hr(e){return e.join("")}var m0=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:hr(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const s={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${hr(e.namespace)}`}),!0}catch(t){if(t instanceof Vn&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(s){if(s instanceof Vn&&s.status===409)return;throw s}}};function Fs(e){return e.join("")}var b0=class{constructor(e,t="",s){this.client=e,this.prefix=t,this.accessDelegation=s}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Fs(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Fs(e.namespace)}/tables`,body:t,headers:s})).data.metadata}async updateTable(e,t){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Fs(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Fs(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/${Fs(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/${Fs(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(s){if(s instanceof Vn&&s.status===404)return!1;throw s}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(s){if(s instanceof Vn&&s.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw s}}},v0=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const s=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=g0({baseUrl:s,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new m0(this.client,t),this.tableOps=new b0(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 qn(e){"@babel/helpers - typeof";return qn=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},qn(e)}function y0(e,t){if(qn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _0(e){var t=y0(e,"string");return qn(t)=="symbol"?t:t+""}function w0(e,t,s){return(t=_0(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function dl(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function we(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(s),!0).forEach(function(n){w0(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):dl(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var ui=class extends Error{constructor(e,t="storage",s,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function di(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var la=class extends ui{constructor(e,t,s,n="storage"){super(e,n,t,s),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=s}toJSON(){return we({},super.toJSON())}},Nu=class extends ui{constructor(e,t,s="storage"){super(e,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Mr(e,t,s){const n=we({},e),r=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===r&&delete n[i];return n[r]=s,n}function x0(e){const t={};for(const[s,n]of Object.entries(e))t[s.toLowerCase()]=n;return t}const E0=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),k0=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)},ca=e=>{if(Array.isArray(e))return e.map(s=>ca(s));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([s,n])=>{const r=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[r]=ca(n)}),t},S0=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),hl=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 s=t.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(e)},T0=async(e,t,s,n)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const r=e;let i=parseInt(String(r.status),10);Number.isFinite(i)||(i=500),r.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new la(hl(a),i,o,n))}).catch(()=>{const a=i+"";t(new la(r.statusText||`HTTP ${i} error`,i,a,n))})}else t(new Nu(hl(e),e,n))},A0=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return we(we({},r),s);if(k0(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[l,c]of Object.entries(a))l.toLowerCase()==="content-type"&&(o=c);r.headers=Mr(a,"Content-Type",(i=o)!==null&&i!==void 0?i:"application/json"),r.body=JSON.stringify(n)}else r.body=n;return t!=null&&t.duplex&&(r.duplex=t.duplex),we(we({},r),s)};async function mn(e,t,s,n,r,i,a){return new Promise((o,l)=>{e(s,A0(t,n,r,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="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=>o(c)).catch(c=>T0(c,l,n,a))})}function Iu(e="storage"){return{get:async(t,s,n,r)=>mn(t,"GET",s,n,r,void 0,e),post:async(t,s,n,r,i)=>mn(t,"POST",s,r,i,n,e),put:async(t,s,n,r,i)=>mn(t,"PUT",s,r,i,n,e),head:async(t,s,n,r)=>mn(t,"HEAD",s,we(we({},n),{},{noResolveJson:!0}),r,void 0,e),remove:async(t,s,n,r,i)=>mn(t,"DELETE",s,r,i,n,e)}}const R0=Iu("storage"),{get:zn,post:xt,put:ua,head:C0,remove:Da}=R0,ct=Iu("vectors");var dn=class{constructor(e,t={},s,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=x0(t),this.fetch=E0(s),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Mr(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(di(s))return{data:null,error:s};throw s}}},O0=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(di(t))return{data:null,error:t};throw t}}};let Pu;Pu=Symbol.toStringTag;var $0=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Pu]="BlobDownloadBuilder",this.promise=null}asStream(){return new O0(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(di(t))return{data:null,error:t};throw t}}};const N0={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var I0=class extends dn{constructor(e,t={},s,n){super(e,t,n,"storage"),this.bucketId=s}async uploadOrUpdate(e,t,s,n){var r=this;return r.handleOperation(async()=>{let i;const a=we(we({},fl),n);let o=we(we({},r.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;if(typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),l&&i.append("metadata",r.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",r.encodeMetadata(l))):(i=s,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[h,f]of Object.entries(n.headers))o=Mr(o,h,f);const c=r._removeEmptyFolders(t),u=r._getFinalPath(c),d=await(e=="PUT"?ua:xt)(r.fetch,`${r.url}/object/${u}`,i,we({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,s){return this.uploadOrUpdate("POST",e,t,s)}async uploadToSignedUrl(e,t,s,n){var r=this;const i=r._removeEmptyFolders(e),a=r._getFinalPath(i),o=new URL(r.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),r.handleOperation(async()=>{let l;const c=we(we({},fl),n);let u=we(we({},r.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",r.encodeMetadata(d)),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.append("metadata",r.encodeMetadata(d))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=r.toBase64(r.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[h,f]of Object.entries(n.headers))u=Mr(u,h,f);return{path:i,fullPath:(await ua(r.fetch,o.toString(),l,we({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var s=this;return s.handleOperation(async()=>{let n=s._getFinalPath(e);const r=we({},s.headers);t!=null&&t.upsert&&(r["x-upsert"]="true");const i=await xt(s.fetch,`${s.url}/object/upload/sign/${n}`,{},{headers:r}),a=new URL(s.url+i.url),o=a.searchParams.get("token");if(!o)throw new ui("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}async update(e,t,s){return this.uploadOrUpdate("PUT",e,t,s)}async move(e,t,s){var n=this;return n.handleOperation(async()=>await xt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers}))}async copy(e,t,s){var n=this;return n.handleOperation(async()=>({path:(await xt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,s){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const i=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let a=await xt(n.fetch,`${n.url}/object/sign/${r}`,we({expiresIn:t},i?{transform:s.transform}:{}),{headers:n.headers});const o=new URLSearchParams;s!=null&&s.download&&o.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&o.set("cacheNonce",String(s.cacheNonce));const l=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,s){var n=this;return n.handleOperation(async()=>{const r=await xt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=new URLSearchParams;s!=null&&s.download&&i.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&i.set("cacheNonce",String(s.cacheNonce));const a=i.toString();return r.map(o=>we(we({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,s){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",r=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const i=r.toString(),a=this._getFinalPath(e),o=()=>zn(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new $0(o,this.shouldThrowOnError)}async info(e){var t=this;const s=t._getFinalPath(e);return t.handleOperation(async()=>ca(await zn(t.fetch,`${t.url}/object/info/${s}`,{headers:t.headers})))}async exists(e){var t=this;const s=t._getFinalPath(e);try{return await C0(t.fetch,`${t.url}/object/${s}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(di(r)){var n;const i=r instanceof la?r.status:r instanceof Nu?(n=r.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const s=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const r=n.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}`)+(r?`?${r}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Da(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,s){var n=this;return n.handleOperation(async()=>{const r=we(we(we({},N0),t),{},{prefix:e||""});return await xt(n.fetch,`${n.url}/object/list/${n.bucketId}`,r,{headers:n.headers},s)})}async listV2(e,t){var s=this;return s.handleOperation(async()=>{const n=we({},e);return await xt(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,n,{headers:s.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 P0="2.105.4",sr={"X-Client-Info":`storage-js/${P0}`};var L0=class extends dn{constructor(e,t={},s,n){const r=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase."));const i=r.href.replace(/\/$/,""),a=we(we({},sr),t);super(i,a,s,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=t.listBucketOptionsToQueryString(e);return await zn(t.fetch,`${t.url}/bucket${s}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await zn(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var s=this;return s.handleOperation(async()=>await xt(s.fetch,`${s.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async updateBucket(e,t){var s=this;return s.handleOperation(async()=>await ua(s.fetch,`${s.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await xt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Da(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():""}},M0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),t);super(n,r,s,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await xt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&s.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&s.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&s.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&s.set("sortOrder",e.sortOrder),e!=null&&e.search&&s.set("search",e.search);const n=s.toString(),r=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await zn(t.fetch,r,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Da(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!S0(e))throw new ui("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 s=new v0({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(s,{get(r,i){const a=r[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(r,o),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},j0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var s=this;return s.handleOperation(async()=>await ct.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var s=this;return s.handleOperation(async()=>await ct.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers})||{})}},D0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"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 ct.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ct.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 ct.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ct.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 ct.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},U0=class extends dn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=we(we({},sr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ct.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},B0=class extends U0{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new H0(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,s=this;return t().call(s,e)}async getBucket(e){var t=()=>super.getBucket,s=this;return t().call(s,e)}async listBuckets(e={}){var t=()=>super.listBuckets,s=this;return t().call(s,e)}async deleteBucket(e){var t=()=>super.deleteBucket,s=this;return t().call(s,e)}},H0=class extends j0{constructor(e,t,s,n){super(e,t,n),this.vectorBucketName=s}async createIndex(e){var t=()=>super.createIndex,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,s=this;return t().call(s,s.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,s=this;return t().call(s,s.vectorBucketName,e)}index(e){return new F0(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},F0=class extends D0{constructor(e,t,s,n,r){super(e,t,r),this.vectorBucketName=s,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(e){var t=()=>super.getVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,s=this;return t().call(s,we(we({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},V0=class extends L0{constructor(e,t={},s,n){super(e,t,s,n)}from(e){return new I0(this.url,this.headers,e,this.fetch)}get vectors(){return new B0(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new M0(this.url+"/iceberg",this.headers,this.fetch)}};const Lu="2.105.4",Ys=30*1e3,da=3,$i=da*Ys,q0="http://localhost:9999",z0="supabase.auth.token",K0={"X-Client-Info":`gotrue-js/${Lu}`},ha="X-Supabase-Api-Version",Mu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},W0=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,G0=10*60*1e3;class Kn extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function re(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Z0 extends Kn{constructor(t,s,n){super(t,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function J0(e){return re(e)&&e.name==="AuthApiError"}class Et extends Kn{constructor(t,s){super(t),this.name="AuthUnknownError",this.originalError=s}}class is extends Kn{constructor(t,s,n,r){super(t,n,r),this.name=s,this.status=n}}class Je extends is{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function fr(e){return re(e)&&e.name==="AuthSessionMissingError"}class Vs extends is{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class pr extends is{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class gr extends is{constructor(t,s=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Y0(e){return re(e)&&e.name==="AuthImplicitGrantRedirectError"}class pl extends is{constructor(t,s=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class X0 extends is{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 fa extends is{constructor(t,s){super(t,"AuthRetryableFetchError",s,void 0)}}function Ni(e){return re(e)&&e.name==="AuthRetryableFetchError"}class gl extends is{constructor(t,s,n){super(t,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class pa extends is{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ml=`
56
+ \r=`.split(""),Q0=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<ml.length;t+=1)e[ml[t].charCodeAt(0)]=-2;for(let t=0;t<jr.length;t+=1)e[jr[t].charCodeAt(0)]=t;return e})();function bl(e,t,s){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(jr[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(jr[n]),t.queuedBits-=6}}function ju(e,t,s){const n=Q0[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)s(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function vl(e){const t=[],s=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=a=>{sm(a,n,s)};for(let a=0;a<e.length;a+=1)ju(e.charCodeAt(a),r,i);return t.join("")}function em(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 tm(e,t){for(let s=0;s<e.length;s+=1){let n=e.charCodeAt(s);if(n>55295&&n<=56319){const r=(n-55296)*1024&65535;n=(e.charCodeAt(s+1)-56320&65535|r)+65536,s+=1}em(n,t)}}function sm(e,t,s){if(t.utf8seq===0){if(e<=127){s(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&s(t.codepoint)}}function an(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};for(let r=0;r<e.length;r+=1)ju(e.charCodeAt(r),s,n);return new Uint8Array(t)}function nm(e){const t=[];return tm(e,s=>t.push(s)),new Uint8Array(t)}function $s(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};return e.forEach(r=>bl(r,s,n)),bl(null,s,n),t.join("")}function rm(e){return Math.round(Date.now()/1e3)+e}function im(){return Symbol("auth-callback")}const Xe=()=>typeof window<"u"&&typeof document<"u",xs={tested:!1,writable:!1},Du=()=>{if(!Xe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xs.tested)return xs.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),xs.tested=!0,xs.writable=!0}catch{xs.tested=!0,xs.writable=!1}return xs.writable};function am(e){const t={},s=new URL(e);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((r,i)=>{t[i]=r})}catch{}return s.searchParams.forEach((n,r)=>{t[r]=n}),t}const Uu=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),om=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Xs=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Es=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Ye=async(e,t)=>{await e.removeItem(t)};class hi{constructor(){this.promise=new hi.promiseConstructor((t,s)=>{this.resolve=t,this.reject=s})}}hi.promiseConstructor=Promise;function mr(e){const t=e.split(".");if(t.length!==3)throw new pa("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!W0.test(t[n]))throw new pa("JWT not in base64url format");return{header:JSON.parse(vl(t[0])),payload:JSON.parse(vl(t[1])),signature:an(t[2]),raw:{header:t[0],payload:t[1]}}}async function lm(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function cm(e,t){return new Promise((n,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await e(i);if(!t(i,null,a)){n(a);return}}catch(a){if(!t(i,a)){r(a);return}}})()})}function um(e){return("0"+e.toString(16)).substr(-2)}function dm(){const t=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let r="";for(let i=0;i<56;i++)r+=s.charAt(Math.floor(Math.random()*n));return r}return crypto.getRandomValues(t),Array.from(t,um).join("")}async function hm(e){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(i=>String.fromCharCode(i)).join("")}async function fm(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 s=await hm(e);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function qs(e,t,s=!1){const n=dm();let r=n;s&&(r+="/recovery"),await Xs(e,`${t}-code-verifier`,r);const i=await fm(n);return[i,n===i?"plain":"s256"]}const pm=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function gm(e){const t=e.headers.get(ha);if(!t||!t.match(pm))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function mm(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 bm(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 vm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function zt(e){if(!vm.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function wt(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 Ii(){const e={};return new Proxy(e,{get:(t,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ym(e,t){return new Proxy(e,{get:(s,n,r)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,n,r)}return!t.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(s,n,r)}})}function yl(e){return JSON.parse(JSON.stringify(e))}const Ss=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)},_m=[502,503,504,520,521,522,523,524,530];async function _l(e){var t;if(!om(e))throw new fa(Ss(e),0);if(_m.includes(e.status))throw new fa(Ss(e),e.status);let s;try{s=await e.json()}catch(i){throw new Et(Ss(i),i)}let n;const r=gm(e);if(r&&r.getTime()>=Mu["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new gl(Ss(s),e.status,((t=s.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Je}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new gl(Ss(s),e.status,s.weak_password.reasons);throw new Z0(Ss(s),e.status||500,n)}const wm=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),r.body=JSON.stringify(n),Object.assign(Object.assign({},r),s))};async function le(e,t,s,n){var r;const i=Object.assign({},n==null?void 0:n.headers);i[ha]||(i[ha]=Mu["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(r=n==null?void 0:n.query)!==null&&r!==void 0?r:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await xm(e,t,s+o,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function xm(e,t,s,n,r,i){const a=wm(t,n,r,i);let o;try{o=await e(s,Object.assign({},a))}catch(l){throw console.error(l),new fa(Ss(l),0)}if(o.ok||await _l(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await _l(l)}}function bt(e){var t;let s=null;Sm(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=rm(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:s,user:n},error:null}}function wl(e){const t=bt(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((s,n)=>s&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function fs(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Em(e){return{data:e,error:null}}function km(e){const{action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i}=e,a=ci(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function xl(e){return e}function Sm(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Pi=["global","local","others"];class Tm{constructor({url:t="",headers:s={},fetch:n,experimental:r}){this.url=t,this.headers=s,this.fetch=Uu(n),this.experimental=r??{},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,s=Pi[0]){if(Pi.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Pi.join(", ")}`);try{return await le(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,s={}){try{return await le(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:s}=t,n=ci(t,["options"]),r=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(r.new_email=n==null?void 0:n.newEmail,delete r.newEmail),await le(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:km,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(re(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(t){try{return await le(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:fs})}catch(s){if(re(s))return{data:{user:null},error:s};throw s}}async listUsers(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await le(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const d=await u.json(),h=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=b}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(re(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){zt(t);try{return await le(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:fs})}catch(s){if(re(s))return{data:{user:null},error:s};throw s}}async updateUserById(t,s){zt(t);try{return await le(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:s,headers:this.headers,xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,s=!1){zt(t);try{return await le(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:s},xform:fs})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){zt(t.userId);try{const{data:s,error:n}=await le(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:s,error:n}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _deleteFactor(t){zt(t.userId),zt(t.id);try{return{data:await le(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _listOAuthClients(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await le(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const d=await u.json(),h=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=b}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(re(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await le(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _getOAuthClient(t){try{return await le(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _updateOAuthClient(t,s){try{return await le(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await le(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(t){try{return await le(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _listCustomProviders(t){try{const s={};return t!=null&&t.type&&(s.type=t.type),await le(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:n=>{var r;return{data:{providers:(r=n==null?void 0:n.providers)!==null&&r!==void 0?r:[]},error:null}}})}catch(s){if(re(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(t){try{return await le(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _getCustomProvider(t){try{return await le(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _updateCustomProvider(t,s){try{return await le(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await le(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}async _adminListPasskeys(t){wt(this.experimental),zt(t.userId);try{return await le(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(re(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(t){wt(this.experimental),zt(t.userId),zt(t.passkeyId);try{return await le(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(re(s))return{data:null,error:s};throw s}}}function El(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const $t={debug:!!(globalThis&&Du()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Bu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class kl extends Bu{}async function Am(e,t,s){$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let r;t>0&&(r=setTimeout(()=>{n.abort(),$t.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:n.signal},async i=>{if(i){clearTimeout(r),$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await s()}finally{$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw $t.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new kl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if($t.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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(r),await s()}})}catch(i){if(t>0&&clearTimeout(r),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(n.signal.aborted)return $t.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 a=>{if(a){$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,a.name);try{return await s()}finally{$t.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await s()}));throw $t.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new kl(`Lock "${e}" was released because another request stole it`)}throw i}}function Rm(){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 Hu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Cm(e){return parseInt(e,16)}function Om(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function $m(e){var t;const{chainId:s,domain:n,expirationTime:r,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:h}=e;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);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=Hu(e.address),g=u?`${u}://${n}`:n,b=e.statement?`${e.statement}
58
58
  `:"",S=`${g} wants you to sign in with your Ethereum account:
59
59
  ${f}
60
60
 
61
- ${m}`;let E=`URI: ${d}
61
+ ${b}`;let E=`URI: ${d}
62
62
  Version: ${h}
63
63
  Chain ID: ${s}${a?`
64
64
  Nonce: ${a}`:""}
@@ -68,19 +68,19 @@ Not Before: ${o.toISOString()}`),l&&(E+=`
68
68
  Request ID: ${l}`),c){let x=`
69
69
  Resources:`;for(const k of c){if(!k||typeof k!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${k}`);x+=`
70
70
  - ${k}`}E+=x}return`${S}
71
- ${E}`}class qe extends Error{constructor({message:t,code:s,cause:n,name:r}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=r??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Dr extends qe{constructor(t,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:t}),this.name="WebAuthnUnknownError",this.originalError=s}}function Nm({error:e,options:t}){var s,n,r;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 qe({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new qe({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new qe({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new qe({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 qe({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new qe({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new qe({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(Fu(a)){if(i.rp.id!==a)return new qe({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({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 qe({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 qe({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 qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Im({error:e,options:t}){const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new qe({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Fu(n)){if(s.rpId!==n)return new qe({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new qe({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 qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Pm{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}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 ga=new Pm;function Sl(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:s,excludeCredentials:n}=e,r=ci(e,["challenge","user","excludeCredentials"]),i=an(t).buffer,a=Object.assign(Object.assign({},s),{id:an(s.id).buffer}),o=Object.assign(Object.assign({},r),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:an(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function Tl(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:s}=e,n=ci(e,["challenge","allowCredentials"]),r=an(t).buffer,i=Object.assign(Object.assign({},n),{challenge:r});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let a=0;a<s.length;a++){const o=s[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:an(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function Al(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e;return{id:e.id,rawId:e.id,response:{attestationObject:Os(new Uint8Array(e.response.attestationObject)),clientDataJSON:Os(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Rl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e,n=e.getClientExtensionResults(),r=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Os(new Uint8Array(r.authenticatorData)),clientDataJSON:Os(new Uint8Array(r.clientDataJSON)),signature:Os(new Uint8Array(r.signature)),userHandle:r.userHandle?Os(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Fu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ur(){var e,t;return!!(Xe()&&"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 Vu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:Nm({error:t,options:e})}}}async function qu(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:Im({error:t,options:e})}}}const Lm={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Mm={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Br(...e){const t=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),s=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),n={};for(const r of e)if(r)for(const i in r){const a=r[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(s(a))n[i]=a;else if(t(a)){const o=n[i];t(o)?n[i]=Br(o,a):n[i]=Br(a)}else n[i]=a}return n}function jm(e,t){return Br(Lm,e,t||{})}function Dm(e,t){return Br(Mm,e,t||{})}class Um{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:s,friendlyName:n,signal:r},i){var a;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:s});if(!o)return{data:null,error:l};const c=r??ga.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=n;if(d)u.name=`${u.id}:${d}`;else{const f=(await this.client.getUser()).data.user,g=((a=f==null?void 0:f.user_metadata)===null||a===void 0?void 0:a.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(o.webauthn.type){case"create":{const u=jm(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:h}=await Vu({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=Dm(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:h}=await qu(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(o){return re(o)?{data:null,error:o}:{data:null,error:new Et("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Kn("rpId is required for WebAuthn authentication")};try{if(!Ur())return{data:null,error:new Et("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:t,webauthn:{rpId:s,rpOrigins:n},signal:r},{request:i});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:n,credential_response:l.credential_response}})}catch(a){return re(a)?{data:null,error:a}:{data:null,error:new Et("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Kn("rpId is required for WebAuthn registration")};try{if(!Ur())return{data:null,error:new Et("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:s,rpOrigins:n},signal:r},{create:i});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return re(a)?{data:null,error:a}:{data:null,error:new Et("Unexpected error in register",a)}}}}Rm();const Bm={url:q0,storageKey:z0,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:K0,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Cl(e,t,s){return await s()}const qs={};class Wn{get jwks(){var t,s;return(s=(t=qs[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(t){qs[this.storageKey]=Object.assign(Object.assign({},qs[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,s;return(s=(t=qs[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){qs[this.storageKey]=Object.assign(Object.assign({},qs[this.storageKey]),{cachedAt:t})}constructor(t){var s,n,r,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 a=Object.assign(Object.assign({},Bm),t);if(this.storageKey=a.storageKey,this.instanceID=(s=Wn.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Wn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Xe()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new Tm({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=Uu(a.fetch),this.lock=a.lock||Cl,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&Xe()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=Am:this.lock=Cl,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 Um(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?(a.storage?this.storage=a.storage:Du()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=El(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=El(this.memoryStorage)),Xe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Lu}) ${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 s={},n="none";if(Xe()&&(s=am(window.location.href),this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce")),Xe()&&this.detectSessionInUrl&&n!=="none"){const{data:r,error:i}=await this._getSessionFromURL(s,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Y0(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:a,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return re(s)?this._returnResult({error:s}):this._returnResult({error:new Et("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var s,n,r;try{const i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}},xform:bt}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(re(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var s,n,r;try{let i;if("email"in t){const{email:u,password:d,options:h}=t;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await Vs(this.storage,this.storageKey)),i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:u,password:d,data:(s=h==null?void 0:h.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:f,code_challenge_method:g},xform:bt})}else if("phone"in t){const{phone:u,password:d,options:h}=t;i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},channel:(r=h==null?void 0:h.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:bt})}else throw new pr("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await Ye(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let s;if("email"in t){const{email:i,password:a,options:o}=t;s=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:wl})}else if("phone"in t){const{phone:i,password:a,options:o}=t;s=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:wl})}else throw new pr("You must provide either an email or phone number and a password");const{data:n,error:r}=s;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const i=new Fs;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(t){var s,n,r,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(r=t.options)===null||r===void 0?void 0:r.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:s}=t;switch(s){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(t){var s,n,r,i,a,o,l,c,u,d,h;let f,g;if("message"in t)f=t.message,g=t.signature;else{const{chain:m,wallet:S,statement:E,options:x}=t;let k;if(Xe())if(typeof S=="object")k=S;else{const j=window;if("ethereum"in j&&typeof j.ethereum=="object"&&"request"in j.ethereum&&typeof j.ethereum.request=="function")k=j.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 S!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=S}const P=new URL((s=x==null?void 0:x.url)!==null&&s!==void 0?s:window.location.href),N=await k.request({method:"eth_requestAccounts"}).then(j=>j).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!N||N.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const R=Hu(N[0]);let v=(n=x==null?void 0:x.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!v){const j=await k.request({method:"eth_chainId"});v=Cm(j)}const C={domain:P.host,address:R,statement:E,uri:P.href,version:"1",chainId:v,nonce:(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(a=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=x==null?void 0:x.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=$m(C),g=await k.request({method:"personal_sign",params:[Om(f),R]})}try{const{data:m,error:S}=await le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:bt});if(S)throw S;if(!m||!m.session||!m.user){const E=new Fs;return this._returnResult({data:{user:null,session:null},error:E})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:S})}catch(m){if(re(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(t){var s,n,r,i,a,o,l,c,u,d,h,f;let g,m;if("message"in t)g=t.message,m=t.signature;else{const{chain:S,wallet:E,statement:x,options:k}=t;let P;if(Xe())if(typeof E=="object")P=E;else{const R=window;if("solana"in R&&typeof R.solana=="object"&&("signIn"in R.solana&&typeof R.solana.signIn=="function"||"signMessage"in R.solana&&typeof R.solana.signMessage=="function"))P=R.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=E}const N=new URL((s=k==null?void 0:k.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in P&&P.signIn){const R=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},k==null?void 0:k.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),x?{statement:x}:null));let v;if(Array.isArray(R)&&R[0]&&typeof R[0]=="object")v=R[0];else if(R&&typeof R=="object"&&"signedMessage"in R&&"signature"in R)v=R;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in v&&"signature"in v&&(typeof v.signedMessage=="string"||v.signedMessage instanceof Uint8Array)&&v.signature instanceof Uint8Array)g=typeof v.signedMessage=="string"?v.signedMessage:new TextDecoder().decode(v.signedMessage),m=v.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${N.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(r=(n=k==null?void 0:k.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((i=k==null?void 0:k.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${k.signInWithSolana.notBefore}`]:[],...!((a=k==null?void 0:k.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${k.signInWithSolana.expirationTime}`]:[],...!((o=k==null?void 0:k.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${k.signInWithSolana.chainId}`]:[],...!((l=k==null?void 0:k.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${k.signInWithSolana.nonce}`]:[],...!((c=k==null?void 0:k.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${k.signInWithSolana.requestId}`]:[],...!((d=(u=k==null?void 0:k.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...k.signInWithSolana.resources.map(v=>`- ${v}`)]:[]].join(`
72
- `);const R=await P.signMessage(new TextEncoder().encode(g),"utf8");if(!R||!(R instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=R}}try{const{data:S,error:E}=await le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Os(m)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:bt});if(E)throw E;if(!S||!S.session||!S.user){const x=new Fs;return this._returnResult({data:{user:null,session:null},error:x})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:E})}catch(S){if(re(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async _exchangeCodeForSession(t){const s=await Es(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(s??"").split("/");try{if(!n&&this.flowType==="pkce")throw new X0;const{data:i,error:a}=await le(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:bt});if(await Ye(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Fs;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(r==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:r??null}),error:a})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:s,provider:n,token:r,access_token:i,nonce:a}=t,o=await le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:bt}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Fs;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(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(t){var s,n,r,i,a;try{if("email"in t){const{email:o,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Vs(this.storage,this.storageKey));const{error:d}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in t){const{phone:o,options:l}=t,{data:c,error:u}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},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:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new pr("You must provide either an email or phone number.")}catch(o){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(t){var s,n;try{let r,i;"options"in t&&(r=(s=t.options)===null||s===void 0?void 0:s.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await le(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:bt});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.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(r){if(re(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(t){var s,n,r,i,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await Vs(this.storage,this.storageKey));const c=await le(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(s=t.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n:void 0}),!((r=t==null?void 0:t.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Em});return!((i=c.data)===null||i===void 0)&&i.url&&Xe()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:null,error:o});throw o}}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:s},error:n}=t;if(n)throw n;if(!s)throw new Je;const{error:r}=await le(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(t){if(re(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const s=`${this.url}/resend`;if("email"in t){const{email:n,type:r,options:i}=t,{error:a}=await le(this.fetch,"POST",s,{headers:this.headers,body:{email:n,type:r,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:a})}else if("phone"in t){const{phone:n,type:r,options:i}=t,{data:a,error:o}=await le(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new pr("You must provide either an email or phone number and a type")}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(t,s){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await n,await s()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await t(s)}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 s=await Es(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?t=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<$i:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await Es(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Ii()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=ym(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(t){try{return t?await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:fs}):await this._useSession(async s=>{var n,r,i;const{data:a,error:o}=s;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Je}:await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:fs})})}catch(s){if(re(s))return fr(s)&&(await this._removeSession(),await Ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(t,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,s))}async _updateUser(t,s={}){try{return await this._useSession(async n=>{const{data:r,error:i}=n;if(i)throw i;if(!r.session)throw new Je;const a=r.session;let o=null,l=null;this.flowType==="pkce"&&t.email!=null&&([o,l]=await Vs(this.storage,this.storageKey));const{data:c,error:u}=await le(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:fs});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(n))return this._returnResult({data:{user:null},error:n});throw n}}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 Je;const s=Date.now()/1e3;let n=s,r=!0,i=null;const{payload:a}=mr(t.access_token);if(a.exp&&(n=a.exp,r=n<=s),r){const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,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:o.user,token_type:"bearer",expires_in:n-s,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(re(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}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 s=>{var n;if(!t){const{data:a,error:o}=s;if(o)throw o;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Je;const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(t,s){var n;try{if(!Xe())throw new gr("No browser detected.");if(t.error||t.error_description||t.error_code)throw new gr(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new pl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new gr("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new pl("No code detected.");const{data:k,error:P}=await this._exchangeCodeForSession(t.code);if(P)throw P;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:k.session,redirectType:(n=k.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!a||!l||!o||!u)throw new gr("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const g=f-d;g*1e3<=Js&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${h}s`);const m=f-h;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,d);const{data:S,error:E}=await this._getUser(a);if(E)throw E;const x={provider_token:r,provider_refresh_token:i,access_token:a,expires_in:h,expires_at:f,refresh_token:o,token_type:u,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:t.type},error:null})}catch(r){if(re(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_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 s=await Es(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&s)}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 s=>{var n;const{data:r,error:i}=s;if(i&&!fr(i))return this._returnResult({error:i});const a=(n=r.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,t);if(o&&!(J0(o)&&(o.status===404||o.status===401||o.status===403)||fr(o)))return this._returnResult({error:o})}return t!=="others"&&(await this._removeSession(),await Ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const s=im(),n={id:s,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async s=>{var n,r;try{const{data:{session:i},error:a}=s;if(a)throw a;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),fr(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,s={}){let n=null,r=null;this.flowType==="pkce"&&([n,r]=await Vs(this.storage,this.storageKey,!0));try{return await le(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=s.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var s;try{const{data:n,error:r}=await this._useSession(async i=>{var a,o,l,c,u;const{data:d,error:h}=i;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await le(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(r)throw r;return Xe()&&!(!((s=t.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(re(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async s=>{var n;try{const{error:r,data:{session:i}}=s;if(r)throw r;const{options:a,provider:o,token:l,access_token:c,nonce:u}=t,d=await le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:bt}),{data:h,error:f}=d;return f?this._returnResult({data:{user:null,session:null},error:f}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Fs}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:f}))}catch(r){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)throw a;return await le(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(r=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&r!==void 0?r:void 0})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(t){const s=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await cm(async r=>(r>0&&await lm(200*Math.pow(2,r-1)),this._debug(s,"refreshing attempt",r),await le(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:bt})),(r,i)=>{const a=200*Math.pow(2,r);return i&&Ni(i)&&Date.now()+a-n<Js})}catch(n){if(this._debug(s,"error",n),re(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(s,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,s){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",s,"url",n),Xe()&&!s.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,s;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const r=await Es(this.storage,this.storageKey);if(r&&this.userStorage){let a=await Es(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:r.user},await Ys(this.userStorage,this.storageKey+"-user",a)),r.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Ii()}else if(r&&!r.user&&!r.user){const a=await Es(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(r.user=a.user,await Ye(this.storage,this.storageKey+"-user"),await Ys(this.storage,this.storageKey,r)):r.user=Ii()}if(this._debug(n,"session from storage",r),!this._isValidSession(r)){this._debug(n,"session is not valid"),r!==null&&await this._removeSession();return}const i=((s=r.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<$i;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${$i}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(console.error(a),Ni(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(r.access_token);!o&&(a!=null&&a.user)?(r.user=a.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(n,"error",r),console.error(r);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var s,n;if(!t)throw new Je;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new hi;const{data:i,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!i.session)throw new Je;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(r,"error",i),re(i)){const a={data:null,error:i};return Ni(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(t,s,n=!0){const r=`#_notifyAllSubscribers(${t})`;this._debug(r,"begin",s,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:s});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,s)}catch(l){i.push(l)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(r,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Ye(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},t),n=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&s.user&&await Ys(this.userStorage,this.storageKey+"-user",{user:s.user});const r=Object.assign({},s);delete r.user;const i=yl(r);await Ys(this.storage,this.storageKey,i)}else{const r=yl(s);await Ys(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ye(this.storage,this.storageKey),await Ye(this.storage,this.storageKey+"-code-verifier"),await Ye(this.storage,this.storageKey+"-user"),this.userStorage&&await Ye(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Xe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Js);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((n.expires_at*1e3-t)/Js);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Js}ms, refresh threshold is ${da} ticks`),r<=da&&await this._callRefreshToken(n.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Bu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Xe()||!(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 s=`#_onVisibilityChanged(${t})`;this._debug(s,"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(s,"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,s,n){const r=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await Vs(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});r.push(o.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;return i?this._returnResult({data:null,error:i}):await le(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await le(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((r=l==null?void 0:l.totp)===null||r===void 0)&&r.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Al(t.webauthn.credential_response):Rl(t.webauthn.credential_response)})}:{code:t.code}),{data:o,error:l}=await le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=await le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Sl(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Tl(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(t){const{data:s,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:s.id,code:t.code})}async _listFactors(){var t;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=s==null?void 0:s.factors)!==null&&t!==void 0?t:[])r.all.push(i),i.status==="verified"&&r[i.factor_type].push(i);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(t){var s,n,r,i;if(t)try{const{payload:f}=mr(t);let g=null;f.aal&&(g=f.aal);let m=g;const{data:{user:S},error:E}=await this.getUser(t);if(E)return this._returnResult({data:null,error:E});((n=(s=S==null?void 0:S.factors)===null||s===void 0?void 0:s.filter(P=>P.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(m="aal2");const k=f.amr||[];return{data:{currentLevel:g,nextLevel:m,currentAuthenticationMethods:k},error:null}}catch(f){if(re(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:a},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=mr(a.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(r=a.user.factors)===null||r===void 0?void 0:r.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const h=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?await le(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Je})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Je});const a=await le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Je});const a=await le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;return n?this._returnResult({data:null,error:n}):s?await le(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Je})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?(await le(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Je})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(t,s={keys:[]}){let n=s.keys.find(o=>o.kid===t);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(o=>o.kid===t),n&&this.jwks_cached_at+G0>r)return n;const{data:i,error:a}=await le(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,n=i.keys.find(o=>o.kid===t),!n)?null:n}async getClaims(t,s={}){try{let n=t;if(!n){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});n=f.session.access_token}const{header:r,payload:i,signature:a,raw:{header:o,payload:l}}=mr(n);s!=null&&s.allowExpired||mm(i.exp);const c=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:r,signature:a},error:null}}const u=bm(r.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,nm(`${o}.${l}`)))throw new pa("Invalid JWT signature");return{data:{claims:i,header:r,signature:a},error:null}}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var s,n,r;wt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new Et("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const o=Tl(i.options),l=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:ga.createNewAbortSignal(),{data:c,error:u}=await qu({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Et("WebAuthn ceremony failed",null)});const d=Rl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:d})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var s,n;wt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new Et("Browser does not support WebAuthn",null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const a=Sl(r.options),o=(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:ga.createNewAbortSignal(),{data:l,error:c}=await Vu({publicKey:a,signal:o});if(c||!l)return this._returnResult({data:null,error:c??new Et("WebAuthn ceremony failed",null)});const u=Al(l);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(r){if(re(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyRegistration(){wt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Je});const{data:r,error:i}=await le(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{data:i,error:a}=await le(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(t){var s;wt(this.experimental);try{const{data:n,error:r}=await le(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:n,error:null})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){wt(this.experimental);try{const{data:s,error:n}=await le(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:bt});return n?this._returnResult({data:null,error:n}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){wt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Je});const{data:r,error:i}=await le(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{data:i,error:a}=await le(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{error:i}=await le(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}}Wn.nextInstanceID={};const Hm=Wn,Fm="2.105.4";let wn="";typeof Deno<"u"?wn="deno":typeof document<"u"?wn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wn="react-native":wn="node";const Vm={"X-Client-Info":`supabase-js-${wn}/${Fm}`},qm={headers:Vm},zm={schema:"public"},Km={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Wm={};function Gn(e){"@babel/helpers - typeof";return Gn=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},Gn(e)}function Gm(e,t){if(Gn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Gn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zm(e){var t=Gm(e,"string");return Gn(t)=="symbol"?t:t+""}function Jm(e,t,s){return(t=Zm(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Ol(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function He(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Ol(Object(s),!0).forEach(function(n){Jm(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ol(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}const Ym=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Xm=()=>Headers,Qm=(e,t,s)=>{const n=Ym(s),r=Xm();return async(i,a)=>{var o;const l=(o=await t())!==null&&o!==void 0?o:e;let c=new r(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,He(He({},a),{},{headers:c}))}};function eb(e){return e.endsWith("/")?e:e+"/"}function tb(e,t){var s,n;const{db:r,auth:i,realtime:a,global:o}=e,{db:l,auth:c,realtime:u,global:d}=t,h={db:He(He({},l),r),auth:He(He({},c),i),realtime:He(He({},u),a),storage:{},global:He(He(He({},d),o),{},{headers:He(He({},(s=d==null?void 0:d.headers)!==null&&s!==void 0?s:{}),(n=o==null?void 0:o.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function sb(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(eb(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var nb=class extends Hm{constructor(e){super(e)}},rb=class{constructor(e,t,s){var n,r;this.supabaseUrl=e,this.supabaseKey=t;const i=sb(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:zm,realtime:Wm,auth:He(He({},Km),{},{storageKey:a}),global:qm},l=tb(s??{},o);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(r=l.global.headers)!==null&&r!==void 0?r:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} 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=Qm(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(He({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 Og(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 V0(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new _g(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={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,s)}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,s;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(s=n.session)===null||s===void 0?void 0:s.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:h},f,g){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nb({url:this.authUrl.href,headers:He(He({},m),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:d,skipAutoInitialize:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new h0(this.realtimeUrl.href,He(He({},e),{},{params:He(He({},{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,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const ib=(e,t,s)=>new rb(e,t,s);function ab(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const s=t.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}ab()&&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 br=null,vr=null;async function zu(){if(vr)return vr;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return vr=await e.json(),vr}catch{return{authEnabled:!1,supabaseUrl:null,supabaseAnonKey:null}}}async function Qs(){if(br)return br;const e=await zu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(br=ib(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),br)}const nr=lu("auth",()=>{const e=Q(null),t=Q(null),s=Q(!1),n=Q(!1),r=Q(!1);let i=null;async function a(){const d=await zu();if(r.value=d.authEnabled,!d.authEnabled){n.value=!0;return}const h=await Qs();if(!h){n.value=!0;return}await new Promise(f=>{h.auth.onAuthStateChange((g,m)=>{t.value=m,e.value=(m==null?void 0:m.user)??null,g==="INITIAL_SESSION"&&f()})}),n.value=!0}async function o(){if(!n.value)return i||(i=a().catch(()=>{i=null})),i}async function l(d,h){const f=await Qs();if(!f)return"Auth not configured";s.value=!0;try{const{error:g}=await f.auth.signInWithPassword({email:d,password:h});return g?g.message:null}finally{s.value=!1}}async function c(){const d=await Qs();d&&await d.auth.signOut(),e.value=null,t.value=null}async function u(){var f,g;if(!r.value)return null;const d=await Qs();if(!d)return((f=t.value)==null?void 0:f.access_token)??null;const{data:h}=await d.auth.getSession();return h.session?(t.value=h.session,e.value=h.session.user,h.session.access_token):((g=t.value)==null?void 0:g.access_token)??null}return{user:e,session:t,loading:s,initialized:n,authEnabled:r,init:o,signIn:l,signOut:c,getAccessToken:u}});async function Ce(e,t){const s=nr(),n=await s.getAccessToken(),r=new Headers(t==null?void 0:t.headers);n&&r.set("Authorization",`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401&&s.authEnabled){const a=await Qs();if(a){const{data:o,error:l}=await a.auth.refreshSession();if(o.session){const c=new Headers(t==null?void 0:t.headers);return c.set("Authorization",`Bearer ${o.session.access_token}`),fetch(e,{...t,headers:c})}l||await s.signOut()}}return i}async function fi(e){const s=await nr().getAccessToken();if(!s)return e;const n=e.includes("?")?"&":"?";return`${e}${n}token=${encodeURIComponent(s)}`}function ob(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ku(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 s=e[t],n=typeof s;(n==="object"||n==="function")&&!Object.isFrozen(s)&&Ku(s)}),e}class $l{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Wu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ps(e,...t){const s=Object.create(null);for(const n in e)s[n]=e[n];return t.forEach(function(n){for(const r in n)s[r]=n[r]}),s}const lb="</span>",Nl=e=>!!e.scope,cb=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const s=e.split(".");return[`${t}${s.shift()}`,...s.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class ub{constructor(t,s){this.buffer="",this.classPrefix=s.classPrefix,t.walk(this)}addText(t){this.buffer+=Wu(t)}openNode(t){if(!Nl(t))return;const s=cb(t.scope,{prefix:this.classPrefix});this.span(s)}closeNode(t){Nl(t)&&(this.buffer+=lb)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Il=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Ua{constructor(){this.rootNode=Il(),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 s=Il({scope:t});this.add(s),this.stack.push(s)}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,s){return typeof s=="string"?t.addText(s):s.children&&(t.openNode(s),s.children.forEach(n=>this._walk(t,n)),t.closeNode(s)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(s=>typeof s=="string")?t.children=[t.children.join("")]:t.children.forEach(s=>{Ua._collapse(s)}))}}class db extends Ua{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,s){const n=t.root;s&&(n.scope=`language:${s}`),this.add(n)}toHTML(){return new ub(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Zn(e){return e?typeof e=="string"?e:e.source:null}function Gu(e){return js("(?=",e,")")}function hb(e){return js("(?:",e,")*")}function fb(e){return js("(?:",e,")?")}function js(...e){return e.map(s=>Zn(s)).join("")}function pb(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Ba(...e){return"("+(pb(e).capture?"":"?:")+e.map(n=>Zn(n)).join("|")+")"}function Zu(e){return new RegExp(e.toString()+"|").exec("").length-1}function gb(e,t){const s=e&&e.exec(t);return s&&s.index===0}const mb=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ha(e,{joinWith:t}){let s=0;return e.map(n=>{s+=1;const r=s;let i=Zn(n),a="";for(;i.length>0;){const o=mb.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+r):(a+=o[0],o[0]==="("&&s++)}return a}).map(n=>`(${n})`).join(t)}const bb=/\b\B/,Ju="[a-zA-Z]\\w*",Fa="[a-zA-Z_]\\w*",Yu="\\b\\d+(\\.\\d+)?",Xu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Qu="\\b(0b[01]+)",vb="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",yb=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=js(t,/.*\b/,e.binary,/\b.*/)),ps({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(s,n)=>{s.index!==0&&n.ignoreMatch()}},e)},Jn={begin:"\\\\[\\s\\S]",relevance:0},_b={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Jn]},wb={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Jn]},xb={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/},pi=function(e,t,s={}){const n=ps({scope:"comment",begin:e,end:t,contains:[]},s);n.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 r=Ba("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 n.contains.push({begin:js(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},Eb=pi("//","$"),kb=pi("/\\*","\\*/"),Sb=pi("#","$"),Tb={scope:"number",begin:Yu,relevance:0},Ab={scope:"number",begin:Xu,relevance:0},Rb={scope:"number",begin:Qu,relevance:0},Cb={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Jn,{begin:/\[/,end:/\]/,relevance:0,contains:[Jn]}]},Ob={scope:"title",begin:Ju,relevance:0},$b={scope:"title",begin:Fa,relevance:0},Nb={begin:"\\.\\s*"+Fa,relevance:0},Ib=function(e){return Object.assign(e,{"on:begin":(t,s)=>{s.data._beginMatch=t[1]},"on:end":(t,s)=>{s.data._beginMatch!==t[1]&&s.ignoreMatch()}})};var yr=Object.freeze({__proto__:null,APOS_STRING_MODE:_b,BACKSLASH_ESCAPE:Jn,BINARY_NUMBER_MODE:Rb,BINARY_NUMBER_RE:Qu,COMMENT:pi,C_BLOCK_COMMENT_MODE:kb,C_LINE_COMMENT_MODE:Eb,C_NUMBER_MODE:Ab,C_NUMBER_RE:Xu,END_SAME_AS_BEGIN:Ib,HASH_COMMENT_MODE:Sb,IDENT_RE:Ju,MATCH_NOTHING_RE:bb,METHOD_GUARD:Nb,NUMBER_MODE:Tb,NUMBER_RE:Yu,PHRASAL_WORDS_MODE:xb,QUOTE_STRING_MODE:wb,REGEXP_MODE:Cb,RE_STARTERS_RE:vb,SHEBANG:yb,TITLE_MODE:Ob,UNDERSCORE_IDENT_RE:Fa,UNDERSCORE_TITLE_MODE:$b});function Pb(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Lb(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Mb(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Pb,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function jb(e,t){Array.isArray(e.illegal)&&(e.illegal=Ba(...e.illegal))}function Db(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 Ub(e,t){e.relevance===void 0&&(e.relevance=1)}const Bb=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const s=Object.assign({},e);Object.keys(e).forEach(n=>{delete e[n]}),e.keywords=s.keywords,e.begin=js(s.beforeMatch,Gu(s.begin)),e.starts={relevance:0,contains:[Object.assign(s,{endsParent:!0})]},e.relevance=0,delete s.beforeMatch},Hb=["of","and","for","in","not","or","if","then","parent","list","value"],Fb="keyword";function ed(e,t,s=Fb){const n=Object.create(null);return typeof e=="string"?r(s,e.split(" ")):Array.isArray(e)?r(s,e):Object.keys(e).forEach(function(i){Object.assign(n,ed(e[i],t,i))}),n;function r(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const l=o.split("|");n[l[0]]=[i,Vb(l[0],l[1])]})}}function Vb(e,t){return t?Number(t):qb(e)?0:1}function qb(e){return Hb.includes(e.toLowerCase())}const Pl={},Ps=e=>{console.error(e)},Ll=(e,...t)=>{console.log(`WARN: ${e}`,...t)},zs=(e,t)=>{Pl[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Pl[`${e}/${t}`]=!0)},Hr=new Error;function td(e,t,{key:s}){let n=0;const r=e[s],i={},a={};for(let o=1;o<=t.length;o++)a[o+n]=r[o],i[o+n]=!0,n+=Zu(t[o-1]);e[s]=a,e[s]._emit=i,e[s]._multi=!0}function zb(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ps("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Hr;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ps("beginScope must be object"),Hr;td(e,e.begin,{key:"beginScope"}),e.begin=Ha(e.begin,{joinWith:""})}}function Kb(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ps("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Hr;if(typeof e.endScope!="object"||e.endScope===null)throw Ps("endScope must be object"),Hr;td(e,e.end,{key:"endScope"}),e.end=Ha(e.end,{joinWith:""})}}function Wb(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Gb(e){Wb(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),zb(e),Kb(e)}function Zb(e){function t(a,o){return new RegExp(Zn(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class s{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=Zu(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(l=>l[1]);this.matcherRe=t(Ha(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(o);if(!l)return null;const c=l.findIndex((d,h)=>h>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const l=new s;return this.rules.slice(o).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(o);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(o)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(a){const o=new n;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const l=a;if(a.isCompiled)return l;[Lb,Db,Gb,Bb].forEach(u=>u(a,o)),e.compilerExtensions.forEach(u=>u(a,o)),a.__beforeBegin=null,[Mb,jb,Ub].forEach(u=>u(a,o)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=ed(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Zn(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(u){return Jb(u==="self"?a:u)})),a.contains.forEach(function(u){i(u,l)}),a.starts&&i(a.starts,o),l.matcher=r(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=ps(e.classNameAliases||{}),i(e)}function sd(e){return e?e.endsWithParent||sd(e.starts):!1}function Jb(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return ps(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:sd(e)?ps(e,{starts:e.starts?ps(e.starts):null}):Object.isFrozen(e)?ps(e):e}var Yb="11.11.1";class Xb extends Error{constructor(t,s){super(t),this.name="HTMLInjectionError",this.html=s}}const Li=Wu,Ml=ps,jl=Symbol("nomatch"),Qb=7,nd=function(e){const t=Object.create(null),s=Object.create(null),n=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:db};function l(M){return o.noHighlightRe.test(M)}function c(M){let z=M.className+" ";z+=M.parentNode?M.parentNode.className:"";const Y=o.languageDetectRe.exec(z);if(Y){const ue=C(Y[1]);return ue||(Ll(i.replace("{}",Y[1])),Ll("Falling back to no-highlight mode for this block.",M)),ue?Y[1]:"no-highlight"}return z.split(/\s+/).find(ue=>l(ue)||C(ue))}function u(M,z,Y){let ue="",xe="";typeof z=="object"?(ue=M,Y=z.ignoreIllegals,xe=z.language):(zs("10.7.0","highlight(lang, code, ...args) has been deprecated."),zs("10.7.0",`Please use highlight(code, options) instead.
73
- https://github.com/highlightjs/highlight.js/issues/2277`),xe=M,ue=z),Y===void 0&&(Y=!0);const q={code:ue,language:xe};L("before:highlight",q);const T=q.result?q.result:d(q.language,q.code,Y);return T.code=q.code,L("after:highlight",T),T}function d(M,z,Y,ue){const xe=Object.create(null);function q(G,te){return G.keywords[te]}function T(){if(!H.keywords){J.addText(U);return}let G=0;H.keywordPatternRe.lastIndex=0;let te=H.keywordPatternRe.exec(U),oe="";for(;te;){oe+=U.substring(G,te.index);const _e=D.case_insensitive?te[0].toLowerCase():te[0],Te=q(H,_e);if(Te){const[Ve,gt]=Te;if(J.addText(oe),oe="",xe[_e]=(xe[_e]||0)+1,xe[_e]<=Qb&&(fe+=gt),Ve.startsWith("_"))oe+=te[0];else{const bs=D.classNameAliases[Ve]||Ve;ce(te[0],bs)}}else oe+=te[0];G=H.keywordPatternRe.lastIndex,te=H.keywordPatternRe.exec(U)}oe+=U.substring(G),J.addText(oe)}function O(){if(U==="")return;let G=null;if(typeof H.subLanguage=="string"){if(!t[H.subLanguage]){J.addText(U);return}G=d(H.subLanguage,U,!0,se[H.subLanguage]),se[H.subLanguage]=G._top}else G=f(U,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(fe+=G.relevance),J.__addSublanguage(G._emitter,G.language)}function X(){H.subLanguage!=null?O():T(),U=""}function ce(G,te){G!==""&&(J.startScope(te),J.addText(G),J.endScope())}function Ue(G,te){let oe=1;const _e=te.length-1;for(;oe<=_e;){if(!G._emit[oe]){oe++;continue}const Te=D.classNameAliases[G[oe]]||G[oe],Ve=te[oe];Te?ce(Ve,Te):(U=Ve,T(),U=""),oe++}}function F(G,te){return G.scope&&typeof G.scope=="string"&&J.openNode(D.classNameAliases[G.scope]||G.scope),G.beginScope&&(G.beginScope._wrap?(ce(U,D.classNameAliases[G.beginScope._wrap]||G.beginScope._wrap),U=""):G.beginScope._multi&&(Ue(G.beginScope,te),U="")),H=Object.create(G,{parent:{value:H}}),H}function ae(G,te,oe){let _e=gb(G.endRe,oe);if(_e){if(G["on:end"]){const Te=new $l(G);G["on:end"](te,Te),Te.isMatchIgnored&&(_e=!1)}if(_e){for(;G.endsParent&&G.parent;)G=G.parent;return G}}if(G.endsWithParent)return ae(G.parent,te,oe)}function ie(G){return H.matcher.regexIndex===0?(U+=G[0],1):(ye=!0,0)}function he(G){const te=G[0],oe=G.rule,_e=new $l(oe),Te=[oe.__beforeBegin,oe["on:begin"]];for(const Ve of Te)if(Ve&&(Ve(G,_e),_e.isMatchIgnored))return ie(te);return oe.skip?U+=te:(oe.excludeBegin&&(U+=te),X(),!oe.returnBegin&&!oe.excludeBegin&&(U=te)),F(oe,G),oe.returnBegin?0:te.length}function Se(G){const te=G[0],oe=z.substring(G.index),_e=ae(H,G,oe);if(!_e)return jl;const Te=H;H.endScope&&H.endScope._wrap?(X(),ce(te,H.endScope._wrap)):H.endScope&&H.endScope._multi?(X(),Ue(H.endScope,G)):Te.skip?U+=te:(Te.returnEnd||Te.excludeEnd||(U+=te),X(),Te.excludeEnd&&(U=te));do H.scope&&J.closeNode(),!H.skip&&!H.subLanguage&&(fe+=H.relevance),H=H.parent;while(H!==_e.parent);return _e.starts&&F(_e.starts,G),Te.returnEnd?0:te.length}function b(){const G=[];for(let te=H;te!==D;te=te.parent)te.scope&&G.unshift(te.scope);G.forEach(te=>J.openNode(te))}let y={};function A(G,te){const oe=te&&te[0];if(U+=G,oe==null)return X(),0;if(y.type==="begin"&&te.type==="end"&&y.index===te.index&&oe===""){if(U+=z.slice(te.index,te.index+1),!r){const _e=new Error(`0 width match regex (${M})`);throw _e.languageName=M,_e.badRule=y.rule,_e}return 1}if(y=te,te.type==="begin")return he(te);if(te.type==="illegal"&&!Y){const _e=new Error('Illegal lexeme "'+oe+'" for mode "'+(H.scope||"<unnamed>")+'"');throw _e.mode=H,_e}else if(te.type==="end"){const _e=Se(te);if(_e!==jl)return _e}if(te.type==="illegal"&&oe==="")return U+=`
74
- `,1;if(de>1e5&&de>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return U+=oe,oe.length}const D=C(M);if(!D)throw Ps(i.replace("{}",M)),new Error('Unknown language: "'+M+'"');const K=Zb(D);let B="",H=ue||K;const se={},J=new o.__emitter(o);b();let U="",fe=0,ne=0,de=0,ye=!1;try{if(D.__emitTokens)D.__emitTokens(z,J);else{for(H.matcher.considerAll();;){de++,ye?ye=!1:H.matcher.considerAll(),H.matcher.lastIndex=ne;const G=H.matcher.exec(z);if(!G)break;const te=z.substring(ne,G.index),oe=A(te,G);ne=G.index+oe}A(z.substring(ne))}return J.finalize(),B=J.toHTML(),{language:M,value:B,relevance:fe,illegal:!1,_emitter:J,_top:H}}catch(G){if(G.message&&G.message.includes("Illegal"))return{language:M,value:Li(z),illegal:!0,relevance:0,_illegalBy:{message:G.message,index:ne,context:z.slice(ne-100,ne+100),mode:G.mode,resultSoFar:B},_emitter:J};if(r)return{language:M,value:Li(z),illegal:!1,relevance:0,errorRaised:G,_emitter:J,_top:H};throw G}}function h(M){const z={value:Li(M),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return z._emitter.addText(M),z}function f(M,z){z=z||o.languages||Object.keys(t);const Y=h(M),ue=z.filter(C).filter(V).map(X=>d(X,M,!1));ue.unshift(Y);const xe=ue.sort((X,ce)=>{if(X.relevance!==ce.relevance)return ce.relevance-X.relevance;if(X.language&&ce.language){if(C(X.language).supersetOf===ce.language)return 1;if(C(ce.language).supersetOf===X.language)return-1}return 0}),[q,T]=xe,O=q;return O.secondBest=T,O}function g(M,z,Y){const ue=z&&s[z]||Y;M.classList.add("hljs"),M.classList.add(`language-${ue}`)}function m(M){let z=null;const Y=c(M);if(l(Y))return;if(L("before:highlightElement",{el:M,language:Y}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.children.length>0&&(o.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(M)),o.throwUnescapedHTML))throw new Xb("One of your code blocks includes unescaped HTML.",M.innerHTML);z=M;const ue=z.textContent,xe=Y?u(ue,{language:Y,ignoreIllegals:!0}):f(ue);M.innerHTML=xe.value,M.dataset.highlighted="yes",g(M,Y,xe.language),M.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(M.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),L("after:highlightElement",{el:M,result:xe,text:ue})}function S(M){o=Ml(o,M)}const E=()=>{P(),zs("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){P(),zs("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function P(){function M(){P()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",M,!1),k=!0;return}document.querySelectorAll(o.cssSelector).forEach(m)}function N(M,z){let Y=null;try{Y=z(e)}catch(ue){if(Ps("Language definition for '{}' could not be registered.".replace("{}",M)),r)Ps(ue);else throw ue;Y=a}Y.name||(Y.name=M),t[M]=Y,Y.rawDefinition=z.bind(null,e),Y.aliases&&j(Y.aliases,{languageName:M})}function R(M){delete t[M];for(const z of Object.keys(s))s[z]===M&&delete s[z]}function v(){return Object.keys(t)}function C(M){return M=(M||"").toLowerCase(),t[M]||t[s[M]]}function j(M,{languageName:z}){typeof M=="string"&&(M=[M]),M.forEach(Y=>{s[Y.toLowerCase()]=z})}function V(M){const z=C(M);return z&&!z.disableAutodetect}function Z(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=z=>{M["before:highlightBlock"](Object.assign({block:z.el},z))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=z=>{M["after:highlightBlock"](Object.assign({block:z.el},z))})}function $(M){Z(M),n.push(M)}function W(M){const z=n.indexOf(M);z!==-1&&n.splice(z,1)}function L(M,z){const Y=M;n.forEach(function(ue){ue[Y]&&ue[Y](z)})}function pe(M){return zs("10.7.0","highlightBlock will be removed entirely in v12.0"),zs("10.7.0","Please use highlightElement now."),m(M)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:P,highlightElement:m,highlightBlock:pe,configure:S,initHighlighting:E,initHighlightingOnLoad:x,registerLanguage:N,unregisterLanguage:R,listLanguages:v,getLanguage:C,registerAliases:j,autoDetection:V,inherit:Ml,addPlugin:$,removePlugin:W}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=Yb,e.regex={concat:js,lookahead:Gu,either:Ba,optional:fb,anyNumberOfTimes:hb};for(const M in yr)typeof yr[M]=="object"&&Ku(yr[M]);return Object.assign(e,yr),e},un=nd({});un.newInstance=()=>nd({});var ev=un;un.HighlightJS=un;un.default=un;const Ke=ob(ev),Fr="[A-Za-z$_][0-9A-Za-z$_]*",rd=["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"],id=["true","false","null","undefined","NaN","Infinity"],ad=["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"],od=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ld=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ud=[].concat(ld,ad,od);function tv(e){const t=e.regex,s=(Y,{after:ue})=>{const xe="</"+Y[0].slice(1);return Y.input.indexOf(xe,ue)!==-1},n=Fr,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ue)=>{const xe=Y[0].length+Y.index,q=Y.input[xe];if(q==="<"||q===","){ue.ignoreMatch();return}q===">"&&(s(Y,{after:xe})||ue.ignoreMatch());let T;const O=Y.input.substring(xe);if(T=O.match(/^\s*=/)){ue.ignoreMatch();return}if((T=O.match(/^\s+extends\s+/))&&T.index===0){ue.ignoreMatch();return}}},o={$pattern:Fr,keyword:rd,literal:id,built_in:ud,"variable.language":cd},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,m,S,{match:/\$\d+/},d];h.contains=k.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(k)});const P=[].concat(x,h.contains),N=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:N},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},C={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:{_:[...ad,...od]}},j={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(Y){return t.concat("(?!",Y.join("|"),")")}const W={match:t.concat(/\b/,$([...ld,"super","import"].map(Y=>`${Y}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),j,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,m,S,x,{match:/\$\d+/},d,C,{scope:"attr",match:n+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:M,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:o,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},V,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},W,Z,v,pe,{match:/\$[(.]/}]}}function dd(e){const t=e.regex,s=tv(e),n=Fr,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[s.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Fr,keyword:rd.concat(l),literal:id,built_in:ud.concat(r),"variable.language":cd},u={className:"meta",begin:"@"+n},d=(m,S,E)=>{const x=m.contains.findIndex(k=>k.label===S);if(x===-1)throw new Error("can not find mode to replace");m.contains.splice(x,1,E)};Object.assign(s.keywords,c),s.exports.PARAMS_CONTAINS.push(u);const h=s.contains.find(m=>m.scope==="attr"),f=Object.assign({},h,{match:t.concat(n,t.lookahead(/\s*\?:/))});s.exports.PARAMS_CONTAINS.push([s.exports.CLASS_REFERENCE,h,f]),s.contains=s.contains.concat([u,i,a,f]),d(s,"shebang",e.SHEBANG()),d(s,"use_strict",o);const g=s.contains.find(m=>m.label==="func.def");return g.relevance=0,Object.assign(s,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),s}const Dl="[A-Za-z$_][0-9A-Za-z$_]*",sv=["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"],nv=["true","false","null","undefined","NaN","Infinity"],hd=["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"],fd=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],pd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rv=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iv=[].concat(pd,hd,fd);function gd(e){const t=e.regex,s=(Y,{after:ue})=>{const xe="</"+Y[0].slice(1);return Y.input.indexOf(xe,ue)!==-1},n=Dl,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ue)=>{const xe=Y[0].length+Y.index,q=Y.input[xe];if(q==="<"||q===","){ue.ignoreMatch();return}q===">"&&(s(Y,{after:xe})||ue.ignoreMatch());let T;const O=Y.input.substring(xe);if(T=O.match(/^\s*=/)){ue.ignoreMatch();return}if((T=O.match(/^\s+extends\s+/))&&T.index===0){ue.ignoreMatch();return}}},o={$pattern:Dl,keyword:sv,literal:nv,built_in:iv,"variable.language":rv},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,m,S,{match:/\$\d+/},d];h.contains=k.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(k)});const P=[].concat(x,h.contains),N=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:N},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},C={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:{_:[...hd,...fd]}},j={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(Y){return t.concat("(?!",Y.join("|"),")")}const W={match:t.concat(/\b/,$([...pd,"super","import"].map(Y=>`${Y}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),j,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,m,S,x,{match:/\$\d+/},d,C,{scope:"attr",match:n+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:M,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:o,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},V,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},W,Z,v,pe,{match:/\$[(.]/}]}}function md(e){const t=e.regex,s=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["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"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,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:o,illegal:/#/},u={begin:/\{\{/,relevance:0},d={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]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${n.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[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(${h})[jJ](?=${g})`}]},S={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},E={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,m,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,S,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,s,/\s*/,/\(\s*/,s,/\s*\)/]},{match:[/\bclass/,/\s+/,s]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,E,d]}]}}function bd(e){const t=e.regex,s={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[s]}]};Object.assign(s,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,r]};r.contains.push(o);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,s]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${h.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},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],S=["true","false"],E={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],P=["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"],N=["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:m,literal:S,built_in:[...x,...k,"set","shopt",...P,...N]},contains:[f,e.SHEBANG(),g,d,i,a,E,o,l,c,u,s]}}function av(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},s={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[t,s,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const ov=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_-]*/}}),lv=["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"],cv=["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"],uv=[...lv,...cv],dv=["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(),hv=["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(),fv=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pv=["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 gv(e){const t=e.regex,s=ov(e),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[s.BLOCK_COMMENT,n,s.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},s.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+hv.join("|")+")"},{begin:":(:)?("+fv.join("|")+")"}]},s.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[s.BLOCK_COMMENT,s.HEXCOLOR,s.IMPORTANT,s.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},s.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:r,attribute:dv.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,s.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+uv.join("|")+")\\b"}]}}function vd(e){const t=e.regex,s=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,r={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/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=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:n,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{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,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,a,l,o]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{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(s,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:s,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(s,/>/))),contains:[{className:"name",begin:s,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function mv(e){const t=e.regex,s=e.COMMENT("--","$"),n={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],d=["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"],h=["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(N=>!u.includes(N)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},S={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function x(N){return t.concat(/\b/,t.either(...N.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:x(h),relevance:0};function P(N,{exceptions:R,when:v}={}){const C=v;return R=R||[],N.map(j=>j.match(/\|\d+$/)||R.includes(j)?j:C(j)?`${j}|0`:j)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:P(g,{when:N=>N.length<3}),literal:i,type:o,built_in:d},contains:[{scope:"type",match:x(a)},k,E,m,n,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,s,S]}}function yd(e){const t="true false yes no null",s="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},S=[n,{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+!"+s},{className:"type",begin:"!<"+s+">"},{className:"type",begin:"!"+s},{className:"type",begin:"!!"+s},{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}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,m,i,a],E=[...S];return E.pop(),E.push(o),f.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:S}}function _d(e){const t=e.regex,s={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={begin:"^[-\\*]{3,}",end:"$"},r={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},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},d=e.inherit(c,{contains:[]}),h=e.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let f=[s,l];return[c,u,d,h].forEach(E=>{E.contains=E.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}]}]},s,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},r,n,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}Ke.registerLanguage("typescript",dd);Ke.registerLanguage("ts",dd);Ke.registerLanguage("javascript",gd);Ke.registerLanguage("js",gd);Ke.registerLanguage("python",md);Ke.registerLanguage("py",md);Ke.registerLanguage("bash",bd);Ke.registerLanguage("sh",bd);Ke.registerLanguage("json",av);Ke.registerLanguage("css",gv);Ke.registerLanguage("html",vd);Ke.registerLanguage("xml",vd);Ke.registerLanguage("sql",mv);Ke.registerLanguage("yaml",yd);Ke.registerLanguage("yml",yd);Ke.registerLanguage("markdown",_d);Ke.registerLanguage("md",_d);function Lt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").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,s,n)=>`<a href="${/^https?:\/\//i.test(n)||n.startsWith("/")||n.startsWith("#")?n:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${s}</a>`)}function wd(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Ul(e){return wd(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Mi(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function bv(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function vv(e){if(e.length<2)return e.map(o=>`<p class="my-1">${Lt(o)}</p>`).join(`
71
+ ${E}`}class qe extends Error{constructor({message:t,code:s,cause:n,name:r}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=r??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Dr extends qe{constructor(t,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:t}),this.name="WebAuthnUnknownError",this.originalError=s}}function Nm({error:e,options:t}){var s,n,r;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 qe({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new qe({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new qe({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new qe({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 qe({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new qe({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new qe({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(Fu(a)){if(i.rp.id!==a)return new qe({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({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 qe({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 qe({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 qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Im({error:e,options:t}){const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new qe({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Fu(n)){if(s.rpId!==n)return new qe({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new qe({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 qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Pm{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}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 ga=new Pm;function Sl(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:s,excludeCredentials:n}=e,r=ci(e,["challenge","user","excludeCredentials"]),i=an(t).buffer,a=Object.assign(Object.assign({},s),{id:an(s.id).buffer}),o=Object.assign(Object.assign({},r),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:an(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function Tl(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:s}=e,n=ci(e,["challenge","allowCredentials"]),r=an(t).buffer,i=Object.assign(Object.assign({},n),{challenge:r});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let a=0;a<s.length;a++){const o=s[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:an(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function Al(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e;return{id:e.id,rawId:e.id,response:{attestationObject:$s(new Uint8Array(e.response.attestationObject)),clientDataJSON:$s(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Rl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e,n=e.getClientExtensionResults(),r=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:$s(new Uint8Array(r.authenticatorData)),clientDataJSON:$s(new Uint8Array(r.clientDataJSON)),signature:$s(new Uint8Array(r.signature)),userHandle:r.userHandle?$s(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Fu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ur(){var e,t;return!!(Xe()&&"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 Vu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:Nm({error:t,options:e})}}}async function qu(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:Im({error:t,options:e})}}}const Lm={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Mm={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Br(...e){const t=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),s=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),n={};for(const r of e)if(r)for(const i in r){const a=r[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(s(a))n[i]=a;else if(t(a)){const o=n[i];t(o)?n[i]=Br(o,a):n[i]=Br(a)}else n[i]=a}return n}function jm(e,t){return Br(Lm,e,t||{})}function Dm(e,t){return Br(Mm,e,t||{})}class Um{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:s,friendlyName:n,signal:r},i){var a;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:s});if(!o)return{data:null,error:l};const c=r??ga.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=n;if(d)u.name=`${u.id}:${d}`;else{const f=(await this.client.getUser()).data.user,g=((a=f==null?void 0:f.user_metadata)===null||a===void 0?void 0:a.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(o.webauthn.type){case"create":{const u=jm(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:h}=await Vu({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=Dm(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:h}=await qu(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(o){return re(o)?{data:null,error:o}:{data:null,error:new Et("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Kn("rpId is required for WebAuthn authentication")};try{if(!Ur())return{data:null,error:new Et("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:t,webauthn:{rpId:s,rpOrigins:n},signal:r},{request:i});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:n,credential_response:l.credential_response}})}catch(a){return re(a)?{data:null,error:a}:{data:null,error:new Et("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Kn("rpId is required for WebAuthn registration")};try{if(!Ur())return{data:null,error:new Et("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:s,rpOrigins:n},signal:r},{create:i});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return re(a)?{data:null,error:a}:{data:null,error:new Et("Unexpected error in register",a)}}}}Rm();const Bm={url:q0,storageKey:z0,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:K0,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Cl(e,t,s){return await s()}const zs={};class Wn{get jwks(){var t,s;return(s=(t=zs[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(t){zs[this.storageKey]=Object.assign(Object.assign({},zs[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,s;return(s=(t=zs[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){zs[this.storageKey]=Object.assign(Object.assign({},zs[this.storageKey]),{cachedAt:t})}constructor(t){var s,n,r,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 a=Object.assign(Object.assign({},Bm),t);if(this.storageKey=a.storageKey,this.instanceID=(s=Wn.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Wn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Xe()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new Tm({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=Uu(a.fetch),this.lock=a.lock||Cl,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&Xe()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=Am:this.lock=Cl,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 Um(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?(a.storage?this.storage=a.storage:Du()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=El(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=El(this.memoryStorage)),Xe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Lu}) ${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 s={},n="none";if(Xe()&&(s=am(window.location.href),this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce")),Xe()&&this.detectSessionInUrl&&n!=="none"){const{data:r,error:i}=await this._getSessionFromURL(s,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Y0(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:a,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return re(s)?this._returnResult({error:s}):this._returnResult({error:new Et("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var s,n,r;try{const i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}},xform:bt}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(re(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var s,n,r;try{let i;if("email"in t){const{email:u,password:d,options:h}=t;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await qs(this.storage,this.storageKey)),i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:u,password:d,data:(s=h==null?void 0:h.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:f,code_challenge_method:g},xform:bt})}else if("phone"in t){const{phone:u,password:d,options:h}=t;i=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},channel:(r=h==null?void 0:h.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:bt})}else throw new pr("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await Ye(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let s;if("email"in t){const{email:i,password:a,options:o}=t;s=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:wl})}else if("phone"in t){const{phone:i,password:a,options:o}=t;s=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:wl})}else throw new pr("You must provide either an email or phone number and a password");const{data:n,error:r}=s;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const i=new Vs;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(t){var s,n,r,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(r=t.options)===null||r===void 0?void 0:r.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:s}=t;switch(s){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(t){var s,n,r,i,a,o,l,c,u,d,h;let f,g;if("message"in t)f=t.message,g=t.signature;else{const{chain:b,wallet:S,statement:E,options:x}=t;let k;if(Xe())if(typeof S=="object")k=S;else{const j=window;if("ethereum"in j&&typeof j.ethereum=="object"&&"request"in j.ethereum&&typeof j.ethereum.request=="function")k=j.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 S!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=S}const P=new URL((s=x==null?void 0:x.url)!==null&&s!==void 0?s:window.location.href),N=await k.request({method:"eth_requestAccounts"}).then(j=>j).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!N||N.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const R=Hu(N[0]);let v=(n=x==null?void 0:x.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!v){const j=await k.request({method:"eth_chainId"});v=Cm(j)}const C={domain:P.host,address:R,statement:E,uri:P.href,version:"1",chainId:v,nonce:(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(a=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=x==null?void 0:x.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=$m(C),g=await k.request({method:"personal_sign",params:[Om(f),R]})}try{const{data:b,error:S}=await le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:bt});if(S)throw S;if(!b||!b.session||!b.user){const E=new Vs;return this._returnResult({data:{user:null,session:null},error:E})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:S})}catch(b){if(re(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(t){var s,n,r,i,a,o,l,c,u,d,h,f;let g,b;if("message"in t)g=t.message,b=t.signature;else{const{chain:S,wallet:E,statement:x,options:k}=t;let P;if(Xe())if(typeof E=="object")P=E;else{const R=window;if("solana"in R&&typeof R.solana=="object"&&("signIn"in R.solana&&typeof R.solana.signIn=="function"||"signMessage"in R.solana&&typeof R.solana.signMessage=="function"))P=R.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=E}const N=new URL((s=k==null?void 0:k.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in P&&P.signIn){const R=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},k==null?void 0:k.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),x?{statement:x}:null));let v;if(Array.isArray(R)&&R[0]&&typeof R[0]=="object")v=R[0];else if(R&&typeof R=="object"&&"signedMessage"in R&&"signature"in R)v=R;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in v&&"signature"in v&&(typeof v.signedMessage=="string"||v.signedMessage instanceof Uint8Array)&&v.signature instanceof Uint8Array)g=typeof v.signedMessage=="string"?v.signedMessage:new TextDecoder().decode(v.signedMessage),b=v.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${N.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(r=(n=k==null?void 0:k.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((i=k==null?void 0:k.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${k.signInWithSolana.notBefore}`]:[],...!((a=k==null?void 0:k.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${k.signInWithSolana.expirationTime}`]:[],...!((o=k==null?void 0:k.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${k.signInWithSolana.chainId}`]:[],...!((l=k==null?void 0:k.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${k.signInWithSolana.nonce}`]:[],...!((c=k==null?void 0:k.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${k.signInWithSolana.requestId}`]:[],...!((d=(u=k==null?void 0:k.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...k.signInWithSolana.resources.map(v=>`- ${v}`)]:[]].join(`
72
+ `);const R=await P.signMessage(new TextEncoder().encode(g),"utf8");if(!R||!(R instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=R}}try{const{data:S,error:E}=await le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:$s(b)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:bt});if(E)throw E;if(!S||!S.session||!S.user){const x=new Vs;return this._returnResult({data:{user:null,session:null},error:x})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:E})}catch(S){if(re(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async _exchangeCodeForSession(t){const s=await Es(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(s??"").split("/");try{if(!n&&this.flowType==="pkce")throw new X0;const{data:i,error:a}=await le(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:bt});if(await Ye(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Vs;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(r==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:r??null}),error:a})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:s,provider:n,token:r,access_token:i,nonce:a}=t,o=await le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:bt}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Vs;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(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(t){var s,n,r,i,a;try{if("email"in t){const{email:o,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await qs(this.storage,this.storageKey));const{error:d}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in t){const{phone:o,options:l}=t,{data:c,error:u}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},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:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new pr("You must provide either an email or phone number.")}catch(o){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(t){var s,n;try{let r,i;"options"in t&&(r=(s=t.options)===null||s===void 0?void 0:s.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await le(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:bt});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.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(r){if(re(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(t){var s,n,r,i,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await qs(this.storage,this.storageKey));const c=await le(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(s=t.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n:void 0}),!((r=t==null?void 0:t.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Em});return!((i=c.data)===null||i===void 0)&&i.url&&Xe()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:null,error:o});throw o}}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:s},error:n}=t;if(n)throw n;if(!s)throw new Je;const{error:r}=await le(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(t){if(re(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const s=`${this.url}/resend`;if("email"in t){const{email:n,type:r,options:i}=t,{error:a}=await le(this.fetch,"POST",s,{headers:this.headers,body:{email:n,type:r,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:a})}else if("phone"in t){const{phone:n,type:r,options:i}=t,{data:a,error:o}=await le(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new pr("You must provide either an email or phone number and a type")}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(t,s){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await n,await s()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await t(s)}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 s=await Es(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?t=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<$i:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await Es(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Ii()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=ym(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(t){try{return t?await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:fs}):await this._useSession(async s=>{var n,r,i;const{data:a,error:o}=s;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Je}:await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:fs})})}catch(s){if(re(s))return fr(s)&&(await this._removeSession(),await Ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(t,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,s))}async _updateUser(t,s={}){try{return await this._useSession(async n=>{const{data:r,error:i}=n;if(i)throw i;if(!r.session)throw new Je;const a=r.session;let o=null,l=null;this.flowType==="pkce"&&t.email!=null&&([o,l]=await qs(this.storage,this.storageKey));const{data:c,error:u}=await le(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:fs});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(n))return this._returnResult({data:{user:null},error:n});throw n}}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 Je;const s=Date.now()/1e3;let n=s,r=!0,i=null;const{payload:a}=mr(t.access_token);if(a.exp&&(n=a.exp,r=n<=s),r){const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,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:o.user,token_type:"bearer",expires_in:n-s,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(re(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}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 s=>{var n;if(!t){const{data:a,error:o}=s;if(o)throw o;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Je;const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(re(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(t,s){var n;try{if(!Xe())throw new gr("No browser detected.");if(t.error||t.error_description||t.error_code)throw new gr(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new pl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new gr("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new pl("No code detected.");const{data:k,error:P}=await this._exchangeCodeForSession(t.code);if(P)throw P;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:k.session,redirectType:(n=k.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!a||!l||!o||!u)throw new gr("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const g=f-d;g*1e3<=Ys&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${h}s`);const b=f-h;d-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,f,d):d-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,d);const{data:S,error:E}=await this._getUser(a);if(E)throw E;const x={provider_token:r,provider_refresh_token:i,access_token:a,expires_in:h,expires_at:f,refresh_token:o,token_type:u,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:t.type},error:null})}catch(r){if(re(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_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 s=await Es(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&s)}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 s=>{var n;const{data:r,error:i}=s;if(i&&!fr(i))return this._returnResult({error:i});const a=(n=r.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,t);if(o&&!(J0(o)&&(o.status===404||o.status===401||o.status===403)||fr(o)))return this._returnResult({error:o})}return t!=="others"&&(await this._removeSession(),await Ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const s=im(),n={id:s,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async s=>{var n,r;try{const{data:{session:i},error:a}=s;if(a)throw a;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),fr(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,s={}){let n=null,r=null;this.flowType==="pkce"&&([n,r]=await qs(this.storage,this.storageKey,!0));try{return await le(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=s.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var s;try{const{data:n,error:r}=await this._useSession(async i=>{var a,o,l,c,u;const{data:d,error:h}=i;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await le(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(r)throw r;return Xe()&&!(!((s=t.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(re(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async s=>{var n;try{const{error:r,data:{session:i}}=s;if(r)throw r;const{options:a,provider:o,token:l,access_token:c,nonce:u}=t,d=await le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:bt}),{data:h,error:f}=d;return f?this._returnResult({data:{user:null,session:null},error:f}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Vs}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:f}))}catch(r){if(await Ye(this.storage,`${this.storageKey}-code-verifier`),re(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)throw a;return await le(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(r=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&r!==void 0?r:void 0})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(t){const s=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await cm(async r=>(r>0&&await lm(200*Math.pow(2,r-1)),this._debug(s,"refreshing attempt",r),await le(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:bt})),(r,i)=>{const a=200*Math.pow(2,r);return i&&Ni(i)&&Date.now()+a-n<Ys})}catch(n){if(this._debug(s,"error",n),re(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(s,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,s){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",s,"url",n),Xe()&&!s.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,s;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const r=await Es(this.storage,this.storageKey);if(r&&this.userStorage){let a=await Es(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:r.user},await Xs(this.userStorage,this.storageKey+"-user",a)),r.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Ii()}else if(r&&!r.user&&!r.user){const a=await Es(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(r.user=a.user,await Ye(this.storage,this.storageKey+"-user"),await Xs(this.storage,this.storageKey,r)):r.user=Ii()}if(this._debug(n,"session from storage",r),!this._isValidSession(r)){this._debug(n,"session is not valid"),r!==null&&await this._removeSession();return}const i=((s=r.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<$i;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${$i}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(console.error(a),Ni(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(r.access_token);!o&&(a!=null&&a.user)?(r.user=a.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(n,"error",r),console.error(r);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var s,n;if(!t)throw new Je;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new hi;const{data:i,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!i.session)throw new Je;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(r,"error",i),re(i)){const a={data:null,error:i};return Ni(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(t,s,n=!0){const r=`#_notifyAllSubscribers(${t})`;this._debug(r,"begin",s,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:s});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,s)}catch(l){i.push(l)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(r,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Ye(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},t),n=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&s.user&&await Xs(this.userStorage,this.storageKey+"-user",{user:s.user});const r=Object.assign({},s);delete r.user;const i=yl(r);await Xs(this.storage,this.storageKey,i)}else{const r=yl(s);await Xs(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ye(this.storage,this.storageKey),await Ye(this.storage,this.storageKey+"-code-verifier"),await Ye(this.storage,this.storageKey+"-user"),this.userStorage&&await Ye(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Xe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Ys);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((n.expires_at*1e3-t)/Ys);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Ys}ms, refresh threshold is ${da} ticks`),r<=da&&await this._callRefreshToken(n.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Bu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Xe()||!(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 s=`#_onVisibilityChanged(${t})`;this._debug(s,"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(s,"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,s,n){const r=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await qs(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});r.push(o.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;return i?this._returnResult({data:null,error:i}):await le(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await le(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((r=l==null?void 0:l.totp)===null||r===void 0)&&r.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Al(t.webauthn.credential_response):Rl(t.webauthn.credential_response)})}:{code:t.code}),{data:o,error:l}=await le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=await le(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Sl(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Tl(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(t){const{data:s,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:s.id,code:t.code})}async _listFactors(){var t;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=s==null?void 0:s.factors)!==null&&t!==void 0?t:[])r.all.push(i),i.status==="verified"&&r[i.factor_type].push(i);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(t){var s,n,r,i;if(t)try{const{payload:f}=mr(t);let g=null;f.aal&&(g=f.aal);let b=g;const{data:{user:S},error:E}=await this.getUser(t);if(E)return this._returnResult({data:null,error:E});((n=(s=S==null?void 0:S.factors)===null||s===void 0?void 0:s.filter(P=>P.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(b="aal2");const k=f.amr||[];return{data:{currentLevel:g,nextLevel:b,currentAuthenticationMethods:k},error:null}}catch(f){if(re(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:a},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=mr(a.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(r=a.user.factors)===null||r===void 0?void 0:r.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const h=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?await le(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Je})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Je});const a=await le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Je});const a=await le(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;return n?this._returnResult({data:null,error:n}):s?await le(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Je})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?(await le(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Je})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(t,s={keys:[]}){let n=s.keys.find(o=>o.kid===t);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(o=>o.kid===t),n&&this.jwks_cached_at+G0>r)return n;const{data:i,error:a}=await le(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,n=i.keys.find(o=>o.kid===t),!n)?null:n}async getClaims(t,s={}){try{let n=t;if(!n){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});n=f.session.access_token}const{header:r,payload:i,signature:a,raw:{header:o,payload:l}}=mr(n);s!=null&&s.allowExpired||mm(i.exp);const c=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:r,signature:a},error:null}}const u=bm(r.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,nm(`${o}.${l}`)))throw new pa("Invalid JWT signature");return{data:{claims:i,header:r,signature:a},error:null}}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var s,n,r;wt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new Et("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const o=Tl(i.options),l=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:ga.createNewAbortSignal(),{data:c,error:u}=await qu({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Et("WebAuthn ceremony failed",null)});const d=Rl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:d})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var s,n;wt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new Et("Browser does not support WebAuthn",null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const a=Sl(r.options),o=(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:ga.createNewAbortSignal(),{data:l,error:c}=await Vu({publicKey:a,signal:o});if(c||!l)return this._returnResult({data:null,error:c??new Et("WebAuthn ceremony failed",null)});const u=Al(l);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(r){if(re(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyRegistration(){wt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Je});const{data:r,error:i}=await le(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{data:i,error:a}=await le(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(t){var s;wt(this.experimental);try{const{data:n,error:r}=await le(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:n,error:null})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){wt(this.experimental);try{const{data:s,error:n}=await le(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:bt});return n?this._returnResult({data:null,error:n}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){wt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Je});const{data:r,error:i}=await le(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(re(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{data:i,error:a}=await le(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(t){wt(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Je});const{error:i}=await le(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(s){if(re(s))return this._returnResult({data:null,error:s});throw s}}}Wn.nextInstanceID={};const Hm=Wn,Fm="2.105.4";let wn="";typeof Deno<"u"?wn="deno":typeof document<"u"?wn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wn="react-native":wn="node";const Vm={"X-Client-Info":`supabase-js-${wn}/${Fm}`},qm={headers:Vm},zm={schema:"public"},Km={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Wm={};function Gn(e){"@babel/helpers - typeof";return Gn=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},Gn(e)}function Gm(e,t){if(Gn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Gn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zm(e){var t=Gm(e,"string");return Gn(t)=="symbol"?t:t+""}function Jm(e,t,s){return(t=Zm(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Ol(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function He(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Ol(Object(s),!0).forEach(function(n){Jm(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ol(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}const Ym=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Xm=()=>Headers,Qm=(e,t,s)=>{const n=Ym(s),r=Xm();return async(i,a)=>{var o;const l=(o=await t())!==null&&o!==void 0?o:e;let c=new r(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,He(He({},a),{},{headers:c}))}};function eb(e){return e.endsWith("/")?e:e+"/"}function tb(e,t){var s,n;const{db:r,auth:i,realtime:a,global:o}=e,{db:l,auth:c,realtime:u,global:d}=t,h={db:He(He({},l),r),auth:He(He({},c),i),realtime:He(He({},u),a),storage:{},global:He(He(He({},d),o),{},{headers:He(He({},(s=d==null?void 0:d.headers)!==null&&s!==void 0?s:{}),(n=o==null?void 0:o.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function sb(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(eb(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var nb=class extends Hm{constructor(e){super(e)}},rb=class{constructor(e,t,s){var n,r;this.supabaseUrl=e,this.supabaseKey=t;const i=sb(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:zm,realtime:Wm,auth:He(He({},Km),{},{storageKey:a}),global:qm},l=tb(s??{},o);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(r=l.global.headers)!==null&&r!==void 0?r:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} 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=Qm(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(He({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 Og(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 V0(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new _g(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={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,s)}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,s;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(s=n.session)===null||s===void 0?void 0:s.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:h},f,g){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nb({url:this.authUrl.href,headers:He(He({},b),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:d,skipAutoInitialize:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new h0(this.realtimeUrl.href,He(He({},e),{},{params:He(He({},{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,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const ib=(e,t,s)=>new rb(e,t,s);function ab(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const s=t.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}ab()&&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 br=null,vr=null;async function zu(){if(vr)return vr;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return vr=await e.json(),vr}catch{return{authEnabled:!1,supabaseUrl:null,supabaseAnonKey:null}}}async function Cs(){if(br)return br;const e=await zu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(br=ib(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),br)}const nr=lu("auth",()=>{const e=Q(null),t=Q(null),s=Q(!1),n=Q(!1),r=Q(!1);let i=null;async function a(){const d=await zu();if(r.value=d.authEnabled,!d.authEnabled){n.value=!0;return}const h=await Cs();if(!h){n.value=!0;return}await new Promise(f=>{h.auth.onAuthStateChange((g,b)=>{b?(t.value=b,e.value=b.user??null):g==="SIGNED_OUT"&&(t.value=null,e.value=null),g==="INITIAL_SESSION"&&f()})}),n.value=!0}async function o(){if(!n.value)return i||(i=a().catch(()=>{i=null})),i}async function l(d,h){const f=await Cs();if(!f)return"Auth not configured";s.value=!0;try{const{error:g}=await f.auth.signInWithPassword({email:d,password:h});return g?g.message:null}finally{s.value=!1}}async function c(){const d=await Cs();d&&await d.auth.signOut(),e.value=null,t.value=null}async function u(){const d=t.value;if(d!=null&&d.access_token){if(d.expires_at&&d.expires_at*1e3-Date.now()<3e4)try{const h=await Cs();if(h){const{data:f}=await h.auth.refreshSession();if(f.session)return f.session.access_token}}catch{}return d.access_token}if(r.value)try{const h=await Cs();if(h){const{data:f}=await h.auth.refreshSession();if(f.session)return f.session.access_token}}catch{}return null}return{user:e,session:t,loading:s,initialized:n,authEnabled:r,init:o,signIn:l,signOut:c,getAccessToken:u}});async function Ce(e,t){const s=nr(),n=await s.getAccessToken(),r=new Headers(t==null?void 0:t.headers);n&&r.set("Authorization",`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401&&s.authEnabled){const a=await Cs();if(a){const{data:o,error:l}=await a.auth.refreshSession();if(o.session){const c=new Headers(t==null?void 0:t.headers);return c.set("Authorization",`Bearer ${o.session.access_token}`),fetch(e,{...t,headers:c})}l||await s.signOut()}}return i}async function fi(e){const s=await nr().getAccessToken();if(!s)return e;const n=e.includes("?")?"&":"?";return`${e}${n}token=${encodeURIComponent(s)}`}function ob(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ku(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 s=e[t],n=typeof s;(n==="object"||n==="function")&&!Object.isFrozen(s)&&Ku(s)}),e}class $l{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Wu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ps(e,...t){const s=Object.create(null);for(const n in e)s[n]=e[n];return t.forEach(function(n){for(const r in n)s[r]=n[r]}),s}const lb="</span>",Nl=e=>!!e.scope,cb=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const s=e.split(".");return[`${t}${s.shift()}`,...s.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class ub{constructor(t,s){this.buffer="",this.classPrefix=s.classPrefix,t.walk(this)}addText(t){this.buffer+=Wu(t)}openNode(t){if(!Nl(t))return;const s=cb(t.scope,{prefix:this.classPrefix});this.span(s)}closeNode(t){Nl(t)&&(this.buffer+=lb)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Il=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Ua{constructor(){this.rootNode=Il(),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 s=Il({scope:t});this.add(s),this.stack.push(s)}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,s){return typeof s=="string"?t.addText(s):s.children&&(t.openNode(s),s.children.forEach(n=>this._walk(t,n)),t.closeNode(s)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(s=>typeof s=="string")?t.children=[t.children.join("")]:t.children.forEach(s=>{Ua._collapse(s)}))}}class db extends Ua{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,s){const n=t.root;s&&(n.scope=`language:${s}`),this.add(n)}toHTML(){return new ub(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Zn(e){return e?typeof e=="string"?e:e.source:null}function Gu(e){return Ds("(?=",e,")")}function hb(e){return Ds("(?:",e,")*")}function fb(e){return Ds("(?:",e,")?")}function Ds(...e){return e.map(s=>Zn(s)).join("")}function pb(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Ba(...e){return"("+(pb(e).capture?"":"?:")+e.map(n=>Zn(n)).join("|")+")"}function Zu(e){return new RegExp(e.toString()+"|").exec("").length-1}function gb(e,t){const s=e&&e.exec(t);return s&&s.index===0}const mb=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ha(e,{joinWith:t}){let s=0;return e.map(n=>{s+=1;const r=s;let i=Zn(n),a="";for(;i.length>0;){const o=mb.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+r):(a+=o[0],o[0]==="("&&s++)}return a}).map(n=>`(${n})`).join(t)}const bb=/\b\B/,Ju="[a-zA-Z]\\w*",Fa="[a-zA-Z_]\\w*",Yu="\\b\\d+(\\.\\d+)?",Xu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Qu="\\b(0b[01]+)",vb="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",yb=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Ds(t,/.*\b/,e.binary,/\b.*/)),ps({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(s,n)=>{s.index!==0&&n.ignoreMatch()}},e)},Jn={begin:"\\\\[\\s\\S]",relevance:0},_b={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Jn]},wb={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Jn]},xb={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/},pi=function(e,t,s={}){const n=ps({scope:"comment",begin:e,end:t,contains:[]},s);n.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 r=Ba("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 n.contains.push({begin:Ds(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},Eb=pi("//","$"),kb=pi("/\\*","\\*/"),Sb=pi("#","$"),Tb={scope:"number",begin:Yu,relevance:0},Ab={scope:"number",begin:Xu,relevance:0},Rb={scope:"number",begin:Qu,relevance:0},Cb={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Jn,{begin:/\[/,end:/\]/,relevance:0,contains:[Jn]}]},Ob={scope:"title",begin:Ju,relevance:0},$b={scope:"title",begin:Fa,relevance:0},Nb={begin:"\\.\\s*"+Fa,relevance:0},Ib=function(e){return Object.assign(e,{"on:begin":(t,s)=>{s.data._beginMatch=t[1]},"on:end":(t,s)=>{s.data._beginMatch!==t[1]&&s.ignoreMatch()}})};var yr=Object.freeze({__proto__:null,APOS_STRING_MODE:_b,BACKSLASH_ESCAPE:Jn,BINARY_NUMBER_MODE:Rb,BINARY_NUMBER_RE:Qu,COMMENT:pi,C_BLOCK_COMMENT_MODE:kb,C_LINE_COMMENT_MODE:Eb,C_NUMBER_MODE:Ab,C_NUMBER_RE:Xu,END_SAME_AS_BEGIN:Ib,HASH_COMMENT_MODE:Sb,IDENT_RE:Ju,MATCH_NOTHING_RE:bb,METHOD_GUARD:Nb,NUMBER_MODE:Tb,NUMBER_RE:Yu,PHRASAL_WORDS_MODE:xb,QUOTE_STRING_MODE:wb,REGEXP_MODE:Cb,RE_STARTERS_RE:vb,SHEBANG:yb,TITLE_MODE:Ob,UNDERSCORE_IDENT_RE:Fa,UNDERSCORE_TITLE_MODE:$b});function Pb(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Lb(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Mb(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Pb,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function jb(e,t){Array.isArray(e.illegal)&&(e.illegal=Ba(...e.illegal))}function Db(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 Ub(e,t){e.relevance===void 0&&(e.relevance=1)}const Bb=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const s=Object.assign({},e);Object.keys(e).forEach(n=>{delete e[n]}),e.keywords=s.keywords,e.begin=Ds(s.beforeMatch,Gu(s.begin)),e.starts={relevance:0,contains:[Object.assign(s,{endsParent:!0})]},e.relevance=0,delete s.beforeMatch},Hb=["of","and","for","in","not","or","if","then","parent","list","value"],Fb="keyword";function ed(e,t,s=Fb){const n=Object.create(null);return typeof e=="string"?r(s,e.split(" ")):Array.isArray(e)?r(s,e):Object.keys(e).forEach(function(i){Object.assign(n,ed(e[i],t,i))}),n;function r(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const l=o.split("|");n[l[0]]=[i,Vb(l[0],l[1])]})}}function Vb(e,t){return t?Number(t):qb(e)?0:1}function qb(e){return Hb.includes(e.toLowerCase())}const Pl={},Ls=e=>{console.error(e)},Ll=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ks=(e,t)=>{Pl[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Pl[`${e}/${t}`]=!0)},Hr=new Error;function td(e,t,{key:s}){let n=0;const r=e[s],i={},a={};for(let o=1;o<=t.length;o++)a[o+n]=r[o],i[o+n]=!0,n+=Zu(t[o-1]);e[s]=a,e[s]._emit=i,e[s]._multi=!0}function zb(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ls("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Hr;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ls("beginScope must be object"),Hr;td(e,e.begin,{key:"beginScope"}),e.begin=Ha(e.begin,{joinWith:""})}}function Kb(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ls("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Hr;if(typeof e.endScope!="object"||e.endScope===null)throw Ls("endScope must be object"),Hr;td(e,e.end,{key:"endScope"}),e.end=Ha(e.end,{joinWith:""})}}function Wb(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Gb(e){Wb(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),zb(e),Kb(e)}function Zb(e){function t(a,o){return new RegExp(Zn(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class s{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=Zu(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(l=>l[1]);this.matcherRe=t(Ha(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(o);if(!l)return null;const c=l.findIndex((d,h)=>h>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const l=new s;return this.rules.slice(o).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(o);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(o)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(a){const o=new n;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const l=a;if(a.isCompiled)return l;[Lb,Db,Gb,Bb].forEach(u=>u(a,o)),e.compilerExtensions.forEach(u=>u(a,o)),a.__beforeBegin=null,[Mb,jb,Ub].forEach(u=>u(a,o)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=ed(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Zn(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(u){return Jb(u==="self"?a:u)})),a.contains.forEach(function(u){i(u,l)}),a.starts&&i(a.starts,o),l.matcher=r(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=ps(e.classNameAliases||{}),i(e)}function sd(e){return e?e.endsWithParent||sd(e.starts):!1}function Jb(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return ps(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:sd(e)?ps(e,{starts:e.starts?ps(e.starts):null}):Object.isFrozen(e)?ps(e):e}var Yb="11.11.1";class Xb extends Error{constructor(t,s){super(t),this.name="HTMLInjectionError",this.html=s}}const Li=Wu,Ml=ps,jl=Symbol("nomatch"),Qb=7,nd=function(e){const t=Object.create(null),s=Object.create(null),n=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:db};function l(M){return o.noHighlightRe.test(M)}function c(M){let z=M.className+" ";z+=M.parentNode?M.parentNode.className:"";const Y=o.languageDetectRe.exec(z);if(Y){const ue=C(Y[1]);return ue||(Ll(i.replace("{}",Y[1])),Ll("Falling back to no-highlight mode for this block.",M)),ue?Y[1]:"no-highlight"}return z.split(/\s+/).find(ue=>l(ue)||C(ue))}function u(M,z,Y){let ue="",xe="";typeof z=="object"?(ue=M,Y=z.ignoreIllegals,xe=z.language):(Ks("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ks("10.7.0",`Please use highlight(code, options) instead.
73
+ https://github.com/highlightjs/highlight.js/issues/2277`),xe=M,ue=z),Y===void 0&&(Y=!0);const q={code:ue,language:xe};L("before:highlight",q);const T=q.result?q.result:d(q.language,q.code,Y);return T.code=q.code,L("after:highlight",T),T}function d(M,z,Y,ue){const xe=Object.create(null);function q(G,te){return G.keywords[te]}function T(){if(!H.keywords){J.addText(U);return}let G=0;H.keywordPatternRe.lastIndex=0;let te=H.keywordPatternRe.exec(U),oe="";for(;te;){oe+=U.substring(G,te.index);const _e=D.case_insensitive?te[0].toLowerCase():te[0],Te=q(H,_e);if(Te){const[Ve,gt]=Te;if(J.addText(oe),oe="",xe[_e]=(xe[_e]||0)+1,xe[_e]<=Qb&&(fe+=gt),Ve.startsWith("_"))oe+=te[0];else{const bs=D.classNameAliases[Ve]||Ve;ce(te[0],bs)}}else oe+=te[0];G=H.keywordPatternRe.lastIndex,te=H.keywordPatternRe.exec(U)}oe+=U.substring(G),J.addText(oe)}function O(){if(U==="")return;let G=null;if(typeof H.subLanguage=="string"){if(!t[H.subLanguage]){J.addText(U);return}G=d(H.subLanguage,U,!0,se[H.subLanguage]),se[H.subLanguage]=G._top}else G=f(U,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(fe+=G.relevance),J.__addSublanguage(G._emitter,G.language)}function X(){H.subLanguage!=null?O():T(),U=""}function ce(G,te){G!==""&&(J.startScope(te),J.addText(G),J.endScope())}function Ue(G,te){let oe=1;const _e=te.length-1;for(;oe<=_e;){if(!G._emit[oe]){oe++;continue}const Te=D.classNameAliases[G[oe]]||G[oe],Ve=te[oe];Te?ce(Ve,Te):(U=Ve,T(),U=""),oe++}}function F(G,te){return G.scope&&typeof G.scope=="string"&&J.openNode(D.classNameAliases[G.scope]||G.scope),G.beginScope&&(G.beginScope._wrap?(ce(U,D.classNameAliases[G.beginScope._wrap]||G.beginScope._wrap),U=""):G.beginScope._multi&&(Ue(G.beginScope,te),U="")),H=Object.create(G,{parent:{value:H}}),H}function ae(G,te,oe){let _e=gb(G.endRe,oe);if(_e){if(G["on:end"]){const Te=new $l(G);G["on:end"](te,Te),Te.isMatchIgnored&&(_e=!1)}if(_e){for(;G.endsParent&&G.parent;)G=G.parent;return G}}if(G.endsWithParent)return ae(G.parent,te,oe)}function ie(G){return H.matcher.regexIndex===0?(U+=G[0],1):(ye=!0,0)}function he(G){const te=G[0],oe=G.rule,_e=new $l(oe),Te=[oe.__beforeBegin,oe["on:begin"]];for(const Ve of Te)if(Ve&&(Ve(G,_e),_e.isMatchIgnored))return ie(te);return oe.skip?U+=te:(oe.excludeBegin&&(U+=te),X(),!oe.returnBegin&&!oe.excludeBegin&&(U=te)),F(oe,G),oe.returnBegin?0:te.length}function Se(G){const te=G[0],oe=z.substring(G.index),_e=ae(H,G,oe);if(!_e)return jl;const Te=H;H.endScope&&H.endScope._wrap?(X(),ce(te,H.endScope._wrap)):H.endScope&&H.endScope._multi?(X(),Ue(H.endScope,G)):Te.skip?U+=te:(Te.returnEnd||Te.excludeEnd||(U+=te),X(),Te.excludeEnd&&(U=te));do H.scope&&J.closeNode(),!H.skip&&!H.subLanguage&&(fe+=H.relevance),H=H.parent;while(H!==_e.parent);return _e.starts&&F(_e.starts,G),Te.returnEnd?0:te.length}function m(){const G=[];for(let te=H;te!==D;te=te.parent)te.scope&&G.unshift(te.scope);G.forEach(te=>J.openNode(te))}let y={};function A(G,te){const oe=te&&te[0];if(U+=G,oe==null)return X(),0;if(y.type==="begin"&&te.type==="end"&&y.index===te.index&&oe===""){if(U+=z.slice(te.index,te.index+1),!r){const _e=new Error(`0 width match regex (${M})`);throw _e.languageName=M,_e.badRule=y.rule,_e}return 1}if(y=te,te.type==="begin")return he(te);if(te.type==="illegal"&&!Y){const _e=new Error('Illegal lexeme "'+oe+'" for mode "'+(H.scope||"<unnamed>")+'"');throw _e.mode=H,_e}else if(te.type==="end"){const _e=Se(te);if(_e!==jl)return _e}if(te.type==="illegal"&&oe==="")return U+=`
74
+ `,1;if(de>1e5&&de>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return U+=oe,oe.length}const D=C(M);if(!D)throw Ls(i.replace("{}",M)),new Error('Unknown language: "'+M+'"');const K=Zb(D);let B="",H=ue||K;const se={},J=new o.__emitter(o);m();let U="",fe=0,ne=0,de=0,ye=!1;try{if(D.__emitTokens)D.__emitTokens(z,J);else{for(H.matcher.considerAll();;){de++,ye?ye=!1:H.matcher.considerAll(),H.matcher.lastIndex=ne;const G=H.matcher.exec(z);if(!G)break;const te=z.substring(ne,G.index),oe=A(te,G);ne=G.index+oe}A(z.substring(ne))}return J.finalize(),B=J.toHTML(),{language:M,value:B,relevance:fe,illegal:!1,_emitter:J,_top:H}}catch(G){if(G.message&&G.message.includes("Illegal"))return{language:M,value:Li(z),illegal:!0,relevance:0,_illegalBy:{message:G.message,index:ne,context:z.slice(ne-100,ne+100),mode:G.mode,resultSoFar:B},_emitter:J};if(r)return{language:M,value:Li(z),illegal:!1,relevance:0,errorRaised:G,_emitter:J,_top:H};throw G}}function h(M){const z={value:Li(M),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return z._emitter.addText(M),z}function f(M,z){z=z||o.languages||Object.keys(t);const Y=h(M),ue=z.filter(C).filter(V).map(X=>d(X,M,!1));ue.unshift(Y);const xe=ue.sort((X,ce)=>{if(X.relevance!==ce.relevance)return ce.relevance-X.relevance;if(X.language&&ce.language){if(C(X.language).supersetOf===ce.language)return 1;if(C(ce.language).supersetOf===X.language)return-1}return 0}),[q,T]=xe,O=q;return O.secondBest=T,O}function g(M,z,Y){const ue=z&&s[z]||Y;M.classList.add("hljs"),M.classList.add(`language-${ue}`)}function b(M){let z=null;const Y=c(M);if(l(Y))return;if(L("before:highlightElement",{el:M,language:Y}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.children.length>0&&(o.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(M)),o.throwUnescapedHTML))throw new Xb("One of your code blocks includes unescaped HTML.",M.innerHTML);z=M;const ue=z.textContent,xe=Y?u(ue,{language:Y,ignoreIllegals:!0}):f(ue);M.innerHTML=xe.value,M.dataset.highlighted="yes",g(M,Y,xe.language),M.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(M.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),L("after:highlightElement",{el:M,result:xe,text:ue})}function S(M){o=Ml(o,M)}const E=()=>{P(),Ks("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){P(),Ks("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function P(){function M(){P()}if(document.readyState==="loading"){k||window.addEventListener("DOMContentLoaded",M,!1),k=!0;return}document.querySelectorAll(o.cssSelector).forEach(b)}function N(M,z){let Y=null;try{Y=z(e)}catch(ue){if(Ls("Language definition for '{}' could not be registered.".replace("{}",M)),r)Ls(ue);else throw ue;Y=a}Y.name||(Y.name=M),t[M]=Y,Y.rawDefinition=z.bind(null,e),Y.aliases&&j(Y.aliases,{languageName:M})}function R(M){delete t[M];for(const z of Object.keys(s))s[z]===M&&delete s[z]}function v(){return Object.keys(t)}function C(M){return M=(M||"").toLowerCase(),t[M]||t[s[M]]}function j(M,{languageName:z}){typeof M=="string"&&(M=[M]),M.forEach(Y=>{s[Y.toLowerCase()]=z})}function V(M){const z=C(M);return z&&!z.disableAutodetect}function Z(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=z=>{M["before:highlightBlock"](Object.assign({block:z.el},z))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=z=>{M["after:highlightBlock"](Object.assign({block:z.el},z))})}function $(M){Z(M),n.push(M)}function W(M){const z=n.indexOf(M);z!==-1&&n.splice(z,1)}function L(M,z){const Y=M;n.forEach(function(ue){ue[Y]&&ue[Y](z)})}function pe(M){return Ks("10.7.0","highlightBlock will be removed entirely in v12.0"),Ks("10.7.0","Please use highlightElement now."),b(M)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:P,highlightElement:b,highlightBlock:pe,configure:S,initHighlighting:E,initHighlightingOnLoad:x,registerLanguage:N,unregisterLanguage:R,listLanguages:v,getLanguage:C,registerAliases:j,autoDetection:V,inherit:Ml,addPlugin:$,removePlugin:W}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=Yb,e.regex={concat:Ds,lookahead:Gu,either:Ba,optional:fb,anyNumberOfTimes:hb};for(const M in yr)typeof yr[M]=="object"&&Ku(yr[M]);return Object.assign(e,yr),e},un=nd({});un.newInstance=()=>nd({});var ev=un;un.HighlightJS=un;un.default=un;const Ke=ob(ev),Fr="[A-Za-z$_][0-9A-Za-z$_]*",rd=["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"],id=["true","false","null","undefined","NaN","Infinity"],ad=["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"],od=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ld=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ud=[].concat(ld,ad,od);function tv(e){const t=e.regex,s=(Y,{after:ue})=>{const xe="</"+Y[0].slice(1);return Y.input.indexOf(xe,ue)!==-1},n=Fr,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ue)=>{const xe=Y[0].length+Y.index,q=Y.input[xe];if(q==="<"||q===","){ue.ignoreMatch();return}q===">"&&(s(Y,{after:xe})||ue.ignoreMatch());let T;const O=Y.input.substring(xe);if(T=O.match(/^\s*=/)){ue.ignoreMatch();return}if((T=O.match(/^\s+extends\s+/))&&T.index===0){ue.ignoreMatch();return}}},o={$pattern:Fr,keyword:rd,literal:id,built_in:ud,"variable.language":cd},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,S,{match:/\$\d+/},d];h.contains=k.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(k)});const P=[].concat(x,h.contains),N=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:N},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},C={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:{_:[...ad,...od]}},j={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(Y){return t.concat("(?!",Y.join("|"),")")}const W={match:t.concat(/\b/,$([...ld,"super","import"].map(Y=>`${Y}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),j,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,S,x,{match:/\$\d+/},d,C,{scope:"attr",match:n+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:M,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:o,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},V,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},W,Z,v,pe,{match:/\$[(.]/}]}}function dd(e){const t=e.regex,s=tv(e),n=Fr,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[s.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Fr,keyword:rd.concat(l),literal:id,built_in:ud.concat(r),"variable.language":cd},u={className:"meta",begin:"@"+n},d=(b,S,E)=>{const x=b.contains.findIndex(k=>k.label===S);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,E)};Object.assign(s.keywords,c),s.exports.PARAMS_CONTAINS.push(u);const h=s.contains.find(b=>b.scope==="attr"),f=Object.assign({},h,{match:t.concat(n,t.lookahead(/\s*\?:/))});s.exports.PARAMS_CONTAINS.push([s.exports.CLASS_REFERENCE,h,f]),s.contains=s.contains.concat([u,i,a,f]),d(s,"shebang",e.SHEBANG()),d(s,"use_strict",o);const g=s.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(s,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),s}const Dl="[A-Za-z$_][0-9A-Za-z$_]*",sv=["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"],nv=["true","false","null","undefined","NaN","Infinity"],hd=["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"],fd=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],pd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rv=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iv=[].concat(pd,hd,fd);function gd(e){const t=e.regex,s=(Y,{after:ue})=>{const xe="</"+Y[0].slice(1);return Y.input.indexOf(xe,ue)!==-1},n=Dl,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,ue)=>{const xe=Y[0].length+Y.index,q=Y.input[xe];if(q==="<"||q===","){ue.ignoreMatch();return}q===">"&&(s(Y,{after:xe})||ue.ignoreMatch());let T;const O=Y.input.substring(xe);if(T=O.match(/^\s*=/)){ue.ignoreMatch();return}if((T=O.match(/^\s+extends\s+/))&&T.index===0){ue.ignoreMatch();return}}},o={$pattern:Dl,keyword:sv,literal:nv,built_in:iv,"variable.language":rv},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,S,{match:/\$\d+/},d];h.contains=k.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(k)});const P=[].concat(x,h.contains),N=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(P)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:N},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},C={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:{_:[...hd,...fd]}},j={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(Y){return t.concat("(?!",Y.join("|"),")")}const W={match:t.concat(/\b/,$([...pd,"super","import"].map(Y=>`${Y}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",z={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(M)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),j,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,S,x,{match:/\$\d+/},d,C,{scope:"attr",match:n+t.lookahead(":"),relevance:0},z,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:M,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:o,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},V,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},W,Z,v,pe,{match:/\$[(.]/}]}}function md(e){const t=e.regex,s=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["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"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,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:o,illegal:/#/},u={begin:/\{\{/,relevance:0},d={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]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${n.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[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(${h})[jJ](?=${g})`}]},S={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},E={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,b,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,S,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,s,/\s*/,/\(\s*/,s,/\s*\)/]},{match:[/\bclass/,/\s+/,s]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,E,d]}]}}function bd(e){const t=e.regex,s={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[s]}]};Object.assign(s,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,r]};r.contains.push(o);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,s]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${h.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"],S=["true","false"],E={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],P=["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"],N=["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:S,built_in:[...x,...k,"set","shopt",...P,...N]},contains:[f,e.SHEBANG(),g,d,i,a,E,o,l,c,u,s]}}function av(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},s={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[t,s,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const ov=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_-]*/}}),lv=["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"],cv=["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"],uv=[...lv,...cv],dv=["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(),hv=["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(),fv=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pv=["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 gv(e){const t=e.regex,s=ov(e),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[s.BLOCK_COMMENT,n,s.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},s.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+hv.join("|")+")"},{begin:":(:)?("+fv.join("|")+")"}]},s.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[s.BLOCK_COMMENT,s.HEXCOLOR,s.IMPORTANT,s.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},s.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:r,attribute:dv.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,s.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+uv.join("|")+")\\b"}]}}function vd(e){const t=e.regex,s=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,r={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/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=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:n,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{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,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,a,l,o]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{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(s,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:s,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(s,/>/))),contains:[{className:"name",begin:s,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function mv(e){const t=e.regex,s=e.COMMENT("--","$"),n={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],d=["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"],h=["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(N=>!u.includes(N)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},S={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function x(N){return t.concat(/\b/,t.either(...N.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}const k={scope:"keyword",match:x(h),relevance:0};function P(N,{exceptions:R,when:v}={}){const C=v;return R=R||[],N.map(j=>j.match(/\|\d+$/)||R.includes(j)?j:C(j)?`${j}|0`:j)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:P(g,{when:N=>N.length<3}),literal:i,type:o,built_in:d},contains:[{scope:"type",match:x(a)},k,E,b,n,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,s,S]}}function yd(e){const t="true false yes no null",s="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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},S=[n,{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+!"+s},{className:"type",begin:"!<"+s+">"},{className:"type",begin:"!"+s},{className:"type",begin:"!!"+s},{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}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,b,i,a],E=[...S];return E.pop(),E.push(o),f.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:S}}function _d(e){const t=e.regex,s={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={begin:"^[-\\*]{3,}",end:"$"},r={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},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},d=e.inherit(c,{contains:[]}),h=e.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let f=[s,l];return[c,u,d,h].forEach(E=>{E.contains=E.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}]}]},s,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},r,n,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}Ke.registerLanguage("typescript",dd);Ke.registerLanguage("ts",dd);Ke.registerLanguage("javascript",gd);Ke.registerLanguage("js",gd);Ke.registerLanguage("python",md);Ke.registerLanguage("py",md);Ke.registerLanguage("bash",bd);Ke.registerLanguage("sh",bd);Ke.registerLanguage("json",av);Ke.registerLanguage("css",gv);Ke.registerLanguage("html",vd);Ke.registerLanguage("xml",vd);Ke.registerLanguage("sql",mv);Ke.registerLanguage("yaml",yd);Ke.registerLanguage("yml",yd);Ke.registerLanguage("markdown",_d);Ke.registerLanguage("md",_d);function Lt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").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,s,n)=>`<a href="${/^https?:\/\//i.test(n)||n.startsWith("/")||n.startsWith("#")?n:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${s}</a>`)}function wd(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Ul(e){return wd(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Mi(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function bv(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function vv(e){if(e.length<2)return e.map(o=>`<p class="my-1">${Lt(o)}</p>`).join(`
75
75
  `);const t=Mi(e[0]),s=e[1],n=Ul(s)?Mi(s).map(bv):t.map(()=>"text-left"),r=Ul(s)?e.slice(2):e.slice(1),i=t.map((o,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${n[l]??"text-left"}">${Lt(o)}</th>`).join(""),a=r.map(o=>{const l=Mi(o);return`<tr class="border-b border-gray-800">${t.map((u,d)=>`<td class="px-3 py-1.5 text-gray-400 ${n[d]??"text-left"}">${Lt(l[d]??"")}</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>${a}</tbody></table></div>`}function yv(e){if(!e.startsWith(`---
76
76
  `)&&e!=="---")return{frontmatter:null,body:e};const t=e.indexOf(`
77
77
  ---
78
78
  `,3),s=e.indexOf(`
79
79
  ---`,3),n=t!==-1?t:s!==-1&&e.slice(s).trimEnd()==="---"?s:-1;if(n===-1)return{frontmatter:null,body:e};const r=e.slice(4,n),i=t!==-1?e.slice(t+5):"",a={};for(const o of r.split(`
80
- `)){const l=o.match(/^([^:]+):\s*(.*)$/);if(!l)continue;const c=l[1].trim();let u=l[2].trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),a[c]=u}return{frontmatter:Object.keys(a).length>0?a:null,body:i}}function Ls(e){if(!e)return"";const t=e.split(`
80
+ `)){const l=o.match(/^([^:]+):\s*(.*)$/);if(!l)continue;const c=l[1].trim();let u=l[2].trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),a[c]=u}return{frontmatter:Object.keys(a).length>0?a:null,body:i}}function Ms(e){if(!e)return"";const t=e.split(`
81
81
  `),s=[];let n=!1,r=!1,i=!1,a=[],o="",l=[];function c(){r&&(s.push("</ul>"),r=!1)}function u(){i&&(s.push(vv(l)),l=[],i=!1)}for(const d of t){if(d.startsWith("```")){if(c(),u(),!n)n=!0,o=d.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const x=a.join(`
82
- `);let k;try{k=o&&Ke.getLanguage(o)?Ke.highlight(x,{language:o,ignoreIllegals:!0}).value:Ke.highlightAuto(x).value}catch{k=x.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const P=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),N=P?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${P}</span>`:"";s.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">${k}</code></pre>${N}</div>`),n=!1,o="",a=[]}continue}if(n){a.push(d);continue}if(wd(d)){c(),i=!0,l.push(d);continue}i&&u();const h=d.match(/^####\s+(.+)/),f=d.match(/^###\s+(.+)/),g=d.match(/^##\s+(.+)/),m=d.match(/^#\s+(.+)/);if(h){c(),s.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${Lt(h[1])}</h4>`);continue}if(f){c(),s.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${Lt(f[1])}</h3>`);continue}if(g){c(),s.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${Lt(g[1])}</h2>`);continue}if(m){c(),s.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${Lt(m[1])}</h1>`);continue}if(/^---+$/.test(d.trim())){c(),s.push('<hr class="border-gray-800 my-4" />');continue}const S=d.match(/^[-*+]\s+(.+)/);if(S){r||(s.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),r=!0),s.push(`<li>${Lt(S[1])}</li>`);continue}const E=d.match(/^\d+\.\s+(.+)/);if(E){r||(s.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),r=!0),s.push(`<li>${Lt(E[1])}</li>`);continue}if(d.trim()===""){c(),s.push('<div class="my-2"></div>');continue}c(),s.push(`<p class="my-1">${Lt(d)}</p>`)}if(n&&a.length){const d=a.join(`
82
+ `);let k;try{k=o&&Ke.getLanguage(o)?Ke.highlight(x,{language:o,ignoreIllegals:!0}).value:Ke.highlightAuto(x).value}catch{k=x.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const P=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),N=P?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${P}</span>`:"";s.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">${k}</code></pre>${N}</div>`),n=!1,o="",a=[]}continue}if(n){a.push(d);continue}if(wd(d)){c(),i=!0,l.push(d);continue}i&&u();const h=d.match(/^####\s+(.+)/),f=d.match(/^###\s+(.+)/),g=d.match(/^##\s+(.+)/),b=d.match(/^#\s+(.+)/);if(h){c(),s.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${Lt(h[1])}</h4>`);continue}if(f){c(),s.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${Lt(f[1])}</h3>`);continue}if(g){c(),s.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${Lt(g[1])}</h2>`);continue}if(b){c(),s.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${Lt(b[1])}</h1>`);continue}if(/^---+$/.test(d.trim())){c(),s.push('<hr class="border-gray-800 my-4" />');continue}const S=d.match(/^[-*+]\s+(.+)/);if(S){r||(s.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),r=!0),s.push(`<li>${Lt(S[1])}</li>`);continue}const E=d.match(/^\d+\.\s+(.+)/);if(E){r||(s.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),r=!0),s.push(`<li>${Lt(E[1])}</li>`);continue}if(d.trim()===""){c(),s.push('<div class="my-2"></div>');continue}c(),s.push(`<p class="my-1">${Lt(d)}</p>`)}if(n&&a.length){const d=a.join(`
83
83
  `).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.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">${d}</code></pre>`)}return u(),c(),s.join(`
84
- `)}const _v={key:0,class:"flex items-center gap-2.5 min-w-0"},wv={key:1,class:"w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center"},xv={class:"flex-1 py-3 overflow-y-auto overflow-x-hidden"},Ev={key:1,class:"text-[13px] font-medium truncate"},kv={class:"shrink-0"},Sv={class:"p-2.5"},Tv={class:"flex items-center gap-2 px-2 py-1.5 rounded-lg bg-surface-2/50 mb-1.5"},Av={class:"w-6 h-6 rounded-full bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0"},Rv={class:"text-[10px] text-accent font-semibold"},Cv={class:"min-w-0 flex-1"},Ov={class:"text-xs text-txt-primary truncate leading-tight"},$v={class:"flex items-center justify-between px-2"},Nv={class:"flex items-center gap-1.5"},Iv={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},Pv={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},Lv={key:1,class:"flex items-center gap-1.5 px-2"},Mv={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},jv={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},Dv={key:1,class:"flex flex-col items-center gap-1.5"},Uv={key:1,class:"md:hidden fixed bottom-0 inset-x-0 z-50 flex items-stretch border-t border-edge",style:{background:"linear-gradient(180deg, rgba(8,13,22,0.93) 0%, rgba(5,8,15,0.98) 100%)","backdrop-filter":"blur(12px)","padding-bottom":"env(safe-area-inset-bottom)"},"aria-label":"Mobile navigation"},Bv={key:0,class:"absolute top-0 left-1/2 -translate-x-1/2 w-6 h-[2px] bg-accent rounded-b-full"},Hv={class:"relative"},Fv={key:0,class:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] flex items-center justify-center bg-red-500 text-white text-[7px] font-bold rounded-full px-0.5 ring-1 ring-surface-0"},Vv={class:"text-[9px] leading-tight font-medium truncate max-w-full px-0.5"},qv={class:"relative bg-surface-1 border border-edge rounded-2xl shadow-card w-full max-w-lg max-h-[80vh] flex flex-col z-10"},zv={class:"flex items-start justify-between p-5 pb-4 border-b border-edge/50 shrink-0"},Kv={key:0,class:"flex items-center gap-2 mt-1.5"},Wv={class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50"},Gv={class:"text-[10px] text-txt-muted"},Zv={class:"text-[10px] text-txt-muted/60"},Jv={class:"overflow-y-auto flex-1 p-5"},Yv={key:0,class:"flex items-center justify-center py-8 text-txt-muted text-sm gap-3"},Xv={key:1,class:"text-txt-muted text-sm py-6 text-center"},Qv=["innerHTML"],Bl="io-last-seen-version",Hl="io-nav-collapsed",ey=pt({__name:"AppNav",setup(e){const t=Eu(),s=xu(),n=nr(),r=Q(""),i=Q(0),a=Q(!1);let o=null;const l=Q(!1),c=Q(!1),u=Q([]),d=Q(!1),h=[{to:"/chat",name:"chat",icon:'<path d="M10 2a8 8 0 1 1-3.61 15.14l-.12-.07-3.65.92a.5.5 0 0 1-.62-.45v-.08l.01-.08.92-3.64-.07-.12a7.95 7.95 0 0 1-.83-2.9l-.02-.37L2 10a8 8 0 0 1 8-8Zm0 1a7 7 0 0 0-6.1 10.42.5.5 0 0 1 .06.28l-.02.1-.75 3.01 3.02-.75a.5.5 0 0 1 .19-.01l.09.02.09.04A7 7 0 1 0 10 3Zm.5 8a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h3.09Zm2-3a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h5.09Z"/>',label:"Chat"},{to:"/feed",name:"feed",icon:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',label:"Feed"},{to:"/skills",name:"skills",icon:'<path d="M9 6.5a4.5 4.5 0 0 1 6.35-4.1.5.5 0 0 1 .15.8l-2.3 2.3 1.3 1.3 2.3-2.3a.5.5 0 0 1 .8.15A4.49 4.49 0 0 1 13.5 11a4.5 4.5 0 0 1-1.1-.14l-6.37 6.45a2.36 2.36 0 0 1-3.37-3.3l6.42-6.65A4.52 4.52 0 0 1 9 6.5ZM13.5 3a3.5 3.5 0 0 0-3.39 4.39.5.5 0 0 1-.12.47L3.38 14.7a1.36 1.36 0 0 0 1.94 1.9l6.57-6.66a.5.5 0 0 1 .51-.12 3.5 3.5 0 0 0 4.53-4.05l-2.08 2.07a.5.5 0 0 1-.7 0l-2-2a.5.5 0 0 1 0-.7l2.07-2.08A3.52 3.52 0 0 0 13.5 3Z"/>',label:"Skills"},{to:"/squads",name:"squads",icon:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',label:"Squads"},{to:"/wiki",name:"wiki",icon:'<path d="M10 16c-.46.6-1.18 1-2 1H3.5A1.5 1.5 0 0 1 2 15.5v-11C2 3.67 2.67 3 3.5 3H8c.82 0 1.54.4 2 1 .46-.6 1.18-1 2-1h4.5c.83 0 1.5.67 1.5 1.5v11c0 .83-.67 1.5-1.5 1.5H12a2.5 2.5 0 0 1-2-1ZM3 4.5v11c0 .28.22.5.5.5H8c.83 0 1.5-.67 1.5-1.5v-9C9.5 4.67 8.83 4 8 4H3.5a.5.5 0 0 0-.5.5Zm7.5 10c0 .83.67 1.5 1.5 1.5h4.5a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5H12c-.83 0-1.5.67-1.5 1.5v9Z"/>',label:"Wiki"},{to:"/schedules",name:"schedules",icon:'<path d="M7 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-5.5A2.5 2.5 0 0 0 14.5 3h-9A2.5 2.5 0 0 0 3 5.5v9A2.5 2.5 0 0 0 5.5 17h9a2.5 2.5 0 0 0 2.5-2.5v-9ZM4 7h12v7.5c0 .83-.67 1.5-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5V7Zm1.5-3h9c.83 0 1.5.67 1.5 1.5V6H4v-.5C4 4.67 4.67 4 5.5 4Z"/>',label:"Schedules"},{to:"/activity",name:"activity",icon:'<path d="M16.52 9c.26 0 .48-.2.48-.46V8.5A6.5 6.5 0 0 0 10.5 2h-.04a.47.47 0 0 0-.46.48V8.5c0 .28.22.5.5.5h6.02ZM11 3.02A5.5 5.5 0 0 1 15.98 8H11V3.02ZM8 9V5.1A5 5 0 0 0 9 15v1a6 6 0 0 1-.5-11.98c.28-.02.5.2.5.48V9a1 1 0 0 0 1 1h4.5c.28 0 .5.22.48.5a6 6 0 0 1-.06.5H10a2 2 0 0 1-2-2Zm9 1a1 1 0 0 0-1 1v7a1 1 0 1 0 2 0v-7a1 1 0 0 0-1-1Zm-3 2a1 1 0 0 0-1 1v5a1 1 0 1 0 2 0v-5a1 1 0 0 0-1-1Zm-4 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0v-3Z"/>',label:"Activity"}],f=je(()=>{var v;return(((v=n.user)==null?void 0:v.email)??"").charAt(0).toUpperCase()});function g(R){return t.name===R}function m(R){try{return new Date(R).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return R}}async function S(){if(l.value=!0,r.value){try{localStorage.setItem(Bl,r.value)}catch{}c.value=!1}if(!(u.value.length>0)){d.value=!0;try{const R=await Ce("/api/releases");if(R.ok){const v=await R.json();u.value=v.releases??[]}}catch{}d.value=!1}}function E(){l.value=!1}function x(){a.value=!a.value;try{localStorage.setItem(Hl,String(a.value))}catch{}}async function k(){await n.signOut(),s.push("/login")}function P(){i.value=0}Ht(async()=>{try{const R=localStorage.getItem(Hl);R!==null&&(a.value=R==="true")}catch{}try{const R=await Ce("/api/status");if(R.ok){const v=await R.json();r.value=v.version??"";try{const C=localStorage.getItem(Bl);r.value&&r.value!==C&&(c.value=!0)}catch{}}}catch{}window.addEventListener("keydown",R=>{R.key==="Escape"&&E()});try{const R=await Ce("/api/feed/count");if(R.ok){const v=await R.json();i.value=v.count??0}}catch{}N()});async function N(R=0){o==null||o.close(),o=null;const v=new EventSource(await fi("/api/events"));o=v,v.onmessage=C=>{try{JSON.parse(C.data).type==="feed"&&t.name!=="feed"&&i.value++}catch{}},v.onerror=async()=>{if(v.close(),o===v&&(o=null),!(R>=3)){try{const C=await Qs();C&&await C.auth.refreshSession()}catch{}setTimeout(()=>N(R+1),2e3*(R+1))}}}return ti(()=>{o==null||o.close(),o=null}),(R,v)=>(_(),w(ke,null,[Ie(t).name!=="login"?(_(),w("nav",{key:0,class:ge(["relative z-10 hidden md:flex flex-col shrink-0 nav-sidebar border-r border-edge backdrop-blur-md",a.value?"nav-collapsed":"nav-expanded"]),style:{background:"linear-gradient(180deg, rgba(10,17,32,0.85) 0%, rgba(12,18,32,0.78) 50%, rgba(8,13,25,0.88) 100%)"}},[p("div",{class:ge(["flex items-center h-14 px-3 shrink-0",a.value?"justify-center":"justify-between"])},[a.value?(_(),w("div",wv,[...v[1]||(v[1]=[p("span",{class:"text-accent font-bold text-xs font-mono tracking-tight"},"IO",-1)])])):(_(),w("div",_v,[...v[0]||(v[0]=[er('<div class="w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0" data-v-fef55011><span class="text-accent font-bold text-sm font-mono tracking-tight" data-v-fef55011>IO</span></div><div class="min-w-0" data-v-fef55011><p class="text-sm font-semibold text-txt-primary leading-tight tracking-tight" data-v-fef55011>IO Assistant</p><p class="text-[10px] text-txt-muted leading-tight" data-v-fef55011>Terminal · Dashboard</p></div>',2)])])),a.value?(_(),w("button",{key:3,onClick:x,class:"absolute -right-3 top-4 w-6 h-6 rounded-full bg-surface-2 border border-edge-bright shadow-card flex items-center justify-center text-txt-muted hover:text-accent hover:border-accent/30 transition-all duration-150 z-20",title:"Expand sidebar"},[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:12})])):(_(),w("button",{key:2,onClick:x,class:"p-1.5 rounded-md text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 transition-all duration-150 shrink-0 ml-1",title:"Collapse sidebar"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14})]))],2),v[8]||(v[8]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.12] to-transparent"},null,-1)),p("div",xv,[p("ul",{class:ge(["space-y-0.5",a.value?"px-1.5":"px-2"])},[(_(),w(ke,null,ze(h,C=>p("li",{key:C.to},[be(Ie(sa),{to:C.to,class:ge(["group flex items-center rounded-lg transition-all duration-150 relative",[a.value?"justify-center p-2":"px-2.5 py-2 gap-2.5",g(C.name)?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"]]),title:a.value?C.label:void 0,onClick:j=>C.name==="feed"?P():void 0},{default:gs(()=>[g(C.name)?(_(),w("span",{key:0,class:ge(["absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-r-full bg-accent shadow-glow-sm",a.value?"h-4":"h-5"])},null,2)):ee("",!0),be(Re,{paths:C.icon,size:18,class:ge(["shrink-0 transition-transform duration-150 group-hover:scale-105",a.value?"":"ml-0.5"])},null,8,["paths","class"]),a.value?ee("",!0):(_(),w("span",Ev,I(C.label),1)),C.name==="feed"&&i.value>0?(_(),w("span",{key:2,class:ge(["absolute flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full min-w-[16px] h-[16px] px-0.5 ring-2 ring-surface-1",a.value?"top-0 right-0":"top-0.5 right-1"])},I(i.value>99?"99+":i.value),3)):ee("",!0)]),_:2},1032,["to","class","title","onClick"])])),64))],2)]),p("div",kv,[v[7]||(v[7]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.08] to-transparent"},null,-1)),p("div",Sv,[a.value?(_(),w("div",Dv,[v[6]||(v[6]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"p-1.5 rounded-md text-txt-muted hover:text-accent hover:bg-surface-3/50 transition-all duration-150",title:"GitHub"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1)),Ie(n).authEnabled&&Ie(n).user?(_(),w("button",{key:0,onClick:k,class:"p-1.5 rounded-md text-txt-muted hover:text-red-400 hover:bg-surface-3/50 transition-all duration-150",title:"Sign out"},[be(Re,{paths:'<path d="M9.16 16.87a.5.5 0 1 0 .67-.74L3.67 10.5H17.5a.5.5 0 0 0 0-1H3.67l6.16-5.63a.5.5 0 0 0-.67-.74L2.24 9.44a.75.75 0 0 0 0 1.11l6.92 6.32Z"/>',size:14})])):ee("",!0)])):(_(),w(ke,{key:0},[Ie(n).authEnabled&&Ie(n).user?(_(),w(ke,{key:0},[p("div",Tv,[p("div",Av,[p("span",Rv,I(f.value),1)]),p("div",Cv,[p("p",Ov,I(Ie(n).user.email),1)])]),p("div",$v,[p("span",Nv,[r.value?(_(),w("button",{key:0,onClick:S,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"What's New"},[p("span",Iv,"v"+I(r.value),1),c.value?(_(),w("span",Pv)):ee("",!0)])):ee("",!0),v[2]||(v[2]=p("span",{class:"text-[10px] text-txt-muted"},"·",-1)),v[3]||(v[3]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]),p("button",{onClick:k,class:"text-[11px] text-txt-muted hover:text-red-400 transition-colors px-1.5 py-0.5 rounded hover:bg-surface-3/50"}," Sign out ")])],64)):(_(),w("div",Lv,[r.value?(_(),w("button",{key:0,onClick:S,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"What's New"},[p("span",Mv,"v"+I(r.value),1),c.value?(_(),w("span",jv)):ee("",!0)])):ee("",!0),v[4]||(v[4]=p("span",{class:"text-[10px] text-txt-muted"},"·",-1)),v[5]||(v[5]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]))],64))])])],2)):ee("",!0),Ie(t).name!=="login"?(_(),w("nav",Uv,[(_(),w(ke,null,ze(h,C=>be(Ie(sa),{key:C.to,to:C.to,class:ge(["relative flex-1 flex flex-col items-center justify-center gap-0.5 py-2 px-1 min-w-0 transition-colors duration-150 touch-manipulation select-none",g(C.name)?"text-accent":"text-txt-muted"]),onClick:j=>C.name==="feed"?P():void 0,"aria-label":C.label},{default:gs(()=>[g(C.name)?(_(),w("span",Bv)):ee("",!0),p("span",Hv,[be(Re,{paths:C.icon,size:20},null,8,["paths"]),C.name==="feed"&&i.value>0?(_(),w("span",Fv,I(i.value>9?"9+":i.value),1)):ee("",!0)]),p("span",Vv,I(C.label),1)]),_:2},1032,["to","class","onClick","aria-label"])),64))])):ee("",!0),(_(),nn(wh,{to:"body"},[be(ii,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gs(()=>[l.value?(_(),w("div",{key:0,class:"fixed inset-0 z-[100] flex items-center justify-center p-4 sm:p-6",onClick:yt(E,["self"])},[p("div",{class:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:E}),p("div",qv,[p("div",zv,[p("div",null,[v[9]||(v[9]=p("h2",{class:"text-base font-semibold text-txt-primary"},"What's New",-1)),u.value.length>0?(_(),w("div",Kv,[p("span",Wv,I(u.value[0].tag),1),p("span",Gv,I(u.value[0].name),1),p("span",Zv,I(m(u.value[0].published_at)),1)])):ee("",!0)]),p("button",{onClick:E,class:"p-1.5 rounded-lg text-txt-muted hover:text-txt-primary hover:bg-surface-3/40 transition-all duration-150 shrink-0 ml-3 mt-0.5",title:"Close"},[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16})])]),p("div",Jv,[d.value?(_(),w("div",Yv,[...v[10]||(v[10]=[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading release notes… ",-1)])])):u.value.length===0?(_(),w("div",Xv," No release notes found. ")):(_(),w("div",{key:2,class:"wiki-content text-sm text-txt-secondary leading-relaxed",innerHTML:Ie(Ls)(u.value[0].body)},null,8,Qv))]),v[11]||(v[11]=p("div",{class:"p-4 pt-3 border-t border-edge/50 shrink-0"},[p("a",{href:"https://github.com/michaeljolley/io/releases",target:"_blank",rel:"noopener",class:"text-xs text-accent hover:text-accent-glow transition-colors"}," View all releases on GitHub → ")],-1))])])):ee("",!0)]),_:1})]))],64))}}),rr=(e,t)=>{const s=e.__vccOpts||e;for(const[n,r]of t)s[n]=r;return s},ty=rr(ey,[["__scopeId","data-v-fef55011"]]),sy={class:"flex h-screen bg-surface-0 relative overflow-hidden"},ny={class:"flex-1 overflow-auto relative z-0 pb-16 md:pb-0"},ry=pt({__name:"App",setup(e){return(t,s)=>(_(),w("div",sy,[s[1]||(s[1]=er('<div class="pointer-events-none absolute inset-0 overflow-hidden" aria-hidden="true" data-v-e49ca296><div class="absolute -top-[30%] -right-[15%] w-[65%] h-[70%] rounded-full bg-accent/[0.03] blur-[160px]" data-v-e49ca296></div><div class="absolute -bottom-[25%] -left-[15%] w-[55%] h-[55%] rounded-full bg-blue-900/[0.06] blur-[140px]" data-v-e49ca296></div><div class="absolute top-[15%] left-[25%] w-[45%] h-[50%] rounded-full bg-indigo-950/[0.08] blur-[180px]" data-v-e49ca296></div><div class="absolute top-0 inset-x-0 h-px bg-gradient-to-r from-transparent via-accent/[0.18] to-transparent" data-v-e49ca296></div><div class="absolute inset-0" style="background:radial-gradient(ellipse 85% 75% at 50% 40%, transparent 45%, rgba(3, 5, 10, 0.35) 100%);" data-v-e49ca296></div></div>',1)),be(ty),p("main",ny,[s[0]||(s[0]=p("div",{class:"pointer-events-none absolute top-0 inset-x-0 h-[2px] bg-gradient-to-r from-transparent via-accent/[0.1] to-transparent z-10","aria-hidden":"true"},null,-1)),be(Ie(wu),null,{default:gs(({Component:n})=>[be(ii,{name:"view",mode:"out-in"},{default:gs(()=>[(_(),nn(Mh(n)))]),_:2},1024)]),_:1})])]))}}),iy=rr(ry,[["__scopeId","data-v-e49ca296"]]),ay=lu("chat",()=>{const e=Q([]),t=Q(!1);function s(i){e.value.push(i)}function n(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.content+=i)}function r(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.streaming=i)}return{messages:e,isLoading:t,addMessage:s,appendToLast:n,setLastStreaming:r}}),oy={class:"flex flex-col h-full relative bg-surface-0"},ly={key:0,class:"flex flex-col items-center justify-center h-full select-none animate-fade-in"},cy={class:"flex flex-wrap justify-center gap-2 mt-8 max-w-md"},uy=["onClick"],dy={key:1,class:"max-w-3xl mx-auto space-y-5"},hy={key:0,class:"max-w-[80%] px-4 py-2.5 rounded-2xl rounded-br-md text-sm whitespace-pre-wrap bg-gradient-to-br from-accent/[0.14] to-accent/[0.08] text-txt-primary border border-accent/20 shadow-glow-sm"},fy={key:1,class:"max-w-[85%] flex gap-2.5 items-start"},py=["innerHTML"],gy={key:0,class:"flex justify-start animate-fade-in"},my={class:"shrink-0 border-t border-edge/50 backdrop-blur-md p-3 sm:p-4",style:{background:"linear-gradient(180deg, rgba(12,18,32,0.75) 0%, rgba(8,13,22,0.88) 100%)"}},by={class:"flex-1 relative group"},vy=["disabled"],yy=["disabled"],_y={class:"hidden sm:inline"},wy=["disabled"],xy='<span class="stream-cursor"></span>',Ey=pt({__name:"ChatView",setup(e){const t=ay(),s=Eu(),n=Q(""),r=Q(!1),i=Q(null),a=Q(!1),o=Q(null),l=["Check squad status","Run my schedules","Summarize recent activity","What skills are installed?"];function c(E){n.value=E,Ns(()=>S())}async function u(){if(!r.value){r.value=!0;try{await Ce("/api/orchestrator/abort",{method:"POST"})}catch{}finally{r.value=!1}}}const d=je(()=>t.messages.some(E=>E.streaming));function h(){const E=i.value;E&&(a.value=E.scrollTop+E.clientHeight<E.scrollHeight-100)}function f(E=!0){Ns(()=>{i.value&&i.value.scrollTo({top:i.value.scrollHeight,behavior:E?"smooth":"instant"})})}Ht(()=>{f(!1)}),es(()=>s.name,E=>{E==="chat"&&f(!1)}),es(()=>t.messages.length,()=>{a.value||f()});function g(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),S())}function m(){const E=o.value;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,200)+"px")}async function S(){const E=n.value.trim();if(!E||t.isLoading)return;n.value="",Ns(()=>{o.value&&(o.value.style.height="auto")}),t.isLoading=!0,t.addMessage({id:crypto.randomUUID(),role:"user",content:E}),t.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),f();const x=new EventSource(await fi("/api/events"));x.onmessage=k=>{try{const P=JSON.parse(k.data);P.type==="delta"?(t.appendToLast(P.text),f()):P.type==="done"&&(t.setLastStreaming(!1),t.isLoading=!1,x.close(),f())}catch{}},x.onerror=()=>{t.setLastStreaming(!1),t.isLoading=!1,x.close()};try{await Ce("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:E})})}catch{t.appendToLast(`
84
+ `)}const _v={key:0,class:"flex items-center gap-2.5 min-w-0"},wv={key:1,class:"w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center"},xv={class:"flex-1 py-3 overflow-y-auto overflow-x-hidden"},Ev={key:1,class:"text-[13px] font-medium truncate"},kv={class:"shrink-0"},Sv={class:"p-2.5"},Tv={class:"flex items-center gap-2 px-2 py-1.5 rounded-lg bg-surface-2/50 mb-1.5"},Av={class:"w-6 h-6 rounded-full bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0"},Rv={class:"text-[10px] text-accent font-semibold"},Cv={class:"min-w-0 flex-1"},Ov={class:"text-xs text-txt-primary truncate leading-tight"},$v={class:"flex items-center justify-between px-2"},Nv={class:"flex items-center gap-1.5"},Iv={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},Pv={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},Lv={key:1,class:"flex items-center gap-1.5 px-2"},Mv={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},jv={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},Dv={key:1,class:"flex flex-col items-center gap-1.5"},Uv={key:1,class:"md:hidden fixed bottom-0 inset-x-0 z-50 flex items-stretch border-t border-edge",style:{background:"linear-gradient(180deg, rgba(8,13,22,0.93) 0%, rgba(5,8,15,0.98) 100%)","backdrop-filter":"blur(12px)","padding-bottom":"env(safe-area-inset-bottom)"},"aria-label":"Mobile navigation"},Bv={key:0,class:"absolute top-0 left-1/2 -translate-x-1/2 w-6 h-[2px] bg-accent rounded-b-full"},Hv={class:"relative"},Fv={key:0,class:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] flex items-center justify-center bg-red-500 text-white text-[7px] font-bold rounded-full px-0.5 ring-1 ring-surface-0"},Vv={class:"text-[9px] leading-tight font-medium truncate max-w-full px-0.5"},qv={class:"relative bg-surface-1 border border-edge rounded-2xl shadow-card w-full max-w-lg max-h-[80vh] flex flex-col z-10"},zv={class:"flex items-start justify-between p-5 pb-4 border-b border-edge/50 shrink-0"},Kv={key:0,class:"flex items-center gap-2 mt-1.5"},Wv={class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50"},Gv={class:"text-[10px] text-txt-muted"},Zv={class:"text-[10px] text-txt-muted/60"},Jv={class:"overflow-y-auto flex-1 p-5"},Yv={key:0,class:"flex items-center justify-center py-8 text-txt-muted text-sm gap-3"},Xv={key:1,class:"text-txt-muted text-sm py-6 text-center"},Qv=["innerHTML"],Bl="io-last-seen-version",Hl="io-nav-collapsed",ey=pt({__name:"AppNav",setup(e){const t=Eu(),s=xu(),n=nr(),r=Q(""),i=Q(0),a=Q(!1);let o=null;const l=Q(!1),c=Q(!1),u=Q([]),d=Q(!1),h=[{to:"/chat",name:"chat",icon:'<path d="M10 2a8 8 0 1 1-3.61 15.14l-.12-.07-3.65.92a.5.5 0 0 1-.62-.45v-.08l.01-.08.92-3.64-.07-.12a7.95 7.95 0 0 1-.83-2.9l-.02-.37L2 10a8 8 0 0 1 8-8Zm0 1a7 7 0 0 0-6.1 10.42.5.5 0 0 1 .06.28l-.02.1-.75 3.01 3.02-.75a.5.5 0 0 1 .19-.01l.09.02.09.04A7 7 0 1 0 10 3Zm.5 8a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h3.09Zm2-3a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h5.09Z"/>',label:"Chat"},{to:"/feed",name:"feed",icon:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',label:"Feed"},{to:"/skills",name:"skills",icon:'<path d="M9 6.5a4.5 4.5 0 0 1 6.35-4.1.5.5 0 0 1 .15.8l-2.3 2.3 1.3 1.3 2.3-2.3a.5.5 0 0 1 .8.15A4.49 4.49 0 0 1 13.5 11a4.5 4.5 0 0 1-1.1-.14l-6.37 6.45a2.36 2.36 0 0 1-3.37-3.3l6.42-6.65A4.52 4.52 0 0 1 9 6.5ZM13.5 3a3.5 3.5 0 0 0-3.39 4.39.5.5 0 0 1-.12.47L3.38 14.7a1.36 1.36 0 0 0 1.94 1.9l6.57-6.66a.5.5 0 0 1 .51-.12 3.5 3.5 0 0 0 4.53-4.05l-2.08 2.07a.5.5 0 0 1-.7 0l-2-2a.5.5 0 0 1 0-.7l2.07-2.08A3.52 3.52 0 0 0 13.5 3Z"/>',label:"Skills"},{to:"/squads",name:"squads",icon:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',label:"Squads"},{to:"/wiki",name:"wiki",icon:'<path d="M10 16c-.46.6-1.18 1-2 1H3.5A1.5 1.5 0 0 1 2 15.5v-11C2 3.67 2.67 3 3.5 3H8c.82 0 1.54.4 2 1 .46-.6 1.18-1 2-1h4.5c.83 0 1.5.67 1.5 1.5v11c0 .83-.67 1.5-1.5 1.5H12a2.5 2.5 0 0 1-2-1ZM3 4.5v11c0 .28.22.5.5.5H8c.83 0 1.5-.67 1.5-1.5v-9C9.5 4.67 8.83 4 8 4H3.5a.5.5 0 0 0-.5.5Zm7.5 10c0 .83.67 1.5 1.5 1.5h4.5a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5H12c-.83 0-1.5.67-1.5 1.5v9Z"/>',label:"Wiki"},{to:"/schedules",name:"schedules",icon:'<path d="M7 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-5.5A2.5 2.5 0 0 0 14.5 3h-9A2.5 2.5 0 0 0 3 5.5v9A2.5 2.5 0 0 0 5.5 17h9a2.5 2.5 0 0 0 2.5-2.5v-9ZM4 7h12v7.5c0 .83-.67 1.5-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5V7Zm1.5-3h9c.83 0 1.5.67 1.5 1.5V6H4v-.5C4 4.67 4.67 4 5.5 4Z"/>',label:"Schedules"},{to:"/activity",name:"activity",icon:'<path d="M16.52 9c.26 0 .48-.2.48-.46V8.5A6.5 6.5 0 0 0 10.5 2h-.04a.47.47 0 0 0-.46.48V8.5c0 .28.22.5.5.5h6.02ZM11 3.02A5.5 5.5 0 0 1 15.98 8H11V3.02ZM8 9V5.1A5 5 0 0 0 9 15v1a6 6 0 0 1-.5-11.98c.28-.02.5.2.5.48V9a1 1 0 0 0 1 1h4.5c.28 0 .5.22.48.5a6 6 0 0 1-.06.5H10a2 2 0 0 1-2-2Zm9 1a1 1 0 0 0-1 1v7a1 1 0 1 0 2 0v-7a1 1 0 0 0-1-1Zm-3 2a1 1 0 0 0-1 1v5a1 1 0 1 0 2 0v-5a1 1 0 0 0-1-1Zm-4 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0v-3Z"/>',label:"Activity"}],f=je(()=>{var v;return(((v=n.user)==null?void 0:v.email)??"").charAt(0).toUpperCase()});function g(R){return t.name===R}function b(R){try{return new Date(R).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return R}}async function S(){if(l.value=!0,r.value){try{localStorage.setItem(Bl,r.value)}catch{}c.value=!1}if(!(u.value.length>0)){d.value=!0;try{const R=await Ce("/api/releases");if(R.ok){const v=await R.json();u.value=v.releases??[]}}catch{}d.value=!1}}function E(){l.value=!1}function x(){a.value=!a.value;try{localStorage.setItem(Hl,String(a.value))}catch{}}async function k(){await n.signOut(),s.push("/login")}function P(){i.value=0}Ht(async()=>{try{const R=localStorage.getItem(Hl);R!==null&&(a.value=R==="true")}catch{}try{const R=await Ce("/api/status");if(R.ok){const v=await R.json();r.value=v.version??"";try{const C=localStorage.getItem(Bl);r.value&&r.value!==C&&(c.value=!0)}catch{}}}catch{}window.addEventListener("keydown",R=>{R.key==="Escape"&&E()});try{const R=await Ce("/api/feed/count");if(R.ok){const v=await R.json();i.value=v.count??0}}catch{}N()});async function N(R=0){o==null||o.close(),o=null;const v=new EventSource(await fi("/api/events"));o=v,v.onmessage=C=>{try{JSON.parse(C.data).type==="feed"&&t.name!=="feed"&&i.value++}catch{}},v.onerror=async()=>{if(v.close(),o===v&&(o=null),!(R>=3)){try{const C=await Cs();C&&await C.auth.refreshSession()}catch{}setTimeout(()=>N(R+1),2e3*(R+1))}}}return ti(()=>{o==null||o.close(),o=null}),(R,v)=>(_(),w(ke,null,[Ie(t).name!=="login"?(_(),w("nav",{key:0,class:ge(["relative z-10 hidden md:flex flex-col shrink-0 nav-sidebar border-r border-edge backdrop-blur-md",a.value?"nav-collapsed":"nav-expanded"]),style:{background:"linear-gradient(180deg, rgba(10,17,32,0.85) 0%, rgba(12,18,32,0.78) 50%, rgba(8,13,25,0.88) 100%)"}},[p("div",{class:ge(["flex items-center h-14 px-3 shrink-0",a.value?"justify-center":"justify-between"])},[a.value?(_(),w("div",wv,[...v[1]||(v[1]=[p("span",{class:"text-accent font-bold text-xs font-mono tracking-tight"},"IO",-1)])])):(_(),w("div",_v,[...v[0]||(v[0]=[er('<div class="w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0" data-v-fef55011><span class="text-accent font-bold text-sm font-mono tracking-tight" data-v-fef55011>IO</span></div><div class="min-w-0" data-v-fef55011><p class="text-sm font-semibold text-txt-primary leading-tight tracking-tight" data-v-fef55011>IO Assistant</p><p class="text-[10px] text-txt-muted leading-tight" data-v-fef55011>Terminal · Dashboard</p></div>',2)])])),a.value?(_(),w("button",{key:3,onClick:x,class:"absolute -right-3 top-4 w-6 h-6 rounded-full bg-surface-2 border border-edge-bright shadow-card flex items-center justify-center text-txt-muted hover:text-accent hover:border-accent/30 transition-all duration-150 z-20",title:"Expand sidebar"},[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:12})])):(_(),w("button",{key:2,onClick:x,class:"p-1.5 rounded-md text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 transition-all duration-150 shrink-0 ml-1",title:"Collapse sidebar"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14})]))],2),v[8]||(v[8]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.12] to-transparent"},null,-1)),p("div",xv,[p("ul",{class:ge(["space-y-0.5",a.value?"px-1.5":"px-2"])},[(_(),w(ke,null,ze(h,C=>p("li",{key:C.to},[be(Ie(sa),{to:C.to,class:ge(["group flex items-center rounded-lg transition-all duration-150 relative",[a.value?"justify-center p-2":"px-2.5 py-2 gap-2.5",g(C.name)?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"]]),title:a.value?C.label:void 0,onClick:j=>C.name==="feed"?P():void 0},{default:gs(()=>[g(C.name)?(_(),w("span",{key:0,class:ge(["absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-r-full bg-accent shadow-glow-sm",a.value?"h-4":"h-5"])},null,2)):ee("",!0),be(Re,{paths:C.icon,size:18,class:ge(["shrink-0 transition-transform duration-150 group-hover:scale-105",a.value?"":"ml-0.5"])},null,8,["paths","class"]),a.value?ee("",!0):(_(),w("span",Ev,I(C.label),1)),C.name==="feed"&&i.value>0?(_(),w("span",{key:2,class:ge(["absolute flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full min-w-[16px] h-[16px] px-0.5 ring-2 ring-surface-1",a.value?"top-0 right-0":"top-0.5 right-1"])},I(i.value>99?"99+":i.value),3)):ee("",!0)]),_:2},1032,["to","class","title","onClick"])])),64))],2)]),p("div",kv,[v[7]||(v[7]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.08] to-transparent"},null,-1)),p("div",Sv,[a.value?(_(),w("div",Dv,[v[6]||(v[6]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"p-1.5 rounded-md text-txt-muted hover:text-accent hover:bg-surface-3/50 transition-all duration-150",title:"GitHub"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1)),Ie(n).authEnabled&&Ie(n).user?(_(),w("button",{key:0,onClick:k,class:"p-1.5 rounded-md text-txt-muted hover:text-red-400 hover:bg-surface-3/50 transition-all duration-150",title:"Sign out"},[be(Re,{paths:'<path d="M9.16 16.87a.5.5 0 1 0 .67-.74L3.67 10.5H17.5a.5.5 0 0 0 0-1H3.67l6.16-5.63a.5.5 0 0 0-.67-.74L2.24 9.44a.75.75 0 0 0 0 1.11l6.92 6.32Z"/>',size:14})])):ee("",!0)])):(_(),w(ke,{key:0},[Ie(n).authEnabled&&Ie(n).user?(_(),w(ke,{key:0},[p("div",Tv,[p("div",Av,[p("span",Rv,I(f.value),1)]),p("div",Cv,[p("p",Ov,I(Ie(n).user.email),1)])]),p("div",$v,[p("span",Nv,[r.value?(_(),w("button",{key:0,onClick:S,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"What's New"},[p("span",Iv,"v"+I(r.value),1),c.value?(_(),w("span",Pv)):ee("",!0)])):ee("",!0),v[2]||(v[2]=p("span",{class:"text-[10px] text-txt-muted"},"·",-1)),v[3]||(v[3]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]),p("button",{onClick:k,class:"text-[11px] text-txt-muted hover:text-red-400 transition-colors px-1.5 py-0.5 rounded hover:bg-surface-3/50"}," Sign out ")])],64)):(_(),w("div",Lv,[r.value?(_(),w("button",{key:0,onClick:S,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"What's New"},[p("span",Mv,"v"+I(r.value),1),c.value?(_(),w("span",jv)):ee("",!0)])):ee("",!0),v[4]||(v[4]=p("span",{class:"text-[10px] text-txt-muted"},"·",-1)),v[5]||(v[5]=p("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[p("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]))],64))])])],2)):ee("",!0),Ie(t).name!=="login"?(_(),w("nav",Uv,[(_(),w(ke,null,ze(h,C=>be(Ie(sa),{key:C.to,to:C.to,class:ge(["relative flex-1 flex flex-col items-center justify-center gap-0.5 py-2 px-1 min-w-0 transition-colors duration-150 touch-manipulation select-none",g(C.name)?"text-accent":"text-txt-muted"]),onClick:j=>C.name==="feed"?P():void 0,"aria-label":C.label},{default:gs(()=>[g(C.name)?(_(),w("span",Bv)):ee("",!0),p("span",Hv,[be(Re,{paths:C.icon,size:20},null,8,["paths"]),C.name==="feed"&&i.value>0?(_(),w("span",Fv,I(i.value>9?"9+":i.value),1)):ee("",!0)]),p("span",Vv,I(C.label),1)]),_:2},1032,["to","class","onClick","aria-label"])),64))])):ee("",!0),(_(),nn(wh,{to:"body"},[be(ii,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gs(()=>[l.value?(_(),w("div",{key:0,class:"fixed inset-0 z-[100] flex items-center justify-center p-4 sm:p-6",onClick:yt(E,["self"])},[p("div",{class:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:E}),p("div",qv,[p("div",zv,[p("div",null,[v[9]||(v[9]=p("h2",{class:"text-base font-semibold text-txt-primary"},"What's New",-1)),u.value.length>0?(_(),w("div",Kv,[p("span",Wv,I(u.value[0].tag),1),p("span",Gv,I(u.value[0].name),1),p("span",Zv,I(b(u.value[0].published_at)),1)])):ee("",!0)]),p("button",{onClick:E,class:"p-1.5 rounded-lg text-txt-muted hover:text-txt-primary hover:bg-surface-3/40 transition-all duration-150 shrink-0 ml-3 mt-0.5",title:"Close"},[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16})])]),p("div",Jv,[d.value?(_(),w("div",Yv,[...v[10]||(v[10]=[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading release notes… ",-1)])])):u.value.length===0?(_(),w("div",Xv," No release notes found. ")):(_(),w("div",{key:2,class:"wiki-content text-sm text-txt-secondary leading-relaxed",innerHTML:Ie(Ms)(u.value[0].body)},null,8,Qv))]),v[11]||(v[11]=p("div",{class:"p-4 pt-3 border-t border-edge/50 shrink-0"},[p("a",{href:"https://github.com/michaeljolley/io/releases",target:"_blank",rel:"noopener",class:"text-xs text-accent hover:text-accent-glow transition-colors"}," View all releases on GitHub → ")],-1))])])):ee("",!0)]),_:1})]))],64))}}),rr=(e,t)=>{const s=e.__vccOpts||e;for(const[n,r]of t)s[n]=r;return s},ty=rr(ey,[["__scopeId","data-v-fef55011"]]),sy={class:"flex h-screen bg-surface-0 relative overflow-hidden"},ny={class:"flex-1 overflow-auto relative z-0 pb-16 md:pb-0"},ry=pt({__name:"App",setup(e){return(t,s)=>(_(),w("div",sy,[s[1]||(s[1]=er('<div class="pointer-events-none absolute inset-0 overflow-hidden" aria-hidden="true" data-v-e49ca296><div class="absolute -top-[30%] -right-[15%] w-[65%] h-[70%] rounded-full bg-accent/[0.03] blur-[160px]" data-v-e49ca296></div><div class="absolute -bottom-[25%] -left-[15%] w-[55%] h-[55%] rounded-full bg-blue-900/[0.06] blur-[140px]" data-v-e49ca296></div><div class="absolute top-[15%] left-[25%] w-[45%] h-[50%] rounded-full bg-indigo-950/[0.08] blur-[180px]" data-v-e49ca296></div><div class="absolute top-0 inset-x-0 h-px bg-gradient-to-r from-transparent via-accent/[0.18] to-transparent" data-v-e49ca296></div><div class="absolute inset-0" style="background:radial-gradient(ellipse 85% 75% at 50% 40%, transparent 45%, rgba(3, 5, 10, 0.35) 100%);" data-v-e49ca296></div></div>',1)),be(ty),p("main",ny,[s[0]||(s[0]=p("div",{class:"pointer-events-none absolute top-0 inset-x-0 h-[2px] bg-gradient-to-r from-transparent via-accent/[0.1] to-transparent z-10","aria-hidden":"true"},null,-1)),be(Ie(wu),null,{default:gs(({Component:n})=>[be(ii,{name:"view",mode:"out-in"},{default:gs(()=>[(_(),nn(Mh(n)))]),_:2},1024)]),_:1})])]))}}),iy=rr(ry,[["__scopeId","data-v-e49ca296"]]),ay=lu("chat",()=>{const e=Q([]),t=Q(!1);function s(i){e.value.push(i)}function n(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.content+=i)}function r(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.streaming=i)}return{messages:e,isLoading:t,addMessage:s,appendToLast:n,setLastStreaming:r}}),oy={class:"flex flex-col h-full relative bg-surface-0"},ly={key:0,class:"flex flex-col items-center justify-center h-full select-none animate-fade-in"},cy={class:"flex flex-wrap justify-center gap-2 mt-8 max-w-md"},uy=["onClick"],dy={key:1,class:"max-w-3xl mx-auto space-y-5"},hy={key:0,class:"max-w-[80%] px-4 py-2.5 rounded-2xl rounded-br-md text-sm whitespace-pre-wrap bg-gradient-to-br from-accent/[0.14] to-accent/[0.08] text-txt-primary border border-accent/20 shadow-glow-sm"},fy={key:1,class:"max-w-[85%] flex gap-2.5 items-start"},py=["innerHTML"],gy={key:0,class:"flex justify-start animate-fade-in"},my={class:"shrink-0 border-t border-edge/50 backdrop-blur-md p-3 sm:p-4",style:{background:"linear-gradient(180deg, rgba(12,18,32,0.75) 0%, rgba(8,13,22,0.88) 100%)"}},by={class:"flex-1 relative group"},vy=["disabled"],yy=["disabled"],_y={class:"hidden sm:inline"},wy=["disabled"],xy='<span class="stream-cursor"></span>',Ey=pt({__name:"ChatView",setup(e){const t=ay(),s=Eu(),n=Q(""),r=Q(!1),i=Q(null),a=Q(!1),o=Q(null),l=["Check squad status","Run my schedules","Summarize recent activity","What skills are installed?"];function c(E){n.value=E,Is(()=>S())}async function u(){if(!r.value){r.value=!0;try{await Ce("/api/orchestrator/abort",{method:"POST"})}catch{}finally{r.value=!1}}}const d=je(()=>t.messages.some(E=>E.streaming));function h(){const E=i.value;E&&(a.value=E.scrollTop+E.clientHeight<E.scrollHeight-100)}function f(E=!0){Is(()=>{i.value&&i.value.scrollTo({top:i.value.scrollHeight,behavior:E?"smooth":"instant"})})}Ht(()=>{f(!1)}),es(()=>s.name,E=>{E==="chat"&&f(!1)}),es(()=>t.messages.length,()=>{a.value||f()});function g(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),S())}function b(){const E=o.value;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,200)+"px")}async function S(){const E=n.value.trim();if(!E||t.isLoading)return;n.value="",Is(()=>{o.value&&(o.value.style.height="auto")}),t.isLoading=!0,t.addMessage({id:crypto.randomUUID(),role:"user",content:E}),t.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),f();const x=new EventSource(await fi("/api/events"));x.onmessage=k=>{try{const P=JSON.parse(k.data);P.type==="delta"?(t.appendToLast(P.text),f()):P.type==="done"&&(t.setLastStreaming(!1),t.isLoading=!1,x.close(),f())}catch{}},x.onerror=()=>{t.setLastStreaming(!1),t.isLoading=!1,x.close()};try{await Ce("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:E})})}catch{t.appendToLast(`
85
85
 
86
- [Error: failed to reach IO]`),t.setLastStreaming(!1),t.isLoading=!1,x.close()}}return(E,x)=>(_(),w("div",oy,[p("div",{ref_key:"messagesEl",ref:i,class:"flex-1 overflow-y-auto px-3 py-4 sm:px-4 sm:py-6",onScroll:h},[Ie(t).messages.length===0?(_(),w("div",ly,[x[1]||(x[1]=p("div",{class:"w-16 h-16 rounded-2xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-5 shadow-glow"},[p("span",{class:"text-accent font-bold text-2xl font-mono tracking-tighter"},"IO")],-1)),x[2]||(x[2]=p("p",{class:"text-txt-secondary text-sm font-medium mb-1"},"What can I help you build?",-1)),x[3]||(x[3]=p("p",{class:"text-txt-muted text-xs"},"Send a message to start a conversation",-1)),p("div",cy,[(_(),w(ke,null,ze(l,k=>p("button",{key:k,onClick:P=>c(k),class:"px-3 py-1.5 text-xs text-txt-secondary bg-surface-2/60 border border-edge rounded-full hover:border-accent/30 hover:text-accent hover:bg-accent/5 transition-all duration-200"},I(k),9,uy)),64))])])):(_(),w("div",dy,[(_(!0),w(ke,null,ze(Ie(t).messages,k=>(_(),w("div",{key:k.id,class:ge(["flex animate-fade-in",k.role==="user"?"justify-end":"justify-start"])},[k.role==="user"?(_(),w("div",hy,I(k.content),1)):(_(),w("div",fy,[x[4]||(x[4]=p("div",{class:"shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center mt-0.5"},[p("span",{class:"text-accent text-[10px] font-bold font-mono"},"IO")],-1)),p("div",{class:"chat-md min-w-0 px-4 py-2.5 rounded-2xl rounded-tl-md text-sm bg-surface-2/70 text-txt-primary border border-edge",innerHTML:Ie(Ls)(k.content)+(k.streaming?xy:"")},null,8,py)]))],2))),128)),Ie(t).isLoading&&!d.value?(_(),w("div",gy,[...x[5]||(x[5]=[er('<div class="flex gap-2.5 items-start" data-v-a5462ea7><div class="shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center" data-v-a5462ea7><span class="text-accent text-[10px] font-bold font-mono" data-v-a5462ea7>IO</span></div><div class="px-4 py-3 rounded-2xl rounded-tl-md bg-surface-2/70 border border-edge flex items-center gap-1" data-v-a5462ea7><span class="thinking-dot" style="animation-delay:0s;" data-v-a5462ea7></span><span class="thinking-dot" style="animation-delay:0.15s;" data-v-a5462ea7></span><span class="thinking-dot" style="animation-delay:0.3s;" data-v-a5462ea7></span></div></div>',1)])])):ee("",!0)]))],544),be(ii,{name:"scroll-btn"},{default:gs(()=>[a.value?(_(),w("button",{key:0,onClick:f,class:"absolute bottom-24 left-1/2 -translate-x-1/2 z-10 w-8 h-8 rounded-full bg-surface-2/90 backdrop-blur-sm border border-edge-bright text-txt-secondary hover:text-accent hover:border-accent/40 hover:shadow-glow-sm flex items-center justify-center transition-all duration-200",title:"Scroll to bottom"},[be(Re,{paths:'<path d="M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"/>',size:16})])):ee("",!0)]),_:1}),p("div",my,[p("form",{onSubmit:yt(S,["prevent"]),class:"max-w-3xl mx-auto flex gap-2 items-end"},[p("div",by,[dt(p("textarea",{ref_key:"inputEl",ref:o,"onUpdate:modelValue":x[0]||(x[0]=k=>n.value=k),placeholder:"Message IO…",disabled:Ie(t).isLoading,rows:"1",class:"w-full bg-surface-2/60 border border-edge rounded-xl px-4 py-2.5 pr-3 text-sm text-txt-primary placeholder-txt-muted/60 resize-none overflow-hidden focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200",onKeydown:g,onInput:m},null,40,vy),[[kt,n.value]])]),Ie(t).isLoading?(_(),w("button",{key:0,type:"button",onClick:u,disabled:r.value,class:"shrink-0 h-10 px-3.5 rounded-xl text-sm font-medium bg-red-500/15 text-red-400 border border-red-500/25 hover:bg-red-500/25 hover:border-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-150 flex items-center gap-1.5",title:"Stop"},[x[6]||(x[6]=p("span",{class:"w-2.5 h-2.5 rounded-[3px] bg-red-400"},null,-1)),p("span",_y,I(r.value?"Stopping…":"Stop"),1)],8,yy)):(_(),w("button",{key:1,type:"submit",disabled:!n.value.trim(),class:"shrink-0 w-10 h-10 rounded-xl flex items-center justify-center bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 hover:shadow-glow-sm disabled:opacity-25 disabled:cursor-not-allowed disabled:hover:shadow-none transition-all duration-150",title:"Send"},[be(Re,{paths:'<path d="M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z"/>',size:16})],8,wy))],32)])]))}}),ky=rr(Ey,[["__scopeId","data-v-a5462ea7"]]),Sy={class:"flex flex-col h-full bg-surface-0"},Ty={key:0,class:"flex flex-col h-full overflow-hidden animate-fade-in"},Ay={class:"flex items-center gap-3 px-3 sm:px-6 py-3.5 border-b border-edge/70 shrink-0 backdrop-blur-sm",style:{background:"linear-gradient(180deg, rgba(19,27,46,0.9) 0%, rgba(12,18,32,0.85) 100%)"}},Ry={class:"text-base font-semibold text-txt-primary truncate"},Cy={class:"text-[11px] text-txt-muted font-mono shrink-0 bg-surface-2/60 px-1.5 py-0.5 rounded"},Oy={key:0,class:"flex-1 flex items-center justify-center"},$y={key:1,class:"flex-1 p-6"},Ny={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},Iy={key:2,class:"flex-1 overflow-y-auto p-6 skill-content text-sm text-txt-secondary leading-relaxed"},Py={key:0,class:"mb-6 bg-surface-2/60 border border-edge rounded-xl p-5"},Ly={key:0,class:"mb-3"},My={class:"text-base font-semibold text-txt-primary"},jy={key:1,class:"mb-3"},Dy={class:"text-sm text-txt-secondary"},Uy={class:"flex flex-wrap gap-6 mt-1"},By={key:0},Hy={class:"text-sm text-accent font-mono"},Fy={key:1},Vy={class:"text-sm text-txt-secondary"},qy={key:2,class:"mt-3 pt-3 border-t border-edge grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 items-baseline"},zy={class:"text-[10px] text-txt-muted uppercase tracking-wider whitespace-nowrap"},Ky={class:"text-xs text-txt-secondary font-mono"},Wy=["innerHTML"],Gy={key:1,class:"flex-1 overflow-y-auto p-3 sm:p-6"},Zy={class:"max-w-3xl"},Jy={class:"mb-6 bg-surface-2/40 border border-edge rounded-xl p-4"},Yy={class:"flex gap-1 mb-3"},Xy={class:"flex gap-2"},Qy=["disabled"],e_=["disabled"],t_={class:"flex flex-col gap-2"},s_=["disabled"],n_=["disabled"],r_=["disabled"],i_={key:0,class:"flex items-center gap-2 bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},a_={key:1,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},o_={key:2,class:"mb-4"},l_={key:3,class:"flex items-center justify-center py-16"},c_={key:4,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},u_={key:5,class:"text-txt-muted text-sm text-center py-16"},d_={key:6,class:"text-txt-muted text-sm text-center py-12"},h_={key:7,class:"grid gap-3"},f_=["onClick"],p_={class:"flex justify-between items-start mb-1.5"},g_={class:"min-w-0"},m_={class:"font-semibold text-txt-primary text-sm group-hover:text-accent transition-colors duration-150"},b_={class:"text-[11px] text-txt-muted font-mono mt-0.5"},v_=["onClick"],y_={class:"text-xs text-txt-secondary mb-2 line-clamp-2"},__={class:"text-[10px] text-txt-muted font-mono truncate"},w_=pt({__name:"SkillsView",setup(e){const t=Q([]),s=Q(!0),n=Q(null),r=Q(""),i=Q(!1),a=Q(null),o=Q(null),l=Q("url"),c=Q(""),u=Q(""),d=Q(!1),h=Q(null),f=Q(""),g=Q(!1),m=Q(null),S=je(()=>yv(f.value)),E=je(()=>S.value.frontmatter),x=je(()=>Ls(S.value.body)),k=["name","description","version","author"],P=je(()=>E.value?Object.entries(E.value).filter(([W])=>!k.includes(W)):[]),N=Q(""),R=je(()=>{const W=N.value.toLowerCase().trim();return W?t.value.filter(L=>L.name.toLowerCase().includes(W)||L.slug.toLowerCase().includes(W)||(L.description??"").toLowerCase().includes(W)):t.value});async function v(W){h.value=W,f.value="",m.value=null,g.value=!0;try{const L=await Ce(`/api/skills/${encodeURIComponent(W.slug)}`);if(L.status===404)m.value="Skill not found";else if(!L.ok)m.value=`Failed to load skill (HTTP ${L.status})`;else{const pe=await L.json();f.value=pe.content??""}}catch(L){m.value=L instanceof Error?L.message:"Failed to load skill"}finally{g.value=!1}}function C(){h.value=null,f.value="",m.value=null}async function j(){try{const W=await Ce("/api/skills");if(!W.ok)throw new Error(`HTTP error! status: ${W.status}`);const L=await W.json();t.value=L.skills}catch(W){n.value=W instanceof Error?W.message:"Failed to load skills"}finally{s.value=!1}}async function V(){if(!(i.value||r.value.trim()==="")){i.value=!0,a.value=null,o.value=null;try{const W=await Ce("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:r.value.trim()})});if(W.ok){const L=await W.json();t.value=[L.skill,...t.value],r.value="",o.value=`✓ Installed: ${L.skill.name}`,setTimeout(()=>{o.value=null},4e3),j()}else{let L="Install failed";try{L=(await W.json()).error??W.statusText??L}catch{L=W.statusText||L}a.value=L}}catch(W){a.value=W instanceof Error?W.message:"Install failed"}finally{i.value=!1}}}async function Z(){if(!(d.value||c.value.trim()===""||u.value.trim()==="")){d.value=!0,a.value=null,o.value=null;try{const W=await Ce("/api/skills/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.value.trim(),slug:c.value.trim()})});if(W.ok){const L=await W.json();t.value=[L.skill,...t.value],c.value="",u.value="",o.value=`✓ Installed: ${L.skill.name}`,setTimeout(()=>{o.value=null},4e3),j()}else{let L="Install failed";try{L=(await W.json()).error??W.statusText??L}catch{L=W.statusText||L}a.value=L}}catch(W){a.value=W instanceof Error?W.message:"Install failed"}finally{d.value=!1}}}async function $(W){if(confirm(`Delete skill "${W.name}"? This cannot be undone.`))try{const L=await Ce(`/api/skills/${encodeURIComponent(W.slug)}`,{method:"DELETE"});if(L.ok)t.value=t.value.filter(pe=>pe.slug!==W.slug),o.value=`✓ Deleted: ${W.name}`,setTimeout(()=>{o.value=null},3e3);else{const pe=await L.json().catch(()=>({}));a.value=pe.error??(L.status===404?"Skill not found":`Delete failed (HTTP ${L.status})`)}}catch(L){a.value=L instanceof Error?L.message:"Delete failed"}}return Ht(j),(W,L)=>(_(),w("div",Sy,[h.value?(_(),w("div",Ty,[p("div",Ay,[p("button",{onClick:C,class:"text-txt-muted hover:text-accent transition-colors flex items-center gap-1.5 text-sm group"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14,class:"transition-transform group-hover:-translate-x-0.5"}),L[6]||(L[6]=ve(" Back ",-1))]),L[7]||(L[7]=p("div",{class:"w-px h-5 bg-edge"},null,-1)),p("h2",Ry,I(h.value.name),1),p("span",Cy,I(h.value.slug),1)]),g.value?(_(),w("div",Oy,[...L[8]||(L[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):m.value?(_(),w("div",$y,[p("div",Ny,[L[9]||(L[9]=p("span",null,"⚠",-1)),ve(" "+I(m.value),1)])])):(_(),w("div",Iy,[E.value?(_(),w("div",Py,[E.value.name?(_(),w("div",Ly,[L[10]||(L[10]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Name",-1)),p("p",My,I(E.value.name),1)])):ee("",!0),E.value.description?(_(),w("div",jy,[L[11]||(L[11]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Description",-1)),p("p",Dy,I(E.value.description),1)])):ee("",!0),p("div",Uy,[E.value.version?(_(),w("div",By,[L[12]||(L[12]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Version",-1)),p("p",Hy,I(E.value.version),1)])):ee("",!0),E.value.author?(_(),w("div",Fy,[L[13]||(L[13]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Author",-1)),p("p",Vy,I(E.value.author),1)])):ee("",!0)]),P.value.length>0?(_(),w("dl",qy,[(_(!0),w(ke,null,ze(P.value,([pe,M])=>(_(),w(ke,{key:pe},[p("dt",zy,I(pe),1),p("dd",Ky,I(M),1)],64))),128))])):ee("",!0)])):ee("",!0),p("div",{innerHTML:x.value},null,8,Wy)]))])):(_(),w("div",Gy,[p("div",Zy,[L[19]||(L[19]=er('<div class="flex items-end justify-between mb-6" data-v-20b3d95d><div data-v-20b3d95d><h2 class="text-xl font-bold text-txt-primary tracking-tight" data-v-20b3d95d>Skills</h2><p class="text-xs text-txt-muted mt-0.5" data-v-20b3d95d>Manage installed Copilot skills</p></div><div class="flex items-center gap-2" data-v-20b3d95d><a href="https://github.com/github/awesome-copilot" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-20b3d95d><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-20b3d95d><path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z" data-v-20b3d95d></path></svg> awesome-copilot </a><a href="https://skills.sh" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-20b3d95d><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-20b3d95d><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8c0 .93.16 1.82.46 2.65L5 8.5V7H3.5l-.07.01A6.492 6.492 0 0 0 1.5 8Zm6.5 6.5c.93 0 1.82-.17 2.65-.47L8.5 11H7v2.5c.17.01.33.01.5.01Zm-5.3-1.7c.56.4 1.19.7 1.87.88L5 11H3.5c.34.66.79 1.25 1.2 1.8ZM8.5 1.5V4H10l2.5 2.5c.02-.16.03-.33.03-.5A6.5 6.5 0 0 0 8.5 1.5Zm-1 0A6.5 6.5 0 0 0 1.97 6H3.5L6 3.5V1.53c-.51.1-1 .26-1.5.46V1.5ZM11 8.5l-2.5 2.5H10l1.88-1.88A6.47 6.47 0 0 0 11 8.5ZM6 6v4h4V6H6Z" data-v-20b3d95d></path></svg> skills.sh </a></div></div>',1)),p("div",Jy,[p("div",Yy,[p("button",{type:"button",onClick:L[0]||(L[0]=pe=>l.value="url"),class:ge(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="url"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," From URL ",2),p("button",{type:"button",onClick:L[1]||(L[1]=pe=>l.value="paste"),class:ge(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="paste"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," Paste SKILL.md ",2)]),l.value==="url"?(_(),w("form",{key:0,onSubmit:yt(V,["prevent"])},[p("div",Xy,[dt(p("input",{"onUpdate:modelValue":L[2]||(L[2]=pe=>r.value=pe),type:"url",placeholder:"https://github.com/owner/repo.git","aria-label":"Git repository URL",disabled:i.value,class:"flex-1 bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,Qy),[[kt,r.value]]),p("button",{type:"submit",disabled:i.value||r.value.trim()==="",class:"bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150 whitespace-nowrap"},I(i.value?"Installing…":"Install"),9,e_)])],32)):(_(),w("form",{key:1,onSubmit:yt(Z,["prevent"])},[p("div",t_,[p("div",null,[dt(p("input",{"onUpdate:modelValue":L[3]||(L[3]=pe=>c.value=pe),type:"text",placeholder:"my-skill","aria-label":"Skill slug",disabled:d.value,class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,s_),[[kt,c.value]]),L[14]||(L[14]=p("p",{class:"text-[10px] text-txt-muted mt-1 ml-1"},"Unique identifier (lowercase, hyphens ok)",-1))]),dt(p("textarea",{"onUpdate:modelValue":L[4]||(L[4]=pe=>u.value=pe),placeholder:"Paste SKILL.md content here…","aria-label":"SKILL.md content",disabled:d.value,rows:"6",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary font-mono placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 resize-y transition-all duration-200"},null,8,n_),[[kt,u.value]]),p("button",{type:"submit",disabled:d.value||c.value.trim()===""||u.value.trim()==="",class:"self-end bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},I(d.value?"Installing…":"Install"),9,r_)])],32))]),o.value?(_(),w("div",i_,[L[15]||(L[15]=p("span",null,"✓",-1)),ve(" "+I(o.value),1)])):ee("",!0),a.value?(_(),w("div",a_,[L[16]||(L[16]=p("span",null,"⚠",-1)),ve(" "+I(a.value),1)])):ee("",!0),!s.value&&!n.value&&t.value.length>0?(_(),w("div",o_,[dt(p("input",{"onUpdate:modelValue":L[5]||(L[5]=pe=>N.value=pe),type:"search",placeholder:"Search skills…","aria-label":"Search skills",class:"w-full bg-surface-2/50 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,N.value]])])):ee("",!0),s.value?(_(),w("div",l_,[...L[17]||(L[17]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading skills… ")],-1)])])):n.value?(_(),w("div",c_,[L[18]||(L[18]=p("span",null,"⚠",-1)),ve(" "+I(n.value),1)])):t.value.length===0?(_(),w("div",u_," No skills installed yet ")):R.value.length===0?(_(),w("div",d_," No matching skills ")):(_(),w("div",h_,[(_(!0),w(ke,null,ze(R.value,pe=>(_(),w("div",{key:pe.slug,onClick:M=>v(pe),class:"group bg-surface-2/40 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card-hover hover:bg-surface-2/70 transition-all duration-200 cursor-pointer"},[p("div",p_,[p("div",g_,[p("h3",m_,I(pe.name),1),p("p",b_,I(pe.slug),1)]),p("button",{onClick:yt(M=>$(pe),["stop"]),class:"shrink-0 ml-2 p-1.5 rounded-lg text-txt-muted/0 group-hover:text-txt-muted hover:!text-red-400 hover:bg-red-500/10 transition-all duration-150",title:"Delete skill"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,v_)]),p("p",y_,I(pe.description),1),p("p",__,I(pe.path),1)],8,f_))),128))]))])]))]))}}),x_=rr(w_,[["__scopeId","data-v-20b3d95d"]]),E_={class:"flex flex-col h-full bg-surface-0"},k_={class:"flex-1 overflow-y-auto p-3 sm:p-6"},S_={class:"max-w-4xl"},T_={class:"flex justify-between items-end mb-6"},A_={class:"space-y-3"},R_=["disabled"],C_={key:0,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},O_={key:1,class:"flex items-center justify-center py-16"},$_={key:2,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},N_={key:3,class:"text-txt-muted text-sm text-center py-16"},I_={key:4,class:"grid gap-3"},P_=["onClick","aria-expanded"],L_={class:"flex justify-between items-start mb-2"},M_={class:"flex-1 flex items-center gap-2.5"},j_={class:"min-w-0"},D_={class:"font-semibold text-txt-primary text-sm"},U_={class:"text-[11px] text-txt-muted font-mono"},B_={class:"flex items-center gap-2 shrink-0"},H_={key:0,class:"px-2 py-0.5 rounded-md text-[10px] font-medium bg-purple-500/10 text-purple-300 border border-purple-500/20"},F_={class:"text-xs text-txt-muted font-mono ml-6"},V_={key:0,class:"border-t border-edge px-4 pb-4 pt-3 animate-fade-in"},q_={class:"flex justify-between items-center text-[10px] text-txt-muted mb-3"},z_={key:0,class:"font-mono"},K_={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-3"},W_={key:1,class:"text-red-400 text-xs py-2"},G_={key:2,class:"text-txt-muted text-xs italic py-2"},Z_={key:3,class:"space-y-1.5"},J_={class:"flex-1 min-w-0"},Y_={class:"flex items-center gap-1.5"},X_={class:"text-sm font-medium text-txt-primary truncate"},Q_={key:0,title:"Team Lead",class:"text-xs"},e1={key:1,title:"QA / Veto Power",class:"text-xs"},t1={class:"text-[10px] text-txt-muted"},s1={class:"flex items-center gap-1 shrink-0"},n1=["onClick"],r1=["onClick","disabled"],i1={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},a1={class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},o1={class:"text-sm font-semibold text-txt-primary flex items-center gap-2"},l1={class:"text-xs font-normal text-txt-muted"},c1={class:"text-[10px] text-txt-muted mt-0.5 flex items-center gap-1.5"},u1={class:"flex items-center gap-3"},d1={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},h1={key:0,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},f1={key:1,class:"text-txt-muted italic text-center py-8"},p1={class:"shrink-0"},g1={class:"flex-1 min-w-0"},m1={class:"text-txt-secondary break-words"},b1={class:"text-txt-muted text-[10px] ml-2"},v1={key:0,class:"text-txt-muted italic text-center py-4"},y1={class:"flex justify-between items-center mb-1"},_1={class:"text-accent"},w1={class:"text-txt-muted text-[10px]"},x1={class:"text-txt-secondary whitespace-pre-wrap break-words"},E1=pt({__name:"SquadsView",setup(e){const t=new Set(["system"]),s={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},n=Q([]),r=Q(!0),i=Q(null),a=Q(!1),o=Q(!1),l=Q(null),c=Xt({}),u=Xt({});function d(T){return[...T].sort((O,X)=>{const ce=Ue=>Ue.is_lead?0:Ue.is_qa?1:2;return ce(O)-ce(X)})}const h=Xt({}),f=Xt({}),g=Q(new Set),m=Q(null),S=Q([]),E=Q(null),x=Q(!1),k=Q(!0),P=Q(null);let N=null;const R=je(()=>E.value?"Disconnected":x.value?"Live":"Connecting…"),v=je(()=>S.value.filter(T=>!(!T.summary||t.has(T.summary.kind)||T.type==="assistant.message_delta"))),C=T=>{try{return new Date(T).toLocaleTimeString()}catch{return""}},j=T=>{const O=T.data;if(!O||typeof O!="object")return"";if(typeof O.deltaContent=="string")return O.deltaContent;if(typeof O.content=="string")return O.content;if(typeof O.text=="string")return O.text;try{return JSON.stringify(O,null,2)}catch{return String(O)}},V=()=>{Ns(()=>{const T=P.value;T&&(T.scrollTop=T.scrollHeight)})},Z=async T=>{if(!T.currentTaskId)return;$(),m.value=T,S.value=[],E.value=null,x.value=!1,k.value=!0;const O=await fi(`/api/tasks/${encodeURIComponent(T.currentTaskId)}/events`),X=new EventSource(O);N=X,X.onopen=()=>{x.value=!0},X.onmessage=ce=>{try{const Ue=JSON.parse(ce.data);S.value.push(Ue),V()}catch{}},X.onerror=()=>{x.value=!1,S.value.length===0&&(E.value="Connection error. Retrying…")}},$=()=>{if(N){try{N.close()}catch{}N=null}m.value=null,S.value=[],E.value=null,x.value=!1};Ra(()=>{$()});const W=async(T,O)=>{if(!g.value.has(O)){g.value=new Set(g.value).add(O);try{await Ce(`/api/tasks/${encodeURIComponent(O)}/cancel`,{method:"POST"}),await ue(T,!0)}catch(X){f[T]=X instanceof Error?X.message:"Failed to stop task"}finally{const X=new Set(g.value);X.delete(O),g.value=X}}},L=Q({slug:"",name:"",projectPath:""}),pe=T=>T?s[T]??T:"",M=T=>new Date(T).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),z=T=>!!c[T],Y=async T=>{c[T]=!c[T],c[T]&&!u[T]&&!h[T]&&await ue(T)},ue=async(T,O=!1)=>{if(!(!O&&h[T])){h[T]=!0,f[T]=null;try{const X=await Ce(`/api/squads/${encodeURIComponent(T)}/agents`);if(!X.ok)throw new Error(`HTTP error! status: ${X.status}`);const ce=await X.json();u[T]=ce.agents}catch(X){f[T]=X instanceof Error?X.message:"Failed to load agents"}finally{h[T]=!1}}},xe=async()=>{try{const T=await Ce("/api/squads");if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const O=await T.json();n.value=O.squads}catch(T){i.value=T instanceof Error?T.message:"Failed to load squads"}finally{r.value=!1}},q=async()=>{if(!L.value.slug||!L.value.name||!L.value.projectPath){l.value="All fields are required";return}o.value=!0,l.value=null;try{const T=await Ce("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:L.value.slug,name:L.value.name,projectPath:L.value.projectPath})});if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);L.value={slug:"",name:"",projectPath:""},a.value=!1,await xe()}catch(T){l.value=T instanceof Error?T.message:"Failed to create squad"}finally{o.value=!1}};return Ht(()=>{xe()}),(T,O)=>(_(),w("div",E_,[p("div",k_,[p("div",S_,[p("div",T_,[O[5]||(O[5]=p("div",null,[p("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Squads"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Manage teams and monitor agents")],-1)),p("button",{onClick:O[0]||(O[0]=X=>a.value=!a.value),class:ge(["px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150",a.value?"bg-surface-3/50 text-txt-secondary border border-edge hover:bg-surface-3/70":"bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40"])},I(a.value?"Cancel":"New Squad"),3)]),a.value?(_(),w("form",{key:0,onSubmit:yt(q,["prevent"]),class:"bg-surface-2/40 border border-edge rounded-xl p-5 mb-6 animate-fade-in"},[O[7]||(O[7]=p("h3",{class:"font-semibold text-txt-primary text-sm mb-4"},"Create New Squad",-1)),p("div",A_,[dt(p("input",{"onUpdate:modelValue":O[1]||(O[1]=X=>L.value.slug=X),type:"text",placeholder:"Squad slug (e.g., frontend-team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.slug]]),dt(p("input",{"onUpdate:modelValue":O[2]||(O[2]=X=>L.value.name=X),type:"text",placeholder:"Squad name (e.g., Frontend Team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.name]]),dt(p("input",{"onUpdate:modelValue":O[3]||(O[3]=X=>L.value.projectPath=X),type:"text",placeholder:"Project path (e.g., /path/to/project)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.projectPath]]),p("button",{type:"submit",disabled:o.value||!L.value.slug||!L.value.name||!L.value.projectPath,class:"w-full bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},I(o.value?"Creating…":"Create Squad"),9,R_)]),l.value?(_(),w("div",C_,[O[6]||(O[6]=p("span",null,"⚠",-1)),ve(" "+I(l.value),1)])):ee("",!0)],32)):ee("",!0),r.value?(_(),w("div",O_,[...O[8]||(O[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading squads… ")],-1)])])):i.value?(_(),w("div",$_,[O[9]||(O[9]=p("span",null,"⚠",-1)),ve(" "+I(i.value),1)])):n.value.length===0?(_(),w("div",N_," No squads created yet ")):(_(),w("div",I_,[(_(!0),w(ke,null,ze(n.value,X=>(_(),w("div",{key:X.id,class:"bg-surface-2/40 border border-edge rounded-xl overflow-hidden hover:border-edge-bright transition-all duration-200"},[p("button",{type:"button",onClick:ce=>Y(X.slug),class:"w-full text-left p-4 focus:outline-none","aria-expanded":z(X.slug)},[p("div",L_,[p("div",M_,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:14,class:ge(["text-txt-muted transition-transform duration-200 shrink-0",z(X.slug)?"rotate-90":""])},null,8,["class"]),p("div",j_,[p("h3",D_,I(X.name),1),p("p",U_,I(X.slug),1)])]),p("div",B_,[X.universe?(_(),w("span",H_," 🎬 "+I(pe(X.universe)),1)):ee("",!0),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",X.status==="working"?"bg-accent/10 text-accent border border-accent/20":X.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-surface-3/60 text-txt-muted border border-edge"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",X.status==="working"?"bg-accent animate-pulse":X.status==="error"?"bg-red-400":"bg-txt-muted/50"])},null,2),ve(" "+I(X.status),1)],2)])]),p("p",F_,"📁 "+I(X.project_path),1)],8,P_),z(X.slug)?(_(),w("div",V_,[p("div",q_,[X.model?(_(),w("span",z_,"Model: "+I(X.model),1)):ee("",!0),p("span",null,I(M(X.created_at)),1)]),O[13]||(O[13]=p("h4",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-2"},"Team Roster",-1)),h[X.slug]?(_(),w("div",K_,[...O[10]||(O[10]=[p("span",{class:"w-3 h-3 border-2 border-edge border-t-accent rounded-full animate-spin"},null,-1),ve(" Loading agents… ",-1)])])):f[X.slug]?(_(),w("div",W_,I(f[X.slug]),1)):!u[X.slug]||u[X.slug].length===0?(_(),w("div",G_," No agents assigned yet ")):(_(),w("ul",Z_,[(_(!0),w(ke,null,ze(d(u[X.slug]??[]),ce=>(_(),w("li",{key:ce.id??ce.character_name,class:ge(["flex items-center gap-3 rounded-lg px-3 py-2 transition-all duration-150",ce.status==="working"?"bg-accent/[0.06] border border-accent/15":"bg-surface-1/50 border border-edge"])},[p("div",{class:ge(["w-7 h-7 rounded-full flex items-center justify-center shrink-0 text-[10px] font-bold",ce.status==="working"?"bg-accent/15 text-accent border border-accent/25":ce.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-surface-3/60 text-txt-muted border border-edge"])},I((ce.character_name??"?").charAt(0).toUpperCase()),3),p("div",J_,[p("div",Y_,[p("span",X_,I(ce.character_name),1),ce.is_lead?(_(),w("span",Q_,"👑")):ee("",!0),ce.is_qa?(_(),w("span",e1,"🛡️")):ee("",!0)]),p("span",t1,I(ce.role_title),1)]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",ce.status==="working"?"bg-accent/10 text-accent":ce.status==="error"?"bg-red-500/10 text-red-400":"bg-surface-3/40 text-txt-muted"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",ce.status==="working"?"bg-accent animate-pulse":ce.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),ve(" "+I(ce.status),1)],2),p("div",s1,[ce.status==="working"&&ce.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:Ue=>Z(ce),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-accent/10 text-accent border border-accent/20 hover:bg-accent/20 transition-all duration-150 flex items-center gap-1",title:"Preview live work"},[...O[11]||(O[11]=[p("span",{"aria-hidden":"true"},"👁",-1),ve(" Preview ",-1)])],8,n1)):ee("",!0),ce.status==="working"&&ce.currentTaskId?(_(),w("button",{key:1,type:"button",onClick:Ue=>W(X.slug,ce.currentTaskId),disabled:g.value.has(ce.currentTaskId),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[O[12]||(O[12]=p("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),ve(" "+I(g.value.has(ce.currentTaskId)?"Stopping…":"Stop"),1)],8,r1)):ee("",!0)])],2))),128))]))])):ee("",!0)]))),128))]))])]),m.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:yt($,["self"])},[p("div",i1,[p("div",a1,[p("div",null,[p("h3",o1,[ve(I(m.value.character_name)+" ",1),p("span",l1,"— "+I(m.value.role_title),1)]),p("p",c1,[p("span",{class:ge(["inline-block w-1.5 h-1.5 rounded-full",x.value?"bg-emerald-400 animate-pulse":"bg-txt-muted/50"])},null,2),ve(" "+I(R.value),1)])]),p("div",u1,[p("label",d1,[dt(p("input",{type:"checkbox","onUpdate:modelValue":O[4]||(O[4]=X=>k.value=X),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[su,k.value]]),O[14]||(O[14]=ve(" Summary ",-1))]),p("button",{type:"button",onClick:$,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")])]),p("div",{ref_key:"previewScrollEl",ref:P,class:"overflow-y-auto p-4 space-y-2 flex-1 font-mono text-xs"},[E.value?(_(),w("div",h1,I(E.value),1)):S.value.length===0?(_(),w("div",f1," Waiting for activity… ")):k.value?(_(),w(ke,{key:2},[(_(!0),w(ke,null,ze(v.value,(X,ce)=>(_(),w("div",{key:ce,class:"flex items-start gap-2 py-1.5 px-1"},[p("span",p1,I(X.summary.icon),1),p("div",g1,[p("span",m1,I(X.summary.summary),1),p("span",b1,I(C(X.ts)),1)])]))),128)),v.value.length===0?(_(),w("div",v1," Processing… ")):ee("",!0)],64)):(_(!0),w(ke,{key:3},ze(S.value,(X,ce)=>(_(),w("div",{key:ce,class:"border border-edge rounded-lg p-2.5 bg-surface-0"},[p("div",y1,[p("span",_1,I(X.type),1),p("span",w1,I(C(X.ts)),1)]),p("pre",x1,I(j(X)),1)]))),128))],512),p("div",{class:"px-4 py-3 border-t border-edge flex justify-end"},[p("button",{type:"button",onClick:$,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):ee("",!0)]))}}),k1={class:"flex flex-col h-full bg-surface-0"},S1={class:"flex-1 overflow-y-auto p-3 sm:p-6"},T1={class:"max-w-4xl"},A1={class:"flex justify-between items-end mb-6"},R1=["disabled"],C1={key:0,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-6 text-sm"},O1={class:"mb-8"},$1={key:0,class:"flex items-center justify-center py-10"},N1={key:1,class:"text-txt-muted text-sm text-center py-10"},I1={key:2,class:"grid gap-3"},P1={class:"flex justify-between items-start mb-2.5"},L1={class:"flex items-center gap-3 min-w-0"},M1={class:"min-w-0"},j1={class:"font-semibold text-txt-primary text-sm"},D1={class:"flex items-center gap-1.5 mt-0.5 flex-wrap"},U1={class:"text-[10px] text-txt-muted font-mono"},B1={key:0,class:"text-[10px] text-txt-secondary bg-surface-3/50 px-1.5 py-0.5 rounded border border-edge"},H1={key:1,class:"text-[10px] text-purple-300 bg-purple-500/10 px-1.5 py-0.5 rounded border border-purple-500/20"},F1=["title"],V1={key:0,class:"bg-surface-0/60 border border-edge rounded-lg p-3 mb-2.5 ml-12"},q1={class:"text-sm text-txt-primary break-words"},z1={class:"flex justify-between items-center ml-12"},K1={class:"text-[10px] text-txt-muted"},W1=["onClick","disabled"],G1={key:0,class:"flex items-center justify-center py-10"},Z1={key:1,class:"text-txt-muted text-sm text-center py-10"},J1={key:2,class:"relative"},Y1={class:"space-y-1"},X1=["onClick"],Q1={class:"flex justify-between items-start gap-3"},ew={class:"min-w-0 flex-1"},tw={class:"flex items-center gap-2 mb-0.5"},sw={class:"text-sm font-medium text-txt-primary truncate group-hover:text-accent transition-colors"},nw={key:0,class:"text-[10px] text-txt-muted bg-surface-3/40 px-1.5 py-0.5 rounded border border-edge"},rw={class:"text-xs text-txt-secondary truncate"},iw={class:"text-[10px] text-txt-muted mt-1"},aw={key:0},ow={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},lw={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},cw={class:"overflow-y-auto p-5 space-y-4"},uw={key:0,class:"flex items-center justify-center py-10"},dw={key:1,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},hw={class:"flex justify-between items-start gap-3"},fw={class:"text-sm text-txt-primary font-medium"},pw={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},gw={class:"text-[11px] text-txt-muted font-mono break-all bg-surface-0/60 px-2 py-1 rounded border border-edge"},mw={key:0},bw={class:"text-sm text-txt-secondary"},vw={class:"grid grid-cols-2 gap-4"},yw={class:"text-sm text-txt-secondary"},_w={class:"text-sm text-txt-secondary"},ww={key:1},xw={class:"text-sm text-accent font-mono"},Ew=["innerHTML"],kw={class:"flex justify-between items-center mb-2"},Sw={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},Tw={key:0,class:"text-sm text-txt-muted italic"},Aw={key:1,class:"text-sm text-txt-muted italic"},Rw={key:2,class:"bg-surface-0/60 border border-edge rounded-lg divide-y divide-edge max-h-96 overflow-y-auto"},Cw=["onClick"],Ow={class:"shrink-0"},$w={class:"flex-1 break-words"},Nw={class:"text-[10px] text-txt-muted shrink-0"},Iw={key:0,class:"mt-2 pl-6 space-y-1"},Pw={key:0,class:"text-xs text-txt-secondary bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono"},Lw={class:"text-[11px] text-txt-muted bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono max-h-48 overflow-y-auto"},Mw={class:"text-[10px] text-txt-muted font-mono"},jw=["innerHTML"],Dw={key:1,class:"text-sm text-txt-muted italic"},Uw={class:"px-5 py-3 border-t border-edge flex justify-between items-center"},Bw=["disabled"],Hw={key:1},Fw=pt({__name:"AgentActivityView",setup(e){const t=Q([]),s=Q([]),n=Q(!0),r=Q(null),i=Q(new Set),a=Q(null),o=Q(null),l=Q(!1),c=Q(null),u=Q([]),d=Q(!1),h=Q(!1),f=Q(new Set);let g=null,m=null,S=null;const E=q=>q.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),x=q=>{if(!q)return"";const T=q.includes("T")?q:q.replace(" ","T")+"Z",O=new Date(T);return Number.isNaN(O.getTime())?q:O.toLocaleString()},k=q=>{switch(q){case"running":return"bg-accent/10 text-accent border border-accent/20";case"done":return"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-400 border border-red-500/20";case"cancelled":return"bg-amber-500/10 text-amber-400 border border-amber-500/20";default:return"bg-surface-3/50 text-txt-muted border border-edge"}},P=je(()=>{if(!o.value)return null;const q=o.value.started_at,T=o.value.completed_at;if(!q||!T)return null;const O=new Date(q.includes("T")?q:q.replace(" ","T")+"Z").getTime(),X=new Date(T.includes("T")?T:T.replace(" ","T")+"Z").getTime();if(Number.isNaN(O)||Number.isNaN(X))return null;const ce=Math.max(0,Math.round((X-O)/1e3));if(ce<60)return`${ce}s`;const Ue=Math.floor(ce/60),F=ce%60;return`${Ue}m ${F}s`}),N=async q=>{if(!i.value.has(q)){i.value=new Set(i.value).add(q);try{await Ce(`/api/tasks/${encodeURIComponent(q)}/cancel`,{method:"POST"}),await C(),a.value===q&&await j(q)}catch(T){r.value=T instanceof Error?T.message:"Failed to stop task"}finally{const T=new Set(i.value);T.delete(q),i.value=T}}},R=async()=>{try{const q=await Ce("/api/agents");if(!q.ok)throw new Error(`HTTP error! status: ${q.status}`);const T=await q.json();t.value=T.agents}catch(q){r.value=q instanceof Error?q.message:"Failed to load agents"}},v=async()=>{try{const q=await Ce("/api/tasks?limit=50");if(!q.ok)throw new Error(`HTTP error! status: ${q.status}`);const T=await q.json();s.value=T.tasks}catch(q){r.value=q instanceof Error?q.message:"Failed to load tasks"}},C=async()=>{n.value=!0,r.value=null;try{await Promise.all([R(),v()])}finally{n.value=!1}},j=async q=>{l.value=!0,c.value=null;try{const T=await Ce(`/api/tasks/${encodeURIComponent(q)}`);if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const O=await T.json();o.value=O.task}catch(T){c.value=T instanceof Error?T.message:"Failed to load task",o.value=null}finally{l.value=!1}},V=q=>{if(!q)return"";const T=new Date(q);return Number.isNaN(T.getTime())?"":T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},Z=q=>{try{return JSON.stringify(q,null,2)}catch{return String(q)}},$=q=>{if(q.status==="success")return"text-emerald-300";if(q.status==="error")return"text-red-300";if(q.status==="pending")return"text-accent";switch(q.kind){case"message":return"text-txt-primary";case"reasoning":return"text-purple-300";case"tool":return"text-blue-300";case"outcome":return"text-amber-300";default:return"text-txt-secondary"}},W=q=>{if(h.value)return;const T=new Set(f.value);T.has(q)?T.delete(q):T.add(q),f.value=T},L=async(q,T={})=>{T.initial&&(d.value=!0);try{const O=await Ce(`/api/tasks/${encodeURIComponent(q)}/activity`);if(!O.ok)return;const X=await O.json();u.value=X.activity??[]}catch{}finally{T.initial&&(d.value=!1)}},pe=q=>{m||(m=setTimeout(()=>{m=null,a.value===q&&L(q)},250))},M=async q=>{z(),L(q,{initial:!0});try{g=new EventSource(await fi(`/api/tasks/${encodeURIComponent(q)}/events`)),g.onmessage=()=>{pe(q)},g.onerror=()=>{}}catch{g=null}},z=()=>{g&&(g.close(),g=null),m&&(clearTimeout(m),m=null)},Y=q=>{a.value=q,o.value=null,u.value=[],f.value=new Set,j(q),M(q)},ue=()=>{a.value=null,o.value=null,c.value=null,u.value=[],f.value=new Set,z()},xe=q=>{q.key==="Escape"&&a.value&&ue()};return es(a,q=>{q?document.addEventListener("keydown",xe):document.removeEventListener("keydown",xe)}),Ht(()=>{C(),S=setInterval(C,5e3)}),es(()=>{var q;return(q=o.value)==null?void 0:q.status},q=>{q&&q!=="running"&&(a.value&&L(a.value),z())}),ti(()=>{S&&clearInterval(S),document.removeEventListener("keydown",xe),z()}),(q,T)=>(_(),w("div",k1,[p("div",S1,[p("div",T1,[p("div",A1,[T[2]||(T[2]=p("div",null,[p("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Activity"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Monitor agents and recent tasks")],-1)),p("button",{onClick:C,disabled:n.value,class:"px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150 bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed"},I(n.value?"Refreshing…":"Refresh"),9,R1)]),r.value?(_(),w("div",C1,[T[3]||(T[3]=p("span",null,"⚠",-1)),ve(" "+I(r.value),1)])):ee("",!0),p("section",O1,[T[7]||(T[7]=p("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Active Agents",-1)),n.value&&t.value.length===0?(_(),w("div",$1,[...T[4]||(T[4]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading agents… ")],-1)])])):t.value.length===0?(_(),w("div",N1," No active agents ")):(_(),w("div",I1,[(_(!0),w(ke,null,ze(t.value,O=>(_(),w("div",{key:O.slug+(O.characterName||""),class:ge(["group bg-surface-2/40 border rounded-xl p-4 transition-all duration-200",O.status==="working"?"border-accent/20 hover:border-accent/35":"border-edge hover:border-edge-bright"])},[p("div",P1,[p("div",L1,[p("div",{class:ge(["w-9 h-9 rounded-xl flex items-center justify-center shrink-0 text-xs font-bold",O.status==="working"?"bg-accent/15 text-accent border border-accent/25":O.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},I((O.name??"?").charAt(0).toUpperCase()),3),p("div",M1,[p("h3",j1,I(O.name),1),p("div",D1,[p("span",U1,I(O.slug),1),O.roleTitle?(_(),w("span",B1,I(O.roleTitle),1)):ee("",!0),O.universe?(_(),w("span",H1," 🎬 "+I(O.universe),1)):ee("",!0),O.model&&O.status==="working"?(_(),w("span",{key:2,class:"text-[10px] text-emerald-300 bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20",title:`Model: ${O.model}`}," 🧠 "+I(O.model),9,F1)):ee("",!0)])])]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",O.status==="working"?"bg-accent/10 text-accent border border-accent/20":O.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",O.status==="working"?"bg-accent animate-pulse":O.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),ve(" "+I(O.status==="working"?"Working":O.status==="error"?"Error":"Idle"),1)],2)]),O.currentTask?(_(),w("div",V1,[T[5]||(T[5]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-wider mb-1"},"Current Task",-1)),p("p",q1,I(O.currentTask),1)])):ee("",!0),p("div",z1,[p("div",K1," Last updated: "+I(E(new Date)),1),O.status==="working"&&O.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:X=>N(O.currentTaskId),disabled:i.value.has(O.currentTaskId),class:"text-[10px] font-medium px-2.5 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[T[6]||(T[6]=p("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),ve(" "+I(i.value.has(O.currentTaskId)?"Stopping…":"Stop"),1)],8,W1)):ee("",!0)])],2))),128))]))]),p("section",null,[T[10]||(T[10]=p("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Recent Activity",-1)),n.value&&s.value.length===0?(_(),w("div",G1,[...T[8]||(T[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading activity… ")],-1)])])):s.value.length===0?(_(),w("div",Z1," No recent activity yet ")):(_(),w("div",J1,[T[9]||(T[9]=p("div",{class:"absolute left-[15px] top-0 bottom-0 w-px bg-gradient-to-b from-accent/30 via-edge to-transparent"},null,-1)),p("div",Y1,[(_(!0),w(ke,null,ze(s.value,O=>(_(),w("button",{key:O.task_id,type:"button",onClick:X=>Y(O.task_id),class:"w-full text-left relative pl-10 pr-4 py-3 rounded-lg hover:bg-surface-2/40 transition-all duration-150 group"},[p("div",{class:ge(["absolute left-[11px] top-4 w-[9px] h-[9px] rounded-full border-2 z-10",O.status==="running"?"bg-accent border-accent shadow-glow-sm":O.status==="done"?"bg-emerald-400 border-emerald-400":O.status==="failed"?"bg-red-400 border-red-400":O.status==="cancelled"?"bg-amber-400 border-amber-400":"bg-surface-3 border-edge"])},null,2),p("div",Q1,[p("div",ew,[p("div",tw,[p("span",sw,I(O.agent_slug),1),O.origin_channel?(_(),w("span",nw,"via "+I(O.origin_channel),1)):ee("",!0)]),p("p",rw,I(O.description),1),p("p",iw,[ve(I(x(O.started_at))+" ",1),O.completed_at?(_(),w("span",aw," · "+I(x(O.completed_at)),1)):ee("",!0)])]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",k(O.status)])},[O.status==="running"?(_(),w("span",ow)):ee("",!0),ve(" "+I(O.status),1)],2)])],8,X1))),128))])]))])])]),a.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:yt(ue,["self"])},[p("div",lw,[p("div",{class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},[T[11]||(T[11]=p("h3",{class:"text-sm font-semibold text-txt-primary"},"Task Details",-1)),p("button",{type:"button",onClick:ue,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")]),p("div",cw,[l.value?(_(),w("div",uw,[...T[12]||(T[12]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading task… ")],-1)])])):c.value?(_(),w("div",dw,I(c.value),1)):o.value?(_(),w(ke,{key:2},[p("div",hw,[p("div",null,[T[13]||(T[13]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Agent",-1)),p("p",fw,I(o.value.agent_slug),1)]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",k(o.value.status)])},[o.value.status==="running"?(_(),w("span",pw)):ee("",!0),ve(" "+I(o.value.status),1)],2)]),p("div",null,[T[14]||(T[14]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Task ID",-1)),p("p",gw,I(o.value.task_id),1)]),o.value.origin_channel?(_(),w("div",mw,[T[15]||(T[15]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Origin",-1)),p("p",bw,I(o.value.origin_channel),1)])):ee("",!0),p("div",vw,[p("div",null,[T[16]||(T[16]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Started",-1)),p("p",yw,I(x(o.value.started_at)),1)]),p("div",null,[T[17]||(T[17]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Completed",-1)),p("p",_w,I(o.value.completed_at?x(o.value.completed_at):"—"),1)])]),P.value?(_(),w("div",ww,[T[18]||(T[18]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Duration",-1)),p("p",xw,I(P.value),1)])):ee("",!0),p("div",null,[T[19]||(T[19]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Description",-1)),p("div",{class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content",innerHTML:Ie(Ls)(o.value.description)},null,8,Ew)]),p("div",null,[p("div",kw,[T[21]||(T[21]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted"},"Activity",-1)),p("label",Sw,[dt(p("input",{type:"checkbox","onUpdate:modelValue":T[0]||(T[0]=O=>h.value=O),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[su,h.value]]),T[20]||(T[20]=ve(" Show details ",-1))])]),d.value&&u.value.length===0?(_(),w("div",Tw,"Loading activity…")):u.value.length===0?(_(),w("div",Aw,"No activity yet")):(_(),w("ul",Rw,[(_(!0),w(ke,null,ze(u.value,(O,X)=>(_(),w("li",{key:`${O.ts}-${X}-${O.rawType}`,class:"px-3 py-2 text-sm hover:bg-surface-2/40 cursor-pointer transition-colors",onClick:ce=>W(X)},[p("div",{class:ge(["flex items-start gap-2",$(O)])},[p("span",Ow,I(O.icon),1),p("span",$w,I(O.summary),1),p("span",Nw,I(V(O.ts)),1)],2),h.value||f.value.has(X)?(_(),w("div",Iw,[O.detail?(_(),w("pre",Pw,I(O.detail),1)):ee("",!0),p("pre",Lw,I(Z(O.raw)),1),p("p",Mw,I(O.rawType),1)])):ee("",!0)],8,Cw))),128))]))]),p("div",null,[T[22]||(T[22]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Result",-1)),o.value.result?(_(),w("div",{key:0,class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content max-h-96 overflow-y-auto",innerHTML:Ie(Ls)(o.value.result)},null,8,jw)):(_(),w("p",Dw,"No result yet"))])],64)):ee("",!0)]),p("div",Uw,[o.value&&o.value.status==="running"?(_(),w("button",{key:0,type:"button",onClick:T[1]||(T[1]=O=>N(o.value.task_id)),disabled:i.value.has(o.value.task_id),class:"text-xs font-medium px-3 py-1.5 rounded-lg bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},I(i.value.has(o.value.task_id)?"Stopping…":"Stop Task"),9,Bw)):(_(),w("span",Hw)),p("button",{type:"button",onClick:ue,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):ee("",!0)]))}}),Vw={class:"flex flex-col h-full"},qw={class:"flex-1 overflow-y-auto p-3 sm:p-6"},zw={class:"flex justify-between items-center mb-6"},Kw=["disabled"],Ww={key:0,class:"flex items-center justify-center py-16"},Gw={key:1,class:"bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl mb-4 text-sm"},Zw={open:"",class:"mb-8 group/section"},Jw={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},Yw={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},Xw={key:0,class:"flex flex-col items-center py-8"},Qw={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},ex={key:1,class:"grid gap-3"},tx={class:"flex flex-wrap items-start gap-3"},sx={class:"flex-1 min-w-0"},nx={class:"flex flex-wrap items-center gap-2 mb-1.5"},rx={class:"font-semibold text-txt-primary break-words min-w-0"},ix={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},ax={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},ox={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},lx={key:0,class:"flex items-center gap-1 shrink-0"},cx={key:1,class:"flex items-center gap-1 shrink-0"},ux={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},dx={class:"flex flex-wrap items-center gap-1.5"},hx=["onClick","disabled"],fx=["onClick","disabled"],px=["onClick","disabled"],gx=["onClick"],mx=["onClick","disabled"],bx={key:0,class:"mt-3"},vx=["onClick"],yx={key:1,class:"mt-4 pt-4 border-t border-edge/50"},_x={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},wx={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},xx={key:1,class:"text-txt-muted text-xs py-2 text-center"},Ex={key:2,class:"space-y-1.5"},kx={class:"flex-1 min-w-0"},Sx={class:"flex flex-wrap items-center gap-2"},Tx={class:"text-txt-secondary"},Ax={key:0,class:"text-txt-muted mt-0.5"},Rx={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},Cx={open:"",class:"group/section"},Ox={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},$x={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},Nx={key:0,class:"flex flex-col items-center py-8"},Ix={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},Px={key:1,class:"grid gap-3"},Lx={class:"flex flex-wrap items-start gap-3"},Mx={class:"flex-1 min-w-0"},jx={class:"flex flex-wrap items-center gap-2 mb-1.5"},Dx={class:"font-semibold text-txt-primary break-words min-w-0"},Ux={class:"text-[10px] font-mono text-accent/60 bg-accent/5 px-2 py-0.5 rounded-full border border-accent/10 shrink-0"},Bx={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},Hx={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},Fx={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},Vx={key:0,class:"flex items-center gap-1 shrink-0"},qx={key:1,class:"flex items-center gap-1 shrink-0"},zx={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},Kx={class:"flex flex-wrap items-center gap-1.5"},Wx=["onClick","disabled"],Gx=["onClick","disabled"],Zx=["onClick","disabled"],Jx=["onClick"],Yx=["onClick","disabled"],Xx={key:0,class:"mt-3"},Qx=["onClick"],eE={key:1,class:"mt-4 pt-4 border-t border-edge/50"},tE={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},sE={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},nE={key:1,class:"text-txt-muted text-xs py-2 text-center"},rE={key:2,class:"space-y-1.5"},iE={class:"flex-1 min-w-0"},aE={class:"flex flex-wrap items-center gap-2"},oE={class:"text-txt-secondary"},lE={key:0,class:"text-txt-muted mt-0.5"},cE={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},uE=pt({__name:"SchedulesView",setup(e){const t=Q([]),s=Q([]),n=Q(!0),r=Q(null),i=Q(new Set),a=Q(new Map),o=Q(new Map),l=Q(new Set),c=Q(new Set);function u(N){const R=N.includes("T")||N.endsWith("Z")?N:N.replace(" ","T")+"Z";return new Date(R).toLocaleString()}function d(N){return N==="done"?"bg-emerald-400":N==="failed"?"bg-red-400":"bg-accent animate-pulse"}function h(N){return N==="done"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":N==="failed"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-accent/10 text-accent border-accent/20"}function f(N,R){const v=`${N}-${R}`,C=new Set(c.value);C.has(v)?C.delete(v):C.add(v),c.value=C}async function g(N,R){const v=`${N}-${R}`,C=a.value.get(v)??!1,j=new Map(a.value);if(j.set(v,!C),a.value=j,!C&&!o.value.has(v)){const V=new Set(l.value);V.add(v),l.value=V;try{const Z=await Ce(`/api/schedules/${N}/${R}/runs?limit=25`);if(Z.ok){const $=await Z.json(),W=new Map(o.value);W.set(v,$.runs??[]),o.value=W}}catch{}finally{const Z=new Set(l.value);Z.delete(v),l.value=Z}}}async function m(){n.value=!0,r.value=null,o.value=new Map;try{const N=await Ce("/api/schedules");if(!N.ok)throw new Error(`HTTP ${N.status}`);const R=await N.json();t.value=R.io,s.value=R.squads}catch(N){r.value=N instanceof Error?N.message:"Failed to load schedules"}finally{n.value=!1}}async function S(N,R){if(!i.value.has(N)){i.value=new Set(i.value).add(N);try{await R(),await m()}catch(v){r.value=v instanceof Error?v.message:"Action failed"}finally{const v=new Set(i.value);v.delete(N),i.value=v}}}async function E(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/pause`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function x(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/resume`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function k(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/run-now`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function P(N,R,v){window.confirm(`Delete schedule '${v}'?`)&&await S(`${N}-${R}`,async()=>{const C=await Ce(`/api/schedules/${N}/${R}`,{method:"DELETE"});if(!C.ok)throw new Error(`HTTP ${C.status}`)})}return Ht(m),(N,R)=>(_(),w("div",Vw,[p("div",qw,[p("div",zw,[R[1]||(R[1]=p("div",null,[p("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Schedules"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Automated tasks & cron jobs")],-1)),p("button",{onClick:m,disabled:n.value,class:"flex items-center gap-1.5 bg-surface-2/60 hover:bg-surface-3/60 disabled:opacity-50 text-txt-secondary hover:text-txt-primary border border-edge hover:border-edge-bright px-3.5 py-2 rounded-xl text-sm transition-all duration-200"},[be(Re,{paths:'<path d="M11.41 3.64a.5.5 0 0 0 0-.71L9.3.8a.5.5 0 0 0-.7.7l1 1a7.5 7.5 0 0 0-4.08 13.5.5.5 0 0 0 .6-.8A6.5 6.5 0 0 1 10.14 3.5L8.59 5.04a.5.5 0 0 0 .7.7l2.12-2.11ZM8.6 16.36a.5.5 0 0 0 0 .71l2.12 2.12a.5.5 0 0 0 .7-.7l-1-1a7.5 7.5 0 0 0 4.07-13.5.5.5 0 1 0-.59.8A6.5 6.5 0 0 1 9.86 16.5l1.55-1.55a.5.5 0 1 0-.7-.7l-2.12 2.11Z"/>',class:"w-3.5 h-3.5"}),R[0]||(R[0]=ve(" Refresh ",-1))],8,Kw)]),n.value?(_(),w("div",Ww,[...R[2]||(R[2]=[p("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),ve(" Loading schedules… ")],-1)])])):r.value?(_(),w("div",Gw,I(r.value),1)):(_(),w(ke,{key:2},[p("details",Zw,[p("summary",Jw,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),R[3]||(R[3]=p("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"IO Schedules",-1)),p("span",Yw,I(t.value.length),1),R[4]||(R[4]=p("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),t.value.length===0?(_(),w("div",Xw,[p("div",Qw,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:20,class:"text-txt-muted"})]),R[5]||(R[5]=p("p",{class:"text-txt-muted text-sm"},"No IO schedules configured",-1))])):(_(),w("div",ex,[(_(!0),w(ke,null,ze(t.value,v=>(_(),w("div",{key:v.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[p("div",tx,[p("div",sx,[p("div",nx,[p("span",rx,I(v.name),1),p("span",{class:ge(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",v.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[v.enabled?(_(),w("span",ix)):ee("",!0),ve(" "+I(v.enabled?"Active":"Paused"),1)],2)]),p("div",ax,[p("code",ox,I(v.cron_expr),1),v.next_run_at?(_(),w("span",lx,[be(Re,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),ve(" "+I(u(v.next_run_at)),1)])):ee("",!0),v.last_run_at?(_(),w("span",cx,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),ve(" "+I(u(v.last_run_at)),1)])):ee("",!0)]),v.notes?(_(),w("p",ux,I(v.notes),1)):ee("",!0)]),p("div",dx,[v.enabled?(_(),w("button",{key:0,onClick:C=>E("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,hx)):(_(),w("button",{key:1,onClick:C=>x("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,fx)),p("button",{onClick:C=>k("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,px),p("button",{onClick:C=>g("io",v.id),class:ge(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`io-${v.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,gx),p("button",{onClick:C=>P("io",v.id,v.name),disabled:i.value.has(`io-${v.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,mx)])]),v.prompt?(_(),w("div",bx,[p("p",{class:ge(["text-xs text-txt-muted break-words",c.value.has(`io-${v.id}`)?"":"line-clamp-2"])},I(v.prompt),3),v.prompt.length>120?(_(),w("button",{key:0,onClick:C=>f("io",v.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},I(c.value.has(`io-${v.id}`)?"Show less ▲":"Show more ▼"),9,vx)):ee("",!0)])):ee("",!0),a.value.get(`io-${v.id}`)?(_(),w("div",yx,[p("h4",_x," Run history — "+I(v.name),1),l.value.has(`io-${v.id}`)?(_(),w("div",wx,[...R[6]||(R[6]=[p("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading… ",-1)])])):!o.value.get(`io-${v.id}`)||o.value.get(`io-${v.id}`).length===0?(_(),w("div",xx," No history yet ")):(_(),w("ul",Ex,[(_(!0),w(ke,null,ze(o.value.get(`io-${v.id}`),C=>(_(),w("li",{key:C.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[p("span",{class:ge(["w-2 h-2 rounded-full mt-1 shrink-0",d(C.status)])},null,2),p("div",kx,[p("div",Sx,[p("span",Tx,I(u(C.started_at)),1),p("span",{class:ge(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",h(C.status)])},I(C.status),3)]),C.completed_at?(_(),w("div",Ax," Completed: "+I(u(C.completed_at)),1)):ee("",!0),C.error_text?(_(),w("div",Rx,I(C.error_text),1)):ee("",!0)])]))),128))]))])):ee("",!0)]))),128))]))]),p("details",Cx,[p("summary",Ox,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),R[7]||(R[7]=p("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"Squad Schedules",-1)),p("span",$x,I(s.value.length),1),R[8]||(R[8]=p("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),s.value.length===0?(_(),w("div",Nx,[p("div",Ix,[be(Re,{paths:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',size:20,class:"text-txt-muted"})]),R[9]||(R[9]=p("p",{class:"text-txt-muted text-sm"},"No squad schedules configured",-1))])):(_(),w("div",Px,[(_(!0),w(ke,null,ze(s.value,v=>(_(),w("div",{key:v.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[p("div",Lx,[p("div",Mx,[p("div",jx,[p("span",Dx,I(v.name),1),p("span",Ux,I(v.squad_slug),1),p("span",{class:ge(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",v.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[v.enabled?(_(),w("span",Bx)):ee("",!0),ve(" "+I(v.enabled?"Active":"Paused"),1)],2)]),p("div",Hx,[p("code",Fx,I(v.cron_expr),1),v.next_run_at?(_(),w("span",Vx,[be(Re,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),ve(" "+I(u(v.next_run_at)),1)])):ee("",!0),v.last_run_at?(_(),w("span",qx,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),ve(" "+I(u(v.last_run_at)),1)])):ee("",!0)]),v.notes?(_(),w("p",zx,I(v.notes),1)):ee("",!0)]),p("div",Kx,[v.enabled?(_(),w("button",{key:0,onClick:C=>E("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,Wx)):(_(),w("button",{key:1,onClick:C=>x("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,Gx)),p("button",{onClick:C=>k("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,Zx),p("button",{onClick:C=>g("squads",v.id),class:ge(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`squads-${v.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,Jx),p("button",{onClick:C=>P("squads",v.id,v.name),disabled:i.value.has(`squads-${v.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,Yx)])]),v.prompt?(_(),w("div",Xx,[p("p",{class:ge(["text-xs text-txt-muted break-words",c.value.has(`squads-${v.id}`)?"":"line-clamp-2"])},I(v.prompt),3),v.prompt.length>120?(_(),w("button",{key:0,onClick:C=>f("squads",v.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},I(c.value.has(`squads-${v.id}`)?"Show less ▲":"Show more ▼"),9,Qx)):ee("",!0)])):ee("",!0),a.value.get(`squads-${v.id}`)?(_(),w("div",eE,[p("h4",tE," Run history — "+I(v.name),1),l.value.has(`squads-${v.id}`)?(_(),w("div",sE,[...R[10]||(R[10]=[p("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading… ",-1)])])):!o.value.get(`squads-${v.id}`)||o.value.get(`squads-${v.id}`).length===0?(_(),w("div",nE," No history yet ")):(_(),w("ul",rE,[(_(!0),w(ke,null,ze(o.value.get(`squads-${v.id}`),C=>(_(),w("li",{key:C.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[p("span",{class:ge(["w-2 h-2 rounded-full mt-1 shrink-0",d(C.status)])},null,2),p("div",iE,[p("div",aE,[p("span",oE,I(u(C.started_at)),1),p("span",{class:ge(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",h(C.status)])},I(C.status),3)]),C.completed_at?(_(),w("div",lE," Completed: "+I(u(C.completed_at)),1)):ee("",!0),C.error_text?(_(),w("div",cE,I(C.error_text),1)):ee("",!0)])]))),128))]))])):ee("",!0)]))),128))]))])],64))])]))}}),dE={class:"relative flex flex-col h-full p-3 sm:p-6"},hE={class:"flex justify-between items-start mb-4"},fE={class:"flex items-center gap-2 flex-wrap justify-end"},pE={class:"flex gap-1.5 mb-4 p-1 bg-surface-2/50 rounded-xl border border-edge"},gE=["onClick"],mE={key:0,class:"ml-1 font-mono text-[10px] opacity-70"},bE={key:0,class:"flex-1 flex items-center justify-center"},vE={key:1,class:"flex-1 flex flex-col items-center justify-center"},yE={class:"w-14 h-14 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"},_E={class:"text-txt-muted/60 text-xs mt-1"},wE=["onClick"],xE=["onClick"],EE={class:"mt-0.5 shrink-0"},kE={key:1,class:"mt-2 w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm shrink-0"},SE={key:2,class:"mt-2 w-1.5 h-1.5 rounded-full bg-edge shrink-0"},TE={class:"flex-1 min-w-0"},AE={class:"flex items-center gap-2 mb-0.5"},RE={class:"text-sm font-semibold text-txt-primary truncate leading-snug"},CE={key:0,class:"text-[10px] font-mono tracking-wider uppercase text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},OE={class:"text-[10px] text-txt-muted mb-1"},$E={key:0,class:"text-xs text-txt-secondary line-clamp-2 leading-relaxed"},NE={key:3,class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},IE=["onClick"],PE=["onClick","disabled"],LE={key:0,class:"px-4 pb-4"},ME=["innerHTML"],jE={key:0,class:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-3 px-4 py-2.5 rounded-2xl bg-surface-3 border border-edge-bright shadow-card backdrop-blur-sm z-20"},DE={class:"text-xs font-semibold text-txt-secondary mr-1 whitespace-nowrap"},UE=["disabled"],BE=["disabled"],HE={key:3,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},FE=pt({__name:"FeedView",setup(e){const t=[{label:"All",value:"all"},{label:"Deliverables",value:"deliverable"},{label:"Notifications",value:"notification"}],s=Q([]),n=Q(!0),r=Q("all"),i=Q(new Set),a=Q(new Set),o=Q(null),l=Q(!1),c=Q(new Set),u=Q(!1),d=je(()=>r.value==="all"?s.value:s.value.filter(V=>V.type===r.value)),h=je(()=>d.value.length>0&&d.value.every(V=>c.value.has(V.id)));function f(V){return s.value.filter(Z=>Z.type===V).length}function g(V){try{const Z=V.includes("T")||V.endsWith("Z")?V:V.replace(" ","T")+"Z";return new Date(Z).toLocaleString()}catch{return V}}function m(V){return V.replace(/[#*`_~[\]()]/g,"").slice(0,200)}function S(V){const Z=new Set(i.value);Z.has(V)?Z.delete(V):Z.add(V),i.value=Z}function E(){l.value=!l.value,l.value||(c.value=new Set)}function x(V){const Z=new Set(c.value);Z.has(V)?Z.delete(V):Z.add(V),c.value=Z}function k(){h.value?c.value=new Set:c.value=new Set(d.value.map(V=>V.id))}async function P(){n.value=!0,o.value=null;try{const V=await Ce("/api/feed?limit=100");if(V.ok){const Z=await V.json();s.value=Z.entries??[]}}catch{}n.value=!1}async function N(V){try{await Ce(`/api/feed/${V}/read`,{method:"POST"});const Z=s.value.find($=>$.id===V);Z&&(Z.read_at=new Date().toISOString())}catch{}}async function R(){const V=r.value!=="all"?`?type=${r.value}`:"";try{await Ce(`/api/feed/read-all${V}`,{method:"POST"});const Z=new Date().toISOString();for(const $ of s.value)!$.read_at&&(r.value==="all"||$.type===r.value)&&($.read_at=Z)}catch{}}async function v(V){if(!window.confirm("Delete this entry?"))return;const Z=new Set(a.value);Z.add(V),a.value=Z;try{const $=await Ce(`/api/feed/${V}`,{method:"DELETE"});if($.ok){s.value=s.value.filter(L=>L.id!==V);const W=new Set(i.value);W.delete(V),i.value=W}else o.value=`Failed to delete entry (HTTP ${$.status})`}catch($){o.value=$ instanceof Error?$.message:"Delete failed"}finally{const $=new Set(a.value);$.delete(V),a.value=$}}async function C(){const V=Array.from(c.value);if(V.length!==0){u.value=!0;try{const Z=await Ce("/api/feed/batch-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:V})});if(Z.ok){const $=new Date().toISOString();for(const W of s.value)V.includes(W.id)&&(W.read_at=W.read_at??$);c.value=new Set}else o.value=`Bulk mark-read failed (HTTP ${Z.status})`}catch(Z){o.value=Z instanceof Error?Z.message:"Bulk mark-read failed"}finally{u.value=!1}}}async function j(){const V=Array.from(c.value);if(V.length!==0&&window.confirm(`Delete ${V.length} item${V.length===1?"":"s"}?`)){u.value=!0;try{const Z=await Ce("/api/feed/batch-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:V})});if(Z.ok){s.value=s.value.filter(W=>!V.includes(W.id));const $=new Set(i.value);V.forEach(W=>$.delete(W)),i.value=$,c.value=new Set}else o.value=`Bulk delete failed (HTTP ${Z.status})`}catch(Z){o.value=Z instanceof Error?Z.message:"Bulk delete failed"}finally{u.value=!1}}}return Ht(P),(V,Z)=>(_(),w("div",dE,[p("div",hE,[Z[0]||(Z[0]=p("div",null,[p("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Feed"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Messages, results & notifications")],-1)),p("div",fE,[l.value&&d.value.length>0?(_(),w("button",{key:0,onClick:k,class:"text-xs text-txt-secondary hover:text-txt-primary transition-colors font-medium"},I(h.value?"Deselect all":"Select all"),1)):ee("",!0),!l.value&&s.value.length>0?(_(),w("button",{key:1,onClick:R,class:"text-xs text-accent hover:text-accent-glow transition-colors font-medium"}," Mark all read ")):ee("",!0),s.value.length>0?(_(),w("button",{key:2,onClick:E,class:ge(["text-xs px-2.5 py-1 rounded-lg border transition-all duration-150 font-medium",l.value?"text-accent border-accent/30 bg-accent/10 hover:bg-accent/20":"text-txt-muted border-edge hover:text-txt-secondary hover:border-edge-bright hover:bg-surface-3/40"])},I(l.value?"Cancel":"Select"),3)):ee("",!0)])]),p("div",pE,[(_(),w(ke,null,ze(t,$=>p("button",{key:$.value,onClick:W=>r.value=$.value,class:ge(["flex-1 text-xs font-medium py-1.5 px-3 rounded-lg transition-all duration-150",r.value===$.value?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 border border-transparent"])},[ve(I($.label)+" ",1),$.value!=="all"&&f($.value)>0?(_(),w("span",mE,"("+I(f($.value))+")",1)):ee("",!0)],10,gE)),64))]),n.value?(_(),w("div",bE,[...Z[1]||(Z[1]=[p("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),ve(" Loading… ")],-1)])])):d.value.length===0?(_(),w("div",vE,[p("div",yE,[be(Re,{paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:28,class:"text-txt-muted"})]),Z[2]||(Z[2]=p("p",{class:"text-txt-muted text-sm font-medium"},"Nothing here yet",-1)),p("p",_E,I(r.value==="all"?"Your feed is empty":r.value==="deliverable"?"No deliverables":"No notifications"),1)])):(_(),w("ul",{key:2,class:ge(["space-y-2 overflow-y-auto flex-1 pr-1",l.value&&c.value.size>0?"pb-16":""])},[(_(!0),w(ke,null,ze(d.value,$=>(_(),w("li",{key:$.id,class:ge(["group bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden animate-fade-in",[$.read_at?"":"glow-inner",l.value&&c.value.has($.id)?"ring-1 ring-accent/40 bg-accent/5 border-accent/30":""]])},[p("div",{class:ge(["flex items-start gap-3 p-4",(l.value,"cursor-pointer")]),onClick:W=>l.value?x($.id):S($.id)},[l.value?(_(),w("div",{key:0,class:"mt-0.5 shrink-0",onClick:yt(W=>x($.id),["stop"])},[p("div",{class:ge(["w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all duration-150",c.value.has($.id)?"border-accent bg-accent shadow-glow-sm":"border-edge hover:border-accent/60"])},[c.value.has($.id)?(_(),nn(Re,{key:0,paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:11,class:"text-surface-0"})):ee("",!0)],2)],8,xE)):ee("",!0),p("div",EE,[$.type==="deliverable"?(_(),nn(Re,{key:0,paths:'<path d="M6 3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H6Zm10 7h-3.5a.5.5 0 0 0-.5.5v.01a1.75 1.75 0 0 1-.03.3c-.04.2-.1.46-.23.72-.13.25-.3.49-.57.66-.26.18-.63.31-1.17.31-.54 0-.9-.13-1.17-.3a1.7 1.7 0 0 1-.57-.67A2.57 2.57 0 0 1 8 10.5v-.01a.5.5 0 0 0-.5-.5H4V6c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2v4ZM4 11h3.05c.05.26.14.62.32.97.18.38.47.76.9 1.06.45.29 1.02.47 1.73.47s1.28-.18 1.72-.47c.44-.3.73-.68.91-1.06.18-.35.27-.7.32-.97H16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3Z"/>',size:16,class:ge($.read_at?"text-txt-muted":"text-accent")},null,8,["class"])):(_(),nn(Re,{key:1,paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:16,class:ge($.read_at?"text-txt-muted":"text-accent")},null,8,["class"]))]),$.read_at?(_(),w("span",SE)):(_(),w("span",kE)),p("div",TE,[p("div",AE,[p("span",RE,I($.title),1),$.source_type?(_(),w("span",CE,I($.source_type),1)):ee("",!0)]),p("p",OE,I(g($.created_at)),1),i.value.has($.id)?ee("",!0):(_(),w("p",$E,I(m($.body)),1))]),l.value?ee("",!0):(_(),w("div",NE,[$.read_at?ee("",!0):(_(),w("button",{key:0,onClick:yt(W=>N($.id),["stop"]),class:"p-1.5 rounded-lg text-txt-muted hover:text-accent hover:bg-accent/10 border border-transparent hover:border-accent/20 transition-all duration-150",title:"Mark as read"},[be(Re,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14})],8,IE)),p("button",{onClick:yt(W=>v($.id),["stop"]),disabled:a.value.has($.id),class:"p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-30 transition-all duration-150",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,PE)]))],10,wE),!l.value&&i.value.has($.id)?(_(),w("div",LE,[p("div",{class:"text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content leading-relaxed",innerHTML:Ie(Ls)($.body)},null,8,ME)])):ee("",!0)],2))),128))],2)),be(ii,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:gs(()=>[l.value&&c.value.size>0?(_(),w("div",jE,[p("span",DE,I(c.value.size)+" selected ",1),p("button",{onClick:C,disabled:u.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 disabled:opacity-40 transition-all duration-150"},[be(Re,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14}),Z[3]||(Z[3]=ve(" Mark read ",-1))],8,UE),p("button",{onClick:j,disabled:u.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14}),Z[4]||(Z[4]=ve(" Delete ",-1))],8,BE)])):ee("",!0)]),_:1}),o.value?(_(),w("div",HE,[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),ve(" "+I(o.value),1)])):ee("",!0)]))}}),VE={class:"flex flex-col md:flex-row h-full overflow-hidden bg-surface-0"},qE={class:"p-3.5 shrink-0"},zE={class:"flex items-center justify-between mb-3"},KE={class:"text-[10px] text-txt-muted font-mono bg-surface-2/60 px-1.5 py-0.5 rounded"},WE={key:0,class:"flex-1 flex items-center justify-center"},GE={key:1,class:"flex-1 p-4"},ZE={class:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},JE={key:2,class:"flex-1 overflow-y-auto py-2 px-2"},YE={key:0,class:"px-2 py-3 text-sm text-txt-muted text-center"},XE=["onClick"],QE={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-5 rounded-r-full bg-accent shadow-glow-sm"},ek={key:0,class:"md:hidden flex items-center gap-2 px-3 py-2 border-b border-edge bg-surface-1/60 shrink-0"},tk={class:"text-xs text-txt-primary font-medium truncate"},sk={key:1,class:"flex-1 flex flex-col items-center justify-center select-none"},nk={key:2,class:"flex-1 flex items-center justify-center"},rk={key:3,class:"flex-1 p-6"},ik={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},ak={key:4,class:"flex-1 overflow-y-auto"},ok={class:"max-w-3xl mx-auto px-6 py-6"},lk={class:"text-xl font-bold text-txt-primary mb-4 pb-3 border-b border-edge"},ck=["innerHTML"],uk=pt({__name:"WikiView",setup(e){const t=Q([]),s=Q(null),n=Q(""),r=Q(""),i=Q(!1),a=Q(!1),o=Q(""),l=Q(""),c=je(()=>{const f=r.value.trim().toLowerCase();return f?t.value.filter(g=>g.title.toLowerCase().includes(f)):t.value}),u=je(()=>Ls(n.value));async function d(){i.value=!0,o.value="";try{const f=await Ce("/api/wiki");if(!f.ok)throw new Error(`HTTP ${f.status}`);const g=await f.json();t.value=g.pages??[]}catch(f){o.value=f instanceof Error?f.message:"Failed to load pages"}finally{i.value=!1}}async function h(f){var g;if(((g=s.value)==null?void 0:g.path)!==f.path){s.value=f,n.value="",a.value=!0,l.value="";try{const m=await Ce(`/api/wiki/${encodeURIComponent(f.path)}`);if(!m.ok)throw new Error(`HTTP ${m.status}`);const S=await m.json();n.value=S.content??""}catch(m){l.value=m instanceof Error?m.message:"Failed to load page"}finally{a.value=!1}}}return Ht(d),(f,g)=>(_(),w("div",VE,[p("div",{class:ge(["bg-surface-1/70 backdrop-blur-sm border-edge flex flex-col",s.value?"hidden md:flex md:w-72 md:shrink-0 md:border-r":"flex w-full md:w-72 md:shrink-0 border-b md:border-b-0 md:border-r md:h-full max-h-64 md:max-h-none"])},[p("div",qE,[p("div",zE,[g[2]||(g[2]=p("h2",{class:"text-sm font-semibold text-txt-primary tracking-tight flex items-center gap-1.5"},[p("span",{class:"text-base"},"📚"),ve(" Wiki ")],-1)),p("span",KE,I(c.value.length),1)]),dt(p("input",{"onUpdate:modelValue":g[0]||(g[0]=m=>r.value=m),type:"text",placeholder:"Filter pages…",class:"w-full px-3 py-1.5 text-sm bg-surface-2/50 border border-edge rounded-lg text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,r.value]])]),g[4]||(g[4]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),i.value?(_(),w("div",WE,[...g[3]||(g[3]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):o.value?(_(),w("div",GE,[p("div",ZE,I(o.value),1)])):(_(),w("ul",JE,[c.value.length===0?(_(),w("li",YE," No pages found ")):ee("",!0),(_(!0),w(ke,null,ze(c.value,m=>{var S,E,x;return _(),w("li",{key:m.path,onClick:k=>h(m),class:ge(["relative px-2.5 py-2 rounded-lg cursor-pointer text-sm transition-all duration-150 mb-0.5",((S=s.value)==null?void 0:S.path)===m.path?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"])},[((E=s.value)==null?void 0:E.path)===m.path?(_(),w("span",QE)):ee("",!0),p("span",{class:ge(((x=s.value)==null?void 0:x.path)===m.path?"ml-1":"")},I(m.title),3)],10,XE)}),128))]))],2),p("div",{class:ge(["flex-1 min-w-0 flex flex-col overflow-hidden",s.value?"flex":"hidden md:flex"])},[s.value?(_(),w("div",ek,[p("button",{onClick:g[1]||(g[1]=m=>s.value=null),class:"flex items-center gap-1.5 text-xs text-txt-muted hover:text-accent transition-colors py-1"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14}),g[5]||(g[5]=ve(" All pages ",-1))]),g[6]||(g[6]=p("span",{class:"text-txt-muted/30"},"·",-1)),p("span",tk,I(s.value.title),1)])):ee("",!0),s.value?a.value?(_(),w("div",nk,[...g[8]||(g[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):l.value?(_(),w("div",rk,[p("div",ik,[g[9]||(g[9]=p("span",null,"⚠",-1)),ve(" "+I(l.value),1)])])):(_(),w("div",ak,[p("div",ok,[p("h1",lk,I(s.value.title),1),p("div",{class:"wiki-content text-txt-secondary text-sm leading-relaxed",innerHTML:u.value},null,8,ck)])])):(_(),w("div",sk,[...g[7]||(g[7]=[p("div",{class:"w-12 h-12 rounded-xl bg-surface-2/60 border border-edge flex items-center justify-center mb-4"},[p("span",{class:"text-2xl"},"📖")],-1),p("p",{class:"text-txt-muted text-sm"},"Select a page to start reading",-1)])]))],2)]))}}),dk=rr(uk,[["__scopeId","data-v-5b6273c1"]]),hk={class:"relative flex items-center justify-center h-screen bg-surface-0 overflow-hidden"},fk={class:"relative w-full max-w-sm mx-4 animate-fade-in"},pk={class:"glass rounded-2xl border border-edge p-8 shadow-glow"},gk={key:0,class:"flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},mk=["disabled"],bk=pt({__name:"LoginView",setup(e){const t=nr(),s=xu(),n=Q(""),r=Q(""),i=Q(null);async function a(){i.value=null;const o=await t.signIn(n.value,r.value);o?i.value=o:s.push("/chat")}return(o,l)=>(_(),w("div",hk,[l[5]||(l[5]=p("div",{class:"pointer-events-none absolute inset-0"},[p("div",{class:"absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-accent/[0.04] rounded-full blur-[120px]"}),p("div",{class:"absolute bottom-1/4 right-1/4 w-[400px] h-[400px] bg-accent-dim/[0.06] rounded-full blur-[100px]"})],-1)),p("div",fk,[p("div",pk,[l[4]||(l[4]=er('<div class="flex flex-col items-center mb-8"><div class="w-14 h-14 rounded-xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-4 shadow-glow-sm"><span class="text-accent font-mono font-bold text-2xl tracking-tighter">IO</span></div><h1 class="text-xl font-semibold text-txt-primary tracking-tight">Welcome back</h1><p class="text-sm text-txt-muted mt-1">Sign in to continue</p></div>',1)),p("form",{onSubmit:yt(a,["prevent"]),class:"space-y-5"},[p("div",null,[l[2]||(l[2]=p("label",{for:"email",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Email",-1)),dt(p("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>n.value=c),type:"email",required:"",autocomplete:"email",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"you@example.com"},null,512),[[kt,n.value]])]),p("div",null,[l[3]||(l[3]=p("label",{for:"password",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Password",-1)),dt(p("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>r.value=c),type:"password",required:"",autocomplete:"current-password",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"••••••••"},null,512),[[kt,r.value]])]),i.value?(_(),w("div",gk,[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),ve(" "+I(i.value),1)])):ee("",!0),p("button",{type:"submit",disabled:Ie(t).loading,class:"w-full py-2.5 px-4 bg-accent hover:bg-accent-glow disabled:opacity-50 disabled:cursor-not-allowed text-surface-0 font-semibold text-sm rounded-xl transition-all duration-200 shadow-glow-sm hover:shadow-glow"},I(Ie(t).loading?"Signing in…":"Sign in"),9,mk)],32)])])]))}}),xd=gg({history:Zp("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:bk,meta:{public:!0}},{path:"/chat",name:"chat",component:ky},{path:"/skills",name:"skills",component:x_},{path:"/squads",name:"squads",component:E1},{path:"/activity",name:"activity",component:Fw},{path:"/wiki",name:"wiki",component:dk},{path:"/schedules",name:"schedules",component:uE},{path:"/feed",name:"feed",component:FE},{path:"/notifications",redirect:"/feed"},{path:"/inbox",redirect:"/feed"}]});xd.beforeEach(async e=>{const t=nr();return t.initialized||await t.init(),!t.authEnabled||e.meta.public||t.user?!0:{name:"login"}});const Va=np(iy);Va.use(ap());Va.use(xd);Va.mount("#app");
86
+ [Error: failed to reach IO]`),t.setLastStreaming(!1),t.isLoading=!1,x.close()}}return(E,x)=>(_(),w("div",oy,[p("div",{ref_key:"messagesEl",ref:i,class:"flex-1 overflow-y-auto px-3 py-4 sm:px-4 sm:py-6",onScroll:h},[Ie(t).messages.length===0?(_(),w("div",ly,[x[1]||(x[1]=p("div",{class:"w-16 h-16 rounded-2xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-5 shadow-glow"},[p("span",{class:"text-accent font-bold text-2xl font-mono tracking-tighter"},"IO")],-1)),x[2]||(x[2]=p("p",{class:"text-txt-secondary text-sm font-medium mb-1"},"What can I help you build?",-1)),x[3]||(x[3]=p("p",{class:"text-txt-muted text-xs"},"Send a message to start a conversation",-1)),p("div",cy,[(_(),w(ke,null,ze(l,k=>p("button",{key:k,onClick:P=>c(k),class:"px-3 py-1.5 text-xs text-txt-secondary bg-surface-2/60 border border-edge rounded-full hover:border-accent/30 hover:text-accent hover:bg-accent/5 transition-all duration-200"},I(k),9,uy)),64))])])):(_(),w("div",dy,[(_(!0),w(ke,null,ze(Ie(t).messages,k=>(_(),w("div",{key:k.id,class:ge(["flex animate-fade-in",k.role==="user"?"justify-end":"justify-start"])},[k.role==="user"?(_(),w("div",hy,I(k.content),1)):(_(),w("div",fy,[x[4]||(x[4]=p("div",{class:"shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center mt-0.5"},[p("span",{class:"text-accent text-[10px] font-bold font-mono"},"IO")],-1)),p("div",{class:"chat-md min-w-0 px-4 py-2.5 rounded-2xl rounded-tl-md text-sm bg-surface-2/70 text-txt-primary border border-edge",innerHTML:Ie(Ms)(k.content)+(k.streaming?xy:"")},null,8,py)]))],2))),128)),Ie(t).isLoading&&!d.value?(_(),w("div",gy,[...x[5]||(x[5]=[er('<div class="flex gap-2.5 items-start" data-v-a5462ea7><div class="shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center" data-v-a5462ea7><span class="text-accent text-[10px] font-bold font-mono" data-v-a5462ea7>IO</span></div><div class="px-4 py-3 rounded-2xl rounded-tl-md bg-surface-2/70 border border-edge flex items-center gap-1" data-v-a5462ea7><span class="thinking-dot" style="animation-delay:0s;" data-v-a5462ea7></span><span class="thinking-dot" style="animation-delay:0.15s;" data-v-a5462ea7></span><span class="thinking-dot" style="animation-delay:0.3s;" data-v-a5462ea7></span></div></div>',1)])])):ee("",!0)]))],544),be(ii,{name:"scroll-btn"},{default:gs(()=>[a.value?(_(),w("button",{key:0,onClick:f,class:"absolute bottom-24 left-1/2 -translate-x-1/2 z-10 w-8 h-8 rounded-full bg-surface-2/90 backdrop-blur-sm border border-edge-bright text-txt-secondary hover:text-accent hover:border-accent/40 hover:shadow-glow-sm flex items-center justify-center transition-all duration-200",title:"Scroll to bottom"},[be(Re,{paths:'<path d="M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"/>',size:16})])):ee("",!0)]),_:1}),p("div",my,[p("form",{onSubmit:yt(S,["prevent"]),class:"max-w-3xl mx-auto flex gap-2 items-end"},[p("div",by,[dt(p("textarea",{ref_key:"inputEl",ref:o,"onUpdate:modelValue":x[0]||(x[0]=k=>n.value=k),placeholder:"Message IO…",disabled:Ie(t).isLoading,rows:"1",class:"w-full bg-surface-2/60 border border-edge rounded-xl px-4 py-2.5 pr-3 text-sm text-txt-primary placeholder-txt-muted/60 resize-none overflow-hidden focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200",onKeydown:g,onInput:b},null,40,vy),[[kt,n.value]])]),Ie(t).isLoading?(_(),w("button",{key:0,type:"button",onClick:u,disabled:r.value,class:"shrink-0 h-10 px-3.5 rounded-xl text-sm font-medium bg-red-500/15 text-red-400 border border-red-500/25 hover:bg-red-500/25 hover:border-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-150 flex items-center gap-1.5",title:"Stop"},[x[6]||(x[6]=p("span",{class:"w-2.5 h-2.5 rounded-[3px] bg-red-400"},null,-1)),p("span",_y,I(r.value?"Stopping…":"Stop"),1)],8,yy)):(_(),w("button",{key:1,type:"submit",disabled:!n.value.trim(),class:"shrink-0 w-10 h-10 rounded-xl flex items-center justify-center bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 hover:shadow-glow-sm disabled:opacity-25 disabled:cursor-not-allowed disabled:hover:shadow-none transition-all duration-150",title:"Send"},[be(Re,{paths:'<path d="M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z"/>',size:16})],8,wy))],32)])]))}}),ky=rr(Ey,[["__scopeId","data-v-a5462ea7"]]),Sy={class:"flex flex-col h-full bg-surface-0"},Ty={key:0,class:"flex flex-col h-full overflow-hidden animate-fade-in"},Ay={class:"flex items-center gap-3 px-3 sm:px-6 py-3.5 border-b border-edge/70 shrink-0 backdrop-blur-sm",style:{background:"linear-gradient(180deg, rgba(19,27,46,0.9) 0%, rgba(12,18,32,0.85) 100%)"}},Ry={class:"text-base font-semibold text-txt-primary truncate"},Cy={class:"text-[11px] text-txt-muted font-mono shrink-0 bg-surface-2/60 px-1.5 py-0.5 rounded"},Oy={key:0,class:"flex-1 flex items-center justify-center"},$y={key:1,class:"flex-1 p-6"},Ny={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},Iy={key:2,class:"flex-1 overflow-y-auto p-6 skill-content text-sm text-txt-secondary leading-relaxed"},Py={key:0,class:"mb-6 bg-surface-2/60 border border-edge rounded-xl p-5"},Ly={key:0,class:"mb-3"},My={class:"text-base font-semibold text-txt-primary"},jy={key:1,class:"mb-3"},Dy={class:"text-sm text-txt-secondary"},Uy={class:"flex flex-wrap gap-6 mt-1"},By={key:0},Hy={class:"text-sm text-accent font-mono"},Fy={key:1},Vy={class:"text-sm text-txt-secondary"},qy={key:2,class:"mt-3 pt-3 border-t border-edge grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 items-baseline"},zy={class:"text-[10px] text-txt-muted uppercase tracking-wider whitespace-nowrap"},Ky={class:"text-xs text-txt-secondary font-mono"},Wy=["innerHTML"],Gy={key:1,class:"flex-1 overflow-y-auto p-3 sm:p-6"},Zy={class:"max-w-3xl"},Jy={class:"mb-6 bg-surface-2/40 border border-edge rounded-xl p-4"},Yy={class:"flex gap-1 mb-3"},Xy={class:"flex gap-2"},Qy=["disabled"],e_=["disabled"],t_={class:"flex flex-col gap-2"},s_=["disabled"],n_=["disabled"],r_=["disabled"],i_={key:0,class:"flex items-center gap-2 bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},a_={key:1,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},o_={key:2,class:"mb-4"},l_={key:3,class:"flex items-center justify-center py-16"},c_={key:4,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},u_={key:5,class:"text-txt-muted text-sm text-center py-16"},d_={key:6,class:"text-txt-muted text-sm text-center py-12"},h_={key:7,class:"grid gap-3"},f_=["onClick"],p_={class:"flex justify-between items-start mb-1.5"},g_={class:"min-w-0"},m_={class:"font-semibold text-txt-primary text-sm group-hover:text-accent transition-colors duration-150"},b_={class:"text-[11px] text-txt-muted font-mono mt-0.5"},v_=["onClick"],y_={class:"text-xs text-txt-secondary mb-2 line-clamp-2"},__={class:"text-[10px] text-txt-muted font-mono truncate"},w_=pt({__name:"SkillsView",setup(e){const t=Q([]),s=Q(!0),n=Q(null),r=Q(""),i=Q(!1),a=Q(null),o=Q(null),l=Q("url"),c=Q(""),u=Q(""),d=Q(!1),h=Q(null),f=Q(""),g=Q(!1),b=Q(null),S=je(()=>yv(f.value)),E=je(()=>S.value.frontmatter),x=je(()=>Ms(S.value.body)),k=["name","description","version","author"],P=je(()=>E.value?Object.entries(E.value).filter(([W])=>!k.includes(W)):[]),N=Q(""),R=je(()=>{const W=N.value.toLowerCase().trim();return W?t.value.filter(L=>L.name.toLowerCase().includes(W)||L.slug.toLowerCase().includes(W)||(L.description??"").toLowerCase().includes(W)):t.value});async function v(W){h.value=W,f.value="",b.value=null,g.value=!0;try{const L=await Ce(`/api/skills/${encodeURIComponent(W.slug)}`);if(L.status===404)b.value="Skill not found";else if(!L.ok)b.value=`Failed to load skill (HTTP ${L.status})`;else{const pe=await L.json();f.value=pe.content??""}}catch(L){b.value=L instanceof Error?L.message:"Failed to load skill"}finally{g.value=!1}}function C(){h.value=null,f.value="",b.value=null}async function j(){try{const W=await Ce("/api/skills");if(!W.ok)throw new Error(`HTTP error! status: ${W.status}`);const L=await W.json();t.value=L.skills}catch(W){n.value=W instanceof Error?W.message:"Failed to load skills"}finally{s.value=!1}}async function V(){if(!(i.value||r.value.trim()==="")){i.value=!0,a.value=null,o.value=null;try{const W=await Ce("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:r.value.trim()})});if(W.ok){const L=await W.json();t.value=[L.skill,...t.value],r.value="",o.value=`✓ Installed: ${L.skill.name}`,setTimeout(()=>{o.value=null},4e3),j()}else{let L="Install failed";try{L=(await W.json()).error??W.statusText??L}catch{L=W.statusText||L}a.value=L}}catch(W){a.value=W instanceof Error?W.message:"Install failed"}finally{i.value=!1}}}async function Z(){if(!(d.value||c.value.trim()===""||u.value.trim()==="")){d.value=!0,a.value=null,o.value=null;try{const W=await Ce("/api/skills/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.value.trim(),slug:c.value.trim()})});if(W.ok){const L=await W.json();t.value=[L.skill,...t.value],c.value="",u.value="",o.value=`✓ Installed: ${L.skill.name}`,setTimeout(()=>{o.value=null},4e3),j()}else{let L="Install failed";try{L=(await W.json()).error??W.statusText??L}catch{L=W.statusText||L}a.value=L}}catch(W){a.value=W instanceof Error?W.message:"Install failed"}finally{d.value=!1}}}async function $(W){if(confirm(`Delete skill "${W.name}"? This cannot be undone.`))try{const L=await Ce(`/api/skills/${encodeURIComponent(W.slug)}`,{method:"DELETE"});if(L.ok)t.value=t.value.filter(pe=>pe.slug!==W.slug),o.value=`✓ Deleted: ${W.name}`,setTimeout(()=>{o.value=null},3e3);else{const pe=await L.json().catch(()=>({}));a.value=pe.error??(L.status===404?"Skill not found":`Delete failed (HTTP ${L.status})`)}}catch(L){a.value=L instanceof Error?L.message:"Delete failed"}}return Ht(j),(W,L)=>(_(),w("div",Sy,[h.value?(_(),w("div",Ty,[p("div",Ay,[p("button",{onClick:C,class:"text-txt-muted hover:text-accent transition-colors flex items-center gap-1.5 text-sm group"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14,class:"transition-transform group-hover:-translate-x-0.5"}),L[6]||(L[6]=ve(" Back ",-1))]),L[7]||(L[7]=p("div",{class:"w-px h-5 bg-edge"},null,-1)),p("h2",Ry,I(h.value.name),1),p("span",Cy,I(h.value.slug),1)]),g.value?(_(),w("div",Oy,[...L[8]||(L[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):b.value?(_(),w("div",$y,[p("div",Ny,[L[9]||(L[9]=p("span",null,"⚠",-1)),ve(" "+I(b.value),1)])])):(_(),w("div",Iy,[E.value?(_(),w("div",Py,[E.value.name?(_(),w("div",Ly,[L[10]||(L[10]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Name",-1)),p("p",My,I(E.value.name),1)])):ee("",!0),E.value.description?(_(),w("div",jy,[L[11]||(L[11]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Description",-1)),p("p",Dy,I(E.value.description),1)])):ee("",!0),p("div",Uy,[E.value.version?(_(),w("div",By,[L[12]||(L[12]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Version",-1)),p("p",Hy,I(E.value.version),1)])):ee("",!0),E.value.author?(_(),w("div",Fy,[L[13]||(L[13]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Author",-1)),p("p",Vy,I(E.value.author),1)])):ee("",!0)]),P.value.length>0?(_(),w("dl",qy,[(_(!0),w(ke,null,ze(P.value,([pe,M])=>(_(),w(ke,{key:pe},[p("dt",zy,I(pe),1),p("dd",Ky,I(M),1)],64))),128))])):ee("",!0)])):ee("",!0),p("div",{innerHTML:x.value},null,8,Wy)]))])):(_(),w("div",Gy,[p("div",Zy,[L[19]||(L[19]=er('<div class="flex items-end justify-between mb-6" data-v-20b3d95d><div data-v-20b3d95d><h2 class="text-xl font-bold text-txt-primary tracking-tight" data-v-20b3d95d>Skills</h2><p class="text-xs text-txt-muted mt-0.5" data-v-20b3d95d>Manage installed Copilot skills</p></div><div class="flex items-center gap-2" data-v-20b3d95d><a href="https://github.com/github/awesome-copilot" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-20b3d95d><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-20b3d95d><path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z" data-v-20b3d95d></path></svg> awesome-copilot </a><a href="https://skills.sh" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-20b3d95d><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-20b3d95d><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8c0 .93.16 1.82.46 2.65L5 8.5V7H3.5l-.07.01A6.492 6.492 0 0 0 1.5 8Zm6.5 6.5c.93 0 1.82-.17 2.65-.47L8.5 11H7v2.5c.17.01.33.01.5.01Zm-5.3-1.7c.56.4 1.19.7 1.87.88L5 11H3.5c.34.66.79 1.25 1.2 1.8ZM8.5 1.5V4H10l2.5 2.5c.02-.16.03-.33.03-.5A6.5 6.5 0 0 0 8.5 1.5Zm-1 0A6.5 6.5 0 0 0 1.97 6H3.5L6 3.5V1.53c-.51.1-1 .26-1.5.46V1.5ZM11 8.5l-2.5 2.5H10l1.88-1.88A6.47 6.47 0 0 0 11 8.5ZM6 6v4h4V6H6Z" data-v-20b3d95d></path></svg> skills.sh </a></div></div>',1)),p("div",Jy,[p("div",Yy,[p("button",{type:"button",onClick:L[0]||(L[0]=pe=>l.value="url"),class:ge(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="url"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," From URL ",2),p("button",{type:"button",onClick:L[1]||(L[1]=pe=>l.value="paste"),class:ge(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="paste"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," Paste SKILL.md ",2)]),l.value==="url"?(_(),w("form",{key:0,onSubmit:yt(V,["prevent"])},[p("div",Xy,[dt(p("input",{"onUpdate:modelValue":L[2]||(L[2]=pe=>r.value=pe),type:"url",placeholder:"https://github.com/owner/repo.git","aria-label":"Git repository URL",disabled:i.value,class:"flex-1 bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,Qy),[[kt,r.value]]),p("button",{type:"submit",disabled:i.value||r.value.trim()==="",class:"bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150 whitespace-nowrap"},I(i.value?"Installing…":"Install"),9,e_)])],32)):(_(),w("form",{key:1,onSubmit:yt(Z,["prevent"])},[p("div",t_,[p("div",null,[dt(p("input",{"onUpdate:modelValue":L[3]||(L[3]=pe=>c.value=pe),type:"text",placeholder:"my-skill","aria-label":"Skill slug",disabled:d.value,class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,s_),[[kt,c.value]]),L[14]||(L[14]=p("p",{class:"text-[10px] text-txt-muted mt-1 ml-1"},"Unique identifier (lowercase, hyphens ok)",-1))]),dt(p("textarea",{"onUpdate:modelValue":L[4]||(L[4]=pe=>u.value=pe),placeholder:"Paste SKILL.md content here…","aria-label":"SKILL.md content",disabled:d.value,rows:"6",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary font-mono placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 resize-y transition-all duration-200"},null,8,n_),[[kt,u.value]]),p("button",{type:"submit",disabled:d.value||c.value.trim()===""||u.value.trim()==="",class:"self-end bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},I(d.value?"Installing…":"Install"),9,r_)])],32))]),o.value?(_(),w("div",i_,[L[15]||(L[15]=p("span",null,"✓",-1)),ve(" "+I(o.value),1)])):ee("",!0),a.value?(_(),w("div",a_,[L[16]||(L[16]=p("span",null,"⚠",-1)),ve(" "+I(a.value),1)])):ee("",!0),!s.value&&!n.value&&t.value.length>0?(_(),w("div",o_,[dt(p("input",{"onUpdate:modelValue":L[5]||(L[5]=pe=>N.value=pe),type:"search",placeholder:"Search skills…","aria-label":"Search skills",class:"w-full bg-surface-2/50 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,N.value]])])):ee("",!0),s.value?(_(),w("div",l_,[...L[17]||(L[17]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading skills… ")],-1)])])):n.value?(_(),w("div",c_,[L[18]||(L[18]=p("span",null,"⚠",-1)),ve(" "+I(n.value),1)])):t.value.length===0?(_(),w("div",u_," No skills installed yet ")):R.value.length===0?(_(),w("div",d_," No matching skills ")):(_(),w("div",h_,[(_(!0),w(ke,null,ze(R.value,pe=>(_(),w("div",{key:pe.slug,onClick:M=>v(pe),class:"group bg-surface-2/40 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card-hover hover:bg-surface-2/70 transition-all duration-200 cursor-pointer"},[p("div",p_,[p("div",g_,[p("h3",m_,I(pe.name),1),p("p",b_,I(pe.slug),1)]),p("button",{onClick:yt(M=>$(pe),["stop"]),class:"shrink-0 ml-2 p-1.5 rounded-lg text-txt-muted/0 group-hover:text-txt-muted hover:!text-red-400 hover:bg-red-500/10 transition-all duration-150",title:"Delete skill"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,v_)]),p("p",y_,I(pe.description),1),p("p",__,I(pe.path),1)],8,f_))),128))]))])]))]))}}),x_=rr(w_,[["__scopeId","data-v-20b3d95d"]]),E_={class:"flex flex-col h-full bg-surface-0"},k_={class:"flex-1 overflow-y-auto p-3 sm:p-6"},S_={class:"max-w-4xl"},T_={class:"flex justify-between items-end mb-6"},A_={class:"space-y-3"},R_=["disabled"],C_={key:0,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},O_={key:1,class:"flex items-center justify-center py-16"},$_={key:2,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},N_={key:3,class:"text-txt-muted text-sm text-center py-16"},I_={key:4,class:"grid gap-3"},P_=["onClick","aria-expanded"],L_={class:"flex justify-between items-start mb-2"},M_={class:"flex-1 flex items-center gap-2.5"},j_={class:"min-w-0"},D_={class:"font-semibold text-txt-primary text-sm"},U_={class:"text-[11px] text-txt-muted font-mono"},B_={class:"flex items-center gap-2 shrink-0"},H_={key:0,class:"px-2 py-0.5 rounded-md text-[10px] font-medium bg-purple-500/10 text-purple-300 border border-purple-500/20"},F_={class:"text-xs text-txt-muted font-mono ml-6"},V_={key:0,class:"border-t border-edge px-4 pb-4 pt-3 animate-fade-in"},q_={class:"flex justify-between items-center text-[10px] text-txt-muted mb-3"},z_={key:0,class:"font-mono"},K_={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-3"},W_={key:1,class:"text-red-400 text-xs py-2"},G_={key:2,class:"text-txt-muted text-xs italic py-2"},Z_={key:3,class:"space-y-1.5"},J_={class:"flex-1 min-w-0"},Y_={class:"flex items-center gap-1.5"},X_={class:"text-sm font-medium text-txt-primary truncate"},Q_={key:0,title:"Team Lead",class:"text-xs"},e1={key:1,title:"QA / Veto Power",class:"text-xs"},t1={class:"text-[10px] text-txt-muted"},s1={class:"flex items-center gap-1 shrink-0"},n1=["onClick"],r1=["onClick","disabled"],i1={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},a1={class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},o1={class:"text-sm font-semibold text-txt-primary flex items-center gap-2"},l1={class:"text-xs font-normal text-txt-muted"},c1={class:"text-[10px] text-txt-muted mt-0.5 flex items-center gap-1.5"},u1={class:"flex items-center gap-3"},d1={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},h1={key:0,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},f1={key:1,class:"text-txt-muted italic text-center py-8"},p1={class:"shrink-0"},g1={class:"flex-1 min-w-0"},m1={class:"text-txt-secondary break-words"},b1={class:"text-txt-muted text-[10px] ml-2"},v1={key:0,class:"text-txt-muted italic text-center py-4"},y1={class:"flex justify-between items-center mb-1"},_1={class:"text-accent"},w1={class:"text-txt-muted text-[10px]"},x1={class:"text-txt-secondary whitespace-pre-wrap break-words"},E1=pt({__name:"SquadsView",setup(e){const t=new Set(["system"]),s={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},n=Q([]),r=Q(!0),i=Q(null),a=Q(!1),o=Q(!1),l=Q(null),c=Xt({}),u=Xt({});function d(T){return[...T].sort((O,X)=>{const ce=Ue=>Ue.is_lead?0:Ue.is_qa?1:2;return ce(O)-ce(X)})}const h=Xt({}),f=Xt({}),g=Q(new Set),b=Q(null),S=Q([]),E=Q(null),x=Q(!1),k=Q(!0),P=Q(null);let N=null;const R=je(()=>E.value?"Disconnected":x.value?"Live":"Connecting…"),v=je(()=>S.value.filter(T=>!(!T.summary||t.has(T.summary.kind)||T.type==="assistant.message_delta"))),C=T=>{try{return new Date(T).toLocaleTimeString()}catch{return""}},j=T=>{const O=T.data;if(!O||typeof O!="object")return"";if(typeof O.deltaContent=="string")return O.deltaContent;if(typeof O.content=="string")return O.content;if(typeof O.text=="string")return O.text;try{return JSON.stringify(O,null,2)}catch{return String(O)}},V=()=>{Is(()=>{const T=P.value;T&&(T.scrollTop=T.scrollHeight)})},Z=async T=>{if(!T.currentTaskId)return;$(),b.value=T,S.value=[],E.value=null,x.value=!1,k.value=!0;const O=await fi(`/api/tasks/${encodeURIComponent(T.currentTaskId)}/events`),X=new EventSource(O);N=X,X.onopen=()=>{x.value=!0},X.onmessage=ce=>{try{const Ue=JSON.parse(ce.data);S.value.push(Ue),V()}catch{}},X.onerror=()=>{x.value=!1,S.value.length===0&&(E.value="Connection error. Retrying…")}},$=()=>{if(N){try{N.close()}catch{}N=null}b.value=null,S.value=[],E.value=null,x.value=!1};Ra(()=>{$()});const W=async(T,O)=>{if(!g.value.has(O)){g.value=new Set(g.value).add(O);try{await Ce(`/api/tasks/${encodeURIComponent(O)}/cancel`,{method:"POST"}),await ue(T,!0)}catch(X){f[T]=X instanceof Error?X.message:"Failed to stop task"}finally{const X=new Set(g.value);X.delete(O),g.value=X}}},L=Q({slug:"",name:"",projectPath:""}),pe=T=>T?s[T]??T:"",M=T=>new Date(T).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),z=T=>!!c[T],Y=async T=>{c[T]=!c[T],c[T]&&!u[T]&&!h[T]&&await ue(T)},ue=async(T,O=!1)=>{if(!(!O&&h[T])){h[T]=!0,f[T]=null;try{const X=await Ce(`/api/squads/${encodeURIComponent(T)}/agents`);if(!X.ok)throw new Error(`HTTP error! status: ${X.status}`);const ce=await X.json();u[T]=ce.agents}catch(X){f[T]=X instanceof Error?X.message:"Failed to load agents"}finally{h[T]=!1}}},xe=async()=>{try{const T=await Ce("/api/squads");if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const O=await T.json();n.value=O.squads}catch(T){i.value=T instanceof Error?T.message:"Failed to load squads"}finally{r.value=!1}},q=async()=>{if(!L.value.slug||!L.value.name||!L.value.projectPath){l.value="All fields are required";return}o.value=!0,l.value=null;try{const T=await Ce("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:L.value.slug,name:L.value.name,projectPath:L.value.projectPath})});if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);L.value={slug:"",name:"",projectPath:""},a.value=!1,await xe()}catch(T){l.value=T instanceof Error?T.message:"Failed to create squad"}finally{o.value=!1}};return Ht(()=>{xe()}),(T,O)=>(_(),w("div",E_,[p("div",k_,[p("div",S_,[p("div",T_,[O[5]||(O[5]=p("div",null,[p("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Squads"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Manage teams and monitor agents")],-1)),p("button",{onClick:O[0]||(O[0]=X=>a.value=!a.value),class:ge(["px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150",a.value?"bg-surface-3/50 text-txt-secondary border border-edge hover:bg-surface-3/70":"bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40"])},I(a.value?"Cancel":"New Squad"),3)]),a.value?(_(),w("form",{key:0,onSubmit:yt(q,["prevent"]),class:"bg-surface-2/40 border border-edge rounded-xl p-5 mb-6 animate-fade-in"},[O[7]||(O[7]=p("h3",{class:"font-semibold text-txt-primary text-sm mb-4"},"Create New Squad",-1)),p("div",A_,[dt(p("input",{"onUpdate:modelValue":O[1]||(O[1]=X=>L.value.slug=X),type:"text",placeholder:"Squad slug (e.g., frontend-team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.slug]]),dt(p("input",{"onUpdate:modelValue":O[2]||(O[2]=X=>L.value.name=X),type:"text",placeholder:"Squad name (e.g., Frontend Team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.name]]),dt(p("input",{"onUpdate:modelValue":O[3]||(O[3]=X=>L.value.projectPath=X),type:"text",placeholder:"Project path (e.g., /path/to/project)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,L.value.projectPath]]),p("button",{type:"submit",disabled:o.value||!L.value.slug||!L.value.name||!L.value.projectPath,class:"w-full bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},I(o.value?"Creating…":"Create Squad"),9,R_)]),l.value?(_(),w("div",C_,[O[6]||(O[6]=p("span",null,"⚠",-1)),ve(" "+I(l.value),1)])):ee("",!0)],32)):ee("",!0),r.value?(_(),w("div",O_,[...O[8]||(O[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading squads… ")],-1)])])):i.value?(_(),w("div",$_,[O[9]||(O[9]=p("span",null,"⚠",-1)),ve(" "+I(i.value),1)])):n.value.length===0?(_(),w("div",N_," No squads created yet ")):(_(),w("div",I_,[(_(!0),w(ke,null,ze(n.value,X=>(_(),w("div",{key:X.id,class:"bg-surface-2/40 border border-edge rounded-xl overflow-hidden hover:border-edge-bright transition-all duration-200"},[p("button",{type:"button",onClick:ce=>Y(X.slug),class:"w-full text-left p-4 focus:outline-none","aria-expanded":z(X.slug)},[p("div",L_,[p("div",M_,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:14,class:ge(["text-txt-muted transition-transform duration-200 shrink-0",z(X.slug)?"rotate-90":""])},null,8,["class"]),p("div",j_,[p("h3",D_,I(X.name),1),p("p",U_,I(X.slug),1)])]),p("div",B_,[X.universe?(_(),w("span",H_," 🎬 "+I(pe(X.universe)),1)):ee("",!0),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",X.status==="working"?"bg-accent/10 text-accent border border-accent/20":X.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-surface-3/60 text-txt-muted border border-edge"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",X.status==="working"?"bg-accent animate-pulse":X.status==="error"?"bg-red-400":"bg-txt-muted/50"])},null,2),ve(" "+I(X.status),1)],2)])]),p("p",F_,"📁 "+I(X.project_path),1)],8,P_),z(X.slug)?(_(),w("div",V_,[p("div",q_,[X.model?(_(),w("span",z_,"Model: "+I(X.model),1)):ee("",!0),p("span",null,I(M(X.created_at)),1)]),O[13]||(O[13]=p("h4",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-2"},"Team Roster",-1)),h[X.slug]?(_(),w("div",K_,[...O[10]||(O[10]=[p("span",{class:"w-3 h-3 border-2 border-edge border-t-accent rounded-full animate-spin"},null,-1),ve(" Loading agents… ",-1)])])):f[X.slug]?(_(),w("div",W_,I(f[X.slug]),1)):!u[X.slug]||u[X.slug].length===0?(_(),w("div",G_," No agents assigned yet ")):(_(),w("ul",Z_,[(_(!0),w(ke,null,ze(d(u[X.slug]??[]),ce=>(_(),w("li",{key:ce.id??ce.character_name,class:ge(["flex items-center gap-3 rounded-lg px-3 py-2 transition-all duration-150",ce.status==="working"?"bg-accent/[0.06] border border-accent/15":"bg-surface-1/50 border border-edge"])},[p("div",{class:ge(["w-7 h-7 rounded-full flex items-center justify-center shrink-0 text-[10px] font-bold",ce.status==="working"?"bg-accent/15 text-accent border border-accent/25":ce.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-surface-3/60 text-txt-muted border border-edge"])},I((ce.character_name??"?").charAt(0).toUpperCase()),3),p("div",J_,[p("div",Y_,[p("span",X_,I(ce.character_name),1),ce.is_lead?(_(),w("span",Q_,"👑")):ee("",!0),ce.is_qa?(_(),w("span",e1,"🛡️")):ee("",!0)]),p("span",t1,I(ce.role_title),1)]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",ce.status==="working"?"bg-accent/10 text-accent":ce.status==="error"?"bg-red-500/10 text-red-400":"bg-surface-3/40 text-txt-muted"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",ce.status==="working"?"bg-accent animate-pulse":ce.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),ve(" "+I(ce.status),1)],2),p("div",s1,[ce.status==="working"&&ce.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:Ue=>Z(ce),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-accent/10 text-accent border border-accent/20 hover:bg-accent/20 transition-all duration-150 flex items-center gap-1",title:"Preview live work"},[...O[11]||(O[11]=[p("span",{"aria-hidden":"true"},"👁",-1),ve(" Preview ",-1)])],8,n1)):ee("",!0),ce.status==="working"&&ce.currentTaskId?(_(),w("button",{key:1,type:"button",onClick:Ue=>W(X.slug,ce.currentTaskId),disabled:g.value.has(ce.currentTaskId),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[O[12]||(O[12]=p("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),ve(" "+I(g.value.has(ce.currentTaskId)?"Stopping…":"Stop"),1)],8,r1)):ee("",!0)])],2))),128))]))])):ee("",!0)]))),128))]))])]),b.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:yt($,["self"])},[p("div",i1,[p("div",a1,[p("div",null,[p("h3",o1,[ve(I(b.value.character_name)+" ",1),p("span",l1,"— "+I(b.value.role_title),1)]),p("p",c1,[p("span",{class:ge(["inline-block w-1.5 h-1.5 rounded-full",x.value?"bg-emerald-400 animate-pulse":"bg-txt-muted/50"])},null,2),ve(" "+I(R.value),1)])]),p("div",u1,[p("label",d1,[dt(p("input",{type:"checkbox","onUpdate:modelValue":O[4]||(O[4]=X=>k.value=X),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[su,k.value]]),O[14]||(O[14]=ve(" Summary ",-1))]),p("button",{type:"button",onClick:$,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")])]),p("div",{ref_key:"previewScrollEl",ref:P,class:"overflow-y-auto p-4 space-y-2 flex-1 font-mono text-xs"},[E.value?(_(),w("div",h1,I(E.value),1)):S.value.length===0?(_(),w("div",f1," Waiting for activity… ")):k.value?(_(),w(ke,{key:2},[(_(!0),w(ke,null,ze(v.value,(X,ce)=>(_(),w("div",{key:ce,class:"flex items-start gap-2 py-1.5 px-1"},[p("span",p1,I(X.summary.icon),1),p("div",g1,[p("span",m1,I(X.summary.summary),1),p("span",b1,I(C(X.ts)),1)])]))),128)),v.value.length===0?(_(),w("div",v1," Processing… ")):ee("",!0)],64)):(_(!0),w(ke,{key:3},ze(S.value,(X,ce)=>(_(),w("div",{key:ce,class:"border border-edge rounded-lg p-2.5 bg-surface-0"},[p("div",y1,[p("span",_1,I(X.type),1),p("span",w1,I(C(X.ts)),1)]),p("pre",x1,I(j(X)),1)]))),128))],512),p("div",{class:"px-4 py-3 border-t border-edge flex justify-end"},[p("button",{type:"button",onClick:$,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):ee("",!0)]))}}),k1={class:"flex flex-col h-full bg-surface-0"},S1={class:"flex-1 overflow-y-auto p-3 sm:p-6"},T1={class:"max-w-4xl"},A1={class:"flex justify-between items-end mb-6"},R1=["disabled"],C1={key:0,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-6 text-sm"},O1={class:"mb-8"},$1={key:0,class:"flex items-center justify-center py-10"},N1={key:1,class:"text-txt-muted text-sm text-center py-10"},I1={key:2,class:"grid gap-3"},P1={class:"flex justify-between items-start mb-2.5"},L1={class:"flex items-center gap-3 min-w-0"},M1={class:"min-w-0"},j1={class:"font-semibold text-txt-primary text-sm"},D1={class:"flex items-center gap-1.5 mt-0.5 flex-wrap"},U1={class:"text-[10px] text-txt-muted font-mono"},B1={key:0,class:"text-[10px] text-txt-secondary bg-surface-3/50 px-1.5 py-0.5 rounded border border-edge"},H1={key:1,class:"text-[10px] text-purple-300 bg-purple-500/10 px-1.5 py-0.5 rounded border border-purple-500/20"},F1=["title"],V1={key:0,class:"bg-surface-0/60 border border-edge rounded-lg p-3 mb-2.5 ml-12"},q1={class:"text-sm text-txt-primary break-words"},z1={class:"flex justify-between items-center ml-12"},K1={class:"text-[10px] text-txt-muted"},W1=["onClick","disabled"],G1={key:0,class:"flex items-center justify-center py-10"},Z1={key:1,class:"text-txt-muted text-sm text-center py-10"},J1={key:2,class:"relative"},Y1={class:"space-y-1"},X1=["onClick"],Q1={class:"flex justify-between items-start gap-3"},ew={class:"min-w-0 flex-1"},tw={class:"flex items-center gap-2 mb-0.5"},sw={class:"text-sm font-medium text-txt-primary truncate group-hover:text-accent transition-colors"},nw={key:0,class:"text-[10px] text-txt-muted bg-surface-3/40 px-1.5 py-0.5 rounded border border-edge"},rw={class:"text-xs text-txt-secondary truncate"},iw={class:"text-[10px] text-txt-muted mt-1"},aw={key:0},ow={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},lw={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},cw={class:"overflow-y-auto p-5 space-y-4"},uw={key:0,class:"flex items-center justify-center py-10"},dw={key:1,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},hw={class:"flex justify-between items-start gap-3"},fw={class:"text-sm text-txt-primary font-medium"},pw={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},gw={class:"text-[11px] text-txt-muted font-mono break-all bg-surface-0/60 px-2 py-1 rounded border border-edge"},mw={key:0},bw={class:"text-sm text-txt-secondary"},vw={class:"grid grid-cols-2 gap-4"},yw={class:"text-sm text-txt-secondary"},_w={class:"text-sm text-txt-secondary"},ww={key:1},xw={class:"text-sm text-accent font-mono"},Ew=["innerHTML"],kw={class:"flex justify-between items-center mb-2"},Sw={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},Tw={key:0,class:"text-sm text-txt-muted italic"},Aw={key:1,class:"text-sm text-txt-muted italic"},Rw={key:2,class:"bg-surface-0/60 border border-edge rounded-lg divide-y divide-edge max-h-96 overflow-y-auto"},Cw=["onClick"],Ow={class:"shrink-0"},$w={class:"flex-1 break-words"},Nw={class:"text-[10px] text-txt-muted shrink-0"},Iw={key:0,class:"mt-2 pl-6 space-y-1"},Pw={key:0,class:"text-xs text-txt-secondary bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono"},Lw={class:"text-[11px] text-txt-muted bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono max-h-48 overflow-y-auto"},Mw={class:"text-[10px] text-txt-muted font-mono"},jw=["innerHTML"],Dw={key:1,class:"text-sm text-txt-muted italic"},Uw={class:"px-5 py-3 border-t border-edge flex justify-between items-center"},Bw=["disabled"],Hw={key:1},Fw=pt({__name:"AgentActivityView",setup(e){const t=Q([]),s=Q([]),n=Q(!0),r=Q(null),i=Q(new Set),a=Q(null),o=Q(null),l=Q(!1),c=Q(null),u=Q([]),d=Q(!1),h=Q(!1),f=Q(new Set);let g=null,b=null,S=null;const E=q=>q.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),x=q=>{if(!q)return"";const T=q.includes("T")?q:q.replace(" ","T")+"Z",O=new Date(T);return Number.isNaN(O.getTime())?q:O.toLocaleString()},k=q=>{switch(q){case"running":return"bg-accent/10 text-accent border border-accent/20";case"done":return"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-400 border border-red-500/20";case"cancelled":return"bg-amber-500/10 text-amber-400 border border-amber-500/20";default:return"bg-surface-3/50 text-txt-muted border border-edge"}},P=je(()=>{if(!o.value)return null;const q=o.value.started_at,T=o.value.completed_at;if(!q||!T)return null;const O=new Date(q.includes("T")?q:q.replace(" ","T")+"Z").getTime(),X=new Date(T.includes("T")?T:T.replace(" ","T")+"Z").getTime();if(Number.isNaN(O)||Number.isNaN(X))return null;const ce=Math.max(0,Math.round((X-O)/1e3));if(ce<60)return`${ce}s`;const Ue=Math.floor(ce/60),F=ce%60;return`${Ue}m ${F}s`}),N=async q=>{if(!i.value.has(q)){i.value=new Set(i.value).add(q);try{await Ce(`/api/tasks/${encodeURIComponent(q)}/cancel`,{method:"POST"}),await C(),a.value===q&&await j(q)}catch(T){r.value=T instanceof Error?T.message:"Failed to stop task"}finally{const T=new Set(i.value);T.delete(q),i.value=T}}},R=async()=>{try{const q=await Ce("/api/agents");if(!q.ok)throw new Error(`HTTP error! status: ${q.status}`);const T=await q.json();t.value=T.agents}catch(q){r.value=q instanceof Error?q.message:"Failed to load agents"}},v=async()=>{try{const q=await Ce("/api/tasks?limit=50");if(!q.ok)throw new Error(`HTTP error! status: ${q.status}`);const T=await q.json();s.value=T.tasks}catch(q){r.value=q instanceof Error?q.message:"Failed to load tasks"}},C=async()=>{n.value=!0,r.value=null;try{await Promise.all([R(),v()])}finally{n.value=!1}},j=async q=>{l.value=!0,c.value=null;try{const T=await Ce(`/api/tasks/${encodeURIComponent(q)}`);if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const O=await T.json();o.value=O.task}catch(T){c.value=T instanceof Error?T.message:"Failed to load task",o.value=null}finally{l.value=!1}},V=q=>{if(!q)return"";const T=new Date(q);return Number.isNaN(T.getTime())?"":T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},Z=q=>{try{return JSON.stringify(q,null,2)}catch{return String(q)}},$=q=>{if(q.status==="success")return"text-emerald-300";if(q.status==="error")return"text-red-300";if(q.status==="pending")return"text-accent";switch(q.kind){case"message":return"text-txt-primary";case"reasoning":return"text-purple-300";case"tool":return"text-blue-300";case"outcome":return"text-amber-300";default:return"text-txt-secondary"}},W=q=>{if(h.value)return;const T=new Set(f.value);T.has(q)?T.delete(q):T.add(q),f.value=T},L=async(q,T={})=>{T.initial&&(d.value=!0);try{const O=await Ce(`/api/tasks/${encodeURIComponent(q)}/activity`);if(!O.ok)return;const X=await O.json();u.value=X.activity??[]}catch{}finally{T.initial&&(d.value=!1)}},pe=q=>{b||(b=setTimeout(()=>{b=null,a.value===q&&L(q)},250))},M=async q=>{z(),L(q,{initial:!0});try{g=new EventSource(await fi(`/api/tasks/${encodeURIComponent(q)}/events`)),g.onmessage=()=>{pe(q)},g.onerror=()=>{}}catch{g=null}},z=()=>{g&&(g.close(),g=null),b&&(clearTimeout(b),b=null)},Y=q=>{a.value=q,o.value=null,u.value=[],f.value=new Set,j(q),M(q)},ue=()=>{a.value=null,o.value=null,c.value=null,u.value=[],f.value=new Set,z()},xe=q=>{q.key==="Escape"&&a.value&&ue()};return es(a,q=>{q?document.addEventListener("keydown",xe):document.removeEventListener("keydown",xe)}),Ht(()=>{C(),S=setInterval(C,5e3)}),es(()=>{var q;return(q=o.value)==null?void 0:q.status},q=>{q&&q!=="running"&&(a.value&&L(a.value),z())}),ti(()=>{S&&clearInterval(S),document.removeEventListener("keydown",xe),z()}),(q,T)=>(_(),w("div",k1,[p("div",S1,[p("div",T1,[p("div",A1,[T[2]||(T[2]=p("div",null,[p("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Activity"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Monitor agents and recent tasks")],-1)),p("button",{onClick:C,disabled:n.value,class:"px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150 bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed"},I(n.value?"Refreshing…":"Refresh"),9,R1)]),r.value?(_(),w("div",C1,[T[3]||(T[3]=p("span",null,"⚠",-1)),ve(" "+I(r.value),1)])):ee("",!0),p("section",O1,[T[7]||(T[7]=p("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Active Agents",-1)),n.value&&t.value.length===0?(_(),w("div",$1,[...T[4]||(T[4]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading agents… ")],-1)])])):t.value.length===0?(_(),w("div",N1," No active agents ")):(_(),w("div",I1,[(_(!0),w(ke,null,ze(t.value,O=>(_(),w("div",{key:O.slug+(O.characterName||""),class:ge(["group bg-surface-2/40 border rounded-xl p-4 transition-all duration-200",O.status==="working"?"border-accent/20 hover:border-accent/35":"border-edge hover:border-edge-bright"])},[p("div",P1,[p("div",L1,[p("div",{class:ge(["w-9 h-9 rounded-xl flex items-center justify-center shrink-0 text-xs font-bold",O.status==="working"?"bg-accent/15 text-accent border border-accent/25":O.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},I((O.name??"?").charAt(0).toUpperCase()),3),p("div",M1,[p("h3",j1,I(O.name),1),p("div",D1,[p("span",U1,I(O.slug),1),O.roleTitle?(_(),w("span",B1,I(O.roleTitle),1)):ee("",!0),O.universe?(_(),w("span",H1," 🎬 "+I(O.universe),1)):ee("",!0),O.model&&O.status==="working"?(_(),w("span",{key:2,class:"text-[10px] text-emerald-300 bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20",title:`Model: ${O.model}`}," 🧠 "+I(O.model),9,F1)):ee("",!0)])])]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",O.status==="working"?"bg-accent/10 text-accent border border-accent/20":O.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},[p("span",{class:ge(["w-1.5 h-1.5 rounded-full",O.status==="working"?"bg-accent animate-pulse":O.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),ve(" "+I(O.status==="working"?"Working":O.status==="error"?"Error":"Idle"),1)],2)]),O.currentTask?(_(),w("div",V1,[T[5]||(T[5]=p("p",{class:"text-[10px] text-txt-muted uppercase tracking-wider mb-1"},"Current Task",-1)),p("p",q1,I(O.currentTask),1)])):ee("",!0),p("div",z1,[p("div",K1," Last updated: "+I(E(new Date)),1),O.status==="working"&&O.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:X=>N(O.currentTaskId),disabled:i.value.has(O.currentTaskId),class:"text-[10px] font-medium px-2.5 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[T[6]||(T[6]=p("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),ve(" "+I(i.value.has(O.currentTaskId)?"Stopping…":"Stop"),1)],8,W1)):ee("",!0)])],2))),128))]))]),p("section",null,[T[10]||(T[10]=p("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Recent Activity",-1)),n.value&&s.value.length===0?(_(),w("div",G1,[...T[8]||(T[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading activity… ")],-1)])])):s.value.length===0?(_(),w("div",Z1," No recent activity yet ")):(_(),w("div",J1,[T[9]||(T[9]=p("div",{class:"absolute left-[15px] top-0 bottom-0 w-px bg-gradient-to-b from-accent/30 via-edge to-transparent"},null,-1)),p("div",Y1,[(_(!0),w(ke,null,ze(s.value,O=>(_(),w("button",{key:O.task_id,type:"button",onClick:X=>Y(O.task_id),class:"w-full text-left relative pl-10 pr-4 py-3 rounded-lg hover:bg-surface-2/40 transition-all duration-150 group"},[p("div",{class:ge(["absolute left-[11px] top-4 w-[9px] h-[9px] rounded-full border-2 z-10",O.status==="running"?"bg-accent border-accent shadow-glow-sm":O.status==="done"?"bg-emerald-400 border-emerald-400":O.status==="failed"?"bg-red-400 border-red-400":O.status==="cancelled"?"bg-amber-400 border-amber-400":"bg-surface-3 border-edge"])},null,2),p("div",Q1,[p("div",ew,[p("div",tw,[p("span",sw,I(O.agent_slug),1),O.origin_channel?(_(),w("span",nw,"via "+I(O.origin_channel),1)):ee("",!0)]),p("p",rw,I(O.description),1),p("p",iw,[ve(I(x(O.started_at))+" ",1),O.completed_at?(_(),w("span",aw," · "+I(x(O.completed_at)),1)):ee("",!0)])]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",k(O.status)])},[O.status==="running"?(_(),w("span",ow)):ee("",!0),ve(" "+I(O.status),1)],2)])],8,X1))),128))])]))])])]),a.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:yt(ue,["self"])},[p("div",lw,[p("div",{class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},[T[11]||(T[11]=p("h3",{class:"text-sm font-semibold text-txt-primary"},"Task Details",-1)),p("button",{type:"button",onClick:ue,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")]),p("div",cw,[l.value?(_(),w("div",uw,[...T[12]||(T[12]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading task… ")],-1)])])):c.value?(_(),w("div",dw,I(c.value),1)):o.value?(_(),w(ke,{key:2},[p("div",hw,[p("div",null,[T[13]||(T[13]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Agent",-1)),p("p",fw,I(o.value.agent_slug),1)]),p("span",{class:ge(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",k(o.value.status)])},[o.value.status==="running"?(_(),w("span",pw)):ee("",!0),ve(" "+I(o.value.status),1)],2)]),p("div",null,[T[14]||(T[14]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Task ID",-1)),p("p",gw,I(o.value.task_id),1)]),o.value.origin_channel?(_(),w("div",mw,[T[15]||(T[15]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Origin",-1)),p("p",bw,I(o.value.origin_channel),1)])):ee("",!0),p("div",vw,[p("div",null,[T[16]||(T[16]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Started",-1)),p("p",yw,I(x(o.value.started_at)),1)]),p("div",null,[T[17]||(T[17]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Completed",-1)),p("p",_w,I(o.value.completed_at?x(o.value.completed_at):"—"),1)])]),P.value?(_(),w("div",ww,[T[18]||(T[18]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Duration",-1)),p("p",xw,I(P.value),1)])):ee("",!0),p("div",null,[T[19]||(T[19]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Description",-1)),p("div",{class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content",innerHTML:Ie(Ms)(o.value.description)},null,8,Ew)]),p("div",null,[p("div",kw,[T[21]||(T[21]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted"},"Activity",-1)),p("label",Sw,[dt(p("input",{type:"checkbox","onUpdate:modelValue":T[0]||(T[0]=O=>h.value=O),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[su,h.value]]),T[20]||(T[20]=ve(" Show details ",-1))])]),d.value&&u.value.length===0?(_(),w("div",Tw,"Loading activity…")):u.value.length===0?(_(),w("div",Aw,"No activity yet")):(_(),w("ul",Rw,[(_(!0),w(ke,null,ze(u.value,(O,X)=>(_(),w("li",{key:`${O.ts}-${X}-${O.rawType}`,class:"px-3 py-2 text-sm hover:bg-surface-2/40 cursor-pointer transition-colors",onClick:ce=>W(X)},[p("div",{class:ge(["flex items-start gap-2",$(O)])},[p("span",Ow,I(O.icon),1),p("span",$w,I(O.summary),1),p("span",Nw,I(V(O.ts)),1)],2),h.value||f.value.has(X)?(_(),w("div",Iw,[O.detail?(_(),w("pre",Pw,I(O.detail),1)):ee("",!0),p("pre",Lw,I(Z(O.raw)),1),p("p",Mw,I(O.rawType),1)])):ee("",!0)],8,Cw))),128))]))]),p("div",null,[T[22]||(T[22]=p("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Result",-1)),o.value.result?(_(),w("div",{key:0,class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content max-h-96 overflow-y-auto",innerHTML:Ie(Ms)(o.value.result)},null,8,jw)):(_(),w("p",Dw,"No result yet"))])],64)):ee("",!0)]),p("div",Uw,[o.value&&o.value.status==="running"?(_(),w("button",{key:0,type:"button",onClick:T[1]||(T[1]=O=>N(o.value.task_id)),disabled:i.value.has(o.value.task_id),class:"text-xs font-medium px-3 py-1.5 rounded-lg bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},I(i.value.has(o.value.task_id)?"Stopping…":"Stop Task"),9,Bw)):(_(),w("span",Hw)),p("button",{type:"button",onClick:ue,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):ee("",!0)]))}}),Vw={class:"flex flex-col h-full"},qw={class:"flex-1 overflow-y-auto p-3 sm:p-6"},zw={class:"flex justify-between items-center mb-6"},Kw=["disabled"],Ww={key:0,class:"flex items-center justify-center py-16"},Gw={key:1,class:"bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl mb-4 text-sm"},Zw={open:"",class:"mb-8 group/section"},Jw={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},Yw={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},Xw={key:0,class:"flex flex-col items-center py-8"},Qw={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},ex={key:1,class:"grid gap-3"},tx={class:"flex flex-wrap items-start gap-3"},sx={class:"flex-1 min-w-0"},nx={class:"flex flex-wrap items-center gap-2 mb-1.5"},rx={class:"font-semibold text-txt-primary break-words min-w-0"},ix={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},ax={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},ox={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},lx={key:0,class:"flex items-center gap-1 shrink-0"},cx={key:1,class:"flex items-center gap-1 shrink-0"},ux={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},dx={class:"flex flex-wrap items-center gap-1.5"},hx=["onClick","disabled"],fx=["onClick","disabled"],px=["onClick","disabled"],gx=["onClick"],mx=["onClick","disabled"],bx={key:0,class:"mt-3"},vx=["onClick"],yx={key:1,class:"mt-4 pt-4 border-t border-edge/50"},_x={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},wx={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},xx={key:1,class:"text-txt-muted text-xs py-2 text-center"},Ex={key:2,class:"space-y-1.5"},kx={class:"flex-1 min-w-0"},Sx={class:"flex flex-wrap items-center gap-2"},Tx={class:"text-txt-secondary"},Ax={key:0,class:"text-txt-muted mt-0.5"},Rx={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},Cx={open:"",class:"group/section"},Ox={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},$x={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},Nx={key:0,class:"flex flex-col items-center py-8"},Ix={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},Px={key:1,class:"grid gap-3"},Lx={class:"flex flex-wrap items-start gap-3"},Mx={class:"flex-1 min-w-0"},jx={class:"flex flex-wrap items-center gap-2 mb-1.5"},Dx={class:"font-semibold text-txt-primary break-words min-w-0"},Ux={class:"text-[10px] font-mono text-accent/60 bg-accent/5 px-2 py-0.5 rounded-full border border-accent/10 shrink-0"},Bx={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},Hx={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},Fx={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},Vx={key:0,class:"flex items-center gap-1 shrink-0"},qx={key:1,class:"flex items-center gap-1 shrink-0"},zx={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},Kx={class:"flex flex-wrap items-center gap-1.5"},Wx=["onClick","disabled"],Gx=["onClick","disabled"],Zx=["onClick","disabled"],Jx=["onClick"],Yx=["onClick","disabled"],Xx={key:0,class:"mt-3"},Qx=["onClick"],eE={key:1,class:"mt-4 pt-4 border-t border-edge/50"},tE={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},sE={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},nE={key:1,class:"text-txt-muted text-xs py-2 text-center"},rE={key:2,class:"space-y-1.5"},iE={class:"flex-1 min-w-0"},aE={class:"flex flex-wrap items-center gap-2"},oE={class:"text-txt-secondary"},lE={key:0,class:"text-txt-muted mt-0.5"},cE={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},uE=pt({__name:"SchedulesView",setup(e){const t=Q([]),s=Q([]),n=Q(!0),r=Q(null),i=Q(new Set),a=Q(new Map),o=Q(new Map),l=Q(new Set),c=Q(new Set);function u(N){const R=N.includes("T")||N.endsWith("Z")?N:N.replace(" ","T")+"Z";return new Date(R).toLocaleString()}function d(N){return N==="done"?"bg-emerald-400":N==="failed"?"bg-red-400":"bg-accent animate-pulse"}function h(N){return N==="done"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":N==="failed"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-accent/10 text-accent border-accent/20"}function f(N,R){const v=`${N}-${R}`,C=new Set(c.value);C.has(v)?C.delete(v):C.add(v),c.value=C}async function g(N,R){const v=`${N}-${R}`,C=a.value.get(v)??!1,j=new Map(a.value);if(j.set(v,!C),a.value=j,!C&&!o.value.has(v)){const V=new Set(l.value);V.add(v),l.value=V;try{const Z=await Ce(`/api/schedules/${N}/${R}/runs?limit=25`);if(Z.ok){const $=await Z.json(),W=new Map(o.value);W.set(v,$.runs??[]),o.value=W}}catch{}finally{const Z=new Set(l.value);Z.delete(v),l.value=Z}}}async function b(){n.value=!0,r.value=null,o.value=new Map;try{const N=await Ce("/api/schedules");if(!N.ok)throw new Error(`HTTP ${N.status}`);const R=await N.json();t.value=R.io,s.value=R.squads}catch(N){r.value=N instanceof Error?N.message:"Failed to load schedules"}finally{n.value=!1}}async function S(N,R){if(!i.value.has(N)){i.value=new Set(i.value).add(N);try{await R(),await b()}catch(v){r.value=v instanceof Error?v.message:"Action failed"}finally{const v=new Set(i.value);v.delete(N),i.value=v}}}async function E(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/pause`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function x(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/resume`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function k(N,R){await S(`${N}-${R}`,async()=>{const v=await Ce(`/api/schedules/${N}/${R}/run-now`,{method:"POST"});if(!v.ok)throw new Error(`HTTP ${v.status}`)})}async function P(N,R,v){window.confirm(`Delete schedule '${v}'?`)&&await S(`${N}-${R}`,async()=>{const C=await Ce(`/api/schedules/${N}/${R}`,{method:"DELETE"});if(!C.ok)throw new Error(`HTTP ${C.status}`)})}return Ht(b),(N,R)=>(_(),w("div",Vw,[p("div",qw,[p("div",zw,[R[1]||(R[1]=p("div",null,[p("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Schedules"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Automated tasks & cron jobs")],-1)),p("button",{onClick:b,disabled:n.value,class:"flex items-center gap-1.5 bg-surface-2/60 hover:bg-surface-3/60 disabled:opacity-50 text-txt-secondary hover:text-txt-primary border border-edge hover:border-edge-bright px-3.5 py-2 rounded-xl text-sm transition-all duration-200"},[be(Re,{paths:'<path d="M11.41 3.64a.5.5 0 0 0 0-.71L9.3.8a.5.5 0 0 0-.7.7l1 1a7.5 7.5 0 0 0-4.08 13.5.5.5 0 0 0 .6-.8A6.5 6.5 0 0 1 10.14 3.5L8.59 5.04a.5.5 0 0 0 .7.7l2.12-2.11ZM8.6 16.36a.5.5 0 0 0 0 .71l2.12 2.12a.5.5 0 0 0 .7-.7l-1-1a7.5 7.5 0 0 0 4.07-13.5.5.5 0 1 0-.59.8A6.5 6.5 0 0 1 9.86 16.5l1.55-1.55a.5.5 0 1 0-.7-.7l-2.12 2.11Z"/>',class:"w-3.5 h-3.5"}),R[0]||(R[0]=ve(" Refresh ",-1))],8,Kw)]),n.value?(_(),w("div",Ww,[...R[2]||(R[2]=[p("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),ve(" Loading schedules… ")],-1)])])):r.value?(_(),w("div",Gw,I(r.value),1)):(_(),w(ke,{key:2},[p("details",Zw,[p("summary",Jw,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),R[3]||(R[3]=p("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"IO Schedules",-1)),p("span",Yw,I(t.value.length),1),R[4]||(R[4]=p("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),t.value.length===0?(_(),w("div",Xw,[p("div",Qw,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:20,class:"text-txt-muted"})]),R[5]||(R[5]=p("p",{class:"text-txt-muted text-sm"},"No IO schedules configured",-1))])):(_(),w("div",ex,[(_(!0),w(ke,null,ze(t.value,v=>(_(),w("div",{key:v.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[p("div",tx,[p("div",sx,[p("div",nx,[p("span",rx,I(v.name),1),p("span",{class:ge(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",v.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[v.enabled?(_(),w("span",ix)):ee("",!0),ve(" "+I(v.enabled?"Active":"Paused"),1)],2)]),p("div",ax,[p("code",ox,I(v.cron_expr),1),v.next_run_at?(_(),w("span",lx,[be(Re,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),ve(" "+I(u(v.next_run_at)),1)])):ee("",!0),v.last_run_at?(_(),w("span",cx,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),ve(" "+I(u(v.last_run_at)),1)])):ee("",!0)]),v.notes?(_(),w("p",ux,I(v.notes),1)):ee("",!0)]),p("div",dx,[v.enabled?(_(),w("button",{key:0,onClick:C=>E("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,hx)):(_(),w("button",{key:1,onClick:C=>x("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,fx)),p("button",{onClick:C=>k("io",v.id),disabled:i.value.has(`io-${v.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,px),p("button",{onClick:C=>g("io",v.id),class:ge(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`io-${v.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,gx),p("button",{onClick:C=>P("io",v.id,v.name),disabled:i.value.has(`io-${v.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,mx)])]),v.prompt?(_(),w("div",bx,[p("p",{class:ge(["text-xs text-txt-muted break-words",c.value.has(`io-${v.id}`)?"":"line-clamp-2"])},I(v.prompt),3),v.prompt.length>120?(_(),w("button",{key:0,onClick:C=>f("io",v.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},I(c.value.has(`io-${v.id}`)?"Show less ▲":"Show more ▼"),9,vx)):ee("",!0)])):ee("",!0),a.value.get(`io-${v.id}`)?(_(),w("div",yx,[p("h4",_x," Run history — "+I(v.name),1),l.value.has(`io-${v.id}`)?(_(),w("div",wx,[...R[6]||(R[6]=[p("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading… ",-1)])])):!o.value.get(`io-${v.id}`)||o.value.get(`io-${v.id}`).length===0?(_(),w("div",xx," No history yet ")):(_(),w("ul",Ex,[(_(!0),w(ke,null,ze(o.value.get(`io-${v.id}`),C=>(_(),w("li",{key:C.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[p("span",{class:ge(["w-2 h-2 rounded-full mt-1 shrink-0",d(C.status)])},null,2),p("div",kx,[p("div",Sx,[p("span",Tx,I(u(C.started_at)),1),p("span",{class:ge(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",h(C.status)])},I(C.status),3)]),C.completed_at?(_(),w("div",Ax," Completed: "+I(u(C.completed_at)),1)):ee("",!0),C.error_text?(_(),w("div",Rx,I(C.error_text),1)):ee("",!0)])]))),128))]))])):ee("",!0)]))),128))]))]),p("details",Cx,[p("summary",Ox,[be(Re,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),R[7]||(R[7]=p("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"Squad Schedules",-1)),p("span",$x,I(s.value.length),1),R[8]||(R[8]=p("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),s.value.length===0?(_(),w("div",Nx,[p("div",Ix,[be(Re,{paths:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',size:20,class:"text-txt-muted"})]),R[9]||(R[9]=p("p",{class:"text-txt-muted text-sm"},"No squad schedules configured",-1))])):(_(),w("div",Px,[(_(!0),w(ke,null,ze(s.value,v=>(_(),w("div",{key:v.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[p("div",Lx,[p("div",Mx,[p("div",jx,[p("span",Dx,I(v.name),1),p("span",Ux,I(v.squad_slug),1),p("span",{class:ge(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",v.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[v.enabled?(_(),w("span",Bx)):ee("",!0),ve(" "+I(v.enabled?"Active":"Paused"),1)],2)]),p("div",Hx,[p("code",Fx,I(v.cron_expr),1),v.next_run_at?(_(),w("span",Vx,[be(Re,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),ve(" "+I(u(v.next_run_at)),1)])):ee("",!0),v.last_run_at?(_(),w("span",qx,[be(Re,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),ve(" "+I(u(v.last_run_at)),1)])):ee("",!0)]),v.notes?(_(),w("p",zx,I(v.notes),1)):ee("",!0)]),p("div",Kx,[v.enabled?(_(),w("button",{key:0,onClick:C=>E("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,Wx)):(_(),w("button",{key:1,onClick:C=>x("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,Gx)),p("button",{onClick:C=>k("squads",v.id),disabled:i.value.has(`squads-${v.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,Zx),p("button",{onClick:C=>g("squads",v.id),class:ge(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`squads-${v.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,Jx),p("button",{onClick:C=>P("squads",v.id,v.name),disabled:i.value.has(`squads-${v.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,Yx)])]),v.prompt?(_(),w("div",Xx,[p("p",{class:ge(["text-xs text-txt-muted break-words",c.value.has(`squads-${v.id}`)?"":"line-clamp-2"])},I(v.prompt),3),v.prompt.length>120?(_(),w("button",{key:0,onClick:C=>f("squads",v.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},I(c.value.has(`squads-${v.id}`)?"Show less ▲":"Show more ▼"),9,Qx)):ee("",!0)])):ee("",!0),a.value.get(`squads-${v.id}`)?(_(),w("div",eE,[p("h4",tE," Run history — "+I(v.name),1),l.value.has(`squads-${v.id}`)?(_(),w("div",sE,[...R[10]||(R[10]=[p("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),ve(" Loading… ",-1)])])):!o.value.get(`squads-${v.id}`)||o.value.get(`squads-${v.id}`).length===0?(_(),w("div",nE," No history yet ")):(_(),w("ul",rE,[(_(!0),w(ke,null,ze(o.value.get(`squads-${v.id}`),C=>(_(),w("li",{key:C.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[p("span",{class:ge(["w-2 h-2 rounded-full mt-1 shrink-0",d(C.status)])},null,2),p("div",iE,[p("div",aE,[p("span",oE,I(u(C.started_at)),1),p("span",{class:ge(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",h(C.status)])},I(C.status),3)]),C.completed_at?(_(),w("div",lE," Completed: "+I(u(C.completed_at)),1)):ee("",!0),C.error_text?(_(),w("div",cE,I(C.error_text),1)):ee("",!0)])]))),128))]))])):ee("",!0)]))),128))]))])],64))])]))}}),dE={class:"relative flex flex-col h-full p-3 sm:p-6"},hE={class:"flex justify-between items-start mb-4"},fE={class:"flex items-center gap-2 flex-wrap justify-end"},pE={class:"flex gap-1.5 mb-4 p-1 bg-surface-2/50 rounded-xl border border-edge"},gE=["onClick"],mE={key:0,class:"ml-1 font-mono text-[10px] opacity-70"},bE={key:0,class:"flex-1 flex items-center justify-center"},vE={key:1,class:"flex-1 flex flex-col items-center justify-center"},yE={class:"w-14 h-14 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"},_E={class:"text-txt-muted/60 text-xs mt-1"},wE=["onClick"],xE=["onClick"],EE={class:"mt-0.5 shrink-0"},kE={key:1,class:"mt-2 w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm shrink-0"},SE={key:2,class:"mt-2 w-1.5 h-1.5 rounded-full bg-edge shrink-0"},TE={class:"flex-1 min-w-0"},AE={class:"flex items-center gap-2 mb-0.5"},RE={class:"text-sm font-semibold text-txt-primary truncate leading-snug"},CE={key:0,class:"text-[10px] font-mono tracking-wider uppercase text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},OE={class:"text-[10px] text-txt-muted mb-1"},$E={key:0,class:"text-xs text-txt-secondary line-clamp-2 leading-relaxed"},NE={key:3,class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},IE=["onClick"],PE=["onClick","disabled"],LE={key:0,class:"px-4 pb-4"},ME=["innerHTML"],jE={key:0,class:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-3 px-4 py-2.5 rounded-2xl bg-surface-3 border border-edge-bright shadow-card backdrop-blur-sm z-20"},DE={class:"text-xs font-semibold text-txt-secondary mr-1 whitespace-nowrap"},UE=["disabled"],BE=["disabled"],HE={key:3,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},FE=pt({__name:"FeedView",setup(e){const t=[{label:"All",value:"all"},{label:"Deliverables",value:"deliverable"},{label:"Notifications",value:"notification"}],s=Q([]),n=Q(!0),r=Q("all"),i=Q(new Set),a=Q(new Set),o=Q(null),l=Q(!1),c=Q(new Set),u=Q(!1),d=je(()=>r.value==="all"?s.value:s.value.filter(V=>V.type===r.value)),h=je(()=>d.value.length>0&&d.value.every(V=>c.value.has(V.id)));function f(V){return s.value.filter(Z=>Z.type===V).length}function g(V){try{const Z=V.includes("T")||V.endsWith("Z")?V:V.replace(" ","T")+"Z";return new Date(Z).toLocaleString()}catch{return V}}function b(V){return V.replace(/[#*`_~[\]()]/g,"").slice(0,200)}function S(V){const Z=new Set(i.value);Z.has(V)?Z.delete(V):Z.add(V),i.value=Z}function E(){l.value=!l.value,l.value||(c.value=new Set)}function x(V){const Z=new Set(c.value);Z.has(V)?Z.delete(V):Z.add(V),c.value=Z}function k(){h.value?c.value=new Set:c.value=new Set(d.value.map(V=>V.id))}async function P(){n.value=!0,o.value=null;try{const V=await Ce("/api/feed?limit=100");if(V.ok){const Z=await V.json();s.value=Z.entries??[]}}catch{}n.value=!1}async function N(V){try{await Ce(`/api/feed/${V}/read`,{method:"POST"});const Z=s.value.find($=>$.id===V);Z&&(Z.read_at=new Date().toISOString())}catch{}}async function R(){const V=r.value!=="all"?`?type=${r.value}`:"";try{await Ce(`/api/feed/read-all${V}`,{method:"POST"});const Z=new Date().toISOString();for(const $ of s.value)!$.read_at&&(r.value==="all"||$.type===r.value)&&($.read_at=Z)}catch{}}async function v(V){if(!window.confirm("Delete this entry?"))return;const Z=new Set(a.value);Z.add(V),a.value=Z;try{const $=await Ce(`/api/feed/${V}`,{method:"DELETE"});if($.ok){s.value=s.value.filter(L=>L.id!==V);const W=new Set(i.value);W.delete(V),i.value=W}else o.value=`Failed to delete entry (HTTP ${$.status})`}catch($){o.value=$ instanceof Error?$.message:"Delete failed"}finally{const $=new Set(a.value);$.delete(V),a.value=$}}async function C(){const V=Array.from(c.value);if(V.length!==0){u.value=!0;try{const Z=await Ce("/api/feed/batch-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:V})});if(Z.ok){const $=new Date().toISOString();for(const W of s.value)V.includes(W.id)&&(W.read_at=W.read_at??$);c.value=new Set}else o.value=`Bulk mark-read failed (HTTP ${Z.status})`}catch(Z){o.value=Z instanceof Error?Z.message:"Bulk mark-read failed"}finally{u.value=!1}}}async function j(){const V=Array.from(c.value);if(V.length!==0&&window.confirm(`Delete ${V.length} item${V.length===1?"":"s"}?`)){u.value=!0;try{const Z=await Ce("/api/feed/batch-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:V})});if(Z.ok){s.value=s.value.filter(W=>!V.includes(W.id));const $=new Set(i.value);V.forEach(W=>$.delete(W)),i.value=$,c.value=new Set}else o.value=`Bulk delete failed (HTTP ${Z.status})`}catch(Z){o.value=Z instanceof Error?Z.message:"Bulk delete failed"}finally{u.value=!1}}}return Ht(P),(V,Z)=>(_(),w("div",dE,[p("div",hE,[Z[0]||(Z[0]=p("div",null,[p("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Feed"),p("p",{class:"text-xs text-txt-muted mt-0.5"},"Messages, results & notifications")],-1)),p("div",fE,[l.value&&d.value.length>0?(_(),w("button",{key:0,onClick:k,class:"text-xs text-txt-secondary hover:text-txt-primary transition-colors font-medium"},I(h.value?"Deselect all":"Select all"),1)):ee("",!0),!l.value&&s.value.length>0?(_(),w("button",{key:1,onClick:R,class:"text-xs text-accent hover:text-accent-glow transition-colors font-medium"}," Mark all read ")):ee("",!0),s.value.length>0?(_(),w("button",{key:2,onClick:E,class:ge(["text-xs px-2.5 py-1 rounded-lg border transition-all duration-150 font-medium",l.value?"text-accent border-accent/30 bg-accent/10 hover:bg-accent/20":"text-txt-muted border-edge hover:text-txt-secondary hover:border-edge-bright hover:bg-surface-3/40"])},I(l.value?"Cancel":"Select"),3)):ee("",!0)])]),p("div",pE,[(_(),w(ke,null,ze(t,$=>p("button",{key:$.value,onClick:W=>r.value=$.value,class:ge(["flex-1 text-xs font-medium py-1.5 px-3 rounded-lg transition-all duration-150",r.value===$.value?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 border border-transparent"])},[ve(I($.label)+" ",1),$.value!=="all"&&f($.value)>0?(_(),w("span",mE,"("+I(f($.value))+")",1)):ee("",!0)],10,gE)),64))]),n.value?(_(),w("div",bE,[...Z[1]||(Z[1]=[p("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[p("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),ve(" Loading… ")],-1)])])):d.value.length===0?(_(),w("div",vE,[p("div",yE,[be(Re,{paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:28,class:"text-txt-muted"})]),Z[2]||(Z[2]=p("p",{class:"text-txt-muted text-sm font-medium"},"Nothing here yet",-1)),p("p",_E,I(r.value==="all"?"Your feed is empty":r.value==="deliverable"?"No deliverables":"No notifications"),1)])):(_(),w("ul",{key:2,class:ge(["space-y-2 overflow-y-auto flex-1 pr-1",l.value&&c.value.size>0?"pb-16":""])},[(_(!0),w(ke,null,ze(d.value,$=>(_(),w("li",{key:$.id,class:ge(["group bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden animate-fade-in",[$.read_at?"":"glow-inner",l.value&&c.value.has($.id)?"ring-1 ring-accent/40 bg-accent/5 border-accent/30":""]])},[p("div",{class:ge(["flex items-start gap-3 p-4",(l.value,"cursor-pointer")]),onClick:W=>l.value?x($.id):S($.id)},[l.value?(_(),w("div",{key:0,class:"mt-0.5 shrink-0",onClick:yt(W=>x($.id),["stop"])},[p("div",{class:ge(["w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all duration-150",c.value.has($.id)?"border-accent bg-accent shadow-glow-sm":"border-edge hover:border-accent/60"])},[c.value.has($.id)?(_(),nn(Re,{key:0,paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:11,class:"text-surface-0"})):ee("",!0)],2)],8,xE)):ee("",!0),p("div",EE,[$.type==="deliverable"?(_(),nn(Re,{key:0,paths:'<path d="M6 3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H6Zm10 7h-3.5a.5.5 0 0 0-.5.5v.01a1.75 1.75 0 0 1-.03.3c-.04.2-.1.46-.23.72-.13.25-.3.49-.57.66-.26.18-.63.31-1.17.31-.54 0-.9-.13-1.17-.3a1.7 1.7 0 0 1-.57-.67A2.57 2.57 0 0 1 8 10.5v-.01a.5.5 0 0 0-.5-.5H4V6c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2v4ZM4 11h3.05c.05.26.14.62.32.97.18.38.47.76.9 1.06.45.29 1.02.47 1.73.47s1.28-.18 1.72-.47c.44-.3.73-.68.91-1.06.18-.35.27-.7.32-.97H16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3Z"/>',size:16,class:ge($.read_at?"text-txt-muted":"text-accent")},null,8,["class"])):(_(),nn(Re,{key:1,paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:16,class:ge($.read_at?"text-txt-muted":"text-accent")},null,8,["class"]))]),$.read_at?(_(),w("span",SE)):(_(),w("span",kE)),p("div",TE,[p("div",AE,[p("span",RE,I($.title),1),$.source_type?(_(),w("span",CE,I($.source_type),1)):ee("",!0)]),p("p",OE,I(g($.created_at)),1),i.value.has($.id)?ee("",!0):(_(),w("p",$E,I(b($.body)),1))]),l.value?ee("",!0):(_(),w("div",NE,[$.read_at?ee("",!0):(_(),w("button",{key:0,onClick:yt(W=>N($.id),["stop"]),class:"p-1.5 rounded-lg text-txt-muted hover:text-accent hover:bg-accent/10 border border-transparent hover:border-accent/20 transition-all duration-150",title:"Mark as read"},[be(Re,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14})],8,IE)),p("button",{onClick:yt(W=>v($.id),["stop"]),disabled:a.value.has($.id),class:"p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-30 transition-all duration-150",title:"Delete"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,PE)]))],10,wE),!l.value&&i.value.has($.id)?(_(),w("div",LE,[p("div",{class:"text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content leading-relaxed",innerHTML:Ie(Ms)($.body)},null,8,ME)])):ee("",!0)],2))),128))],2)),be(ii,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:gs(()=>[l.value&&c.value.size>0?(_(),w("div",jE,[p("span",DE,I(c.value.size)+" selected ",1),p("button",{onClick:C,disabled:u.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 disabled:opacity-40 transition-all duration-150"},[be(Re,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14}),Z[3]||(Z[3]=ve(" Mark read ",-1))],8,UE),p("button",{onClick:j,disabled:u.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},[be(Re,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14}),Z[4]||(Z[4]=ve(" Delete ",-1))],8,BE)])):ee("",!0)]),_:1}),o.value?(_(),w("div",HE,[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),ve(" "+I(o.value),1)])):ee("",!0)]))}}),VE={class:"flex flex-col md:flex-row h-full overflow-hidden bg-surface-0"},qE={class:"p-3.5 shrink-0"},zE={class:"flex items-center justify-between mb-3"},KE={class:"text-[10px] text-txt-muted font-mono bg-surface-2/60 px-1.5 py-0.5 rounded"},WE={key:0,class:"flex-1 flex items-center justify-center"},GE={key:1,class:"flex-1 p-4"},ZE={class:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},JE={key:2,class:"flex-1 overflow-y-auto py-2 px-2"},YE={key:0,class:"px-2 py-3 text-sm text-txt-muted text-center"},XE=["onClick"],QE={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-5 rounded-r-full bg-accent shadow-glow-sm"},ek={key:0,class:"md:hidden flex items-center gap-2 px-3 py-2 border-b border-edge bg-surface-1/60 shrink-0"},tk={class:"text-xs text-txt-primary font-medium truncate"},sk={key:1,class:"flex-1 flex flex-col items-center justify-center select-none"},nk={key:2,class:"flex-1 flex items-center justify-center"},rk={key:3,class:"flex-1 p-6"},ik={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},ak={key:4,class:"flex-1 overflow-y-auto"},ok={class:"max-w-3xl mx-auto px-6 py-6"},lk={class:"text-xl font-bold text-txt-primary mb-4 pb-3 border-b border-edge"},ck=["innerHTML"],uk=pt({__name:"WikiView",setup(e){const t=Q([]),s=Q(null),n=Q(""),r=Q(""),i=Q(!1),a=Q(!1),o=Q(""),l=Q(""),c=je(()=>{const f=r.value.trim().toLowerCase();return f?t.value.filter(g=>g.title.toLowerCase().includes(f)):t.value}),u=je(()=>Ms(n.value));async function d(){i.value=!0,o.value="";try{const f=await Ce("/api/wiki");if(!f.ok)throw new Error(`HTTP ${f.status}`);const g=await f.json();t.value=g.pages??[]}catch(f){o.value=f instanceof Error?f.message:"Failed to load pages"}finally{i.value=!1}}async function h(f){var g;if(((g=s.value)==null?void 0:g.path)!==f.path){s.value=f,n.value="",a.value=!0,l.value="";try{const b=await Ce(`/api/wiki/${encodeURIComponent(f.path)}`);if(!b.ok)throw new Error(`HTTP ${b.status}`);const S=await b.json();n.value=S.content??""}catch(b){l.value=b instanceof Error?b.message:"Failed to load page"}finally{a.value=!1}}}return Ht(d),(f,g)=>(_(),w("div",VE,[p("div",{class:ge(["bg-surface-1/70 backdrop-blur-sm border-edge flex flex-col",s.value?"hidden md:flex md:w-72 md:shrink-0 md:border-r":"flex w-full md:w-72 md:shrink-0 border-b md:border-b-0 md:border-r md:h-full max-h-64 md:max-h-none"])},[p("div",qE,[p("div",zE,[g[2]||(g[2]=p("h2",{class:"text-sm font-semibold text-txt-primary tracking-tight flex items-center gap-1.5"},[p("span",{class:"text-base"},"📚"),ve(" Wiki ")],-1)),p("span",KE,I(c.value.length),1)]),dt(p("input",{"onUpdate:modelValue":g[0]||(g[0]=b=>r.value=b),type:"text",placeholder:"Filter pages…",class:"w-full px-3 py-1.5 text-sm bg-surface-2/50 border border-edge rounded-lg text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[kt,r.value]])]),g[4]||(g[4]=p("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),i.value?(_(),w("div",WE,[...g[3]||(g[3]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):o.value?(_(),w("div",GE,[p("div",ZE,I(o.value),1)])):(_(),w("ul",JE,[c.value.length===0?(_(),w("li",YE," No pages found ")):ee("",!0),(_(!0),w(ke,null,ze(c.value,b=>{var S,E,x;return _(),w("li",{key:b.path,onClick:k=>h(b),class:ge(["relative px-2.5 py-2 rounded-lg cursor-pointer text-sm transition-all duration-150 mb-0.5",((S=s.value)==null?void 0:S.path)===b.path?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"])},[((E=s.value)==null?void 0:E.path)===b.path?(_(),w("span",QE)):ee("",!0),p("span",{class:ge(((x=s.value)==null?void 0:x.path)===b.path?"ml-1":"")},I(b.title),3)],10,XE)}),128))]))],2),p("div",{class:ge(["flex-1 min-w-0 flex flex-col overflow-hidden",s.value?"flex":"hidden md:flex"])},[s.value?(_(),w("div",ek,[p("button",{onClick:g[1]||(g[1]=b=>s.value=null),class:"flex items-center gap-1.5 text-xs text-txt-muted hover:text-accent transition-colors py-1"},[be(Re,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14}),g[5]||(g[5]=ve(" All pages ",-1))]),g[6]||(g[6]=p("span",{class:"text-txt-muted/30"},"·",-1)),p("span",tk,I(s.value.title),1)])):ee("",!0),s.value?a.value?(_(),w("div",nk,[...g[8]||(g[8]=[p("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[p("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),ve(" Loading… ")],-1)])])):l.value?(_(),w("div",rk,[p("div",ik,[g[9]||(g[9]=p("span",null,"⚠",-1)),ve(" "+I(l.value),1)])])):(_(),w("div",ak,[p("div",ok,[p("h1",lk,I(s.value.title),1),p("div",{class:"wiki-content text-txt-secondary text-sm leading-relaxed",innerHTML:u.value},null,8,ck)])])):(_(),w("div",sk,[...g[7]||(g[7]=[p("div",{class:"w-12 h-12 rounded-xl bg-surface-2/60 border border-edge flex items-center justify-center mb-4"},[p("span",{class:"text-2xl"},"📖")],-1),p("p",{class:"text-txt-muted text-sm"},"Select a page to start reading",-1)])]))],2)]))}}),dk=rr(uk,[["__scopeId","data-v-5b6273c1"]]),hk={class:"relative flex items-center justify-center h-screen bg-surface-0 overflow-hidden"},fk={class:"relative w-full max-w-sm mx-4 animate-fade-in"},pk={class:"glass rounded-2xl border border-edge p-8 shadow-glow"},gk={key:0,class:"flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},mk=["disabled"],bk=pt({__name:"LoginView",setup(e){const t=nr(),s=xu(),n=Q(""),r=Q(""),i=Q(null);async function a(){i.value=null;const o=await t.signIn(n.value,r.value);o?i.value=o:s.push("/chat")}return(o,l)=>(_(),w("div",hk,[l[5]||(l[5]=p("div",{class:"pointer-events-none absolute inset-0"},[p("div",{class:"absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-accent/[0.04] rounded-full blur-[120px]"}),p("div",{class:"absolute bottom-1/4 right-1/4 w-[400px] h-[400px] bg-accent-dim/[0.06] rounded-full blur-[100px]"})],-1)),p("div",fk,[p("div",pk,[l[4]||(l[4]=er('<div class="flex flex-col items-center mb-8"><div class="w-14 h-14 rounded-xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-4 shadow-glow-sm"><span class="text-accent font-mono font-bold text-2xl tracking-tighter">IO</span></div><h1 class="text-xl font-semibold text-txt-primary tracking-tight">Welcome back</h1><p class="text-sm text-txt-muted mt-1">Sign in to continue</p></div>',1)),p("form",{onSubmit:yt(a,["prevent"]),class:"space-y-5"},[p("div",null,[l[2]||(l[2]=p("label",{for:"email",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Email",-1)),dt(p("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>n.value=c),type:"email",required:"",autocomplete:"email",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"you@example.com"},null,512),[[kt,n.value]])]),p("div",null,[l[3]||(l[3]=p("label",{for:"password",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Password",-1)),dt(p("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>r.value=c),type:"password",required:"",autocomplete:"current-password",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"••••••••"},null,512),[[kt,r.value]])]),i.value?(_(),w("div",gk,[be(Re,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),ve(" "+I(i.value),1)])):ee("",!0),p("button",{type:"submit",disabled:Ie(t).loading,class:"w-full py-2.5 px-4 bg-accent hover:bg-accent-glow disabled:opacity-50 disabled:cursor-not-allowed text-surface-0 font-semibold text-sm rounded-xl transition-all duration-200 shadow-glow-sm hover:shadow-glow"},I(Ie(t).loading?"Signing in…":"Sign in"),9,mk)],32)])])]))}}),xd=gg({history:Zp("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:bk,meta:{public:!0}},{path:"/chat",name:"chat",component:ky},{path:"/skills",name:"skills",component:x_},{path:"/squads",name:"squads",component:E1},{path:"/activity",name:"activity",component:Fw},{path:"/wiki",name:"wiki",component:dk},{path:"/schedules",name:"schedules",component:uE},{path:"/feed",name:"feed",component:FE},{path:"/notifications",redirect:"/feed"},{path:"/inbox",redirect:"/feed"}]});xd.beforeEach(async e=>{const t=nr();return t.initialized||await t.init(),!t.authEnabled||e.meta.public||t.user?!0:{name:"login"}});const Va=np(iy);Va.use(ap());Va.use(xd);Va.mount("#app");