heyio 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/api/logout.test.js +129 -0
  2. package/dist/api/server.js +118 -2
  3. package/dist/api/wiki.test.js +283 -0
  4. package/dist/copilot/skills.js +72 -0
  5. package/dist/copilot/skills.test.js +55 -0
  6. package/dist/store/db.js +28 -0
  7. package/dist/store/squads.js +33 -1
  8. package/dist/store/squads.test.js +52 -0
  9. package/package.json +1 -1
  10. package/web-dist/assets/{AgentActivityView-D-xGvKsm.js → AgentActivityView-CedxxE6K.js} +1 -1
  11. package/web-dist/assets/{ChatView-DV4zdwDI.js → ChatView-DMkYQo_V.js} +1 -1
  12. package/web-dist/assets/FeedView-BH4q-31V.js +1 -0
  13. package/web-dist/assets/InboxView-BVwVP4EW.js +1 -0
  14. package/web-dist/assets/{LoginView-DNcKxnq-.js → LoginView-DRPDhnwu.js} +1 -1
  15. package/web-dist/assets/{McpView-CbiIag57.js → McpView-D8yWz-lq.js} +1 -1
  16. package/web-dist/assets/{SchedulesView-uxtLtxEL.js → SchedulesView-BzzyncGF.js} +1 -1
  17. package/web-dist/assets/{SettingsTabs.vue_vue_type_script_setup_true_lang-BE0YBCo4.js → SettingsTabs.vue_vue_type_script_setup_true_lang-oW3ySu7Y.js} +1 -1
  18. package/web-dist/assets/SkillsView-oxpYuhx7.js +1 -0
  19. package/web-dist/assets/SquadsView-CaKUIKlq.js +1 -0
  20. package/web-dist/assets/StatusIndicator.vue_vue_type_script_setup_true_lang-8U15Qp_Q.js +1 -0
  21. package/web-dist/assets/WikiView-C5jXUlfW.js +1 -0
  22. package/web-dist/assets/index-BrWzNw-N.css +10 -0
  23. package/web-dist/assets/{index-D1C7prBJ.js → index-f67odrrt.js} +32 -32
  24. package/web-dist/index.html +2 -2
  25. package/web-dist/assets/FeedView-BBbnBU_A.js +0 -1
  26. package/web-dist/assets/InboxView-C_6LL8bG.js +0 -1
  27. package/web-dist/assets/SkillsView-CobJkgd1.js +0 -1
  28. package/web-dist/assets/SquadsView-DpI4RInq.js +0 -1
  29. package/web-dist/assets/StatusIndicator.vue_vue_type_script_setup_true_lang-BwmRY2qH.js +0 -1
  30. package/web-dist/assets/WikiView-DeY1mFGq.js +0 -1
  31. package/web-dist/assets/index-DMGoXFX1.css +0 -10
@@ -1,46 +1,46 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-DpI4RInq.js","assets/StatusIndicator.vue_vue_type_script_setup_true_lang-BwmRY2qH.js","assets/AgentActivityView-D-xGvKsm.js","assets/SkillsView-CobJkgd1.js","assets/SettingsTabs.vue_vue_type_script_setup_true_lang-BE0YBCo4.js","assets/McpView-CbiIag57.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-CaKUIKlq.js","assets/StatusIndicator.vue_vue_type_script_setup_true_lang-8U15Qp_Q.js","assets/AgentActivityView-CedxxE6K.js","assets/SkillsView-oxpYuhx7.js","assets/SettingsTabs.vue_vue_type_script_setup_true_lang-oW3ySu7Y.js","assets/McpView-D8yWz-lq.js"])))=>i.map(i=>d[i]);
2
2
  (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
3
3
  * @vue/shared v3.5.34
4
4
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
5
  * @license MIT
6
- **/function po(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ee={},Gn=[],$t=()=>{},jl=()=>!1,Bs=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Hs=e=>e.startsWith("onUpdate:"),Ue=Object.assign,go=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},yh=Object.prototype.hasOwnProperty,ve=(e,t)=>yh.call(e,t),ne=Array.isArray,zn=e=>Gr(e)==="[object Map]",Fs=e=>Gr(e)==="[object Set]",qo=e=>Gr(e)==="[object Date]",le=e=>typeof e=="function",Te=e=>typeof e=="string",ct=e=>typeof e=="symbol",we=e=>e!==null&&typeof e=="object",Dl=e=>(we(e)||le(e))&&le(e.then)&&le(e.catch),Ul=Object.prototype.toString,Gr=e=>Ul.call(e),_h=e=>Gr(e).slice(8,-1),Bl=e=>Gr(e)==="[object Object]",qs=e=>Te(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,br=po(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ks=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},vh=/-\w/g,nt=Ks(e=>e.replace(vh,t=>t.slice(1).toUpperCase())),wh=/\B([A-Z])/g,hn=Ks(e=>e.replace(wh,"-$1").toLowerCase()),Ws=Ks(e=>e.charAt(0).toUpperCase()+e.slice(1)),di=Ks(e=>e?`on${Ws(e)}`:""),Lt=(e,t)=>!Object.is(e,t),ms=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Hl=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Vs=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Eh=e=>{const t=Te(e)?Number(e):NaN;return isNaN(t)?e:t};let Ko;const Gs=()=>Ko||(Ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zs(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Te(r)?Th(r):zs(r);if(s)for(const i in s)t[i]=s[i]}return t}else if(Te(e)||we(e))return e}const Sh=/;(?![^(]*\))/g,kh=/:([^]+)/,Ah=/\/\*[^]*?\*\//g;function Th(e){const t={};return e.replace(Ah,"").split(Sh).forEach(n=>{if(n){const r=n.split(kh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ft(e){let t="";if(Te(e))t=e;else if(ne(e))for(let n=0;n<e.length;n++){const r=ft(e[n]);r&&(t+=r+" ")}else if(we(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Rh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",xh=po(Rh);function Fl(e){return!!e||e===""}function Oh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=zr(e[r],t[r]);return n}function zr(e,t){if(e===t)return!0;let n=qo(e),r=qo(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ct(e),r=ct(t),n||r)return e===t;if(n=ne(e),r=ne(t),n||r)return n&&r?Oh(e,t):!1;if(n=we(e),r=we(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,i=Object.keys(t).length;if(s!==i)return!1;for(const o in e){const a=e.hasOwnProperty(o),l=t.hasOwnProperty(o);if(a&&!l||!a&&l||!zr(e[o],t[o]))return!1}}return String(e)===String(t)}function Ch(e,t){return e.findIndex(n=>zr(n,t))}const ql=e=>!!(e&&e.__v_isRef===!0),Oe=e=>Te(e)?e:e==null?"":ne(e)||we(e)&&(e.toString===Ul||!le(e.toString))?ql(e)?Oe(e.value):JSON.stringify(e,Kl,2):String(e),Kl=(e,t)=>ql(t)?Kl(e,t.value):zn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],i)=>(n[fi(r,i)+" =>"]=s,n),{})}:Fs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>fi(n))}:ct(t)?fi(t):we(t)&&!ne(t)&&!Bl(t)?String(t):t,fi=(e,t="")=>{var n;return ct(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
6
+ **/function po(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Se={},zn=[],$t=()=>{},Ml=()=>!1,Bs=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Hs=e=>e.startsWith("onUpdate:"),Be=Object.assign,go=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},bh=Object.prototype.hasOwnProperty,we=(e,t)=>bh.call(e,t),ne=Array.isArray,Jn=e=>zr(e)==="[object Map]",Fs=e=>zr(e)==="[object Set]",qo=e=>zr(e)==="[object Date]",ce=e=>typeof e=="function",xe=e=>typeof e=="string",ut=e=>typeof e=="symbol",Ee=e=>e!==null&&typeof e=="object",jl=e=>(Ee(e)||ce(e))&&ce(e.then)&&ce(e.catch),Dl=Object.prototype.toString,zr=e=>Dl.call(e),yh=e=>zr(e).slice(8,-1),Ul=e=>zr(e)==="[object Object]",qs=e=>xe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,br=po(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ks=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},_h=/-\w/g,rt=Ks(e=>e.replace(_h,t=>t.slice(1).toUpperCase())),vh=/\B([A-Z])/g,dn=Ks(e=>e.replace(vh,"-$1").toLowerCase()),Ws=Ks(e=>e.charAt(0).toUpperCase()+e.slice(1)),di=Ks(e=>e?`on${Ws(e)}`:""),Lt=(e,t)=>!Object.is(e,t),bs=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Bl=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Vs=e=>{const t=parseFloat(e);return isNaN(t)?e:t},wh=e=>{const t=xe(e)?Number(e):NaN;return isNaN(t)?e:t};let Ko;const Gs=()=>Ko||(Ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zs(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=xe(r)?Ah(r):zs(r);if(s)for(const i in s)t[i]=s[i]}return t}else if(xe(e)||Ee(e))return e}const Eh=/;(?![^(]*\))/g,Sh=/:([^]+)/,kh=/\/\*[^]*?\*\//g;function Ah(e){const t={};return e.replace(kh,"").split(Eh).forEach(n=>{if(n){const r=n.split(Sh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function _t(e){let t="";if(xe(e))t=e;else if(ne(e))for(let n=0;n<e.length;n++){const r=_t(e[n]);r&&(t+=r+" ")}else if(Ee(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Th="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",xh=po(Th);function Hl(e){return!!e||e===""}function Rh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Jr(e[r],t[r]);return n}function Jr(e,t){if(e===t)return!0;let n=qo(e),r=qo(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ut(e),r=ut(t),n||r)return e===t;if(n=ne(e),r=ne(t),n||r)return n&&r?Rh(e,t):!1;if(n=Ee(e),r=Ee(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,i=Object.keys(t).length;if(s!==i)return!1;for(const o in e){const a=e.hasOwnProperty(o),l=t.hasOwnProperty(o);if(a&&!l||!a&&l||!Jr(e[o],t[o]))return!1}}return String(e)===String(t)}function Oh(e,t){return e.findIndex(n=>Jr(n,t))}const Fl=e=>!!(e&&e.__v_isRef===!0),Te=e=>xe(e)?e:e==null?"":ne(e)||Ee(e)&&(e.toString===Dl||!ce(e.toString))?Fl(e)?Te(e.value):JSON.stringify(e,ql,2):String(e),ql=(e,t)=>Fl(t)?ql(e,t.value):Jn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],i)=>(n[fi(r,i)+" =>"]=s,n),{})}:Fs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>fi(n))}:ut(t)?fi(t):Ee(t)&&!ne(t)&&!Ul(t)?String(t):t,fi=(e,t="")=>{var n;return ut(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
7
  * @vue/reactivity v3.5.34
8
8
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
9
  * @license MIT
10
- **/let je;class Wl{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&&je&&(je.active?(this.parent=je,this.index=(je.scopes||(je.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=je;try{return je=this,t()}finally{je=n}}}on(){++this._on===1&&(this.prevScope=je,je=this)}off(){if(this._on>0&&--this._on===0){if(je===this)je=this.prevScope;else{let t=je;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Vl(e){return new Wl(e)}function Gl(){return je}function Nh(e,t=!1){je&&je.cleanups.push(e)}let ke;const pi=new WeakSet;class zl{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,je&&(je.active?je.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pi.has(this)&&(pi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Yl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Wo(this),Zl(this);const t=ke,n=vt;ke=this,vt=!0;try{return this.fn()}finally{Xl(this),ke=t,vt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)yo(t);this.deps=this.depsTail=void 0,Wo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Li(this)&&this.run()}get dirty(){return Li(this)}}let Jl=0,yr,_r;function Yl(e,t=!1){if(e.flags|=8,t){e.next=_r,_r=e;return}e.next=yr,yr=e}function mo(){Jl++}function bo(){if(--Jl>0)return;if(_r){let t=_r;for(_r=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;yr;){let t=yr;for(yr=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Zl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Xl(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),yo(r),Ih(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Li(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ql(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ql(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Or)||(e.globalVersion=Or,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Li(e))))return;e.flags|=2;const t=e.dep,n=ke,r=vt;ke=e,vt=!0;try{Zl(e);const s=e.fn(e._value);(t.version===0||Lt(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{ke=n,vt=r,Xl(e),e.flags&=-3}}function yo(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)yo(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ih(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let vt=!0;const ec=[];function zt(){ec.push(vt),vt=!1}function Jt(){const e=ec.pop();vt=e===void 0?!0:e}function Wo(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ke;ke=void 0;try{t()}finally{ke=n}}}let Or=0;class Ph{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class _o{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(!ke||!vt||ke===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ke)n=this.activeLink=new Ph(ke,this),ke.deps?(n.prevDep=ke.depsTail,ke.depsTail.nextDep=n,ke.depsTail=n):ke.deps=ke.depsTail=n,tc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=ke.depsTail,n.nextDep=void 0,ke.depsTail.nextDep=n,ke.depsTail=n,ke.deps===n&&(ke.deps=r)}return n}trigger(t){this.version++,Or++,this.notify(t)}notify(t){mo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bo()}}}function tc(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)tc(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Es=new WeakMap,Rn=Symbol(""),$i=Symbol(""),Cr=Symbol("");function Ge(e,t,n){if(vt&&ke){let r=Es.get(e);r||Es.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new _o),s.map=r,s.key=n),s.track()}}function Kt(e,t,n,r,s,i){const o=Es.get(e);if(!o){Or++;return}const a=l=>{l&&l.trigger()};if(mo(),t==="clear")o.forEach(a);else{const l=ne(e),c=l&&qs(n);if(l&&n==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===Cr||!ct(d)&&d>=u)&&a(h)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(Cr)),t){case"add":l?c&&a(o.get("length")):(a(o.get(Rn)),zn(e)&&a(o.get($i)));break;case"delete":l||(a(o.get(Rn)),zn(e)&&a(o.get($i)));break;case"set":zn(e)&&a(o.get(Rn));break}}bo()}function Lh(e,t){const n=Es.get(e);return n&&n.get(t)}function In(e){const t=pe(e);return t===e?t:(Ge(t,"iterate",Cr),lt(e)?t:t.map(wt))}function Js(e){return Ge(e=pe(e),"iterate",Cr),e}function Nt(e,t){return Yt(e)?Qn(Vt(e)?wt(t):t):wt(t)}const $h={__proto__:null,[Symbol.iterator](){return gi(this,Symbol.iterator,e=>Nt(this,e))},concat(...e){return In(this).concat(...e.map(t=>ne(t)?In(t):t))},entries(){return gi(this,"entries",e=>(e[1]=Nt(this,e[1]),e))},every(e,t){return Mt(this,"every",e,t,void 0,arguments)},filter(e,t){return Mt(this,"filter",e,t,n=>n.map(r=>Nt(this,r)),arguments)},find(e,t){return Mt(this,"find",e,t,n=>Nt(this,n),arguments)},findIndex(e,t){return Mt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Mt(this,"findLast",e,t,n=>Nt(this,n),arguments)},findLastIndex(e,t){return Mt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Mt(this,"forEach",e,t,void 0,arguments)},includes(...e){return mi(this,"includes",e)},indexOf(...e){return mi(this,"indexOf",e)},join(e){return In(this).join(e)},lastIndexOf(...e){return mi(this,"lastIndexOf",e)},map(e,t){return Mt(this,"map",e,t,void 0,arguments)},pop(){return or(this,"pop")},push(...e){return or(this,"push",e)},reduce(e,...t){return Vo(this,"reduce",e,t)},reduceRight(e,...t){return Vo(this,"reduceRight",e,t)},shift(){return or(this,"shift")},some(e,t){return Mt(this,"some",e,t,void 0,arguments)},splice(...e){return or(this,"splice",e)},toReversed(){return In(this).toReversed()},toSorted(e){return In(this).toSorted(e)},toSpliced(...e){return In(this).toSpliced(...e)},unshift(...e){return or(this,"unshift",e)},values(){return gi(this,"values",e=>Nt(this,e))}};function gi(e,t,n){const r=Js(e),s=r[t]();return r!==e&&!lt(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const Mh=Array.prototype;function Mt(e,t,n,r,s,i){const o=Js(e),a=o!==e&&!lt(e),l=o[t];if(l!==Mh[t]){const h=l.apply(e,i);return a?wt(h):h}let c=n;o!==e&&(a?c=function(h,d){return n.call(this,Nt(e,h),d,e)}:n.length>2&&(c=function(h,d){return n.call(this,h,d,e)}));const u=l.call(o,c,r);return a&&s?s(u):u}function Vo(e,t,n,r){const s=Js(e),i=s!==e&&!lt(e);let o=n,a=!1;s!==e&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=Nt(e,c)),n.call(this,c,Nt(e,u),h,e)}):n.length>3&&(o=function(c,u,h){return n.call(this,c,u,h,e)}));const l=s[t](o,...r);return a?Nt(e,l):l}function mi(e,t,n){const r=pe(e);Ge(r,"iterate",Cr);const s=r[t](...n);return(s===-1||s===!1)&&Ys(n[0])?(n[0]=pe(n[0]),r[t](...n)):s}function or(e,t,n=[]){zt(),mo();const r=pe(e)[t].apply(e,n);return bo(),Jt(),r}const jh=po("__proto__,__v_isRef,__isVue"),nc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ct));function Dh(e){ct(e)||(e=String(e));const t=pe(this);return Ge(t,"has",e),t.hasOwnProperty(e)}class rc{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?zh:ac:i?oc:ic).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=ne(t);if(!s){let l;if(o&&(l=$h[n]))return l;if(n==="hasOwnProperty")return Dh}const a=Reflect.get(t,n,Ce(t)?t:r);if((ct(n)?nc.has(n):jh(n))||(s||Ge(t,"get",n),i))return a;if(Ce(a)){const l=o&&qs(n)?a:a.value;return s&&we(l)?ji(l):l}return we(a)?s?ji(a):Jr(a):a}}class sc extends rc{constructor(t=!1){super(!1,t)}set(t,n,r,s){let i=t[n];const o=ne(t)&&qs(n);if(!this._isShallow){const c=Yt(i);if(!lt(r)&&!Yt(r)&&(i=pe(i),r=pe(r)),!o&&Ce(i)&&!Ce(r))return c||(i.value=r),!0}const a=o?Number(n)<t.length:ve(t,n),l=Reflect.set(t,n,r,Ce(t)?t:s);return t===pe(s)&&(a?Lt(r,i)&&Kt(t,"set",n,r):Kt(t,"add",n,r)),l}deleteProperty(t,n){const r=ve(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Kt(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ct(n)||!nc.has(n))&&Ge(t,"has",n),r}ownKeys(t){return Ge(t,"iterate",ne(t)?"length":Rn),Reflect.ownKeys(t)}}class Uh extends rc{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Bh=new sc,Hh=new Uh,Fh=new sc(!0);const Mi=e=>e,ts=e=>Reflect.getPrototypeOf(e);function qh(e,t,n){return function(...r){const s=this.__v_raw,i=pe(s),o=zn(i),a=e==="entries"||e===Symbol.iterator&&o,l=e==="keys"&&o,c=s[e](...r),u=n?Mi:t?Qn:wt;return!t&&Ge(i,"iterate",l?$i:Rn),Ue(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function ns(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Kh(e,t){const n={get(s){const i=this.__v_raw,o=pe(i),a=pe(s);e||(Lt(s,a)&&Ge(o,"get",s),Ge(o,"get",a));const{has:l}=ts(o),c=t?Mi:e?Qn:wt;if(l.call(o,s))return c(i.get(s));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!e&&Ge(pe(s),"iterate",Rn),s.size},has(s){const i=this.__v_raw,o=pe(i),a=pe(s);return e||(Lt(s,a)&&Ge(o,"has",s),Ge(o,"has",a)),s===a?i.has(s):i.has(s)||i.has(a)},forEach(s,i){const o=this,a=o.__v_raw,l=pe(a),c=t?Mi:e?Qn:wt;return!e&&Ge(l,"iterate",Rn),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Ue(n,e?{add:ns("add"),set:ns("set"),delete:ns("delete"),clear:ns("clear")}:{add(s){const i=pe(this),o=ts(i),a=pe(s),l=!t&&!lt(s)&&!Yt(s)?a:s;return o.has.call(i,l)||Lt(s,l)&&o.has.call(i,s)||Lt(a,l)&&o.has.call(i,a)||(i.add(l),Kt(i,"add",l,l)),this},set(s,i){!t&&!lt(i)&&!Yt(i)&&(i=pe(i));const o=pe(this),{has:a,get:l}=ts(o);let c=a.call(o,s);c||(s=pe(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Lt(i,u)&&Kt(o,"set",s,i):Kt(o,"add",s,i),this},delete(s){const i=pe(this),{has:o,get:a}=ts(i);let l=o.call(i,s);l||(s=pe(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Kt(i,"delete",s,void 0),c},clear(){const s=pe(this),i=s.size!==0,o=s.clear();return i&&Kt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=qh(s,e,t)}),n}function vo(e,t){const n=Kh(e,t);return(r,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ve(n,s)&&s in r?n:r,s,i)}const Wh={get:vo(!1,!1)},Vh={get:vo(!1,!0)},Gh={get:vo(!0,!1)};const ic=new WeakMap,oc=new WeakMap,ac=new WeakMap,zh=new WeakMap;function Jh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Yh(e){return e.__v_skip||!Object.isExtensible(e)?0:Jh(_h(e))}function Jr(e){return Yt(e)?e:wo(e,!1,Bh,Wh,ic)}function lc(e){return wo(e,!1,Fh,Vh,oc)}function ji(e){return wo(e,!0,Hh,Gh,ac)}function wo(e,t,n,r,s){if(!we(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Yh(e);if(i===0)return e;const o=s.get(e);if(o)return o;const a=new Proxy(e,i===2?r:n);return s.set(e,a),a}function Vt(e){return Yt(e)?Vt(e.__v_raw):!!(e&&e.__v_isReactive)}function Yt(e){return!!(e&&e.__v_isReadonly)}function lt(e){return!!(e&&e.__v_isShallow)}function Ys(e){return e?!!e.__v_raw:!1}function pe(e){const t=e&&e.__v_raw;return t?pe(t):e}function Eo(e){return!ve(e,"__v_skip")&&Object.isExtensible(e)&&Hl(e,"__v_skip",!0),e}const wt=e=>we(e)?Jr(e):e,Qn=e=>we(e)?ji(e):e;function Ce(e){return e?e.__v_isRef===!0:!1}function Ae(e){return cc(e,!1)}function Zh(e){return cc(e,!0)}function cc(e,t){return Ce(e)?e:new Xh(e,t)}class Xh{constructor(t,n){this.dep=new _o,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:pe(t),this._value=n?t:wt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||lt(t)||Yt(t);t=r?t:pe(t),Lt(t,n)&&(this._rawValue=t,this._value=r?t:wt(t),this.dep.trigger())}}function De(e){return Ce(e)?e.value:e}const Qh={get:(e,t,n)=>t==="__v_raw"?e:De(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Ce(s)&&!Ce(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function uc(e){return Vt(e)?e:new Proxy(e,Qh)}function ed(e){const t=ne(e)?new Array(e.length):{};for(const n in e)t[n]=nd(e,n);return t}class td{constructor(t,n,r){this._object=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=ct(n)?n:String(n),this._raw=pe(t);let s=!0,i=t;if(!ne(t)||ct(this._key)||!qs(this._key))do s=!Ys(i)||lt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=De(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Ce(this._raw[this._key])){const n=this._object[this._key];if(Ce(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return Lh(this._raw,this._key)}}function nd(e,t,n){return new td(e,t,n)}class rd{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new _o(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Or-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ke!==this)return Yl(this,!0),!0}get value(){const t=this.dep.track();return Ql(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function sd(e,t,n=!1){let r,s;return le(e)?r=e:(r=e.get,s=e.set),new rd(r,s,n)}const rs={},Ss=new WeakMap;let vn;function id(e,t=!1,n=vn){if(n){let r=Ss.get(n);r||Ss.set(n,r=[]),r.push(e)}}function od(e,t,n=Ee){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=n,c=T=>s?T:lt(T)||s===!1||s===0?Wt(T,1):Wt(T);let u,h,d,f,p=!1,m=!1;if(Ce(e)?(h=()=>e.value,p=lt(e)):Vt(e)?(h=()=>c(e),p=!0):ne(e)?(m=!0,p=e.some(T=>Vt(T)||lt(T)),h=()=>e.map(T=>{if(Ce(T))return T.value;if(Vt(T))return c(T);if(le(T))return l?l(T,2):T()})):le(e)?t?h=l?()=>l(e,2):e:h=()=>{if(d){zt();try{d()}finally{Jt()}}const T=vn;vn=u;try{return l?l(e,3,[f]):e(f)}finally{vn=T}}:h=$t,t&&s){const T=h,D=s===!0?1/0:s;h=()=>Wt(T(),D)}const w=Gl(),E=()=>{u.stop(),w&&w.active&&go(w.effects,u)};if(i&&t){const T=t;t=(...D)=>{T(...D),E()}}let y=m?new Array(e.length).fill(rs):rs;const v=T=>{if(!(!(u.flags&1)||!u.dirty&&!T))if(t){const D=u.run();if(s||p||(m?D.some((B,j)=>Lt(B,y[j])):Lt(D,y))){d&&d();const B=vn;vn=u;try{const j=[D,y===rs?void 0:m&&y[0]===rs?[]:y,f];y=D,l?l(t,3,j):t(...j)}finally{vn=B}}}else u.run()};return a&&a(v),u=new zl(h),u.scheduler=o?()=>o(v,!1):v,f=T=>id(T,!1,u),d=u.onStop=()=>{const T=Ss.get(u);if(T){if(l)l(T,4);else for(const D of T)D();Ss.delete(u)}},t?r?v(!0):y=u.run():o?o(v.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Wt(e,t=1/0,n){if(t<=0||!we(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ce(e))Wt(e.value,t,n);else if(ne(e))for(let r=0;r<e.length;r++)Wt(e[r],t,n);else if(Fs(e)||zn(e))e.forEach(r=>{Wt(r,t,n)});else if(Bl(e)){for(const r in e)Wt(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Wt(e[r],t,n)}return e}/**
10
+ **/let je;class Kl{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&&je&&(je.active?(this.parent=je,this.index=(je.scopes||(je.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=je;try{return je=this,t()}finally{je=n}}}on(){++this._on===1&&(this.prevScope=je,je=this)}off(){if(this._on>0&&--this._on===0){if(je===this)je=this.prevScope;else{let t=je;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Wl(e){return new Kl(e)}function Vl(){return je}function Ch(e,t=!1){je&&je.cleanups.push(e)}let Ae;const pi=new WeakSet;class Gl{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,je&&(je.active?je.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pi.has(this)&&(pi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Wo(this),Yl(this);const t=Ae,n=vt;Ae=this,vt=!0;try{return this.fn()}finally{Zl(this),Ae=t,vt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)yo(t);this.deps=this.depsTail=void 0,Wo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Li(this)&&this.run()}get dirty(){return Li(this)}}let zl=0,yr,_r;function Jl(e,t=!1){if(e.flags|=8,t){e.next=_r,_r=e;return}e.next=yr,yr=e}function mo(){zl++}function bo(){if(--zl>0)return;if(_r){let t=_r;for(_r=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;yr;){let t=yr;for(yr=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Yl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Zl(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),yo(r),Nh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Li(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Cr)||(e.globalVersion=Cr,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Li(e))))return;e.flags|=2;const t=e.dep,n=Ae,r=vt;Ae=e,vt=!0;try{Yl(e);const s=e.fn(e._value);(t.version===0||Lt(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ae=n,vt=r,Zl(e),e.flags&=-3}}function yo(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)yo(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Nh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let vt=!0;const Ql=[];function Jt(){Ql.push(vt),vt=!1}function Yt(){const e=Ql.pop();vt=e===void 0?!0:e}function Wo(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ae;Ae=void 0;try{t()}finally{Ae=n}}}let Cr=0;class Ih{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class _o{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(!Ae||!vt||Ae===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ae)n=this.activeLink=new Ih(Ae,this),Ae.deps?(n.prevDep=Ae.depsTail,Ae.depsTail.nextDep=n,Ae.depsTail=n):Ae.deps=Ae.depsTail=n,ec(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Ae.depsTail,n.nextDep=void 0,Ae.depsTail.nextDep=n,Ae.depsTail=n,Ae.deps===n&&(Ae.deps=r)}return n}trigger(t){this.version++,Cr++,this.notify(t)}notify(t){mo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bo()}}}function ec(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)ec(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Es=new WeakMap,Rn=Symbol(""),$i=Symbol(""),Nr=Symbol("");function Je(e,t,n){if(vt&&Ae){let r=Es.get(e);r||Es.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new _o),s.map=r,s.key=n),s.track()}}function Wt(e,t,n,r,s,i){const o=Es.get(e);if(!o){Cr++;return}const a=l=>{l&&l.trigger()};if(mo(),t==="clear")o.forEach(a);else{const l=ne(e),c=l&&qs(n);if(l&&n==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===Nr||!ut(d)&&d>=u)&&a(h)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(Nr)),t){case"add":l?c&&a(o.get("length")):(a(o.get(Rn)),Jn(e)&&a(o.get($i)));break;case"delete":l||(a(o.get(Rn)),Jn(e)&&a(o.get($i)));break;case"set":Jn(e)&&a(o.get(Rn));break}}bo()}function Ph(e,t){const n=Es.get(e);return n&&n.get(t)}function In(e){const t=ge(e);return t===e?t:(Je(t,"iterate",Nr),lt(e)?t:t.map(wt))}function Js(e){return Je(e=ge(e),"iterate",Nr),e}function Nt(e,t){return Zt(e)?er(Gt(e)?wt(t):t):wt(t)}const Lh={__proto__:null,[Symbol.iterator](){return gi(this,Symbol.iterator,e=>Nt(this,e))},concat(...e){return In(this).concat(...e.map(t=>ne(t)?In(t):t))},entries(){return gi(this,"entries",e=>(e[1]=Nt(this,e[1]),e))},every(e,t){return jt(this,"every",e,t,void 0,arguments)},filter(e,t){return jt(this,"filter",e,t,n=>n.map(r=>Nt(this,r)),arguments)},find(e,t){return jt(this,"find",e,t,n=>Nt(this,n),arguments)},findIndex(e,t){return jt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return jt(this,"findLast",e,t,n=>Nt(this,n),arguments)},findLastIndex(e,t){return jt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return jt(this,"forEach",e,t,void 0,arguments)},includes(...e){return mi(this,"includes",e)},indexOf(...e){return mi(this,"indexOf",e)},join(e){return In(this).join(e)},lastIndexOf(...e){return mi(this,"lastIndexOf",e)},map(e,t){return jt(this,"map",e,t,void 0,arguments)},pop(){return ar(this,"pop")},push(...e){return ar(this,"push",e)},reduce(e,...t){return Vo(this,"reduce",e,t)},reduceRight(e,...t){return Vo(this,"reduceRight",e,t)},shift(){return ar(this,"shift")},some(e,t){return jt(this,"some",e,t,void 0,arguments)},splice(...e){return ar(this,"splice",e)},toReversed(){return In(this).toReversed()},toSorted(e){return In(this).toSorted(e)},toSpliced(...e){return In(this).toSpliced(...e)},unshift(...e){return ar(this,"unshift",e)},values(){return gi(this,"values",e=>Nt(this,e))}};function gi(e,t,n){const r=Js(e),s=r[t]();return r!==e&&!lt(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const $h=Array.prototype;function jt(e,t,n,r,s,i){const o=Js(e),a=o!==e&&!lt(e),l=o[t];if(l!==$h[t]){const h=l.apply(e,i);return a?wt(h):h}let c=n;o!==e&&(a?c=function(h,d){return n.call(this,Nt(e,h),d,e)}:n.length>2&&(c=function(h,d){return n.call(this,h,d,e)}));const u=l.call(o,c,r);return a&&s?s(u):u}function Vo(e,t,n,r){const s=Js(e),i=s!==e&&!lt(e);let o=n,a=!1;s!==e&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=Nt(e,c)),n.call(this,c,Nt(e,u),h,e)}):n.length>3&&(o=function(c,u,h){return n.call(this,c,u,h,e)}));const l=s[t](o,...r);return a?Nt(e,l):l}function mi(e,t,n){const r=ge(e);Je(r,"iterate",Nr);const s=r[t](...n);return(s===-1||s===!1)&&Ys(n[0])?(n[0]=ge(n[0]),r[t](...n)):s}function ar(e,t,n=[]){Jt(),mo();const r=ge(e)[t].apply(e,n);return bo(),Yt(),r}const Mh=po("__proto__,__v_isRef,__isVue"),tc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ut));function jh(e){ut(e)||(e=String(e));const t=ge(this);return Je(t,"has",e),t.hasOwnProperty(e)}class nc{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Gh:oc:i?ic:sc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=ne(t);if(!s){let l;if(o&&(l=Lh[n]))return l;if(n==="hasOwnProperty")return jh}const a=Reflect.get(t,n,Ce(t)?t:r);if((ut(n)?tc.has(n):Mh(n))||(s||Je(t,"get",n),i))return a;if(Ce(a)){const l=o&&qs(n)?a:a.value;return s&&Ee(l)?ji(l):l}return Ee(a)?s?ji(a):Yr(a):a}}class rc extends nc{constructor(t=!1){super(!1,t)}set(t,n,r,s){let i=t[n];const o=ne(t)&&qs(n);if(!this._isShallow){const c=Zt(i);if(!lt(r)&&!Zt(r)&&(i=ge(i),r=ge(r)),!o&&Ce(i)&&!Ce(r))return c||(i.value=r),!0}const a=o?Number(n)<t.length:we(t,n),l=Reflect.set(t,n,r,Ce(t)?t:s);return t===ge(s)&&(a?Lt(r,i)&&Wt(t,"set",n,r):Wt(t,"add",n,r)),l}deleteProperty(t,n){const r=we(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Wt(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ut(n)||!tc.has(n))&&Je(t,"has",n),r}ownKeys(t){return Je(t,"iterate",ne(t)?"length":Rn),Reflect.ownKeys(t)}}class Dh extends nc{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Uh=new rc,Bh=new Dh,Hh=new rc(!0);const Mi=e=>e,ns=e=>Reflect.getPrototypeOf(e);function Fh(e,t,n){return function(...r){const s=this.__v_raw,i=ge(s),o=Jn(i),a=e==="entries"||e===Symbol.iterator&&o,l=e==="keys"&&o,c=s[e](...r),u=n?Mi:t?er:wt;return!t&&Je(i,"iterate",l?$i:Rn),Be(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function rs(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function qh(e,t){const n={get(s){const i=this.__v_raw,o=ge(i),a=ge(s);e||(Lt(s,a)&&Je(o,"get",s),Je(o,"get",a));const{has:l}=ns(o),c=t?Mi:e?er:wt;if(l.call(o,s))return c(i.get(s));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!e&&Je(ge(s),"iterate",Rn),s.size},has(s){const i=this.__v_raw,o=ge(i),a=ge(s);return e||(Lt(s,a)&&Je(o,"has",s),Je(o,"has",a)),s===a?i.has(s):i.has(s)||i.has(a)},forEach(s,i){const o=this,a=o.__v_raw,l=ge(a),c=t?Mi:e?er:wt;return!e&&Je(l,"iterate",Rn),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Be(n,e?{add:rs("add"),set:rs("set"),delete:rs("delete"),clear:rs("clear")}:{add(s){const i=ge(this),o=ns(i),a=ge(s),l=!t&&!lt(s)&&!Zt(s)?a:s;return o.has.call(i,l)||Lt(s,l)&&o.has.call(i,s)||Lt(a,l)&&o.has.call(i,a)||(i.add(l),Wt(i,"add",l,l)),this},set(s,i){!t&&!lt(i)&&!Zt(i)&&(i=ge(i));const o=ge(this),{has:a,get:l}=ns(o);let c=a.call(o,s);c||(s=ge(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Lt(i,u)&&Wt(o,"set",s,i):Wt(o,"add",s,i),this},delete(s){const i=ge(this),{has:o,get:a}=ns(i);let l=o.call(i,s);l||(s=ge(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Wt(i,"delete",s,void 0),c},clear(){const s=ge(this),i=s.size!==0,o=s.clear();return i&&Wt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Fh(s,e,t)}),n}function vo(e,t){const n=qh(e,t);return(r,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(we(n,s)&&s in r?n:r,s,i)}const Kh={get:vo(!1,!1)},Wh={get:vo(!1,!0)},Vh={get:vo(!0,!1)};const sc=new WeakMap,ic=new WeakMap,oc=new WeakMap,Gh=new WeakMap;function zh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Jh(e){return e.__v_skip||!Object.isExtensible(e)?0:zh(yh(e))}function Yr(e){return Zt(e)?e:wo(e,!1,Uh,Kh,sc)}function ac(e){return wo(e,!1,Hh,Wh,ic)}function ji(e){return wo(e,!0,Bh,Vh,oc)}function wo(e,t,n,r,s){if(!Ee(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Jh(e);if(i===0)return e;const o=s.get(e);if(o)return o;const a=new Proxy(e,i===2?r:n);return s.set(e,a),a}function Gt(e){return Zt(e)?Gt(e.__v_raw):!!(e&&e.__v_isReactive)}function Zt(e){return!!(e&&e.__v_isReadonly)}function lt(e){return!!(e&&e.__v_isShallow)}function Ys(e){return e?!!e.__v_raw:!1}function ge(e){const t=e&&e.__v_raw;return t?ge(t):e}function Eo(e){return!we(e,"__v_skip")&&Object.isExtensible(e)&&Bl(e,"__v_skip",!0),e}const wt=e=>Ee(e)?Yr(e):e,er=e=>Ee(e)?ji(e):e;function Ce(e){return e?e.__v_isRef===!0:!1}function _e(e){return lc(e,!1)}function Yh(e){return lc(e,!0)}function lc(e,t){return Ce(e)?e:new Zh(e,t)}class Zh{constructor(t,n){this.dep=new _o,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ge(t),this._value=n?t:wt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||lt(t)||Zt(t);t=r?t:ge(t),Lt(t,n)&&(this._rawValue=t,this._value=r?t:wt(t),this.dep.trigger())}}function ze(e){return Ce(e)?e.value:e}const Xh={get:(e,t,n)=>t==="__v_raw"?e:ze(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Ce(s)&&!Ce(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function cc(e){return Gt(e)?e:new Proxy(e,Xh)}function Qh(e){const t=ne(e)?new Array(e.length):{};for(const n in e)t[n]=td(e,n);return t}class ed{constructor(t,n,r){this._object=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=ut(n)?n:String(n),this._raw=ge(t);let s=!0,i=t;if(!ne(t)||ut(this._key)||!qs(this._key))do s=!Ys(i)||lt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=ze(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Ce(this._raw[this._key])){const n=this._object[this._key];if(Ce(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return Ph(this._raw,this._key)}}function td(e,t,n){return new ed(e,t,n)}class nd{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new _o(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Cr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ae!==this)return Jl(this,!0),!0}get value(){const t=this.dep.track();return Xl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function rd(e,t,n=!1){let r,s;return ce(e)?r=e:(r=e.get,s=e.set),new nd(r,s,n)}const ss={},Ss=new WeakMap;let wn;function sd(e,t=!1,n=wn){if(n){let r=Ss.get(n);r||Ss.set(n,r=[]),r.push(e)}}function id(e,t,n=Se){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=n,c=k=>s?k:lt(k)||s===!1||s===0?Vt(k,1):Vt(k);let u,h,d,f,p=!1,m=!1;if(Ce(e)?(h=()=>e.value,p=lt(e)):Gt(e)?(h=()=>c(e),p=!0):ne(e)?(m=!0,p=e.some(k=>Gt(k)||lt(k)),h=()=>e.map(k=>{if(Ce(k))return k.value;if(Gt(k))return c(k);if(ce(k))return l?l(k,2):k()})):ce(e)?t?h=l?()=>l(e,2):e:h=()=>{if(d){Jt();try{d()}finally{Yt()}}const k=wn;wn=u;try{return l?l(e,3,[f]):e(f)}finally{wn=k}}:h=$t,t&&s){const k=h,C=s===!0?1/0:s;h=()=>Vt(k(),C)}const E=Vl(),_=()=>{u.stop(),E&&E.active&&go(E.effects,u)};if(i&&t){const k=t;t=(...C)=>{k(...C),_()}}let y=m?new Array(e.length).fill(ss):ss;const w=k=>{if(!(!(u.flags&1)||!u.dirty&&!k))if(t){const C=u.run();if(s||p||(m?C.some((L,N)=>Lt(L,y[N])):Lt(C,y))){d&&d();const L=wn;wn=u;try{const N=[C,y===ss?void 0:m&&y[0]===ss?[]:y,f];y=C,l?l(t,3,N):t(...N)}finally{wn=L}}}else u.run()};return a&&a(w),u=new Gl(h),u.scheduler=o?()=>o(w,!1):w,f=k=>sd(k,!1,u),d=u.onStop=()=>{const k=Ss.get(u);if(k){if(l)l(k,4);else for(const C of k)C();Ss.delete(u)}},t?r?w(!0):y=u.run():o?o(w.bind(null,!0),!0):u.run(),_.pause=u.pause.bind(u),_.resume=u.resume.bind(u),_.stop=_,_}function Vt(e,t=1/0,n){if(t<=0||!Ee(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ce(e))Vt(e.value,t,n);else if(ne(e))for(let r=0;r<e.length;r++)Vt(e[r],t,n);else if(Fs(e)||Jn(e))e.forEach(r=>{Vt(r,t,n)});else if(Ul(e)){for(const r in e)Vt(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Vt(e[r],t,n)}return e}/**
11
11
  * @vue/runtime-core v3.5.34
12
12
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
13
  * @license MIT
14
- **/function Yr(e,t,n,r){try{return r?e(...r):e()}catch(s){Zs(s,t,n)}}function Et(e,t,n,r){if(le(e)){const s=Yr(e,t,n,r);return s&&Dl(s)&&s.catch(i=>{Zs(i,t,n)}),s}if(ne(e)){const s=[];for(let i=0;i<e.length;i++)s.push(Et(e[i],t,n,r));return s}}function Zs(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Ee;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,c)===!1)return}a=a.parent}if(i){zt(),Yr(i,null,10,[e,l,c]),Jt();return}}ad(e,n,s,r,o)}function ad(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const tt=[];let xt=-1;const Jn=[];let rn=null,Bn=0;const hc=Promise.resolve();let ks=null;function er(e){const t=ks||hc;return e?t.then(this?e.bind(this):e):t}function ld(e){let t=xt+1,n=tt.length;for(;t<n;){const r=t+n>>>1,s=tt[r],i=Nr(s);i<e||i===e&&s.flags&2?t=r+1:n=r}return t}function So(e){if(!(e.flags&1)){const t=Nr(e),n=tt[tt.length-1];!n||!(e.flags&2)&&t>=Nr(n)?tt.push(e):tt.splice(ld(t),0,e),e.flags|=1,dc()}}function dc(){ks||(ks=hc.then(pc))}function cd(e){ne(e)?Jn.push(...e):rn&&e.id===-1?rn.splice(Bn+1,0,e):e.flags&1||(Jn.push(e),e.flags|=1),dc()}function Go(e,t,n=xt+1){for(;n<tt.length;n++){const r=tt[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;tt.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function fc(e){if(Jn.length){const t=[...new Set(Jn)].sort((n,r)=>Nr(n)-Nr(r));if(Jn.length=0,rn){rn.push(...t);return}for(rn=t,Bn=0;Bn<rn.length;Bn++){const n=rn[Bn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}rn=null,Bn=0}}const Nr=e=>e.id==null?e.flags&2?-1:1/0:e.id;function pc(e){try{for(xt=0;xt<tt.length;xt++){const t=tt[xt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Yr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;xt<tt.length;xt++){const t=tt[xt];t&&(t.flags&=-2)}xt=-1,tt.length=0,fc(),ks=null,(tt.length||Jn.length)&&pc()}}let Ve=null,gc=null;function As(e){const t=Ve;return Ve=e,gc=e&&e.type.__scopeId||null,t}function Gt(e,t=Ve,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&xs(-1);const i=As(t);let o;try{o=e(...s)}finally{As(i),r._d&&xs(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function ud(e,t){if(Ve===null)return e;const n=ni(Ve),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[i,o,a,l=Ee]=t[s];i&&(le(i)&&(i={mounted:i,updated:i}),i.deep&&Wt(o),r.push({dir:i,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return e}function pn(e,t,n,r){const s=e.dirs,i=t&&t.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(zt(),Et(l,n,8,[e.el,a,e,t]),Jt())}}function bs(e,t){if(Ye){let n=Ye.provides;const r=Ye.parent&&Ye.parent.provides;r===n&&(n=Ye.provides=Object.create(r)),n[e]=t}}function pt(e,t,n=!1){const r=xo();if(r||On){let s=On?On._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&le(t)?t.call(r&&r.proxy):t}}function hd(){return!!(xo()||On)}const dd=Symbol.for("v-scx"),fd=()=>pt(dd);function cn(e,t,n){return mc(e,t,n)}function mc(e,t,n=Ee){const{immediate:r,deep:s,flush:i,once:o}=n,a=Ue({},n),l=t&&r||!t&&i!=="post";let c;if($r){if(i==="sync"){const f=fd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=$t,f.resume=$t,f.pause=$t,f}}const u=Ye;a.call=(f,p,m)=>Et(f,u,p,m);let h=!1;i==="post"?a.scheduler=f=>{Qe(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():So(f)}),a.augmentJob=f=>{t&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=od(e,t,a);return $r&&(c?c.push(d):l&&d()),d}function pd(e,t,n){const r=this.proxy,s=Te(e)?e.includes(".")?bc(r,e):()=>r[e]:e.bind(r,r);let i;le(t)?i=t:(i=t.handler,n=t);const o=Qr(this),a=mc(s,i.bind(r),n);return o(),a}function bc(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const tn=new WeakMap,yc=Symbol("_vte"),_c=e=>e.__isTeleport,En=e=>e&&(e.disabled||e.disabled===""),gd=e=>e&&(e.defer||e.defer===""),zo=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jo=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Di=(e,t)=>{const n=e&&e.to;return Te(n)?t?t(n):null:n},md={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,i,o,a,l,c){const{mc:u,pc:h,pbc:d,o:{insert:f,querySelector:p,createText:m,createComment:w,parentNode:E}}=c,y=En(t.props);let{dynamicChildren:v}=t;const T=(j,q,C)=>{j.shapeFlag&16&&u(j.children,q,C,s,i,o,a,l)},D=(j=t)=>{const q=En(j.props),C=j.target=Di(j.props,p),Q=Ui(C,j,m,f);C&&(o!=="svg"&&zo(C)?o="svg":o!=="mathml"&&Jo(C)&&(o="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(C),q||(T(j,C,Q),hr(j,!1)))},B=j=>{const q=()=>{if(tn.get(j)===q){if(tn.delete(j),En(j.props)){const C=E(j.el)||n;T(j,C,j.anchor),hr(j,!0)}D(j)}};tn.set(j,q),Qe(q,i)};if(e==null){const j=t.el=m(""),q=t.anchor=m("");if(f(j,n,r),f(q,n,r),gd(t.props)||i&&i.pendingBranch){B(t);return}y&&(T(t,n,q),hr(t,!0)),D()}else{t.el=e.el;const j=t.anchor=e.anchor,q=tn.get(e);if(q){q.flags|=8,tn.delete(e),B(t);return}t.targetStart=e.targetStart;const C=t.target=e.target,Q=t.targetAnchor=e.targetAnchor,ae=En(e.props),F=ae?n:C,ce=ae?j:Q;if(o==="svg"||zo(C)?o="svg":(o==="mathml"||Jo(C))&&(o="mathml"),v?(d(e.dynamicChildren,v,F,s,i,o,a),To(e,t,!0)):l||h(e,t,F,ce,s,i,o,a,!1),y)ae?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ss(t,n,j,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const me=t.target=Di(t.props,p);me&&ss(t,me,null,c,0)}else ae&&ss(t,C,Q,c,1);hr(t,y)}},remove(e,t,n,{um:r,o:{remove:s}},i){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:h,props:d}=e;let f=i||!En(d);const p=tn.get(e);if(p&&(p.flags|=8,tn.delete(e),f=!1),h&&(s(c),s(u)),i&&s(l),o&16)for(let m=0;m<a.length;m++){const w=a[m];r(w,t,n,f,!!w.dynamicChildren)}},move:ss,hydrate:bd};function ss(e,t,n,{o:{insert:r},m:s},i=2){i===0&&r(e.targetAnchor,t,n);const{el:o,anchor:a,shapeFlag:l,children:c,props:u}=e,h=i===2;if(h&&r(o,t,n),!tn.has(e)&&(!h||En(u))&&l&16)for(let d=0;d<c.length;d++)s(c[d],t,n,2);h&&r(a,t,n)}function bd(e,t,n,r,s,i,{o:{nextSibling:o,parentNode:a,querySelector:l,insert:c,createText:u}},h){function d(w,E){let y=E;for(;y;){if(y&&y.nodeType===8){if(y.data==="teleport start anchor")t.targetStart=y;else if(y.data==="teleport anchor"){t.targetAnchor=y,w._lpa=t.targetAnchor&&o(t.targetAnchor);break}}y=o(y)}}function f(w,E){E.anchor=h(o(w),E,a(w),n,r,s,i)}const p=t.target=Di(t.props,l),m=En(t.props);if(p){const w=p._lpa||p.firstChild;t.shapeFlag&16&&(m?(f(e,t),d(p,w),t.targetAnchor||Ui(p,t,u,c,a(e)===p?e:null)):(t.anchor=o(e),d(p,w),t.targetAnchor||Ui(p,t,u,c),h(w&&o(w),t,p,n,r,s,i))),hr(t,m)}else m&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}const yd=md;function hr(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ui(e,t,n,r,s=null){const i=t.targetStart=n(""),o=t.targetAnchor=n("");return i[yc]=o,e&&(r(i,e,s),r(o,e,s)),o}const Ot=Symbol("_leaveCb"),ar=Symbol("_enterCb");function _d(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Zr(()=>{e.isMounted=!0}),Rc(()=>{e.isUnmounting=!0}),e}const ht=[Function,Array],vc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ht,onEnter:ht,onAfterEnter:ht,onEnterCancelled:ht,onBeforeLeave:ht,onLeave:ht,onAfterLeave:ht,onLeaveCancelled:ht,onBeforeAppear:ht,onAppear:ht,onAfterAppear:ht,onAppearCancelled:ht},wc=e=>{const t=e.subTree;return t.component?wc(t.component):t},vd={name:"BaseTransition",props:vc,setup(e,{slots:t}){const n=xo(),r=_d();return()=>{const s=t.default&&kc(t.default(),!0),i=s&&s.length?Ec(s):n.subTree?Je():void 0;if(!i)return;const o=pe(e),{mode:a}=o;if(r.isLeaving)return bi(i);const l=Yo(i);if(!l)return bi(i);let c=Bi(l,o,r,n,h=>c=h);l.type!==ze&&Ir(l,c);let u=n.subTree&&Yo(n.subTree);if(u&&u.type!==ze&&!Sn(u,l)&&wc(n).type!==ze){let h=Bi(u,o,r,n);if(Ir(u,h),a==="out-in"&&l.type!==ze)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,u=void 0},bi(i);a==="in-out"&&l.type!==ze?h.delayLeave=(d,f,p)=>{const m=Sc(r,u);m[String(u.key)]=u,d[Ot]=()=>{f(),d[Ot]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Ec(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==ze){t=n;break}}return t}const wd=vd;function Sc(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Bi(e,t,n,r,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:m,onBeforeAppear:w,onAppear:E,onAfterAppear:y,onAppearCancelled:v}=t,T=String(e.key),D=Sc(n,e),B=(C,Q)=>{C&&Et(C,r,9,Q)},j=(C,Q)=>{const ae=Q[1];B(C,Q),ne(C)?C.every(F=>F.length<=1)&&ae():C.length<=1&&ae()},q={mode:o,persisted:a,beforeEnter(C){let Q=l;if(!n.isMounted)if(i)Q=w||l;else return;C[Ot]&&C[Ot](!0);const ae=D[T];ae&&Sn(e,ae)&&ae.el[Ot]&&ae.el[Ot](),B(Q,[C])},enter(C){if(D[T]===e)return;let Q=c,ae=u,F=h;if(!n.isMounted)if(i)Q=E||c,ae=y||u,F=v||h;else return;let ce=!1;C[ar]=Ne=>{ce||(ce=!0,Ne?B(F,[C]):B(ae,[C]),q.delayedLeave&&q.delayedLeave(),C[ar]=void 0)};const me=C[ar].bind(null,!1);Q?j(Q,[C,me]):me()},leave(C,Q){const ae=String(e.key);if(C[ar]&&C[ar](!0),n.isUnmounting)return Q();B(d,[C]);let F=!1;C[Ot]=me=>{F||(F=!0,Q(),me?B(m,[C]):B(p,[C]),C[Ot]=void 0,D[ae]===e&&delete D[ae])};const ce=C[Ot].bind(null,!1);D[ae]=e,f?j(f,[C,ce]):ce()},clone(C){const Q=Bi(C,t,n,r,s);return s&&s(Q),Q}};return q}function bi(e){if(Xs(e))return e=un(e),e.children=null,e}function Yo(e){if(!Xs(e))return _c(e.type)&&e.children?Ec(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&le(n.default))return n.default()}}function Ir(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ir(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 kc(e,t=!1,n){let r=[],s=0;for(let i=0;i<e.length;i++){let o=e[i];const a=n==null?o.key:String(n)+String(o.key!=null?o.key:i);o.type===ge?(o.patchFlag&128&&s++,r=r.concat(kc(o.children,t,a))):(t||o.type!==ze)&&r.push(a!=null?un(o,{key:a}):o)}if(s>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function dn(e,t){return le(e)?Ue({name:e.name},t,{setup:e}):e}function Ac(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zo(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Ts=new WeakMap;function vr(e,t,n,r,s=!1){if(ne(e)){e.forEach((m,w)=>vr(m,t&&(ne(t)?t[w]:t),n,r,s));return}if(Yn(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vr(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?ni(r.component):r.el,o=s?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===Ee?a.refs={}:a.refs,h=a.setupState,d=pe(h),f=h===Ee?jl:m=>Zo(u,m)?!1:ve(d,m),p=(m,w)=>!(w&&Zo(u,w));if(c!=null&&c!==l){if(Xo(t),Te(c))u[c]=null,f(c)&&(h[c]=null);else if(Ce(c)){const m=t;p(c,m.k)&&(c.value=null),m.k&&(u[m.k]=null)}}if(le(l))Yr(l,a,12,[o,u]);else{const m=Te(l),w=Ce(l);if(m||w){const E=()=>{if(e.f){const y=m?f(l)?h[l]:u[l]:p()||!e.k?l.value:u[e.k];if(s)ne(y)&&go(y,i);else if(ne(y))y.includes(i)||y.push(i);else if(m)u[l]=[i],f(l)&&(h[l]=u[l]);else{const v=[i];p(l,e.k)&&(l.value=v),e.k&&(u[e.k]=v)}}else m?(u[l]=o,f(l)&&(h[l]=o)):w&&(p(l,e.k)&&(l.value=o),e.k&&(u[e.k]=o))};if(o){const y=()=>{E(),Ts.delete(e)};y.id=-1,Ts.set(e,y),Qe(y,n)}else Xo(e),E()}}}function Xo(e){const t=Ts.get(e);t&&(t.flags|=8,Ts.delete(e))}Gs().requestIdleCallback;Gs().cancelIdleCallback;const Yn=e=>!!e.type.__asyncLoader,Xs=e=>e.type.__isKeepAlive;function Ed(e,t){Tc(e,"a",t)}function Sd(e,t){Tc(e,"da",t)}function Tc(e,t,n=Ye){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Qs(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Xs(s.parent.vnode)&&kd(r,t,n,s),s=s.parent}}function kd(e,t,n,r){const s=Qs(t,e,r,!0);Xr(()=>{go(r[t],s)},n)}function Qs(e,t,n=Ye,r=!1){if(n){const s=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{zt();const a=Qr(n),l=Et(t,n,e,o);return a(),Jt(),l});return r?s.unshift(i):s.push(i),i}}const Zt=e=>(t,n=Ye)=>{(!$r||e==="sp")&&Qs(e,(...r)=>t(...r),n)},Ad=Zt("bm"),Zr=Zt("m"),Td=Zt("bu"),Rd=Zt("u"),Rc=Zt("bum"),Xr=Zt("um"),xd=Zt("sp"),Od=Zt("rtg"),Cd=Zt("rtc");function Nd(e,t=Ye){Qs("ec",e,t)}const Id="components";function Vv(e,t){return Ld(Id,e,!0,t)||e}const Pd=Symbol.for("v-ndc");function Ld(e,t,n=!0,r=!1){const s=Ve||Ye;if(s){const i=s.type;{const a=vf(i,!1);if(a&&(a===t||a===nt(t)||a===Ws(nt(t))))return i}const o=Qo(s[e]||i[e],t)||Qo(s.appContext[e],t);return!o&&r?i:o}}function Qo(e,t){return e&&(e[t]||e[nt(t)]||e[Ws(nt(t))])}function xn(e,t,n,r){let s;const i=n,o=ne(e);if(o||Te(e)){const a=o&&Vt(e);let l=!1,c=!1;a&&(l=!lt(e),c=Yt(e),e=Js(e)),s=new Array(e.length);for(let u=0,h=e.length;u<h;u++)s[u]=t(l?c?Qn(wt(e[u])):wt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,i)}else if(we(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,i));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=t(e[u],u,l,i)}}else s=[];return s}function Gv(e,t,n={},r,s){if(Ve.ce||Ve.parent&&Yn(Ve.parent)&&Ve.parent.ce){const c=Object.keys(n).length>0;return J(),tr(ge,null,[ue("slot",n,r)],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),J();const o=i&&xc(i(n)),a=n.key||o&&o.key,l=tr(ge,{key:(a&&!ct(a)?a:`_${t}`)+(!o&&r?"_fb":"")},o||[],o&&e._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function xc(e){return e.some(t=>Lr(t)?!(t.type===ze||t.type===ge&&!xc(t.children)):!0)?e:null}const Hi=e=>e?zc(e)?ni(e):Hi(e.parent):null,wr=Ue(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=>Hi(e.parent),$root:e=>Hi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Cc(e),$forceUpdate:e=>e.f||(e.f=()=>{So(e.update)}),$nextTick:e=>e.n||(e.n=er.bind(e.proxy)),$watch:e=>pd.bind(e)}),yi=(e,t)=>e!==Ee&&!e.__isScriptSetup&&ve(e,t),$d={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:i,accessCache:o,type:a,appContext:l}=e;if(t[0]!=="$"){const d=o[t];if(d!==void 0)switch(d){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return i[t]}else{if(yi(r,t))return o[t]=1,r[t];if(s!==Ee&&ve(s,t))return o[t]=2,s[t];if(ve(i,t))return o[t]=3,i[t];if(n!==Ee&&ve(n,t))return o[t]=4,n[t];Fi&&(o[t]=0)}}const c=wr[t];let u,h;if(c)return t==="$attrs"&&Ge(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Ee&&ve(n,t))return o[t]=4,n[t];if(h=l.config.globalProperties,ve(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:i}=e;return yi(s,t)?(s[t]=n,!0):r!==Ee&&ve(r,t)?(r[t]=n,!0):ve(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:i,type:o}},a){let l;return!!(n[a]||e!==Ee&&a[0]!=="$"&&ve(e,a)||yi(t,a)||ve(i,a)||ve(r,a)||ve(wr,a)||ve(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ve(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ea(e){return ne(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Fi=!0;function Md(e){const t=Cc(e),n=e.proxy,r=e.ctx;Fi=!1,t.beforeCreate&&ta(t.beforeCreate,e,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:p,activated:m,deactivated:w,beforeDestroy:E,beforeUnmount:y,destroyed:v,unmounted:T,render:D,renderTracked:B,renderTriggered:j,errorCaptured:q,serverPrefetch:C,expose:Q,inheritAttrs:ae,components:F,directives:ce,filters:me}=t;if(c&&jd(c,r,null),o)for(const P in o){const M=o[P];le(M)&&(r[P]=M.bind(n))}if(s){const P=s.call(n,n);we(P)&&(e.data=Jr(P))}if(Fi=!0,i)for(const P in i){const M=i[P],re=le(M)?M.bind(n,n):le(M.get)?M.get.bind(n,n):$t,he=!le(M)&&le(M.set)?M.set.bind(n):$t,be=Fe({get:re,set:he});Object.defineProperty(r,P,{enumerable:!0,configurable:!0,get:()=>be.value,set:ye=>be.value=ye})}if(a)for(const P in a)Oc(a[P],r,n,P);if(l){const P=le(l)?l.call(n):l;Reflect.ownKeys(P).forEach(M=>{bs(M,P[M])})}u&&ta(u,e,"c");function A(P,M){ne(M)?M.forEach(re=>P(re.bind(n))):M&&P(M.bind(n))}if(A(Ad,h),A(Zr,d),A(Td,f),A(Rd,p),A(Ed,m),A(Sd,w),A(Nd,q),A(Cd,B),A(Od,j),A(Rc,y),A(Xr,T),A(xd,C),ne(Q))if(Q.length){const P=e.exposed||(e.exposed={});Q.forEach(M=>{Object.defineProperty(P,M,{get:()=>n[M],set:re=>n[M]=re,enumerable:!0})})}else e.exposed||(e.exposed={});D&&e.render===$t&&(e.render=D),ae!=null&&(e.inheritAttrs=ae),F&&(e.components=F),ce&&(e.directives=ce),C&&Ac(e)}function jd(e,t,n=$t){ne(e)&&(e=qi(e));for(const r in e){const s=e[r];let i;we(s)?"default"in s?i=pt(s.from||r,s.default,!0):i=pt(s.from||r):i=pt(s),Ce(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[r]=i}}function ta(e,t,n){Et(ne(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Oc(e,t,n,r){let s=r.includes(".")?bc(n,r):()=>n[r];if(Te(e)){const i=t[e];le(i)&&cn(s,i)}else if(le(e))cn(s,e.bind(n));else if(we(e))if(ne(e))e.forEach(i=>Oc(i,t,n,r));else{const i=le(e.handler)?e.handler.bind(n):t[e.handler];le(i)&&cn(s,i,e)}}function Cc(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,a=i.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(c=>Rs(l,c,o,!0)),Rs(l,t,o)),we(t)&&i.set(t,l),l}function Rs(e,t,n,r=!1){const{mixins:s,extends:i}=t;i&&Rs(e,i,n,!0),s&&s.forEach(o=>Rs(e,o,n,!0));for(const o in t)if(!(r&&o==="expose")){const a=Dd[o]||n&&n[o];e[o]=a?a(e[o],t[o]):t[o]}return e}const Dd={data:na,props:ra,emits:ra,methods:dr,computed:dr,beforeCreate:Xe,created:Xe,beforeMount:Xe,mounted:Xe,beforeUpdate:Xe,updated:Xe,beforeDestroy:Xe,beforeUnmount:Xe,destroyed:Xe,unmounted:Xe,activated:Xe,deactivated:Xe,errorCaptured:Xe,serverPrefetch:Xe,components:dr,directives:dr,watch:Bd,provide:na,inject:Ud};function na(e,t){return t?e?function(){return Ue(le(e)?e.call(this,this):e,le(t)?t.call(this,this):t)}:t:e}function Ud(e,t){return dr(qi(e),qi(t))}function qi(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Xe(e,t){return e?[...new Set([].concat(e,t))]:t}function dr(e,t){return e?Ue(Object.create(null),e,t):t}function ra(e,t){return e?ne(e)&&ne(t)?[...new Set([...e,...t])]:Ue(Object.create(null),ea(e),ea(t??{})):t}function Bd(e,t){if(!e)return t;if(!t)return e;const n=Ue(Object.create(null),e);for(const r in t)n[r]=Xe(e[r],t[r]);return n}function Nc(){return{app:null,config:{isNativeTag:jl,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 Hd=0;function Fd(e,t){return function(r,s=null){le(r)||(r=Ue({},r)),s!=null&&!we(s)&&(s=null);const i=Nc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Hd++,_component:r,_props:s,_container:null,_context:i,_instance:null,version:Ef,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&le(u.install)?(o.add(u),u.install(c,...h)):le(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||ue(r,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),e(f,u,d),l=!0,c._container=u,u.__vue_app__=c,ni(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Et(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=On;On=c;try{return u()}finally{On=h}}};return c}}let On=null;const qd=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${nt(t)}Modifiers`]||e[`${hn(t)}Modifiers`];function Kd(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ee;let s=n;const i=t.startsWith("update:"),o=i&&qd(r,t.slice(7));o&&(o.trim&&(s=n.map(u=>Te(u)?u.trim():u)),o.number&&(s=n.map(Vs)));let a,l=r[a=di(t)]||r[a=di(nt(t))];!l&&i&&(l=r[a=di(hn(t))]),l&&Et(l,e,6,s);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Et(c,e,6,s)}}const Wd=new WeakMap;function Ic(e,t,n=!1){const r=n?Wd:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const i=e.emits;let o={},a=!1;if(!le(e)){const l=c=>{const u=Ic(c,t,!0);u&&(a=!0,Ue(o,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(we(e)&&r.set(e,null),null):(ne(i)?i.forEach(l=>o[l]=null):Ue(o,i),we(e)&&r.set(e,o),o)}function ei(e,t){return!e||!Bs(t)?!1:(t=t.slice(2).replace(/Once$/,""),ve(e,t[0].toLowerCase()+t.slice(1))||ve(e,hn(t))||ve(e,t))}function sa(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:p,inheritAttrs:m}=e,w=As(e);let E,y;try{if(n.shapeFlag&4){const T=s||r,D=T;E=It(c.call(D,T,u,h,f,d,p)),y=a}else{const T=t;E=It(T.length>1?T(h,{attrs:a,slots:o,emit:l}):T(h,null)),y=t.props?a:Vd(a)}}catch(T){Er.length=0,Zs(T,e,1),E=ue(ze)}let v=E;if(y&&m!==!1){const T=Object.keys(y),{shapeFlag:D}=v;T.length&&D&7&&(i&&T.some(Hs)&&(y=Gd(y,i)),v=un(v,y,!1,!0))}return n.dirs&&(v=un(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(n.dirs):n.dirs),n.transition&&Ir(v,n.transition),E=v,As(w),E}const Vd=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bs(n))&&((t||(t={}))[n]=e[n]);return t},Gd=(e,t)=>{const n={};for(const r in e)(!Hs(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function zd(e,t,n){const{props:r,children:s,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?ia(r,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Pc(o,r,d)&&!ei(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?ia(r,o,c):!0:!!o;return!1}function ia(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const i=r[s];if(Pc(t,e,i)&&!ei(n,i))return!0}return!1}function Pc(e,t,n){const r=e[n],s=t[n];return n==="style"&&we(r)&&we(s)?!zr(r,s):r!==s}function Jd({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Lc={},$c=()=>Object.create(Lc),Mc=e=>Object.getPrototypeOf(e)===Lc;function Yd(e,t,n,r=!1){const s={},i=$c();e.propsDefaults=Object.create(null),jc(e,t,s,i);for(const o in e.propsOptions[0])o in s||(s[o]=void 0);n?e.props=r?s:lc(s):e.type.props?e.props=s:e.props=i,e.attrs=i}function Zd(e,t,n,r){const{props:s,attrs:i,vnode:{patchFlag:o}}=e,a=pe(s),[l]=e.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(ei(e.emitsOptions,d))continue;const f=t[d];if(l)if(ve(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=nt(d);s[p]=Ki(l,a,p,f,e,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{jc(e,t,s,i)&&(c=!0);let u;for(const h in a)(!t||!ve(t,h)&&((u=hn(h))===h||!ve(t,u)))&&(l?n&&(n[h]!==void 0||n[u]!==void 0)&&(s[h]=Ki(l,a,h,void 0,e,!0)):delete s[h]);if(i!==a)for(const h in i)(!t||!ve(t,h))&&(delete i[h],c=!0)}c&&Kt(e.attrs,"set","")}function jc(e,t,n,r){const[s,i]=e.propsOptions;let o=!1,a;if(t)for(let l in t){if(br(l))continue;const c=t[l];let u;s&&ve(s,u=nt(l))?!i||!i.includes(u)?n[u]=c:(a||(a={}))[u]=c:ei(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=pe(n),c=a||Ee;for(let u=0;u<i.length;u++){const h=i[u];n[h]=Ki(s,l,h,c[h],e,!ve(c,h))}}return o}function Ki(e,t,n,r,s,i){const o=e[n];if(o!=null){const a=ve(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&le(l)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=Qr(s);r=c[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===hn(n))&&(r=!0))}return r}const Xd=new WeakMap;function Dc(e,t,n=!1){const r=n?Xd:t.propsCache,s=r.get(e);if(s)return s;const i=e.props,o={},a=[];let l=!1;if(!le(e)){const u=h=>{l=!0;const[d,f]=Dc(h,t,!0);Ue(o,d),f&&a.push(...f)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return we(e)&&r.set(e,Gn),Gn;if(ne(i))for(let u=0;u<i.length;u++){const h=nt(i[u]);oa(h)&&(o[h]=Ee)}else if(i)for(const u in i){const h=nt(u);if(oa(h)){const d=i[u],f=o[h]=ne(d)||le(d)?{type:d}:Ue({},d),p=f.type;let m=!1,w=!0;if(ne(p))for(let E=0;E<p.length;++E){const y=p[E],v=le(y)&&y.name;if(v==="Boolean"){m=!0;break}else v==="String"&&(w=!1)}else m=le(p)&&p.name==="Boolean";f[0]=m,f[1]=w,(m||ve(f,"default"))&&a.push(h)}}const c=[o,a];return we(e)&&r.set(e,c),c}function oa(e){return e[0]!=="$"&&!br(e)}const ko=e=>e==="_"||e==="_ctx"||e==="$stable",Ao=e=>ne(e)?e.map(It):[It(e)],Qd=(e,t,n)=>{if(t._n)return t;const r=Gt((...s)=>Ao(t(...s)),n);return r._c=!1,r},Uc=(e,t,n)=>{const r=e._ctx;for(const s in e){if(ko(s))continue;const i=e[s];if(le(i))t[s]=Qd(s,i,r);else if(i!=null){const o=Ao(i);t[s]=()=>o}}},Bc=(e,t)=>{const n=Ao(t);e.slots.default=()=>n},Hc=(e,t,n)=>{for(const r in t)(n||!ko(r))&&(e[r]=t[r])},ef=(e,t,n)=>{const r=e.slots=$c();if(e.vnode.shapeFlag&32){const s=t._;s?(Hc(r,t,n),n&&Hl(r,"_",s,!0)):Uc(t,r)}else t&&Bc(e,t)},tf=(e,t,n)=>{const{vnode:r,slots:s}=e;let i=!0,o=Ee;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Hc(s,t,n):(i=!t.$stable,Uc(t,s)),o=t}else t&&(Bc(e,t),o={default:1});if(i)for(const a in s)!ko(a)&&o[a]==null&&delete s[a]},Qe=af;function nf(e){return rf(e)}function rf(e,t){const n=Gs();n.__VUE__=!0;const{insert:r,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=$t,insertStaticContent:p}=e,m=(g,b,_,S=null,N=null,R=null,x=void 0,H=null,L=!!b.dynamicChildren)=>{if(g===b)return;g&&!Sn(g,b)&&(S=O(g),ye(g,N,R,!0),g=null),b.patchFlag===-2&&(L=!1,b.dynamicChildren=null);const{type:k,ref:te,shapeFlag:K}=b;switch(k){case ti:w(g,b,_,S);break;case ze:E(g,b,_,S);break;case ys:g==null&&y(b,_,S,x);break;case ge:F(g,b,_,S,N,R,x,H,L);break;default:K&1?D(g,b,_,S,N,R,x,H,L):K&6?ce(g,b,_,S,N,R,x,H,L):(K&64||K&128)&&k.process(g,b,_,S,N,R,x,H,L,ee)}te!=null&&N?vr(te,g&&g.ref,R,b||g,!b):te==null&&g&&g.ref!=null&&vr(g.ref,null,R,g,!0)},w=(g,b,_,S)=>{if(g==null)r(b.el=a(b.children),_,S);else{const N=b.el=g.el;b.children!==g.children&&c(N,b.children)}},E=(g,b,_,S)=>{g==null?r(b.el=l(b.children||""),_,S):b.el=g.el},y=(g,b,_,S)=>{[g.el,g.anchor]=p(g.children,b,_,S,g.el,g.anchor)},v=({el:g,anchor:b},_,S)=>{let N;for(;g&&g!==b;)N=d(g),r(g,_,S),g=N;r(b,_,S)},T=({el:g,anchor:b})=>{let _;for(;g&&g!==b;)_=d(g),s(g),g=_;s(b)},D=(g,b,_,S,N,R,x,H,L)=>{if(b.type==="svg"?x="svg":b.type==="math"&&(x="mathml"),g==null)B(b,_,S,N,R,x,H,L);else{const k=g.el&&g.el._isVueCE?g.el:null;try{k&&k._beginPatch(),C(g,b,N,R,x,H,L)}finally{k&&k._endPatch()}}},B=(g,b,_,S,N,R,x,H)=>{let L,k;const{props:te,shapeFlag:K,transition:X,dirs:se}=g;if(L=g.el=o(g.type,R,te&&te.is,te),K&8?u(L,g.children):K&16&&q(g.children,L,null,S,N,_i(g,R),x,H),se&&pn(g,null,S,"created"),j(L,g,g.scopeId,x,S),te){for(const U in te)U!=="value"&&!br(U)&&i(L,U,null,te[U],R,S);"value"in te&&i(L,"value",null,te.value,R),(k=te.onVnodeBeforeMount)&&At(k,S,g)}se&&pn(g,null,S,"beforeMount");const I=sf(N,X);I&&X.beforeEnter(L),r(L,b,_),((k=te&&te.onVnodeMounted)||I||se)&&Qe(()=>{try{k&&At(k,S,g),I&&X.enter(L),se&&pn(g,null,S,"mounted")}finally{}},N)},j=(g,b,_,S,N)=>{if(_&&f(g,_),S)for(let R=0;R<S.length;R++)f(g,S[R]);if(N){let R=N.subTree;if(b===R||Kc(R.type)&&(R.ssContent===b||R.ssFallback===b)){const x=N.vnode;j(g,x,x.scopeId,x.slotScopeIds,N.parent)}}},q=(g,b,_,S,N,R,x,H,L=0)=>{for(let k=L;k<g.length;k++){const te=g[k]=H?qt(g[k]):It(g[k]);m(null,te,b,_,S,N,R,x,H)}},C=(g,b,_,S,N,R,x)=>{const H=b.el=g.el;let{patchFlag:L,dynamicChildren:k,dirs:te}=b;L|=g.patchFlag&16;const K=g.props||Ee,X=b.props||Ee;let se;if(_&&gn(_,!1),(se=X.onVnodeBeforeUpdate)&&At(se,_,b,g),te&&pn(b,g,_,"beforeUpdate"),_&&gn(_,!0),(K.innerHTML&&X.innerHTML==null||K.textContent&&X.textContent==null)&&u(H,""),k?Q(g.dynamicChildren,k,H,_,S,_i(b,N),R):x||M(g,b,H,null,_,S,_i(b,N),R,!1),L>0){if(L&16)ae(H,K,X,_,N);else if(L&2&&K.class!==X.class&&i(H,"class",null,X.class,N),L&4&&i(H,"style",K.style,X.style,N),L&8){const I=b.dynamicProps;for(let U=0;U<I.length;U++){const z=I[U],ie=K[z],fe=X[z];(fe!==ie||z==="value")&&i(H,z,ie,fe,N,_)}}L&1&&g.children!==b.children&&u(H,b.children)}else!x&&k==null&&ae(H,K,X,_,N);((se=X.onVnodeUpdated)||te)&&Qe(()=>{se&&At(se,_,b,g),te&&pn(b,g,_,"updated")},S)},Q=(g,b,_,S,N,R,x)=>{for(let H=0;H<b.length;H++){const L=g[H],k=b[H],te=L.el&&(L.type===ge||!Sn(L,k)||L.shapeFlag&198)?h(L.el):_;m(L,k,te,null,S,N,R,x,!0)}},ae=(g,b,_,S,N)=>{if(b!==_){if(b!==Ee)for(const R in b)!br(R)&&!(R in _)&&i(g,R,b[R],null,N,S);for(const R in _){if(br(R))continue;const x=_[R],H=b[R];x!==H&&R!=="value"&&i(g,R,H,x,N,S)}"value"in _&&i(g,"value",b.value,_.value,N)}},F=(g,b,_,S,N,R,x,H,L)=>{const k=b.el=g?g.el:a(""),te=b.anchor=g?g.anchor:a("");let{patchFlag:K,dynamicChildren:X,slotScopeIds:se}=b;se&&(H=H?H.concat(se):se),g==null?(r(k,_,S),r(te,_,S),q(b.children||[],_,te,N,R,x,H,L)):K>0&&K&64&&X&&g.dynamicChildren&&g.dynamicChildren.length===X.length?(Q(g.dynamicChildren,X,_,N,R,x,H),(b.key!=null||N&&b===N.subTree)&&To(g,b,!0)):M(g,b,_,te,N,R,x,H,L)},ce=(g,b,_,S,N,R,x,H,L)=>{b.slotScopeIds=H,g==null?b.shapeFlag&512?N.ctx.activate(b,_,S,x,L):me(b,_,S,N,R,x,L):Ne(g,b,L)},me=(g,b,_,S,N,R,x)=>{const H=g.component=gf(g,S,N);if(Xs(g)&&(H.ctx.renderer=ee),mf(H,!1,x),H.asyncDep){if(N&&N.registerDep(H,A,x),!g.el){const L=H.subTree=ue(ze);E(null,L,b,_),g.placeholder=L.el}}else A(H,g,b,_,N,R,x)},Ne=(g,b,_)=>{const S=b.component=g.component;if(zd(g,b,_))if(S.asyncDep&&!S.asyncResolved){P(S,b,_);return}else S.next=b,S.update();else b.el=g.el,S.vnode=b},A=(g,b,_,S,N,R,x)=>{const H=()=>{if(g.isMounted){let{next:K,bu:X,u:se,parent:I,vnode:U}=g;{const ut=Fc(g);if(ut){K&&(K.el=U.el,P(g,K,x)),ut.asyncDep.then(()=>{Qe(()=>{g.isUnmounted||k()},N)});return}}let z=K,ie;gn(g,!1),K?(K.el=U.el,P(g,K,x)):K=U,X&&ms(X),(ie=K.props&&K.props.onVnodeBeforeUpdate)&&At(ie,I,K,U),gn(g,!0);const fe=sa(g),Pe=g.subTree;g.subTree=fe,m(Pe,fe,h(Pe.el),O(Pe),g,N,R),K.el=fe.el,z===null&&Jd(g,fe.el),se&&Qe(se,N),(ie=K.props&&K.props.onVnodeUpdated)&&Qe(()=>At(ie,I,K,U),N)}else{let K;const{el:X,props:se}=b,{bm:I,m:U,parent:z,root:ie,type:fe}=g,Pe=Yn(b);gn(g,!1),I&&ms(I),!Pe&&(K=se&&se.onVnodeBeforeMount)&&At(K,z,b),gn(g,!0);{ie.ce&&ie.ce._hasShadowRoot()&&ie.ce._injectChildStyle(fe,g.parent?g.parent.type:void 0);const ut=g.subTree=sa(g);m(null,ut,_,S,g,N,R),b.el=ut.el}if(U&&Qe(U,N),!Pe&&(K=se&&se.onVnodeMounted)){const ut=b;Qe(()=>At(K,z,ut),N)}(b.shapeFlag&256||z&&Yn(z.vnode)&&z.vnode.shapeFlag&256)&&g.a&&Qe(g.a,N),g.isMounted=!0,b=_=S=null}};g.scope.on();const L=g.effect=new zl(H);g.scope.off();const k=g.update=L.run.bind(L),te=g.job=L.runIfDirty.bind(L);te.i=g,te.id=g.uid,L.scheduler=()=>So(te),gn(g,!0),k()},P=(g,b,_)=>{b.component=g;const S=g.vnode.props;g.vnode=b,g.next=null,Zd(g,b.props,S,_),tf(g,b.children,_),zt(),Go(g),Jt()},M=(g,b,_,S,N,R,x,H,L=!1)=>{const k=g&&g.children,te=g?g.shapeFlag:0,K=b.children,{patchFlag:X,shapeFlag:se}=b;if(X>0){if(X&128){he(k,K,_,S,N,R,x,H,L);return}else if(X&256){re(k,K,_,S,N,R,x,H,L);return}}se&8?(te&16&&Ze(k,N,R),K!==k&&u(_,K)):te&16?se&16?he(k,K,_,S,N,R,x,H,L):Ze(k,N,R,!0):(te&8&&u(_,""),se&16&&q(K,_,S,N,R,x,H,L))},re=(g,b,_,S,N,R,x,H,L)=>{g=g||Gn,b=b||Gn;const k=g.length,te=b.length,K=Math.min(k,te);let X;for(X=0;X<K;X++){const se=b[X]=L?qt(b[X]):It(b[X]);m(g[X],se,_,null,N,R,x,H,L)}k>te?Ze(g,N,R,!0,!1,K):q(b,_,S,N,R,x,H,L,K)},he=(g,b,_,S,N,R,x,H,L)=>{let k=0;const te=b.length;let K=g.length-1,X=te-1;for(;k<=K&&k<=X;){const se=g[k],I=b[k]=L?qt(b[k]):It(b[k]);if(Sn(se,I))m(se,I,_,null,N,R,x,H,L);else break;k++}for(;k<=K&&k<=X;){const se=g[K],I=b[X]=L?qt(b[X]):It(b[X]);if(Sn(se,I))m(se,I,_,null,N,R,x,H,L);else break;K--,X--}if(k>K){if(k<=X){const se=X+1,I=se<te?b[se].el:S;for(;k<=X;)m(null,b[k]=L?qt(b[k]):It(b[k]),_,I,N,R,x,H,L),k++}}else if(k>X)for(;k<=K;)ye(g[k],N,R,!0),k++;else{const se=k,I=k,U=new Map;for(k=I;k<=X;k++){const it=b[k]=L?qt(b[k]):It(b[k]);it.key!=null&&U.set(it.key,k)}let z,ie=0;const fe=X-I+1;let Pe=!1,ut=0;const fn=new Array(fe);for(k=0;k<fe;k++)fn[k]=0;for(k=se;k<=K;k++){const it=g[k];if(ie>=fe){ye(it,N,R,!0);continue}let kt;if(it.key!=null)kt=U.get(it.key);else for(z=I;z<=X;z++)if(fn[z-I]===0&&Sn(it,b[z])){kt=z;break}kt===void 0?ye(it,N,R,!0):(fn[kt-I]=k+1,kt>=ut?ut=kt:Pe=!0,m(it,b[kt],_,null,N,R,x,H,L),ie++)}const Bo=Pe?of(fn):Gn;for(z=Bo.length-1,k=fe-1;k>=0;k--){const it=I+k,kt=b[it],Ho=b[it+1],Fo=it+1<te?Ho.el||qc(Ho):S;fn[k]===0?m(null,kt,_,Fo,N,R,x,H,L):Pe&&(z<0||k!==Bo[z]?be(kt,_,Fo,2):z--)}}},be=(g,b,_,S,N=null)=>{const{el:R,type:x,transition:H,children:L,shapeFlag:k}=g;if(k&6){be(g.component.subTree,b,_,S);return}if(k&128){g.suspense.move(b,_,S);return}if(k&64){x.move(g,b,_,ee);return}if(x===ge){r(R,b,_);for(let K=0;K<L.length;K++)be(L[K],b,_,S);r(g.anchor,b,_);return}if(x===ys){v(g,b,_);return}if(S!==2&&k&1&&H)if(S===0)H.beforeEnter(R),r(R,b,_),Qe(()=>H.enter(R),N);else{const{leave:K,delayLeave:X,afterLeave:se}=H,I=()=>{g.ctx.isUnmounted?s(R):r(R,b,_)},U=()=>{R._isLeaving&&R[Ot](!0),K(R,()=>{I(),se&&se()})};X?X(R,I,U):U()}else r(R,b,_)},ye=(g,b,_,S=!1,N=!1)=>{const{type:R,props:x,ref:H,children:L,dynamicChildren:k,shapeFlag:te,patchFlag:K,dirs:X,cacheIndex:se,memo:I}=g;if(K===-2&&(N=!1),H!=null&&(zt(),vr(H,null,_,g,!0),Jt()),se!=null&&(b.renderCache[se]=void 0),te&256){b.ctx.deactivate(g);return}const U=te&1&&X,z=!Yn(g);let ie;if(z&&(ie=x&&x.onVnodeBeforeUnmount)&&At(ie,b,g),te&6)Be(g.component,_,S);else{if(te&128){g.suspense.unmount(_,S);return}U&&pn(g,null,b,"beforeUnmount"),te&64?g.type.remove(g,b,_,ee,S):k&&!k.hasOnce&&(R!==ge||K>0&&K&64)?Ze(k,b,_,!1,!0):(R===ge&&K&384||!N&&te&16)&&Ze(L,b,_),S&&qe(g)}const fe=I!=null&&se==null;(z&&(ie=x&&x.onVnodeUnmounted)||U||fe)&&Qe(()=>{ie&&At(ie,b,g),U&&pn(g,null,b,"unmounted"),fe&&(g.el=null)},_)},qe=g=>{const{type:b,el:_,anchor:S,transition:N}=g;if(b===ge){Ie(_,S);return}if(b===ys){T(g);return}const R=()=>{s(_),N&&!N.persisted&&N.afterLeave&&N.afterLeave()};if(g.shapeFlag&1&&N&&!N.persisted){const{leave:x,delayLeave:H}=N,L=()=>x(_,R);H?H(g.el,R,L):L()}else R()},Ie=(g,b)=>{let _;for(;g!==b;)_=d(g),s(g),g=_;s(b)},Be=(g,b,_)=>{const{bum:S,scope:N,job:R,subTree:x,um:H,m:L,a:k}=g;aa(L),aa(k),S&&ms(S),N.stop(),R&&(R.flags|=8,ye(x,g,b,_)),H&&Qe(H,b),Qe(()=>{g.isUnmounted=!0},b)},Ze=(g,b,_,S=!1,N=!1,R=0)=>{for(let x=R;x<g.length;x++)ye(g[x],b,_,S,N)},O=g=>{if(g.shapeFlag&6)return O(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const b=d(g.anchor||g.el),_=b&&b[yc];return _?d(_):b};let G=!1;const V=(g,b,_)=>{let S;g==null?b._vnode&&(ye(b._vnode,null,null,!0),S=b._vnode.component):m(b._vnode||null,g,b,null,null,null,_),b._vnode=g,G||(G=!0,Go(S),fc(),G=!1)},ee={p:m,um:ye,m:be,r:qe,mt:me,mc:q,pc:M,pbc:Q,n:O,o:e};return{render:V,hydrate:void 0,createApp:Fd(V)}}function _i({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function gn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function sf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function To(e,t,n=!1){const r=e.children,s=t.children;if(ne(r)&&ne(s))for(let i=0;i<r.length;i++){const o=r[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=qt(s[i]),a.el=o.el),!n&&a.patchFlag!==-2&&To(o,a)),a.type===ti&&(a.patchFlag===-1&&(a=s[i]=qt(a)),a.el=o.el),a.type===ze&&!a.el&&(a.el=o.el)}}function of(e){const t=e.slice(),n=[0];let r,s,i,o,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(s=n[n.length-1],e[s]<c){t[r]=s,n.push(r);continue}for(i=0,o=n.length-1;i<o;)a=i+o>>1,e[n[a]]<c?i=a+1:o=a;c<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Fc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Fc(t)}function aa(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?qc(t.subTree):null}const Kc=e=>e.__isSuspense;function af(e,t){t&&t.pendingBranch?ne(e)?t.effects.push(...e):t.effects.push(e):cd(e)}const ge=Symbol.for("v-fgt"),ti=Symbol.for("v-txt"),ze=Symbol.for("v-cmt"),ys=Symbol.for("v-stc"),Er=[];let at=null;function J(e=!1){Er.push(at=e?null:[])}function lf(){Er.pop(),at=Er[Er.length-1]||null}let Pr=1;function xs(e,t=!1){Pr+=e,e<0&&at&&t&&(at.hasOnce=!0)}function Wc(e){return e.dynamicChildren=Pr>0?at||Gn:null,lf(),Pr>0&&at&&at.push(e),e}function Z(e,t,n,r,s,i){return Wc($(e,t,n,r,s,i,!0))}function tr(e,t,n,r,s){return Wc(ue(e,t,n,r,s,!0))}function Lr(e){return e?e.__v_isVNode===!0:!1}function Sn(e,t){return e.type===t.type&&e.key===t.key}const Vc=({key:e})=>e??null,_s=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Te(e)||Ce(e)||le(e)?{i:Ve,r:e,k:t,f:!!n}:e:null);function $(e,t=null,n=null,r=0,s=null,i=e===ge?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Vc(t),ref:t&&_s(t),scopeId:gc,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ve};return a?(Ro(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Te(n)?8:16),Pr>0&&!o&&at&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&at.push(l),l}const ue=cf;function cf(e,t=null,n=null,r=0,s=null,i=!1){if((!e||e===Pd)&&(e=ze),Lr(e)){const a=un(e,t,!0);return n&&Ro(a,n),Pr>0&&!i&&at&&(a.shapeFlag&6?at[at.indexOf(e)]=a:at.push(a)),a.patchFlag=-2,a}if(wf(e)&&(e=e.__vccOpts),t){t=uf(t);let{class:a,style:l}=t;a&&!Te(a)&&(t.class=ft(a)),we(l)&&(Ys(l)&&!ne(l)&&(l=Ue({},l)),t.style=zs(l))}const o=Te(e)?1:Kc(e)?128:_c(e)?64:we(e)?4:le(e)?2:0;return $(e,t,n,r,s,o,i,!0)}function uf(e){return e?Ys(e)||Mc(e)?Ue({},e):e:null}function un(e,t,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?df(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Vc(c),ref:t&&t.ref?n&&i?ne(i)?i.concat(_s(t)):[i,_s(t)]:_s(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ge?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&un(e.ssContent),ssFallback:e.ssFallback&&un(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ir(u,l.clone(u)),u}function Gc(e=" ",t=0){return ue(ti,null,e,t)}function hf(e,t){const n=ue(ys,null,e);return n.staticCount=t,n}function Je(e="",t=!1){return t?(J(),tr(ze,null,e)):ue(ze,null,e)}function It(e){return e==null||typeof e=="boolean"?ue(ze):ne(e)?ue(ge,null,e.slice()):Lr(e)?qt(e):ue(ti,null,String(e))}function qt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:un(e)}function Ro(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(ne(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Ro(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Mc(t)?t._ctx=Ve:s===3&&Ve&&(Ve.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else le(t)?(t={default:t,_ctx:Ve},n=32):(t=String(t),r&64?(n=16,t=[Gc(t)]):n=8);e.children=t,e.shapeFlag|=n}function df(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=ft([t.class,r.class]));else if(s==="style")t.style=zs([t.style,r.style]);else if(Bs(s)){const i=t[s],o=r[s];o&&i!==o&&!(ne(i)&&i.includes(o))?t[s]=i?[].concat(i,o):o:o==null&&i==null&&!Hs(s)&&(t[s]=o)}else s!==""&&(t[s]=r[s])}return t}function At(e,t,n,r=null){Et(e,t,7,[n,r])}const ff=Nc();let pf=0;function gf(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||ff,i={uid:pf++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Dc(r,s),emitsOptions:Ic(r,s),emit:null,emitted:null,propsDefaults:Ee,inheritAttrs:r.inheritAttrs,ctx:Ee,data:Ee,props:Ee,attrs:Ee,slots:Ee,refs:Ee,setupState:Ee,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=Kd.bind(null,i),e.ce&&e.ce(i),i}let Ye=null;const xo=()=>Ye||Ve;let Os,Wi;{const e=Gs(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Os=t("__VUE_INSTANCE_SETTERS__",n=>Ye=n),Wi=t("__VUE_SSR_SETTERS__",n=>$r=n)}const Qr=e=>{const t=Ye;return Os(e),e.scope.on(),()=>{e.scope.off(),Os(t)}},la=()=>{Ye&&Ye.scope.off(),Os(null)};function zc(e){return e.vnode.shapeFlag&4}let $r=!1;function mf(e,t=!1,n=!1){t&&Wi(t);const{props:r,children:s}=e.vnode,i=zc(e);Yd(e,r,i,t),ef(e,s,n||t);const o=i?bf(e,t):void 0;return t&&Wi(!1),o}function bf(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,$d);const{setup:r}=n;if(r){zt();const s=e.setupContext=r.length>1?_f(e):null,i=Qr(e),o=Yr(r,e,0,[e.props,s]),a=Dl(o);if(Jt(),i(),(a||e.sp)&&!Yn(e)&&Ac(e),a){if(o.then(la,la),t)return o.then(l=>{ca(e,l)}).catch(l=>{Zs(l,e,0)});e.asyncDep=o}else ca(e,o)}else Jc(e)}function ca(e,t,n){le(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:we(t)&&(e.setupState=uc(t)),Jc(e)}function Jc(e,t,n){const r=e.type;e.render||(e.render=r.render||$t);{const s=Qr(e);zt();try{Md(e)}finally{Jt(),s()}}}const yf={get(e,t){return Ge(e,"get",""),e[t]}};function _f(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,yf),slots:e.slots,emit:e.emit,expose:t}}function ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(uc(Eo(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wr)return wr[n](e)},has(t,n){return n in t||n in wr}})):e.proxy}function vf(e,t=!0){return le(e)?e.displayName||e.name:e.name||t&&e.__name}function wf(e){return le(e)&&"__vccOpts"in e}const Fe=(e,t)=>sd(e,t,$r);function Oo(e,t,n){try{xs(-1);const r=arguments.length;return r===2?we(t)&&!ne(t)?Lr(t)?ue(e,null,[t]):ue(e,t):ue(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Lr(n)&&(n=[n]),ue(e,t,n))}finally{xs(1)}}const Ef="3.5.34";/**
14
+ **/function Zr(e,t,n,r){try{return r?e(...r):e()}catch(s){Zs(s,t,n)}}function Et(e,t,n,r){if(ce(e)){const s=Zr(e,t,n,r);return s&&jl(s)&&s.catch(i=>{Zs(i,t,n)}),s}if(ne(e)){const s=[];for(let i=0;i<e.length;i++)s.push(Et(e[i],t,n,r));return s}}function Zs(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Se;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,c)===!1)return}a=a.parent}if(i){Jt(),Zr(i,null,10,[e,l,c]),Yt();return}}od(e,n,s,r,o)}function od(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const nt=[];let Rt=-1;const Yn=[];let sn=null,Bn=0;const uc=Promise.resolve();let ks=null;function tr(e){const t=ks||uc;return e?t.then(this?e.bind(this):e):t}function ad(e){let t=Rt+1,n=nt.length;for(;t<n;){const r=t+n>>>1,s=nt[r],i=Ir(s);i<e||i===e&&s.flags&2?t=r+1:n=r}return t}function So(e){if(!(e.flags&1)){const t=Ir(e),n=nt[nt.length-1];!n||!(e.flags&2)&&t>=Ir(n)?nt.push(e):nt.splice(ad(t),0,e),e.flags|=1,hc()}}function hc(){ks||(ks=uc.then(fc))}function ld(e){ne(e)?Yn.push(...e):sn&&e.id===-1?sn.splice(Bn+1,0,e):e.flags&1||(Yn.push(e),e.flags|=1),hc()}function Go(e,t,n=Rt+1){for(;n<nt.length;n++){const r=nt[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;nt.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function dc(e){if(Yn.length){const t=[...new Set(Yn)].sort((n,r)=>Ir(n)-Ir(r));if(Yn.length=0,sn){sn.push(...t);return}for(sn=t,Bn=0;Bn<sn.length;Bn++){const n=sn[Bn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}sn=null,Bn=0}}const Ir=e=>e.id==null?e.flags&2?-1:1/0:e.id;function fc(e){try{for(Rt=0;Rt<nt.length;Rt++){const t=nt[Rt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Zr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Rt<nt.length;Rt++){const t=nt[Rt];t&&(t.flags&=-2)}Rt=-1,nt.length=0,dc(),ks=null,(nt.length||Yn.length)&&fc()}}let Ge=null,pc=null;function As(e){const t=Ge;return Ge=e,pc=e&&e.type.__scopeId||null,t}function Mt(e,t=Ge,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Rs(-1);const i=As(t);let o;try{o=e(...s)}finally{As(i),r._d&&Rs(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function cd(e,t){if(Ge===null)return e;const n=ni(Ge),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[i,o,a,l=Se]=t[s];i&&(ce(i)&&(i={mounted:i,updated:i}),i.deep&&Vt(o),r.push({dir:i,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return e}function gn(e,t,n,r){const s=e.dirs,i=t&&t.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(Jt(),Et(l,n,8,[e.el,a,e,t]),Yt())}}function ys(e,t){if(Ze){let n=Ze.provides;const r=Ze.parent&&Ze.parent.provides;r===n&&(n=Ze.provides=Object.create(r)),n[e]=t}}function pt(e,t,n=!1){const r=Ro();if(r||On){let s=On?On._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&ce(t)?t.call(r&&r.proxy):t}}function ud(){return!!(Ro()||On)}const hd=Symbol.for("v-scx"),dd=()=>pt(hd);function un(e,t,n){return gc(e,t,n)}function gc(e,t,n=Se){const{immediate:r,deep:s,flush:i,once:o}=n,a=Be({},n),l=t&&r||!t&&i!=="post";let c;if(Mr){if(i==="sync"){const f=dd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=$t,f.resume=$t,f.pause=$t,f}}const u=Ze;a.call=(f,p,m)=>Et(f,u,p,m);let h=!1;i==="post"?a.scheduler=f=>{et(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():So(f)}),a.augmentJob=f=>{t&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=id(e,t,a);return Mr&&(c?c.push(d):l&&d()),d}function fd(e,t,n){const r=this.proxy,s=xe(e)?e.includes(".")?mc(r,e):()=>r[e]:e.bind(r,r);let i;ce(t)?i=t:(i=t.handler,n=t);const o=es(this),a=gc(s,i.bind(r),n);return o(),a}function mc(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const nn=new WeakMap,bc=Symbol("_vte"),yc=e=>e.__isTeleport,Sn=e=>e&&(e.disabled||e.disabled===""),pd=e=>e&&(e.defer||e.defer===""),zo=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jo=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Di=(e,t)=>{const n=e&&e.to;return xe(n)?t?t(n):null:n},gd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,i,o,a,l,c){const{mc:u,pc:h,pbc:d,o:{insert:f,querySelector:p,createText:m,createComment:E,parentNode:_}}=c,y=Sn(t.props);let{dynamicChildren:w}=t;const k=(N,U,S)=>{N.shapeFlag&16&&u(N.children,U,S,s,i,o,a,l)},C=(N=t)=>{const U=Sn(N.props),S=N.target=Di(N.props,p),X=Ui(S,N,m,f);S&&(o!=="svg"&&zo(S)?o="svg":o!=="mathml"&&Jo(S)&&(o="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(S),U||(k(N,S,X),dr(N,!1)))},L=N=>{const U=()=>{if(nn.get(N)===U){if(nn.delete(N),Sn(N.props)){const S=_(N.el)||n;k(N,S,N.anchor),dr(N,!0)}C(N)}};nn.set(N,U),et(U,i)};if(e==null){const N=t.el=m(""),U=t.anchor=m("");if(f(N,n,r),f(U,n,r),pd(t.props)||i&&i.pendingBranch){L(t);return}y&&(k(t,n,U),dr(t,!0)),C()}else{t.el=e.el;const N=t.anchor=e.anchor,U=nn.get(e);if(U){U.flags|=8,nn.delete(e),L(t);return}t.targetStart=e.targetStart;const S=t.target=e.target,X=t.targetAnchor=e.targetAnchor,ae=Sn(e.props),H=ae?n:S,ue=ae?N:X;if(o==="svg"||zo(S)?o="svg":(o==="mathml"||Jo(S))&&(o="mathml"),w?(d(e.dynamicChildren,w,H,s,i,o,a),To(e,t,!0)):l||h(e,t,H,ue,s,i,o,a,!1),y)ae?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):is(t,n,N,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const me=t.target=Di(t.props,p);me&&is(t,me,null,c,0)}else ae&&is(t,S,X,c,1);dr(t,y)}},remove(e,t,n,{um:r,o:{remove:s}},i){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:h,props:d}=e;let f=i||!Sn(d);const p=nn.get(e);if(p&&(p.flags|=8,nn.delete(e),f=!1),h&&(s(c),s(u)),i&&s(l),o&16)for(let m=0;m<a.length;m++){const E=a[m];r(E,t,n,f,!!E.dynamicChildren)}},move:is,hydrate:md};function is(e,t,n,{o:{insert:r},m:s},i=2){i===0&&r(e.targetAnchor,t,n);const{el:o,anchor:a,shapeFlag:l,children:c,props:u}=e,h=i===2;if(h&&r(o,t,n),!nn.has(e)&&(!h||Sn(u))&&l&16)for(let d=0;d<c.length;d++)s(c[d],t,n,2);h&&r(a,t,n)}function md(e,t,n,r,s,i,{o:{nextSibling:o,parentNode:a,querySelector:l,insert:c,createText:u}},h){function d(E,_){let y=_;for(;y;){if(y&&y.nodeType===8){if(y.data==="teleport start anchor")t.targetStart=y;else if(y.data==="teleport anchor"){t.targetAnchor=y,E._lpa=t.targetAnchor&&o(t.targetAnchor);break}}y=o(y)}}function f(E,_){_.anchor=h(o(E),_,a(E),n,r,s,i)}const p=t.target=Di(t.props,l),m=Sn(t.props);if(p){const E=p._lpa||p.firstChild;t.shapeFlag&16&&(m?(f(e,t),d(p,E),t.targetAnchor||Ui(p,t,u,c,a(e)===p?e:null)):(t.anchor=o(e),d(p,E),t.targetAnchor||Ui(p,t,u,c),h(E&&o(E),t,p,n,r,s,i))),dr(t,m)}else m&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}const bd=gd;function dr(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ui(e,t,n,r,s=null){const i=t.targetStart=n(""),o=t.targetAnchor=n("");return i[bc]=o,e&&(r(i,e,s),r(o,e,s)),o}const Ot=Symbol("_leaveCb"),lr=Symbol("_enterCb");function yd(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Xr(()=>{e.isMounted=!0}),Tc(()=>{e.isUnmounting=!0}),e}const dt=[Function,Array],_c={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:dt,onEnter:dt,onAfterEnter:dt,onEnterCancelled:dt,onBeforeLeave:dt,onLeave:dt,onAfterLeave:dt,onLeaveCancelled:dt,onBeforeAppear:dt,onAppear:dt,onAfterAppear:dt,onAppearCancelled:dt},vc=e=>{const t=e.subTree;return t.component?vc(t.component):t},_d={name:"BaseTransition",props:_c,setup(e,{slots:t}){const n=Ro(),r=yd();return()=>{const s=t.default&&Sc(t.default(),!0),i=s&&s.length?wc(s):n.subTree?Ue():void 0;if(!i)return;const o=ge(e),{mode:a}=o;if(r.isLeaving)return bi(i);const l=Yo(i);if(!l)return bi(i);let c=Bi(l,o,r,n,h=>c=h);l.type!==Ye&&Pr(l,c);let u=n.subTree&&Yo(n.subTree);if(u&&u.type!==Ye&&!kn(u,l)&&vc(n).type!==Ye){let h=Bi(u,o,r,n);if(Pr(u,h),a==="out-in"&&l.type!==Ye)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,u=void 0},bi(i);a==="in-out"&&l.type!==Ye?h.delayLeave=(d,f,p)=>{const m=Ec(r,u);m[String(u.key)]=u,d[Ot]=()=>{f(),d[Ot]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function wc(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ye){t=n;break}}return t}const vd=_d;function Ec(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Bi(e,t,n,r,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:m,onBeforeAppear:E,onAppear:_,onAfterAppear:y,onAppearCancelled:w}=t,k=String(e.key),C=Ec(n,e),L=(S,X)=>{S&&Et(S,r,9,X)},N=(S,X)=>{const ae=X[1];L(S,X),ne(S)?S.every(H=>H.length<=1)&&ae():S.length<=1&&ae()},U={mode:o,persisted:a,beforeEnter(S){let X=l;if(!n.isMounted)if(i)X=E||l;else return;S[Ot]&&S[Ot](!0);const ae=C[k];ae&&kn(e,ae)&&ae.el[Ot]&&ae.el[Ot](),L(X,[S])},enter(S){if(C[k]===e)return;let X=c,ae=u,H=h;if(!n.isMounted)if(i)X=_||c,ae=y||u,H=w||h;else return;let ue=!1;S[lr]=Ne=>{ue||(ue=!0,Ne?L(H,[S]):L(ae,[S]),U.delayedLeave&&U.delayedLeave(),S[lr]=void 0)};const me=S[lr].bind(null,!1);X?N(X,[S,me]):me()},leave(S,X){const ae=String(e.key);if(S[lr]&&S[lr](!0),n.isUnmounting)return X();L(d,[S]);let H=!1;S[Ot]=me=>{H||(H=!0,X(),me?L(m,[S]):L(p,[S]),S[Ot]=void 0,C[ae]===e&&delete C[ae])};const ue=S[Ot].bind(null,!1);C[ae]=e,f?N(f,[S,ue]):ue()},clone(S){const X=Bi(S,t,n,r,s);return s&&s(X),X}};return U}function bi(e){if(Xs(e))return e=hn(e),e.children=null,e}function Yo(e){if(!Xs(e))return yc(e.type)&&e.children?wc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ce(n.default))return n.default()}}function Pr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Pr(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 Sc(e,t=!1,n){let r=[],s=0;for(let i=0;i<e.length;i++){let o=e[i];const a=n==null?o.key:String(n)+String(o.key!=null?o.key:i);o.type===fe?(o.patchFlag&128&&s++,r=r.concat(Sc(o.children,t,a))):(t||o.type!==Ye)&&r.push(a!=null?hn(o,{key:a}):o)}if(s>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function fn(e,t){return ce(e)?Be({name:e.name},t,{setup:e}):e}function kc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zo(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Ts=new WeakMap;function vr(e,t,n,r,s=!1){if(ne(e)){e.forEach((m,E)=>vr(m,t&&(ne(t)?t[E]:t),n,r,s));return}if(Zn(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vr(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?ni(r.component):r.el,o=s?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===Se?a.refs={}:a.refs,h=a.setupState,d=ge(h),f=h===Se?Ml:m=>Zo(u,m)?!1:we(d,m),p=(m,E)=>!(E&&Zo(u,E));if(c!=null&&c!==l){if(Xo(t),xe(c))u[c]=null,f(c)&&(h[c]=null);else if(Ce(c)){const m=t;p(c,m.k)&&(c.value=null),m.k&&(u[m.k]=null)}}if(ce(l))Zr(l,a,12,[o,u]);else{const m=xe(l),E=Ce(l);if(m||E){const _=()=>{if(e.f){const y=m?f(l)?h[l]:u[l]:p()||!e.k?l.value:u[e.k];if(s)ne(y)&&go(y,i);else if(ne(y))y.includes(i)||y.push(i);else if(m)u[l]=[i],f(l)&&(h[l]=u[l]);else{const w=[i];p(l,e.k)&&(l.value=w),e.k&&(u[e.k]=w)}}else m?(u[l]=o,f(l)&&(h[l]=o)):E&&(p(l,e.k)&&(l.value=o),e.k&&(u[e.k]=o))};if(o){const y=()=>{_(),Ts.delete(e)};y.id=-1,Ts.set(e,y),et(y,n)}else Xo(e),_()}}}function Xo(e){const t=Ts.get(e);t&&(t.flags|=8,Ts.delete(e))}Gs().requestIdleCallback;Gs().cancelIdleCallback;const Zn=e=>!!e.type.__asyncLoader,Xs=e=>e.type.__isKeepAlive;function wd(e,t){Ac(e,"a",t)}function Ed(e,t){Ac(e,"da",t)}function Ac(e,t,n=Ze){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Qs(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Xs(s.parent.vnode)&&Sd(r,t,n,s),s=s.parent}}function Sd(e,t,n,r){const s=Qs(t,e,r,!0);Qr(()=>{go(r[t],s)},n)}function Qs(e,t,n=Ze,r=!1){if(n){const s=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{Jt();const a=es(n),l=Et(t,n,e,o);return a(),Yt(),l});return r?s.unshift(i):s.push(i),i}}const Xt=e=>(t,n=Ze)=>{(!Mr||e==="sp")&&Qs(e,(...r)=>t(...r),n)},kd=Xt("bm"),Xr=Xt("m"),Ad=Xt("bu"),Td=Xt("u"),Tc=Xt("bum"),Qr=Xt("um"),xd=Xt("sp"),Rd=Xt("rtg"),Od=Xt("rtc");function Cd(e,t=Ze){Qs("ec",e,t)}const Nd="components";function ow(e,t){return Pd(Nd,e,!0,t)||e}const Id=Symbol.for("v-ndc");function Pd(e,t,n=!0,r=!1){const s=Ge||Ze;if(s){const i=s.type;{const a=_f(i,!1);if(a&&(a===t||a===rt(t)||a===Ws(rt(t))))return i}const o=Qo(s[e]||i[e],t)||Qo(s.appContext[e],t);return!o&&r?i:o}}function Qo(e,t){return e&&(e[t]||e[rt(t)]||e[Ws(rt(t))])}function zt(e,t,n,r){let s;const i=n,o=ne(e);if(o||xe(e)){const a=o&&Gt(e);let l=!1,c=!1;a&&(l=!lt(e),c=Zt(e),e=Js(e)),s=new Array(e.length);for(let u=0,h=e.length;u<h;u++)s[u]=t(l?c?er(wt(e[u])):wt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,i)}else if(Ee(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,i));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=t(e[u],u,l,i)}}else s=[];return s}function aw(e,t,n={},r,s){if(Ge.ce||Ge.parent&&Zn(Ge.parent)&&Ge.parent.ce){const c=Object.keys(n).length>0;return W(),nr(fe,null,[le("slot",n,r)],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),W();const o=i&&xc(i(n)),a=n.key||o&&o.key,l=nr(fe,{key:(a&&!ut(a)?a:`_${t}`)+(!o&&r?"_fb":"")},o||[],o&&e._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function xc(e){return e.some(t=>$r(t)?!(t.type===Ye||t.type===fe&&!xc(t.children)):!0)?e:null}const Hi=e=>e?Gc(e)?ni(e):Hi(e.parent):null,wr=Be(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=>Hi(e.parent),$root:e=>Hi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Oc(e),$forceUpdate:e=>e.f||(e.f=()=>{So(e.update)}),$nextTick:e=>e.n||(e.n=tr.bind(e.proxy)),$watch:e=>fd.bind(e)}),yi=(e,t)=>e!==Se&&!e.__isScriptSetup&&we(e,t),Ld={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:i,accessCache:o,type:a,appContext:l}=e;if(t[0]!=="$"){const d=o[t];if(d!==void 0)switch(d){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return i[t]}else{if(yi(r,t))return o[t]=1,r[t];if(s!==Se&&we(s,t))return o[t]=2,s[t];if(we(i,t))return o[t]=3,i[t];if(n!==Se&&we(n,t))return o[t]=4,n[t];Fi&&(o[t]=0)}}const c=wr[t];let u,h;if(c)return t==="$attrs"&&Je(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Se&&we(n,t))return o[t]=4,n[t];if(h=l.config.globalProperties,we(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:i}=e;return yi(s,t)?(s[t]=n,!0):r!==Se&&we(r,t)?(r[t]=n,!0):we(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:i,type:o}},a){let l;return!!(n[a]||e!==Se&&a[0]!=="$"&&we(e,a)||yi(t,a)||we(i,a)||we(r,a)||we(wr,a)||we(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:we(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ea(e){return ne(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Fi=!0;function $d(e){const t=Oc(e),n=e.proxy,r=e.ctx;Fi=!1,t.beforeCreate&&ta(t.beforeCreate,e,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:p,activated:m,deactivated:E,beforeDestroy:_,beforeUnmount:y,destroyed:w,unmounted:k,render:C,renderTracked:L,renderTriggered:N,errorCaptured:U,serverPrefetch:S,expose:X,inheritAttrs:ae,components:H,directives:ue,filters:me}=t;if(c&&Md(c,r,null),o)for(const j in o){const B=o[j];ce(B)&&(r[j]=B.bind(n))}if(s){const j=s.call(n,n);Ee(j)&&(e.data=Yr(j))}if(Fi=!0,i)for(const j in i){const B=i[j],re=ce(B)?B.bind(n,n):ce(B.get)?B.get.bind(n,n):$t,he=!ce(B)&&ce(B.set)?B.set.bind(n):$t,be=qe({get:re,set:he});Object.defineProperty(r,j,{enumerable:!0,configurable:!0,get:()=>be.value,set:ye=>be.value=ye})}if(a)for(const j in a)Rc(a[j],r,n,j);if(l){const j=ce(l)?l.call(n):l;Reflect.ownKeys(j).forEach(B=>{ys(B,j[B])})}u&&ta(u,e,"c");function x(j,B){ne(B)?B.forEach(re=>j(re.bind(n))):B&&j(B.bind(n))}if(x(kd,h),x(Xr,d),x(Ad,f),x(Td,p),x(wd,m),x(Ed,E),x(Cd,U),x(Od,L),x(Rd,N),x(Tc,y),x(Qr,k),x(xd,S),ne(X))if(X.length){const j=e.exposed||(e.exposed={});X.forEach(B=>{Object.defineProperty(j,B,{get:()=>n[B],set:re=>n[B]=re,enumerable:!0})})}else e.exposed||(e.exposed={});C&&e.render===$t&&(e.render=C),ae!=null&&(e.inheritAttrs=ae),H&&(e.components=H),ue&&(e.directives=ue),S&&kc(e)}function Md(e,t,n=$t){ne(e)&&(e=qi(e));for(const r in e){const s=e[r];let i;Ee(s)?"default"in s?i=pt(s.from||r,s.default,!0):i=pt(s.from||r):i=pt(s),Ce(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[r]=i}}function ta(e,t,n){Et(ne(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Rc(e,t,n,r){let s=r.includes(".")?mc(n,r):()=>n[r];if(xe(e)){const i=t[e];ce(i)&&un(s,i)}else if(ce(e))un(s,e.bind(n));else if(Ee(e))if(ne(e))e.forEach(i=>Rc(i,t,n,r));else{const i=ce(e.handler)?e.handler.bind(n):t[e.handler];ce(i)&&un(s,i,e)}}function Oc(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,a=i.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(c=>xs(l,c,o,!0)),xs(l,t,o)),Ee(t)&&i.set(t,l),l}function xs(e,t,n,r=!1){const{mixins:s,extends:i}=t;i&&xs(e,i,n,!0),s&&s.forEach(o=>xs(e,o,n,!0));for(const o in t)if(!(r&&o==="expose")){const a=jd[o]||n&&n[o];e[o]=a?a(e[o],t[o]):t[o]}return e}const jd={data:na,props:ra,emits:ra,methods:fr,computed:fr,beforeCreate:Qe,created:Qe,beforeMount:Qe,mounted:Qe,beforeUpdate:Qe,updated:Qe,beforeDestroy:Qe,beforeUnmount:Qe,destroyed:Qe,unmounted:Qe,activated:Qe,deactivated:Qe,errorCaptured:Qe,serverPrefetch:Qe,components:fr,directives:fr,watch:Ud,provide:na,inject:Dd};function na(e,t){return t?e?function(){return Be(ce(e)?e.call(this,this):e,ce(t)?t.call(this,this):t)}:t:e}function Dd(e,t){return fr(qi(e),qi(t))}function qi(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qe(e,t){return e?[...new Set([].concat(e,t))]:t}function fr(e,t){return e?Be(Object.create(null),e,t):t}function ra(e,t){return e?ne(e)&&ne(t)?[...new Set([...e,...t])]:Be(Object.create(null),ea(e),ea(t??{})):t}function Ud(e,t){if(!e)return t;if(!t)return e;const n=Be(Object.create(null),e);for(const r in t)n[r]=Qe(e[r],t[r]);return n}function Cc(){return{app:null,config:{isNativeTag:Ml,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 Bd=0;function Hd(e,t){return function(r,s=null){ce(r)||(r=Be({},r)),s!=null&&!Ee(s)&&(s=null);const i=Cc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Bd++,_component:r,_props:s,_container:null,_context:i,_instance:null,version:wf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&ce(u.install)?(o.add(u),u.install(c,...h)):ce(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||le(r,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),e(f,u,d),l=!0,c._container=u,u.__vue_app__=c,ni(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Et(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=On;On=c;try{return u()}finally{On=h}}};return c}}let On=null;const Fd=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${rt(t)}Modifiers`]||e[`${dn(t)}Modifiers`];function qd(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Se;let s=n;const i=t.startsWith("update:"),o=i&&Fd(r,t.slice(7));o&&(o.trim&&(s=n.map(u=>xe(u)?u.trim():u)),o.number&&(s=n.map(Vs)));let a,l=r[a=di(t)]||r[a=di(rt(t))];!l&&i&&(l=r[a=di(dn(t))]),l&&Et(l,e,6,s);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Et(c,e,6,s)}}const Kd=new WeakMap;function Nc(e,t,n=!1){const r=n?Kd:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const i=e.emits;let o={},a=!1;if(!ce(e)){const l=c=>{const u=Nc(c,t,!0);u&&(a=!0,Be(o,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Ee(e)&&r.set(e,null),null):(ne(i)?i.forEach(l=>o[l]=null):Be(o,i),Ee(e)&&r.set(e,o),o)}function ei(e,t){return!e||!Bs(t)?!1:(t=t.slice(2).replace(/Once$/,""),we(e,t[0].toLowerCase()+t.slice(1))||we(e,dn(t))||we(e,t))}function sa(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:p,inheritAttrs:m}=e,E=As(e);let _,y;try{if(n.shapeFlag&4){const k=s||r,C=k;_=It(c.call(C,k,u,h,f,d,p)),y=a}else{const k=t;_=It(k.length>1?k(h,{attrs:a,slots:o,emit:l}):k(h,null)),y=t.props?a:Wd(a)}}catch(k){Er.length=0,Zs(k,e,1),_=le(Ye)}let w=_;if(y&&m!==!1){const k=Object.keys(y),{shapeFlag:C}=w;k.length&&C&7&&(i&&k.some(Hs)&&(y=Vd(y,i)),w=hn(w,y,!1,!0))}return n.dirs&&(w=hn(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&Pr(w,n.transition),_=w,As(E),_}const Wd=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bs(n))&&((t||(t={}))[n]=e[n]);return t},Vd=(e,t)=>{const n={};for(const r in e)(!Hs(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Gd(e,t,n){const{props:r,children:s,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?ia(r,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Ic(o,r,d)&&!ei(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?ia(r,o,c):!0:!!o;return!1}function ia(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const i=r[s];if(Ic(t,e,i)&&!ei(n,i))return!0}return!1}function Ic(e,t,n){const r=e[n],s=t[n];return n==="style"&&Ee(r)&&Ee(s)?!Jr(r,s):r!==s}function zd({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Pc={},Lc=()=>Object.create(Pc),$c=e=>Object.getPrototypeOf(e)===Pc;function Jd(e,t,n,r=!1){const s={},i=Lc();e.propsDefaults=Object.create(null),Mc(e,t,s,i);for(const o in e.propsOptions[0])o in s||(s[o]=void 0);n?e.props=r?s:ac(s):e.type.props?e.props=s:e.props=i,e.attrs=i}function Yd(e,t,n,r){const{props:s,attrs:i,vnode:{patchFlag:o}}=e,a=ge(s),[l]=e.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(ei(e.emitsOptions,d))continue;const f=t[d];if(l)if(we(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=rt(d);s[p]=Ki(l,a,p,f,e,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Mc(e,t,s,i)&&(c=!0);let u;for(const h in a)(!t||!we(t,h)&&((u=dn(h))===h||!we(t,u)))&&(l?n&&(n[h]!==void 0||n[u]!==void 0)&&(s[h]=Ki(l,a,h,void 0,e,!0)):delete s[h]);if(i!==a)for(const h in i)(!t||!we(t,h))&&(delete i[h],c=!0)}c&&Wt(e.attrs,"set","")}function Mc(e,t,n,r){const[s,i]=e.propsOptions;let o=!1,a;if(t)for(let l in t){if(br(l))continue;const c=t[l];let u;s&&we(s,u=rt(l))?!i||!i.includes(u)?n[u]=c:(a||(a={}))[u]=c:ei(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=ge(n),c=a||Se;for(let u=0;u<i.length;u++){const h=i[u];n[h]=Ki(s,l,h,c[h],e,!we(c,h))}}return o}function Ki(e,t,n,r,s,i){const o=e[n];if(o!=null){const a=we(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ce(l)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=es(s);r=c[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===dn(n))&&(r=!0))}return r}const Zd=new WeakMap;function jc(e,t,n=!1){const r=n?Zd:t.propsCache,s=r.get(e);if(s)return s;const i=e.props,o={},a=[];let l=!1;if(!ce(e)){const u=h=>{l=!0;const[d,f]=jc(h,t,!0);Be(o,d),f&&a.push(...f)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return Ee(e)&&r.set(e,zn),zn;if(ne(i))for(let u=0;u<i.length;u++){const h=rt(i[u]);oa(h)&&(o[h]=Se)}else if(i)for(const u in i){const h=rt(u);if(oa(h)){const d=i[u],f=o[h]=ne(d)||ce(d)?{type:d}:Be({},d),p=f.type;let m=!1,E=!0;if(ne(p))for(let _=0;_<p.length;++_){const y=p[_],w=ce(y)&&y.name;if(w==="Boolean"){m=!0;break}else w==="String"&&(E=!1)}else m=ce(p)&&p.name==="Boolean";f[0]=m,f[1]=E,(m||we(f,"default"))&&a.push(h)}}const c=[o,a];return Ee(e)&&r.set(e,c),c}function oa(e){return e[0]!=="$"&&!br(e)}const ko=e=>e==="_"||e==="_ctx"||e==="$stable",Ao=e=>ne(e)?e.map(It):[It(e)],Xd=(e,t,n)=>{if(t._n)return t;const r=Mt((...s)=>Ao(t(...s)),n);return r._c=!1,r},Dc=(e,t,n)=>{const r=e._ctx;for(const s in e){if(ko(s))continue;const i=e[s];if(ce(i))t[s]=Xd(s,i,r);else if(i!=null){const o=Ao(i);t[s]=()=>o}}},Uc=(e,t)=>{const n=Ao(t);e.slots.default=()=>n},Bc=(e,t,n)=>{for(const r in t)(n||!ko(r))&&(e[r]=t[r])},Qd=(e,t,n)=>{const r=e.slots=Lc();if(e.vnode.shapeFlag&32){const s=t._;s?(Bc(r,t,n),n&&Bl(r,"_",s,!0)):Dc(t,r)}else t&&Uc(e,t)},ef=(e,t,n)=>{const{vnode:r,slots:s}=e;let i=!0,o=Se;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Bc(s,t,n):(i=!t.$stable,Dc(t,s)),o=t}else t&&(Uc(e,t),o={default:1});if(i)for(const a in s)!ko(a)&&o[a]==null&&delete s[a]},et=of;function tf(e){return nf(e)}function nf(e,t){const n=Gs();n.__VUE__=!0;const{insert:r,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=$t,insertStaticContent:p}=e,m=(g,b,v,A=null,P=null,R=null,O=void 0,q=null,D=!!b.dynamicChildren)=>{if(g===b)return;g&&!kn(g,b)&&(A=I(g),ye(g,P,R,!0),g=null),b.patchFlag===-2&&(D=!1,b.dynamicChildren=null);const{type:T,ref:te,shapeFlag:K}=b;switch(T){case ti:E(g,b,v,A);break;case Ye:_(g,b,v,A);break;case _s:g==null&&y(b,v,A,O);break;case fe:H(g,b,v,A,P,R,O,q,D);break;default:K&1?C(g,b,v,A,P,R,O,q,D):K&6?ue(g,b,v,A,P,R,O,q,D):(K&64||K&128)&&T.process(g,b,v,A,P,R,O,q,D,ee)}te!=null&&P?vr(te,g&&g.ref,R,b||g,!b):te==null&&g&&g.ref!=null&&vr(g.ref,null,R,g,!0)},E=(g,b,v,A)=>{if(g==null)r(b.el=a(b.children),v,A);else{const P=b.el=g.el;b.children!==g.children&&c(P,b.children)}},_=(g,b,v,A)=>{g==null?r(b.el=l(b.children||""),v,A):b.el=g.el},y=(g,b,v,A)=>{[g.el,g.anchor]=p(g.children,b,v,A,g.el,g.anchor)},w=({el:g,anchor:b},v,A)=>{let P;for(;g&&g!==b;)P=d(g),r(g,v,A),g=P;r(b,v,A)},k=({el:g,anchor:b})=>{let v;for(;g&&g!==b;)v=d(g),s(g),g=v;s(b)},C=(g,b,v,A,P,R,O,q,D)=>{if(b.type==="svg"?O="svg":b.type==="math"&&(O="mathml"),g==null)L(b,v,A,P,R,O,q,D);else{const T=g.el&&g.el._isVueCE?g.el:null;try{T&&T._beginPatch(),S(g,b,P,R,O,q,D)}finally{T&&T._endPatch()}}},L=(g,b,v,A,P,R,O,q)=>{let D,T;const{props:te,shapeFlag:K,transition:Q,dirs:se}=g;if(D=g.el=o(g.type,R,te&&te.is,te),K&8?u(D,g.children):K&16&&U(g.children,D,null,A,P,_i(g,R),O,q),se&&gn(g,null,A,"created"),N(D,g,g.scopeId,O,A),te){for(const F in te)F!=="value"&&!br(F)&&i(D,F,null,te[F],R,A);"value"in te&&i(D,"value",null,te.value,R),(T=te.onVnodeBeforeMount)&&At(T,A,g)}se&&gn(g,null,A,"beforeMount");const $=rf(P,Q);$&&Q.beforeEnter(D),r(D,b,v),((T=te&&te.onVnodeMounted)||$||se)&&et(()=>{try{T&&At(T,A,g),$&&Q.enter(D),se&&gn(g,null,A,"mounted")}finally{}},P)},N=(g,b,v,A,P)=>{if(v&&f(g,v),A)for(let R=0;R<A.length;R++)f(g,A[R]);if(P){let R=P.subTree;if(b===R||qc(R.type)&&(R.ssContent===b||R.ssFallback===b)){const O=P.vnode;N(g,O,O.scopeId,O.slotScopeIds,P.parent)}}},U=(g,b,v,A,P,R,O,q,D=0)=>{for(let T=D;T<g.length;T++){const te=g[T]=q?Kt(g[T]):It(g[T]);m(null,te,b,v,A,P,R,O,q)}},S=(g,b,v,A,P,R,O)=>{const q=b.el=g.el;let{patchFlag:D,dynamicChildren:T,dirs:te}=b;D|=g.patchFlag&16;const K=g.props||Se,Q=b.props||Se;let se;if(v&&mn(v,!1),(se=Q.onVnodeBeforeUpdate)&&At(se,v,b,g),te&&gn(b,g,v,"beforeUpdate"),v&&mn(v,!0),(K.innerHTML&&Q.innerHTML==null||K.textContent&&Q.textContent==null)&&u(q,""),T?X(g.dynamicChildren,T,q,v,A,_i(b,P),R):O||B(g,b,q,null,v,A,_i(b,P),R,!1),D>0){if(D&16)ae(q,K,Q,v,P);else if(D&2&&K.class!==Q.class&&i(q,"class",null,Q.class,P),D&4&&i(q,"style",K.style,Q.style,P),D&8){const $=b.dynamicProps;for(let F=0;F<$.length;F++){const Y=$[F],ie=K[Y],pe=Q[Y];(pe!==ie||Y==="value")&&i(q,Y,ie,pe,P,v)}}D&1&&g.children!==b.children&&u(q,b.children)}else!O&&T==null&&ae(q,K,Q,v,P);((se=Q.onVnodeUpdated)||te)&&et(()=>{se&&At(se,v,b,g),te&&gn(b,g,v,"updated")},A)},X=(g,b,v,A,P,R,O)=>{for(let q=0;q<b.length;q++){const D=g[q],T=b[q],te=D.el&&(D.type===fe||!kn(D,T)||D.shapeFlag&198)?h(D.el):v;m(D,T,te,null,A,P,R,O,!0)}},ae=(g,b,v,A,P)=>{if(b!==v){if(b!==Se)for(const R in b)!br(R)&&!(R in v)&&i(g,R,b[R],null,P,A);for(const R in v){if(br(R))continue;const O=v[R],q=b[R];O!==q&&R!=="value"&&i(g,R,q,O,P,A)}"value"in v&&i(g,"value",b.value,v.value,P)}},H=(g,b,v,A,P,R,O,q,D)=>{const T=b.el=g?g.el:a(""),te=b.anchor=g?g.anchor:a("");let{patchFlag:K,dynamicChildren:Q,slotScopeIds:se}=b;se&&(q=q?q.concat(se):se),g==null?(r(T,v,A),r(te,v,A),U(b.children||[],v,te,P,R,O,q,D)):K>0&&K&64&&Q&&g.dynamicChildren&&g.dynamicChildren.length===Q.length?(X(g.dynamicChildren,Q,v,P,R,O,q),(b.key!=null||P&&b===P.subTree)&&To(g,b,!0)):B(g,b,v,te,P,R,O,q,D)},ue=(g,b,v,A,P,R,O,q,D)=>{b.slotScopeIds=q,g==null?b.shapeFlag&512?P.ctx.activate(b,v,A,O,D):me(b,v,A,P,R,O,D):Ne(g,b,D)},me=(g,b,v,A,P,R,O)=>{const q=g.component=pf(g,A,P);if(Xs(g)&&(q.ctx.renderer=ee),gf(q,!1,O),q.asyncDep){if(P&&P.registerDep(q,x,O),!g.el){const D=q.subTree=le(Ye);_(null,D,b,v),g.placeholder=D.el}}else x(q,g,b,v,P,R,O)},Ne=(g,b,v)=>{const A=b.component=g.component;if(Gd(g,b,v))if(A.asyncDep&&!A.asyncResolved){j(A,b,v);return}else A.next=b,A.update();else b.el=g.el,A.vnode=b},x=(g,b,v,A,P,R,O)=>{const q=()=>{if(g.isMounted){let{next:K,bu:Q,u:se,parent:$,vnode:F}=g;{const ht=Hc(g);if(ht){K&&(K.el=F.el,j(g,K,O)),ht.asyncDep.then(()=>{et(()=>{g.isUnmounted||T()},P)});return}}let Y=K,ie;mn(g,!1),K?(K.el=F.el,j(g,K,O)):K=F,Q&&bs(Q),(ie=K.props&&K.props.onVnodeBeforeUpdate)&&At(ie,$,K,F),mn(g,!0);const pe=sa(g),Pe=g.subTree;g.subTree=pe,m(Pe,pe,h(Pe.el),I(Pe),g,P,R),K.el=pe.el,Y===null&&zd(g,pe.el),se&&et(se,P),(ie=K.props&&K.props.onVnodeUpdated)&&et(()=>At(ie,$,K,F),P)}else{let K;const{el:Q,props:se}=b,{bm:$,m:F,parent:Y,root:ie,type:pe}=g,Pe=Zn(b);mn(g,!1),$&&bs($),!Pe&&(K=se&&se.onVnodeBeforeMount)&&At(K,Y,b),mn(g,!0);{ie.ce&&ie.ce._hasShadowRoot()&&ie.ce._injectChildStyle(pe,g.parent?g.parent.type:void 0);const ht=g.subTree=sa(g);m(null,ht,v,A,g,P,R),b.el=ht.el}if(F&&et(F,P),!Pe&&(K=se&&se.onVnodeMounted)){const ht=b;et(()=>At(K,Y,ht),P)}(b.shapeFlag&256||Y&&Zn(Y.vnode)&&Y.vnode.shapeFlag&256)&&g.a&&et(g.a,P),g.isMounted=!0,b=v=A=null}};g.scope.on();const D=g.effect=new Gl(q);g.scope.off();const T=g.update=D.run.bind(D),te=g.job=D.runIfDirty.bind(D);te.i=g,te.id=g.uid,D.scheduler=()=>So(te),mn(g,!0),T()},j=(g,b,v)=>{b.component=g;const A=g.vnode.props;g.vnode=b,g.next=null,Yd(g,b.props,A,v),ef(g,b.children,v),Jt(),Go(g),Yt()},B=(g,b,v,A,P,R,O,q,D=!1)=>{const T=g&&g.children,te=g?g.shapeFlag:0,K=b.children,{patchFlag:Q,shapeFlag:se}=b;if(Q>0){if(Q&128){he(T,K,v,A,P,R,O,q,D);return}else if(Q&256){re(T,K,v,A,P,R,O,q,D);return}}se&8?(te&16&&Xe(T,P,R),K!==T&&u(v,K)):te&16?se&16?he(T,K,v,A,P,R,O,q,D):Xe(T,P,R,!0):(te&8&&u(v,""),se&16&&U(K,v,A,P,R,O,q,D))},re=(g,b,v,A,P,R,O,q,D)=>{g=g||zn,b=b||zn;const T=g.length,te=b.length,K=Math.min(T,te);let Q;for(Q=0;Q<K;Q++){const se=b[Q]=D?Kt(b[Q]):It(b[Q]);m(g[Q],se,v,null,P,R,O,q,D)}T>te?Xe(g,P,R,!0,!1,K):U(b,v,A,P,R,O,q,D,K)},he=(g,b,v,A,P,R,O,q,D)=>{let T=0;const te=b.length;let K=g.length-1,Q=te-1;for(;T<=K&&T<=Q;){const se=g[T],$=b[T]=D?Kt(b[T]):It(b[T]);if(kn(se,$))m(se,$,v,null,P,R,O,q,D);else break;T++}for(;T<=K&&T<=Q;){const se=g[K],$=b[Q]=D?Kt(b[Q]):It(b[Q]);if(kn(se,$))m(se,$,v,null,P,R,O,q,D);else break;K--,Q--}if(T>K){if(T<=Q){const se=Q+1,$=se<te?b[se].el:A;for(;T<=Q;)m(null,b[T]=D?Kt(b[T]):It(b[T]),v,$,P,R,O,q,D),T++}}else if(T>Q)for(;T<=K;)ye(g[T],P,R,!0),T++;else{const se=T,$=T,F=new Map;for(T=$;T<=Q;T++){const it=b[T]=D?Kt(b[T]):It(b[T]);it.key!=null&&F.set(it.key,T)}let Y,ie=0;const pe=Q-$+1;let Pe=!1,ht=0;const pn=new Array(pe);for(T=0;T<pe;T++)pn[T]=0;for(T=se;T<=K;T++){const it=g[T];if(ie>=pe){ye(it,P,R,!0);continue}let kt;if(it.key!=null)kt=F.get(it.key);else for(Y=$;Y<=Q;Y++)if(pn[Y-$]===0&&kn(it,b[Y])){kt=Y;break}kt===void 0?ye(it,P,R,!0):(pn[kt-$]=T+1,kt>=ht?ht=kt:Pe=!0,m(it,b[kt],v,null,P,R,O,q,D),ie++)}const Bo=Pe?sf(pn):zn;for(Y=Bo.length-1,T=pe-1;T>=0;T--){const it=$+T,kt=b[it],Ho=b[it+1],Fo=it+1<te?Ho.el||Fc(Ho):A;pn[T]===0?m(null,kt,v,Fo,P,R,O,q,D):Pe&&(Y<0||T!==Bo[Y]?be(kt,v,Fo,2):Y--)}}},be=(g,b,v,A,P=null)=>{const{el:R,type:O,transition:q,children:D,shapeFlag:T}=g;if(T&6){be(g.component.subTree,b,v,A);return}if(T&128){g.suspense.move(b,v,A);return}if(T&64){O.move(g,b,v,ee);return}if(O===fe){r(R,b,v);for(let K=0;K<D.length;K++)be(D[K],b,v,A);r(g.anchor,b,v);return}if(O===_s){w(g,b,v);return}if(A!==2&&T&1&&q)if(A===0)q.beforeEnter(R),r(R,b,v),et(()=>q.enter(R),P);else{const{leave:K,delayLeave:Q,afterLeave:se}=q,$=()=>{g.ctx.isUnmounted?s(R):r(R,b,v)},F=()=>{R._isLeaving&&R[Ot](!0),K(R,()=>{$(),se&&se()})};Q?Q(R,$,F):F()}else r(R,b,v)},ye=(g,b,v,A=!1,P=!1)=>{const{type:R,props:O,ref:q,children:D,dynamicChildren:T,shapeFlag:te,patchFlag:K,dirs:Q,cacheIndex:se,memo:$}=g;if(K===-2&&(P=!1),q!=null&&(Jt(),vr(q,null,v,g,!0),Yt()),se!=null&&(b.renderCache[se]=void 0),te&256){b.ctx.deactivate(g);return}const F=te&1&&Q,Y=!Zn(g);let ie;if(Y&&(ie=O&&O.onVnodeBeforeUnmount)&&At(ie,b,g),te&6)He(g.component,v,A);else{if(te&128){g.suspense.unmount(v,A);return}F&&gn(g,null,b,"beforeUnmount"),te&64?g.type.remove(g,b,v,ee,A):T&&!T.hasOnce&&(R!==fe||K>0&&K&64)?Xe(T,b,v,!1,!0):(R===fe&&K&384||!P&&te&16)&&Xe(D,b,v),A&&Ke(g)}const pe=$!=null&&se==null;(Y&&(ie=O&&O.onVnodeUnmounted)||F||pe)&&et(()=>{ie&&At(ie,b,g),F&&gn(g,null,b,"unmounted"),pe&&(g.el=null)},v)},Ke=g=>{const{type:b,el:v,anchor:A,transition:P}=g;if(b===fe){Ie(v,A);return}if(b===_s){k(g);return}const R=()=>{s(v),P&&!P.persisted&&P.afterLeave&&P.afterLeave()};if(g.shapeFlag&1&&P&&!P.persisted){const{leave:O,delayLeave:q}=P,D=()=>O(v,R);q?q(g.el,R,D):D()}else R()},Ie=(g,b)=>{let v;for(;g!==b;)v=d(g),s(g),g=v;s(b)},He=(g,b,v)=>{const{bum:A,scope:P,job:R,subTree:O,um:q,m:D,a:T}=g;aa(D),aa(T),A&&bs(A),P.stop(),R&&(R.flags|=8,ye(O,g,b,v)),q&&et(q,b),et(()=>{g.isUnmounted=!0},b)},Xe=(g,b,v,A=!1,P=!1,R=0)=>{for(let O=R;O<g.length;O++)ye(g[O],b,v,A,P)},I=g=>{if(g.shapeFlag&6)return I(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const b=d(g.anchor||g.el),v=b&&b[bc];return v?d(v):b};let J=!1;const G=(g,b,v)=>{let A;g==null?b._vnode&&(ye(b._vnode,null,null,!0),A=b._vnode.component):m(b._vnode||null,g,b,null,null,null,v),b._vnode=g,J||(J=!0,Go(A),dc(),J=!1)},ee={p:m,um:ye,m:be,r:Ke,mt:me,mc:U,pc:B,pbc:X,n:I,o:e};return{render:G,hydrate:void 0,createApp:Hd(G)}}function _i({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function mn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function rf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function To(e,t,n=!1){const r=e.children,s=t.children;if(ne(r)&&ne(s))for(let i=0;i<r.length;i++){const o=r[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Kt(s[i]),a.el=o.el),!n&&a.patchFlag!==-2&&To(o,a)),a.type===ti&&(a.patchFlag===-1&&(a=s[i]=Kt(a)),a.el=o.el),a.type===Ye&&!a.el&&(a.el=o.el)}}function sf(e){const t=e.slice(),n=[0];let r,s,i,o,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(s=n[n.length-1],e[s]<c){t[r]=s,n.push(r);continue}for(i=0,o=n.length-1;i<o;)a=i+o>>1,e[n[a]]<c?i=a+1:o=a;c<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Hc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Hc(t)}function aa(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Fc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Fc(t.subTree):null}const qc=e=>e.__isSuspense;function of(e,t){t&&t.pendingBranch?ne(e)?t.effects.push(...e):t.effects.push(e):ld(e)}const fe=Symbol.for("v-fgt"),ti=Symbol.for("v-txt"),Ye=Symbol.for("v-cmt"),_s=Symbol.for("v-stc"),Er=[];let at=null;function W(e=!1){Er.push(at=e?null:[])}function af(){Er.pop(),at=Er[Er.length-1]||null}let Lr=1;function Rs(e,t=!1){Lr+=e,e<0&&at&&t&&(at.hasOnce=!0)}function Kc(e){return e.dynamicChildren=Lr>0?at||zn:null,af(),Lr>0&&at&&at.push(e),e}function z(e,t,n,r,s,i){return Kc(M(e,t,n,r,s,i,!0))}function nr(e,t,n,r,s){return Kc(le(e,t,n,r,s,!0))}function $r(e){return e?e.__v_isVNode===!0:!1}function kn(e,t){return e.type===t.type&&e.key===t.key}const Wc=({key:e})=>e??null,vs=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?xe(e)||Ce(e)||ce(e)?{i:Ge,r:e,k:t,f:!!n}:e:null);function M(e,t=null,n=null,r=0,s=null,i=e===fe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Wc(t),ref:t&&vs(t),scopeId:pc,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ge};return a?(xo(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=xe(n)?8:16),Lr>0&&!o&&at&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&at.push(l),l}const le=lf;function lf(e,t=null,n=null,r=0,s=null,i=!1){if((!e||e===Id)&&(e=Ye),$r(e)){const a=hn(e,t,!0);return n&&xo(a,n),Lr>0&&!i&&at&&(a.shapeFlag&6?at[at.indexOf(e)]=a:at.push(a)),a.patchFlag=-2,a}if(vf(e)&&(e=e.__vccOpts),t){t=cf(t);let{class:a,style:l}=t;a&&!xe(a)&&(t.class=_t(a)),Ee(l)&&(Ys(l)&&!ne(l)&&(l=Be({},l)),t.style=zs(l))}const o=xe(e)?1:qc(e)?128:yc(e)?64:Ee(e)?4:ce(e)?2:0;return M(e,t,n,r,s,o,i,!0)}function cf(e){return e?Ys(e)||$c(e)?Be({},e):e:null}function hn(e,t,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?hf(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Wc(c),ref:t&&t.ref?n&&i?ne(i)?i.concat(vs(t)):[i,vs(t)]:vs(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==fe?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&hn(e.ssContent),ssFallback:e.ssFallback&&hn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Pr(u,l.clone(u)),u}function Vc(e=" ",t=0){return le(ti,null,e,t)}function uf(e,t){const n=le(_s,null,e);return n.staticCount=t,n}function Ue(e="",t=!1){return t?(W(),nr(Ye,null,e)):le(Ye,null,e)}function It(e){return e==null||typeof e=="boolean"?le(Ye):ne(e)?le(fe,null,e.slice()):$r(e)?Kt(e):le(ti,null,String(e))}function Kt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:hn(e)}function xo(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(ne(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),xo(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!$c(t)?t._ctx=Ge:s===3&&Ge&&(Ge.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ce(t)?(t={default:t,_ctx:Ge},n=32):(t=String(t),r&64?(n=16,t=[Vc(t)]):n=8);e.children=t,e.shapeFlag|=n}function hf(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=_t([t.class,r.class]));else if(s==="style")t.style=zs([t.style,r.style]);else if(Bs(s)){const i=t[s],o=r[s];o&&i!==o&&!(ne(i)&&i.includes(o))?t[s]=i?[].concat(i,o):o:o==null&&i==null&&!Hs(s)&&(t[s]=o)}else s!==""&&(t[s]=r[s])}return t}function At(e,t,n,r=null){Et(e,t,7,[n,r])}const df=Cc();let ff=0;function pf(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||df,i={uid:ff++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Kl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:jc(r,s),emitsOptions:Nc(r,s),emit:null,emitted:null,propsDefaults:Se,inheritAttrs:r.inheritAttrs,ctx:Se,data:Se,props:Se,attrs:Se,slots:Se,refs:Se,setupState:Se,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=qd.bind(null,i),e.ce&&e.ce(i),i}let Ze=null;const Ro=()=>Ze||Ge;let Os,Wi;{const e=Gs(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Os=t("__VUE_INSTANCE_SETTERS__",n=>Ze=n),Wi=t("__VUE_SSR_SETTERS__",n=>Mr=n)}const es=e=>{const t=Ze;return Os(e),e.scope.on(),()=>{e.scope.off(),Os(t)}},la=()=>{Ze&&Ze.scope.off(),Os(null)};function Gc(e){return e.vnode.shapeFlag&4}let Mr=!1;function gf(e,t=!1,n=!1){t&&Wi(t);const{props:r,children:s}=e.vnode,i=Gc(e);Jd(e,r,i,t),Qd(e,s,n||t);const o=i?mf(e,t):void 0;return t&&Wi(!1),o}function mf(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Ld);const{setup:r}=n;if(r){Jt();const s=e.setupContext=r.length>1?yf(e):null,i=es(e),o=Zr(r,e,0,[e.props,s]),a=jl(o);if(Yt(),i(),(a||e.sp)&&!Zn(e)&&kc(e),a){if(o.then(la,la),t)return o.then(l=>{ca(e,l)}).catch(l=>{Zs(l,e,0)});e.asyncDep=o}else ca(e,o)}else zc(e)}function ca(e,t,n){ce(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ee(t)&&(e.setupState=cc(t)),zc(e)}function zc(e,t,n){const r=e.type;e.render||(e.render=r.render||$t);{const s=es(e);Jt();try{$d(e)}finally{Yt(),s()}}}const bf={get(e,t){return Je(e,"get",""),e[t]}};function yf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,bf),slots:e.slots,emit:e.emit,expose:t}}function ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(cc(Eo(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wr)return wr[n](e)},has(t,n){return n in t||n in wr}})):e.proxy}function _f(e,t=!0){return ce(e)?e.displayName||e.name:e.name||t&&e.__name}function vf(e){return ce(e)&&"__vccOpts"in e}const qe=(e,t)=>rd(e,t,Mr);function Oo(e,t,n){try{Rs(-1);const r=arguments.length;return r===2?Ee(t)&&!ne(t)?$r(t)?le(e,null,[t]):le(e,t):le(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&$r(n)&&(n=[n]),le(e,t,n))}finally{Rs(1)}}const wf="3.5.34";/**
15
15
  * @vue/runtime-dom v3.5.34
16
16
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
17
  * @license MIT
18
- **/let Vi;const ua=typeof window<"u"&&window.trustedTypes;if(ua)try{Vi=ua.createPolicy("vue",{createHTML:e=>e})}catch{}const Yc=Vi?e=>Vi.createHTML(e):e=>e,Sf="http://www.w3.org/2000/svg",kf="http://www.w3.org/1998/Math/MathML",Bt=typeof document<"u"?document:null,ha=Bt&&Bt.createElement("template"),Af={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Bt.createElementNS(Sf,e):t==="mathml"?Bt.createElementNS(kf,e):n?Bt.createElement(e,{is:n}):Bt.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Bt.createTextNode(e),createComment:e=>Bt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Bt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,i){const o=n?n.previousSibling:t.lastChild;if(s&&(s===i||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{ha.innerHTML=Yc(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ha.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Qt="transition",lr="animation",Mr=Symbol("_vtc"),Zc={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},Tf=Ue({},vc,Zc),Rf=e=>(e.displayName="Transition",e.props=Tf,e),vs=Rf((e,{slots:t})=>Oo(wd,xf(e),t)),mn=(e,t=[])=>{ne(e)?e.forEach(n=>n(...t)):e&&e(...t)},da=e=>e?ne(e)?e.some(t=>t.length>1):e.length>1:!1;function xf(e){const t={};for(const F in e)F in Zc||(t[F]=e[F]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:f=`${n}-leave-to`}=e,p=Of(s),m=p&&p[0],w=p&&p[1],{onBeforeEnter:E,onEnter:y,onEnterCancelled:v,onLeave:T,onLeaveCancelled:D,onBeforeAppear:B=E,onAppear:j=y,onAppearCancelled:q=v}=t,C=(F,ce,me,Ne)=>{F._enterCancelled=Ne,bn(F,ce?u:a),bn(F,ce?c:o),me&&me()},Q=(F,ce)=>{F._isLeaving=!1,bn(F,h),bn(F,f),bn(F,d),ce&&ce()},ae=F=>(ce,me)=>{const Ne=F?j:y,A=()=>C(ce,F,me);mn(Ne,[ce,A]),fa(()=>{bn(ce,F?l:i),jt(ce,F?u:a),da(Ne)||pa(ce,r,m,A)})};return Ue(t,{onBeforeEnter(F){mn(E,[F]),jt(F,i),jt(F,o)},onBeforeAppear(F){mn(B,[F]),jt(F,l),jt(F,c)},onEnter:ae(!1),onAppear:ae(!0),onLeave(F,ce){F._isLeaving=!0;const me=()=>Q(F,ce);jt(F,h),F._enterCancelled?(jt(F,d),ba(F)):(ba(F),jt(F,d)),fa(()=>{F._isLeaving&&(bn(F,h),jt(F,f),da(T)||pa(F,r,w,me))}),mn(T,[F,me])},onEnterCancelled(F){C(F,!1,void 0,!0),mn(v,[F])},onAppearCancelled(F){C(F,!0,void 0,!0),mn(q,[F])},onLeaveCancelled(F){Q(F),mn(D,[F])}})}function Of(e){if(e==null)return null;if(we(e))return[vi(e.enter),vi(e.leave)];{const t=vi(e);return[t,t]}}function vi(e){return Eh(e)}function jt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Mr]||(e[Mr]=new Set)).add(t)}function bn(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Mr];n&&(n.delete(t),n.size||(e[Mr]=void 0))}function fa(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Cf=0;function pa(e,t,n,r){const s=e._endId=++Cf,i=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Nf(e,t);if(!o)return r();const c=o+"end";let u=0;const h=()=>{e.removeEventListener(c,d),i()},d=f=>{f.target===e&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),e.addEventListener(c,d)}function Nf(e,t){const n=window.getComputedStyle(e),r=p=>(n[p]||"").split(", "),s=r(`${Qt}Delay`),i=r(`${Qt}Duration`),o=ga(s,i),a=r(`${lr}Delay`),l=r(`${lr}Duration`),c=ga(a,l);let u=null,h=0,d=0;t===Qt?o>0&&(u=Qt,h=o,d=i.length):t===lr?c>0&&(u=lr,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?Qt:lr:null,d=u?u===Qt?i.length:l.length:0);const f=u===Qt&&/\b(?:transform|all)(?:,|$)/.test(r(`${Qt}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ga(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ma(n)+ma(e[r])))}function ma(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ba(e){return(e?e.ownerDocument:document).body.offsetHeight}function If(e,t,n){const r=e[Mr];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ya=Symbol("_vod"),Pf=Symbol("_vsh"),Lf=Symbol(""),$f=/(?:^|;)\s*display\s*:/;function Mf(e,t,n){const r=e.style,s=Te(n);let i=!1;if(n&&!s){if(t)if(Te(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&fr(r,a,"")}else for(const o in t)n[o]==null&&fr(r,o,"");for(const o in n){o==="display"&&(i=!0);const a=n[o];a!=null?Df(e,o,!Te(t)&&t?t[o]:void 0,a)||fr(r,o,a):fr(r,o,"")}}else if(s){if(t!==n){const o=r[Lf];o&&(n+=";"+o),r.cssText=n,i=$f.test(n)}}else t&&e.removeAttribute("style");ya in e&&(e[ya]=i?r.display:"",e[Pf]&&(r.display="none"))}const _a=/\s*!important$/;function fr(e,t,n){if(ne(n))n.forEach(r=>fr(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=jf(e,t);_a.test(n)?e.setProperty(hn(r),n.replace(_a,""),"important"):e[r]=n}}const va=["Webkit","Moz","ms"],wi={};function jf(e,t){const n=wi[t];if(n)return n;let r=nt(t);if(r!=="filter"&&r in e)return wi[t]=r;r=Ws(r);for(let s=0;s<va.length;s++){const i=va[s]+r;if(i in e)return wi[t]=i}return t}function Df(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Te(r)&&n===r}const wa="http://www.w3.org/1999/xlink";function Ea(e,t,n,r,s,i=xh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(wa,t.slice(6,t.length)):e.setAttributeNS(wa,t,n):n==null||i&&!Fl(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ct(n)?String(n):n)}function Sa(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Yc(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Fl(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(s||t)}function kn(e,t,n,r){e.addEventListener(t,n,r)}function Uf(e,t,n,r){e.removeEventListener(t,n,r)}const ka=Symbol("_vei");function Bf(e,t,n,r,s=null){const i=e[ka]||(e[ka]={}),o=i[t];if(r&&o)o.value=r;else{const[a,l]=Hf(t);if(r){const c=i[t]=Kf(r,s);kn(e,a,c,l)}else o&&(Uf(e,a,o,l),i[t]=void 0)}}const Aa=/(?:Once|Passive|Capture)$/;function Hf(e){let t;if(Aa.test(e)){t={};let r;for(;r=e.match(Aa);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):hn(e.slice(2)),t]}let Ei=0;const Ff=Promise.resolve(),qf=()=>Ei||(Ff.then(()=>Ei=0),Ei=Date.now());function Kf(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Et(Wf(r,n.value),t,5,[r])};return n.value=e,n.attached=qf(),n}function Wf(e,t){if(ne(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Ta=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Vf=(e,t,n,r,s,i)=>{const o=s==="svg";t==="class"?If(e,r,o):t==="style"?Mf(e,n,r):Bs(t)?Hs(t)||Bf(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Gf(e,t,r,o))?(Sa(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ea(e,t,r,o,i,t!=="value")):e._isVueCE&&(zf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Te(r)))?Sa(e,nt(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ea(e,t,r,o))};function Gf(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ta(t)&&le(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ta(t)&&Te(n)?!1:t in e}function zf(e,t){const n=e._def.props;if(!n)return!1;const r=nt(t);return Array.isArray(n)?n.some(s=>nt(s)===r):Object.keys(n).some(s=>nt(s)===r)}const Cs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ne(t)?n=>ms(t,n):t};function Jf(e){e.target.composing=!0}function Ra(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Zn=Symbol("_assign");function xa(e,t,n){return t&&(e=e.trim()),n&&(e=Vs(e)),e}const Yf={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Zn]=Cs(s);const i=r||s.props&&s.props.type==="number";kn(e,t?"change":"input",o=>{o.target.composing||e[Zn](xa(e.value,n,i))}),(n||i)&&kn(e,"change",()=>{e.value=xa(e.value,n,i)}),t||(kn(e,"compositionstart",Jf),kn(e,"compositionend",Ra),kn(e,"change",Ra))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},o){if(e[Zn]=Cs(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Vs(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},zv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=Fs(t);kn(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Vs(Ns(o)):Ns(o));e[Zn](e.multiple?s?new Set(i):i:i[0]),e._assigning=!0,er(()=>{e._assigning=!1})}),e[Zn]=Cs(r)},mounted(e,{value:t}){Oa(e,t)},beforeUpdate(e,t,n){e[Zn]=Cs(n)},updated(e,{value:t}){e._assigning||Oa(e,t)}};function Oa(e,t){const n=e.multiple,r=ne(t);if(!(n&&!r&&!Fs(t))){for(let s=0,i=e.options.length;s<i;s++){const o=e.options[s],a=Ns(o);if(n)if(r){const l=typeof a;l==="string"||l==="number"?o.selected=t.some(c=>String(c)===String(a)):o.selected=Ch(t,a)>-1}else o.selected=t.has(a);else if(zr(Ns(o),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ns(e){return"_value"in e?e._value:e.value}const Zf=["ctrl","shift","alt","meta"],Xf={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)=>Zf.some(n=>e[`${n}Key`]&&!t.includes(n))},Qf=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(s,...i)=>{for(let o=0;o<t.length;o++){const a=Xf[t[o]];if(a&&a(s,t))return}return e(s,...i)})},ep={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Jv=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=s=>{if(!("key"in s))return;const i=hn(s.key);if(t.some(o=>o===i||ep[o]===i))return e(s)})},tp=Ue({patchProp:Vf},Af);let Ca;function np(){return Ca||(Ca=nf(tp))}const rp=(...e)=>{const t=np().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=ip(r);if(!s)return;const i=t._component;!le(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,sp(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},t};function sp(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ip(e){return Te(e)?document.querySelector(e):e}/*!
18
+ **/let Vi;const ua=typeof window<"u"&&window.trustedTypes;if(ua)try{Vi=ua.createPolicy("vue",{createHTML:e=>e})}catch{}const Jc=Vi?e=>Vi.createHTML(e):e=>e,Ef="http://www.w3.org/2000/svg",Sf="http://www.w3.org/1998/Math/MathML",Ht=typeof document<"u"?document:null,ha=Ht&&Ht.createElement("template"),kf={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Ht.createElementNS(Ef,e):t==="mathml"?Ht.createElementNS(Sf,e):n?Ht.createElement(e,{is:n}):Ht.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Ht.createTextNode(e),createComment:e=>Ht.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ht.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,i){const o=n?n.previousSibling:t.lastChild;if(s&&(s===i||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{ha.innerHTML=Jc(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ha.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},en="transition",cr="animation",jr=Symbol("_vtc"),Yc={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},Af=Be({},_c,Yc),Tf=e=>(e.displayName="Transition",e.props=Af,e),Sr=Tf((e,{slots:t})=>Oo(vd,xf(e),t)),bn=(e,t=[])=>{ne(e)?e.forEach(n=>n(...t)):e&&e(...t)},da=e=>e?ne(e)?e.some(t=>t.length>1):e.length>1:!1;function xf(e){const t={};for(const H in e)H in Yc||(t[H]=e[H]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:f=`${n}-leave-to`}=e,p=Rf(s),m=p&&p[0],E=p&&p[1],{onBeforeEnter:_,onEnter:y,onEnterCancelled:w,onLeave:k,onLeaveCancelled:C,onBeforeAppear:L=_,onAppear:N=y,onAppearCancelled:U=w}=t,S=(H,ue,me,Ne)=>{H._enterCancelled=Ne,yn(H,ue?u:a),yn(H,ue?c:o),me&&me()},X=(H,ue)=>{H._isLeaving=!1,yn(H,h),yn(H,f),yn(H,d),ue&&ue()},ae=H=>(ue,me)=>{const Ne=H?N:y,x=()=>S(ue,H,me);bn(Ne,[ue,x]),fa(()=>{yn(ue,H?l:i),Dt(ue,H?u:a),da(Ne)||pa(ue,r,m,x)})};return Be(t,{onBeforeEnter(H){bn(_,[H]),Dt(H,i),Dt(H,o)},onBeforeAppear(H){bn(L,[H]),Dt(H,l),Dt(H,c)},onEnter:ae(!1),onAppear:ae(!0),onLeave(H,ue){H._isLeaving=!0;const me=()=>X(H,ue);Dt(H,h),H._enterCancelled?(Dt(H,d),ba(H)):(ba(H),Dt(H,d)),fa(()=>{H._isLeaving&&(yn(H,h),Dt(H,f),da(k)||pa(H,r,E,me))}),bn(k,[H,me])},onEnterCancelled(H){S(H,!1,void 0,!0),bn(w,[H])},onAppearCancelled(H){S(H,!0,void 0,!0),bn(U,[H])},onLeaveCancelled(H){X(H),bn(C,[H])}})}function Rf(e){if(e==null)return null;if(Ee(e))return[vi(e.enter),vi(e.leave)];{const t=vi(e);return[t,t]}}function vi(e){return wh(e)}function Dt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[jr]||(e[jr]=new Set)).add(t)}function yn(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[jr];n&&(n.delete(t),n.size||(e[jr]=void 0))}function fa(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Of=0;function pa(e,t,n,r){const s=e._endId=++Of,i=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Cf(e,t);if(!o)return r();const c=o+"end";let u=0;const h=()=>{e.removeEventListener(c,d),i()},d=f=>{f.target===e&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),e.addEventListener(c,d)}function Cf(e,t){const n=window.getComputedStyle(e),r=p=>(n[p]||"").split(", "),s=r(`${en}Delay`),i=r(`${en}Duration`),o=ga(s,i),a=r(`${cr}Delay`),l=r(`${cr}Duration`),c=ga(a,l);let u=null,h=0,d=0;t===en?o>0&&(u=en,h=o,d=i.length):t===cr?c>0&&(u=cr,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?en:cr:null,d=u?u===en?i.length:l.length:0);const f=u===en&&/\b(?:transform|all)(?:,|$)/.test(r(`${en}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ga(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ma(n)+ma(e[r])))}function ma(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ba(e){return(e?e.ownerDocument:document).body.offsetHeight}function Nf(e,t,n){const r=e[jr];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ya=Symbol("_vod"),If=Symbol("_vsh"),Pf=Symbol(""),Lf=/(?:^|;)\s*display\s*:/;function $f(e,t,n){const r=e.style,s=xe(n);let i=!1;if(n&&!s){if(t)if(xe(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&pr(r,a,"")}else for(const o in t)n[o]==null&&pr(r,o,"");for(const o in n){o==="display"&&(i=!0);const a=n[o];a!=null?jf(e,o,!xe(t)&&t?t[o]:void 0,a)||pr(r,o,a):pr(r,o,"")}}else if(s){if(t!==n){const o=r[Pf];o&&(n+=";"+o),r.cssText=n,i=Lf.test(n)}}else t&&e.removeAttribute("style");ya in e&&(e[ya]=i?r.display:"",e[If]&&(r.display="none"))}const _a=/\s*!important$/;function pr(e,t,n){if(ne(n))n.forEach(r=>pr(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Mf(e,t);_a.test(n)?e.setProperty(dn(r),n.replace(_a,""),"important"):e[r]=n}}const va=["Webkit","Moz","ms"],wi={};function Mf(e,t){const n=wi[t];if(n)return n;let r=rt(t);if(r!=="filter"&&r in e)return wi[t]=r;r=Ws(r);for(let s=0;s<va.length;s++){const i=va[s]+r;if(i in e)return wi[t]=i}return t}function jf(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&xe(r)&&n===r}const wa="http://www.w3.org/1999/xlink";function Ea(e,t,n,r,s,i=xh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(wa,t.slice(6,t.length)):e.setAttributeNS(wa,t,n):n==null||i&&!Hl(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ut(n)?String(n):n)}function Sa(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Jc(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Hl(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(s||t)}function An(e,t,n,r){e.addEventListener(t,n,r)}function Df(e,t,n,r){e.removeEventListener(t,n,r)}const ka=Symbol("_vei");function Uf(e,t,n,r,s=null){const i=e[ka]||(e[ka]={}),o=i[t];if(r&&o)o.value=r;else{const[a,l]=Bf(t);if(r){const c=i[t]=qf(r,s);An(e,a,c,l)}else o&&(Df(e,a,o,l),i[t]=void 0)}}const Aa=/(?:Once|Passive|Capture)$/;function Bf(e){let t;if(Aa.test(e)){t={};let r;for(;r=e.match(Aa);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):dn(e.slice(2)),t]}let Ei=0;const Hf=Promise.resolve(),Ff=()=>Ei||(Hf.then(()=>Ei=0),Ei=Date.now());function qf(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Et(Kf(r,n.value),t,5,[r])};return n.value=e,n.attached=Ff(),n}function Kf(e,t){if(ne(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Ta=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Wf=(e,t,n,r,s,i)=>{const o=s==="svg";t==="class"?Nf(e,r,o):t==="style"?$f(e,n,r):Bs(t)?Hs(t)||Uf(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Vf(e,t,r,o))?(Sa(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ea(e,t,r,o,i,t!=="value")):e._isVueCE&&(Gf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!xe(r)))?Sa(e,rt(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ea(e,t,r,o))};function Vf(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ta(t)&&ce(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ta(t)&&xe(n)?!1:t in e}function Gf(e,t){const n=e._def.props;if(!n)return!1;const r=rt(t);return Array.isArray(n)?n.some(s=>rt(s)===r):Object.keys(n).some(s=>rt(s)===r)}const Cs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ne(t)?n=>bs(t,n):t};function zf(e){e.target.composing=!0}function xa(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Xn=Symbol("_assign");function Ra(e,t,n){return t&&(e=e.trim()),n&&(e=Vs(e)),e}const Jf={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Xn]=Cs(s);const i=r||s.props&&s.props.type==="number";An(e,t?"change":"input",o=>{o.target.composing||e[Xn](Ra(e.value,n,i))}),(n||i)&&An(e,"change",()=>{e.value=Ra(e.value,n,i)}),t||(An(e,"compositionstart",zf),An(e,"compositionend",xa),An(e,"change",xa))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},o){if(e[Xn]=Cs(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Vs(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},lw={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=Fs(t);An(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Vs(Ns(o)):Ns(o));e[Xn](e.multiple?s?new Set(i):i:i[0]),e._assigning=!0,tr(()=>{e._assigning=!1})}),e[Xn]=Cs(r)},mounted(e,{value:t}){Oa(e,t)},beforeUpdate(e,t,n){e[Xn]=Cs(n)},updated(e,{value:t}){e._assigning||Oa(e,t)}};function Oa(e,t){const n=e.multiple,r=ne(t);if(!(n&&!r&&!Fs(t))){for(let s=0,i=e.options.length;s<i;s++){const o=e.options[s],a=Ns(o);if(n)if(r){const l=typeof a;l==="string"||l==="number"?o.selected=t.some(c=>String(c)===String(a)):o.selected=Oh(t,a)>-1}else o.selected=t.has(a);else if(Jr(Ns(o),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ns(e){return"_value"in e?e._value:e.value}const Yf=["ctrl","shift","alt","meta"],Zf={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)=>Yf.some(n=>e[`${n}Key`]&&!t.includes(n))},Xf=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(s,...i)=>{for(let o=0;o<t.length;o++){const a=Zf[t[o]];if(a&&a(s,t))return}return e(s,...i)})},Qf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},cw=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=s=>{if(!("key"in s))return;const i=dn(s.key);if(t.some(o=>o===i||Qf[o]===i))return e(s)})},ep=Be({patchProp:Wf},kf);let Ca;function tp(){return Ca||(Ca=tf(ep))}const np=(...e)=>{const t=tp().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=sp(r);if(!s)return;const i=t._component;!ce(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,rp(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},t};function rp(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function sp(e){return xe(e)?document.querySelector(e):e}/*!
19
19
  * pinia v2.3.1
20
20
  * (c) 2025 Eduardo San Martin Morote
21
21
  * @license MIT
22
- */let Xc;const ri=e=>Xc=e,Qc=Symbol();function Gi(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Sr;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Sr||(Sr={}));function op(){const e=Vl(!0),t=e.run(()=>Ae({}));let n=[],r=[];const s=Eo({install(i){ri(s),s._a=i,i.provide(Qc,s),i.config.globalProperties.$pinia=s,r.forEach(o=>n.push(o)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return s}const eu=()=>{};function Na(e,t,n,r=eu){e.push(t);const s=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),r())};return!n&&Gl()&&Nh(s),s}function Pn(e,...t){e.slice().forEach(n=>{n(...t)})}const ap=e=>e(),Ia=Symbol(),Si=Symbol();function zi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],s=e[n];Gi(s)&&Gi(r)&&e.hasOwnProperty(n)&&!Ce(r)&&!Vt(r)?e[n]=zi(s,r):e[n]=r}return e}const lp=Symbol();function cp(e){return!Gi(e)||!e.hasOwnProperty(lp)}const{assign:nn}=Object;function up(e){return!!(Ce(e)&&e.effect)}function hp(e,t,n,r){const{state:s,actions:i,getters:o}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=s?s():{});const u=ed(n.state.value[e]);return nn(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=Eo(Fe(()=>{ri(n);const f=n._s.get(e);return o[d].call(f,f)})),h),{}))}return l=tu(e,c,t,n,r,!0),l}function tu(e,t,n={},r,s,i){let o;const a=nn({actions:{}},n),l={deep:!0};let c,u,h=[],d=[],f;const p=r.state.value[e];!i&&!p&&(r.state.value[e]={});let m;function w(q){let C;c=u=!1,typeof q=="function"?(q(r.state.value[e]),C={type:Sr.patchFunction,storeId:e,events:f}):(zi(r.state.value[e],q),C={type:Sr.patchObject,payload:q,storeId:e,events:f});const Q=m=Symbol();er().then(()=>{m===Q&&(c=!0)}),u=!0,Pn(h,C,r.state.value[e])}const E=i?function(){const{state:C}=n,Q=C?C():{};this.$patch(ae=>{nn(ae,Q)})}:eu;function y(){o.stop(),h=[],d=[],r._s.delete(e)}const v=(q,C="")=>{if(Ia in q)return q[Si]=C,q;const Q=function(){ri(r);const ae=Array.from(arguments),F=[],ce=[];function me(P){F.push(P)}function Ne(P){ce.push(P)}Pn(d,{args:ae,name:Q[Si],store:D,after:me,onError:Ne});let A;try{A=q.apply(this&&this.$id===e?this:D,ae)}catch(P){throw Pn(ce,P),P}return A instanceof Promise?A.then(P=>(Pn(F,P),P)).catch(P=>(Pn(ce,P),Promise.reject(P))):(Pn(F,A),A)};return Q[Ia]=!0,Q[Si]=C,Q},T={_p:r,$id:e,$onAction:Na.bind(null,d),$patch:w,$reset:E,$subscribe(q,C={}){const Q=Na(h,q,C.detached,()=>ae()),ae=o.run(()=>cn(()=>r.state.value[e],F=>{(C.flush==="sync"?u:c)&&q({storeId:e,type:Sr.direct,events:f},F)},nn({},l,C)));return Q},$dispose:y},D=Jr(T);r._s.set(e,D);const j=(r._a&&r._a.runWithContext||ap)(()=>r._e.run(()=>(o=Vl()).run(()=>t({action:v}))));for(const q in j){const C=j[q];if(Ce(C)&&!up(C)||Vt(C))i||(p&&cp(C)&&(Ce(C)?C.value=p[q]:zi(C,p[q])),r.state.value[e][q]=C);else if(typeof C=="function"){const Q=v(C,q);j[q]=Q,a.actions[q]=C}}return nn(D,j),nn(pe(D),j),Object.defineProperty(D,"$state",{get:()=>r.state.value[e],set:q=>{w(C=>{nn(C,q)})}}),r._p.forEach(q=>{nn(D,o.run(()=>q({store:D,app:r._a,pinia:r,options:a})))}),p&&i&&n.hydrate&&n.hydrate(D.$state,p),c=!0,u=!0,D}/*! #__NO_SIDE_EFFECTS__ */function nu(e,t,n){let r,s;const i=typeof t=="function";typeof e=="string"?(r=e,s=i?n:t):(s=e,r=e.id);function o(a,l){const c=hd();return a=a||(c?pt(Qc,null):null),a&&ri(a),a=Xc,a._s.has(r)||(i?tu(r,t,s,a):hp(r,s,a)),a._s.get(r)}return o.$id=r,o}/*!
22
+ */let Zc;const ri=e=>Zc=e,Xc=Symbol();function Gi(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var kr;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(kr||(kr={}));function ip(){const e=Wl(!0),t=e.run(()=>_e({}));let n=[],r=[];const s=Eo({install(i){ri(s),s._a=i,i.provide(Xc,s),i.config.globalProperties.$pinia=s,r.forEach(o=>n.push(o)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return s}const Qc=()=>{};function Na(e,t,n,r=Qc){e.push(t);const s=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),r())};return!n&&Vl()&&Ch(s),s}function Pn(e,...t){e.slice().forEach(n=>{n(...t)})}const op=e=>e(),Ia=Symbol(),Si=Symbol();function zi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],s=e[n];Gi(s)&&Gi(r)&&e.hasOwnProperty(n)&&!Ce(r)&&!Gt(r)?e[n]=zi(s,r):e[n]=r}return e}const ap=Symbol();function lp(e){return!Gi(e)||!e.hasOwnProperty(ap)}const{assign:rn}=Object;function cp(e){return!!(Ce(e)&&e.effect)}function up(e,t,n,r){const{state:s,actions:i,getters:o}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=s?s():{});const u=Qh(n.state.value[e]);return rn(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=Eo(qe(()=>{ri(n);const f=n._s.get(e);return o[d].call(f,f)})),h),{}))}return l=eu(e,c,t,n,r,!0),l}function eu(e,t,n={},r,s,i){let o;const a=rn({actions:{}},n),l={deep:!0};let c,u,h=[],d=[],f;const p=r.state.value[e];!i&&!p&&(r.state.value[e]={});let m;function E(U){let S;c=u=!1,typeof U=="function"?(U(r.state.value[e]),S={type:kr.patchFunction,storeId:e,events:f}):(zi(r.state.value[e],U),S={type:kr.patchObject,payload:U,storeId:e,events:f});const X=m=Symbol();tr().then(()=>{m===X&&(c=!0)}),u=!0,Pn(h,S,r.state.value[e])}const _=i?function(){const{state:S}=n,X=S?S():{};this.$patch(ae=>{rn(ae,X)})}:Qc;function y(){o.stop(),h=[],d=[],r._s.delete(e)}const w=(U,S="")=>{if(Ia in U)return U[Si]=S,U;const X=function(){ri(r);const ae=Array.from(arguments),H=[],ue=[];function me(j){H.push(j)}function Ne(j){ue.push(j)}Pn(d,{args:ae,name:X[Si],store:C,after:me,onError:Ne});let x;try{x=U.apply(this&&this.$id===e?this:C,ae)}catch(j){throw Pn(ue,j),j}return x instanceof Promise?x.then(j=>(Pn(H,j),j)).catch(j=>(Pn(ue,j),Promise.reject(j))):(Pn(H,x),x)};return X[Ia]=!0,X[Si]=S,X},k={_p:r,$id:e,$onAction:Na.bind(null,d),$patch:E,$reset:_,$subscribe(U,S={}){const X=Na(h,U,S.detached,()=>ae()),ae=o.run(()=>un(()=>r.state.value[e],H=>{(S.flush==="sync"?u:c)&&U({storeId:e,type:kr.direct,events:f},H)},rn({},l,S)));return X},$dispose:y},C=Yr(k);r._s.set(e,C);const N=(r._a&&r._a.runWithContext||op)(()=>r._e.run(()=>(o=Wl()).run(()=>t({action:w}))));for(const U in N){const S=N[U];if(Ce(S)&&!cp(S)||Gt(S))i||(p&&lp(S)&&(Ce(S)?S.value=p[U]:zi(S,p[U])),r.state.value[e][U]=S);else if(typeof S=="function"){const X=w(S,U);N[U]=X,a.actions[U]=S}}return rn(C,N),rn(ge(C),N),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:U=>{E(S=>{rn(S,U)})}}),r._p.forEach(U=>{rn(C,o.run(()=>U({store:C,app:r._a,pinia:r,options:a})))}),p&&i&&n.hydrate&&n.hydrate(C.$state,p),c=!0,u=!0,C}/*! #__NO_SIDE_EFFECTS__ */function tu(e,t,n){let r,s;const i=typeof t=="function";typeof e=="string"?(r=e,s=i?n:t):(s=e,r=e.id);function o(a,l){const c=ud();return a=a||(c?pt(Xc,null):null),a&&ri(a),a=Zc,a._s.has(r)||(i?eu(r,t,s,a):up(r,s,a)),a._s.get(r)}return o.$id=r,o}/*!
23
23
  * vue-router v4.6.4
24
24
  * (c) 2025 Eduardo San Martin Morote
25
25
  * @license MIT
26
- */const Hn=typeof document<"u";function ru(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function dp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&ru(e.default)}const _e=Object.assign;function ki(e,t){const n={};for(const r in t){const s=t[r];n[r]=St(s)?s.map(e):e(s)}return n}const kr=()=>{},St=Array.isArray;function Pa(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const su=/#/g,fp=/&/g,pp=/\//g,gp=/=/g,mp=/\?/g,iu=/\+/g,bp=/%5B/g,yp=/%5D/g,ou=/%5E/g,_p=/%60/g,au=/%7B/g,vp=/%7C/g,lu=/%7D/g,wp=/%20/g;function Co(e){return e==null?"":encodeURI(""+e).replace(vp,"|").replace(bp,"[").replace(yp,"]")}function Ep(e){return Co(e).replace(au,"{").replace(lu,"}").replace(ou,"^")}function Ji(e){return Co(e).replace(iu,"%2B").replace(wp,"+").replace(su,"%23").replace(fp,"%26").replace(_p,"`").replace(au,"{").replace(lu,"}").replace(ou,"^")}function Sp(e){return Ji(e).replace(gp,"%3D")}function kp(e){return Co(e).replace(su,"%23").replace(mp,"%3F")}function Ap(e){return kp(e).replace(pp,"%2F")}function jr(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Tp=/\/$/,Rp=e=>e.replace(Tp,"");function Ai(e,t,n="/"){let r,s={},i="",o="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),i=t.slice(l,a>0?a:t.length),s=e(i.slice(1))),a>=0&&(r=r||t.slice(0,a),o=t.slice(a,t.length)),r=Np(r??t,n),{fullPath:r+i+o,path:r,query:s,hash:jr(o)}}function xp(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function La(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Op(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&nr(t.matched[r],n.matched[s])&&cu(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function nr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function cu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Cp(e[n],t[n]))return!1;return!0}function Cp(e,t){return St(e)?$a(e,t):St(t)?$a(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function $a(e,t){return St(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Np(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let i=n.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const en={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Yi=function(e){return e.pop="pop",e.push="push",e}({}),Ti=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Ip(e){if(!e)if(Hn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Rp(e)}const Pp=/^[^#]+#/;function Lp(e,t){return e.replace(Pp,"#")+t}function $p(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const si=()=>({left:window.scrollX,top:window.scrollY});function Mp(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=$p(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ma(e,t){return(history.state?history.state.position-t:-1)+e}const Zi=new Map;function jp(e,t){Zi.set(e,t)}function Dp(e){const t=Zi.get(e);return Zi.delete(e),t}function Up(e){return typeof e=="string"||e&&typeof e=="object"}function uu(e){return typeof e=="string"||typeof e=="symbol"}let Re=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 hu=Symbol("");Re.MATCHER_NOT_FOUND+"",Re.NAVIGATION_GUARD_REDIRECT+"",Re.NAVIGATION_ABORTED+"",Re.NAVIGATION_CANCELLED+"",Re.NAVIGATION_DUPLICATED+"";function rr(e,t){return _e(new Error,{type:e,[hu]:!0},t)}function Dt(e,t){return e instanceof Error&&hu 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 n of Bp)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Fp(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(iu," "),i=s.indexOf("="),o=jr(i<0?s:s.slice(0,i)),a=i<0?null:jr(s.slice(i+1));if(o in t){let l=t[o];St(l)||(l=t[o]=[l]),l.push(a)}else t[o]=a}return t}function ja(e){let t="";for(let n in e){const r=e[n];if(n=Sp(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(St(r)?r.map(s=>s&&Ji(s)):[r&&Ji(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function qp(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=St(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Kp=Symbol(""),Da=Symbol(""),ii=Symbol(""),No=Symbol(""),Xi=Symbol("");function cr(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function sn(e,t,n,r,s,i=o=>o()){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(rr(Re.NAVIGATION_ABORTED,{from:n,to:t})):d instanceof Error?l(d):Up(d)?l(rr(Re.NAVIGATION_GUARD_REDIRECT,{from:t,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>e.call(r&&r.instances[s],t,n,c));let h=Promise.resolve(u);e.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Ri(e,t,n,r,s=i=>i()){const i=[];for(const o of e)for(const a in o.components){let l=o.components[a];if(!(t!=="beforeRouteEnter"&&!o.instances[a]))if(ru(l)){const c=(l.__vccOpts||l)[t];c&&i.push(sn(c,n,r,o,a,s))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=dp(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[t];return d&&sn(d,n,r,o,a,s)()}))}}return i}function Wp(e,t){const n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;o<i;o++){const a=t.matched[o];a&&(e.matched.find(c=>nr(c,a))?r.push(a):n.push(a));const l=e.matched[o];l&&(t.matched.find(c=>nr(c,l))||s.push(l))}return[n,r,s]}/*!
26
+ */const Hn=typeof document<"u";function nu(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&&nu(e.default)}const ve=Object.assign;function ki(e,t){const n={};for(const r in t){const s=t[r];n[r]=St(s)?s.map(e):e(s)}return n}const Ar=()=>{},St=Array.isArray;function Pa(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const ru=/#/g,dp=/&/g,fp=/\//g,pp=/=/g,gp=/\?/g,su=/\+/g,mp=/%5B/g,bp=/%5D/g,iu=/%5E/g,yp=/%60/g,ou=/%7B/g,_p=/%7C/g,au=/%7D/g,vp=/%20/g;function Co(e){return e==null?"":encodeURI(""+e).replace(_p,"|").replace(mp,"[").replace(bp,"]")}function wp(e){return Co(e).replace(ou,"{").replace(au,"}").replace(iu,"^")}function Ji(e){return Co(e).replace(su,"%2B").replace(vp,"+").replace(ru,"%23").replace(dp,"%26").replace(yp,"`").replace(ou,"{").replace(au,"}").replace(iu,"^")}function Ep(e){return Ji(e).replace(pp,"%3D")}function Sp(e){return Co(e).replace(ru,"%23").replace(gp,"%3F")}function kp(e){return Sp(e).replace(fp,"%2F")}function Dr(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Ap=/\/$/,Tp=e=>e.replace(Ap,"");function Ai(e,t,n="/"){let r,s={},i="",o="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),i=t.slice(l,a>0?a:t.length),s=e(i.slice(1))),a>=0&&(r=r||t.slice(0,a),o=t.slice(a,t.length)),r=Cp(r??t,n),{fullPath:r+i+o,path:r,query:s,hash:Dr(o)}}function xp(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function La(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Rp(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&rr(t.matched[r],n.matched[s])&&lu(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function rr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function lu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Op(e[n],t[n]))return!1;return!0}function Op(e,t){return St(e)?$a(e,t):St(t)?$a(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function $a(e,t){return St(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Cp(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let i=n.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const tn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Yi=function(e){return e.pop="pop",e.push="push",e}({}),Ti=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Np(e){if(!e)if(Hn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Tp(e)}const Ip=/^[^#]+#/;function Pp(e,t){return e.replace(Ip,"#")+t}function Lp(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const si=()=>({left:window.scrollX,top:window.scrollY});function $p(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Lp(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ma(e,t){return(history.state?history.state.position-t:-1)+e}const Zi=new Map;function Mp(e,t){Zi.set(e,t)}function jp(e){const t=Zi.get(e);return Zi.delete(e),t}function Dp(e){return typeof e=="string"||e&&typeof e=="object"}function cu(e){return typeof e=="string"||typeof e=="symbol"}let Re=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 uu=Symbol("");Re.MATCHER_NOT_FOUND+"",Re.NAVIGATION_GUARD_REDIRECT+"",Re.NAVIGATION_ABORTED+"",Re.NAVIGATION_CANCELLED+"",Re.NAVIGATION_DUPLICATED+"";function sr(e,t){return ve(new Error,{type:e,[uu]:!0},t)}function Ut(e,t){return e instanceof Error&&uu in e&&(t==null||!!(e.type&t))}const Up=["params","query","hash"];function Bp(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Up)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Hp(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(su," "),i=s.indexOf("="),o=Dr(i<0?s:s.slice(0,i)),a=i<0?null:Dr(s.slice(i+1));if(o in t){let l=t[o];St(l)||(l=t[o]=[l]),l.push(a)}else t[o]=a}return t}function ja(e){let t="";for(let n in e){const r=e[n];if(n=Ep(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(St(r)?r.map(s=>s&&Ji(s)):[r&&Ji(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Fp(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=St(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const qp=Symbol(""),Da=Symbol(""),ii=Symbol(""),No=Symbol(""),Xi=Symbol("");function ur(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function on(e,t,n,r,s,i=o=>o()){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(sr(Re.NAVIGATION_ABORTED,{from:n,to:t})):d instanceof Error?l(d):Dp(d)?l(sr(Re.NAVIGATION_GUARD_REDIRECT,{from:t,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>e.call(r&&r.instances[s],t,n,c));let h=Promise.resolve(u);e.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function xi(e,t,n,r,s=i=>i()){const i=[];for(const o of e)for(const a in o.components){let l=o.components[a];if(!(t!=="beforeRouteEnter"&&!o.instances[a]))if(nu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(on(c,n,r,o,a,s))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=hp(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[t];return d&&on(d,n,r,o,a,s)()}))}}return i}function Kp(e,t){const n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;o<i;o++){const a=t.matched[o];a&&(e.matched.find(c=>rr(c,a))?r.push(a):n.push(a));const l=e.matched[o];l&&(t.matched.find(c=>rr(c,l))||s.push(l))}return[n,r,s]}/*!
27
27
  * vue-router v4.6.4
28
28
  * (c) 2025 Eduardo San Martin Morote
29
29
  * @license MIT
30
- */let Vp=()=>location.protocol+"//"+location.host;function du(e,t){const{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let o=s.includes(e.slice(i))?e.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),La(a,"")}return La(n,e)+r+s}function Gp(e,t,n,r){let s=[],i=[],o=null;const a=({state:d})=>{const f=du(e,location),p=n.value,m=t.value;let w=0;if(d){if(n.value=f,t.value=d,o&&o===p){o=null;return}w=m?d.position-m.position:0}else r(f);s.forEach(E=>{E(n.value,p,{delta:w,type:Yi.pop,direction:w?w>0?Ti.forward:Ti.back:Ti.unknown})})};function l(){o=n.value}function c(d){s.push(d);const f=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(_e({},d.state,{scroll:si()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Ua(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?si():null}}function zp(e){const{history:t,location:n}=window,r={value:du(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=e.indexOf("#"),d=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Vp()+e+l;try{t[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),n[u?"replace":"assign"](d)}}function o(l,c){i(l,_e({},t.state,Ua(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=l}function a(l,c){const u=_e({},s.value,t.state,{forward:l,scroll:si()});i(u.current,u,!0),i(l,_e({},Ua(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:s,push:a,replace:o}}function Jp(e){e=Ip(e);const t=zp(e),n=Gp(e,t.state,t.location,t.replace);function r(i,o=!0){o||n.pauseListeners(),history.go(i)}const s=_e({location:"",base:e,go:r,createHref:Lp.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}let An=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Me=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}(Me||{});const Yp={type:An.Static,value:""},Zp=/[a-zA-Z0-9_]/;function Xp(e){if(!e)return[[]];if(e==="/")return[[Yp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=Me.Static,r=n;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(n===Me.Static?i.push({type:An.Static,value:c}):n===Me.Param||n===Me.ParamRegExp||n===Me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:An.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Me.ParamRegExp){r=n,n=Me.EscapeNext;continue}switch(n){case Me.Static:l==="/"?(c&&h(),o()):l===":"?(h(),n=Me.Param):d();break;case Me.EscapeNext:d(),n=r;break;case Me.Param:l==="("?n=Me.ParamRegExp:Zp.test(l)?d():(h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Me.ParamRegExpEnd:u+=l;break;case Me.ParamRegExpEnd:h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Me.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Ba="[^/]+?",Qp={sensitive:!1,strict:!1,start:!0,end:!0};var et=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}(et||{});const eg=/[.+*?^${}()[\]/\\]/g;function tg(e,t){const n=_e({},Qp,t),r=[];let s=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[et.Root];n.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=et.Segment+(n.sensitive?et.BonusCaseSensitive:0);if(d.type===An.Static)h||(s+="/"),s+=d.value.replace(eg,"\\$&"),f+=et.Static;else if(d.type===An.Param){const{value:p,repeatable:m,optional:w,regexp:E}=d;i.push({name:p,repeatable:m,optional:w});const y=E||Ba;if(y!==Ba){f+=et.BonusCustomRegExp;try{`${y}`}catch(T){throw new Error(`Invalid custom RegExp for param "${p}" (${y}): `+T.message)}}let v=m?`((?:${y})(?:/(?:${y}))*)`:`(${y})`;h||(v=w&&c.length<2?`(?:/${v})`:"/"+v),w&&(v+="?"),s+=v,f+=et.Dynamic,w&&(f+=et.BonusOptional),m&&(f+=et.BonusRepeatable),y===".*"&&(f+=et.BonusWildcard)}u.push(f)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=et.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,n.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",p=i[d-1];h[p.name]=f&&p.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of e){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===An.Static)u+=f.value;else if(f.type===An.Param){const{value:p,repeatable:m,optional:w}=f,E=p in c?c[p]:"";if(St(E)&&!m)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const y=St(E)?E.join("/"):E;if(!y)if(w)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=y}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function ng(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===et.Static+et.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===et.Static+et.Segment?1:-1:0}function fu(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const i=ng(r[n],s[n]);if(i)return i;n++}if(Math.abs(s.length-r.length)===1){if(Ha(r))return 1;if(Ha(s))return-1}return s.length-r.length}function Ha(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const rg={strict:!1,end:!0,sensitive:!1};function sg(e,t,n){const r=tg(Xp(e.path),n),s=_e(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function ig(e,t){const n=[],r=new Map;t=Pa(rg,t);function s(h){return r.get(h)}function i(h,d,f){const p=!f,m=qa(h);m.aliasOf=f&&f.record;const w=Pa(t,h),E=[m];if("alias"in h){const T=typeof h.alias=="string"?[h.alias]:h.alias;for(const D of T)E.push(qa(_e({},m,{components:f?f.record.components:m.components,path:D,aliasOf:f?f.record:m})))}let y,v;for(const T of E){const{path:D}=T;if(d&&D[0]!=="/"){const B=d.record.path,j=B[B.length-1]==="/"?"":"/";T.path=d.record.path+(D&&j+D)}if(y=sg(T,d,w),f?f.alias.push(y):(v=v||y,v!==y&&v.alias.push(y),p&&h.name&&!Ka(y)&&o(h.name)),pu(y)&&l(y),m.children){const B=m.children;for(let j=0;j<B.length;j++)i(B[j],y,f&&f.children[j])}f=f||y}return v?()=>{o(v)}:kr}function o(h){if(uu(h)){const d=r.get(h);d&&(r.delete(h),n.splice(n.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=n.indexOf(h);d>-1&&(n.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return n}function l(h){const d=lg(h,n);n.splice(d,0,h),h.record.name&&!Ka(h)&&r.set(h.record.name,h)}function c(h,d){let f,p={},m,w;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw rr(Re.MATCHER_NOT_FOUND,{location:h});w=f.record.name,p=_e(Fa(d.params,f.keys.filter(v=>!v.optional).concat(f.parent?f.parent.keys.filter(v=>v.optional):[]).map(v=>v.name)),h.params&&Fa(h.params,f.keys.map(v=>v.name))),m=f.stringify(p)}else if(h.path!=null)m=h.path,f=n.find(v=>v.re.test(m)),f&&(p=f.parse(m),w=f.record.name);else{if(f=d.name?r.get(d.name):n.find(v=>v.re.test(d.path)),!f)throw rr(Re.MATCHER_NOT_FOUND,{location:h,currentLocation:d});w=f.record.name,p=_e({},d.params,h.params),m=f.stringify(p)}const E=[];let y=f;for(;y;)E.unshift(y.record),y=y.parent;return{name:w,path:m,params:p,matched:E,meta:ag(E)}}e.forEach(h=>i(h));function u(){n.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Fa(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function qa(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:og(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 og(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Ka(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function ag(e){return e.reduce((t,n)=>_e(t,n.meta),{})}function lg(e,t){let n=0,r=t.length;for(;n!==r;){const i=n+r>>1;fu(e,t[i])<0?r=i:n=i+1}const s=cg(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function cg(e){let t=e;for(;t=t.parent;)if(pu(t)&&fu(e,t)===0)return t}function pu({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wa(e){const t=pt(ii),n=pt(No),r=Fe(()=>{const l=De(e.to);return t.resolve(l)}),s=Fe(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=n.matched;if(!u||!h.length)return-1;const d=h.findIndex(nr.bind(null,u));if(d>-1)return d;const f=Va(l[c-2]);return c>1&&Va(u)===f&&h[h.length-1].path!==f?h.findIndex(nr.bind(null,l[c-2])):d}),i=Fe(()=>s.value>-1&&fg(n.params,r.value.params)),o=Fe(()=>s.value>-1&&s.value===n.matched.length-1&&cu(n.params,r.value.params));function a(l={}){if(dg(l)){const c=t[De(e.replace)?"replace":"push"](De(e.to)).catch(kr);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:Fe(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function ug(e){return e.length===1?e[0]:e}const hg=dn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Wa,setup(e,{slots:t}){const n=Jr(Wa(e)),{options:r}=pt(ii),s=Fe(()=>({[Ga(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ga(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&ug(t.default(n));return e.custom?i:Oo("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},i)}}}),Ar=hg;function dg(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 n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!St(s)||s.length!==r.length||r.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Va(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ga=(e,t,n)=>e??t??n,pg=dn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=pt(Xi),s=Fe(()=>e.route||r.value),i=pt(Da,0),o=Fe(()=>{let c=De(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Fe(()=>s.value.matched[o.value]);bs(Da,Fe(()=>o.value+1)),bs(Kp,a),bs(Xi,s);const l=Ae();return cn(()=>[l.value,a.value,e.name],([c,u,h],[d,f,p])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!nr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=s.value,u=e.name,h=a.value,d=h&&h.components[u];if(!d)return za(n.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,w=Oo(d,_e({},p,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return za(n.default,{Component:w,route:c})||w}}});function za(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Qi=pg;function gg(e){const t=ig(e.routes,e),n=e.parseQuery||Fp,r=e.stringifyQuery||ja,s=e.history,i=cr(),o=cr(),a=cr(),l=Zh(en);let c=en;Hn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ki.bind(null,O=>""+O),h=ki.bind(null,Ap),d=ki.bind(null,jr);function f(O,G){let V,ee;return uu(O)?(V=t.getRecordMatcher(O),ee=G):ee=O,t.addRoute(ee,V)}function p(O){const G=t.getRecordMatcher(O);G&&t.removeRoute(G)}function m(){return t.getRoutes().map(O=>O.record)}function w(O){return!!t.getRecordMatcher(O)}function E(O,G){if(G=_e({},G||l.value),typeof O=="string"){const _=Ai(n,O,G.path),S=t.resolve({path:_.path},G),N=s.createHref(_.fullPath);return _e(_,S,{params:d(S.params),hash:jr(_.hash),redirectedFrom:void 0,href:N})}let V;if(O.path!=null)V=_e({},O,{path:Ai(n,O.path,G.path).path});else{const _=_e({},O.params);for(const S in _)_[S]==null&&delete _[S];V=_e({},O,{params:h(_)}),G.params=h(G.params)}const ee=t.resolve(V,G),de=O.hash||"";ee.params=u(d(ee.params));const g=xp(r,_e({},O,{hash:Ep(de),path:ee.path})),b=s.createHref(g);return _e({fullPath:g,hash:de,query:r===ja?qp(O.query):O.query||{}},ee,{redirectedFrom:void 0,href:b})}function y(O){return typeof O=="string"?Ai(n,O,l.value.path):_e({},O)}function v(O,G){if(c!==O)return rr(Re.NAVIGATION_CANCELLED,{from:G,to:O})}function T(O){return j(O)}function D(O){return T(_e(y(O),{replace:!0}))}function B(O,G){const V=O.matched[O.matched.length-1];if(V&&V.redirect){const{redirect:ee}=V;let de=typeof ee=="function"?ee(O,G):ee;return typeof de=="string"&&(de=de.includes("?")||de.includes("#")?de=y(de):{path:de},de.params={}),_e({query:O.query,hash:O.hash,params:de.path!=null?{}:O.params},de)}}function j(O,G){const V=c=E(O),ee=l.value,de=O.state,g=O.force,b=O.replace===!0,_=B(V,ee);if(_)return j(_e(y(_),{state:typeof _=="object"?_e({},de,_.state):de,force:g,replace:b}),G||V);const S=V;S.redirectedFrom=G;let N;return!g&&Op(r,ee,V)&&(N=rr(Re.NAVIGATION_DUPLICATED,{to:S,from:ee}),be(ee,ee,!0,!1)),(N?Promise.resolve(N):Q(S,ee)).catch(R=>Dt(R)?Dt(R,Re.NAVIGATION_GUARD_REDIRECT)?R:he(R):M(R,S,ee)).then(R=>{if(R){if(Dt(R,Re.NAVIGATION_GUARD_REDIRECT))return j(_e({replace:b},y(R.to),{state:typeof R.to=="object"?_e({},de,R.to.state):de,force:g}),G||S)}else R=F(S,ee,!0,b,de);return ae(S,ee,R),R})}function q(O,G){const V=v(O,G);return V?Promise.reject(V):Promise.resolve()}function C(O){const G=Ie.values().next().value;return G&&typeof G.runWithContext=="function"?G.runWithContext(O):O()}function Q(O,G){let V;const[ee,de,g]=Wp(O,G);V=Ri(ee.reverse(),"beforeRouteLeave",O,G);for(const _ of ee)_.leaveGuards.forEach(S=>{V.push(sn(S,O,G))});const b=q.bind(null,O,G);return V.push(b),Ze(V).then(()=>{V=[];for(const _ of i.list())V.push(sn(_,O,G));return V.push(b),Ze(V)}).then(()=>{V=Ri(de,"beforeRouteUpdate",O,G);for(const _ of de)_.updateGuards.forEach(S=>{V.push(sn(S,O,G))});return V.push(b),Ze(V)}).then(()=>{V=[];for(const _ of g)if(_.beforeEnter)if(St(_.beforeEnter))for(const S of _.beforeEnter)V.push(sn(S,O,G));else V.push(sn(_.beforeEnter,O,G));return V.push(b),Ze(V)}).then(()=>(O.matched.forEach(_=>_.enterCallbacks={}),V=Ri(g,"beforeRouteEnter",O,G,C),V.push(b),Ze(V))).then(()=>{V=[];for(const _ of o.list())V.push(sn(_,O,G));return V.push(b),Ze(V)}).catch(_=>Dt(_,Re.NAVIGATION_CANCELLED)?_:Promise.reject(_))}function ae(O,G,V){a.list().forEach(ee=>C(()=>ee(O,G,V)))}function F(O,G,V,ee,de){const g=v(O,G);if(g)return g;const b=G===en,_=Hn?history.state:{};V&&(ee||b?s.replace(O.fullPath,_e({scroll:b&&_&&_.scroll},de)):s.push(O.fullPath,de)),l.value=O,be(O,G,V,b),he()}let ce;function me(){ce||(ce=s.listen((O,G,V)=>{if(!Be.listening)return;const ee=E(O),de=B(ee,Be.currentRoute.value);if(de){j(_e(de,{replace:!0,force:!0}),ee).catch(kr);return}c=ee;const g=l.value;Hn&&jp(Ma(g.fullPath,V.delta),si()),Q(ee,g).catch(b=>Dt(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_CANCELLED)?b:Dt(b,Re.NAVIGATION_GUARD_REDIRECT)?(j(_e(y(b.to),{force:!0}),ee).then(_=>{Dt(_,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&!V.delta&&V.type===Yi.pop&&s.go(-1,!1)}).catch(kr),Promise.reject()):(V.delta&&s.go(-V.delta,!1),M(b,ee,g))).then(b=>{b=b||F(ee,g,!1),b&&(V.delta&&!Dt(b,Re.NAVIGATION_CANCELLED)?s.go(-V.delta,!1):V.type===Yi.pop&&Dt(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ae(ee,g,b)}).catch(kr)}))}let Ne=cr(),A=cr(),P;function M(O,G,V){he(O);const ee=A.list();return ee.length?ee.forEach(de=>de(O,G,V)):console.error(O),Promise.reject(O)}function re(){return P&&l.value!==en?Promise.resolve():new Promise((O,G)=>{Ne.add([O,G])})}function he(O){return P||(P=!O,me(),Ne.list().forEach(([G,V])=>O?V(O):G()),Ne.reset()),O}function be(O,G,V,ee){const{scrollBehavior:de}=e;if(!Hn||!de)return Promise.resolve();const g=!V&&Dp(Ma(O.fullPath,0))||(ee||!V)&&history.state&&history.state.scroll||null;return er().then(()=>de(O,G,g)).then(b=>b&&Mp(b)).catch(b=>M(b,O,G))}const ye=O=>s.go(O);let qe;const Ie=new Set,Be={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:t.clearRoutes,hasRoute:w,getRoutes:m,resolve:E,options:e,push:T,replace:D,go:ye,back:()=>ye(-1),forward:()=>ye(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:A.add,isReady:re,install(O){O.component("RouterLink",Ar),O.component("RouterView",Qi),O.config.globalProperties.$router=Be,Object.defineProperty(O.config.globalProperties,"$route",{enumerable:!0,get:()=>De(l)}),Hn&&!qe&&l.value===en&&(qe=!0,T(s.location).catch(ee=>{}));const G={};for(const ee in en)Object.defineProperty(G,ee,{get:()=>l.value[ee],enumerable:!0});O.provide(ii,Be),O.provide(No,lc(G)),O.provide(Xi,l);const V=O.unmount;Ie.add(O),O.unmount=function(){Ie.delete(O),Ie.size<1&&(c=en,ce&&ce(),ce=null,l.value=en,qe=!1,P=!1),V()}}};function Ze(O){return O.reduce((G,V)=>G.then(()=>C(V)),Promise.resolve())}return Be}function Yv(){return pt(ii)}function Io(e){return pt(No)}const mg={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},bg={key:4,d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H10l-4 4v-4.2A2.5 2.5 0 0 1 5 12.5Z"},yg={key:5,d:"M4 12h4l2.2-5 3.6 10 2.2-5H20"},_g={key:8,d:"m6 9 6 6 6-6"},vg={key:9,d:"m6 15 6-6 6 6"},wg={key:10,d:"m9 6 6 6-6 6"},Eg={key:14,d:"M13 2 5 13h5l-1 9 8-11h-5Z"},Sg={key:18,cx:"12",cy:"12",r:"4.25",fill:"currentColor",stroke:"none"},st=dn({__name:"AppIcon",props:{name:{}},setup(e){return(t,n)=>(J(),Z("svg",mg,[e.name==="grid"?(J(),Z(ge,{key:0},[n[0]||(n[0]=$("rect",{x:"4",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[1]||(n[1]=$("rect",{x:"14",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[2]||(n[2]=$("rect",{x:"4",y:"14",width:"6",height:"6",rx:"1.5"},null,-1)),n[3]||(n[3]=$("rect",{x:"14",y:"14",width:"6",height:"6",rx:"1.5"},null,-1))],64)):e.name==="book"?(J(),Z(ge,{key:1},[n[4]||(n[4]=$("path",{d:"M5 5.5a2.5 2.5 0 0 1 2.5-2.5H20v17H7.5A2.5 2.5 0 0 0 5 22Z"},null,-1)),n[5]||(n[5]=$("path",{d:"M5 5.5V22"},null,-1)),n[6]||(n[6]=$("path",{d:"M9 7h7"},null,-1))],64)):e.name==="settings"?(J(),Z(ge,{key:2},[n[7]||(n[7]=$("circle",{cx:"12",cy:"12",r:"3.25"},null,-1)),n[8]||(n[8]=$("path",{d:"M19.4 15a1 1 0 0 0 .2 1.1l.1.1a1.9 1.9 0 0 1 0 2.7 1.9 1.9 0 0 1-2.7 0l-.1-.1a1 1 0 0 0-1.1-.2 1 1 0 0 0-.6.9V20a2 2 0 0 1-4 0v-.2a1 1 0 0 0-.6-.9 1 1 0 0 0-1.1.2l-.1.1a1.9 1.9 0 0 1-2.7 0 1.9 1.9 0 0 1 0-2.7l.1-.1a1 1 0 0 0 .2-1.1 1 1 0 0 0-.9-.6H4a2 2 0 0 1 0-4h.2a1 1 0 0 0 .9-.6 1 1 0 0 0-.2-1.1l-.1-.1a1.9 1.9 0 0 1 0-2.7 1.9 1.9 0 0 1 2.7 0l.1.1a1 1 0 0 0 1.1.2 1 1 0 0 0 .6-.9V4a2 2 0 0 1 4 0v.2a1 1 0 0 0 .6.9 1 1 0 0 0 1.1-.2l.1-.1a1.9 1.9 0 0 1 2.7 0 1.9 1.9 0 0 1 0 2.7l-.1.1a1 1 0 0 0-.2 1.1 1 1 0 0 0 .9.6H20a2 2 0 0 1 0 4h-.2a1 1 0 0 0-.9.6Z"},null,-1))],64)):e.name==="terminal"?(J(),Z(ge,{key:3},[n[9]||(n[9]=$("path",{d:"M4 6h16v12H4z",rx:"2"},null,-1)),n[10]||(n[10]=$("path",{d:"m8 10 2 2-2 2"},null,-1)),n[11]||(n[11]=$("path",{d:"M12.5 16H16"},null,-1))],64)):e.name==="message"?(J(),Z("path",bg)):e.name==="activity"?(J(),Z("path",yg)):e.name==="sparkles"?(J(),Z(ge,{key:6},[n[12]||(n[12]=$("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5Z"},null,-1)),n[13]||(n[13]=$("path",{d:"m19 14 .7 2.1L22 16.8l-2.3.7L19 20l-.7-2.5-2.3-.7 2.3-.7Z"},null,-1)),n[14]||(n[14]=$("path",{d:"m5 15 .8 2.3L8 18l-2.2.7L5 21l-.8-2.3L2 18l2.2-.7Z"},null,-1))],64)):e.name==="git-branch"?(J(),Z(ge,{key:7},[n[15]||(n[15]=$("path",{d:"M6 4v9a3 3 0 1 0 2 2.8V8h8"},null,-1)),n[16]||(n[16]=$("path",{d:"M16 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1)),n[17]||(n[17]=$("path",{d:"M8 16a3 3 0 1 0-4 2.8"},null,-1))],64)):e.name==="chevron-down"?(J(),Z("path",_g)):e.name==="chevron-up"?(J(),Z("path",vg)):e.name==="chevron-right"?(J(),Z("path",wg)):e.name==="plus"?(J(),Z(ge,{key:11},[n[18]||(n[18]=$("path",{d:"M12 5v14"},null,-1)),n[19]||(n[19]=$("path",{d:"M5 12h14"},null,-1))],64)):e.name==="trash"?(J(),Z(ge,{key:12},[n[20]||(n[20]=hf('<path d="M4 7h16"></path><path d="M10 11v6"></path><path d="M14 11v6"></path><path d="M6 7l1 12h10l1-12"></path><path d="M9 7V4h6v3"></path>',5))],64)):e.name==="x"?(J(),Z(ge,{key:13},[n[21]||(n[21]=$("path",{d:"M6 6l12 12"},null,-1)),n[22]||(n[22]=$("path",{d:"M18 6 6 18"},null,-1))],64)):e.name==="zap"?(J(),Z("path",Eg)):e.name==="calendar"?(J(),Z(ge,{key:15},[n[23]||(n[23]=$("rect",{x:"3.5",y:"5",width:"17",height:"15.5",rx:"2"},null,-1)),n[24]||(n[24]=$("path",{d:"M7 3v4"},null,-1)),n[25]||(n[25]=$("path",{d:"M17 3v4"},null,-1)),n[26]||(n[26]=$("path",{d:"M3.5 9.5h17"},null,-1))],64)):e.name==="inbox"?(J(),Z(ge,{key:16},[n[27]||(n[27]=$("path",{d:"M4 6h16l-2 10H6Z"},null,-1)),n[28]||(n[28]=$("path",{d:"M8 12h8"},null,-1)),n[29]||(n[29]=$("path",{d:"M7 16h10"},null,-1))],64)):e.name==="server"?(J(),Z(ge,{key:17},[n[30]||(n[30]=$("rect",{x:"4",y:"4",width:"16",height:"6",rx:"1.5"},null,-1)),n[31]||(n[31]=$("rect",{x:"4",y:"14",width:"16",height:"6",rx:"1.5"},null,-1)),n[32]||(n[32]=$("path",{d:"M8 7h.01"},null,-1)),n[33]||(n[33]=$("path",{d:"M8 17h.01"},null,-1))],64)):e.name==="circle"?(J(),Z("circle",Sg)):Je("",!0)]))}});function oi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function kg(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}const Ag=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Po extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Tg extends Po{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ja extends Po{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Ya extends Po{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var eo;(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"})(eo||(eo={}));class Rg{constructor(t,{headers:n={},customFetch:r,region:s=eo.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=Ag(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return kg(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const p=new URL(`${this.url}/${n}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let m;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(d["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(d["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 w=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(w=o.signal,u.addEventListener("abort",()=>o.abort())):w=o.signal);const E=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:m,signal:w}).catch(D=>{throw new Tg(D)}),y=E.headers.get("x-relay-error");if(y&&y==="true")throw new Ja(E);if(!E.ok)throw new Ya(E);let v=((s=E.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),T;return v==="application/json"?T=yield E.json():v==="application/octet-stream"||v==="application/pdf"?T=yield E.blob():v==="text/event-stream"?T=E:v==="multipart/form-data"?T=yield E.formData():T=yield E.text(),{data:T,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof Ya||a instanceof Ja?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const gu=3,Za=e=>Math.min(1e3*2**e,3e4),xg=[520,503],mu=["GET","HEAD","OPTIONS"];var Og=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 Xa(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",s),n()},e);function s(){clearTimeout(r),n()}t==null||t.addEventListener("abort",s)})}function Cg(e,t,n,r){return!(!r||n>=gu||!mu.includes(e)||!xg.includes(t))}var Ng=class{constructor(e){var t,n,r,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(n.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:n.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!mu.includes(n.method))throw h;if(n.retryEnabled&&o<gu){const d=Za(o);o++,await Xa(d,n.signal);continue}throw h}if(Cg(n.method,u.status,o,n.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Za(o);await u.text(),o++,await Xa(d,n.signal);continue}return await n.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,p,m;const y=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",v=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
30
+ */let Wp=()=>location.protocol+"//"+location.host;function hu(e,t){const{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let o=s.includes(e.slice(i))?e.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),La(a,"")}return La(n,e)+r+s}function Vp(e,t,n,r){let s=[],i=[],o=null;const a=({state:d})=>{const f=hu(e,location),p=n.value,m=t.value;let E=0;if(d){if(n.value=f,t.value=d,o&&o===p){o=null;return}E=m?d.position-m.position:0}else r(f);s.forEach(_=>{_(n.value,p,{delta:E,type:Yi.pop,direction:E?E>0?Ti.forward:Ti.back:Ti.unknown})})};function l(){o=n.value}function c(d){s.push(d);const f=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(ve({},d.state,{scroll:si()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Ua(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?si():null}}function Gp(e){const{history:t,location:n}=window,r={value:hu(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=e.indexOf("#"),d=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Wp()+e+l;try{t[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),n[u?"replace":"assign"](d)}}function o(l,c){i(l,ve({},t.state,Ua(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=l}function a(l,c){const u=ve({},s.value,t.state,{forward:l,scroll:si()});i(u.current,u,!0),i(l,ve({},Ua(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:s,push:a,replace:o}}function zp(e){e=Np(e);const t=Gp(e),n=Vp(e,t.state,t.location,t.replace);function r(i,o=!0){o||n.pauseListeners(),history.go(i)}const s=ve({location:"",base:e,go:r,createHref:Pp.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}let Tn=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Me=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}(Me||{});const Jp={type:Tn.Static,value:""},Yp=/[a-zA-Z0-9_]/;function Zp(e){if(!e)return[[]];if(e==="/")return[[Jp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=Me.Static,r=n;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(n===Me.Static?i.push({type:Tn.Static,value:c}):n===Me.Param||n===Me.ParamRegExp||n===Me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Tn.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Me.ParamRegExp){r=n,n=Me.EscapeNext;continue}switch(n){case Me.Static:l==="/"?(c&&h(),o()):l===":"?(h(),n=Me.Param):d();break;case Me.EscapeNext:d(),n=r;break;case Me.Param:l==="("?n=Me.ParamRegExp:Yp.test(l)?d():(h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Me.ParamRegExpEnd:u+=l;break;case Me.ParamRegExpEnd:h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Me.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Ba="[^/]+?",Xp={sensitive:!1,strict:!1,start:!0,end:!0};var tt=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}(tt||{});const Qp=/[.+*?^${}()[\]/\\]/g;function eg(e,t){const n=ve({},Xp,t),r=[];let s=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[tt.Root];n.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=tt.Segment+(n.sensitive?tt.BonusCaseSensitive:0);if(d.type===Tn.Static)h||(s+="/"),s+=d.value.replace(Qp,"\\$&"),f+=tt.Static;else if(d.type===Tn.Param){const{value:p,repeatable:m,optional:E,regexp:_}=d;i.push({name:p,repeatable:m,optional:E});const y=_||Ba;if(y!==Ba){f+=tt.BonusCustomRegExp;try{`${y}`}catch(k){throw new Error(`Invalid custom RegExp for param "${p}" (${y}): `+k.message)}}let w=m?`((?:${y})(?:/(?:${y}))*)`:`(${y})`;h||(w=E&&c.length<2?`(?:/${w})`:"/"+w),E&&(w+="?"),s+=w,f+=tt.Dynamic,E&&(f+=tt.BonusOptional),m&&(f+=tt.BonusRepeatable),y===".*"&&(f+=tt.BonusWildcard)}u.push(f)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=tt.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,n.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",p=i[d-1];h[p.name]=f&&p.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of e){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Tn.Static)u+=f.value;else if(f.type===Tn.Param){const{value:p,repeatable:m,optional:E}=f,_=p in c?c[p]:"";if(St(_)&&!m)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const y=St(_)?_.join("/"):_;if(!y)if(E)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=y}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function tg(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===tt.Static+tt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===tt.Static+tt.Segment?1:-1:0}function du(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const i=tg(r[n],s[n]);if(i)return i;n++}if(Math.abs(s.length-r.length)===1){if(Ha(r))return 1;if(Ha(s))return-1}return s.length-r.length}function Ha(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,n){const r=eg(Zp(e.path),n),s=ve(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function sg(e,t){const n=[],r=new Map;t=Pa(ng,t);function s(h){return r.get(h)}function i(h,d,f){const p=!f,m=qa(h);m.aliasOf=f&&f.record;const E=Pa(t,h),_=[m];if("alias"in h){const k=typeof h.alias=="string"?[h.alias]:h.alias;for(const C of k)_.push(qa(ve({},m,{components:f?f.record.components:m.components,path:C,aliasOf:f?f.record:m})))}let y,w;for(const k of _){const{path:C}=k;if(d&&C[0]!=="/"){const L=d.record.path,N=L[L.length-1]==="/"?"":"/";k.path=d.record.path+(C&&N+C)}if(y=rg(k,d,E),f?f.alias.push(y):(w=w||y,w!==y&&w.alias.push(y),p&&h.name&&!Ka(y)&&o(h.name)),fu(y)&&l(y),m.children){const L=m.children;for(let N=0;N<L.length;N++)i(L[N],y,f&&f.children[N])}f=f||y}return w?()=>{o(w)}:Ar}function o(h){if(cu(h)){const d=r.get(h);d&&(r.delete(h),n.splice(n.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=n.indexOf(h);d>-1&&(n.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return n}function l(h){const d=ag(h,n);n.splice(d,0,h),h.record.name&&!Ka(h)&&r.set(h.record.name,h)}function c(h,d){let f,p={},m,E;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw sr(Re.MATCHER_NOT_FOUND,{location:h});E=f.record.name,p=ve(Fa(d.params,f.keys.filter(w=>!w.optional).concat(f.parent?f.parent.keys.filter(w=>w.optional):[]).map(w=>w.name)),h.params&&Fa(h.params,f.keys.map(w=>w.name))),m=f.stringify(p)}else if(h.path!=null)m=h.path,f=n.find(w=>w.re.test(m)),f&&(p=f.parse(m),E=f.record.name);else{if(f=d.name?r.get(d.name):n.find(w=>w.re.test(d.path)),!f)throw sr(Re.MATCHER_NOT_FOUND,{location:h,currentLocation:d});E=f.record.name,p=ve({},d.params,h.params),m=f.stringify(p)}const _=[];let y=f;for(;y;)_.unshift(y.record),y=y.parent;return{name:E,path:m,params:p,matched:_,meta:og(_)}}e.forEach(h=>i(h));function u(){n.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Fa(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function qa(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ig(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 ig(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Ka(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function og(e){return e.reduce((t,n)=>ve(t,n.meta),{})}function ag(e,t){let n=0,r=t.length;for(;n!==r;){const i=n+r>>1;du(e,t[i])<0?r=i:n=i+1}const s=lg(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function lg(e){let t=e;for(;t=t.parent;)if(fu(t)&&du(e,t)===0)return t}function fu({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wa(e){const t=pt(ii),n=pt(No),r=qe(()=>{const l=ze(e.to);return t.resolve(l)}),s=qe(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=n.matched;if(!u||!h.length)return-1;const d=h.findIndex(rr.bind(null,u));if(d>-1)return d;const f=Va(l[c-2]);return c>1&&Va(u)===f&&h[h.length-1].path!==f?h.findIndex(rr.bind(null,l[c-2])):d}),i=qe(()=>s.value>-1&&dg(n.params,r.value.params)),o=qe(()=>s.value>-1&&s.value===n.matched.length-1&&lu(n.params,r.value.params));function a(l={}){if(hg(l)){const c=t[ze(e.replace)?"replace":"push"](ze(e.to)).catch(Ar);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:qe(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function cg(e){return e.length===1?e[0]:e}const ug=fn({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:Wa,setup(e,{slots:t}){const n=Yr(Wa(e)),{options:r}=pt(ii),s=qe(()=>({[Ga(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ga(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&cg(t.default(n));return e.custom?i:Oo("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},i)}}}),Tr=ug;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 dg(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!St(s)||s.length!==r.length||r.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Va(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ga=(e,t,n)=>e??t??n,fg=fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=pt(Xi),s=qe(()=>e.route||r.value),i=pt(Da,0),o=qe(()=>{let c=ze(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=qe(()=>s.value.matched[o.value]);ys(Da,qe(()=>o.value+1)),ys(qp,a),ys(Xi,s);const l=_e();return un(()=>[l.value,a.value,e.name],([c,u,h],[d,f,p])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!rr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=s.value,u=e.name,h=a.value,d=h&&h.components[u];if(!d)return za(n.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,E=Oo(d,ve({},p,t,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return za(n.default,{Component:E,route:c})||E}}});function za(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Qi=fg;function pg(e){const t=sg(e.routes,e),n=e.parseQuery||Hp,r=e.stringifyQuery||ja,s=e.history,i=ur(),o=ur(),a=ur(),l=Yh(tn);let c=tn;Hn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ki.bind(null,I=>""+I),h=ki.bind(null,kp),d=ki.bind(null,Dr);function f(I,J){let G,ee;return cu(I)?(G=t.getRecordMatcher(I),ee=J):ee=I,t.addRoute(ee,G)}function p(I){const J=t.getRecordMatcher(I);J&&t.removeRoute(J)}function m(){return t.getRoutes().map(I=>I.record)}function E(I){return!!t.getRecordMatcher(I)}function _(I,J){if(J=ve({},J||l.value),typeof I=="string"){const v=Ai(n,I,J.path),A=t.resolve({path:v.path},J),P=s.createHref(v.fullPath);return ve(v,A,{params:d(A.params),hash:Dr(v.hash),redirectedFrom:void 0,href:P})}let G;if(I.path!=null)G=ve({},I,{path:Ai(n,I.path,J.path).path});else{const v=ve({},I.params);for(const A in v)v[A]==null&&delete v[A];G=ve({},I,{params:h(v)}),J.params=h(J.params)}const ee=t.resolve(G,J),de=I.hash||"";ee.params=u(d(ee.params));const g=xp(r,ve({},I,{hash:wp(de),path:ee.path})),b=s.createHref(g);return ve({fullPath:g,hash:de,query:r===ja?Fp(I.query):I.query||{}},ee,{redirectedFrom:void 0,href:b})}function y(I){return typeof I=="string"?Ai(n,I,l.value.path):ve({},I)}function w(I,J){if(c!==I)return sr(Re.NAVIGATION_CANCELLED,{from:J,to:I})}function k(I){return N(I)}function C(I){return k(ve(y(I),{replace:!0}))}function L(I,J){const G=I.matched[I.matched.length-1];if(G&&G.redirect){const{redirect:ee}=G;let de=typeof ee=="function"?ee(I,J):ee;return typeof de=="string"&&(de=de.includes("?")||de.includes("#")?de=y(de):{path:de},de.params={}),ve({query:I.query,hash:I.hash,params:de.path!=null?{}:I.params},de)}}function N(I,J){const G=c=_(I),ee=l.value,de=I.state,g=I.force,b=I.replace===!0,v=L(G,ee);if(v)return N(ve(y(v),{state:typeof v=="object"?ve({},de,v.state):de,force:g,replace:b}),J||G);const A=G;A.redirectedFrom=J;let P;return!g&&Rp(r,ee,G)&&(P=sr(Re.NAVIGATION_DUPLICATED,{to:A,from:ee}),be(ee,ee,!0,!1)),(P?Promise.resolve(P):X(A,ee)).catch(R=>Ut(R)?Ut(R,Re.NAVIGATION_GUARD_REDIRECT)?R:he(R):B(R,A,ee)).then(R=>{if(R){if(Ut(R,Re.NAVIGATION_GUARD_REDIRECT))return N(ve({replace:b},y(R.to),{state:typeof R.to=="object"?ve({},de,R.to.state):de,force:g}),J||A)}else R=H(A,ee,!0,b,de);return ae(A,ee,R),R})}function U(I,J){const G=w(I,J);return G?Promise.reject(G):Promise.resolve()}function S(I){const J=Ie.values().next().value;return J&&typeof J.runWithContext=="function"?J.runWithContext(I):I()}function X(I,J){let G;const[ee,de,g]=Kp(I,J);G=xi(ee.reverse(),"beforeRouteLeave",I,J);for(const v of ee)v.leaveGuards.forEach(A=>{G.push(on(A,I,J))});const b=U.bind(null,I,J);return G.push(b),Xe(G).then(()=>{G=[];for(const v of i.list())G.push(on(v,I,J));return G.push(b),Xe(G)}).then(()=>{G=xi(de,"beforeRouteUpdate",I,J);for(const v of de)v.updateGuards.forEach(A=>{G.push(on(A,I,J))});return G.push(b),Xe(G)}).then(()=>{G=[];for(const v of g)if(v.beforeEnter)if(St(v.beforeEnter))for(const A of v.beforeEnter)G.push(on(A,I,J));else G.push(on(v.beforeEnter,I,J));return G.push(b),Xe(G)}).then(()=>(I.matched.forEach(v=>v.enterCallbacks={}),G=xi(g,"beforeRouteEnter",I,J,S),G.push(b),Xe(G))).then(()=>{G=[];for(const v of o.list())G.push(on(v,I,J));return G.push(b),Xe(G)}).catch(v=>Ut(v,Re.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function ae(I,J,G){a.list().forEach(ee=>S(()=>ee(I,J,G)))}function H(I,J,G,ee,de){const g=w(I,J);if(g)return g;const b=J===tn,v=Hn?history.state:{};G&&(ee||b?s.replace(I.fullPath,ve({scroll:b&&v&&v.scroll},de)):s.push(I.fullPath,de)),l.value=I,be(I,J,G,b),he()}let ue;function me(){ue||(ue=s.listen((I,J,G)=>{if(!He.listening)return;const ee=_(I),de=L(ee,He.currentRoute.value);if(de){N(ve(de,{replace:!0,force:!0}),ee).catch(Ar);return}c=ee;const g=l.value;Hn&&Mp(Ma(g.fullPath,G.delta),si()),X(ee,g).catch(b=>Ut(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_CANCELLED)?b:Ut(b,Re.NAVIGATION_GUARD_REDIRECT)?(N(ve(y(b.to),{force:!0}),ee).then(v=>{Ut(v,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&!G.delta&&G.type===Yi.pop&&s.go(-1,!1)}).catch(Ar),Promise.reject()):(G.delta&&s.go(-G.delta,!1),B(b,ee,g))).then(b=>{b=b||H(ee,g,!1),b&&(G.delta&&!Ut(b,Re.NAVIGATION_CANCELLED)?s.go(-G.delta,!1):G.type===Yi.pop&&Ut(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ae(ee,g,b)}).catch(Ar)}))}let Ne=ur(),x=ur(),j;function B(I,J,G){he(I);const ee=x.list();return ee.length?ee.forEach(de=>de(I,J,G)):console.error(I),Promise.reject(I)}function re(){return j&&l.value!==tn?Promise.resolve():new Promise((I,J)=>{Ne.add([I,J])})}function he(I){return j||(j=!I,me(),Ne.list().forEach(([J,G])=>I?G(I):J()),Ne.reset()),I}function be(I,J,G,ee){const{scrollBehavior:de}=e;if(!Hn||!de)return Promise.resolve();const g=!G&&jp(Ma(I.fullPath,0))||(ee||!G)&&history.state&&history.state.scroll||null;return tr().then(()=>de(I,J,g)).then(b=>b&&$p(b)).catch(b=>B(b,I,J))}const ye=I=>s.go(I);let Ke;const Ie=new Set,He={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:t.clearRoutes,hasRoute:E,getRoutes:m,resolve:_,options:e,push:k,replace:C,go:ye,back:()=>ye(-1),forward:()=>ye(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:x.add,isReady:re,install(I){I.component("RouterLink",Tr),I.component("RouterView",Qi),I.config.globalProperties.$router=He,Object.defineProperty(I.config.globalProperties,"$route",{enumerable:!0,get:()=>ze(l)}),Hn&&!Ke&&l.value===tn&&(Ke=!0,k(s.location).catch(ee=>{}));const J={};for(const ee in tn)Object.defineProperty(J,ee,{get:()=>l.value[ee],enumerable:!0});I.provide(ii,He),I.provide(No,ac(J)),I.provide(Xi,l);const G=I.unmount;Ie.add(I),I.unmount=function(){Ie.delete(I),Ie.size<1&&(c=tn,ue&&ue(),ue=null,l.value=tn,Ke=!1,j=!1),G()}}};function Xe(I){return I.reduce((J,G)=>J.then(()=>S(G)),Promise.resolve())}return He}function gg(){return pt(ii)}function Io(e){return pt(No)}const mg={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},bg={key:4,d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H10l-4 4v-4.2A2.5 2.5 0 0 1 5 12.5Z"},yg={key:5,d:"M4 12h4l2.2-5 3.6 10 2.2-5H20"},_g={key:8,d:"m6 9 6 6 6-6"},vg={key:9,d:"m6 15 6-6 6 6"},wg={key:10,d:"m9 6 6 6-6 6"},Eg={key:14,d:"M13 2 5 13h5l-1 9 8-11h-5Z"},Sg={key:18,cx:"12",cy:"12",r:"4.25",fill:"currentColor",stroke:"none"},De=fn({__name:"AppIcon",props:{name:{}},setup(e){return(t,n)=>(W(),z("svg",mg,[e.name==="grid"?(W(),z(fe,{key:0},[n[0]||(n[0]=M("rect",{x:"4",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[1]||(n[1]=M("rect",{x:"14",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[2]||(n[2]=M("rect",{x:"4",y:"14",width:"6",height:"6",rx:"1.5"},null,-1)),n[3]||(n[3]=M("rect",{x:"14",y:"14",width:"6",height:"6",rx:"1.5"},null,-1))],64)):e.name==="book"?(W(),z(fe,{key:1},[n[4]||(n[4]=M("path",{d:"M5 5.5a2.5 2.5 0 0 1 2.5-2.5H20v17H7.5A2.5 2.5 0 0 0 5 22Z"},null,-1)),n[5]||(n[5]=M("path",{d:"M5 5.5V22"},null,-1)),n[6]||(n[6]=M("path",{d:"M9 7h7"},null,-1))],64)):e.name==="settings"?(W(),z(fe,{key:2},[n[7]||(n[7]=M("circle",{cx:"12",cy:"12",r:"3.25"},null,-1)),n[8]||(n[8]=M("path",{d:"M19.4 15a1 1 0 0 0 .2 1.1l.1.1a1.9 1.9 0 0 1 0 2.7 1.9 1.9 0 0 1-2.7 0l-.1-.1a1 1 0 0 0-1.1-.2 1 1 0 0 0-.6.9V20a2 2 0 0 1-4 0v-.2a1 1 0 0 0-.6-.9 1 1 0 0 0-1.1.2l-.1.1a1.9 1.9 0 0 1-2.7 0 1.9 1.9 0 0 1 0-2.7l.1-.1a1 1 0 0 0 .2-1.1 1 1 0 0 0-.9-.6H4a2 2 0 0 1 0-4h.2a1 1 0 0 0 .9-.6 1 1 0 0 0-.2-1.1l-.1-.1a1.9 1.9 0 0 1 0-2.7 1.9 1.9 0 0 1 2.7 0l.1.1a1 1 0 0 0 1.1.2 1 1 0 0 0 .6-.9V4a2 2 0 0 1 4 0v.2a1 1 0 0 0 .6.9 1 1 0 0 0 1.1-.2l.1-.1a1.9 1.9 0 0 1 2.7 0 1.9 1.9 0 0 1 0 2.7l-.1.1a1 1 0 0 0-.2 1.1 1 1 0 0 0 .9.6H20a2 2 0 0 1 0 4h-.2a1 1 0 0 0-.9.6Z"},null,-1))],64)):e.name==="terminal"?(W(),z(fe,{key:3},[n[9]||(n[9]=M("path",{d:"M4 6h16v12H4z",rx:"2"},null,-1)),n[10]||(n[10]=M("path",{d:"m8 10 2 2-2 2"},null,-1)),n[11]||(n[11]=M("path",{d:"M12.5 16H16"},null,-1))],64)):e.name==="message"?(W(),z("path",bg)):e.name==="activity"?(W(),z("path",yg)):e.name==="sparkles"?(W(),z(fe,{key:6},[n[12]||(n[12]=M("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5Z"},null,-1)),n[13]||(n[13]=M("path",{d:"m19 14 .7 2.1L22 16.8l-2.3.7L19 20l-.7-2.5-2.3-.7 2.3-.7Z"},null,-1)),n[14]||(n[14]=M("path",{d:"m5 15 .8 2.3L8 18l-2.2.7L5 21l-.8-2.3L2 18l2.2-.7Z"},null,-1))],64)):e.name==="git-branch"?(W(),z(fe,{key:7},[n[15]||(n[15]=M("path",{d:"M6 4v9a3 3 0 1 0 2 2.8V8h8"},null,-1)),n[16]||(n[16]=M("path",{d:"M16 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1)),n[17]||(n[17]=M("path",{d:"M8 16a3 3 0 1 0-4 2.8"},null,-1))],64)):e.name==="chevron-down"?(W(),z("path",_g)):e.name==="chevron-up"?(W(),z("path",vg)):e.name==="chevron-right"?(W(),z("path",wg)):e.name==="plus"?(W(),z(fe,{key:11},[n[18]||(n[18]=M("path",{d:"M12 5v14"},null,-1)),n[19]||(n[19]=M("path",{d:"M5 12h14"},null,-1))],64)):e.name==="trash"?(W(),z(fe,{key:12},[n[20]||(n[20]=uf('<path d="M4 7h16"></path><path d="M10 11v6"></path><path d="M14 11v6"></path><path d="M6 7l1 12h10l1-12"></path><path d="M9 7V4h6v3"></path>',5))],64)):e.name==="x"?(W(),z(fe,{key:13},[n[21]||(n[21]=M("path",{d:"M6 6l12 12"},null,-1)),n[22]||(n[22]=M("path",{d:"M18 6 6 18"},null,-1))],64)):e.name==="zap"?(W(),z("path",Eg)):e.name==="calendar"?(W(),z(fe,{key:15},[n[23]||(n[23]=M("rect",{x:"3.5",y:"5",width:"17",height:"15.5",rx:"2"},null,-1)),n[24]||(n[24]=M("path",{d:"M7 3v4"},null,-1)),n[25]||(n[25]=M("path",{d:"M17 3v4"},null,-1)),n[26]||(n[26]=M("path",{d:"M3.5 9.5h17"},null,-1))],64)):e.name==="inbox"?(W(),z(fe,{key:16},[n[27]||(n[27]=M("path",{d:"M4 6h16l-2 10H6Z"},null,-1)),n[28]||(n[28]=M("path",{d:"M8 12h8"},null,-1)),n[29]||(n[29]=M("path",{d:"M7 16h10"},null,-1))],64)):e.name==="server"?(W(),z(fe,{key:17},[n[30]||(n[30]=M("rect",{x:"4",y:"4",width:"16",height:"6",rx:"1.5"},null,-1)),n[31]||(n[31]=M("rect",{x:"4",y:"14",width:"16",height:"6",rx:"1.5"},null,-1)),n[32]||(n[32]=M("path",{d:"M8 7h.01"},null,-1)),n[33]||(n[33]=M("path",{d:"M8 17h.01"},null,-1))],64)):e.name==="circle"?(W(),z("circle",Sg)):Ue("",!0)]))}});function oi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function kg(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}const Ag=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Po extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Tg extends Po{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ja extends Po{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Ya extends Po{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var eo;(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"})(eo||(eo={}));class xg{constructor(t,{headers:n={},customFetch:r,region:s=eo.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=Ag(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return kg(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const p=new URL(`${this.url}/${n}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let m;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(d["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(d["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 E=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(E=o.signal,u.addEventListener("abort",()=>o.abort())):E=o.signal);const _=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:m,signal:E}).catch(C=>{throw new Tg(C)}),y=_.headers.get("x-relay-error");if(y&&y==="true")throw new Ja(_);if(!_.ok)throw new Ya(_);let w=((s=_.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),k;return w==="application/json"?k=yield _.json():w==="application/octet-stream"||w==="application/pdf"?k=yield _.blob():w==="text/event-stream"?k=_:w==="multipart/form-data"?k=yield _.formData():k=yield _.text(),{data:k,error:null,response:_}}catch(a){return{data:null,error:a,response:a instanceof Ya||a instanceof Ja?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const pu=3,Za=e=>Math.min(1e3*2**e,3e4),Rg=[520,503],gu=["GET","HEAD","OPTIONS"];var Og=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 Xa(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",s),n()},e);function s(){clearTimeout(r),n()}t==null||t.addEventListener("abort",s)})}function Cg(e,t,n,r){return!(!r||n>=pu||!gu.includes(e)||!Rg.includes(t))}var Ng=class{constructor(e){var t,n,r,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(n.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:n.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!gu.includes(n.method))throw h;if(n.retryEnabled&&o<pu){const d=Za(o);o++,await Xa(d,n.signal);continue}throw h}if(Cg(n.method,u.status,o,n.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Za(o);await u.text(),o++,await Xa(d,n.signal);continue}return await n.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,p,m;const y=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",w=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
31
31
 
32
- Caused by: ${(m=h==null?void 0:h.name)!==null&&m!==void 0?m:"Error"}: ${y}`,v&&(l+=` (${v})`),h!=null&&h.stack&&(l+=`
33
- ${h.stack}`)}else{var w;l=(w=o==null?void 0:o.stack)!==null&&w!==void 0?w:""}const E=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,s=null,i=e.status,o=e.statusText;if(e.ok){var a,l;if(t.method!=="HEAD"){var c;const d=await e.text();d===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=t.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(r=[],n=null,i=200,o="OK")}catch{e.status===404&&u===""?(i=204,o="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new Og(n)}return{success:n===null,error:n,data:r,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Ig=class extends Ng{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const Qa=new RegExp("[,()]");var Fn=class extends Ig{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Pg=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new Fn({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Fn({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),r&&l.append("Prefer",`count=${r}`),s||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new Fn({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Fn({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Fn({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Dr(e){"@babel/helpers - typeof";return Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(e)}function Lg(e,t){if(Dr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $g(e){var t=Lg(e,"string");return Dr(t)=="symbol"?t:t+""}function Mg(e,t,n){return(t=$g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function is(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){Mg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jg=class bu{constructor(t,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const p=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",p,{once:!0}),l(c,is(is({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,is(is({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Pg(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 bu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(n).some(u);h?(a="POST",c=n):r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([f,p])=>p!==void 0).map(([f,p])=>[f,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([f,p])=>{l.searchParams.append(f,p)})):(a="POST",c=n);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new Fn({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Dg{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
32
+ Caused by: ${(m=h==null?void 0:h.name)!==null&&m!==void 0?m:"Error"}: ${y}`,w&&(l+=` (${w})`),h!=null&&h.stack&&(l+=`
33
+ ${h.stack}`)}else{var E;l=(E=o==null?void 0:o.stack)!==null&&E!==void 0?E:""}const _=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",_>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${_} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",_>this.urlLengthLimit&&(c+=`. Your request URL is ${_} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,s=null,i=e.status,o=e.statusText;if(e.ok){var a,l;if(t.method!=="HEAD"){var c;const d=await e.text();d===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=t.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(r=[],n=null,i=200,o="OK")}catch{e.status===404&&u===""?(i=204,o="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new Og(n)}return{success:n===null,error:n,data:r,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Ig=class extends Ng{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const Qa=new RegExp("[,()]");var Fn=class extends Ig{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Pg=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new Fn({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Fn({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),r&&l.append("Prefer",`count=${r}`),s||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new Fn({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Fn({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Fn({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Ur(e){"@babel/helpers - typeof";return Ur=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},Ur(e)}function Lg(e,t){if(Ur(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ur(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $g(e){var t=Lg(e,"string");return Ur(t)=="symbol"?t:t+""}function Mg(e,t,n){return(t=$g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){Mg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jg=class mu{constructor(t,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const p=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",p,{once:!0}),l(c,os(os({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,os(os({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Pg(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 mu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(n).some(u);h?(a="POST",c=n):r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([f,p])=>p!==void 0).map(([f,p])=>[f,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([f,p])=>{l.searchParams.append(f,p)})):(a="POST",c=n);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new Fn({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Dg{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
34
34
  import ws from "ws"
35
35
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
36
36
 
37
- Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Ug="2.105.4",Bg=`realtime-js/${Ug}`,Hg="1.0.0",yu="2.0.0",Fg=yu,qg=1e4,Kg=100,on={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},_u={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},to={connecting:"connecting",closing:"closing",closed:"closed"};class Wg{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var s,i;const o=t.topic,a=(s=t.ref)!==null&&s!==void 0?s:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let p=new DataView(f),m=0;p.setUint8(m++,this.KINDS.userBroadcastPush),p.setUint8(m++,l.length),p.setUint8(m++,a.length),p.setUint8(m++,o.length),p.setUint8(m++,c.length),p.setUint8(m++,h.length),p.setUint8(m++,n),Array.from(l,E=>p.setUint8(m++,E.charCodeAt(0))),Array.from(a,E=>p.setUint8(m++,E.charCodeAt(0))),Array.from(o,E=>p.setUint8(m++,E.charCodeAt(0))),Array.from(c,E=>p.setUint8(m++,E.charCodeAt(0))),Array.from(h,E=>p.setUint8(m++,E.charCodeAt(0)));var w=new Uint8Array(f.byteLength+r.byteLength);return w.set(new Uint8Array(f),0),w.set(new Uint8Array(r),f.byteLength),w.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,i,o,a,l]=r;return n({join_ref:s,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,s)}}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(t.slice(l,l+s));l=l+s;const u=r.decode(t.slice(l,l+i));l=l+i;const h=r.decode(t.slice(l,l+o));l=l+o;const d=t.slice(l,t.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.decode(d)):d,p={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}var Se;(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"})(Se||(Se={}));const tl=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Vg(o,e,t,s),i),{}):{}},Vg=(e,t,n,r)=>{const s=t.find(a=>a.name===e),i=s==null?void 0:s.type,o=n[e];return i&&!r.includes(i)?vu(i,o):no(o)},vu=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Yg(t,n)}switch(e){case Se.bool:return Gg(t);case Se.float4:case Se.float8:case Se.int2:case Se.int4:case Se.int8:case Se.numeric:case Se.oid:return zg(t);case Se.json:case Se.jsonb:return Jg(t);case Se.timestamp:return Zg(t);case Se.abstime:case Se.date:case Se.daterange:case Se.int4range:case Se.int8range:case Se.money:case Se.reltime:case Se.text:case Se.time:case Se.timestamptz:case Se.timetz:case Se.tsrange:case Se.tstzrange:return no(t);default:return no(t)}},no=e=>e,Gg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},zg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Jg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Yg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>vu(t,a))}return e},Zg=e=>typeof e=="string"?e.replace(" ","T"):e,wu=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 Tr=e=>typeof e=="function"?e:function(){return e},Xg=typeof self<"u"?self:null,qn=typeof window<"u"?window:null,Ct=Xg||qn||globalThis,Qg="2.0.0",em=1e4,tm=1e3,Pt={connecting:0,open:1,closing:2,closed:3},rt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ht={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ro={longpoll:"longpoll",websocket:"websocket"},nm={complete:4},so="base64url.bearer.phx.",os=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Eu=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))}},rm=class{constructor(e,t,n){this.state=rt.closed,this.topic=e,this.params=Tr(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new os(this,Ht.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Eu(()=>{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=rt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=rt.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=rt.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=rt.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 os(this,Ht.leave,Tr({}),this.timeout).send(),this.state=rt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ht.reply,(r,s)=>{this.trigger(this.replyEventName(s),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=rt.closed,this.bindings=[]}onClose(e){this.on(Ht.close,e)}onError(e){return this.on(Ht.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new os(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=rt.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ht.close,"leave")},n=new os(this,Ht.leave,Tr({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=rt.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===rt.closed}isErrored(){return this.state===rt.errored}isJoined(){return this.state===rt.joined}isJoining(){return this.state===rt.joining}isLeaving(){return this.state===rt.leaving}},Is=class{static request(e,t,n,r,s,i,o){if(Ct.XDomainRequest){let a=new Ct.XDomainRequest;return this.xdomainRequest(a,e,t,r,s,i,o)}else if(Ct.XMLHttpRequest){let a=new Ct.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,i,o)}else{if(Ct.fetch&&Ct.AbortController)return this.fetchRequest(e,t,n,r,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,s,i,o){let a={method:e,headers:n,body:r},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Ct.fetch(t,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(e,t,n,r,s,i,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,i,o,a){e.open(t,n,!0),e.timeout=i;for(let[l,c]of Object.entries(r))e.setRequestHeader(l,c);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===nm.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,i=e[r];typeof i=="object"?n.push(this.serialize(i,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},sm=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let s=0;s<r;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ln=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(so)&&(this.authToken=atob(t[1].slice(so.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=Pt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ro.websocket),"$1/"+ro.longpoll)}endpointURL(){return Is.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Pt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Pt.open||this.readyState===Pt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:s}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Pt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=sm(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(`
38
- `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=Pt.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let i,o=()=>{this.reqs.delete(i),r()};i=Is.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},im=class pr{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=pr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=pr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=pr.syncDiff(this.state,s,i,o),a())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return pr.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,s){let i=this.clone(t),o={},a={};return this.map(i,(l,c)=>{n[l]||(a[l]=c)}),this.map(n,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(m=>m.phx_ref),d=u.metas.map(m=>m.phx_ref),f=c.metas.filter(m=>d.indexOf(m.phx_ref)<0),p=u.metas.filter(m=>h.indexOf(m.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),p.length>0&&(a[l]=this.clone(u),a[l].metas=p)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},r,s)}static syncDiff(t,n,r,s){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=t[a];if(t[a]=this.clone(l),c){let u=t[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);t[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=t[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete t[a]}),t}static list(t,n){return n||(n=function(r,s){return s}),this.map(t,(r,s)=>n(r,s))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},as={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,i,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:i}=e,o=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),Array.from(t,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+r));o=o+r;let l=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+i));o=o+i;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+r));a=a+r;let c=n.decode(e.slice(a,a+s));a=a+s;let u=n.decode(e.slice(a,a+i));a=a+i;let h=n.decode(e.slice(a,a+o));a=a+o;let d=e.slice(a,e.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ht.reply,payload:f}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+r));i=i+r;let a=n.decode(e.slice(i,i+s));i=i+s;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},om=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||em,this.transport=t.transport||Ct.WebSocket||Ln,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Ct&&Ct.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=as.encode.bind(as),this.defaultDecoder=as.decode.bind(as),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!==Ln?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;qn&&qn.addEventListener&&(qn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),r=this.connectClock)}),qn.addEventListener("pageshow",s=>{r===this.connectClock&&(r=null,this.connect())}),qn.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Tr(t.params||{}),this.endPoint=`${e}/${ro.websocket}`,this.vsn=t.vsn||Qg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Eu(()=>{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 Ln}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=Is.appendParams(Is.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Tr(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ln?this.connectWithFallback(Ln,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case Ln:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${so}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,s,i,o=this.transportName(e),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),i=this.onError(l=>{this.log("transport","error",l),r&&!n&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let l=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),tm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Pt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Ht.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Pt.connecting:return"connecting";case Pt.open:return"open";case Pt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new rm(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${s})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:s,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(n,r,s,o)&&l.trigger(r,s,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Rr{constructor(t,n){const r=lm(n);this.presence=new im(t.getChannel(),r),this.presence.onJoin((s,i,o)=>{const a=Rr.onJoinPayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Rr.onLeavePayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rr.transformState(this.presence.state)}static transformState(t){return t=am(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const s=t[r];return n[r]=ws(s),n},{})}static onJoinPayload(t,n,r){const s=nl(n),i=ws(r);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,n,r){const s=nl(n),i=ws(r);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function ws(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function am(e){return JSON.parse(JSON.stringify(e))}function lm(e){return(e==null?void 0:e.events)&&{events:e.events}}function nl(e){return e!=null&&e.metas?ws(e):[]}var rl;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(rl||(rl={}));class cm{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Rr(this.channel.channelAdapter,n)}}function um(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class hm{constructor(t,n,r){const s=dm(r);this.channel=t.getSocket().channel(n,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let s;try{s=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Kg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===on.joined}isJoined(){return this.state===on.joined}isJoining(){return this.state===on.joining}isClosed(){return this.state===on.closed}isLeaving(){return this.state===on.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function dm(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var sl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(sl||(sl={}));var Vn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Vn||(Vn={}));var Ft;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Ft||(Ft={}));class xr{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var s,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new hm(this.socket.socketAdapter,t,this.params),this.presence=new cm(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=wu(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Vn.PRESENCE]&&this.bindings[Vn.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{t==null||t(Ft.CHANNEL_ERROR,um(f))}),this._onClose(()=>t==null?void 0:t(Ft.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(Ft.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=on.errored;const p=Object.values(f).join(", ")||"error";t==null||t(Ft.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{t==null||t(Ft.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const s=this.bindings.postgres_changes,i=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=t&&t[a];if(f&&f.event===c&&xr.isFilterValueEqual(f.schema,u)&&xr.isFilterValueEqual(f.table,h)&&xr.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=on.errored,n==null||n(Ft.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=on.errored&&n&&n(Ft.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Vn.PRESENCE||t===Vn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,n={}){var r,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_on(t,n,r){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,r),o={type:s,filter:n,callback:r,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var s,i,o,a,l,c,u;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===t.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,p=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=n.ids)===null||o===void 0?void 0:o.includes(f))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((a=n.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,n){const{close:r,error:s,leave:i,join:o}=_u;return n&&[r,s,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const s=n.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=tl(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=tl(t.columns,t.old_record)),n}}class fm{constructor(t,n){this.socket=new om(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==to.connecting}isDisconnecting(){return this.socket.connectionState()==to.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const il={HEARTBEAT_INTERVAL:25e3},pm=[1e3,2e3,5e3,1e4],gm=1e4;function mm(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function bm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return mm()}const ym=`
37
+ Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Ug="2.105.4",Bg=`realtime-js/${Ug}`,Hg="1.0.0",bu="2.0.0",Fg=bu,qg=1e4,Kg=100,an={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},yu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},to={connecting:"connecting",closing:"closing",closed:"closed"};class Wg{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var s,i;const o=t.topic,a=(s=t.ref)!==null&&s!==void 0?s:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let p=new DataView(f),m=0;p.setUint8(m++,this.KINDS.userBroadcastPush),p.setUint8(m++,l.length),p.setUint8(m++,a.length),p.setUint8(m++,o.length),p.setUint8(m++,c.length),p.setUint8(m++,h.length),p.setUint8(m++,n),Array.from(l,_=>p.setUint8(m++,_.charCodeAt(0))),Array.from(a,_=>p.setUint8(m++,_.charCodeAt(0))),Array.from(o,_=>p.setUint8(m++,_.charCodeAt(0))),Array.from(c,_=>p.setUint8(m++,_.charCodeAt(0))),Array.from(h,_=>p.setUint8(m++,_.charCodeAt(0)));var E=new Uint8Array(f.byteLength+r.byteLength);return E.set(new Uint8Array(f),0),E.set(new Uint8Array(r),f.byteLength),E.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,i,o,a,l]=r;return n({join_ref:s,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,s)}}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(t.slice(l,l+s));l=l+s;const u=r.decode(t.slice(l,l+i));l=l+i;const h=r.decode(t.slice(l,l+o));l=l+o;const d=t.slice(l,t.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.decode(d)):d,p={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}var ke;(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"})(ke||(ke={}));const tl=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Vg(o,e,t,s),i),{}):{}},Vg=(e,t,n,r)=>{const s=t.find(a=>a.name===e),i=s==null?void 0:s.type,o=n[e];return i&&!r.includes(i)?_u(i,o):no(o)},_u=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Yg(t,n)}switch(e){case ke.bool:return Gg(t);case ke.float4:case ke.float8:case ke.int2:case ke.int4:case ke.int8:case ke.numeric:case ke.oid:return zg(t);case ke.json:case ke.jsonb:return Jg(t);case ke.timestamp:return Zg(t);case ke.abstime:case ke.date:case ke.daterange:case ke.int4range:case ke.int8range:case ke.money:case ke.reltime:case ke.text:case ke.time:case ke.timestamptz:case ke.timetz:case ke.tsrange:case ke.tstzrange:return no(t);default:return no(t)}},no=e=>e,Gg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},zg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Jg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Yg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>_u(t,a))}return e},Zg=e=>typeof e=="string"?e.replace(" ","T"):e,vu=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 xr=e=>typeof e=="function"?e:function(){return e},Xg=typeof self<"u"?self:null,qn=typeof window<"u"?window:null,Ct=Xg||qn||globalThis,Qg="2.0.0",em=1e4,tm=1e3,Pt={connecting:0,open:1,closing:2,closed:3},st={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ft={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ro={longpoll:"longpoll",websocket:"websocket"},nm={complete:4},so="base64url.bearer.phx.",as=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},wu=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))}},rm=class{constructor(e,t,n){this.state=st.closed,this.topic=e,this.params=xr(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new as(this,Ft.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new wu(()=>{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=st.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=st.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=st.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=st.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new as(this,Ft.leave,xr({}),this.timeout).send(),this.state=st.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ft.reply,(r,s)=>{this.trigger(this.replyEventName(s),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=st.closed,this.bindings=[]}onClose(e){this.on(Ft.close,e)}onError(e){return this.on(Ft.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new as(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=st.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ft.close,"leave")},n=new as(this,Ft.leave,xr({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=st.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===st.closed}isErrored(){return this.state===st.errored}isJoined(){return this.state===st.joined}isJoining(){return this.state===st.joining}isLeaving(){return this.state===st.leaving}},Is=class{static request(e,t,n,r,s,i,o){if(Ct.XDomainRequest){let a=new Ct.XDomainRequest;return this.xdomainRequest(a,e,t,r,s,i,o)}else if(Ct.XMLHttpRequest){let a=new Ct.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,i,o)}else{if(Ct.fetch&&Ct.AbortController)return this.fetchRequest(e,t,n,r,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,s,i,o){let a={method:e,headers:n,body:r},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Ct.fetch(t,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(e,t,n,r,s,i,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,i,o,a){e.open(t,n,!0),e.timeout=i;for(let[l,c]of Object.entries(r))e.setRequestHeader(l,c);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===nm.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,i=e[r];typeof i=="object"?n.push(this.serialize(i,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},sm=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let s=0;s<r;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ln=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(so)&&(this.authToken=atob(t[1].slice(so.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=Pt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ro.websocket),"$1/"+ro.longpoll)}endpointURL(){return Is.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Pt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Pt.open||this.readyState===Pt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:s}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Pt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=sm(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(`
38
+ `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=Pt.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let i,o=()=>{this.reqs.delete(i),r()};i=Is.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},im=class gr{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=gr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=gr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=gr.syncDiff(this.state,s,i,o),a())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return gr.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,s){let i=this.clone(t),o={},a={};return this.map(i,(l,c)=>{n[l]||(a[l]=c)}),this.map(n,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(m=>m.phx_ref),d=u.metas.map(m=>m.phx_ref),f=c.metas.filter(m=>d.indexOf(m.phx_ref)<0),p=u.metas.filter(m=>h.indexOf(m.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),p.length>0&&(a[l]=this.clone(u),a[l].metas=p)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},r,s)}static syncDiff(t,n,r,s){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=t[a];if(t[a]=this.clone(l),c){let u=t[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);t[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=t[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete t[a]}),t}static list(t,n){return n||(n=function(r,s){return s}),this.map(t,(r,s)=>n(r,s))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},ls={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,i,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:i}=e,o=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),Array.from(t,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+r));o=o+r;let l=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+i));o=o+i;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+r));a=a+r;let c=n.decode(e.slice(a,a+s));a=a+s;let u=n.decode(e.slice(a,a+i));a=a+i;let h=n.decode(e.slice(a,a+o));a=a+o;let d=e.slice(a,e.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ft.reply,payload:f}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+r));i=i+r;let a=n.decode(e.slice(i,i+s));i=i+s;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},om=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||em,this.transport=t.transport||Ct.WebSocket||Ln,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Ct&&Ct.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=ls.encode.bind(ls),this.defaultDecoder=ls.decode.bind(ls),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!==Ln?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;qn&&qn.addEventListener&&(qn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),r=this.connectClock)}),qn.addEventListener("pageshow",s=>{r===this.connectClock&&(r=null,this.connect())}),qn.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=xr(t.params||{}),this.endPoint=`${e}/${ro.websocket}`,this.vsn=t.vsn||Qg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new wu(()=>{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 Ln}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=Is.appendParams(Is.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=xr(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ln?this.connectWithFallback(Ln,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case Ln:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${so}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,s,i,o=this.transportName(e),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),i=this.onError(l=>{this.log("transport","error",l),r&&!n&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let l=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),tm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Pt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Ft.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Pt.connecting:return"connecting";case Pt.open:return"open";case Pt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new rm(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${s})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:s,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(n,r,s,o)&&l.trigger(r,s,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Rr{constructor(t,n){const r=lm(n);this.presence=new im(t.getChannel(),r),this.presence.onJoin((s,i,o)=>{const a=Rr.onJoinPayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Rr.onLeavePayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rr.transformState(this.presence.state)}static transformState(t){return t=am(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const s=t[r];return n[r]=ws(s),n},{})}static onJoinPayload(t,n,r){const s=nl(n),i=ws(r);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,n,r){const s=nl(n),i=ws(r);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function ws(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function am(e){return JSON.parse(JSON.stringify(e))}function lm(e){return(e==null?void 0:e.events)&&{events:e.events}}function nl(e){return e!=null&&e.metas?ws(e):[]}var rl;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(rl||(rl={}));class cm{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Rr(this.channel.channelAdapter,n)}}function um(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class hm{constructor(t,n,r){const s=dm(r);this.channel=t.getSocket().channel(n,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let s;try{s=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Kg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===an.joined}isJoined(){return this.state===an.joined}isJoining(){return this.state===an.joining}isClosed(){return this.state===an.closed}isLeaving(){return this.state===an.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function dm(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var sl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(sl||(sl={}));var Gn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Gn||(Gn={}));var qt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(qt||(qt={}));class Or{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var s,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new hm(this.socket.socketAdapter,t,this.params),this.presence=new cm(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=vu(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Gn.PRESENCE]&&this.bindings[Gn.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{t==null||t(qt.CHANNEL_ERROR,um(f))}),this._onClose(()=>t==null?void 0:t(qt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(qt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=an.errored;const p=Object.values(f).join(", ")||"error";t==null||t(qt.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{t==null||t(qt.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const s=this.bindings.postgres_changes,i=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=t&&t[a];if(f&&f.event===c&&Or.isFilterValueEqual(f.schema,u)&&Or.isFilterValueEqual(f.table,h)&&Or.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=an.errored,n==null||n(qt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=an.errored&&n&&n(qt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Gn.PRESENCE||t===Gn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,n={}){var r,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_on(t,n,r){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,r),o={type:s,filter:n,callback:r,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var s,i,o,a,l,c,u;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===t.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,p=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=n.ids)===null||o===void 0?void 0:o.includes(f))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((a=n.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,n){const{close:r,error:s,leave:i,join:o}=yu;return n&&[r,s,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const s=n.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=tl(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=tl(t.columns,t.old_record)),n}}class fm{constructor(t,n){this.socket=new om(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==to.connecting}isDisconnecting(){return this.socket.connectionState()==to.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const il={HEARTBEAT_INTERVAL:25e3},pm=[1e3,2e3,5e3,1e4],gm=1e4;function mm(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function bm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return mm()}const ym=`
39
39
  addEventListener("message", (e) => {
40
40
  if (e.data.event === "start") {
41
41
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
42
42
  }
43
- });`;class _m{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new Wg,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const s=this._initializeOptions(n);this.socketAdapter=new fm(t,s),this.httpEndpoint=wu(t),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n}
43
+ });`;class _m{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new Wg,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const s=this._initializeOptions(n);this.socketAdapter=new fm(t,s),this.httpEndpoint=vu(t),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n}
44
44
 
45
45
  To use Realtime in Node.js, you need to provide a WebSocket implementation:
46
46
 
@@ -53,29 +53,29 @@ Option 2: Install and provide the "ws" package:
53
53
  const client = new RealtimeClient(url, {
54
54
  ...options,
55
55
  transport: ws
56
- })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const s=await r.unsubscribe();return r.teardown(),s}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||to.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new xr(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:Bg};n&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(_u.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([ym],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,s,i,o,a,l,c,u,h,d,f;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const p={};p.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:qg,p.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:il.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:il.HEARTBEAT_INTERVAL),p.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:Dg.getWebSocketConstructor(),p.params=t==null?void 0:t.params,p.logger=t==null?void 0:t.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),p.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:bm(),p.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>pm[y-1]||gm;let m,w;const E=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:Fg;switch(E){case Hg:m=(y,v)=>v(JSON.stringify(y)),w=(y,v)=>v(JSON.parse(y));break;case yu:m=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=E,p.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:m,p.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:w,p.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,p.params=Object.assign(Object.assign({},p.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,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Ur=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function vm(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function wm(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 Em(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=vm(e.baseUrl,r,s),l=await wm(e.auth),c=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,p=f==null?void 0:f.error;throw new Ur((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function ls(e){return e.join("")}var Sm=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:ls(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ls(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ls(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ls(e.namespace)}`}),!0}catch(t){if(t instanceof Ur&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Ur&&n.status===409)return;throw n}}};function $n(e){return e.join("")}var km=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${$n(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/${$n(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/${$n(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Ur&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Ur&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Am=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Em({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new Sm(this.client,t),this.tableOps=new km(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 Br(e){"@babel/helpers - typeof";return Br=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},Br(e)}function Tm(e,t){if(Br(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Br(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rm(e){var t=Tm(e,"string");return Br(t)=="symbol"?t:t+""}function xm(e,t,n){return(t=Rm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){xm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ai=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function li(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var io=class extends ai{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return oe({},super.toJSON())}},Su=class extends ai{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Ps(e,t,n){const r=oe({},e),s=t.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===s&&delete r[i];return r[s]=n,r}function Om(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const Cm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Nm=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)},oo=e=>{if(Array.isArray(e))return e.map(n=>oo(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=oo(r)}),t},Im=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),al=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},Pm=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new io(al(o),i,a,r))}).catch(()=>{const o=i+"";t(new io(s.statusText||`HTTP ${i} error`,i,o,r))})}else t(new Su(al(e),e,r))},Lm=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return oe(oe({},s),n);if(Nm(r)){var i;const o=(t==null?void 0:t.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(r)}else s.body=r;return t!=null&&t.duplex&&(s.duplex=t.duplex),oe(oe({},s),n)};async function ur(e,t,n,r,s,i,o){return new Promise((a,l)=>{e(n,Lm(t,r,s,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Pm(c,l,r,o))})}function ku(e="storage"){return{get:async(t,n,r,s)=>ur(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>ur(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>ur(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>ur(t,"HEAD",n,oe(oe({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>ur(t,"DELETE",n,s,i,r,e)}}const $m=ku("storage"),{get:Hr,post:bt,put:ao,head:Mm,remove:Lo}=$m,ot=ku("vectors");var ir=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Om(t),this.fetch=Cm(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ps(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(li(n))return{data:null,error:n};throw n}}},jm=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(li(t))return{data:null,error:t};throw t}}};let Au;Au=Symbol.toStringTag;var Dm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Au]="BlobDownloadBuilder",this.promise=null}asStream(){return new jm(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(li(t))return{data:null,error:t};throw t}}};const Um={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ll={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Bm=class extends ir{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=oe(oe({},ll),r);let a=oe(oe({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(t),u=s._getFinalPath(c),h=await(e=="PUT"?ao:bt)(s.fetch,`${s.url}/object/${u}`,i,oe({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let l;const c=oe(oe({},ll),r);let u=oe(oe({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=Ps(u,d,f);return{path:i,fullPath:(await ao(s.fetch,a.toString(),l,oe({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=oe({},n.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await bt(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new ai("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await bt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await bt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await bt(r.fetch,`${r.url}/object/sign/${s}`,oe({expiresIn:t},i?{transform:n.transform}:{}),{headers:r.headers});const a=new URLSearchParams;n!=null&&n.download&&a.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&a.set("cacheNonce",String(n.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await bt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return s.map(a=>oe(oe({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),o=this._getFinalPath(e),a=()=>Hr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new Dm(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>oo(await Hr(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Mm(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(li(s)){var r;const i=s instanceof io?s.status:s instanceof Su?(r=s.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const s=r.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=oe(oe(oe({},Um),t),{},{prefix:e||""});return await bt(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=oe({},e);return await bt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const Hm="2.105.4",es={"X-Client-Info":`storage-js/${Hm}`};var Fm=class extends ir{constructor(e,t={},n,r){const s=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=oe(oe({},es),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Hr(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Hr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await bt(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await ao(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await bt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(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():""}},qm=class extends ir{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},es),t);super(r,s,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await bt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Hr(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Im(e))throw new ai("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Am({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},Km=class extends ir{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},es),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},Wm=class extends ir{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},es),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ot.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 ot.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ot.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 ot.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Vm=class extends ir{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},es),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Gm=class extends Vm{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new zm(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},zm=class extends Km{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Jm(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Jm=class extends Wm{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Ym=class extends Fm{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Bm(this.url,this.headers,e,this.fetch)}get vectors(){return new Gm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new qm(this.url+"/iceberg",this.headers,this.fetch)}};const Tu="2.105.4",Kn=30*1e3,lo=3,xi=lo*Kn,Zm="http://localhost:9999",Xm="supabase.auth.token",Qm={"X-Client-Info":`gotrue-js/${Tu}`},co="X-Supabase-Api-Version",Ru={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eb=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,tb=10*60*1e3;class Fr extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function W(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class nb extends Fr{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function rb(e){return W(e)&&e.name==="AuthApiError"}class _t extends Fr{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Xt extends Fr{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class He extends Xt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function cs(e){return W(e)&&e.name==="AuthSessionMissingError"}class Mn extends Xt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class us extends Xt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class hs extends Xt{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function sb(e){return W(e)&&e.name==="AuthImplicitGrantRedirectError"}class cl extends Xt{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class ib extends Xt{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class uo extends Xt{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Oi(e){return W(e)&&e.name==="AuthRetryableFetchError"}class ul extends Xt{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ho extends Xt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),hl=`
57
- \r=`.split(""),ob=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<hl.length;t+=1)e[hl[t].charCodeAt(0)]=-2;for(let t=0;t<Ls.length;t+=1)e[Ls[t].charCodeAt(0)]=t;return e})();function dl(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}}function xu(e,t,n){const r=ob[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function fl(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{cb(o,r,n)};for(let o=0;o<e.length;o+=1)xu(e.charCodeAt(o),s,i);return t.join("")}function ab(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 lb(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}ab(r,t)}}function cb(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Xn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)xu(e.charCodeAt(s),n,r);return new Uint8Array(t)}function ub(e){const t=[];return lb(e,n=>t.push(n)),new Uint8Array(t)}function Tn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>dl(s,n,r)),dl(null,n,r),t.join("")}function hb(e){return Math.round(Date.now()/1e3)+e}function db(){return Symbol("auth-callback")}const We=()=>typeof window<"u"&&typeof document<"u",yn={tested:!1,writable:!1},Ou=()=>{if(!We())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yn.tested)return yn.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),yn.tested=!0,yn.writable=!0}catch{yn.tested=!0,yn.writable=!1}return yn.writable};function fb(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const Cu=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),pb=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Wn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},_n=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},Ke=async(e,t)=>{await e.removeItem(t)};class ci{constructor(){this.promise=new ci.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ci.promiseConstructor=Promise;function ds(e){const t=e.split(".");if(t.length!==3)throw new ho("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!eb.test(t[r]))throw new ho("JWT not in base64url format");return{header:JSON.parse(fl(t[0])),payload:JSON.parse(fl(t[1])),signature:Xn(t[2]),raw:{header:t[0],payload:t[1]}}}async function gb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function mb(e,t){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function bb(e){return("0"+e.toString(16)).substr(-2)}function yb(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,bb).join("")}async function _b(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function vb(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await _b(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jn(e,t,n=!1){const r=yb();let s=r;n&&(s+="/recovery"),await Wn(e,`${t}-code-verifier`,s);const i=await vb(r);return[i,r===i?"plain":"s256"]}const wb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Eb(e){const t=e.headers.get(co);if(!t||!t.match(wb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Sb(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 kb(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 Ab=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ut(e){if(!Ab.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function mt(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 Ci(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Tb(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function pl(e){return JSON.parse(JSON.stringify(e))}const wn=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)},Rb=[502,503,504,520,521,522,523,524,530];async function gl(e){var t;if(!pb(e))throw new uo(wn(e),0);if(Rb.includes(e.status))throw new uo(wn(e),e.status);let n;try{n=await e.json()}catch(i){throw new _t(wn(i),i)}let r;const s=Eb(e);if(s&&s.getTime()>=Ru["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new ul(wn(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new He}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ul(wn(n),e.status,n.weak_password.reasons);throw new nb(wn(n),e.status||500,r)}const xb=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Y(e,t,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[co]||(i[co]=Ru["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Ob(e,t,n+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function Ob(e,t,n,r,s,i){const o=xb(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new uo(wn(l),0)}if(a.ok||await gl(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await gl(l)}}function dt(e){var t;let n=null;Ib(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=hb(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function ml(e){const t=dt(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function an(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Cb(e){return{data:e,error:null}}function Nb(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=oi(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function bl(e){return e}function Ib(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ni=["global","local","others"];class Pb{constructor({url:t="",headers:n={},fetch:r,experimental:s}){this.url=t,this.headers=n,this.fetch=Cu(r),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=Ni[0]){if(Ni.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ni.join(", ")}`);try{return await Y(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Y(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:an})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=oi(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await Y(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Nb,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(W(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Y(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:an})}catch(n){if(W(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Y(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(W(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Ut(t);try{return await Y(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:an})}catch(n){if(W(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Ut(t);try{return await Y(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:an})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Ut(t);try{return await Y(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:an})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Ut(t.userId);try{const{data:n,error:r}=await Y(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(W(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Ut(t.userId),Ut(t.id);try{return{data:await Y(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(W(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Y(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(W(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await Y(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Y(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Y(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Y(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(W(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Y(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await Y(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var s;return{data:{providers:(s=r==null?void 0:r.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(n){if(W(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await Y(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await Y(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await Y(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await Y(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(W(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){mt(this.experimental),Ut(t.userId);try{return await Y(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){mt(this.experimental),Ut(t.userId),Ut(t.passkeyId);try{return await Y(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(W(n))return{data:null,error:n};throw n}}}function yl(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Tt={debug:!!(globalThis&&Ou()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Nu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class _l extends Nu{}async function Lb(e,t,n){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{r.abort(),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(s),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new _l(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Tt.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(s),await n()}})}catch(i){if(t>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(r.signal.aborted)return Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async o=>{if(o){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new _l(`Lock "${e}" was released because another request stole it`)}throw i}}function $b(){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 Iu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Mb(e){return parseInt(e,16)}function jb(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function Db(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
58
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=Iu(e.address),p=u?`${u}://${r}`:r,m=e.statement?`${e.statement}
59
- `:"",w=`${p} wants you to sign in with your Ethereum account:
56
+ })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const s=await r.unsubscribe();return r.teardown(),s}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||to.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new Or(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:Bg};n&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(yu.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([ym],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,s,i,o,a,l,c,u,h,d,f;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const p={};p.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:qg,p.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:il.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:il.HEARTBEAT_INTERVAL),p.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:Dg.getWebSocketConstructor(),p.params=t==null?void 0:t.params,p.logger=t==null?void 0:t.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),p.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:bm(),p.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>pm[y-1]||gm;let m,E;const _=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:Fg;switch(_){case Hg:m=(y,w)=>w(JSON.stringify(y)),E=(y,w)=>w(JSON.parse(y));break;case bu:m=this.serializer.encode.bind(this.serializer),E=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=_,p.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:m,p.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:E,p.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,p.params=Object.assign(Object.assign({},p.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,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Br=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function vm(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function wm(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 Em(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=vm(e.baseUrl,r,s),l=await wm(e.auth),c=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,p=f==null?void 0:f.error;throw new Br((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function cs(e){return e.join("")}var Sm=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:cs(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cs(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cs(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cs(e.namespace)}`}),!0}catch(t){if(t instanceof Br&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Br&&n.status===409)return;throw n}}};function $n(e){return e.join("")}var km=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${$n(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/${$n(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/${$n(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Br&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Br&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Am=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Em({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new Sm(this.client,t),this.tableOps=new km(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 Hr(e){"@babel/helpers - typeof";return Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(e)}function Tm(e,t){if(Hr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xm(e){var t=Tm(e,"string");return Hr(t)=="symbol"?t:t+""}function Rm(e,t,n){return(t=xm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){Rm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ai=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function li(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var io=class extends ai{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return oe({},super.toJSON())}},Eu=class extends ai{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Ps(e,t,n){const r=oe({},e),s=t.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===s&&delete r[i];return r[s]=n,r}function Om(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const Cm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Nm=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)},oo=e=>{if(Array.isArray(e))return e.map(n=>oo(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=oo(r)}),t},Im=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),al=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},Pm=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new io(al(o),i,a,r))}).catch(()=>{const o=i+"";t(new io(s.statusText||`HTTP ${i} error`,i,o,r))})}else t(new Eu(al(e),e,r))},Lm=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return oe(oe({},s),n);if(Nm(r)){var i;const o=(t==null?void 0:t.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(r)}else s.body=r;return t!=null&&t.duplex&&(s.duplex=t.duplex),oe(oe({},s),n)};async function hr(e,t,n,r,s,i,o){return new Promise((a,l)=>{e(n,Lm(t,r,s,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Pm(c,l,r,o))})}function Su(e="storage"){return{get:async(t,n,r,s)=>hr(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>hr(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>hr(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>hr(t,"HEAD",n,oe(oe({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>hr(t,"DELETE",n,s,i,r,e)}}const $m=Su("storage"),{get:Fr,post:mt,put:ao,head:Mm,remove:Lo}=$m,ot=Su("vectors");var or=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Om(t),this.fetch=Cm(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ps(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(li(n))return{data:null,error:n};throw n}}},jm=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(li(t))return{data:null,error:t};throw t}}};let ku;ku=Symbol.toStringTag;var Dm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[ku]="BlobDownloadBuilder",this.promise=null}asStream(){return new jm(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(li(t))return{data:null,error:t};throw t}}};const Um={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ll={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Bm=class extends or{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=oe(oe({},ll),r);let a=oe(oe({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(t),u=s._getFinalPath(c),h=await(e=="PUT"?ao:mt)(s.fetch,`${s.url}/object/${u}`,i,oe({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let l;const c=oe(oe({},ll),r);let u=oe(oe({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=Ps(u,d,f);return{path:i,fullPath:(await ao(s.fetch,a.toString(),l,oe({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=oe({},n.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await mt(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new ai("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await mt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await mt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await mt(r.fetch,`${r.url}/object/sign/${s}`,oe({expiresIn:t},i?{transform:n.transform}:{}),{headers:r.headers});const a=new URLSearchParams;n!=null&&n.download&&a.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&a.set("cacheNonce",String(n.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await mt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return s.map(a=>oe(oe({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),o=this._getFinalPath(e),a=()=>Fr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new Dm(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>oo(await Fr(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Mm(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(li(s)){var r;const i=s instanceof io?s.status:s instanceof Eu?(r=s.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const s=r.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=oe(oe(oe({},Um),t),{},{prefix:e||""});return await mt(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=oe({},e);return await mt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const Hm="2.105.4",ts={"X-Client-Info":`storage-js/${Hm}`};var Fm=class extends or{constructor(e,t={},n,r){const s=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=oe(oe({},ts),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Fr(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Fr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await mt(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await ao(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await mt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(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():""}},qm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),t);super(r,s,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await mt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Fr(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Im(e))throw new ai("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Am({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},Km=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},Wm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ot.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 ot.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ot.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 ot.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Vm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Gm=class extends Vm{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new zm(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},zm=class extends Km{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Jm(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Jm=class extends Wm{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Ym=class extends Fm{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Bm(this.url,this.headers,e,this.fetch)}get vectors(){return new Gm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new qm(this.url+"/iceberg",this.headers,this.fetch)}};const Au="2.105.4",Kn=30*1e3,lo=3,Ri=lo*Kn,Zm="http://localhost:9999",Xm="supabase.auth.token",Qm={"X-Client-Info":`gotrue-js/${Au}`},co="X-Supabase-Api-Version",Tu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eb=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,tb=10*60*1e3;class qr extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function V(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class nb extends qr{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function rb(e){return V(e)&&e.name==="AuthApiError"}class yt extends qr{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Qt extends qr{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class Fe extends Qt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function us(e){return V(e)&&e.name==="AuthSessionMissingError"}class Mn extends Qt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hs extends Qt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ds extends Qt{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function sb(e){return V(e)&&e.name==="AuthImplicitGrantRedirectError"}class cl extends Qt{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class ib extends Qt{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 uo extends Qt{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Oi(e){return V(e)&&e.name==="AuthRetryableFetchError"}class ul extends Qt{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ho extends Qt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),hl=`
57
+ \r=`.split(""),ob=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<hl.length;t+=1)e[hl[t].charCodeAt(0)]=-2;for(let t=0;t<Ls.length;t+=1)e[Ls[t].charCodeAt(0)]=t;return e})();function dl(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}}function xu(e,t,n){const r=ob[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function fl(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{cb(o,r,n)};for(let o=0;o<e.length;o+=1)xu(e.charCodeAt(o),s,i);return t.join("")}function ab(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 lb(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}ab(r,t)}}function cb(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Qn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)xu(e.charCodeAt(s),n,r);return new Uint8Array(t)}function ub(e){const t=[];return lb(e,n=>t.push(n)),new Uint8Array(t)}function xn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>dl(s,n,r)),dl(null,n,r),t.join("")}function hb(e){return Math.round(Date.now()/1e3)+e}function db(){return Symbol("auth-callback")}const Ve=()=>typeof window<"u"&&typeof document<"u",_n={tested:!1,writable:!1},Ru=()=>{if(!Ve())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(_n.tested)return _n.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),_n.tested=!0,_n.writable=!0}catch{_n.tested=!0,_n.writable=!1}return _n.writable};function fb(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const Ou=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),pb=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Wn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},vn=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},We=async(e,t)=>{await e.removeItem(t)};class ci{constructor(){this.promise=new ci.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ci.promiseConstructor=Promise;function fs(e){const t=e.split(".");if(t.length!==3)throw new ho("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!eb.test(t[r]))throw new ho("JWT not in base64url format");return{header:JSON.parse(fl(t[0])),payload:JSON.parse(fl(t[1])),signature:Qn(t[2]),raw:{header:t[0],payload:t[1]}}}async function gb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function mb(e,t){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function bb(e){return("0"+e.toString(16)).substr(-2)}function yb(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,bb).join("")}async function _b(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function vb(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await _b(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jn(e,t,n=!1){const r=yb();let s=r;n&&(s+="/recovery"),await Wn(e,`${t}-code-verifier`,s);const i=await vb(r);return[i,r===i?"plain":"s256"]}const wb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Eb(e){const t=e.headers.get(co);if(!t||!t.match(wb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Sb(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 kb(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 Ab=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Bt(e){if(!Ab.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function gt(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 Ci(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Tb(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function pl(e){return JSON.parse(JSON.stringify(e))}const En=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)},xb=[502,503,504,520,521,522,523,524,530];async function gl(e){var t;if(!pb(e))throw new uo(En(e),0);if(xb.includes(e.status))throw new uo(En(e),e.status);let n;try{n=await e.json()}catch(i){throw new yt(En(i),i)}let r;const s=Eb(e);if(s&&s.getTime()>=Tu["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new ul(En(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Fe}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ul(En(n),e.status,n.weak_password.reasons);throw new nb(En(n),e.status||500,r)}const Rb=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Z(e,t,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[co]||(i[co]=Tu["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Ob(e,t,n+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function Ob(e,t,n,r,s,i){const o=Rb(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new uo(En(l),0)}if(a.ok||await gl(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await gl(l)}}function ft(e){var t;let n=null;Ib(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=hb(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function ml(e){const t=ft(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function ln(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Cb(e){return{data:e,error:null}}function Nb(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=oi(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function bl(e){return e}function Ib(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ni=["global","local","others"];class Pb{constructor({url:t="",headers:n={},fetch:r,experimental:s}){this.url=t,this.headers=n,this.fetch=Ou(r),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=Ni[0]){if(Ni.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ni.join(", ")}`);try{return await Z(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(V(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Z(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=oi(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await Z(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Nb,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(V(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:ln})}catch(n){if(V(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Z(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(p.split(";")[1].split("=")[1]);c[`${E}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(V(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Bt(t);try{return await Z(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:ln})}catch(n){if(V(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Bt(t);try{return await Z(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Bt(t);try{return await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Bt(t.userId);try{const{data:n,error:r}=await Z(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Bt(t.userId),Bt(t.id);try{return{data:await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Z(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(p.split(";")[1].split("=")[1]);c[`${E}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(V(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Z(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Z(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(V(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Z(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await Z(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var s;return{data:{providers:(s=r==null?void 0:r.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(n){if(V(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await Z(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await Z(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(V(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await Z(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){gt(this.experimental),Bt(t.userId);try{return await Z(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){gt(this.experimental),Bt(t.userId),Bt(t.passkeyId);try{return await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}}function yl(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Tt={debug:!!(globalThis&&Ru()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Cu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class _l extends Cu{}async function Lb(e,t,n){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{r.abort(),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(s),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new _l(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Tt.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(s),await n()}})}catch(i){if(t>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(r.signal.aborted)return Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async o=>{if(o){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new _l(`Lock "${e}" was released because another request stole it`)}throw i}}function $b(){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 Nu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Mb(e){return parseInt(e,16)}function jb(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function Db(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
58
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=Nu(e.address),p=u?`${u}://${r}`:r,m=e.statement?`${e.statement}
59
+ `:"",E=`${p} wants you to sign in with your Ethereum account:
60
60
  ${f}
61
61
 
62
- ${m}`;let E=`URI: ${h}
62
+ ${m}`;let _=`URI: ${h}
63
63
  Version: ${d}
64
64
  Chain ID: ${n}${o?`
65
65
  Nonce: ${o}`:""}
66
- Issued At: ${i.toISOString()}`;if(s&&(E+=`
67
- Expiration Time: ${s.toISOString()}`),a&&(E+=`
68
- Not Before: ${a.toISOString()}`),l&&(E+=`
66
+ Issued At: ${i.toISOString()}`;if(s&&(_+=`
67
+ Expiration Time: ${s.toISOString()}`),a&&(_+=`
68
+ Not Before: ${a.toISOString()}`),l&&(_+=`
69
69
  Request ID: ${l}`),c){let y=`
70
- Resources:`;for(const v of c){if(!v||typeof v!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${v}`);y+=`
71
- - ${v}`}E+=y}return`${w}
72
- ${E}`}class Le extends Error{constructor({message:t,code:n,cause:r,name:s}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Le{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Ub({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Le({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Le({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Le({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 Le({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Le({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Le({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(Pu(o)){if(i.rp.id!==o)return new Le({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({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 Le({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 Le({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 Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Bb({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Pu(r)){if(n.rpId!==r)return new Le({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Le({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 Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Hb{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const fo=new Hb;function vl(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=oi(e,["challenge","user","excludeCredentials"]),i=Xn(t).buffer,o=Object.assign(Object.assign({},n),{id:Xn(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Xn(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function wl(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=oi(e,["challenge","allowCredentials"]),s=Xn(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Xn(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function El(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Tn(new Uint8Array(e.response.attestationObject)),clientDataJSON:Tn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Sl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Tn(new Uint8Array(s.authenticatorData)),clientDataJSON:Tn(new Uint8Array(s.clientDataJSON)),signature:Tn(new Uint8Array(s.signature)),userHandle:s.userHandle?Tn(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Pu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ms(){var e,t;return!!(We()&&"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 Lu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Ub({error:t,options:e})}}}async function $u(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Bb({error:t,options:e})}}}const Fb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},qb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const a=r[i];t(a)?r[i]=js(a,o):r[i]=js(o)}else r[i]=o}return r}function Kb(e,t){return js(Fb,e,t||{})}function Wb(e,t){return js(qb,e,t||{})}class Vb{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const c=s??fo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,p=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Kb(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Lu({publicKey:u,signal:c});return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=Wb(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await $u(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return W(a)?{data:null,error:a}:{data:null,error:new _t("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new Fr("rpId is required for WebAuthn authentication")};try{if(!Ms())return{data:null,error:new _t("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return W(o)?{data:null,error:o}:{data:null,error:new _t("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new Fr("rpId is required for WebAuthn registration")};try{if(!Ms())return{data:null,error:new _t("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===t&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return W(o)?{data:null,error:o}:{data:null,error:new _t("Unexpected error in register",o)}}}}$b();const Gb={url:Zm,storageKey:Xm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Qm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function kl(e,t,n){return await n()}const Dn={};class qr{get jwks(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},Gb),t);if(this.storageKey=o.storageKey,this.instanceID=(n=qr.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,qr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&We()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new Pb({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Cu(o.fetch),this.lock=o.lock||kl,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&We()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Lb:this.lock=kl,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 Vb(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:Ou()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=yl(this.memoryStorage)),We()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Tu}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(We()&&(n=fb(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),We()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),sb(i)){const l=(t=i.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return W(n)?this._returnResult({error:n}):this._returnResult({error:new _t("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const i=await Y(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:dt}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(W(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,s;try{let i;if("email"in t){const{email:u,password:h,options:d}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await jn(this.storage,this.storageKey)),i=await Y(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:p},xform:dt})}else if("phone"in t){const{phone:u,password:h,options:d}=t;i=await Y(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:dt})}else throw new us("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Ke(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await Y(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ml})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await Y(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ml})}else throw new us("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new Mn;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(W(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,i,o,a,l,c,u,h,d;let f,p;if("message"in t)f=t.message,p=t.signature;else{const{chain:m,wallet:w,statement:E,options:y}=t;let v;if(We())if(typeof w=="object")v=w;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")v=C.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 w!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");v=w}const T=new URL((n=y==null?void 0:y.url)!==null&&n!==void 0?n:window.location.href),D=await v.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const B=Iu(D[0]);let j=(r=y==null?void 0:y.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!j){const C=await v.request({method:"eth_chainId"});j=Mb(C)}const q={domain:T.host,address:B,statement:E,uri:T.href,version:"1",chainId:j,nonce:(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Db(q),p=await v.request({method:"personal_sign",params:[jb(f),B]})}try{const{data:m,error:w}=await Y(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=t.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:dt});if(w)throw w;if(!m||!m.session||!m.user){const E=new Mn;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:w})}catch(m){if(W(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(t){var n,r,s,i,o,a,l,c,u,h,d,f;let p,m;if("message"in t)p=t.message,m=t.signature;else{const{chain:w,wallet:E,statement:y,options:v}=t;let T;if(We())if(typeof E=="object")T=E;else{const B=window;if("solana"in B&&typeof B.solana=="object"&&("signIn"in B.solana&&typeof B.solana.signIn=="function"||"signMessage"in B.solana&&typeof B.solana.signMessage=="function"))T=B.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");T=E}const D=new URL((n=v==null?void 0:v.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in T&&T.signIn){const B=await T.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},v==null?void 0:v.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),y?{statement:y}:null));let j;if(Array.isArray(B)&&B[0]&&typeof B[0]=="object")j=B[0];else if(B&&typeof B=="object"&&"signedMessage"in B&&"signature"in B)j=B;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in j&&"signature"in j&&(typeof j.signedMessage=="string"||j.signedMessage instanceof Uint8Array)&&j.signature instanceof Uint8Array)p=typeof j.signedMessage=="string"?j.signedMessage:new TextDecoder().decode(j.signedMessage),m=j.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in T)||typeof T.signMessage!="function"||!("publicKey"in T)||typeof T!="object"||!T.publicKey||!("toBase58"in T.publicKey)||typeof T.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${D.host} wants you to sign in with your Solana account:`,T.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(s=(r=v==null?void 0:v.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=v==null?void 0:v.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${v.signInWithSolana.notBefore}`]:[],...!((o=v==null?void 0:v.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${v.signInWithSolana.expirationTime}`]:[],...!((a=v==null?void 0:v.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${v.signInWithSolana.chainId}`]:[],...!((l=v==null?void 0:v.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${v.signInWithSolana.nonce}`]:[],...!((c=v==null?void 0:v.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${v.signInWithSolana.requestId}`]:[],...!((h=(u=v==null?void 0:v.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...v.signInWithSolana.resources.map(j=>`- ${j}`)]:[]].join(`
73
- `);const B=await T.signMessage(new TextEncoder().encode(p),"utf8");if(!B||!(B instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=B}}try{const{data:w,error:E}=await Y(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Tn(m)},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:dt});if(E)throw E;if(!w||!w.session||!w.user){const y=new Mn;return this._returnResult({data:{user:null,session:null},error:y})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:E})}catch(w){if(W(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(t){const n=await _n(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new ib;const{data:i,error:o}=await Y(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:dt});if(await Ke(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Mn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=t,a=await Y(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:dt}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Mn;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(W(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,i,o;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await jn(this.storage,this.storageKey));const{error:h}=await Y(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:a,options:l}=t,{data:c,error:u}=await Y(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new us("You must provide either an email or phone number.")}catch(a){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,r;try{let s,i;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await Y(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:dt});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(W(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await jn(this.storage,this.storageKey));const c=await Y(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Cb});return!((i=c.data)===null||i===void 0)&&i.url&&We()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new He;const{error:s}=await Y(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(W(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:i}=t,{error:o}=await Y(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:s,options:i}=t,{data:o,error:a}=await Y(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new us("You must provide either an email or phone number and a type")}catch(n){if(W(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await _n(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<xi:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await _n(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=Ci()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Tb(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Y(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:an}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new He}:await Y(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:an})})}catch(n){if(W(n))return cs(n)&&(await this._removeSession(),await Ke(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new He;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await jn(this.storage,this.storageKey));const{data:c,error:u}=await Y(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:an});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new He;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=ds(t.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(W(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new He;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(W(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var r;try{if(!We())throw new hs("No browser detected.");if(t.error||t.error_description||t.error_code)throw new hs(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new cl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new hs("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new cl("No code detected.");const{data:v,error:T}=await this._exchangeCodeForSession(t.code);if(T)throw T;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:v.session,redirectType:(r=v.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=t;if(!o||!l||!a||!u)throw new hs("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=Kn&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const m=f-d;h-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,h):h-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,h);const{data:w,error:E}=await this._getUser(o);if(E)throw E;const y={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:t.type},error:null})}catch(s){if(W(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await _n(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!cs(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(rb(a)&&(a.status===404||a.status===401||a.status===403)||cs(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await Ke(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=db(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),cs(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await jn(this.storage,this.storageKey,!0));try{return await Y(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Y(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return We()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(W(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=t,h=await Y(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:dt}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new Mn}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await Ke(this.storage,`${this.storageKey}-code-verifier`),W(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await Y(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await mb(async s=>(s>0&&await gb(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Y(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:dt})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Oi(i)&&Date.now()+o-r<Kn})}catch(r){if(this._debug(n,"error",r),W(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),We()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await _n(this.storage,this.storageKey);if(s&&this.userStorage){let o=await _n(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Wn(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:Ci()}else if(s&&!s.user&&!s.user){const o=await _n(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Ke(this.storage,this.storageKey+"-user"),await Wn(this.storage,this.storageKey,s)):s.user=Ci()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<xi;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${xi}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Oi(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ci;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new He;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),W(i)){const o={data:null,error:i};return Oi(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Ke(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Wn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=pl(s);await Wn(this.storage,this.storageKey,i)}else{const s=pl(n);await Wn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ke(this.storage,this.storageKey),await Ke(this.storage,this.storageKey+"-code-verifier"),await Ke(this.storage,this.storageKey+"-user"),this.userStorage&&await Ke(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&We()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Kn);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/Kn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Kn}ms, refresh threshold is ${lo} ticks`),s<=lo&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Nu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!We()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await jn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?this._returnResult({data:null,error:i}):await Y(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await Y(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?El(t.webauthn.credential_response):Sl(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await Y(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await Y(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:vl(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:wl(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,s,i;if(t)try{const{payload:f}=ds(t);let p=null;f.aal&&(p=f.aal);let m=p;const{data:{user:w},error:E}=await this.getUser(t);if(E)return this._returnResult({data:null,error:E});((r=(n=w==null?void 0:w.factors)===null||n===void 0?void 0:n.filter(T=>T.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const v=f.amr||[];return{data:{currentLevel:p,nextLevel:m,currentAuthenticationMethods:v},error:null}}catch(f){if(W(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=ds(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await Y(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new He})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new He});const o=await Y(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&We()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new He});const o=await Y(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&We()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Y(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new He})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await Y(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new He})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(a=>a.kid===t);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===t),r&&this.jwks_cached_at+tb>s)return r;const{data:i,error:o}=await Y(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:f,error:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=ds(r);n!=null&&n.allowExpired||Sb(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=kb(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,ub(`${a}.${l}`)))throw new ho("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var n,r,s;mt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new _t("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=wl(i.options),l=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:fo.createNewAbortSignal(),{data:c,error:u}=await $u({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new _t("WebAuthn ceremony failed",null)});const h=Sl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(W(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,r;mt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new _t("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=vl(s.options),a=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:fo.createNewAbortSignal(),{data:l,error:c}=await Lu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new _t("WebAuthn ceremony failed",null)});const u=El(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(W(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){mt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new He});const{data:s,error:i}=await Y(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){mt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{data:i,error:o}=await Y(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;mt(this.experimental);try{const{data:r,error:s}=await Y(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:r,error:null})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){mt(this.experimental);try{const{data:n,error:r}=await Y(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:dt});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){mt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new He});const{data:s,error:i}=await Y(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){mt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{data:i,error:o}=await Y(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){mt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{error:i}=await Y(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}}qr.nextInstanceID={};const zb=qr,Jb="2.105.4";let gr="";typeof Deno<"u"?gr="deno":typeof document<"u"?gr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?gr="react-native":gr="node";const Yb={"X-Client-Info":`supabase-js-${gr}/${Jb}`},Zb={headers:Yb},Xb={schema:"public"},Qb={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ey={};function Kr(e){"@babel/helpers - typeof";return Kr=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},Kr(e)}function ty(e,t){if(Kr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Kr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ny(e){var t=ty(e,"string");return Kr(t)=="symbol"?t:t+""}function ry(e,t,n){return(t=ny(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){ry(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const sy=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),iy=()=>Headers,oy=(e,t,n)=>{const r=sy(n),s=iy();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let c=new s(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,xe(xe({},o),{},{headers:c}))}};function ay(e){return e.endsWith("/")?e:e+"/"}function ly(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:l,auth:c,realtime:u,global:h}=t,d={db:xe(xe({},l),s),auth:xe(xe({},c),i),realtime:xe(xe({},u),o),storage:{},global:xe(xe(xe({},h),a),{},{headers:xe(xe({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}function cy(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(ay(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var uy=class extends zb{constructor(e){super(e)}},hy=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=cy(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Xb,realtime:ey,auth:xe(xe({},Qb),{},{storageKey:o}),global:Zb},l=ly(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=oy(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(xe({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 jg(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 Ym(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Rg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new uy({url:this.authUrl.href,headers:xe(xe({},m),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new _m(this.realtimeUrl.href,xe(xe({},e),{},{params:xe(xe({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const dy=(e,t,n)=>new hy(e,t,n);function fy(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}fy()&&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 fs=null,ps=null;async function Mu(){if(fs)return fs;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.json();return fs={authEnabled:t.authEnabled,supabaseUrl:t.supabaseUrl??void 0,supabaseAnonKey:t.supabaseAnonKey??void 0},fs}catch{return{authEnabled:!1}}}async function mr(){if(ps)return ps;const e=await Mu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(ps=dy(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),ps)}const ui=nu("auth",()=>{const e=Ae(null),t=Ae(null),n=Ae(!1),r=Ae(!1),s=Ae(!1),i=Fe(()=>!r.value||!!e.value);let o=!1;async function a(){var p;const d=await mr();if(!d){t.value=null,e.value=null;return}const{data:f}=await d.auth.getSession();t.value=f.session??null,e.value=((p=f.session)==null?void 0:p.user)??null}async function l(d=!1){if(n.value&&!d)return;s.value=!0;const f=await Mu();if(r.value=!!f.authEnabled,!r.value){n.value=!0,s.value=!1;return}await a();const p=await mr();p&&!o&&(p.auth.onAuthStateChange((m,w)=>{t.value=w,e.value=(w==null?void 0:w.user)??null,n.value=!0}),o=!0),n.value=!0,s.value=!1}async function c(d,f){s.value=!0;try{const p=await mr();if(!p)throw new Error("Authentication is disabled for this workspace.");const{error:m}=await p.auth.signInWithPassword({email:d,password:f});if(m)throw m;await a()}finally{s.value=!1,n.value=!0}}async function u(){if(!r.value){e.value=null,t.value=null;return}const d=await mr();await(d==null?void 0:d.auth.signOut()),e.value=null,t.value=null}async function h(){var d,f;return r.value?(n.value||await l(),(d=t.value)!=null&&d.access_token?t.value.access_token:(await a(),((f=t.value)==null?void 0:f.access_token)??null)):null}return{user:e,session:t,initialized:n,authEnabled:r,loading:s,isAuthenticated:i,init:l,signIn:c,signOut:u,getAccessToken:h}});function ju(e){return/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`}async function gt(e,t){const n=ui(),r=ju(e),s=new Headers(t==null?void 0:t.headers),i=await n.getAccessToken();i&&s.set("Authorization",`Bearer ${i}`);const o=await fetch(r,{...t,headers:s});if(o.status===401&&n.authEnabled){const a=await mr();if(a){const{data:l,error:c}=await a.auth.refreshSession();if(l.session){const u=new Headers(t==null?void 0:t.headers);return u.set("Authorization",`Bearer ${l.session.access_token}`),fetch(r,{...t,headers:u})}c||await n.signOut()}}return o}async function py(e){const n=await ui().getAccessToken(),r=ju(e),s=/^https?:\/\//i.test(r)?new URL(r):new URL(r,window.location.origin);return n&&s.searchParams.set("token",n),s.toString()}const gy={class:"hidden w-12 shrink-0 flex-col items-center border-r border-border bg-sidebar py-3 md:flex"},my={class:"flex flex-col gap-1"},by={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},yy={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},_y={class:"flex flex-1 flex-col justify-between"},vy={class:"flex flex-col gap-1"},wy={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},Ey={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},Sy={class:"flex flex-col gap-1"},ky={key:0,class:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 font-mono text-[9px] font-bold leading-none text-white"},Ay={key:1,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},Ty={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},Ry=dn({__name:"AppSidebar",setup(e){const t=Io(),n=Ae(0),r=Ae(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}],o=[{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/schedules",label:"Schedules",icon:"calendar"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/inbox",label:"Inbox",icon:"inbox",badge:"inbox"}];function a(u){return(u.match??[u.to]).some(d=>t.path.startsWith(d))}function l(u){return u.badge==="feed"?n.value:u.badge==="inbox"?r.value:0}async function c(){try{const[u,h]=await Promise.all([gt("/api/feed/count"),gt("/api/inbox/count")]);u.ok&&(n.value=Number((await u.json()).count??0)),h.ok&&(r.value=Number((await h.json()).count??0))}catch{n.value=0,r.value=0}}return Zr(()=>{c(),s=window.setInterval(c,15e3)}),Xr(()=>{window.clearInterval(s)}),(u,h)=>(J(),Z("aside",gy,[$("div",my,[(J(),Z(ge,null,xn(i,d=>ue(De(Ar),{key:d.to,to:d.to,class:ft(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Gt(()=>[ue(st,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(J(),Z("div",by)):Je("",!0),$("span",yy,Oe(d.label),1)]),_:2},1032,["to","class"])),64))]),h[0]||(h[0]=$("div",{class:"my-3 h-px w-6 bg-border/80"},null,-1)),$("div",_y,[$("div",vy,[(J(!0),Z(ge,null,xn(o.slice(0,3),d=>(J(),tr(De(Ar),{key:d.to,to:d.to,class:ft(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Gt(()=>[ue(st,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(J(),Z("div",wy)):Je("",!0),$("span",Ey,Oe(d.label),1)]),_:2},1032,["to","class"]))),128))]),$("div",Sy,[(J(!0),Z(ge,null,xn(o.slice(3),d=>(J(),tr(De(Ar),{key:d.to,to:d.to,class:ft(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Gt(()=>[ue(st,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),l(d)>0?(J(),Z("span",ky,Oe(l(d)),1)):Je("",!0),a(d)?(J(),Z("div",Ay)):Je("",!0),$("span",Ty,Oe(d.label),1)]),_:2},1032,["to","class"]))),128))])])]))}});function xy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Du(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Du(n)}),e}class Tl{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Uu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ln(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const Oy="</span>",Rl=e=>!!e.scope,Cy=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class Ny{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Uu(t)}openNode(t){if(!Rl(t))return;const n=Cy(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Rl(t)&&(this.buffer+=Oy)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const xl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class $o{constructor(){this.rootNode=xl(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=xl({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{$o._collapse(n)}))}}class Iy extends $o{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Ny(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Wr(e){return e?typeof e=="string"?e:e.source:null}function Bu(e){return Nn("(?=",e,")")}function Py(e){return Nn("(?:",e,")*")}function Ly(e){return Nn("(?:",e,")?")}function Nn(...e){return e.map(n=>Wr(n)).join("")}function $y(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Mo(...e){return"("+($y(e).capture?"":"?:")+e.map(r=>Wr(r)).join("|")+")"}function Hu(e){return new RegExp(e.toString()+"|").exec("").length-1}function My(e,t){const n=e&&e.exec(t);return n&&n.index===0}const jy=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function jo(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Wr(r),o="";for(;i.length>0;){const a=jy.exec(i);if(!a){o+=i;break}o+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+s):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}const Dy=/\b\B/,Fu="[a-zA-Z]\\w*",Do="[a-zA-Z_]\\w*",qu="\\b\\d+(\\.\\d+)?",Ku="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Wu="\\b(0b[01]+)",Uy="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",By=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Nn(t,/.*\b/,e.binary,/\b.*/)),ln({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Vr={begin:"\\\\[\\s\\S]",relevance:0},Hy={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Vr]},Fy={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Vr]},qy={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/},hi=function(e,t,n={}){const r=ln({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=Mo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Nn(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Ky=hi("//","$"),Wy=hi("/\\*","\\*/"),Vy=hi("#","$"),Gy={scope:"number",begin:qu,relevance:0},zy={scope:"number",begin:Ku,relevance:0},Jy={scope:"number",begin:Wu,relevance:0},Yy={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Vr,{begin:/\[/,end:/\]/,relevance:0,contains:[Vr]}]},Zy={scope:"title",begin:Fu,relevance:0},Xy={scope:"title",begin:Do,relevance:0},Qy={begin:"\\.\\s*"+Do,relevance:0},e_=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var gs=Object.freeze({__proto__:null,APOS_STRING_MODE:Hy,BACKSLASH_ESCAPE:Vr,BINARY_NUMBER_MODE:Jy,BINARY_NUMBER_RE:Wu,COMMENT:hi,C_BLOCK_COMMENT_MODE:Wy,C_LINE_COMMENT_MODE:Ky,C_NUMBER_MODE:zy,C_NUMBER_RE:Ku,END_SAME_AS_BEGIN:e_,HASH_COMMENT_MODE:Vy,IDENT_RE:Fu,MATCH_NOTHING_RE:Dy,METHOD_GUARD:Qy,NUMBER_MODE:Gy,NUMBER_RE:qu,PHRASAL_WORDS_MODE:qy,QUOTE_STRING_MODE:Fy,REGEXP_MODE:Yy,RE_STARTERS_RE:Uy,SHEBANG:By,TITLE_MODE:Zy,UNDERSCORE_IDENT_RE:Do,UNDERSCORE_TITLE_MODE:Xy});function t_(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function n_(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function r_(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=t_,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function s_(e,t){Array.isArray(e.illegal)&&(e.illegal=Mo(...e.illegal))}function i_(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 o_(e,t){e.relevance===void 0&&(e.relevance=1)}const a_=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Nn(n.beforeMatch,Bu(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},l_=["of","and","for","in","not","or","if","then","parent","list","value"],c_="keyword";function Vu(e,t,n=c_){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Vu(e[i],t,i))}),r;function s(i,o){t&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[i,u_(l[0],l[1])]})}}function u_(e,t){return t?Number(t):h_(e)?0:1}function h_(e){return l_.includes(e.toLowerCase())}const Ol={},Cn=e=>{console.error(e)},Cl=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Un=(e,t)=>{Ol[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Ol[`${e}/${t}`]=!0)},Ds=new Error;function Gu(e,t,{key:n}){let r=0;const s=e[n],i={},o={};for(let a=1;a<=t.length;a++)o[a+r]=s[a],i[a+r]=!0,r+=Hu(t[a-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function d_(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Cn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ds;if(typeof e.beginScope!="object"||e.beginScope===null)throw Cn("beginScope must be object"),Ds;Gu(e,e.begin,{key:"beginScope"}),e.begin=jo(e.begin,{joinWith:""})}}function f_(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Cn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ds;if(typeof e.endScope!="object"||e.endScope===null)throw Cn("endScope must be object"),Ds;Gu(e,e.end,{key:"endScope"}),e.end=jo(e.end,{joinWith:""})}}function p_(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function g_(e){p_(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),d_(e),f_(e)}function m_(e){function t(o,a){return new RegExp(Wr(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Hu(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=t(jo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function s(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function i(o,a){const l=o;if(o.isCompiled)return l;[n_,i_,g_,a_].forEach(u=>u(o,a)),e.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[r_,s_,o_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Vu(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Wr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return b_(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,a),l.matcher=s(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=ln(e.classNameAliases||{}),i(e)}function zu(e){return e?e.endsWithParent||zu(e.starts):!1}function b_(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return ln(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:zu(e)?ln(e,{starts:e.starts?ln(e.starts):null}):Object.isFrozen(e)?ln(e):e}var y_="11.11.1";class __ extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Ii=Uu,Nl=ln,Il=Symbol("nomatch"),v_=7,Ju=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Iy};function l(A){return a.noHighlightRe.test(A)}function c(A){let P=A.className+" ";P+=A.parentNode?A.parentNode.className:"";const M=a.languageDetectRe.exec(P);if(M){const re=q(M[1]);return re||(Cl(i.replace("{}",M[1])),Cl("Falling back to no-highlight mode for this block.",A)),re?M[1]:"no-highlight"}return P.split(/\s+/).find(re=>l(re)||q(re))}function u(A,P,M){let re="",he="";typeof P=="object"?(re=A,M=P.ignoreIllegals,he=P.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
74
- https://github.com/highlightjs/highlight.js/issues/2277`),he=A,re=P),M===void 0&&(M=!0);const be={code:re,language:he};me("before:highlight",be);const ye=be.result?be.result:h(be.language,be.code,M);return ye.code=be.code,me("after:highlight",ye),ye}function h(A,P,M,re){const he=Object.create(null);function be(I,U){return I.keywords[U]}function ye(){if(!x.keywords){L.addText(k);return}let I=0;x.keywordPatternRe.lastIndex=0;let U=x.keywordPatternRe.exec(k),z="";for(;U;){z+=k.substring(I,U.index);const ie=S.case_insensitive?U[0].toLowerCase():U[0],fe=be(x,ie);if(fe){const[Pe,ut]=fe;if(L.addText(z),z="",he[ie]=(he[ie]||0)+1,he[ie]<=v_&&(te+=ut),Pe.startsWith("_"))z+=U[0];else{const fn=S.classNameAliases[Pe]||Pe;Be(U[0],fn)}}else z+=U[0];I=x.keywordPatternRe.lastIndex,U=x.keywordPatternRe.exec(k)}z+=k.substring(I),L.addText(z)}function qe(){if(k==="")return;let I=null;if(typeof x.subLanguage=="string"){if(!t[x.subLanguage]){L.addText(k);return}I=h(x.subLanguage,k,!0,H[x.subLanguage]),H[x.subLanguage]=I._top}else I=f(k,x.subLanguage.length?x.subLanguage:null);x.relevance>0&&(te+=I.relevance),L.__addSublanguage(I._emitter,I.language)}function Ie(){x.subLanguage!=null?qe():ye(),k=""}function Be(I,U){I!==""&&(L.startScope(U),L.addText(I),L.endScope())}function Ze(I,U){let z=1;const ie=U.length-1;for(;z<=ie;){if(!I._emit[z]){z++;continue}const fe=S.classNameAliases[I[z]]||I[z],Pe=U[z];fe?Be(Pe,fe):(k=Pe,ye(),k=""),z++}}function O(I,U){return I.scope&&typeof I.scope=="string"&&L.openNode(S.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Be(k,S.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),k=""):I.beginScope._multi&&(Ze(I.beginScope,U),k="")),x=Object.create(I,{parent:{value:x}}),x}function G(I,U,z){let ie=My(I.endRe,z);if(ie){if(I["on:end"]){const fe=new Tl(I);I["on:end"](U,fe),fe.isMatchIgnored&&(ie=!1)}if(ie){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return G(I.parent,U,z)}function V(I){return x.matcher.regexIndex===0?(k+=I[0],1):(se=!0,0)}function ee(I){const U=I[0],z=I.rule,ie=new Tl(z),fe=[z.__beforeBegin,z["on:begin"]];for(const Pe of fe)if(Pe&&(Pe(I,ie),ie.isMatchIgnored))return V(U);return z.skip?k+=U:(z.excludeBegin&&(k+=U),Ie(),!z.returnBegin&&!z.excludeBegin&&(k=U)),O(z,I),z.returnBegin?0:U.length}function de(I){const U=I[0],z=P.substring(I.index),ie=G(x,I,z);if(!ie)return Il;const fe=x;x.endScope&&x.endScope._wrap?(Ie(),Be(U,x.endScope._wrap)):x.endScope&&x.endScope._multi?(Ie(),Ze(x.endScope,I)):fe.skip?k+=U:(fe.returnEnd||fe.excludeEnd||(k+=U),Ie(),fe.excludeEnd&&(k=U));do x.scope&&L.closeNode(),!x.skip&&!x.subLanguage&&(te+=x.relevance),x=x.parent;while(x!==ie.parent);return ie.starts&&O(ie.starts,I),fe.returnEnd?0:U.length}function g(){const I=[];for(let U=x;U!==S;U=U.parent)U.scope&&I.unshift(U.scope);I.forEach(U=>L.openNode(U))}let b={};function _(I,U){const z=U&&U[0];if(k+=I,z==null)return Ie(),0;if(b.type==="begin"&&U.type==="end"&&b.index===U.index&&z===""){if(k+=P.slice(U.index,U.index+1),!s){const ie=new Error(`0 width match regex (${A})`);throw ie.languageName=A,ie.badRule=b.rule,ie}return 1}if(b=U,U.type==="begin")return ee(U);if(U.type==="illegal"&&!M){const ie=new Error('Illegal lexeme "'+z+'" for mode "'+(x.scope||"<unnamed>")+'"');throw ie.mode=x,ie}else if(U.type==="end"){const ie=de(U);if(ie!==Il)return ie}if(U.type==="illegal"&&z==="")return k+=`
75
- `,1;if(X>1e5&&X>U.index*3)throw new Error("potential infinite loop, way more iterations than matches");return k+=z,z.length}const S=q(A);if(!S)throw Cn(i.replace("{}",A)),new Error('Unknown language: "'+A+'"');const N=m_(S);let R="",x=re||N;const H={},L=new a.__emitter(a);g();let k="",te=0,K=0,X=0,se=!1;try{if(S.__emitTokens)S.__emitTokens(P,L);else{for(x.matcher.considerAll();;){X++,se?se=!1:x.matcher.considerAll(),x.matcher.lastIndex=K;const I=x.matcher.exec(P);if(!I)break;const U=P.substring(K,I.index),z=_(U,I);K=I.index+z}_(P.substring(K))}return L.finalize(),R=L.toHTML(),{language:A,value:R,relevance:te,illegal:!1,_emitter:L,_top:x}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:A,value:Ii(P),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:K,context:P.slice(K-100,K+100),mode:I.mode,resultSoFar:R},_emitter:L};if(s)return{language:A,value:Ii(P),illegal:!1,relevance:0,errorRaised:I,_emitter:L,_top:x};throw I}}function d(A){const P={value:Ii(A),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return P._emitter.addText(A),P}function f(A,P){P=P||a.languages||Object.keys(t);const M=d(A),re=P.filter(q).filter(Q).map(Ie=>h(Ie,A,!1));re.unshift(M);const he=re.sort((Ie,Be)=>{if(Ie.relevance!==Be.relevance)return Be.relevance-Ie.relevance;if(Ie.language&&Be.language){if(q(Ie.language).supersetOf===Be.language)return 1;if(q(Be.language).supersetOf===Ie.language)return-1}return 0}),[be,ye]=he,qe=be;return qe.secondBest=ye,qe}function p(A,P,M){const re=P&&n[P]||M;A.classList.add("hljs"),A.classList.add(`language-${re}`)}function m(A){let P=null;const M=c(A);if(l(M))return;if(me("before:highlightElement",{el:A,language:M}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),a.throwUnescapedHTML))throw new __("One of your code blocks includes unescaped HTML.",A.innerHTML);P=A;const re=P.textContent,he=M?u(re,{language:M,ignoreIllegals:!0}):f(re);A.innerHTML=he.value,A.dataset.highlighted="yes",p(A,M,he.language),A.result={language:he.language,re:he.relevance,relevance:he.relevance},he.secondBest&&(A.secondBest={language:he.secondBest.language,relevance:he.secondBest.relevance}),me("after:highlightElement",{el:A,result:he,text:re})}function w(A){a=Nl(a,A)}const E=()=>{T(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){T(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let v=!1;function T(){function A(){T()}if(document.readyState==="loading"){v||window.addEventListener("DOMContentLoaded",A,!1),v=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function D(A,P){let M=null;try{M=P(e)}catch(re){if(Cn("Language definition for '{}' could not be registered.".replace("{}",A)),s)Cn(re);else throw re;M=o}M.name||(M.name=A),t[A]=M,M.rawDefinition=P.bind(null,e),M.aliases&&C(M.aliases,{languageName:A})}function B(A){delete t[A];for(const P of Object.keys(n))n[P]===A&&delete n[P]}function j(){return Object.keys(t)}function q(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:P}){typeof A=="string"&&(A=[A]),A.forEach(M=>{n[M.toLowerCase()]=P})}function Q(A){const P=q(A);return P&&!P.disableAutodetect}function ae(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=P=>{A["before:highlightBlock"](Object.assign({block:P.el},P))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=P=>{A["after:highlightBlock"](Object.assign({block:P.el},P))})}function F(A){ae(A),r.push(A)}function ce(A){const P=r.indexOf(A);P!==-1&&r.splice(P,1)}function me(A,P){const M=A;r.forEach(function(re){re[M]&&re[M](P)})}function Ne(A){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),m(A)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:T,highlightElement:m,highlightBlock:Ne,configure:w,initHighlighting:E,initHighlightingOnLoad:y,registerLanguage:D,unregisterLanguage:B,listLanguages:j,getLanguage:q,registerAliases:C,autoDetection:Q,inherit:Nl,addPlugin:F,removePlugin:ce}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=y_,e.regex={concat:Nn,lookahead:Bu,either:Mo,optional:Ly,anyNumberOfTimes:Py};for(const A in gs)typeof gs[A]=="object"&&Du(gs[A]);return Object.assign(e,gs),e},sr=Ju({});sr.newInstance=()=>Ju({});var w_=sr;sr.HighlightJS=sr;sr.default=sr;const $e=xy(w_),Us="[A-Za-z$_][0-9A-Za-z$_]*",Yu=["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"],Zu=["true","false","null","undefined","NaN","Infinity"],Xu=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Qu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],eh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],th=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],nh=[].concat(eh,Xu,Qu);function E_(e){const t=e.regex,n=(M,{after:re})=>{const he="</"+M[0].slice(1);return M.input.indexOf(he,re)!==-1},r=Us,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,re)=>{const he=M[0].length+M.index,be=M.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(M,{after:he})||re.ignoreMatch());let ye;const qe=M.input.substring(he);if(ye=qe.match(/^\s*=/)){re.ignoreMatch();return}if((ye=qe.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Us,keyword:Yu,literal:Zu,built_in:nh,"variable.language":th},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,w,{match:/\$\d+/},h];d.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const T=[].concat(y,d.contains),D=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:D},j={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},q={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Xu,...Qu]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Q={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(M){return t.concat("(?!",M.join("|"),")")}const ce={match:t.concat(/\b/,F([...eh,"super","import"].map(M=>`${M}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:q},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,w,y,{match:/\$\d+/},h,q,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},Q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},ce,ae,j,Ne,{match:/\$[(.]/}]}}function rh(e){const t=e.regex,n=E_(e),r=Us,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Us,keyword:Yu.concat(l),literal:Zu,built_in:nh.concat(s),"variable.language":th},u={className:"meta",begin:"@"+r},h=(m,w,E)=>{const y=m.contains.findIndex(v=>v.label===w);if(y===-1)throw new Error("can not find mode to replace");m.contains.splice(y,1,E)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(m=>m.scope==="attr"),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,i,o,f]),h(n,"shebang",e.SHEBANG()),h(n,"use_strict",a);const p=n.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Pl="[A-Za-z$_][0-9A-Za-z$_]*",S_=["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"],k_=["true","false","null","undefined","NaN","Infinity"],sh=["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"],ih=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],oh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],A_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],T_=[].concat(oh,sh,ih);function ah(e){const t=e.regex,n=(M,{after:re})=>{const he="</"+M[0].slice(1);return M.input.indexOf(he,re)!==-1},r=Pl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,re)=>{const he=M[0].length+M.index,be=M.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(M,{after:he})||re.ignoreMatch());let ye;const qe=M.input.substring(he);if(ye=qe.match(/^\s*=/)){re.ignoreMatch();return}if((ye=qe.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Pl,keyword:S_,literal:k_,built_in:T_,"variable.language":A_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,w,{match:/\$\d+/},h];d.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const T=[].concat(y,d.contains),D=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:D},j={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},q={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:{_:[...sh,...ih]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Q={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(M){return t.concat("(?!",M.join("|"),")")}const ce={match:t.concat(/\b/,F([...oh,"super","import"].map(M=>`${M}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:D,CLASS_REFERENCE:q},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,w,y,{match:/\$\d+/},h,q,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:D}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},Q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},ce,ae,j,Ne,{match:/\$[(.]/}]}}function lh(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${d})[jJ](?=${p})`}]},w={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,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:a,contains:["self",l,m,h,e.HASH_COMMENT_MODE]}]};return c.contains=[h,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,w,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,E,h]}]}}function ch(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),p={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"],w=["true","false"],E={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["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"],D=["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:w,built_in:[...y,...v,"set","shopt",...T,...D]},contains:[f,e.SHEBANG(),p,h,i,o,E,a,l,c,u,n]}}function R_(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const x_=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_-]*/}}),O_=["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"],C_=["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"],N_=[...O_,...C_],I_=["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(),P_=["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(),L_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),$_=["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 M_(e){const t=e.regex,n=x_(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+P_.join("|")+")"},{begin:":(:)?("+L_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$_.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:I_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+N_.join("|")+")\\b"}]}}function uh(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function j_(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,p=[...c,...l].filter(D=>!u.includes(D)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},w={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function y(D){return t.concat(/\b/,t.either(...D.map(B=>B.replace(/\s+/,"\\s+"))),/\b/)}const v={scope:"keyword",match:y(d),relevance:0};function T(D,{exceptions:B,when:j}={}){const q=j;return B=B||[],D.map(C=>C.match(/\|\d+$/)||B.includes(C)?C:q(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:T(p,{when:D=>D.length<3}),literal:i,type:a,built_in:h},contains:[{scope:"type",match:y(o)},v,E,m,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,w]}}function hh(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},w=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},p,m,i,o],E=[...w];return E.pop(),E.push(a),f.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:w}}function dh(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(c,{contains:[]}),d=e.inherit(u,{contains:[]});c.contains.push(d),u.contains.push(h);let f=[n,l];return[c,u,h,d].forEach(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}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}$e.registerLanguage("typescript",rh);$e.registerLanguage("ts",rh);$e.registerLanguage("javascript",ah);$e.registerLanguage("js",ah);$e.registerLanguage("python",lh);$e.registerLanguage("py",lh);$e.registerLanguage("bash",ch);$e.registerLanguage("sh",ch);$e.registerLanguage("json",R_);$e.registerLanguage("css",M_);$e.registerLanguage("html",uh);$e.registerLanguage("xml",uh);$e.registerLanguage("sql",j_);$e.registerLanguage("yaml",hh);$e.registerLanguage("yml",hh);$e.registerLanguage("markdown",dh);$e.registerLanguage("md",dh);function yt(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,n,r)=>`<a href="${/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("#")?r:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${n}</a>`)}function fh(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Ll(e){return fh(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Pi(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function D_(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function U_(e){if(e.length<2)return e.map(a=>`<p class="my-1">${yt(a)}</p>`).join(`
76
- `);const t=Pi(e[0]),n=e[1],r=Ll(n)?Pi(n).map(D_):t.map(()=>"text-left"),s=Ll(n)?e.slice(2):e.slice(1),i=t.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${r[l]??"text-left"}">${yt(a)}</th>`).join(""),o=s.map(a=>{const l=Pi(a);return`<tr class="border-b border-gray-800">${t.map((u,h)=>`<td class="px-3 py-1.5 text-gray-400 ${r[h]??"text-left"}">${yt(l[h]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function ph(e){if(!e)return"";const t=e.split(`
77
- `),n=[];let r=!1,s=null,i=!1,o=!1,a=[],l="",c=[];function u(){s&&(n.push(`</${s}>`),s=null)}function h(){o&&(n.push(U_(c)),c=[],o=!1)}function d(){i&&(n.push("</blockquote>"),i=!1)}for(const f of t){if(f.startsWith("```")){if(u(),h(),!r)r=!0,l=f.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const D=a.join(`
78
- `);let B;try{B=l&&$e.getLanguage(l)?$e.highlight(D,{language:l,ignoreIllegals:!0}).value:$e.highlightAuto(D).value}catch{B=D.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const j=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),q=j?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${j}</span>`:"";n.push(`<div class="relative my-2"><pre class="bg-surface-1 border border-edge rounded-xl p-3 overflow-x-auto"><code class="hljs font-mono text-xs">${B}</code></pre>${q}</div>`),r=!1,l="",a=[]}continue}if(r){a.push(f);continue}if(fh(f)){u(),o=!0,c.push(f);continue}o&&h();const p=f.match(/^####\s+(.+)/),m=f.match(/^###\s+(.+)/),w=f.match(/^##\s+(.+)/),E=f.match(/^#\s+(.+)/);if(p){u(),d(),n.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${yt(p[1])}</h4>`);continue}if(m){u(),d(),n.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${yt(m[1])}</h3>`);continue}if(w){u(),d(),n.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${yt(w[1])}</h2>`);continue}if(E){u(),d(),n.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${yt(E[1])}</h1>`);continue}if(/^---+$/.test(f.trim())){u(),d(),n.push('<hr class="border-gray-800 my-4" />');continue}const y=f.match(/^[-*+]\s+(.+)/);if(y){s==="ol"&&u(),d(),s||(n.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),s="ul"),n.push(`<li>${yt(y[1])}</li>`);continue}const v=f.match(/^\d+\.\s+(.+)/);if(v){s==="ul"&&u(),d(),s||(n.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),s="ol"),n.push(`<li>${yt(v[1])}</li>`);continue}const T=f.match(/^>\s?(.*)/);if(T){u(),i||(n.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),n.push(`<p class="my-0">${yt(T[1])}</p>`);continue}if(f.trim()===""){u(),d(),n.push('<div class="my-2"></div>');continue}u(),d(),n.push(`<p class="my-1">${yt(f)}</p>`)}if(r&&a.length){const f=a.join(`
70
+ Resources:`;for(const w of c){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);y+=`
71
+ - ${w}`}_+=y}return`${E}
72
+ ${_}`}class Le extends Error{constructor({message:t,code:n,cause:r,name:s}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Le{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Ub({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Le({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Le({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Le({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 Le({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Le({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Le({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(Iu(o)){if(i.rp.id!==o)return new Le({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({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 Le({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 Le({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 Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Bb({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Iu(r)){if(n.rpId!==r)return new Le({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Le({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 Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Hb{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const fo=new Hb;function vl(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=oi(e,["challenge","user","excludeCredentials"]),i=Qn(t).buffer,o=Object.assign(Object.assign({},n),{id:Qn(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Qn(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function wl(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=oi(e,["challenge","allowCredentials"]),s=Qn(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Qn(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function El(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:xn(new Uint8Array(e.response.attestationObject)),clientDataJSON:xn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Sl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:xn(new Uint8Array(s.authenticatorData)),clientDataJSON:xn(new Uint8Array(s.clientDataJSON)),signature:xn(new Uint8Array(s.signature)),userHandle:s.userHandle?xn(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Iu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ms(){var e,t;return!!(Ve()&&"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 Pu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Ub({error:t,options:e})}}}async function Lu(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Bb({error:t,options:e})}}}const Fb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},qb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const a=r[i];t(a)?r[i]=js(a,o):r[i]=js(o)}else r[i]=o}return r}function Kb(e,t){return js(Fb,e,t||{})}function Wb(e,t){return js(qb,e,t||{})}class Vb{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const c=s??fo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,p=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Kb(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Pu({publicKey:u,signal:c});return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=Wb(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Lu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return V(a)?{data:null,error:a}:{data:null,error:new yt("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new qr("rpId is required for WebAuthn authentication")};try{if(!Ms())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return V(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new qr("rpId is required for WebAuthn registration")};try{if(!Ms())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===t&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return V(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in register",o)}}}}$b();const Gb={url:Zm,storageKey:Xm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Qm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function kl(e,t,n){return await n()}const Dn={};class Kr{get jwks(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},Gb),t);if(this.storageKey=o.storageKey,this.instanceID=(n=Kr.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Kr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ve()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new Pb({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Ou(o.fetch),this.lock=o.lock||kl,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Ve()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Lb:this.lock=kl,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 Vb(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:Ru()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=yl(this.memoryStorage)),Ve()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Au}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(Ve()&&(n=fb(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ve()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),sb(i)){const l=(t=i.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return V(n)?this._returnResult({error:n}):this._returnResult({error:new yt("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:ft}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(V(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,s;try{let i;if("email"in t){const{email:u,password:h,options:d}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await jn(this.storage,this.storageKey)),i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:p},xform:ft})}else if("phone"in t){const{phone:u,password:h,options:d}=t;i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:ft})}else throw new hs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await We(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await Z(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ml})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await Z(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ml})}else throw new hs("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new Mn;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,i,o,a,l,c,u,h,d;let f,p;if("message"in t)f=t.message,p=t.signature;else{const{chain:m,wallet:E,statement:_,options:y}=t;let w;if(Ve())if(typeof E=="object")w=E;else{const S=window;if("ethereum"in S&&typeof S.ethereum=="object"&&"request"in S.ethereum&&typeof S.ethereum.request=="function")w=S.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=E}const k=new URL((n=y==null?void 0:y.url)!==null&&n!==void 0?n:window.location.href),C=await w.request({method:"eth_requestAccounts"}).then(S=>S).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!C||C.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const L=Nu(C[0]);let N=(r=y==null?void 0:y.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!N){const S=await w.request({method:"eth_chainId"});N=Mb(S)}const U={domain:k.host,address:L,statement:_,uri:k.href,version:"1",chainId:N,nonce:(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Db(U),p=await w.request({method:"personal_sign",params:[jb(f),L]})}try{const{data:m,error:E}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=t.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ft});if(E)throw E;if(!m||!m.session||!m.user){const _=new Mn;return this._returnResult({data:{user:null,session:null},error:_})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:E})}catch(m){if(V(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(t){var n,r,s,i,o,a,l,c,u,h,d,f;let p,m;if("message"in t)p=t.message,m=t.signature;else{const{chain:E,wallet:_,statement:y,options:w}=t;let k;if(Ve())if(typeof _=="object")k=_;else{const L=window;if("solana"in L&&typeof L.solana=="object"&&("signIn"in L.solana&&typeof L.solana.signIn=="function"||"signMessage"in L.solana&&typeof L.solana.signMessage=="function"))k=L.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 _!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=_}const C=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in k&&k.signIn){const L=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:C.host,uri:C.href}),y?{statement:y}:null));let N;if(Array.isArray(L)&&L[0]&&typeof L[0]=="object")N=L[0];else if(L&&typeof L=="object"&&"signedMessage"in L&&"signature"in L)N=L;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in N&&"signature"in N&&(typeof N.signedMessage=="string"||N.signedMessage instanceof Uint8Array)&&N.signature instanceof Uint8Array)p=typeof N.signedMessage=="string"?N.signedMessage:new TextDecoder().decode(N.signedMessage),m=N.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${C.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${C.href}`,`Issued At: ${(s=(r=w==null?void 0:w.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(N=>`- ${N}`)]:[]].join(`
73
+ `);const L=await k.signMessage(new TextEncoder().encode(p),"utf8");if(!L||!(L instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=L}}try{const{data:E,error:_}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:xn(m)},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ft});if(_)throw _;if(!E||!E.session||!E.user){const y=new Mn;return this._returnResult({data:{user:null,session:null},error:y})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:_})}catch(E){if(V(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(t){const n=await vn(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new ib;const{data:i,error:o}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:ft});if(await We(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Mn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=t,a=await Z(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:ft}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Mn;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,i,o;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await jn(this.storage,this.storageKey));const{error:h}=await Z(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:a,options:l}=t,{data:c,error:u}=await Z(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new hs("You must provide either an email or phone number.")}catch(a){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,r;try{let s,i;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await Z(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ft});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(V(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await jn(this.storage,this.storageKey));const c=await Z(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Cb});return!((i=c.data)===null||i===void 0)&&i.url&&Ve()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Fe;const{error:s}=await Z(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(V(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:i}=t,{error:o}=await Z(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:s,options:i}=t,{data:o,error:a}=await Z(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new hs("You must provide either an email or phone number and a type")}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await vn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<Ri:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await vn(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=Ci()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Tb(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Z(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:ln}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Fe}:await Z(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:ln})})}catch(n){if(V(n))return us(n)&&(await this._removeSession(),await We(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Fe;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await jn(this.storage,this.storageKey));const{data:c,error:u}=await Z(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:ln});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Fe;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=fs(t.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(V(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new Fe;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var r;try{if(!Ve())throw new ds("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ds(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new cl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ds("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new cl("No code detected.");const{data:w,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const C=new URL(window.location.href);return C.searchParams.delete("code"),window.history.replaceState(window.history.state,"",C.toString()),{data:{session:w.session,redirectType:(r=w.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=t;if(!o||!l||!a||!u)throw new ds("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=Kn&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const m=f-d;h-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,h):h-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,h);const{data:E,error:_}=await this._getUser(o);if(_)throw _;const y={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:t.type},error:null})}catch(s){if(V(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await vn(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!us(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(rb(a)&&(a.status===404||a.status===401||a.status===403)||us(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await We(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=db(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),us(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await jn(this.storage,this.storageKey,!0));try{return await Z(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Z(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return Ve()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(V(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=t,h=await Z(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ft}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new Mn}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await Z(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await mb(async s=>(s>0&&await gb(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Z(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ft})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Oi(i)&&Date.now()+o-r<Kn})}catch(r){if(this._debug(n,"error",r),V(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Ve()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await vn(this.storage,this.storageKey);if(s&&this.userStorage){let o=await vn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Wn(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:Ci()}else if(s&&!s.user&&!s.user){const o=await vn(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await We(this.storage,this.storageKey+"-user"),await Wn(this.storage,this.storageKey,s)):s.user=Ci()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Ri;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${Ri}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Oi(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Fe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ci;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Fe;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),V(i)){const o={data:null,error:i};return Oi(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await We(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Wn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=pl(s);await Wn(this.storage,this.storageKey,i)}else{const s=pl(n);await Wn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await We(this.storage,this.storageKey),await We(this.storage,this.storageKey+"-code-verifier"),await We(this.storage,this.storageKey+"-user"),this.userStorage&&await We(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ve()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Kn);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/Kn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Kn}ms, refresh threshold is ${lo} ticks`),s<=lo&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Cu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ve()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await jn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?this._returnResult({data:null,error:i}):await Z(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await Z(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?El(t.webauthn.credential_response):Sl(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await Z(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await Z(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:vl(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:wl(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,s,i;if(t)try{const{payload:f}=fs(t);let p=null;f.aal&&(p=f.aal);let m=p;const{data:{user:E},error:_}=await this.getUser(t);if(_)return this._returnResult({data:null,error:_});((r=(n=E==null?void 0:E.factors)===null||n===void 0?void 0:n.filter(k=>k.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const w=f.amr||[];return{data:{currentLevel:p,nextLevel:m,currentAuthenticationMethods:w},error:null}}catch(f){if(V(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=fs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await Z(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Fe})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Fe});const o=await Z(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ve()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Fe});const o=await Z(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ve()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Z(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Fe})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await Z(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Fe})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(a=>a.kid===t);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===t),r&&this.jwks_cached_at+tb>s)return r;const{data:i,error:o}=await Z(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:f,error:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=fs(r);n!=null&&n.allowExpired||Sb(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=kb(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,ub(`${a}.${l}`)))throw new ho("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var n,r,s;gt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new yt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=wl(i.options),l=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:fo.createNewAbortSignal(),{data:c,error:u}=await Lu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new yt("WebAuthn ceremony failed",null)});const h=Sl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(V(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,r;gt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new yt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=vl(s.options),a=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:fo.createNewAbortSignal(),{data:l,error:c}=await Pu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new yt("WebAuthn ceremony failed",null)});const u=El(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(V(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){gt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Fe});const{data:s,error:i}=await Z(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Fe});const{data:i,error:o}=await Z(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;gt(this.experimental);try{const{data:r,error:s}=await Z(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:r,error:null})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){gt(this.experimental);try{const{data:n,error:r}=await Z(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:ft});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){gt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Fe});const{data:s,error:i}=await Z(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Fe});const{data:i,error:o}=await Z(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Fe});const{error:i}=await Z(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}}Kr.nextInstanceID={};const zb=Kr,Jb="2.105.4";let mr="";typeof Deno<"u"?mr="deno":typeof document<"u"?mr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mr="react-native":mr="node";const Yb={"X-Client-Info":`supabase-js-${mr}/${Jb}`},Zb={headers:Yb},Xb={schema:"public"},Qb={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ey={};function Wr(e){"@babel/helpers - typeof";return Wr=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},Wr(e)}function ty(e,t){if(Wr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ny(e){var t=ty(e,"string");return Wr(t)=="symbol"?t:t+""}function ry(e,t,n){return(t=ny(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){ry(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const sy=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),iy=()=>Headers,oy=(e,t,n)=>{const r=sy(n),s=iy();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let c=new s(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,Oe(Oe({},o),{},{headers:c}))}};function ay(e){return e.endsWith("/")?e:e+"/"}function ly(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:l,auth:c,realtime:u,global:h}=t,d={db:Oe(Oe({},l),s),auth:Oe(Oe({},c),i),realtime:Oe(Oe({},u),o),storage:{},global:Oe(Oe(Oe({},h),a),{},{headers:Oe(Oe({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}function cy(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(ay(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var uy=class extends zb{constructor(e){super(e)}},hy=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=cy(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Xb,realtime:ey,auth:Oe(Oe({},Qb),{},{storageKey:o}),global:Zb},l=ly(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=oy(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Oe({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 jg(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 Ym(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new xg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new uy({url:this.authUrl.href,headers:Oe(Oe({},m),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(E=>E.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new _m(this.realtimeUrl.href,Oe(Oe({},e),{},{params:Oe(Oe({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const dy=(e,t,n)=>new hy(e,t,n);function fy(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}fy()&&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 ps=null,gs=null;async function $u(){if(ps)return ps;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.json();return ps={authEnabled:t.authEnabled,supabaseUrl:t.supabaseUrl??void 0,supabaseAnonKey:t.supabaseAnonKey??void 0},ps}catch{return{authEnabled:!1}}}async function Vn(){if(gs)return gs;const e=await $u();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(gs=dy(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),gs)}const ui=tu("auth",()=>{const e=gg(),t=_e(null),n=_e(null),r=_e(!1),s=_e(!1),i=_e(!1),o=qe(()=>!s.value||!!t.value);let a=!1;async function l(){var E;const p=await Vn();if(!p){n.value=null,t.value=null;return}const{data:m}=await p.auth.getSession();n.value=m.session??null,t.value=((E=m.session)==null?void 0:E.user)??null}async function c(p=!1){if(r.value&&!p)return;i.value=!0;const m=await $u();if(s.value=!!m.authEnabled,!s.value){r.value=!0,i.value=!1;return}await l();const E=await Vn();E&&!a&&(E.auth.onAuthStateChange((_,y)=>{n.value=y,t.value=(y==null?void 0:y.user)??null,r.value=!0}),a=!0),r.value=!0,i.value=!1}async function u(p,m){i.value=!0;try{const E=await Vn();if(!E)throw new Error("Authentication is disabled for this workspace.");const{error:_}=await E.auth.signInWithPassword({email:p,password:m});if(_)throw _;await l()}finally{i.value=!1,r.value=!0}}async function h(){if(!s.value){t.value=null,n.value=null;return}const p=await Vn();await(p==null?void 0:p.auth.signOut()),t.value=null,n.value=null}async function d(){i.value=!0;try{if(await ct("/api/logout",{method:"POST"}).catch(()=>{}),t.value=null,n.value=null,localStorage.removeItem("token"),localStorage.removeItem("supabase.auth.token"),s.value){const p=await Vn();await(p==null?void 0:p.auth.signOut().catch(()=>{}))}return await e.push("/login"),{success:!0}}catch(p){return{success:!1,error:p instanceof Error?p.message:"Logout failed"}}finally{i.value=!1}}async function f(){var p,m;return s.value?(r.value||await c(),(p=n.value)!=null&&p.access_token?n.value.access_token:(await l(),((m=n.value)==null?void 0:m.access_token)??null)):null}return{user:t,session:n,initialized:r,authEnabled:s,loading:i,isAuthenticated:o,init:c,signIn:u,signOut:h,logout:d,getAccessToken:f}});function Mu(e){return/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`}async function ct(e,t){const n=ui(),r=Mu(e),s=new Headers(t==null?void 0:t.headers),i=await n.getAccessToken();i&&s.set("Authorization",`Bearer ${i}`);const o=await fetch(r,{...t,headers:s});if(o.status===401&&n.authEnabled){const a=await Vn();if(a){const{data:l,error:c}=await a.auth.refreshSession();if(l.session){const u=new Headers(t==null?void 0:t.headers);return u.set("Authorization",`Bearer ${l.session.access_token}`),fetch(r,{...t,headers:u})}c||await n.signOut()}}return o}async function py(e){const n=await ui().getAccessToken(),r=Mu(e),s=/^https?:\/\//i.test(r)?new URL(r):new URL(r,window.location.origin);return n&&s.searchParams.set("token",n),s.toString()}const gy={class:"hidden w-12 shrink-0 flex-col items-center border-r border-border bg-sidebar py-3 md:flex"},my={class:"flex flex-col gap-1"},by={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},yy={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},_y={class:"flex flex-1 flex-col justify-between"},vy={class:"flex flex-col gap-1"},wy={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},Ey={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},Sy={class:"flex flex-col gap-1"},ky={key:0,class:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 font-mono text-[9px] font-bold leading-none text-white"},Ay={key:1,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},Ty={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},xy=fn({__name:"AppSidebar",setup(e){const t=Io(),n=_e(0),r=_e(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}],o=[{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/schedules",label:"Schedules",icon:"calendar"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/inbox",label:"Inbox",icon:"inbox",badge:"inbox"}];function a(u){return(u.match??[u.to]).some(d=>t.path.startsWith(d))}function l(u){return u.badge==="feed"?n.value:u.badge==="inbox"?r.value:0}async function c(){try{const[u,h]=await Promise.all([ct("/api/feed/count"),ct("/api/inbox/count")]);u.ok&&(n.value=Number((await u.json()).count??0)),h.ok&&(r.value=Number((await h.json()).count??0))}catch{n.value=0,r.value=0}}return Xr(()=>{c(),s=window.setInterval(c,15e3)}),Qr(()=>{window.clearInterval(s)}),(u,h)=>(W(),z("aside",gy,[M("div",my,[(W(),z(fe,null,zt(i,d=>le(ze(Tr),{key:d.to,to:d.to,class:_t(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(W(),z("div",by)):Ue("",!0),M("span",yy,Te(d.label),1)]),_:2},1032,["to","class"])),64))]),h[0]||(h[0]=M("div",{class:"my-3 h-px w-6 bg-border/80"},null,-1)),M("div",_y,[M("div",vy,[(W(!0),z(fe,null,zt(o.slice(0,3),d=>(W(),nr(ze(Tr),{key:d.to,to:d.to,class:_t(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(W(),z("div",wy)):Ue("",!0),M("span",Ey,Te(d.label),1)]),_:2},1032,["to","class"]))),128))]),M("div",Sy,[(W(!0),z(fe,null,zt(o.slice(3),d=>(W(),nr(ze(Tr),{key:d.to,to:d.to,class:_t(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),l(d)>0?(W(),z("span",ky,Te(l(d)),1)):Ue("",!0),a(d)?(W(),z("div",Ay)):Ue("",!0),M("span",Ty,Te(d.label),1)]),_:2},1032,["to","class"]))),128))])])]))}});function Ry(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ju(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&ju(n)}),e}class Tl{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Du(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function cn(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const Oy="</span>",xl=e=>!!e.scope,Cy=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class Ny{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Du(t)}openNode(t){if(!xl(t))return;const n=Cy(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){xl(t)&&(this.buffer+=Oy)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Rl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class $o{constructor(){this.rootNode=Rl(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=Rl({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{$o._collapse(n)}))}}class Iy extends $o{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Ny(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Vr(e){return e?typeof e=="string"?e:e.source:null}function Uu(e){return Nn("(?=",e,")")}function Py(e){return Nn("(?:",e,")*")}function Ly(e){return Nn("(?:",e,")?")}function Nn(...e){return e.map(n=>Vr(n)).join("")}function $y(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Mo(...e){return"("+($y(e).capture?"":"?:")+e.map(r=>Vr(r)).join("|")+")"}function Bu(e){return new RegExp(e.toString()+"|").exec("").length-1}function My(e,t){const n=e&&e.exec(t);return n&&n.index===0}const jy=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function jo(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Vr(r),o="";for(;i.length>0;){const a=jy.exec(i);if(!a){o+=i;break}o+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+s):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}const Dy=/\b\B/,Hu="[a-zA-Z]\\w*",Do="[a-zA-Z_]\\w*",Fu="\\b\\d+(\\.\\d+)?",qu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ku="\\b(0b[01]+)",Uy="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",By=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Nn(t,/.*\b/,e.binary,/\b.*/)),cn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Gr={begin:"\\\\[\\s\\S]",relevance:0},Hy={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gr]},Fy={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gr]},qy={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/},hi=function(e,t,n={}){const r=cn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=Mo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Nn(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Ky=hi("//","$"),Wy=hi("/\\*","\\*/"),Vy=hi("#","$"),Gy={scope:"number",begin:Fu,relevance:0},zy={scope:"number",begin:qu,relevance:0},Jy={scope:"number",begin:Ku,relevance:0},Yy={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gr,{begin:/\[/,end:/\]/,relevance:0,contains:[Gr]}]},Zy={scope:"title",begin:Hu,relevance:0},Xy={scope:"title",begin:Do,relevance:0},Qy={begin:"\\.\\s*"+Do,relevance:0},e_=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var ms=Object.freeze({__proto__:null,APOS_STRING_MODE:Hy,BACKSLASH_ESCAPE:Gr,BINARY_NUMBER_MODE:Jy,BINARY_NUMBER_RE:Ku,COMMENT:hi,C_BLOCK_COMMENT_MODE:Wy,C_LINE_COMMENT_MODE:Ky,C_NUMBER_MODE:zy,C_NUMBER_RE:qu,END_SAME_AS_BEGIN:e_,HASH_COMMENT_MODE:Vy,IDENT_RE:Hu,MATCH_NOTHING_RE:Dy,METHOD_GUARD:Qy,NUMBER_MODE:Gy,NUMBER_RE:Fu,PHRASAL_WORDS_MODE:qy,QUOTE_STRING_MODE:Fy,REGEXP_MODE:Yy,RE_STARTERS_RE:Uy,SHEBANG:By,TITLE_MODE:Zy,UNDERSCORE_IDENT_RE:Do,UNDERSCORE_TITLE_MODE:Xy});function t_(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function n_(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function r_(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=t_,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function s_(e,t){Array.isArray(e.illegal)&&(e.illegal=Mo(...e.illegal))}function i_(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 o_(e,t){e.relevance===void 0&&(e.relevance=1)}const a_=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Nn(n.beforeMatch,Uu(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},l_=["of","and","for","in","not","or","if","then","parent","list","value"],c_="keyword";function Wu(e,t,n=c_){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Wu(e[i],t,i))}),r;function s(i,o){t&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[i,u_(l[0],l[1])]})}}function u_(e,t){return t?Number(t):h_(e)?0:1}function h_(e){return l_.includes(e.toLowerCase())}const Ol={},Cn=e=>{console.error(e)},Cl=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Un=(e,t)=>{Ol[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Ol[`${e}/${t}`]=!0)},Ds=new Error;function Vu(e,t,{key:n}){let r=0;const s=e[n],i={},o={};for(let a=1;a<=t.length;a++)o[a+r]=s[a],i[a+r]=!0,r+=Bu(t[a-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function d_(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Cn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ds;if(typeof e.beginScope!="object"||e.beginScope===null)throw Cn("beginScope must be object"),Ds;Vu(e,e.begin,{key:"beginScope"}),e.begin=jo(e.begin,{joinWith:""})}}function f_(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Cn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ds;if(typeof e.endScope!="object"||e.endScope===null)throw Cn("endScope must be object"),Ds;Vu(e,e.end,{key:"endScope"}),e.end=jo(e.end,{joinWith:""})}}function p_(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function g_(e){p_(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),d_(e),f_(e)}function m_(e){function t(o,a){return new RegExp(Vr(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Bu(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=t(jo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function s(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function i(o,a){const l=o;if(o.isCompiled)return l;[n_,i_,g_,a_].forEach(u=>u(o,a)),e.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[r_,s_,o_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Wu(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Vr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return b_(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,a),l.matcher=s(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=cn(e.classNameAliases||{}),i(e)}function Gu(e){return e?e.endsWithParent||Gu(e.starts):!1}function b_(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return cn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Gu(e)?cn(e,{starts:e.starts?cn(e.starts):null}):Object.isFrozen(e)?cn(e):e}var y_="11.11.1";class __ extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Ii=Du,Nl=cn,Il=Symbol("nomatch"),v_=7,zu=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Iy};function l(x){return a.noHighlightRe.test(x)}function c(x){let j=x.className+" ";j+=x.parentNode?x.parentNode.className:"";const B=a.languageDetectRe.exec(j);if(B){const re=U(B[1]);return re||(Cl(i.replace("{}",B[1])),Cl("Falling back to no-highlight mode for this block.",x)),re?B[1]:"no-highlight"}return j.split(/\s+/).find(re=>l(re)||U(re))}function u(x,j,B){let re="",he="";typeof j=="object"?(re=x,B=j.ignoreIllegals,he=j.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
74
+ https://github.com/highlightjs/highlight.js/issues/2277`),he=x,re=j),B===void 0&&(B=!0);const be={code:re,language:he};me("before:highlight",be);const ye=be.result?be.result:h(be.language,be.code,B);return ye.code=be.code,me("after:highlight",ye),ye}function h(x,j,B,re){const he=Object.create(null);function be($,F){return $.keywords[F]}function ye(){if(!O.keywords){D.addText(T);return}let $=0;O.keywordPatternRe.lastIndex=0;let F=O.keywordPatternRe.exec(T),Y="";for(;F;){Y+=T.substring($,F.index);const ie=A.case_insensitive?F[0].toLowerCase():F[0],pe=be(O,ie);if(pe){const[Pe,ht]=pe;if(D.addText(Y),Y="",he[ie]=(he[ie]||0)+1,he[ie]<=v_&&(te+=ht),Pe.startsWith("_"))Y+=F[0];else{const pn=A.classNameAliases[Pe]||Pe;He(F[0],pn)}}else Y+=F[0];$=O.keywordPatternRe.lastIndex,F=O.keywordPatternRe.exec(T)}Y+=T.substring($),D.addText(Y)}function Ke(){if(T==="")return;let $=null;if(typeof O.subLanguage=="string"){if(!t[O.subLanguage]){D.addText(T);return}$=h(O.subLanguage,T,!0,q[O.subLanguage]),q[O.subLanguage]=$._top}else $=f(T,O.subLanguage.length?O.subLanguage:null);O.relevance>0&&(te+=$.relevance),D.__addSublanguage($._emitter,$.language)}function Ie(){O.subLanguage!=null?Ke():ye(),T=""}function He($,F){$!==""&&(D.startScope(F),D.addText($),D.endScope())}function Xe($,F){let Y=1;const ie=F.length-1;for(;Y<=ie;){if(!$._emit[Y]){Y++;continue}const pe=A.classNameAliases[$[Y]]||$[Y],Pe=F[Y];pe?He(Pe,pe):(T=Pe,ye(),T=""),Y++}}function I($,F){return $.scope&&typeof $.scope=="string"&&D.openNode(A.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(He(T,A.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),T=""):$.beginScope._multi&&(Xe($.beginScope,F),T="")),O=Object.create($,{parent:{value:O}}),O}function J($,F,Y){let ie=My($.endRe,Y);if(ie){if($["on:end"]){const pe=new Tl($);$["on:end"](F,pe),pe.isMatchIgnored&&(ie=!1)}if(ie){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return J($.parent,F,Y)}function G($){return O.matcher.regexIndex===0?(T+=$[0],1):(se=!0,0)}function ee($){const F=$[0],Y=$.rule,ie=new Tl(Y),pe=[Y.__beforeBegin,Y["on:begin"]];for(const Pe of pe)if(Pe&&(Pe($,ie),ie.isMatchIgnored))return G(F);return Y.skip?T+=F:(Y.excludeBegin&&(T+=F),Ie(),!Y.returnBegin&&!Y.excludeBegin&&(T=F)),I(Y,$),Y.returnBegin?0:F.length}function de($){const F=$[0],Y=j.substring($.index),ie=J(O,$,Y);if(!ie)return Il;const pe=O;O.endScope&&O.endScope._wrap?(Ie(),He(F,O.endScope._wrap)):O.endScope&&O.endScope._multi?(Ie(),Xe(O.endScope,$)):pe.skip?T+=F:(pe.returnEnd||pe.excludeEnd||(T+=F),Ie(),pe.excludeEnd&&(T=F));do O.scope&&D.closeNode(),!O.skip&&!O.subLanguage&&(te+=O.relevance),O=O.parent;while(O!==ie.parent);return ie.starts&&I(ie.starts,$),pe.returnEnd?0:F.length}function g(){const $=[];for(let F=O;F!==A;F=F.parent)F.scope&&$.unshift(F.scope);$.forEach(F=>D.openNode(F))}let b={};function v($,F){const Y=F&&F[0];if(T+=$,Y==null)return Ie(),0;if(b.type==="begin"&&F.type==="end"&&b.index===F.index&&Y===""){if(T+=j.slice(F.index,F.index+1),!s){const ie=new Error(`0 width match regex (${x})`);throw ie.languageName=x,ie.badRule=b.rule,ie}return 1}if(b=F,F.type==="begin")return ee(F);if(F.type==="illegal"&&!B){const ie=new Error('Illegal lexeme "'+Y+'" for mode "'+(O.scope||"<unnamed>")+'"');throw ie.mode=O,ie}else if(F.type==="end"){const ie=de(F);if(ie!==Il)return ie}if(F.type==="illegal"&&Y==="")return T+=`
75
+ `,1;if(Q>1e5&&Q>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return T+=Y,Y.length}const A=U(x);if(!A)throw Cn(i.replace("{}",x)),new Error('Unknown language: "'+x+'"');const P=m_(A);let R="",O=re||P;const q={},D=new a.__emitter(a);g();let T="",te=0,K=0,Q=0,se=!1;try{if(A.__emitTokens)A.__emitTokens(j,D);else{for(O.matcher.considerAll();;){Q++,se?se=!1:O.matcher.considerAll(),O.matcher.lastIndex=K;const $=O.matcher.exec(j);if(!$)break;const F=j.substring(K,$.index),Y=v(F,$);K=$.index+Y}v(j.substring(K))}return D.finalize(),R=D.toHTML(),{language:x,value:R,relevance:te,illegal:!1,_emitter:D,_top:O}}catch($){if($.message&&$.message.includes("Illegal"))return{language:x,value:Ii(j),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:K,context:j.slice(K-100,K+100),mode:$.mode,resultSoFar:R},_emitter:D};if(s)return{language:x,value:Ii(j),illegal:!1,relevance:0,errorRaised:$,_emitter:D,_top:O};throw $}}function d(x){const j={value:Ii(x),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return j._emitter.addText(x),j}function f(x,j){j=j||a.languages||Object.keys(t);const B=d(x),re=j.filter(U).filter(X).map(Ie=>h(Ie,x,!1));re.unshift(B);const he=re.sort((Ie,He)=>{if(Ie.relevance!==He.relevance)return He.relevance-Ie.relevance;if(Ie.language&&He.language){if(U(Ie.language).supersetOf===He.language)return 1;if(U(He.language).supersetOf===Ie.language)return-1}return 0}),[be,ye]=he,Ke=be;return Ke.secondBest=ye,Ke}function p(x,j,B){const re=j&&n[j]||B;x.classList.add("hljs"),x.classList.add(`language-${re}`)}function m(x){let j=null;const B=c(x);if(l(B))return;if(me("before:highlightElement",{el:x,language:B}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new __("One of your code blocks includes unescaped HTML.",x.innerHTML);j=x;const re=j.textContent,he=B?u(re,{language:B,ignoreIllegals:!0}):f(re);x.innerHTML=he.value,x.dataset.highlighted="yes",p(x,B,he.language),x.result={language:he.language,re:he.relevance,relevance:he.relevance},he.secondBest&&(x.secondBest={language:he.secondBest.language,relevance:he.secondBest.relevance}),me("after:highlightElement",{el:x,result:he,text:re})}function E(x){a=Nl(a,x)}const _=()=>{k(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){k(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function k(){function x(){k()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",x,!1),w=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function C(x,j){let B=null;try{B=j(e)}catch(re){if(Cn("Language definition for '{}' could not be registered.".replace("{}",x)),s)Cn(re);else throw re;B=o}B.name||(B.name=x),t[x]=B,B.rawDefinition=j.bind(null,e),B.aliases&&S(B.aliases,{languageName:x})}function L(x){delete t[x];for(const j of Object.keys(n))n[j]===x&&delete n[j]}function N(){return Object.keys(t)}function U(x){return x=(x||"").toLowerCase(),t[x]||t[n[x]]}function S(x,{languageName:j}){typeof x=="string"&&(x=[x]),x.forEach(B=>{n[B.toLowerCase()]=j})}function X(x){const j=U(x);return j&&!j.disableAutodetect}function ae(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=j=>{x["before:highlightBlock"](Object.assign({block:j.el},j))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=j=>{x["after:highlightBlock"](Object.assign({block:j.el},j))})}function H(x){ae(x),r.push(x)}function ue(x){const j=r.indexOf(x);j!==-1&&r.splice(j,1)}function me(x,j){const B=x;r.forEach(function(re){re[B]&&re[B](j)})}function Ne(x){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),m(x)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:k,highlightElement:m,highlightBlock:Ne,configure:E,initHighlighting:_,initHighlightingOnLoad:y,registerLanguage:C,unregisterLanguage:L,listLanguages:N,getLanguage:U,registerAliases:S,autoDetection:X,inherit:Nl,addPlugin:H,removePlugin:ue}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=y_,e.regex={concat:Nn,lookahead:Uu,either:Mo,optional:Ly,anyNumberOfTimes:Py};for(const x in ms)typeof ms[x]=="object"&&ju(ms[x]);return Object.assign(e,ms),e},ir=zu({});ir.newInstance=()=>zu({});var w_=ir;ir.HighlightJS=ir;ir.default=ir;const $e=Ry(w_),Us="[A-Za-z$_][0-9A-Za-z$_]*",Ju=["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"],Yu=["true","false","null","undefined","NaN","Infinity"],Zu=["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"],Xu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Qu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],eh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],th=[].concat(Qu,Zu,Xu);function E_(e){const t=e.regex,n=(B,{after:re})=>{const he="</"+B[0].slice(1);return B.input.indexOf(he,re)!==-1},r=Us,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,re)=>{const he=B[0].length+B.index,be=B.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(B,{after:he})||re.ignoreMatch());let ye;const Ke=B.input.substring(he);if(ye=Ke.match(/^\s*=/)){re.ignoreMatch();return}if((ye=Ke.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Us,keyword:Ju,literal:Yu,built_in:th,"variable.language":eh},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(y,d.contains),C=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},U={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:{_:[...Zu,...Xu]}},S={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(B){return t.concat("(?!",B.join("|"),")")}const ue={match:t.concat(/\b/,H([...Qu,"super","import"].map(B=>`${B}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),S,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,y,{match:/\$\d+/},h,U,{scope:"attr",match:r+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},ue,ae,N,Ne,{match:/\$[(.]/}]}}function nh(e){const t=e.regex,n=E_(e),r=Us,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Us,keyword:Ju.concat(l),literal:Yu,built_in:th.concat(s),"variable.language":eh},u={className:"meta",begin:"@"+r},h=(m,E,_)=>{const y=m.contains.findIndex(w=>w.label===E);if(y===-1)throw new Error("can not find mode to replace");m.contains.splice(y,1,_)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(m=>m.scope==="attr"),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,i,o,f]),h(n,"shebang",e.SHEBANG()),h(n,"use_strict",a);const p=n.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Pl="[A-Za-z$_][0-9A-Za-z$_]*",S_=["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"],k_=["true","false","null","undefined","NaN","Infinity"],rh=["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"],sh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ih=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],A_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],T_=[].concat(ih,rh,sh);function oh(e){const t=e.regex,n=(B,{after:re})=>{const he="</"+B[0].slice(1);return B.input.indexOf(he,re)!==-1},r=Pl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,re)=>{const he=B[0].length+B.index,be=B.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(B,{after:he})||re.ignoreMatch());let ye;const Ke=B.input.substring(he);if(ye=Ke.match(/^\s*=/)){re.ignoreMatch();return}if((ye=Ke.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Pl,keyword:S_,literal:k_,built_in:T_,"variable.language":A_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(y,d.contains),C=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},U={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:{_:[...rh,...sh]}},S={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(B){return t.concat("(?!",B.join("|"),")")}const ue={match:t.concat(/\b/,H([...ih,"super","import"].map(B=>`${B}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),S,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,y,{match:/\$\d+/},h,U,{scope:"attr",match:r+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},ue,ae,N,Ne,{match:/\$[(.]/}]}}function ah(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${d})[jJ](?=${p})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},_={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,h,e.HASH_COMMENT_MODE]}]};return c.contains=[h,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[_]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,_,h]}]}}function lh(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),p={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"],E=["true","false"],_={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["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"],C=["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:E,built_in:[...y,...w,"set","shopt",...k,...C]},contains:[f,e.SHEBANG(),p,h,i,o,_,a,l,c,u,n]}}function x_(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const R_=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_-]*/}}),O_=["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"],C_=["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"],N_=[...O_,...C_],I_=["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(),P_=["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(),L_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),$_=["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 M_(e){const t=e.regex,n=R_(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+P_.join("|")+")"},{begin:":(:)?("+L_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$_.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:I_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+N_.join("|")+")\\b"}]}}function ch(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function j_(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,p=[...c,...l].filter(C=>!u.includes(C)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function y(C){return t.concat(/\b/,t.either(...C.map(L=>L.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:y(d),relevance:0};function k(C,{exceptions:L,when:N}={}){const U=N;return L=L||[],C.map(S=>S.match(/\|\d+$/)||L.includes(S)?S:U(S)?`${S}|0`:S)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(p,{when:C=>C.length<3}),literal:i,type:a,built_in:h},contains:[{scope:"type",match:y(o)},w,_,m,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function uh(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},p,m,i,o],_=[...E];return _.pop(),_.push(a),f.contains=_,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}function hh(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(c,{contains:[]}),d=e.inherit(u,{contains:[]});c.contains.push(d),u.contains.push(h);let f=[n,l];return[c,u,h,d].forEach(_=>{_.contains=_.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}$e.registerLanguage("typescript",nh);$e.registerLanguage("ts",nh);$e.registerLanguage("javascript",oh);$e.registerLanguage("js",oh);$e.registerLanguage("python",ah);$e.registerLanguage("py",ah);$e.registerLanguage("bash",lh);$e.registerLanguage("sh",lh);$e.registerLanguage("json",x_);$e.registerLanguage("css",M_);$e.registerLanguage("html",ch);$e.registerLanguage("xml",ch);$e.registerLanguage("sql",j_);$e.registerLanguage("yaml",uh);$e.registerLanguage("yml",uh);$e.registerLanguage("markdown",hh);$e.registerLanguage("md",hh);function D_(e){if(/&(lt|gt|amp|quot|apos|#);/.test(e)){const t=e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&apos;/g,"'");if(/<[a-z]/i.test(t))return t}return e}function bt(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,n,r)=>`<a href="${/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("#")?r:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${n}</a>`)}function dh(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Ll(e){return dh(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Pi(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function U_(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function B_(e){if(e.length<2)return e.map(a=>`<p class="my-1">${bt(a)}</p>`).join(`
76
+ `);const t=Pi(e[0]),n=e[1],r=Ll(n)?Pi(n).map(U_):t.map(()=>"text-left"),s=Ll(n)?e.slice(2):e.slice(1),i=t.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${r[l]??"text-left"}">${bt(a)}</th>`).join(""),o=s.map(a=>{const l=Pi(a);return`<tr class="border-b border-gray-800">${t.map((u,h)=>`<td class="px-3 py-1.5 text-gray-400 ${r[h]??"text-left"}">${bt(l[h]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function fh(e){if(!e)return"";e=D_(e);const t=e.split(`
77
+ `),n=[];let r=!1,s=null,i=!1,o=!1,a=[],l="",c=[];function u(){s&&(n.push(`</${s}>`),s=null)}function h(){o&&(n.push(B_(c)),c=[],o=!1)}function d(){i&&(n.push("</blockquote>"),i=!1)}for(const f of t){if(f.startsWith("```")){if(u(),h(),!r)r=!0,l=f.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const C=a.join(`
78
+ `);let L;try{L=l&&$e.getLanguage(l)?$e.highlight(C,{language:l,ignoreIllegals:!0}).value:$e.highlightAuto(C).value}catch{L=C.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const N=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),U=N?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${N}</span>`:"";n.push(`<div class="relative my-2"><pre class="bg-surface-1 border border-edge rounded-xl p-3 overflow-x-auto"><code class="hljs font-mono text-xs">${L}</code></pre>${U}</div>`),r=!1,l="",a=[]}continue}if(r){a.push(f);continue}if(dh(f)){u(),o=!0,c.push(f);continue}o&&h();const p=f.match(/^####\s+(.+)/),m=f.match(/^###\s+(.+)/),E=f.match(/^##\s+(.+)/),_=f.match(/^#\s+(.+)/);if(p){u(),d(),n.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${bt(p[1])}</h4>`);continue}if(m){u(),d(),n.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${bt(m[1])}</h3>`);continue}if(E){u(),d(),n.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${bt(E[1])}</h2>`);continue}if(_){u(),d(),n.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${bt(_[1])}</h1>`);continue}if(/^---+$/.test(f.trim())){u(),d(),n.push('<hr class="border-gray-800 my-4" />');continue}const y=f.match(/^[-*+]\s+(.+)/);if(y){s==="ol"&&u(),d(),s||(n.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),s="ul"),n.push(`<li>${bt(y[1])}</li>`);continue}const w=f.match(/^\d+\.\s+(.+)/);if(w){s==="ul"&&u(),d(),s||(n.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),s="ol"),n.push(`<li>${bt(w[1])}</li>`);continue}const k=f.match(/^>\s?(.*)/);if(k){u(),i||(n.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),n.push(`<p class="my-0">${bt(k[1])}</p>`);continue}if(f.trim()===""){u(),d(),n.push('<div class="my-2"></div>');continue}u(),d(),n.push(`<p class="my-1">${bt(f)}</p>`)}if(r&&a.length){const f=a.join(`
79
79
  `).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");n.push(`<pre class="bg-gray-900 border border-gray-800 rounded p-3 my-2 overflow-x-auto"><code class="font-mono text-xs text-green-300">${f}</code></pre>`)}return h(),u(),d(),n.join(`
80
- `)}function Zv(e){const t=(e??"").toLowerCase();return["error","failed","failure","cancelled","aborted"].some(n=>t.includes(n))?"error":["success","completed","done","healthy"].some(n=>t.includes(n))?"success":["working","running","active","queued","pending","in_progress","processing"].some(n=>t.includes(n))?"working":"idle"}function Xv(e){const t=(e??"").toLowerCase();return["failed","error","aborted","cancelled"].some(n=>t.includes(n))?"failed":["success","completed","merged"].some(n=>t.includes(n))?"success":["pause","idle"].some(n=>t.includes(n))?"paused":"running"}function $l(e){switch((e??"").toLowerCase()){case"gi joe":return"#5fff87";case"thundercats":return"#ffd000";case"a-team":return"#ff6b35";case"ghostbusters":return"#c4a7ff";default:return"#00d9ff"}}function Qv(e){switch(e){case"failed":return"#ff3864";case"success":return"#5fff87";case"paused":return"#8a8a99";default:return"#00d9ff"}}function B_(e,t){const n=e.replace("#","");if(n.length!==6)return e;const r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgba(${r}, ${s}, ${i}, ${t})`}function gh(e){return(e??"io").replace(/[_/]+/g," ").replace(/-/g," ").replace(/\.[^.]+$/,"").replace(/\w/g,t=>t.toUpperCase())}function mh(e){if(!e)return"just now";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=t.getTime()-Date.now(),r=n<=0,s=Math.abs(n),i=6e4,o=60*i,a=24*o;let l=0,c="m";return s<o?(l=Math.max(1,Math.round(s/i)),c="m"):s<a?(l=Math.round(s/o),c="h"):(l=Math.round(s/a),c="d"),r?`${l}${c} ago`:`in ${l}${c}`}function ew(e,t){const n=`${e} ${t??""}`.toLowerCase();return/(read|write|edit|glob|file|path|fs)/.test(n)?"File System":/(grep|search|code|analy|lint|semantic|test|debug)/.test(n)?"Code Intelligence":/(git|branch|commit|pr|issue|ci|build|release)/.test(n)?"Git & CI":"Communication"}function tw(e){const t=[];for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t,i="";for(const[o,a]of r.entries()){i=i?`${i}/${a}`:a;let l=s.find(c=>c.id===i);l||(l={id:i,label:o===r.length-1?n.title:gh(a),path:o===r.length-1?n.path:void 0,children:[]},s.push(l)),s=l.children}}return t}function nw(e,t){return e.some(n=>n.status==="error")?"error":e.some(n=>n.status==="working")?"working":e.some(n=>n.status==="success")?"success":((t==null?void 0:t.instances_active)??0)>0?"working":"idle"}const H_={key:0,class:"fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l border-border bg-sidebar md:w-[420px]"},F_={class:"flex shrink-0 items-center justify-between border-b border-border px-5 py-4"},q_={class:"flex items-center gap-2"},K_={key:0,class:"rounded-full bg-destructive px-1.5 py-0.5 font-mono text-[9px] font-bold text-white"},W_={class:"flex-1 overflow-y-auto"},V_={key:0,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},G_={key:1,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},z_={key:2},J_={class:"sticky top-0 z-10 border-b border-border/40 bg-sidebar/95 px-5 py-2 backdrop-blur"},Y_=["onClick"],Z_={class:"flex items-start gap-3"},X_={class:"mt-1.5 shrink-0"},Q_={key:0,class:"h-1.5 w-1.5 rounded-full bg-primary",style:{boxShadow:"var(--glow-cyan)"}},ev={key:1,class:"h-1.5 w-1.5"},tv={class:"min-w-0 flex-1"},nv={class:"mb-1 flex flex-wrap items-center gap-1.5"},rv={class:"font-mono text-[10px] text-muted-foreground/50"},sv={class:"text-[10px] text-muted-foreground/50"},iv={class:"flex items-center justify-between gap-2"},ov={class:"font-mono text-[10px] text-muted-foreground/40"},av={key:0,class:"text-[10px] text-primary/60"},lv={key:0,class:"mt-2.5 rounded border border-white/[0.06] bg-black/30 p-3 text-xs text-foreground/60"},cv=["innerHTML"],uv=dn({__name:"FeedFlyout",props:{open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,s=Ae([]),i=Ae({}),o=Ae(null),a=Ae(!1),l=Fe(()=>{var d;const h=new Map;for(const f of s.value){const p=f.squad_slug??"io",m=i.value[p];h.has(p)||h.set(p,{key:p,label:(m==null?void 0:m.name)??gh(p),universe:m==null?void 0:m.universe,entries:[]}),(d=h.get(p))==null||d.entries.push(f)}return[...h.values()]});async function c(){a.value=!0;try{const[h,d]=await Promise.all([gt("/api/feed?limit=80"),gt("/api/squads")]);if(h.ok&&(s.value=(await h.json()).entries),d.ok){const f=await d.json();i.value=Object.fromEntries(f.squads.map(p=>[p.slug??p.id??p.name.toLowerCase(),{name:p.name,universe:p.universe}]))}}finally{a.value=!1}}async function u(h){o.value=o.value===h.id?null:h.id,h.read_at||(await gt(`/api/feed/${h.id}/read`,{method:"POST"}).catch(()=>null),h.read_at=new Date().toISOString())}return cn(()=>n.open,h=>{h?c():o.value=null}),(h,d)=>(J(),tr(yd,{to:"body"},[ue(vs,{"enter-active-class":"duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:Gt(()=>[e.open?(J(),Z("div",{key:0,class:"fixed inset-0 z-40 bg-black/40",onClick:d[0]||(d[0]=f=>r("close"))})):Je("",!0)]),_:1}),ue(vs,{"enter-active-class":"transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]","enter-from-class":"translate-x-full","enter-to-class":"translate-x-0","leave-active-class":"transition-transform duration-200 ease-in","leave-from-class":"translate-x-0","leave-to-class":"translate-x-full"},{default:Gt(()=>[e.open?(J(),Z("aside",H_,[$("div",F_,[$("div",q_,[ue(st,{name:"message",class:"h-4 w-4 text-primary"}),d[2]||(d[2]=$("span",{class:"text-sm font-semibold"},"Activity Feed",-1)),s.value.filter(f=>!f.read_at).length?(J(),Z("span",K_,Oe(s.value.filter(f=>!f.read_at).length),1)):Je("",!0)]),$("button",{class:"flex h-7 w-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",onClick:d[1]||(d[1]=f=>r("close"))},[ue(st,{name:"x",class:"h-4 w-4"})])]),$("div",W_,[a.value?(J(),Z("div",V_,"Syncing feed…")):l.value.length?(J(),Z("div",z_,[(J(!0),Z(ge,null,xn(l.value,f=>(J(),Z("section",{key:f.key,class:"border-b border-border/40 last:border-b-0"},[$("div",J_,[$("span",{class:"rounded px-1.5 py-0.5 font-mono text-[10px]",style:zs({color:De($l)(f.universe),backgroundColor:De(B_)(De($l)(f.universe),.15)})},Oe(f.label),5)]),$("div",null,[(J(!0),Z(ge,null,xn(f.entries,p=>(J(),Z("article",{key:p.id,class:ft(["cursor-pointer px-5 py-3.5 transition-colors hover:bg-white/[0.02]",p.read_at?"":"bg-white/[0.015]"]),onClick:m=>u(p)},[$("div",Z_,[$("div",X_,[p.read_at?(J(),Z("div",ev)):(J(),Z("div",Q_))]),$("div",tv,[$("div",nv,[$("span",rv,Oe(p.source_ref??p.instance_id??p.task_id??p.type),1),d[3]||(d[3]=$("span",{class:"font-mono text-[10px] text-muted-foreground/40"},"·",-1)),$("span",sv,Oe(p.source_type??"IO"),1)]),$("div",{class:ft(["mb-1 text-sm leading-snug",p.read_at?"text-foreground/70":"text-foreground"])},Oe(p.title),3),$("div",iv,[$("span",ov,Oe(De(mh)(p.created_at)),1),p.body?(J(),Z("span",av,Oe(o.value===p.id?"▲ collapse":"▼ details"),1)):Je("",!0)]),ue(vs,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:Gt(()=>[o.value===p.id&&p.body?(J(),Z("div",lv,[$("div",{class:"wiki-content text-xs font-mono leading-relaxed",innerHTML:De(ph)(p.body)},null,8,cv)])):Je("",!0)]),_:2},1024)])])],10,Y_))),128))])]))),128))])):(J(),Z("div",G_,"No feed activity."))])])):Je("",!0)]),_:1})]))}}),hv=nu("chat",()=>{const e=Ae([]),t=Ae(!1);let n=null,r=null;function s(d){return e.value.length?d?e.value.find(f=>f.id===d)??null:e.value[e.value.length-1]??null:null}function i(d){const f={id:d.id??crypto.randomUUID(),createdAt:d.createdAt??new Date().toISOString(),streaming:d.streaming??!1,role:d.role,text:d.text,kind:d.kind};return e.value.push(f),f}function o(d,f){const p=s(f??r??void 0);p&&(p.text+=d)}function a(d,f){const p=s(f??r??void 0);p&&(p.streaming=d)}function l(){n==null||n.close(),n=null,r=null,t.value=!1}async function c(d,f=[]){const p=d.trim();if(!p)return;l(),i({role:"user",text:p});const m=i({role:"assistant",text:"",streaming:!0});r=m.id,t.value=!0;const w=await py("/api/events");n=new EventSource(w),n.onmessage=y=>{try{const v=JSON.parse(y.data);if(v.type==="delta"){o(String(v.text??""),m.id);return}if(v.type==="done"){a(!1,m.id),l();return}v.type==="feed"&&i({role:"system",kind:"feed",text:[v.title,v.body].filter(Boolean).join(`
81
- `)||JSON.stringify(v,null,2)})}catch{o(y.data,m.id)}},n.onerror=()=>{m.text||(m.text="stream disconnected"),a(!1,m.id),l()};const E=await gt("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:p,attachments:f})});if(!E.ok){const y=await E.text();m.text=y||`Request failed (${E.status})`,a(!1,m.id),l()}}async function u(){await gt("/api/orchestrator/abort",{method:"POST"}).catch(()=>null),a(!1),l()}function h(){l(),e.value=[]}return{messages:e,isLoading:t,addMessage:i,appendToLast:o,setLastStreaming:a,sendMessage:c,abortRun:u,clearMessages:h}}),dv={class:"fixed bottom-14 right-0 z-50 flex w-full flex-col md:bottom-10 md:right-4 md:w-[360px]"},fv={key:0,class:"flex h-[380px] flex-col overflow-hidden rounded-t-xl border border-border border-b-0 bg-sidebar"},pv={class:"flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-2.5"},gv={class:"flex items-center gap-2"},mv={key:0,class:"whitespace-pre-wrap"},bv=["innerHTML"],yv={type:"submit",class:"flex shrink-0 items-center gap-1 rounded bg-primary/15 px-2.5 py-1 font-mono text-xs text-primary transition-colors hover:bg-primary/25"},_v=dn({__name:"FloatingChat",setup(e,{expose:t}){const n=hv(),r=Ae(""),s=Ae(!1),i=Ae(null),o=Ae(null),a=Fe(()=>n.messages.length?n.messages:[{id:"welcome",role:"assistant",text:"IO online. What do you need?",createdAt:new Date().toISOString(),streaming:!1}]),l=Fe(()=>a.value.map(f=>`${f.id}:${f.text.length}:${f.streaming}`).join("|"));function c(){o.value&&(o.value.scrollTop=o.value.scrollHeight)}async function u(){const f=r.value.trim();f&&(r.value="",await n.sendMessage(f))}function h(){s.value=!0}function d(){s.value=!1}return cn(s,async f=>{var p;f&&(await er(),(p=i.value)==null||p.focus(),c())}),cn(l,async()=>{s.value&&(await er(),c())}),t({open:h,isOpen:s}),(f,p)=>(J(),Z("div",dv,[ue(vs,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-y-2 scale-[0.97] opacity-0","enter-to-class":"translate-y-0 scale-100 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-y-0 scale-100 opacity-100","leave-to-class":"translate-y-2 scale-[0.97] opacity-0"},{default:Gt(()=>[s.value?(J(),Z("div",fv,[$("div",pv,[$("div",gv,[ue(st,{name:"terminal",class:"h-3.5 w-3.5 text-primary"}),p[1]||(p[1]=$("span",{class:"font-mono text-xs text-foreground/70"},"IO Command",-1))]),$("button",{class:"text-muted-foreground/40 transition-colors hover:text-muted-foreground",onClick:d},[ue(st,{name:"chevron-down",class:"h-4 w-4"})])]),$("div",{ref_key:"scrollPanel",ref:o,class:"flex-1 space-y-2.5 overflow-y-auto px-4 py-3"},[(J(!0),Z(ge,null,xn(a.value,m=>(J(),Z("div",{key:m.id,class:ft(["flex",m.role==="user"?"justify-end":"justify-start"])},[$("div",{class:ft(["max-w-[85%] rounded-lg px-3 py-2 text-xs leading-relaxed",m.role==="user"?"rounded-br-sm border border-primary/20 bg-primary/15 font-mono text-primary":"rounded-bl-sm border border-white/[0.06] bg-white/[0.04] text-foreground/75"])},[m.role==="user"?(J(),Z("div",mv,Oe(m.text),1)):(J(),Z("div",{key:1,class:"wiki-content text-xs",innerHTML:De(ph)(m.text||(m.streaming?"…":""))},null,8,bv))],2)],2))),128))],512)])):Je("",!0)]),_:1}),$("div",{class:ft(["overflow-hidden border border-border bg-sidebar",s.value?"rounded-b-xl border-t-0":"rounded-xl"])},[s.value?(J(),Z("form",{key:0,class:"flex items-center gap-2 border-t border-border/50 px-3 py-2.5",onSubmit:Qf(u,["prevent"])},[ud($("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":p[0]||(p[0]=m=>r.value=m),type:"text",placeholder:"Command IO...",class:"flex-1 bg-transparent font-mono text-sm text-foreground placeholder:text-muted-foreground/40"},null,512),[[Yf,r.value]]),$("button",yv,[ue(st,{name:"zap",class:"h-3 w-3"}),p[2]||(p[2]=Gc(" send ",-1))])],32)):(J(),Z("button",{key:1,class:"flex w-full items-center gap-2.5 px-4 py-3 text-left transition-colors hover:bg-white/[0.03]",onClick:h},[ue(st,{name:"terminal",class:"h-4 w-4 text-primary",style:{filter:"drop-shadow(0 0 6px #00d9ff88)"}}),p[3]||(p[3]=$("span",{class:"flex-1 font-mono text-sm text-muted-foreground/60"},"Command IO...",-1)),ue(st,{name:"chevron-up",class:"h-4 w-4 text-muted-foreground/30"})]))],2)]))}}),vv={class:"fixed inset-x-0 bottom-0 z-30 flex items-center justify-around border-t border-border bg-sidebar px-2 pb-[env(safe-area-inset-bottom)] pt-1 md:hidden"},wv={key:0,class:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-destructive px-0.5 font-mono text-[8px] font-bold leading-none text-white"},Ev={class:"font-mono text-[10px]"},Sv={key:1,class:"absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full bg-primary"},kv=dn({__name:"MobileNav",setup(e){const t=Io(),n=Ae(0),r=Ae(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}];function o(c){return(c.match??[c.to]).some(h=>t.path.startsWith(h))}function a(c){return c.badge==="feed"?n.value:c.badge==="inbox"?r.value:0}async function l(){try{const[c,u]=await Promise.all([gt("/api/feed/count"),gt("/api/inbox/count")]);c.ok&&(n.value=Number((await c.json()).count??0)),u.ok&&(r.value=Number((await u.json()).count??0))}catch{}}return Zr(()=>{l(),s=window.setInterval(l,15e3)}),Xr(()=>{window.clearInterval(s)}),(c,u)=>(J(),Z("nav",vv,[(J(),Z(ge,null,xn(i,h=>ue(De(Ar),{key:h.to,to:h.to,class:ft(["relative flex flex-col items-center gap-0.5 rounded-lg px-3 py-1.5 transition-colors",o(h)?"text-primary":"text-muted-foreground/50"])},{default:Gt(()=>[a(h)>0?(J(),Z("span",wv,Oe(a(h)),1)):Je("",!0),ue(st,{name:h.icon,class:"h-5 w-5"},null,8,["name"]),$("span",Ev,Oe(h.label),1),o(h)?(J(),Z("div",Sv)):Je("",!0)]),_:2},1032,["to","class"])),64))]))}}),Av={class:"dark flex h-full flex-col overflow-hidden bg-background text-foreground"},Tv={class:"flex shrink-0 items-center justify-between border-b border-border bg-sidebar px-4 py-3 md:px-5"},Rv={class:"flex items-center gap-2"},xv={key:0,class:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-destructive font-mono text-[9px] font-bold text-white"},Ov={class:"flex min-h-0 flex-1 overflow-hidden"},Cv={class:"flex min-w-0 flex-1 flex-col overflow-hidden"},Nv={class:"min-h-0 flex-1 overflow-hidden pb-[calc(env(safe-area-inset-bottom)+3.5rem)] md:pb-0"},Iv={class:"hidden shrink-0 border-t border-border bg-sidebar px-5 py-2 md:block"},Pv={class:"flex items-center justify-between font-mono text-[11px]"},Lv={class:"flex items-center gap-4"},$v={class:"flex items-center gap-1.5"},Mv={class:"text-muted-foreground"},jv={class:"text-accent-foreground"},Dv={class:"flex items-center gap-4"},Uv={key:0,class:"flex items-center gap-1.5 text-primary"},Bv={class:"text-muted-foreground/40"},Hv={key:1,class:"h-full"},Fv=dn({__name:"App",setup(e){const t=Io(),n=ui(),r=Ae(null),s=Ae(!1),i=Ae(0),o=Ae(null),a=Ae({squads:0,agents:0,instances:0,runningInstances:0,working:0});let l=0;const c=Fe(()=>t.name!=="login"&&n.isAuthenticated),u=Fe(()=>mh(o.value));function h(){var p;(p=r.value)==null||p.open()}function d(p){(p.metaKey||p.ctrlKey)&&p.key==="."&&(p.preventDefault(),h())}async function f(){try{const[p,m,w]=await Promise.all([gt("/api/feed/count"),gt("/api/squads"),gt("/api/tasks")]);if(p.ok&&(i.value=Number((await p.json()).count??0)),m.ok){const E=await m.json();a.value.squads=E.squads.length,a.value.agents=E.squads.reduce((y,v)=>y+Number(v.agents_count??0),0),a.value.instances=E.squads.reduce((y,v)=>y+Number(v.instances_total??0),0),a.value.runningInstances=E.squads.reduce((y,v)=>y+Number(v.instances_active??0),0)}if(w.ok){const E=await w.json();a.value.working=E.tasks.filter(y=>/running|working|queued|pending|in_progress/i.test(y.status)).length}o.value=new Date().toISOString()}catch{}}return Zr(()=>{n.init(),f(),l=window.setInterval(f,3e4),window.addEventListener("keydown",d)}),Xr(()=>{window.clearInterval(l),window.removeEventListener("keydown",d)}),(p,m)=>(J(),Z("div",Av,[c.value?(J(),Z(ge,{key:0},[$("div",Tv,[m[3]||(m[3]=$("div",{class:"flex items-center gap-3 md:gap-4"},[$("div",{class:"select-none font-mono text-xl font-bold tracking-tight text-primary text-glow-cyan"},"IO"),$("div",{class:"hidden h-4 w-px bg-border md:block"}),$("div",{class:"hidden font-mono text-xs text-muted-foreground md:block"},"Mission Control · Developer AI Assistant")],-1)),$("div",Rv,[$("button",{class:"relative flex items-center gap-2 rounded border border-border px-3 py-1.5 text-sm text-muted-foreground transition-all hover:border-primary/40 hover:bg-primary/5 hover:text-foreground",onClick:m[0]||(m[0]=w=>s.value=!0)},[ue(st,{name:"message",class:"h-4 w-4"}),m[2]||(m[2]=$("span",{class:"text-xs font-medium"},"Feed",-1)),i.value>0?(J(),Z("span",xv,Oe(i.value),1)):Je("",!0)])])]),$("div",Ov,[ue(Ry),$("div",Cv,[$("div",Nv,[ue(De(Qi))])])]),$("div",Iv,[$("div",Pv,[$("div",Lv,[$("div",$v,[ue(st,{name:"circle",class:"h-2 w-2 text-status-success"}),m[4]||(m[4]=$("span",{class:"text-muted-foreground"},"Daemon running",-1))]),m[5]||(m[5]=$("span",{class:"text-muted-foreground/40"},"·",-1)),$("span",Mv,Oe(a.value.squads)+" squads · "+Oe(a.value.agents)+" agents",1),m[6]||(m[6]=$("span",{class:"text-muted-foreground/40"},"·",-1)),$("span",jv,Oe(a.value.runningInstances)+"/"+Oe(a.value.instances)+" instances active",1)]),$("div",Dv,[a.value.working>0?(J(),Z("div",Uv,[ue(st,{name:"activity",class:"h-3 w-3"}),$("span",null,Oe(a.value.working)+" working",1)])):Je("",!0),$("span",Bv,"Last sync: "+Oe(u.value),1)])])]),ue(uv,{open:s.value,onClose:m[1]||(m[1]=w=>s.value=!1)},null,8,["open"]),ue(_v,{ref_key:"floatingChat",ref:r},null,512),ue(kv)],64)):(J(),Z("div",Hv,[ue(De(Qi))]))]))}}),qv="modulepreload",Kv=function(e){return"/"+e},Ml={},Rt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=Kv(l),l in Ml)return;Ml[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":qv,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},bh=gg({history:Jp(),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:()=>Rt(()=>import("./LoginView-DNcKxnq-.js"),[]),meta:{title:"Login",subtitle:"Authenticate against Supabase",public:!0}},{path:"/chat",name:"chat",component:()=>Rt(()=>import("./ChatView-DV4zdwDI.js"),[]),meta:{title:"Chat",subtitle:"Live orchestrator stream"}},{path:"/squads",name:"squads",component:()=>Rt(()=>import("./SquadsView-DpI4RInq.js"),__vite__mapDeps([0,1])),meta:{title:"Squads",subtitle:"Project crews and worktrees"}},{path:"/activity",name:"activity",component:()=>Rt(()=>import("./AgentActivityView-D-xGvKsm.js"),__vite__mapDeps([2,1])),meta:{title:"Activity",subtitle:"Task execution and event stream"}},{path:"/schedules",name:"schedules",component:()=>Rt(()=>import("./SchedulesView-uxtLtxEL.js"),[]),meta:{title:"Schedules",subtitle:"Cron-driven automation matrix"}},{path:"/skills",name:"skills",component:()=>Rt(()=>import("./SkillsView-CobJkgd1.js"),__vite__mapDeps([3,4])),meta:{title:"Skills",subtitle:"Installed skill manifests and content"}},{path:"/wiki",name:"wiki",component:()=>Rt(()=>import("./WikiView-DeY1mFGq.js"),[]),meta:{title:"Wiki",subtitle:"Workspace knowledge browser"}},{path:"/mcp",name:"mcp",component:()=>Rt(()=>import("./McpView-CbiIag57.js"),__vite__mapDeps([5,4])),meta:{title:"MCP",subtitle:"Server registry and transport health"}},{path:"/feed",name:"feed",component:()=>Rt(()=>import("./FeedView-BBbnBU_A.js"),[]),meta:{title:"Feed",subtitle:"Notifications and durable activity"}},{path:"/inbox",name:"inbox",component:()=>Rt(()=>import("./InboxView-C_6LL8bG.js"),[]),meta:{title:"Inbox",subtitle:"Operator-facing messages"}}]});bh.beforeEach(async e=>{const t=ui();return await t.init(),e.path==="/"?"/chat":t.authEnabled?!t.user&&e.path!=="/login"&&!e.meta.public?{path:"/login",query:{redirect:e.fullPath}}:t.user&&e.path==="/login"?"/chat":!0:e.path==="/login"?"/chat":!0});const Uo=rp(Fv),Wv=op();Uo.use(Wv);Uo.use(bh);Uo.mount("#app");export{Gt as A,B_ as B,Qv as C,tr as D,$l as E,ge as F,gt as G,Zv as H,Xv as I,mh as J,nw as K,Xr as L,py as M,ew as N,Vv as O,tw as P,zv as Q,Ar as R,Gv as S,vs as T,gh as U,st as _,$ as a,De as b,Z as c,dn as d,Jv as e,Qf as f,Je as g,Yv as h,Io as i,J as j,hv as k,cn as l,xn as m,ue as n,Zr as o,Gc as p,Fe as q,Ae as r,ft as s,Oe as t,ui as u,Yf as v,ud as w,ph as x,er as y,zs as z};
80
+ `)}function uw(e){const t=(e??"").toLowerCase();return["error","failed","failure","cancelled","aborted"].some(n=>t.includes(n))?"error":["success","completed","done","healthy"].some(n=>t.includes(n))?"success":["working","running","active","queued","pending","in_progress","processing"].some(n=>t.includes(n))?"working":"idle"}function hw(e){const t=(e??"").toLowerCase();return["failed","error","aborted","cancelled"].some(n=>t.includes(n))?"failed":["success","completed","merged"].some(n=>t.includes(n))?"success":["pause","idle"].some(n=>t.includes(n))?"paused":"running"}function dw(e){switch(e){case"failed":return"#ff3864";case"success":return"#5fff87";case"paused":return"#8a8a99";default:return"#00d9ff"}}function H_(e,t){const n=e.replace("#","");if(n.length!==6)return e;const r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgba(${r}, ${s}, ${i}, ${t})`}function ph(e){return(e??"io").replace(/[_/]+/g," ").replace(/-/g," ").replace(/\.[^.]+$/,"").replace(/\w/g,t=>t.toUpperCase())}function gh(e){if(!e)return"just now";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=t.getTime()-Date.now(),r=n<=0,s=Math.abs(n),i=6e4,o=60*i,a=24*o;let l=0,c="m";return s<o?(l=Math.max(1,Math.round(s/i)),c="m"):s<a?(l=Math.round(s/o),c="h"):(l=Math.round(s/a),c="d"),r?`${l}${c} ago`:`in ${l}${c}`}function fw(e,t){const n=`${e} ${t??""}`.toLowerCase();return/(read|write|edit|glob|file|path|fs)/.test(n)?"File System":/(grep|search|code|analy|lint|semantic|test|debug)/.test(n)?"Code Intelligence":/(git|branch|commit|pr|issue|ci|build|release)/.test(n)?"Git & CI":"Communication"}function pw(e){const t=[];for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t,i="";for(const[o,a]of r.entries()){i=i?`${i}/${a}`:a;let l=s.find(c=>c.id===i);l||(l={id:i,label:o===r.length-1?n.title:ph(a),path:o===r.length-1?n.path:void 0,children:[]},s.push(l)),s=l.children}}return t}function gw(e,t){return e.some(n=>n.status==="error")?"error":e.some(n=>n.status==="working")?"working":e.some(n=>n.status==="success")?"success":((t==null?void 0:t.instances_active)??0)>0?"working":"idle"}const F_={key:0,class:"fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l border-border bg-sidebar md:w-[420px]"},q_={class:"flex shrink-0 items-center justify-between border-b border-border px-5 py-4"},K_={class:"flex items-center gap-2"},W_={key:0,class:"rounded-full bg-destructive px-1.5 py-0.5 font-mono text-[9px] font-bold text-white"},V_={class:"flex-1 overflow-y-auto"},G_={key:0,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},z_={key:1,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},J_={key:2},Y_={class:"sticky top-0 z-10 border-b border-border/40 bg-sidebar/95 px-5 py-2 backdrop-blur"},Z_=["onClick"],X_={class:"flex items-start gap-3"},Q_={class:"mt-1.5 shrink-0"},ev={key:0,class:"h-1.5 w-1.5 rounded-full bg-primary",style:{boxShadow:"var(--glow-cyan)"}},tv={key:1,class:"h-1.5 w-1.5"},nv={class:"min-w-0 flex-1"},rv={class:"flex items-start justify-between gap-1"},sv={class:"text-xs font-medium leading-tight text-foreground"},iv={class:"shrink-0 font-mono text-[9px] text-muted-foreground/40"},ov={key:0,class:"mt-1 max-w-xs text-[11px] leading-relaxed text-foreground/50"},av={key:0,class:"mt-2 rounded border border-white/[0.06] bg-white/[0.03] p-3"},lv=["innerHTML"],cv=fn({__name:"FeedFlyout",props:{open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,s=_e([]),i=_e({}),o=_e(null),a=_e(!1),l=qe(()=>{var d;const h=new Map;for(const f of s.value){const p=f.squad_slug??"io",m=i.value[p];h.has(p)||h.set(p,{key:p,label:(m==null?void 0:m.name)??ph(p),color:(m==null?void 0:m.color)??"#8a8a99",entries:[]}),(d=h.get(p))==null||d.entries.push(f)}return[...h.values()]});async function c(){a.value=!0;try{const[h,d]=await Promise.all([ct("/api/feed?limit=80"),ct("/api/squads")]);if(h.ok&&(s.value=(await h.json()).entries),d.ok){const f=await d.json();i.value=Object.fromEntries(f.squads.map(p=>[p.slug??p.id??p.name.toLowerCase(),{name:p.name,universe:p.universe,color:p.color??"#8a8a99"}]))}}finally{a.value=!1}}async function u(h){o.value=o.value===h.id?null:h.id,h.read_at||(await ct(`/api/feed/${h.id}/read`,{method:"POST"}).catch(()=>null),h.read_at=new Date().toISOString())}return un(()=>n.open,h=>{h?c():o.value=null}),(h,d)=>(W(),nr(bd,{to:"body"},[le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:Mt(()=>[e.open?(W(),z("div",{key:0,class:"fixed inset-0 z-40 bg-black/40",onClick:d[0]||(d[0]=f=>r("close"))})):Ue("",!0)]),_:1}),le(Sr,{"enter-active-class":"transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]","enter-from-class":"translate-x-full","enter-to-class":"translate-x-0","leave-active-class":"transition-transform duration-200 ease-in","leave-from-class":"translate-x-0","leave-to-class":"translate-x-full"},{default:Mt(()=>[e.open?(W(),z("aside",F_,[M("div",q_,[M("div",K_,[le(De,{name:"message",class:"h-4 w-4 text-primary"}),d[2]||(d[2]=M("span",{class:"text-sm font-semibold"},"Activity Feed",-1)),s.value.filter(f=>!f.read_at).length?(W(),z("span",W_,Te(s.value.filter(f=>!f.read_at).length),1)):Ue("",!0)]),M("button",{class:"flex h-7 w-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",onClick:d[1]||(d[1]=f=>r("close"))},[le(De,{name:"x",class:"h-4 w-4"})])]),M("div",V_,[a.value?(W(),z("div",G_,"Syncing feed…")):l.value.length?(W(),z("div",J_,[(W(!0),z(fe,null,zt(l.value,f=>(W(),z("section",{key:f.key,class:"border-b border-border/40 last:border-b-0"},[M("div",Y_,[M("span",{class:"rounded px-1.5 py-0.5 font-mono text-[10px]",style:zs({color:f.color,backgroundColor:ze(H_)(f.color,.15)})},Te(f.label),5)]),M("div",null,[(W(!0),z(fe,null,zt(f.entries,p=>(W(),z("article",{key:p.id,class:_t(["cursor-pointer px-5 py-3.5 transition-colors hover:bg-white/[0.02]",p.read_at?"":"bg-white/[0.015]"]),onClick:m=>u(p)},[M("div",X_,[M("div",Q_,[p.read_at?(W(),z("div",tv)):(W(),z("div",ev))]),M("div",nv,[M("div",rv,[M("h4",sv,Te(p.title),1),M("span",iv,Te(ze(gh)(p.created_at)),1)]),p.body?(W(),z("div",ov,Te(p.body.slice(0,200)),1)):Ue("",!0)])]),le(Sr,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:Mt(()=>[o.value===p.id&&p.body?(W(),z("div",av,[M("div",{class:"wiki-content text-xs",innerHTML:ze(fh)(p.body)},null,8,lv)])):Ue("",!0)]),_:2},1024)],10,Z_))),128))])]))),128))])):(W(),z("div",z_,"No feed activity."))])])):Ue("",!0)]),_:1})]))}}),uv=tu("chat",()=>{const e=_e([]),t=_e(!1);let n=null,r=null;function s(d){return e.value.length?d?e.value.find(f=>f.id===d)??null:e.value[e.value.length-1]??null:null}function i(d){const f={id:d.id??crypto.randomUUID(),createdAt:d.createdAt??new Date().toISOString(),streaming:d.streaming??!1,role:d.role,text:d.text,kind:d.kind};return e.value.push(f),f}function o(d,f){const p=s(f??r??void 0);p&&(p.text+=d)}function a(d,f){const p=s(f??r??void 0);p&&(p.streaming=d)}function l(){n==null||n.close(),n=null,r=null,t.value=!1}async function c(d,f=[]){const p=d.trim();if(!p)return;l(),i({role:"user",text:p});const m=i({role:"assistant",text:"",streaming:!0});r=m.id,t.value=!0;const E=await py("/api/events");n=new EventSource(E),n.onmessage=y=>{try{const w=JSON.parse(y.data);if(w.type==="delta"){o(String(w.text??""),m.id);return}if(w.type==="done"){a(!1,m.id),l();return}w.type==="feed"&&i({role:"system",kind:"feed",text:[w.title,w.body].filter(Boolean).join(`
81
+ `)||JSON.stringify(w,null,2)})}catch{o(y.data,m.id)}},n.onerror=()=>{m.text||(m.text="stream disconnected"),a(!1,m.id),l()};const _=await ct("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:p,attachments:f})});if(!_.ok){const y=await _.text();m.text=y||`Request failed (${_.status})`,a(!1,m.id),l()}}async function u(){await ct("/api/orchestrator/abort",{method:"POST"}).catch(()=>null),a(!1),l()}function h(){l(),e.value=[]}return{messages:e,isLoading:t,addMessage:i,appendToLast:o,setLastStreaming:a,sendMessage:c,abortRun:u,clearMessages:h}}),hv={class:"fixed bottom-14 right-0 z-50 flex w-full flex-col md:bottom-10 md:right-4 md:w-[360px]"},dv={key:0,class:"flex h-[380px] flex-col overflow-hidden rounded-t-xl border border-border border-b-0 bg-sidebar"},fv={class:"flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-2.5"},pv={class:"flex items-center gap-2"},gv={key:0,class:"whitespace-pre-wrap"},mv=["innerHTML"],bv={key:2,class:"mt-2 space-y-1"},yv=["src","alt"],_v=["href","download"],vv={key:0,class:"flex-shrink-0 border-t border-border/50 px-3 py-2"},wv={class:"flex gap-2 overflow-x-auto"},Ev=["src","alt"],Sv={key:1,class:"flex h-12 w-12 items-center justify-center rounded border border-border bg-card text-[8px] text-foreground/50"},kv={class:"text-center"},Av=["onClick"],Tv={type:"submit",class:"flex shrink-0 items-center gap-1 rounded bg-primary/15 px-2.5 py-1 font-mono text-xs text-primary transition-colors hover:bg-primary/25"},xv=5*1024*1024,Rv=fn({__name:"FloatingChat",setup(e,{expose:t}){const n=uv(),r=_e(""),s=_e(!1),i=_e(null),o=_e(null),a=_e(null),l=_e([]),c=_e([]),u=["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],h=qe(()=>n.messages.length?n.messages:[{id:"welcome",role:"assistant",text:"IO online. What do you need?",createdAt:new Date().toISOString(),streaming:!1}]),d=qe(()=>h.value.map(C=>`${C.id}:${C.text.length}:${C.streaming}`).join("|"));function f(){a.value&&(a.value.scrollTop=a.value.scrollHeight)}async function p(C){const L=C.target,N=Array.from(L.files||[]),U=[];for(const S of N){if(S.size>xv){U.push(`${S.name} exceeds 5MB limit`);continue}if(!u.includes(S.type)&&!S.name.match(/\.(pdf|doc|docx|txt|jpg|jpeg|png|gif|webp)$/i)){U.push(`${S.name} has unsupported file type`);continue}if(l.value.push(S),S.type.startsWith("image/")){const X=new FileReader;X.onload=ae=>{var H;c.value.push({file:S,preview:(H=ae.target)==null?void 0:H.result})},X.readAsDataURL(S)}else c.value.push({file:S,preview:null})}U.length>0&&console.warn("File validation errors:",U),L.value=""}function m(C){l.value.splice(C,1),c.value.splice(C,1)}async function E(){const C=[];for(const L of l.value){const N=new FileReader,U=await new Promise((S,X)=>{N.onload=ae=>{var H;return S((H=ae.target)==null?void 0:H.result)},N.onerror=X,N.readAsDataURL(L)});C.push({type:"blob",data:U,mimeType:L.type,displayName:L.name})}return C}async function _(){const C=r.value.trim(),L=l.value.length>0;if(!C&&!L)return;r.value="";const N=await E();l.value=[],c.value=[],await n.sendMessage(C,N)}function y(){var C;(C=o.value)==null||C.click()}function w(){s.value=!0}function k(){s.value=!1}return un(s,async C=>{var L;C&&(await tr(),(L=i.value)==null||L.focus(),f())}),un(d,async()=>{s.value&&(await tr(),f())}),t({open:w,isOpen:s}),(C,L)=>(W(),z("div",hv,[le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-y-2 scale-[0.97] opacity-0","enter-to-class":"translate-y-0 scale-100 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-y-0 scale-100 opacity-100","leave-to-class":"translate-y-2 scale-[0.97] opacity-0"},{default:Mt(()=>[s.value?(W(),z("div",dv,[M("div",fv,[M("div",pv,[le(De,{name:"terminal",class:"h-3.5 w-3.5 text-primary"}),L[1]||(L[1]=M("span",{class:"font-mono text-xs text-foreground/70"},"IO Command",-1))]),M("button",{class:"text-muted-foreground/40 transition-colors hover:text-muted-foreground",onClick:k},[le(De,{name:"chevron-down",class:"h-4 w-4"})])]),M("div",{ref_key:"scrollPanel",ref:a,class:"flex-1 space-y-2.5 overflow-y-auto px-4 py-3"},[(W(!0),z(fe,null,zt(h.value,N=>(W(),z("div",{key:N.id,class:_t(["flex",N.role==="user"?"justify-end":"justify-start"])},[M("div",{class:_t(["max-w-[85%] rounded-lg px-3 py-2 text-xs leading-relaxed",N.role==="user"?"rounded-br-sm border border-primary/20 bg-primary/15 font-mono text-primary":"rounded-bl-sm border border-white/[0.06] bg-white/[0.04] text-foreground/75"])},[N.role==="user"?(W(),z("div",gv,Te(N.text),1)):(W(),z("div",{key:1,class:"wiki-content text-xs",innerHTML:ze(fh)(N.text||(N.streaming?"…":""))},null,8,mv)),N.attachments&&N.attachments.length>0?(W(),z("div",bv,[(W(!0),z(fe,null,zt(N.attachments,(U,S)=>(W(),z("div",{key:`${N.id}-${S}`},[U.type==="image"?(W(),z("img",{key:0,src:U.data,alt:U.displayName,class:"max-w-full max-h-32 rounded border border-border/50"},null,8,yv)):(W(),z("a",{key:1,class:"flex items-center gap-1 text-[10px] text-primary hover:underline",href:U.data,download:U.displayName},[le(De,{name:"zap",class:"h-2.5 w-2.5"}),M("span",null,Te(U.displayName),1)],8,_v))]))),128))])):Ue("",!0)],2)],2))),128))],512),c.value.length>0?(W(),z("div",vv,[M("div",wv,[(W(!0),z(fe,null,zt(c.value,(N,U)=>{var S;return W(),z("div",{key:`preview-${U}`,class:"relative shrink-0"},[N.preview?(W(),z("img",{key:0,src:N.preview,alt:N.file.name,class:"h-12 w-12 rounded border border-border object-cover"},null,8,Ev)):(W(),z("div",Sv,[M("span",kv,Te((S=N.file.name.split(".").pop())==null?void 0:S.toUpperCase()),1)])),M("button",{class:"absolute -right-1 -top-1 rounded-full bg-destructive p-0.5 text-white transition-colors hover:bg-destructive/80",onClick:X=>m(U)},[le(De,{name:"x",class:"h-2.5 w-2.5"})],8,Av)])}),128))])])):Ue("",!0)])):Ue("",!0)]),_:1}),M("div",{class:_t(["overflow-hidden border border-border bg-sidebar",s.value?"rounded-b-xl border-t-0":"rounded-xl"])},[M("input",{ref_key:"fileInputRef",ref:o,type:"file",multiple:"",accept:"image/*,.pdf,.doc,.docx,.txt",class:"hidden",onChange:p},null,544),s.value?(W(),z("form",{key:0,class:"flex items-center gap-2 border-t border-border/50 px-3 py-2.5",onSubmit:Xf(_,["prevent"])},[M("button",{type:"button",class:"flex shrink-0 items-center rounded border border-border/50 px-2 py-1.5 text-muted-foreground/50 transition-colors hover:border-primary/50 hover:text-primary",onClick:y},[le(De,{name:"zap",class:"h-3.5 w-3.5"})]),cd(M("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":L[0]||(L[0]=N=>r.value=N),type:"text",placeholder:"Command IO...",class:"flex-1 bg-transparent font-mono text-sm text-foreground placeholder:text-muted-foreground/40"},null,512),[[Jf,r.value]]),M("button",Tv,[le(De,{name:"zap",class:"h-3 w-3"}),L[2]||(L[2]=Vc(" send ",-1))])],32)):(W(),z("button",{key:1,class:"flex w-full items-center gap-2.5 px-4 py-3 text-left transition-colors hover:bg-white/[0.03]",onClick:w},[le(De,{name:"terminal",class:"h-4 w-4 text-primary",style:{filter:"drop-shadow(0 0 6px #00d9ff88)"}}),L[3]||(L[3]=M("span",{class:"flex-1 font-mono text-sm text-muted-foreground/60"},"Command IO...",-1)),le(De,{name:"chevron-up",class:"h-4 w-4 text-muted-foreground/30"})]))],2)]))}}),Ov={class:"fixed inset-x-0 bottom-0 z-30 flex items-center justify-around border-t border-border bg-sidebar px-2 pb-[env(safe-area-inset-bottom)] pt-1 md:hidden"},Cv={key:0,class:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-destructive px-0.5 font-mono text-[8px] font-bold leading-none text-white"},Nv={class:"font-mono text-[10px]"},Iv={key:1,class:"absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full bg-primary"},Pv=fn({__name:"MobileNav",setup(e){const t=Io(),n=_e(0),r=_e(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}];function o(c){return(c.match??[c.to]).some(h=>t.path.startsWith(h))}function a(c){return c.badge==="feed"?n.value:c.badge==="inbox"?r.value:0}async function l(){try{const[c,u]=await Promise.all([ct("/api/feed/count"),ct("/api/inbox/count")]);c.ok&&(n.value=Number((await c.json()).count??0)),u.ok&&(r.value=Number((await u.json()).count??0))}catch{}}return Xr(()=>{l(),s=window.setInterval(l,15e3)}),Qr(()=>{window.clearInterval(s)}),(c,u)=>(W(),z("nav",Ov,[(W(),z(fe,null,zt(i,h=>le(ze(Tr),{key:h.to,to:h.to,class:_t(["relative flex flex-col items-center gap-0.5 rounded-lg px-3 py-1.5 transition-colors",o(h)?"text-primary":"text-muted-foreground/50"])},{default:Mt(()=>[a(h)>0?(W(),z("span",Cv,Te(a(h)),1)):Ue("",!0),le(De,{name:h.icon,class:"h-5 w-5"},null,8,["name"]),M("span",Nv,Te(h.label),1),o(h)?(W(),z("div",Iv)):Ue("",!0)]),_:2},1032,["to","class"])),64))]))}}),Lv={class:"dark flex h-full flex-col overflow-hidden bg-background text-foreground"},$v={class:"flex shrink-0 items-center justify-between border-b border-border bg-sidebar px-4 py-3 md:px-5"},Mv={class:"flex items-center gap-2"},jv={key:0,class:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-destructive font-mono text-[9px] font-bold text-white"},Dv=["disabled"],Uv={class:"text-xs font-medium"},Bv={key:0,class:"shrink-0 border-b border-destructive/50 bg-destructive/10 px-5 py-3"},Hv={class:"flex items-center justify-between gap-3"},Fv={class:"text-sm text-destructive"},qv={class:"flex min-h-0 flex-1 overflow-hidden"},Kv={class:"flex min-w-0 flex-1 flex-col overflow-hidden"},Wv={class:"min-h-0 flex-1 overflow-hidden pb-[calc(env(safe-area-inset-bottom)+3.5rem)] md:pb-0"},Vv={class:"hidden shrink-0 border-t border-border bg-sidebar px-5 py-2 md:block"},Gv={class:"flex items-center justify-between font-mono text-[11px]"},zv={class:"flex items-center gap-4"},Jv={class:"flex items-center gap-1.5"},Yv={class:"text-muted-foreground"},Zv={class:"text-accent-foreground"},Xv={class:"flex items-center gap-4"},Qv={key:0,class:"flex items-center gap-1.5 text-primary"},ew={class:"text-muted-foreground/40"},tw={key:1,class:"h-full"},nw=fn({__name:"App",setup(e){const t=Io(),n=ui(),r=_e(null),s=_e(!1),i=_e(0),o=_e(null),a=_e(""),l=_e(!1),c=_e({squads:0,agents:0,instances:0,runningInstances:0,working:0});let u=0;const h=qe(()=>t.name!=="login"&&n.isAuthenticated),d=qe(()=>gh(o.value));function f(){var _;(_=r.value)==null||_.open()}function p(_){(_.metaKey||_.ctrlKey)&&_.key==="."&&(_.preventDefault(),f())}async function m(){l.value=!0,a.value="";try{const _=await n.logout();_.success||(a.value=_.error||"Logout failed",l.value=!1)}catch(_){a.value=_ instanceof Error?_.message:"Logout failed",l.value=!1}}async function E(){try{const[_,y,w]=await Promise.all([ct("/api/feed/count"),ct("/api/squads"),ct("/api/tasks")]);if(_.ok&&(i.value=Number((await _.json()).count??0)),y.ok){const k=await y.json();c.value.squads=k.squads.length,c.value.agents=k.squads.reduce((C,L)=>C+Number(L.agents_count??0),0),c.value.instances=k.squads.reduce((C,L)=>C+Number(L.instances_total??0),0),c.value.runningInstances=k.squads.reduce((C,L)=>C+Number(L.instances_active??0),0)}if(w.ok){const k=await w.json();c.value.working=k.tasks.filter(C=>/running|working|queued|pending|in_progress/i.test(C.status)).length}o.value=new Date().toISOString()}catch{}}return Xr(()=>{n.init(),E(),u=window.setInterval(E,3e4),window.addEventListener("keydown",p)}),Qr(()=>{window.clearInterval(u),window.removeEventListener("keydown",p)}),(_,y)=>(W(),z("div",Lv,[h.value?(W(),z(fe,{key:0},[M("div",$v,[y[4]||(y[4]=M("div",{class:"flex items-center gap-3 md:gap-4"},[M("div",{class:"select-none font-mono text-xl font-bold tracking-tight text-primary text-glow-cyan"},"IO"),M("div",{class:"hidden h-4 w-px bg-border md:block"}),M("div",{class:"hidden font-mono text-xs text-muted-foreground md:block"},"Mission Control · Developer AI Assistant")],-1)),M("div",Mv,[M("button",{class:"relative flex items-center gap-2 rounded border border-border px-3 py-1.5 text-sm text-muted-foreground transition-all hover:border-primary/40 hover:bg-primary/5 hover:text-foreground",onClick:y[0]||(y[0]=w=>s.value=!0)},[le(De,{name:"message",class:"h-4 w-4"}),y[3]||(y[3]=M("span",{class:"text-xs font-medium"},"Feed",-1)),i.value>0?(W(),z("span",jv,Te(i.value),1)):Ue("",!0)]),M("button",{class:"flex items-center gap-2 rounded border border-border px-3 py-1.5 text-sm text-muted-foreground transition-all hover:border-destructive/40 hover:bg-destructive/5 hover:text-destructive disabled:opacity-50",disabled:l.value,onClick:m,title:"Sign out"},[le(De,{name:"log-out",class:"h-4 w-4"}),M("span",Uv,Te(l.value?"Signing out...":"Sign Out"),1)],8,Dv)])]),le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-y-0 opacity-0","enter-to-class":"translate-y-1 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-y-1 opacity-100","leave-to-class":"translate-y-0 opacity-0"},{default:Mt(()=>[a.value?(W(),z("div",Bv,[M("div",Hv,[M("span",Fv,Te(a.value),1),M("button",{class:"text-destructive/50 hover:text-destructive",onClick:y[1]||(y[1]=w=>a.value="")},[le(De,{name:"x",class:"h-4 w-4"})])])])):Ue("",!0)]),_:1}),M("div",qv,[le(xy),M("div",Kv,[M("div",Wv,[le(ze(Qi))])])]),M("div",Vv,[M("div",Gv,[M("div",zv,[M("div",Jv,[le(De,{name:"circle",class:"h-2 w-2 text-status-success"}),y[5]||(y[5]=M("span",{class:"text-muted-foreground"},"Daemon running",-1))]),y[6]||(y[6]=M("span",{class:"text-muted-foreground/40"},"·",-1)),M("span",Yv,Te(c.value.squads)+" squads · "+Te(c.value.agents)+" agents",1),y[7]||(y[7]=M("span",{class:"text-muted-foreground/40"},"·",-1)),M("span",Zv,Te(c.value.runningInstances)+"/"+Te(c.value.instances)+" instances active",1)]),M("div",Xv,[c.value.working>0?(W(),z("div",Qv,[le(De,{name:"activity",class:"h-3 w-3"}),M("span",null,Te(c.value.working)+" working",1)])):Ue("",!0),M("span",ew,"Last sync: "+Te(d.value),1)])])]),le(cv,{open:s.value,onClose:y[2]||(y[2]=w=>s.value=!1)},null,8,["open"]),le(Rv,{ref_key:"floatingChat",ref:r},null,512),le(Pv)],64)):(W(),z("div",tw,[le(ze(Qi))]))]))}}),rw="modulepreload",sw=function(e){return"/"+e},$l={},xt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=sw(l),l in $l)return;$l[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":rw,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},mh=pg({history:zp(),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:()=>xt(()=>import("./LoginView-DRPDhnwu.js"),[]),meta:{title:"Login",subtitle:"Authenticate against Supabase",public:!0}},{path:"/chat",name:"chat",component:()=>xt(()=>import("./ChatView-DMkYQo_V.js"),[]),meta:{title:"Chat",subtitle:"Live orchestrator stream"}},{path:"/squads",name:"squads",component:()=>xt(()=>import("./SquadsView-CaKUIKlq.js"),__vite__mapDeps([0,1])),meta:{title:"Squads",subtitle:"Project crews and worktrees"}},{path:"/activity",name:"activity",component:()=>xt(()=>import("./AgentActivityView-CedxxE6K.js"),__vite__mapDeps([2,1])),meta:{title:"Activity",subtitle:"Task execution and event stream"}},{path:"/schedules",name:"schedules",component:()=>xt(()=>import("./SchedulesView-BzzyncGF.js"),[]),meta:{title:"Schedules",subtitle:"Cron-driven automation matrix"}},{path:"/skills",name:"skills",component:()=>xt(()=>import("./SkillsView-oxpYuhx7.js"),__vite__mapDeps([3,4])),meta:{title:"Skills",subtitle:"Installed skill manifests and content"}},{path:"/wiki",name:"wiki",component:()=>xt(()=>import("./WikiView-C5jXUlfW.js"),[]),meta:{title:"Wiki",subtitle:"Workspace knowledge browser"}},{path:"/mcp",name:"mcp",component:()=>xt(()=>import("./McpView-D8yWz-lq.js"),__vite__mapDeps([5,4])),meta:{title:"MCP",subtitle:"Server registry and transport health"}},{path:"/feed",name:"feed",component:()=>xt(()=>import("./FeedView-BH4q-31V.js"),[]),meta:{title:"Feed",subtitle:"Notifications and durable activity"}},{path:"/inbox",name:"inbox",component:()=>xt(()=>import("./InboxView-BVwVP4EW.js"),[]),meta:{title:"Inbox",subtitle:"Operator-facing messages"}}]});mh.beforeEach(async e=>{const t=ui();return await t.init(),e.path==="/"?"/chat":t.authEnabled?!t.user&&e.path!=="/login"&&!e.meta.public?{path:"/login",query:{redirect:e.fullPath}}:t.user&&e.path==="/login"?"/chat":!0:e.path==="/login"?"/chat":!0});const Uo=np(nw),iw=ip();Uo.use(iw);Uo.use(mh);Uo.mount("#app");export{Mt as A,H_ as B,dw as C,nr as D,ct as E,fe as F,uw as G,hw as H,gh as I,gw as J,Qr as K,py as L,bd as M,fw as N,ow as O,lw as P,pw as Q,Tr as R,aw as S,Sr as T,ph as U,De as _,M as a,ze as b,z as c,fn as d,cw as e,Xf as f,Ue as g,gg as h,Io as i,W as j,uv as k,un as l,zt as m,le as n,Xr as o,Vc as p,qe as q,_e as r,_t as s,Te as t,ui as u,Jf as v,cd as w,fh as x,tr as y,zs as z};