heyio 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/dist/api/server.js +37 -9
  3. package/dist/copilot/agents.js +47 -3
  4. package/dist/copilot/squad-tools.js +55 -1
  5. package/dist/store/instances.js +4 -0
  6. package/package.json +1 -1
  7. package/web-dist/assets/{AuditLogView-DqxVzjd_.js → AuditLogView-eyz02XQx.js} +2 -2
  8. package/web-dist/assets/{ChatView-BBopM_A3.js → ChatView-DXpE1NMj.js} +1 -1
  9. package/web-dist/assets/{FeedView-Bo4p1stx.js → FeedView-Clis71Lg.js} +2 -2
  10. package/web-dist/assets/HistoryView-B1EJ2Q9S.js +1 -0
  11. package/web-dist/assets/LoginView-bg8Sl_Gw.js +1 -0
  12. package/web-dist/assets/McpView-CBepc2JJ.js +1 -0
  13. package/web-dist/assets/{SchedulesView-B2o3vMm-.js → SchedulesView-DDFUUMPG.js} +2 -2
  14. package/web-dist/assets/SettingsView-BFfDRToB.js +1 -0
  15. package/web-dist/assets/{SkillsView-D_NHLk7C.js → SkillsView-Dv-337Yq.js} +4 -4
  16. package/web-dist/assets/{SquadDetailView-BKXLWvwn.js → SquadDetailView-p4c6XQ5a.js} +2 -2
  17. package/web-dist/assets/SquadHealthView-IjOdIla7.js +11 -0
  18. package/web-dist/assets/SquadsView-C5wQPkBA.js +6 -0
  19. package/web-dist/assets/{UsageView-Cy5Mbprb.js → UsageView-BcHfPX-N.js} +2 -2
  20. package/web-dist/assets/{WikiView-B5TOMnOg.js → WikiView-CKBw5FOf.js} +2 -2
  21. package/web-dist/assets/api-DPUP4xY9.js +1 -0
  22. package/web-dist/assets/{arrow-left-CGMB1w_A.js → arrow-left-BMJZvMdZ.js} +1 -1
  23. package/web-dist/assets/{git-branch-C_Hu39uh.js → git-branch-BF40208L.js} +1 -1
  24. package/web-dist/assets/{index-CiZnRvN4.js → index-DSAUDIwK.js} +63 -62
  25. package/web-dist/assets/{plus-DIBAaEMT.js → plus-aHVgAXQB.js} +1 -1
  26. package/web-dist/assets/{save-Chqlu7QA.js → save-jn5LGsCv.js} +1 -1
  27. package/web-dist/assets/{search-Cl8HcIsG.js → search-DUqJxRNn.js} +1 -1
  28. package/web-dist/assets/{trash-2-CQSzbVIr.js → trash-2-B9ibnt3n.js} +1 -1
  29. package/web-dist/assets/{triangle-alert-C1OjMvP5.js → triangle-alert-Cindqw1C.js} +1 -1
  30. package/web-dist/assets/{x-DThJHYFm.js → x-BDIsved4.js} +1 -1
  31. package/web-dist/index.html +1 -1
  32. package/web-dist/assets/HistoryView-ChTuQvXr.js +0 -1
  33. package/web-dist/assets/LoginView-AnOP3Mau.js +0 -1
  34. package/web-dist/assets/McpView-DPcihjuB.js +0 -1
  35. package/web-dist/assets/SettingsView-rtMUmH43.js +0 -1
  36. package/web-dist/assets/SquadHealthView-CVJiAgVW.js +0 -11
  37. package/web-dist/assets/SquadsView-fammrB7r.js +0 -6
@@ -1,171 +1,171 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-fammrB7r.js","assets/squad-colors-B8B_Y-lz.js","assets/git-branch-C_Hu39uh.js","assets/SquadHealthView-CVJiAgVW.js","assets/triangle-alert-C1OjMvP5.js","assets/SquadDetailView-BKXLWvwn.js","assets/x-DThJHYFm.js","assets/trash-2-CQSzbVIr.js","assets/arrow-left-CGMB1w_A.js","assets/FeedView-Bo4p1stx.js","assets/SkillsView-D_NHLk7C.js","assets/plus-DIBAaEMT.js","assets/search-Cl8HcIsG.js","assets/save-Chqlu7QA.js","assets/McpView-DPcihjuB.js","assets/SchedulesView-B2o3vMm-.js","assets/HistoryView-ChTuQvXr.js","assets/WikiView-B5TOMnOg.js","assets/UsageView-Cy5Mbprb.js"])))=>i.map(i=>d[i]);
2
- var ih=Object.defineProperty;var oh=(t,e,r)=>e in t?ih(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var fe=(t,e,r)=>oh(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(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"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(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 n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const ah="modulepreload",lh=function(t){return"/"+t},Jo={},Me=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(r.map(c=>{if(c=lh(c),c in Jo)return;Jo[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":ah,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,g)=>{d.addEventListener("load",f),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-C5wQPkBA.js","assets/api-DPUP4xY9.js","assets/squad-colors-B8B_Y-lz.js","assets/git-branch-BF40208L.js","assets/SquadHealthView-IjOdIla7.js","assets/triangle-alert-Cindqw1C.js","assets/SquadDetailView-p4c6XQ5a.js","assets/x-BDIsved4.js","assets/trash-2-B9ibnt3n.js","assets/arrow-left-BMJZvMdZ.js","assets/FeedView-Clis71Lg.js","assets/SkillsView-Dv-337Yq.js","assets/plus-aHVgAXQB.js","assets/search-DUqJxRNn.js","assets/save-jn5LGsCv.js","assets/McpView-CBepc2JJ.js","assets/SchedulesView-DDFUUMPG.js","assets/HistoryView-B1EJ2Q9S.js","assets/WikiView-CKBw5FOf.js","assets/UsageView-BcHfPX-N.js","assets/AuditLogView-eyz02XQx.js","assets/SettingsView-BFfDRToB.js"])))=>i.map(i=>d[i]);
2
+ var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var fe=(t,e,r)=>nh(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(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"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(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 n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const sh="modulepreload",ih=function(t){return"/"+t},zo={},Me=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(r.map(c=>{if(c=ih(c),c in zo)return;zo[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":sh,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,g)=>{d.addEventListener("load",f),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};/**
3
3
  * @vue/shared v3.5.34
4
4
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
5
  * @license MIT
6
- **/function go(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const pe={},Wr=[],Pt=()=>{},ql=()=>!1,Ms=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Hs=t=>t.startsWith("onUpdate:"),Pe=Object.assign,mo=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},ch=Object.prototype.hasOwnProperty,ie=(t,e)=>ch.call(t,e),q=Array.isArray,Gr=t=>Jn(t)==="[object Map]",on=t=>Jn(t)==="[object Set]",Yo=t=>Jn(t)==="[object Date]",Y=t=>typeof t=="function",be=t=>typeof t=="string",ct=t=>typeof t=="symbol",ae=t=>t!==null&&typeof t=="object",Fl=t=>(ae(t)||Y(t))&&Y(t.then)&&Y(t.catch),Vl=Object.prototype.toString,Jn=t=>Vl.call(t),uh=t=>Jn(t).slice(8,-1),zl=t=>Jn(t)==="[object Object]",qs=t=>be(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,wn=go(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fs=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},hh=/-\w/g,Ke=Fs(t=>t.replace(hh,e=>e.slice(1).toUpperCase())),dh=/\B([A-Z])/g,hr=Fs(t=>t.replace(dh,"-$1").toLowerCase()),Vs=Fs(t=>t.charAt(0).toUpperCase()+t.slice(1)),hi=Fs(t=>t?`on${Vs(t)}`:""),Ot=(t,e)=>!Object.is(t,e),gs=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},Kl=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},zs=t=>{const e=parseFloat(t);return isNaN(e)?t:e},fh=t=>{const e=be(t)?Number(t):NaN;return isNaN(e)?t:e};let Zo;const Ks=()=>Zo||(Zo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function yo(t){if(q(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],s=be(n)?yh(n):yo(n);if(s)for(const i in s)e[i]=s[i]}return e}else if(be(t)||ae(t))return t}const ph=/;(?![^(]*\))/g,gh=/:([^]+)/,mh=/\/\*[^]*?\*\//g;function yh(t){const e={};return t.replace(mh,"").split(ph).forEach(r=>{if(r){const n=r.split(gh);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function at(t){let e="";if(be(t))e=t;else if(q(t))for(let r=0;r<t.length;r++){const n=at(t[r]);n&&(e+=n+" ")}else if(ae(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const vh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",bh=go(vh);function Wl(t){return!!t||t===""}function _h(t,e){if(t.length!==e.length)return!1;let r=!0;for(let n=0;r&&n<t.length;n++)r=an(t[n],e[n]);return r}function an(t,e){if(t===e)return!0;let r=Yo(t),n=Yo(e);if(r||n)return r&&n?t.getTime()===e.getTime():!1;if(r=ct(t),n=ct(e),r||n)return t===e;if(r=q(t),n=q(e),r||n)return r&&n?_h(t,e):!1;if(r=ae(t),n=ae(e),r||n){if(!r||!n)return!1;const s=Object.keys(t).length,i=Object.keys(e).length;if(s!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!an(t[o],e[o]))return!1}}return String(t)===String(e)}function vo(t,e){return t.findIndex(r=>an(r,e))}const Gl=t=>!!(t&&t.__v_isRef===!0),ms=t=>be(t)?t:t==null?"":q(t)||ae(t)&&(t.toString===Vl||!Y(t.toString))?Gl(t)?ms(t.value):JSON.stringify(t,Jl,2):String(t),Jl=(t,e)=>Gl(e)?Jl(t,e.value):Gr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[n,s],i)=>(r[di(n,i)+" =>"]=s,r),{})}:on(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>di(r))}:ct(e)?di(e):ae(e)&&!q(e)&&!zl(e)?String(e):e,di=(t,e="")=>{var r;return ct(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
6
+ **/function uo(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const pe={},Vr=[],Pt=()=>{},Ul=()=>!1,Ds=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Us=t=>t.startsWith("onUpdate:"),Pe=Object.assign,ho=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},oh=Object.prototype.hasOwnProperty,ie=(t,e)=>oh.call(t,e),q=Array.isArray,zr=t=>Wn(t)==="[object Map]",rn=t=>Wn(t)==="[object Set]",Wo=t=>Wn(t)==="[object Date]",Y=t=>typeof t=="function",be=t=>typeof t=="string",ct=t=>typeof t=="symbol",ae=t=>t!==null&&typeof t=="object",Bl=t=>(ae(t)||Y(t))&&Y(t.then)&&Y(t.catch),Ml=Object.prototype.toString,Wn=t=>Ml.call(t),ah=t=>Wn(t).slice(8,-1),Hl=t=>Wn(t)==="[object Object]",Bs=t=>be(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,vn=uo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ms=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},lh=/-\w/g,We=Ms(t=>t.replace(lh,e=>e.slice(1).toUpperCase())),ch=/\B([A-Z])/g,cr=Ms(t=>t.replace(ch,"-$1").toLowerCase()),Hs=Ms(t=>t.charAt(0).toUpperCase()+t.slice(1)),ai=Ms(t=>t?`on${Hs(t)}`:""),Ot=(t,e)=>!Object.is(t,e),fs=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},ql=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},qs=t=>{const e=parseFloat(t);return isNaN(e)?t:e},uh=t=>{const e=be(t)?Number(t):NaN;return isNaN(e)?t:e};let Ko;const Fs=()=>Ko||(Ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function fo(t){if(q(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],s=be(n)?ph(n):fo(n);if(s)for(const i in s)e[i]=s[i]}return e}else if(be(t)||ae(t))return t}const hh=/;(?![^(]*\))/g,dh=/:([^]+)/,fh=/\/\*[^]*?\*\//g;function ph(t){const e={};return t.replace(fh,"").split(hh).forEach(r=>{if(r){const n=r.split(dh);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function at(t){let e="";if(be(t))e=t;else if(q(t))for(let r=0;r<t.length;r++){const n=at(t[r]);n&&(e+=n+" ")}else if(ae(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const gh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mh=uo(gh);function Fl(t){return!!t||t===""}function yh(t,e){if(t.length!==e.length)return!1;let r=!0;for(let n=0;r&&n<t.length;n++)r=nn(t[n],e[n]);return r}function nn(t,e){if(t===e)return!0;let r=Wo(t),n=Wo(e);if(r||n)return r&&n?t.getTime()===e.getTime():!1;if(r=ct(t),n=ct(e),r||n)return t===e;if(r=q(t),n=q(e),r||n)return r&&n?yh(t,e):!1;if(r=ae(t),n=ae(e),r||n){if(!r||!n)return!1;const s=Object.keys(t).length,i=Object.keys(e).length;if(s!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!nn(t[o],e[o]))return!1}}return String(t)===String(e)}function po(t,e){return t.findIndex(r=>nn(r,e))}const Vl=t=>!!(t&&t.__v_isRef===!0),ps=t=>be(t)?t:t==null?"":q(t)||ae(t)&&(t.toString===Ml||!Y(t.toString))?Vl(t)?ps(t.value):JSON.stringify(t,zl,2):String(t),zl=(t,e)=>Vl(e)?zl(t,e.value):zr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[n,s],i)=>(r[li(n,i)+" =>"]=s,r),{})}:rn(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>li(r))}:ct(e)?li(e):ae(e)&&!q(e)&&!Hl(e)?String(e):e,li=(t,e="")=>{var r;return ct(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
7
7
  * @vue/reactivity v3.5.34
8
8
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
9
  * @license MIT
10
- **/let Oe;class Yl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Oe&&(Oe.active?(this.parent=Oe,this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=Oe;try{return Oe=this,e()}finally{Oe=r}}}on(){++this._on===1&&(this.prevScope=Oe,Oe=this)}off(){if(this._on>0&&--this._on===0){if(Oe===this)Oe=this.prevScope;else{let e=Oe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,n=this.scopes.length;r<n;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Zl(t){return new Yl(t)}function Ql(){return Oe}function wh(t,e=!1){Oe&&Oe.cleanups.push(t)}let ye;const fi=new WeakSet;class Xl{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Oe&&(Oe.active?Oe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fi.has(this)&&(fi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||tc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Qo(this),rc(this);const e=ye,r=ft;ye=this,ft=!0;try{return this.fn()}finally{nc(this),ye=e,ft=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)wo(e);this.deps=this.depsTail=void 0,Qo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ji(this)&&this.run()}get dirty(){return ji(this)}}let ec=0,kn,Sn;function tc(t,e=!1){if(t.flags|=8,e){t.next=Sn,Sn=t;return}t.next=kn,kn=t}function bo(){ec++}function _o(){if(--ec>0)return;if(Sn){let e=Sn;for(Sn=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;kn;){let e=kn;for(kn=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function rc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function nc(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),wo(n),kh(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function ji(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(sc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function sc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===jn)||(t.globalVersion=jn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!ji(t))))return;t.flags|=2;const e=t.dep,r=ye,n=ft;ye=t,ft=!0;try{rc(t);const s=t.fn(t._value);(e.version===0||Ot(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{ye=r,ft=n,nc(t),t.flags&=-3}}function wo(t,e=!1){const{dep:r,prevSub:n,nextSub:s}=t;if(n&&(n.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)wo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function kh(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let ft=!0;const ic=[];function Gt(){ic.push(ft),ft=!1}function Jt(){const t=ic.pop();ft=t===void 0?!0:t}function Qo(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ye;ye=void 0;try{e()}finally{ye=r}}}let jn=0;class Sh{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ko{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ye||!ft||ye===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ye)r=this.activeLink=new Sh(ye,this),ye.deps?(r.prevDep=ye.depsTail,ye.depsTail.nextDep=r,ye.depsTail=r):ye.deps=ye.depsTail=r,oc(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=ye.depsTail,r.nextDep=void 0,ye.depsTail.nextDep=r,ye.depsTail=r,ye.deps===r&&(ye.deps=n)}return r}trigger(e){this.version++,jn++,this.notify(e)}notify(e){bo();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{_o()}}}function oc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)oc(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const ws=new WeakMap,Tr=Symbol(""),Ni=Symbol(""),Nn=Symbol("");function Le(t,e,r){if(ft&&ye){let n=ws.get(t);n||ws.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new ko),s.map=n,s.key=r),s.track()}}function Ht(t,e,r,n,s,i){const o=ws.get(t);if(!o){jn++;return}const a=l=>{l&&l.trigger()};if(bo(),e==="clear")o.forEach(a);else{const l=q(t),c=l&&qs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===Nn||!ct(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(Nn)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Tr)),Gr(t)&&a(o.get(Ni)));break;case"delete":l||(a(o.get(Tr)),Gr(t)&&a(o.get(Ni)));break;case"set":Gr(t)&&a(o.get(Tr));break}}_o()}function Eh(t,e){const r=ws.get(t);return r&&r.get(e)}function $r(t){const e=te(t);return e===t?e:(Le(e,"iterate",Nn),nt(t)?e:e.map(pt))}function Ws(t){return Le(t=te(t),"iterate",Nn),t}function xt(t,e){return Yt(t)?Qr(zt(t)?pt(e):e):pt(e)}const Th={__proto__:null,[Symbol.iterator](){return pi(this,Symbol.iterator,t=>xt(this,t))},concat(...t){return $r(this).concat(...t.map(e=>q(e)?$r(e):e))},entries(){return pi(this,"entries",t=>(t[1]=xt(this,t[1]),t))},every(t,e){return $t(this,"every",t,e,void 0,arguments)},filter(t,e){return $t(this,"filter",t,e,r=>r.map(n=>xt(this,n)),arguments)},find(t,e){return $t(this,"find",t,e,r=>xt(this,r),arguments)},findIndex(t,e){return $t(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return $t(this,"findLast",t,e,r=>xt(this,r),arguments)},findLastIndex(t,e){return $t(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return $t(this,"forEach",t,e,void 0,arguments)},includes(...t){return gi(this,"includes",t)},indexOf(...t){return gi(this,"indexOf",t)},join(t){return $r(this).join(t)},lastIndexOf(...t){return gi(this,"lastIndexOf",t)},map(t,e){return $t(this,"map",t,e,void 0,arguments)},pop(){return un(this,"pop")},push(...t){return un(this,"push",t)},reduce(t,...e){return Xo(this,"reduce",t,e)},reduceRight(t,...e){return Xo(this,"reduceRight",t,e)},shift(){return un(this,"shift")},some(t,e){return $t(this,"some",t,e,void 0,arguments)},splice(...t){return un(this,"splice",t)},toReversed(){return $r(this).toReversed()},toSorted(t){return $r(this).toSorted(t)},toSpliced(...t){return $r(this).toSpliced(...t)},unshift(...t){return un(this,"unshift",t)},values(){return pi(this,"values",t=>xt(this,t))}};function pi(t,e,r){const n=Ws(t),s=n[e]();return n!==t&&!nt(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Ah=Array.prototype;function $t(t,e,r,n,s,i){const o=Ws(t),a=o!==t&&!nt(t),l=o[e];if(l!==Ah[e]){const h=l.apply(t,i);return a?pt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,xt(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,n);return a&&s?s(u):u}function Xo(t,e,r,n){const s=Ws(t),i=s!==t&&!nt(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=xt(t,c)),r.call(this,c,xt(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=s[e](o,...n);return a?xt(t,l):l}function gi(t,e,r){const n=te(t);Le(n,"iterate",Nn);const s=n[e](...r);return(s===-1||s===!1)&&Gs(r[0])?(r[0]=te(r[0]),n[e](...r)):s}function un(t,e,r=[]){Gt(),bo();const n=te(t)[e].apply(t,r);return _o(),Jt(),n}const xh=go("__proto__,__v_isRef,__isVue"),ac=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ct));function Rh(t){ct(t)||(t=String(t));const e=te(this);return Le(e,"has",t),e.hasOwnProperty(t)}class lc{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!s;if(r==="__v_isReadonly")return s;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(s?i?Uh:dc:i?hc:uc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=q(e);if(!s){let l;if(o&&(l=Th[r]))return l;if(r==="hasOwnProperty")return Rh}const a=Reflect.get(e,r,Se(e)?e:n);if((ct(r)?ac.has(r):xh(r))||(s||Le(e,"get",r),i))return a;if(Se(a)){const l=o&&qs(r)?a:a.value;return s&&ae(l)?Di(l):l}return ae(a)?s?Di(a):Yn(a):a}}class cc extends lc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=q(e)&&qs(r);if(!this._isShallow){const c=Yt(i);if(!nt(n)&&!Yt(n)&&(i=te(i),n=te(n)),!o&&Se(i)&&!Se(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:ie(e,r),l=Reflect.set(e,r,n,Se(e)?e:s);return e===te(s)&&(a?Ot(n,i)&&Ht(e,"set",r,n):Ht(e,"add",r,n)),l}deleteProperty(e,r){const n=ie(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&Ht(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!ct(r)||!ac.has(r))&&Le(e,"has",r),n}ownKeys(e){return Le(e,"iterate",q(e)?"length":Tr),Reflect.ownKeys(e)}}class Ch extends lc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Oh=new cc,Ph=new Ch,Ih=new cc(!0);const Li=t=>t,ts=t=>Reflect.getPrototypeOf(t);function $h(t,e,r){return function(...n){const s=this.__v_raw,i=te(s),o=Gr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Li:e?Qr:pt;return!e&&Le(i,"iterate",l?Ni:Tr),Pe(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(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function jh(t,e){const r={get(s){const i=this.__v_raw,o=te(i),a=te(s);t||(Ot(s,a)&&Le(o,"get",s),Le(o,"get",a));const{has:l}=ts(o),c=e?Li:t?Qr:pt;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!t&&Le(te(s),"iterate",Tr),s.size},has(s){const i=this.__v_raw,o=te(i),a=te(s);return t||(Ot(s,a)&&Le(o,"has",s),Le(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=te(a),c=e?Li:t?Qr:pt;return!t&&Le(l,"iterate",Tr),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Pe(r,t?{add:rs("add"),set:rs("set"),delete:rs("delete"),clear:rs("clear")}:{add(s){const i=te(this),o=ts(i),a=te(s),l=!e&&!nt(s)&&!Yt(s)?a:s;return o.has.call(i,l)||Ot(s,l)&&o.has.call(i,s)||Ot(a,l)&&o.has.call(i,a)||(i.add(l),Ht(i,"add",l,l)),this},set(s,i){!e&&!nt(i)&&!Yt(i)&&(i=te(i));const o=te(this),{has:a,get:l}=ts(o);let c=a.call(o,s);c||(s=te(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Ot(i,u)&&Ht(o,"set",s,i):Ht(o,"add",s,i),this},delete(s){const i=te(this),{has:o,get:a}=ts(i);let l=o.call(i,s);l||(s=te(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Ht(i,"delete",s,void 0),c},clear(){const s=te(this),i=s.size!==0,o=s.clear();return i&&Ht(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=$h(s,t,e)}),r}function So(t,e){const r=jh(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(ie(r,s)&&s in n?r:n,s,i)}const Nh={get:So(!1,!1)},Lh={get:So(!1,!0)},Dh={get:So(!0,!1)};const uc=new WeakMap,hc=new WeakMap,dc=new WeakMap,Uh=new WeakMap;function Bh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Mh(t){return t.__v_skip||!Object.isExtensible(t)?0:Bh(uh(t))}function Yn(t){return Yt(t)?t:Eo(t,!1,Oh,Nh,uc)}function fc(t){return Eo(t,!1,Ih,Lh,hc)}function Di(t){return Eo(t,!0,Ph,Dh,dc)}function Eo(t,e,r,n,s){if(!ae(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Mh(t);if(i===0)return t;const o=s.get(t);if(o)return o;const a=new Proxy(t,i===2?n:r);return s.set(t,a),a}function zt(t){return Yt(t)?zt(t.__v_raw):!!(t&&t.__v_isReactive)}function Yt(t){return!!(t&&t.__v_isReadonly)}function nt(t){return!!(t&&t.__v_isShallow)}function Gs(t){return t?!!t.__v_raw:!1}function te(t){const e=t&&t.__v_raw;return e?te(e):t}function To(t){return!ie(t,"__v_skip")&&Object.isExtensible(t)&&Kl(t,"__v_skip",!0),t}const pt=t=>ae(t)?Yn(t):t,Qr=t=>ae(t)?Di(t):t;function Se(t){return t?t.__v_isRef===!0:!1}function et(t){return pc(t,!1)}function Hh(t){return pc(t,!0)}function pc(t,e){return Se(t)?t:new qh(t,e)}class qh{constructor(e,r){this.dep=new ko,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:te(e),this._value=r?e:pt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||nt(e)||Yt(e);e=n?e:te(e),Ot(e,r)&&(this._rawValue=e,this._value=n?e:pt(e),this.dep.trigger())}}function _e(t){return Se(t)?t.value:t}const Fh={get:(t,e,r)=>e==="__v_raw"?t:_e(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return Se(s)&&!Se(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function gc(t){return zt(t)?t:new Proxy(t,Fh)}function Vh(t){const e=q(t)?new Array(t.length):{};for(const r in t)e[r]=Kh(t,r);return e}class zh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ct(r)?r:String(r),this._raw=te(e);let s=!0,i=e;if(!q(e)||ct(this._key)||!qs(this._key))do s=!Gs(i)||nt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=_e(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Se(this._raw[this._key])){const r=this._object[this._key];if(Se(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return Eh(this._raw,this._key)}}function Kh(t,e,r){return new zh(t,e,r)}class Wh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new ko(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=jn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return tc(this,!0),!0}get value(){const e=this.dep.track();return sc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Gh(t,e,r=!1){let n,s;return Y(t)?n=t:(n=t.get,s=t.set),new Wh(n,s,r)}const ns={},ks=new WeakMap;let _r;function Jh(t,e=!1,r=_r){if(r){let n=ks.get(r);n||ks.set(r,n=[]),n.push(t)}}function Yh(t,e,r=pe){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=x=>s?x:nt(x)||s===!1||s===0?qt(x,1):qt(x);let u,h,d,f,g=!1,y=!1;if(Se(t)?(h=()=>t.value,g=nt(t)):zt(t)?(h=()=>c(t),g=!0):q(t)?(y=!0,g=t.some(x=>zt(x)||nt(x)),h=()=>t.map(x=>{if(Se(x))return x.value;if(zt(x))return c(x);if(Y(x))return l?l(x,2):x()})):Y(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Gt();try{d()}finally{Jt()}}const x=_r;_r=u;try{return l?l(t,3,[f]):t(f)}finally{_r=x}}:h=Pt,e&&s){const x=h,B=s===!0?1/0:s;h=()=>qt(x(),B)}const S=Ql(),w=()=>{u.stop(),S&&S.active&&mo(S.effects,u)};if(i&&e){const x=e;e=(...B)=>{x(...B),w()}}let b=y?new Array(t.length).fill(ns):ns;const _=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const B=u.run();if(s||g||(y?B.some((H,M)=>Ot(H,b[M])):Ot(B,b))){d&&d();const H=_r;_r=u;try{const M=[B,b===ns?void 0:y&&b[0]===ns?[]:b,f];b=B,l?l(e,3,M):e(...M)}finally{_r=H}}}else u.run()};return a&&a(_),u=new Xl(h),u.scheduler=o?()=>o(_,!1):_,f=x=>Jh(x,!1,u),d=u.onStop=()=>{const x=ks.get(u);if(x){if(l)l(x,4);else for(const B of x)B();ks.delete(u)}},e?n?_(!0):b=u.run():o?o(_.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function qt(t,e=1/0,r){if(e<=0||!ae(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,Se(t))qt(t.value,e,r);else if(q(t))for(let n=0;n<t.length;n++)qt(t[n],e,r);else if(on(t)||Gr(t))t.forEach(n=>{qt(n,e,r)});else if(zl(t)){for(const n in t)qt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&qt(t[n],e,r)}return t}/**
10
+ **/let Oe;class Wl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Oe&&(Oe.active?(this.parent=Oe,this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=Oe;try{return Oe=this,e()}finally{Oe=r}}}on(){++this._on===1&&(this.prevScope=Oe,Oe=this)}off(){if(this._on>0&&--this._on===0){if(Oe===this)Oe=this.prevScope;else{let e=Oe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,n=this.scopes.length;r<n;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Kl(t){return new Wl(t)}function Gl(){return Oe}function vh(t,e=!1){Oe&&Oe.cleanups.push(t)}let ye;const ci=new WeakSet;class Jl{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Oe&&(Oe.active?Oe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ci.has(this)&&(ci.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ql(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Go(this),Zl(this);const e=ye,r=ft;ye=this,ft=!0;try{return this.fn()}finally{Xl(this),ye=e,ft=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)yo(e);this.deps=this.depsTail=void 0,Go(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ci.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Oi(this)&&this.run()}get dirty(){return Oi(this)}}let Yl=0,bn,_n;function Ql(t,e=!1){if(t.flags|=8,e){t.next=_n,_n=t;return}t.next=bn,bn=t}function go(){Yl++}function mo(){if(--Yl>0)return;if(_n){let e=_n;for(_n=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;bn;){let e=bn;for(bn=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function Zl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Xl(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),yo(n),bh(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function Oi(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(ec(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function ec(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Pn)||(t.globalVersion=Pn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Oi(t))))return;t.flags|=2;const e=t.dep,r=ye,n=ft;ye=t,ft=!0;try{Zl(t);const s=t.fn(t._value);(e.version===0||Ot(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{ye=r,ft=n,Xl(t),t.flags&=-3}}function yo(t,e=!1){const{dep:r,prevSub:n,nextSub:s}=t;if(n&&(n.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)yo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function bh(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let ft=!0;const tc=[];function Gt(){tc.push(ft),ft=!1}function Jt(){const t=tc.pop();ft=t===void 0?!0:t}function Go(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ye;ye=void 0;try{e()}finally{ye=r}}}let Pn=0;class _h{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class vo{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ye||!ft||ye===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ye)r=this.activeLink=new _h(ye,this),ye.deps?(r.prevDep=ye.depsTail,ye.depsTail.nextDep=r,ye.depsTail=r):ye.deps=ye.depsTail=r,rc(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=ye.depsTail,r.nextDep=void 0,ye.depsTail.nextDep=r,ye.depsTail=r,ye.deps===r&&(ye.deps=n)}return r}trigger(e){this.version++,Pn++,this.notify(e)}notify(e){go();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{mo()}}}function rc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)rc(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const bs=new WeakMap,Sr=Symbol(""),Pi=Symbol(""),In=Symbol("");function Le(t,e,r){if(ft&&ye){let n=bs.get(t);n||bs.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new vo),s.map=n,s.key=r),s.track()}}function Ht(t,e,r,n,s,i){const o=bs.get(t);if(!o){Pn++;return}const a=l=>{l&&l.trigger()};if(go(),e==="clear")o.forEach(a);else{const l=q(t),c=l&&Bs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===In||!ct(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(In)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"delete":l||(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"set":zr(t)&&a(o.get(Sr));break}}mo()}function wh(t,e){const r=bs.get(t);return r&&r.get(e)}function Or(t){const e=te(t);return e===t?e:(Le(e,"iterate",In),nt(t)?e:e.map(pt))}function Vs(t){return Le(t=te(t),"iterate",In),t}function xt(t,e){return Yt(t)?Jr(zt(t)?pt(e):e):pt(e)}const kh={__proto__:null,[Symbol.iterator](){return ui(this,Symbol.iterator,t=>xt(this,t))},concat(...t){return Or(this).concat(...t.map(e=>q(e)?Or(e):e))},entries(){return ui(this,"entries",t=>(t[1]=xt(this,t[1]),t))},every(t,e){return jt(this,"every",t,e,void 0,arguments)},filter(t,e){return jt(this,"filter",t,e,r=>r.map(n=>xt(this,n)),arguments)},find(t,e){return jt(this,"find",t,e,r=>xt(this,r),arguments)},findIndex(t,e){return jt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return jt(this,"findLast",t,e,r=>xt(this,r),arguments)},findLastIndex(t,e){return jt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return jt(this,"forEach",t,e,void 0,arguments)},includes(...t){return hi(this,"includes",t)},indexOf(...t){return hi(this,"indexOf",t)},join(t){return Or(this).join(t)},lastIndexOf(...t){return hi(this,"lastIndexOf",t)},map(t,e){return jt(this,"map",t,e,void 0,arguments)},pop(){return an(this,"pop")},push(...t){return an(this,"push",t)},reduce(t,...e){return Jo(this,"reduce",t,e)},reduceRight(t,...e){return Jo(this,"reduceRight",t,e)},shift(){return an(this,"shift")},some(t,e){return jt(this,"some",t,e,void 0,arguments)},splice(...t){return an(this,"splice",t)},toReversed(){return Or(this).toReversed()},toSorted(t){return Or(this).toSorted(t)},toSpliced(...t){return Or(this).toSpliced(...t)},unshift(...t){return an(this,"unshift",t)},values(){return ui(this,"values",t=>xt(this,t))}};function ui(t,e,r){const n=Vs(t),s=n[e]();return n!==t&&!nt(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Sh=Array.prototype;function jt(t,e,r,n,s,i){const o=Vs(t),a=o!==t&&!nt(t),l=o[e];if(l!==Sh[e]){const h=l.apply(t,i);return a?pt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,xt(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,n);return a&&s?s(u):u}function Jo(t,e,r,n){const s=Vs(t),i=s!==t&&!nt(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=xt(t,c)),r.call(this,c,xt(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=s[e](o,...n);return a?xt(t,l):l}function hi(t,e,r){const n=te(t);Le(n,"iterate",In);const s=n[e](...r);return(s===-1||s===!1)&&zs(r[0])?(r[0]=te(r[0]),n[e](...r)):s}function an(t,e,r=[]){Gt(),go();const n=te(t)[e].apply(t,r);return mo(),Jt(),n}const Eh=uo("__proto__,__v_isRef,__isVue"),nc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ct));function Th(t){ct(t)||(t=String(t));const e=te(this);return Le(e,"has",t),e.hasOwnProperty(t)}class sc{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!s;if(r==="__v_isReadonly")return s;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(s?i?Nh:lc:i?ac:oc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=q(e);if(!s){let l;if(o&&(l=kh[r]))return l;if(r==="hasOwnProperty")return Th}const a=Reflect.get(e,r,Se(e)?e:n);if((ct(r)?nc.has(r):Eh(r))||(s||Le(e,"get",r),i))return a;if(Se(a)){const l=o&&Bs(r)?a:a.value;return s&&ae(l)?ji(l):l}return ae(a)?s?ji(a):Kn(a):a}}class ic extends sc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=q(e)&&Bs(r);if(!this._isShallow){const c=Yt(i);if(!nt(n)&&!Yt(n)&&(i=te(i),n=te(n)),!o&&Se(i)&&!Se(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:ie(e,r),l=Reflect.set(e,r,n,Se(e)?e:s);return e===te(s)&&(a?Ot(n,i)&&Ht(e,"set",r,n):Ht(e,"add",r,n)),l}deleteProperty(e,r){const n=ie(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&Ht(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!ct(r)||!nc.has(r))&&Le(e,"has",r),n}ownKeys(e){return Le(e,"iterate",q(e)?"length":Sr),Reflect.ownKeys(e)}}class Ah extends sc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const xh=new ic,Rh=new Ah,Ch=new ic(!0);const Ii=t=>t,Xn=t=>Reflect.getPrototypeOf(t);function Oh(t,e,r){return function(...n){const s=this.__v_raw,i=te(s),o=zr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Ii:e?Jr:pt;return!e&&Le(i,"iterate",l?Pi:Sr),Pe(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 es(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ph(t,e){const r={get(s){const i=this.__v_raw,o=te(i),a=te(s);t||(Ot(s,a)&&Le(o,"get",s),Le(o,"get",a));const{has:l}=Xn(o),c=e?Ii:t?Jr:pt;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!t&&Le(te(s),"iterate",Sr),s.size},has(s){const i=this.__v_raw,o=te(i),a=te(s);return t||(Ot(s,a)&&Le(o,"has",s),Le(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=te(a),c=e?Ii:t?Jr:pt;return!t&&Le(l,"iterate",Sr),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Pe(r,t?{add:es("add"),set:es("set"),delete:es("delete"),clear:es("clear")}:{add(s){const i=te(this),o=Xn(i),a=te(s),l=!e&&!nt(s)&&!Yt(s)?a:s;return o.has.call(i,l)||Ot(s,l)&&o.has.call(i,s)||Ot(a,l)&&o.has.call(i,a)||(i.add(l),Ht(i,"add",l,l)),this},set(s,i){!e&&!nt(i)&&!Yt(i)&&(i=te(i));const o=te(this),{has:a,get:l}=Xn(o);let c=a.call(o,s);c||(s=te(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Ot(i,u)&&Ht(o,"set",s,i):Ht(o,"add",s,i),this},delete(s){const i=te(this),{has:o,get:a}=Xn(i);let l=o.call(i,s);l||(s=te(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Ht(i,"delete",s,void 0),c},clear(){const s=te(this),i=s.size!==0,o=s.clear();return i&&Ht(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=Oh(s,t,e)}),r}function bo(t,e){const r=Ph(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(ie(r,s)&&s in n?r:n,s,i)}const Ih={get:bo(!1,!1)},jh={get:bo(!1,!0)},$h={get:bo(!0,!1)};const oc=new WeakMap,ac=new WeakMap,lc=new WeakMap,Nh=new WeakMap;function Lh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Dh(t){return t.__v_skip||!Object.isExtensible(t)?0:Lh(ah(t))}function Kn(t){return Yt(t)?t:_o(t,!1,xh,Ih,oc)}function cc(t){return _o(t,!1,Ch,jh,ac)}function ji(t){return _o(t,!0,Rh,$h,lc)}function _o(t,e,r,n,s){if(!ae(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Dh(t);if(i===0)return t;const o=s.get(t);if(o)return o;const a=new Proxy(t,i===2?n:r);return s.set(t,a),a}function zt(t){return Yt(t)?zt(t.__v_raw):!!(t&&t.__v_isReactive)}function Yt(t){return!!(t&&t.__v_isReadonly)}function nt(t){return!!(t&&t.__v_isShallow)}function zs(t){return t?!!t.__v_raw:!1}function te(t){const e=t&&t.__v_raw;return e?te(e):t}function wo(t){return!ie(t,"__v_skip")&&Object.isExtensible(t)&&ql(t,"__v_skip",!0),t}const pt=t=>ae(t)?Kn(t):t,Jr=t=>ae(t)?ji(t):t;function Se(t){return t?t.__v_isRef===!0:!1}function et(t){return uc(t,!1)}function Uh(t){return uc(t,!0)}function uc(t,e){return Se(t)?t:new Bh(t,e)}class Bh{constructor(e,r){this.dep=new vo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:te(e),this._value=r?e:pt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||nt(e)||Yt(e);e=n?e:te(e),Ot(e,r)&&(this._rawValue=e,this._value=n?e:pt(e),this.dep.trigger())}}function _e(t){return Se(t)?t.value:t}const Mh={get:(t,e,r)=>e==="__v_raw"?t:_e(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return Se(s)&&!Se(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function hc(t){return zt(t)?t:new Proxy(t,Mh)}function Hh(t){const e=q(t)?new Array(t.length):{};for(const r in t)e[r]=Fh(t,r);return e}class qh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ct(r)?r:String(r),this._raw=te(e);let s=!0,i=e;if(!q(e)||ct(this._key)||!Bs(this._key))do s=!zs(i)||nt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=_e(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Se(this._raw[this._key])){const r=this._object[this._key];if(Se(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return wh(this._raw,this._key)}}function Fh(t,e,r){return new qh(t,e,r)}class Vh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new vo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Pn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return Ql(this,!0),!0}get value(){const e=this.dep.track();return ec(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function zh(t,e,r=!1){let n,s;return Y(t)?n=t:(n=t.get,s=t.set),new Vh(n,s,r)}const ts={},_s=new WeakMap;let vr;function Wh(t,e=!1,r=vr){if(r){let n=_s.get(r);n||_s.set(r,n=[]),n.push(t)}}function Kh(t,e,r=pe){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=x=>s?x:nt(x)||s===!1||s===0?qt(x,1):qt(x);let u,h,d,f,g=!1,y=!1;if(Se(t)?(h=()=>t.value,g=nt(t)):zt(t)?(h=()=>c(t),g=!0):q(t)?(y=!0,g=t.some(x=>zt(x)||nt(x)),h=()=>t.map(x=>{if(Se(x))return x.value;if(zt(x))return c(x);if(Y(x))return l?l(x,2):x()})):Y(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Gt();try{d()}finally{Jt()}}const x=vr;vr=u;try{return l?l(t,3,[f]):t(f)}finally{vr=x}}:h=Pt,e&&s){const x=h,D=s===!0?1/0:s;h=()=>qt(x(),D)}const k=Gl(),w=()=>{u.stop(),k&&k.active&&ho(k.effects,u)};if(i&&e){const x=e;e=(...D)=>{x(...D),w()}}let _=y?new Array(t.length).fill(ts):ts;const b=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const D=u.run();if(s||g||(y?D.some((H,U)=>Ot(H,_[U])):Ot(D,_))){d&&d();const H=vr;vr=u;try{const U=[D,_===ts?void 0:y&&_[0]===ts?[]:_,f];_=D,l?l(e,3,U):e(...U)}finally{vr=H}}}else u.run()};return a&&a(b),u=new Jl(h),u.scheduler=o?()=>o(b,!1):b,f=x=>Wh(x,!1,u),d=u.onStop=()=>{const x=_s.get(u);if(x){if(l)l(x,4);else for(const D of x)D();_s.delete(u)}},e?n?b(!0):_=u.run():o?o(b.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function qt(t,e=1/0,r){if(e<=0||!ae(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,Se(t))qt(t.value,e,r);else if(q(t))for(let n=0;n<t.length;n++)qt(t[n],e,r);else if(rn(t)||zr(t))t.forEach(n=>{qt(n,e,r)});else if(Hl(t)){for(const n in t)qt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&qt(t[n],e,r)}return t}/**
11
11
  * @vue/runtime-core v3.5.34
12
12
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
13
  * @license MIT
14
- **/function Zn(t,e,r,n){try{return n?t(...n):t()}catch(s){Js(s,e,r)}}function gt(t,e,r,n){if(Y(t)){const s=Zn(t,e,r,n);return s&&Fl(s)&&s.catch(i=>{Js(i,e,r)}),s}if(q(t)){const s=[];for(let i=0;i<t.length;i++)s.push(gt(t[i],e,r,n));return s}}function Js(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||pe;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Gt(),Zn(i,null,10,[t,l,c]),Jt();return}}Zh(t,r,s,n,o)}function Zh(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Fe=[];let Et=-1;const Jr=[];let sr=null,Mr=0;const mc=Promise.resolve();let Ss=null;function Xr(t){const e=Ss||mc;return t?e.then(this?t.bind(this):t):e}function Qh(t){let e=Et+1,r=Fe.length;for(;e<r;){const n=e+r>>>1,s=Fe[n],i=Ln(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function Ao(t){if(!(t.flags&1)){const e=Ln(t),r=Fe[Fe.length-1];!r||!(t.flags&2)&&e>=Ln(r)?Fe.push(t):Fe.splice(Qh(e),0,t),t.flags|=1,yc()}}function yc(){Ss||(Ss=mc.then(bc))}function Xh(t){q(t)?Jr.push(...t):sr&&t.id===-1?sr.splice(Mr+1,0,t):t.flags&1||(Jr.push(t),t.flags|=1),yc()}function ea(t,e,r=Et+1){for(;r<Fe.length;r++){const n=Fe[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Fe.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function vc(t){if(Jr.length){const e=[...new Set(Jr)].sort((r,n)=>Ln(r)-Ln(n));if(Jr.length=0,sr){sr.push(...e);return}for(sr=e,Mr=0;Mr<sr.length;Mr++){const r=sr[Mr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}sr=null,Mr=0}}const Ln=t=>t.id==null?t.flags&2?-1:1/0:t.id;function bc(t){try{for(Et=0;Et<Fe.length;Et++){const e=Fe[Et];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Zn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Et<Fe.length;Et++){const e=Fe[Et];e&&(e.flags&=-2)}Et=-1,Fe.length=0,vc(),Ss=null,(Fe.length||Jr.length)&&bc()}}let tt=null,_c=null;function Es(t){const e=tt;return tt=t,_c=t&&t.type.__scopeId||null,e}function Yr(t,e=tt,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&xs(-1);const i=Es(e);let o;try{o=t(...s)}finally{Es(i),n._d&&xs(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function ed(t,e){if(tt===null)return t;const r=ei(tt),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=pe]=e[s];i&&(Y(i)&&(i={mounted:i,updated:i}),i.deep&&qt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function pr(t,e,r,n){const s=t.dirs,i=e&&e.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[n];l&&(Gt(),gt(l,r,8,[t.el,a,t,e]),Jt())}}function ys(t,e){if(De){let r=De.provides;const n=De.parent&&De.parent.provides;n===r&&(r=De.provides=Object.create(n)),r[t]=e}}function lt(t,e,r=!1){const n=Po();if(n||xr){let s=xr?xr._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return r&&Y(e)?e.call(n&&n.proxy):e}}function td(){return!!(Po()||xr)}const rd=Symbol.for("v-scx"),nd=()=>lt(rd);function Ar(t,e,r){return wc(t,e,r)}function wc(t,e,r=pe){const{immediate:n,deep:s,flush:i,once:o}=r,a=Pe({},r),l=e&&n||!e&&i!=="post";let c;if(Bn){if(i==="sync"){const f=nd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Pt,f.resume=Pt,f.pause=Pt,f}}const u=De;a.call=(f,g,y)=>gt(f,u,g,y);let h=!1;i==="post"?a.scheduler=f=>{Je(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,g)=>{g?f():Ao(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Yh(t,e,a);return Bn&&(c?c.push(d):l&&d()),d}function sd(t,e,r){const n=this.proxy,s=be(t)?t.includes(".")?kc(n,t):()=>n[t]:t.bind(n,n);let i;Y(e)?i=e:(i=e.handler,r=e);const o=Qn(this),a=wc(s,i.bind(n),r);return o(),a}function kc(t,e){const r=e.split(".");return()=>{let n=t;for(let s=0;s<r.length&&n;s++)n=n[r[s]];return n}}const id=Symbol("_vte"),Sc=t=>t.__isTeleport,Tt=Symbol("_leaveCb"),hn=Symbol("_enterCb");function od(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Pc(()=>{t.isMounted=!0}),Ic(()=>{t.isUnmounting=!0}),t}const it=[Function,Array],Ec={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:it,onEnter:it,onAfterEnter:it,onEnterCancelled:it,onBeforeLeave:it,onLeave:it,onAfterLeave:it,onLeaveCancelled:it,onBeforeAppear:it,onAppear:it,onAfterAppear:it,onAppearCancelled:it},Tc=t=>{const e=t.subTree;return e.component?Tc(e.component):e},ad={name:"BaseTransition",props:Ec,setup(t,{slots:e}){const r=Po(),n=od();return()=>{const s=e.default&&Rc(e.default(),!0),i=s&&s.length?Ac(s):r.subTree?Ze():void 0;if(!i)return;const o=te(t),{mode:a}=o;if(n.isLeaving)return mi(i);const l=ta(i);if(!l)return mi(i);let c=Ui(l,o,n,r,h=>c=h);l.type!==Ve&&Dn(l,c);let u=r.subTree&&ta(r.subTree);if(u&&u.type!==Ve&&!kr(u,l)&&Tc(r).type!==Ve){let h=Ui(u,o,n,r);if(Dn(u,h),a==="out-in"&&l.type!==Ve)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},mi(i);a==="in-out"&&l.type!==Ve?h.delayLeave=(d,f,g)=>{const y=xc(n,u);y[String(u.key)]=u,d[Tt]=()=>{f(),d[Tt]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{g(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Ac(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ve){e=r;break}}return e}const ld=ad;function xc(t,e){const{leavingVNodes:r}=t;let n=r.get(e.type);return n||(n=Object.create(null),r.set(e.type,n)),n}function Ui(t,e,r,n,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:g,onLeaveCancelled:y,onBeforeAppear:S,onAppear:w,onAfterAppear:b,onAppearCancelled:_}=e,x=String(t.key),B=xc(r,t),H=(C,J)=>{C&&gt(C,n,9,J)},M=(C,J)=>{const ee=J[1];H(C,J),q(C)?C.every(N=>N.length<=1)&&ee():C.length<=1&&ee()},G={mode:o,persisted:a,beforeEnter(C){let J=l;if(!r.isMounted)if(i)J=S||l;else return;C[Tt]&&C[Tt](!0);const ee=B[x];ee&&kr(t,ee)&&ee.el[Tt]&&ee.el[Tt](),H(J,[C])},enter(C){if(B[x]===t)return;let J=c,ee=u,N=h;if(!r.isMounted)if(i)J=w||c,ee=b||u,N=_||h;else return;let Q=!1;C[hn]=Be=>{Q||(Q=!0,Be?H(N,[C]):H(ee,[C]),G.delayedLeave&&G.delayedLeave(),C[hn]=void 0)};const Ae=C[hn].bind(null,!1);J?M(J,[C,Ae]):Ae()},leave(C,J){const ee=String(t.key);if(C[hn]&&C[hn](!0),r.isUnmounting)return J();H(d,[C]);let N=!1;C[Tt]=Ae=>{N||(N=!0,J(),Ae?H(y,[C]):H(g,[C]),C[Tt]=void 0,B[ee]===t&&delete B[ee])};const Q=C[Tt].bind(null,!1);B[ee]=t,f?M(f,[C,Q]):Q()},clone(C){const J=Ui(C,e,r,n,s);return s&&s(J),J}};return G}function mi(t){if(Ys(t))return t=cr(t),t.children=null,t}function ta(t){if(!Ys(t))return Sc(t.type)&&t.children?Ac(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&Y(r.default))return r.default()}}function Dn(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Dn(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Rc(t,e=!1,r){let n=[],s=0;for(let i=0;i<t.length;i++){let o=t[i];const a=r==null?o.key:String(r)+String(o.key!=null?o.key:i);o.type===Ye?(o.patchFlag&128&&s++,n=n.concat(Rc(o.children,e,a))):(e||o.type!==Ve)&&n.push(a!=null?cr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function dr(t,e){return Y(t)?Pe({name:t.name},e,{setup:t}):t}function Cc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function ra(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ts=new WeakMap;function En(t,e,r,n,s=!1){if(q(t)){t.forEach((y,S)=>En(y,e&&(q(e)?e[S]:e),r,n,s));return}if(Tn(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&En(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?ei(n.component):n.el,o=s?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===pe?a.refs={}:a.refs,h=a.setupState,d=te(h),f=h===pe?ql:y=>ra(u,y)?!1:ie(d,y),g=(y,S)=>!(S&&ra(u,S));if(c!=null&&c!==l){if(na(e),be(c))u[c]=null,f(c)&&(h[c]=null);else if(Se(c)){const y=e;g(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(Y(l))Zn(l,a,12,[o,u]);else{const y=be(l),S=Se(l);if(y||S){const w=()=>{if(t.f){const b=y?f(l)?h[l]:u[l]:g()||!t.k?l.value:u[t.k];if(s)q(b)&&mo(b,i);else if(q(b))b.includes(i)||b.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const _=[i];g(l,t.k)&&(l.value=_),t.k&&(u[t.k]=_)}}else y?(u[l]=o,f(l)&&(h[l]=o)):S&&(g(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const b=()=>{w(),Ts.delete(t)};b.id=-1,Ts.set(t,b),Je(b,r)}else na(t),w()}}}function na(t){const e=Ts.get(t);e&&(e.flags|=8,Ts.delete(t))}Ks().requestIdleCallback;Ks().cancelIdleCallback;const Tn=t=>!!t.type.__asyncLoader,Ys=t=>t.type.__isKeepAlive;function cd(t,e){Oc(t,"a",e)}function ud(t,e){Oc(t,"da",e)}function Oc(t,e,r=De){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Zs(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Ys(s.parent.vnode)&&hd(n,e,r,s),s=s.parent}}function hd(t,e,r,n){const s=Zs(e,t,n,!0);$c(()=>{mo(n[e],s)},r)}function Zs(t,e,r=De,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Gt();const a=Qn(r),l=gt(e,r,t,o);return a(),Jt(),l});return n?s.unshift(i):s.push(i),i}}const Qt=t=>(e,r=De)=>{(!Bn||t==="sp")&&Zs(t,(...n)=>e(...n),r)},dd=Qt("bm"),Pc=Qt("m"),fd=Qt("bu"),pd=Qt("u"),Ic=Qt("bum"),$c=Qt("um"),gd=Qt("sp"),md=Qt("rtg"),yd=Qt("rtc");function vd(t,e=De){Zs("ec",t,e)}const jc="components";function xo(t,e){return Lc(jc,t,!0,e)||t}const Nc=Symbol.for("v-ndc");function sa(t){return be(t)?Lc(jc,t,!1)||t:t||Nc}function Lc(t,e,r=!0,n=!1){const s=tt||De;if(s){const i=s.type;{const a=nf(i,!1);if(a&&(a===e||a===Ke(e)||a===Vs(Ke(e))))return i}const o=ia(s[t]||i[t],e)||ia(s.appContext[t],e);return!o&&n?i:o}}function ia(t,e){return t&&(t[e]||t[Ke(e)]||t[Vs(Ke(e))])}function Bi(t,e,r,n){let s;const i=r,o=q(t);if(o||be(t)){const a=o&&zt(t);let l=!1,c=!1;a&&(l=!nt(t),c=Yt(t),t=Ws(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Qr(pt(t[u])):pt(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a+1,a,void 0,i)}else if(ae(t))if(t[Symbol.iterator])s=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=e(t[u],u,l,i)}}else s=[];return s}const Mi=t=>t?ru(t)?ei(t):Mi(t.parent):null,An=Pe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Mi(t.parent),$root:t=>Mi(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Uc(t),$forceUpdate:t=>t.f||(t.f=()=>{Ao(t.update)}),$nextTick:t=>t.n||(t.n=Xr.bind(t.proxy)),$watch:t=>sd.bind(t)}),yi=(t,e)=>t!==pe&&!t.__isScriptSetup&&ie(t,e),bd={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:s,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return s[e];case 4:return r[e];case 3:return i[e]}else{if(yi(n,e))return o[e]=1,n[e];if(s!==pe&&ie(s,e))return o[e]=2,s[e];if(ie(i,e))return o[e]=3,i[e];if(r!==pe&&ie(r,e))return o[e]=4,r[e];Hi&&(o[e]=0)}}const c=An[e];let u,h;if(c)return e==="$attrs"&&Le(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==pe&&ie(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,ie(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return yi(s,e)?(s[e]=r,!0):n!==pe&&ie(n,e)?(n[e]=r,!0):ie(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:s,props:i,type:o}},a){let l;return!!(r[a]||t!==pe&&a[0]!=="$"&&ie(t,a)||yi(e,a)||ie(i,a)||ie(n,a)||ie(An,a)||ie(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:ie(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function oa(t){return q(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Hi=!0;function _d(t){const e=Uc(t),r=t.proxy,n=t.ctx;Hi=!1,e.beforeCreate&&aa(e.beforeCreate,t,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:g,activated:y,deactivated:S,beforeDestroy:w,beforeUnmount:b,destroyed:_,unmounted:x,render:B,renderTracked:H,renderTriggered:M,errorCaptured:G,serverPrefetch:C,expose:J,inheritAttrs:ee,components:N,directives:Q,filters:Ae}=e;if(c&&wd(c,n,null),o)for(const Z in o){const ne=o[Z];Y(ne)&&(n[Z]=ne.bind(r))}if(s){const Z=s.call(r,r);ae(Z)&&(t.data=Yn(Z))}if(Hi=!0,i)for(const Z in i){const ne=i[Z],It=Y(ne)?ne.bind(r,r):Y(ne.get)?ne.get.bind(r,r):Pt,er=!Y(ne)&&Y(ne.set)?ne.set.bind(r):Pt,yt=Ue({get:It,set:er});Object.defineProperty(n,Z,{enumerable:!0,configurable:!0,get:()=>yt.value,set:We=>yt.value=We})}if(a)for(const Z in a)Dc(a[Z],n,r,Z);if(l){const Z=Y(l)?l.call(r):l;Reflect.ownKeys(Z).forEach(ne=>{ys(ne,Z[ne])})}u&&aa(u,t,"c");function he(Z,ne){q(ne)?ne.forEach(It=>Z(It.bind(r))):ne&&Z(ne.bind(r))}if(he(dd,h),he(Pc,d),he(fd,f),he(pd,g),he(cd,y),he(ud,S),he(vd,G),he(yd,H),he(md,M),he(Ic,b),he($c,x),he(gd,C),q(J))if(J.length){const Z=t.exposed||(t.exposed={});J.forEach(ne=>{Object.defineProperty(Z,ne,{get:()=>r[ne],set:It=>r[ne]=It,enumerable:!0})})}else t.exposed||(t.exposed={});B&&t.render===Pt&&(t.render=B),ee!=null&&(t.inheritAttrs=ee),N&&(t.components=N),Q&&(t.directives=Q),C&&Cc(t)}function wd(t,e,r=Pt){q(t)&&(t=qi(t));for(const n in t){const s=t[n];let i;ae(s)?"default"in s?i=lt(s.from||n,s.default,!0):i=lt(s.from||n):i=lt(s),Se(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function aa(t,e,r){gt(q(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function Dc(t,e,r,n){let s=n.includes(".")?kc(r,n):()=>r[n];if(be(t)){const i=e[t];Y(i)&&Ar(s,i)}else if(Y(t))Ar(s,t.bind(r));else if(ae(t))if(q(t))t.forEach(i=>Dc(i,e,r,n));else{const i=Y(t.handler)?t.handler.bind(r):e[t.handler];Y(i)&&Ar(s,i,t)}}function Uc(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!s.length&&!r&&!n?l=e:(l={},s.length&&s.forEach(c=>As(l,c,o,!0)),As(l,e,o)),ae(e)&&i.set(e,l),l}function As(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&As(t,i,r,!0),s&&s.forEach(o=>As(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=kd[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const kd={data:la,props:ca,emits:ca,methods:yn,computed:yn,beforeCreate:He,created:He,beforeMount:He,mounted:He,beforeUpdate:He,updated:He,beforeDestroy:He,beforeUnmount:He,destroyed:He,unmounted:He,activated:He,deactivated:He,errorCaptured:He,serverPrefetch:He,components:yn,directives:yn,watch:Ed,provide:la,inject:Sd};function la(t,e){return e?t?function(){return Pe(Y(t)?t.call(this,this):t,Y(e)?e.call(this,this):e)}:e:t}function Sd(t,e){return yn(qi(t),qi(e))}function qi(t){if(q(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function He(t,e){return t?[...new Set([].concat(t,e))]:e}function yn(t,e){return t?Pe(Object.create(null),t,e):e}function ca(t,e){return t?q(t)&&q(e)?[...new Set([...t,...e])]:Pe(Object.create(null),oa(t),oa(e??{})):e}function Ed(t,e){if(!t)return e;if(!e)return t;const r=Pe(Object.create(null),t);for(const n in e)r[n]=He(t[n],e[n]);return r}function Bc(){return{app:null,config:{isNativeTag:ql,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 Td=0;function Ad(t,e){return function(n,s=null){Y(n)||(n=Pe({},n)),s!=null&&!ae(s)&&(s=null);const i=Bc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Td++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:of,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&Y(u.install)?(o.add(u),u.install(c,...h)):Y(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(n,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,ei(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(gt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=xr;xr=c;try{return u()}finally{xr=h}}};return c}}let xr=null;const xd=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ke(e)}Modifiers`]||t[`${hr(e)}Modifiers`];function Rd(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||pe;let s=r;const i=e.startsWith("update:"),o=i&&xd(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>be(u)?u.trim():u)),o.number&&(s=r.map(zs)));let a,l=n[a=hi(e)]||n[a=hi(Ke(e))];!l&&i&&(l=n[a=hi(hr(e))]),l&&gt(l,t,6,s);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,gt(c,t,6,s)}}const Cd=new WeakMap;function Mc(t,e,r=!1){const n=r?Cd:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!Y(t)){const l=c=>{const u=Mc(c,e,!0);u&&(a=!0,Pe(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(ae(t)&&n.set(t,null),null):(q(i)?i.forEach(l=>o[l]=null):Pe(o,i),ae(t)&&n.set(t,o),o)}function Qs(t,e){return!t||!Ms(e)?!1:(e=e.slice(2).replace(/Once$/,""),ie(t,e[0].toLowerCase()+e.slice(1))||ie(t,hr(e))||ie(t,e))}function ua(t){const{type:e,vnode:r,proxy:n,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:g,inheritAttrs:y}=t,S=Es(t);let w,b;try{if(r.shapeFlag&4){const x=s||n,B=x;w=Rt(c.call(B,x,u,h,f,d,g)),b=a}else{const x=e;w=Rt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),b=e.props?a:Od(a)}}catch(x){xn.length=0,Js(x,t,1),w=ue(Ve)}let _=w;if(b&&y!==!1){const x=Object.keys(b),{shapeFlag:B}=_;x.length&&B&7&&(i&&x.some(Hs)&&(b=Pd(b,i)),_=cr(_,b,!1,!0))}return r.dirs&&(_=cr(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(r.dirs):r.dirs),r.transition&&Dn(_,r.transition),w=_,Es(S),w}const Od=t=>{let e;for(const r in t)(r==="class"||r==="style"||Ms(r))&&((e||(e={}))[r]=t[r]);return e},Pd=(t,e)=>{const r={};for(const n in t)(!Hs(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Id(t,e,r){const{props:n,children:s,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?ha(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Hc(o,n,d)&&!Qs(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?ha(n,o,c):!0:!!o;return!1}function ha(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let s=0;s<n.length;s++){const i=n[s];if(Hc(e,t,i)&&!Qs(r,i))return!0}return!1}function Hc(t,e,r){const n=t[r],s=e[r];return r==="style"&&ae(n)&&ae(s)?!an(n,s):n!==s}function $d({vnode:t,parent:e,suspense:r},n){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===t&&(s.suspense.vnode.el=s.el=n,t=s),s===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const qc={},Fc=()=>Object.create(qc),Vc=t=>Object.getPrototypeOf(t)===qc;function jd(t,e,r,n=!1){const s={},i=Fc();t.propsDefaults=Object.create(null),zc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:fc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Nd(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=te(s),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Qs(t.emitsOptions,d))continue;const f=e[d];if(l)if(ie(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const g=Ke(d);s[g]=Fi(l,a,g,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{zc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!ie(e,h)&&((u=hr(h))===h||!ie(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Fi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!ie(e,h))&&(delete i[h],c=!0)}c&&Ht(t.attrs,"set","")}function zc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(wn(l))continue;const c=e[l];let u;s&&ie(s,u=Ke(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Qs(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=te(r),c=a||pe;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Fi(s,l,h,c[h],t,!ie(c,h))}}return o}function Fi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=ie(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Y(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Qn(s);n=c[r]=l.call(null,e),u()}}else n=l;s.ce&&s.ce._setProp(r,n)}o[0]&&(i&&!a?n=!1:o[1]&&(n===""||n===hr(r))&&(n=!0))}return n}const Ld=new WeakMap;function Kc(t,e,r=!1){const n=r?Ld:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!Y(t)){const u=h=>{l=!0;const[d,f]=Kc(h,e,!0);Pe(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return ae(t)&&n.set(t,Wr),Wr;if(q(i))for(let u=0;u<i.length;u++){const h=Ke(i[u]);da(h)&&(o[h]=pe)}else if(i)for(const u in i){const h=Ke(u);if(da(h)){const d=i[u],f=o[h]=q(d)||Y(d)?{type:d}:Pe({},d),g=f.type;let y=!1,S=!0;if(q(g))for(let w=0;w<g.length;++w){const b=g[w],_=Y(b)&&b.name;if(_==="Boolean"){y=!0;break}else _==="String"&&(S=!1)}else y=Y(g)&&g.name==="Boolean";f[0]=y,f[1]=S,(y||ie(f,"default"))&&a.push(h)}}const c=[o,a];return ae(t)&&n.set(t,c),c}function da(t){return t[0]!=="$"&&!wn(t)}const Ro=t=>t==="_"||t==="_ctx"||t==="$stable",Co=t=>q(t)?t.map(Rt):[Rt(t)],Dd=(t,e,r)=>{if(e._n)return e;const n=Yr((...s)=>Co(e(...s)),r);return n._c=!1,n},Wc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(Ro(s))continue;const i=t[s];if(Y(i))e[s]=Dd(s,i,n);else if(i!=null){const o=Co(i);e[s]=()=>o}}},Gc=(t,e)=>{const r=Co(e);t.slots.default=()=>r},Jc=(t,e,r)=>{for(const n in e)(r||!Ro(n))&&(t[n]=e[n])},Ud=(t,e,r)=>{const n=t.slots=Fc();if(t.vnode.shapeFlag&32){const s=e._;s?(Jc(n,e,r),r&&Kl(n,"_",s,!0)):Wc(e,n)}else e&&Gc(t,e)},Bd=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=pe;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:Jc(s,e,r):(i=!e.$stable,Wc(e,s)),o=e}else e&&(Gc(t,e),o={default:1});if(i)for(const a in s)!Ro(a)&&o[a]==null&&delete s[a]},Je=Vd;function Md(t){return Hd(t)}function Hd(t,e){const r=Ks();r.__VUE__=!0;const{insert:n,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Pt,insertStaticContent:g}=t,y=(p,m,v,k=null,A=null,E=null,$=void 0,P=null,O=!!m.dynamicChildren)=>{if(p===m)return;p&&!kr(p,m)&&(k=T(p),We(p,A,E,!0),p=null),m.patchFlag===-2&&(O=!1,m.dynamicChildren=null);const{type:R,ref:z,shapeFlag:L}=m;switch(R){case Xs:S(p,m,v,k);break;case Ve:w(p,m,v,k);break;case bi:p==null&&b(m,v,k,$);break;case Ye:N(p,m,v,k,A,E,$,P,O);break;default:L&1?B(p,m,v,k,A,E,$,P,O):L&6?Q(p,m,v,k,A,E,$,P,O):(L&64||L&128)&&R.process(p,m,v,k,A,E,$,P,O,F)}z!=null&&A?En(z,p&&p.ref,E,m||p,!m):z==null&&p&&p.ref!=null&&En(p.ref,null,E,p,!0)},S=(p,m,v,k)=>{if(p==null)n(m.el=a(m.children),v,k);else{const A=m.el=p.el;m.children!==p.children&&c(A,m.children)}},w=(p,m,v,k)=>{p==null?n(m.el=l(m.children||""),v,k):m.el=p.el},b=(p,m,v,k)=>{[p.el,p.anchor]=g(p.children,m,v,k,p.el,p.anchor)},_=({el:p,anchor:m},v,k)=>{let A;for(;p&&p!==m;)A=d(p),n(p,v,k),p=A;n(m,v,k)},x=({el:p,anchor:m})=>{let v;for(;p&&p!==m;)v=d(p),s(p),p=v;s(m)},B=(p,m,v,k,A,E,$,P,O)=>{if(m.type==="svg"?$="svg":m.type==="math"&&($="mathml"),p==null)H(m,v,k,A,E,$,P,O);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),C(p,m,A,E,$,P,O)}finally{R&&R._endPatch()}}},H=(p,m,v,k,A,E,$,P)=>{let O,R;const{props:z,shapeFlag:L,transition:V,dirs:W}=p;if(O=p.el=o(p.type,E,z&&z.is,z),L&8?u(O,p.children):L&16&&G(p.children,O,null,k,A,vi(p,E),$,P),W&&pr(p,null,k,"created"),M(O,p,p.scopeId,$,k),z){for(const de in z)de!=="value"&&!wn(de)&&i(O,de,null,z[de],E,k);"value"in z&&i(O,"value",null,z.value,E),(R=z.onVnodeBeforeMount)&&wt(R,k,p)}W&&pr(p,null,k,"beforeMount");const re=qd(A,V);re&&V.beforeEnter(O),n(O,m,v),((R=z&&z.onVnodeMounted)||re||W)&&Je(()=>{try{R&&wt(R,k,p),re&&V.enter(O),W&&pr(p,null,k,"mounted")}finally{}},A)},M=(p,m,v,k,A)=>{if(v&&f(p,v),k)for(let E=0;E<k.length;E++)f(p,k[E]);if(A){let E=A.subTree;if(m===E||Xc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const $=A.vnode;M(p,$,$.scopeId,$.slotScopeIds,A.parent)}}},G=(p,m,v,k,A,E,$,P,O=0)=>{for(let R=O;R<p.length;R++){const z=p[R]=P?Mt(p[R]):Rt(p[R]);y(null,z,m,v,k,A,E,$,P)}},C=(p,m,v,k,A,E,$)=>{const P=m.el=p.el;let{patchFlag:O,dynamicChildren:R,dirs:z}=m;O|=p.patchFlag&16;const L=p.props||pe,V=m.props||pe;let W;if(v&&gr(v,!1),(W=V.onVnodeBeforeUpdate)&&wt(W,v,m,p),z&&pr(m,p,v,"beforeUpdate"),v&&gr(v,!0),(L.innerHTML&&V.innerHTML==null||L.textContent&&V.textContent==null)&&u(P,""),R?J(p.dynamicChildren,R,P,v,k,vi(m,A),E):$||ne(p,m,P,null,v,k,vi(m,A),E,!1),O>0){if(O&16)ee(P,L,V,v,A);else if(O&2&&L.class!==V.class&&i(P,"class",null,V.class,A),O&4&&i(P,"style",L.style,V.style,A),O&8){const re=m.dynamicProps;for(let de=0;de<re.length;de++){const ge=re[de],xe=L[ge],$e=V[ge];($e!==xe||ge==="value")&&i(P,ge,xe,$e,A,v)}}O&1&&p.children!==m.children&&u(P,m.children)}else!$&&R==null&&ee(P,L,V,v,A);((W=V.onVnodeUpdated)||z)&&Je(()=>{W&&wt(W,v,m,p),z&&pr(m,p,v,"updated")},k)},J=(p,m,v,k,A,E,$)=>{for(let P=0;P<m.length;P++){const O=p[P],R=m[P],z=O.el&&(O.type===Ye||!kr(O,R)||O.shapeFlag&198)?h(O.el):v;y(O,R,z,null,k,A,E,$,!0)}},ee=(p,m,v,k,A)=>{if(m!==v){if(m!==pe)for(const E in m)!wn(E)&&!(E in v)&&i(p,E,m[E],null,A,k);for(const E in v){if(wn(E))continue;const $=v[E],P=m[E];$!==P&&E!=="value"&&i(p,E,P,$,A,k)}"value"in v&&i(p,"value",m.value,v.value,A)}},N=(p,m,v,k,A,E,$,P,O)=>{const R=m.el=p?p.el:a(""),z=m.anchor=p?p.anchor:a("");let{patchFlag:L,dynamicChildren:V,slotScopeIds:W}=m;W&&(P=P?P.concat(W):W),p==null?(n(R,v,k),n(z,v,k),G(m.children||[],v,z,A,E,$,P,O)):L>0&&L&64&&V&&p.dynamicChildren&&p.dynamicChildren.length===V.length?(J(p.dynamicChildren,V,v,A,E,$,P),(m.key!=null||A&&m===A.subTree)&&Yc(p,m,!0)):ne(p,m,v,z,A,E,$,P,O)},Q=(p,m,v,k,A,E,$,P,O)=>{m.slotScopeIds=P,p==null?m.shapeFlag&512?A.ctx.activate(m,v,k,$,O):Ae(m,v,k,A,E,$,O):Be(p,m,O)},Ae=(p,m,v,k,A,E,$)=>{const P=p.component=Qd(p,k,A);if(Ys(p)&&(P.ctx.renderer=F),Xd(P,!1,$),P.asyncDep){if(A&&A.registerDep(P,he,$),!p.el){const O=P.subTree=ue(Ve);w(null,O,m,v),p.placeholder=O.el}}else he(P,p,m,v,A,E,$)},Be=(p,m,v)=>{const k=m.component=p.component;if(Id(p,m,v))if(k.asyncDep&&!k.asyncResolved){Z(k,m,v);return}else k.next=m,k.update();else m.el=p.el,k.vnode=m},he=(p,m,v,k,A,E,$)=>{const P=()=>{if(p.isMounted){let{next:L,bu:V,u:W,parent:re,vnode:de}=p;{const bt=Zc(p);if(bt){L&&(L.el=de.el,Z(p,L,$)),bt.asyncDep.then(()=>{Je(()=>{p.isUnmounted||R()},A)});return}}let ge=L,xe;gr(p,!1),L?(L.el=de.el,Z(p,L,$)):L=de,V&&gs(V),(xe=L.props&&L.props.onVnodeBeforeUpdate)&&wt(xe,re,L,de),gr(p,!0);const $e=ua(p),vt=p.subTree;p.subTree=$e,y(vt,$e,h(vt.el),T(vt),p,A,E),L.el=$e.el,ge===null&&$d(p,$e.el),W&&Je(W,A),(xe=L.props&&L.props.onVnodeUpdated)&&Je(()=>wt(xe,re,L,de),A)}else{let L;const{el:V,props:W}=m,{bm:re,m:de,parent:ge,root:xe,type:$e}=p,vt=Tn(m);gr(p,!1),re&&gs(re),!vt&&(L=W&&W.onVnodeBeforeMount)&&wt(L,ge,m),gr(p,!0);{xe.ce&&xe.ce._hasShadowRoot()&&xe.ce._injectChildStyle($e,p.parent?p.parent.type:void 0);const bt=p.subTree=ua(p);y(null,bt,v,k,p,A,E),m.el=bt.el}if(de&&Je(de,A),!vt&&(L=W&&W.onVnodeMounted)){const bt=m;Je(()=>wt(L,ge,bt),A)}(m.shapeFlag&256||ge&&Tn(ge.vnode)&&ge.vnode.shapeFlag&256)&&p.a&&Je(p.a,A),p.isMounted=!0,m=v=k=null}};p.scope.on();const O=p.effect=new Xl(P);p.scope.off();const R=p.update=O.run.bind(O),z=p.job=O.runIfDirty.bind(O);z.i=p,z.id=p.uid,O.scheduler=()=>Ao(z),gr(p,!0),R()},Z=(p,m,v)=>{m.component=p;const k=p.vnode.props;p.vnode=m,p.next=null,Nd(p,m.props,k,v),Bd(p,m.children,v),Gt(),ea(p),Jt()},ne=(p,m,v,k,A,E,$,P,O=!1)=>{const R=p&&p.children,z=p?p.shapeFlag:0,L=m.children,{patchFlag:V,shapeFlag:W}=m;if(V>0){if(V&128){er(R,L,v,k,A,E,$,P,O);return}else if(V&256){It(R,L,v,k,A,E,$,P,O);return}}W&8?(z&16&&st(R,A,E),L!==R&&u(v,L)):z&16?W&16?er(R,L,v,k,A,E,$,P,O):st(R,A,E,!0):(z&8&&u(v,""),W&16&&G(L,v,k,A,E,$,P,O))},It=(p,m,v,k,A,E,$,P,O)=>{p=p||Wr,m=m||Wr;const R=p.length,z=m.length,L=Math.min(R,z);let V;for(V=0;V<L;V++){const W=m[V]=O?Mt(m[V]):Rt(m[V]);y(p[V],W,v,null,A,E,$,P,O)}R>z?st(p,A,E,!0,!1,L):G(m,v,k,A,E,$,P,O,L)},er=(p,m,v,k,A,E,$,P,O)=>{let R=0;const z=m.length;let L=p.length-1,V=z-1;for(;R<=L&&R<=V;){const W=p[R],re=m[R]=O?Mt(m[R]):Rt(m[R]);if(kr(W,re))y(W,re,v,null,A,E,$,P,O);else break;R++}for(;R<=L&&R<=V;){const W=p[L],re=m[V]=O?Mt(m[V]):Rt(m[V]);if(kr(W,re))y(W,re,v,null,A,E,$,P,O);else break;L--,V--}if(R>L){if(R<=V){const W=V+1,re=W<z?m[W].el:k;for(;R<=V;)y(null,m[R]=O?Mt(m[R]):Rt(m[R]),v,re,A,E,$,P,O),R++}}else if(R>V)for(;R<=L;)We(p[R],A,E,!0),R++;else{const W=R,re=R,de=new Map;for(R=re;R<=V;R++){const Qe=m[R]=O?Mt(m[R]):Rt(m[R]);Qe.key!=null&&de.set(Qe.key,R)}let ge,xe=0;const $e=V-re+1;let vt=!1,bt=0;const cn=new Array($e);for(R=0;R<$e;R++)cn[R]=0;for(R=W;R<=L;R++){const Qe=p[R];if(xe>=$e){We(Qe,A,E,!0);continue}let _t;if(Qe.key!=null)_t=de.get(Qe.key);else for(ge=re;ge<=V;ge++)if(cn[ge-re]===0&&kr(Qe,m[ge])){_t=ge;break}_t===void 0?We(Qe,A,E,!0):(cn[_t-re]=R+1,_t>=bt?bt=_t:vt=!0,y(Qe,m[_t],v,null,A,E,$,P,O),xe++)}const Ko=vt?Fd(cn):Wr;for(ge=Ko.length-1,R=$e-1;R>=0;R--){const Qe=re+R,_t=m[Qe],Wo=m[Qe+1],Go=Qe+1<z?Wo.el||Qc(Wo):k;cn[R]===0?y(null,_t,v,Go,A,E,$,P,O):vt&&(ge<0||R!==Ko[ge]?yt(_t,v,Go,2):ge--)}}},yt=(p,m,v,k,A=null)=>{const{el:E,type:$,transition:P,children:O,shapeFlag:R}=p;if(R&6){yt(p.component.subTree,m,v,k);return}if(R&128){p.suspense.move(m,v,k);return}if(R&64){$.move(p,m,v,F);return}if($===Ye){n(E,m,v);for(let L=0;L<O.length;L++)yt(O[L],m,v,k);n(p.anchor,m,v);return}if($===bi){_(p,m,v);return}if(k!==2&&R&1&&P)if(k===0)P.beforeEnter(E),n(E,m,v),Je(()=>P.enter(E),A);else{const{leave:L,delayLeave:V,afterLeave:W}=P,re=()=>{p.ctx.isUnmounted?s(E):n(E,m,v)},de=()=>{E._isLeaving&&E[Tt](!0),L(E,()=>{re(),W&&W()})};V?V(E,re,de):de()}else n(E,m,v)},We=(p,m,v,k=!1,A=!1)=>{const{type:E,props:$,ref:P,children:O,dynamicChildren:R,shapeFlag:z,patchFlag:L,dirs:V,cacheIndex:W,memo:re}=p;if(L===-2&&(A=!1),P!=null&&(Gt(),En(P,null,v,p,!0),Jt()),W!=null&&(m.renderCache[W]=void 0),z&256){m.ctx.deactivate(p);return}const de=z&1&&V,ge=!Tn(p);let xe;if(ge&&(xe=$&&$.onVnodeBeforeUnmount)&&wt(xe,m,p),z&6)fr(p.component,v,k);else{if(z&128){p.suspense.unmount(v,k);return}de&&pr(p,null,m,"beforeUnmount"),z&64?p.type.remove(p,m,v,F,k):R&&!R.hasOnce&&(E!==Ye||L>0&&L&64)?st(R,m,v,!1,!0):(E===Ye&&L&384||!A&&z&16)&&st(O,m,v),k&&Pr(p)}const $e=re!=null&&W==null;(ge&&(xe=$&&$.onVnodeUnmounted)||de||$e)&&Je(()=>{xe&&wt(xe,m,p),de&&pr(p,null,m,"unmounted"),$e&&(p.el=null)},v)},Pr=p=>{const{type:m,el:v,anchor:k,transition:A}=p;if(m===Ye){Ir(v,k);return}if(m===bi){x(p);return}const E=()=>{s(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(p.shapeFlag&1&&A&&!A.persisted){const{leave:$,delayLeave:P}=A,O=()=>$(v,E);P?P(p.el,E,O):O()}else E()},Ir=(p,m)=>{let v;for(;p!==m;)v=d(p),s(p),p=v;s(m)},fr=(p,m,v)=>{const{bum:k,scope:A,job:E,subTree:$,um:P,m:O,a:R}=p;fa(O),fa(R),k&&gs(k),A.stop(),E&&(E.flags|=8,We($,p,m,v)),P&&Je(P,m),Je(()=>{p.isUnmounted=!0},m)},st=(p,m,v,k=!1,A=!1,E=0)=>{for(let $=E;$<p.length;$++)We(p[$],m,v,k,A)},T=p=>{if(p.shapeFlag&6)return T(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const m=d(p.anchor||p.el),v=m&&m[id];return v?d(v):m};let D=!1;const j=(p,m,v)=>{let k;p==null?m._vnode&&(We(m._vnode,null,null,!0),k=m._vnode.component):y(m._vnode||null,p,m,null,null,null,v),m._vnode=p,D||(D=!0,ea(k),vc(),D=!1)},F={p:y,um:We,m:yt,r:Pr,mt:Ae,mc:G,pc:ne,pbc:J,n:T,o:t};return{render:j,hydrate:void 0,createApp:Ad(j)}}function vi({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function gr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function qd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Yc(t,e,r=!1){const n=t.children,s=e.children;if(q(n)&&q(s))for(let i=0;i<n.length;i++){const o=n[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Mt(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Yc(o,a)),a.type===Xs&&(a.patchFlag===-1&&(a=s[i]=Mt(a)),a.el=o.el),a.type===Ve&&!a.el&&(a.el=o.el)}}function Fd(t){const e=t.slice(),r=[0];let n,s,i,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(s=r[r.length-1],t[s]<c){e[n]=s,r.push(n);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Zc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Zc(e)}function fa(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Qc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Qc(e.subTree):null}const Xc=t=>t.__isSuspense;function Vd(t,e){e&&e.pendingBranch?q(t)?e.effects.push(...t):e.effects.push(t):Xh(t)}const Ye=Symbol.for("v-fgt"),Xs=Symbol.for("v-txt"),Ve=Symbol.for("v-cmt"),bi=Symbol.for("v-stc"),xn=[];let rt=null;function oe(t=!1){xn.push(rt=t?null:[])}function zd(){xn.pop(),rt=xn[xn.length-1]||null}let Un=1;function xs(t,e=!1){Un+=t,t<0&&rt&&e&&(rt.hasOnce=!0)}function eu(t){return t.dynamicChildren=Un>0?rt||Wr:null,zd(),Un>0&&rt&&rt.push(t),t}function Ee(t,e,r,n,s,i){return eu(ve(t,e,r,n,s,i,!0))}function Kt(t,e,r,n,s){return eu(ue(t,e,r,n,s,!0))}function Rs(t){return t?t.__v_isVNode===!0:!1}function kr(t,e){return t.type===e.type&&t.key===e.key}const tu=({key:t})=>t??null,vs=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?be(t)||Se(t)||Y(t)?{i:tt,r:t,k:e,f:!!r}:t:null);function ve(t,e=null,r=null,n=0,s=null,i=t===Ye?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&tu(e),ref:e&&vs(e),scopeId:_c,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:tt};return a?(Oo(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=be(r)?8:16),Un>0&&!o&&rt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&rt.push(l),l}const ue=Kd;function Kd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===Nc)&&(t=Ve),Rs(t)){const a=cr(t,e,!0);return r&&Oo(a,r),Un>0&&!i&&rt&&(a.shapeFlag&6?rt[rt.indexOf(t)]=a:rt.push(a)),a.patchFlag=-2,a}if(sf(t)&&(t=t.__vccOpts),e){e=Wd(e);let{class:a,style:l}=e;a&&!be(a)&&(e.class=at(a)),ae(l)&&(Gs(l)&&!q(l)&&(l=Pe({},l)),e.style=yo(l))}const o=be(t)?1:Xc(t)?128:Sc(t)?64:ae(t)?4:Y(t)?2:0;return ve(t,e,r,n,s,o,i,!0)}function Wd(t){return t?Gs(t)||Vc(t)?Pe({},t):t:null}function cr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Jd(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&tu(c),ref:e&&e.ref?r&&i?q(i)?i.concat(vs(e)):[i,vs(e)]:vs(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ye?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&cr(t.ssContent),ssFallback:t.ssFallback&&cr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&Dn(u,l.clone(u)),u}function Gd(t=" ",e=0){return ue(Xs,null,t,e)}function Ze(t="",e=!1){return e?(oe(),Kt(Ve,null,t)):ue(Ve,null,t)}function Rt(t){return t==null||typeof t=="boolean"?ue(Ve):q(t)?ue(Ye,null,t.slice()):Rs(t)?Mt(t):ue(Xs,null,String(t))}function Mt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:cr(t)}function Oo(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(q(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Oo(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Vc(e)?e._ctx=tt:s===3&&tt&&(tt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:tt},r=32):(e=String(e),n&64?(r=16,e=[Gd(e)]):r=8);t.children=e,t.shapeFlag|=r}function Jd(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const s in n)if(s==="class")e.class!==n.class&&(e.class=at([e.class,n.class]));else if(s==="style")e.style=yo([e.style,n.style]);else if(Ms(s)){const i=e[s],o=n[s];o&&i!==o&&!(q(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Hs(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function wt(t,e,r,n=null){gt(t,e,7,[r,n])}const Yd=Bc();let Zd=0;function Qd(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||Yd,i={uid:Zd++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Kc(n,s),emitsOptions:Mc(n,s),emit:null,emitted:null,propsDefaults:pe,inheritAttrs:n.inheritAttrs,ctx:pe,data:pe,props:pe,attrs:pe,slots:pe,refs:pe,setupState:pe,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Rd.bind(null,i),t.ce&&t.ce(i),i}let De=null;const Po=()=>De||tt;let Cs,Vi;{const t=Ks(),e=(r,n)=>{let s;return(s=t[r])||(s=t[r]=[]),s.push(n),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Cs=e("__VUE_INSTANCE_SETTERS__",r=>De=r),Vi=e("__VUE_SSR_SETTERS__",r=>Bn=r)}const Qn=t=>{const e=De;return Cs(t),t.scope.on(),()=>{t.scope.off(),Cs(e)}},pa=()=>{De&&De.scope.off(),Cs(null)};function ru(t){return t.vnode.shapeFlag&4}let Bn=!1;function Xd(t,e=!1,r=!1){e&&Vi(e);const{props:n,children:s}=t.vnode,i=ru(t);jd(t,n,i,e),Ud(t,s,r||e);const o=i?ef(t,e):void 0;return e&&Vi(!1),o}function ef(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,bd);const{setup:n}=r;if(n){Gt();const s=t.setupContext=n.length>1?rf(t):null,i=Qn(t),o=Zn(n,t,0,[t.props,s]),a=Fl(o);if(Jt(),i(),(a||t.sp)&&!Tn(t)&&Cc(t),a){if(o.then(pa,pa),e)return o.then(l=>{ga(t,l)}).catch(l=>{Js(l,t,0)});t.asyncDep=o}else ga(t,o)}else nu(t)}function ga(t,e,r){Y(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ae(e)&&(t.setupState=gc(e)),nu(t)}function nu(t,e,r){const n=t.type;t.render||(t.render=n.render||Pt);{const s=Qn(t);Gt();try{_d(t)}finally{Jt(),s()}}}const tf={get(t,e){return Le(t,"get",""),t[e]}};function rf(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,tf),slots:t.slots,emit:t.emit,expose:e}}function ei(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(gc(To(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in An)return An[r](t)},has(e,r){return r in e||r in An}})):t.proxy}function nf(t,e=!0){return Y(t)?t.displayName||t.name:t.name||e&&t.__name}function sf(t){return Y(t)&&"__vccOpts"in t}const Ue=(t,e)=>Gh(t,e,Bn);function en(t,e,r){try{xs(-1);const n=arguments.length;return n===2?ae(e)&&!q(e)?Rs(e)?ue(t,null,[e]):ue(t,e):ue(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&Rs(r)&&(r=[r]),ue(t,e,r))}finally{xs(1)}}const of="3.5.34";/**
14
+ **/function Gn(t,e,r,n){try{return n?t(...n):t()}catch(s){Ws(s,e,r)}}function gt(t,e,r,n){if(Y(t)){const s=Gn(t,e,r,n);return s&&Bl(s)&&s.catch(i=>{Ws(i,e,r)}),s}if(q(t)){const s=[];for(let i=0;i<t.length;i++)s.push(gt(t[i],e,r,n));return s}}function Ws(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||pe;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Gt(),Gn(i,null,10,[t,l,c]),Jt();return}}Gh(t,r,s,n,o)}function Gh(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Fe=[];let Et=-1;const Wr=[];let nr=null,Dr=0;const dc=Promise.resolve();let ws=null;function Yr(t){const e=ws||dc;return t?e.then(this?t.bind(this):t):e}function Jh(t){let e=Et+1,r=Fe.length;for(;e<r;){const n=e+r>>>1,s=Fe[n],i=jn(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function ko(t){if(!(t.flags&1)){const e=jn(t),r=Fe[Fe.length-1];!r||!(t.flags&2)&&e>=jn(r)?Fe.push(t):Fe.splice(Jh(e),0,t),t.flags|=1,fc()}}function fc(){ws||(ws=dc.then(gc))}function Yh(t){q(t)?Wr.push(...t):nr&&t.id===-1?nr.splice(Dr+1,0,t):t.flags&1||(Wr.push(t),t.flags|=1),fc()}function Yo(t,e,r=Et+1){for(;r<Fe.length;r++){const n=Fe[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Fe.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function pc(t){if(Wr.length){const e=[...new Set(Wr)].sort((r,n)=>jn(r)-jn(n));if(Wr.length=0,nr){nr.push(...e);return}for(nr=e,Dr=0;Dr<nr.length;Dr++){const r=nr[Dr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}nr=null,Dr=0}}const jn=t=>t.id==null?t.flags&2?-1:1/0:t.id;function gc(t){try{for(Et=0;Et<Fe.length;Et++){const e=Fe[Et];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Gn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Et<Fe.length;Et++){const e=Fe[Et];e&&(e.flags&=-2)}Et=-1,Fe.length=0,pc(),ws=null,(Fe.length||Wr.length)&&gc()}}let tt=null,mc=null;function ks(t){const e=tt;return tt=t,mc=t&&t.type.__scopeId||null,e}function Kr(t,e=tt,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&Ts(-1);const i=ks(e);let o;try{o=t(...s)}finally{ks(i),n._d&&Ts(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function Qh(t,e){if(tt===null)return t;const r=Qs(tt),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=pe]=e[s];i&&(Y(i)&&(i={mounted:i,updated:i}),i.deep&&qt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function dr(t,e,r,n){const s=t.dirs,i=e&&e.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[n];l&&(Gt(),gt(l,r,8,[t.el,a,t,e]),Jt())}}function gs(t,e){if(De){let r=De.provides;const n=De.parent&&De.parent.provides;n===r&&(r=De.provides=Object.create(n)),r[t]=e}}function lt(t,e,r=!1){const n=xo();if(n||Tr){let s=Tr?Tr._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return r&&Y(e)?e.call(n&&n.proxy):e}}function Zh(){return!!(xo()||Tr)}const Xh=Symbol.for("v-scx"),ed=()=>lt(Xh);function Er(t,e,r){return yc(t,e,r)}function yc(t,e,r=pe){const{immediate:n,deep:s,flush:i,once:o}=r,a=Pe({},r),l=e&&n||!e&&i!=="post";let c;if(Ln){if(i==="sync"){const f=ed();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Pt,f.resume=Pt,f.pause=Pt,f}}const u=De;a.call=(f,g,y)=>gt(f,u,g,y);let h=!1;i==="post"?a.scheduler=f=>{Je(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,g)=>{g?f():ko(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Kh(t,e,a);return Ln&&(c?c.push(d):l&&d()),d}function td(t,e,r){const n=this.proxy,s=be(t)?t.includes(".")?vc(n,t):()=>n[t]:t.bind(n,n);let i;Y(e)?i=e:(i=e.handler,r=e);const o=Jn(this),a=yc(s,i.bind(n),r);return o(),a}function vc(t,e){const r=e.split(".");return()=>{let n=t;for(let s=0;s<r.length&&n;s++)n=n[r[s]];return n}}const rd=Symbol("_vte"),bc=t=>t.__isTeleport,Tt=Symbol("_leaveCb"),ln=Symbol("_enterCb");function nd(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return xc(()=>{t.isMounted=!0}),Rc(()=>{t.isUnmounting=!0}),t}const it=[Function,Array],_c={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:it,onEnter:it,onAfterEnter:it,onEnterCancelled:it,onBeforeLeave:it,onLeave:it,onAfterLeave:it,onLeaveCancelled:it,onBeforeAppear:it,onAppear:it,onAfterAppear:it,onAppearCancelled:it},wc=t=>{const e=t.subTree;return e.component?wc(e.component):e},sd={name:"BaseTransition",props:_c,setup(t,{slots:e}){const r=xo(),n=nd();return()=>{const s=e.default&&Ec(e.default(),!0),i=s&&s.length?kc(s):r.subTree?Qe():void 0;if(!i)return;const o=te(t),{mode:a}=o;if(n.isLeaving)return di(i);const l=Qo(i);if(!l)return di(i);let c=$i(l,o,n,r,h=>c=h);l.type!==Ve&&$n(l,c);let u=r.subTree&&Qo(r.subTree);if(u&&u.type!==Ve&&!_r(u,l)&&wc(r).type!==Ve){let h=$i(u,o,n,r);if($n(u,h),a==="out-in"&&l.type!==Ve)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},di(i);a==="in-out"&&l.type!==Ve?h.delayLeave=(d,f,g)=>{const y=Sc(n,u);y[String(u.key)]=u,d[Tt]=()=>{f(),d[Tt]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{g(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function kc(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ve){e=r;break}}return e}const id=sd;function Sc(t,e){const{leavingVNodes:r}=t;let n=r.get(e.type);return n||(n=Object.create(null),r.set(e.type,n)),n}function $i(t,e,r,n,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:g,onLeaveCancelled:y,onBeforeAppear:k,onAppear:w,onAfterAppear:_,onAppearCancelled:b}=e,x=String(t.key),D=Sc(r,t),H=(C,V)=>{C&&gt(C,n,9,V)},U=(C,V)=>{const Z=V[1];H(C,V),q(C)?C.every($=>$.length<=1)&&Z():C.length<=1&&Z()},F={mode:o,persisted:a,beforeEnter(C){let V=l;if(!r.isMounted)if(i)V=k||l;else return;C[Tt]&&C[Tt](!0);const Z=D[x];Z&&_r(t,Z)&&Z.el[Tt]&&Z.el[Tt](),H(V,[C])},enter(C){if(D[x]===t)return;let V=c,Z=u,$=h;if(!r.isMounted)if(i)V=w||c,Z=_||u,$=b||h;else return;let X=!1;C[ln]=Be=>{X||(X=!0,Be?H($,[C]):H(Z,[C]),F.delayedLeave&&F.delayedLeave(),C[ln]=void 0)};const Ae=C[ln].bind(null,!1);V?U(V,[C,Ae]):Ae()},leave(C,V){const Z=String(t.key);if(C[ln]&&C[ln](!0),r.isUnmounting)return V();H(d,[C]);let $=!1;C[Tt]=Ae=>{$||($=!0,V(),Ae?H(y,[C]):H(g,[C]),C[Tt]=void 0,D[Z]===t&&delete D[Z])};const X=C[Tt].bind(null,!1);D[Z]=t,f?U(f,[C,X]):X()},clone(C){const V=$i(C,e,r,n,s);return s&&s(V),V}};return F}function di(t){if(Ks(t))return t=lr(t),t.children=null,t}function Qo(t){if(!Ks(t))return bc(t.type)&&t.children?kc(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&Y(r.default))return r.default()}}function $n(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$n(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Ec(t,e=!1,r){let n=[],s=0;for(let i=0;i<t.length;i++){let o=t[i];const a=r==null?o.key:String(r)+String(o.key!=null?o.key:i);o.type===Ye?(o.patchFlag&128&&s++,n=n.concat(Ec(o.children,e,a))):(e||o.type!==Ve)&&n.push(a!=null?lr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function ur(t,e){return Y(t)?Pe({name:t.name},e,{setup:t}):t}function Tc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Zo(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ss=new WeakMap;function wn(t,e,r,n,s=!1){if(q(t)){t.forEach((y,k)=>wn(y,e&&(q(e)?e[k]:e),r,n,s));return}if(kn(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&wn(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?Qs(n.component):n.el,o=s?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===pe?a.refs={}:a.refs,h=a.setupState,d=te(h),f=h===pe?Ul:y=>Zo(u,y)?!1:ie(d,y),g=(y,k)=>!(k&&Zo(u,k));if(c!=null&&c!==l){if(Xo(e),be(c))u[c]=null,f(c)&&(h[c]=null);else if(Se(c)){const y=e;g(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(Y(l))Gn(l,a,12,[o,u]);else{const y=be(l),k=Se(l);if(y||k){const w=()=>{if(t.f){const _=y?f(l)?h[l]:u[l]:g()||!t.k?l.value:u[t.k];if(s)q(_)&&ho(_,i);else if(q(_))_.includes(i)||_.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];g(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else y?(u[l]=o,f(l)&&(h[l]=o)):k&&(g(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const _=()=>{w(),Ss.delete(t)};_.id=-1,Ss.set(t,_),Je(_,r)}else Xo(t),w()}}}function Xo(t){const e=Ss.get(t);e&&(e.flags|=8,Ss.delete(t))}Fs().requestIdleCallback;Fs().cancelIdleCallback;const kn=t=>!!t.type.__asyncLoader,Ks=t=>t.type.__isKeepAlive;function od(t,e){Ac(t,"a",e)}function ad(t,e){Ac(t,"da",e)}function Ac(t,e,r=De){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Gs(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Ks(s.parent.vnode)&&ld(n,e,r,s),s=s.parent}}function ld(t,e,r,n){const s=Gs(e,t,n,!0);Cc(()=>{ho(n[e],s)},r)}function Gs(t,e,r=De,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Gt();const a=Jn(r),l=gt(e,r,t,o);return a(),Jt(),l});return n?s.unshift(i):s.push(i),i}}const Qt=t=>(e,r=De)=>{(!Ln||t==="sp")&&Gs(t,(...n)=>e(...n),r)},cd=Qt("bm"),xc=Qt("m"),ud=Qt("bu"),hd=Qt("u"),Rc=Qt("bum"),Cc=Qt("um"),dd=Qt("sp"),fd=Qt("rtg"),pd=Qt("rtc");function gd(t,e=De){Gs("ec",t,e)}const Oc="components";function So(t,e){return Ic(Oc,t,!0,e)||t}const Pc=Symbol.for("v-ndc");function ea(t){return be(t)?Ic(Oc,t,!1)||t:t||Pc}function Ic(t,e,r=!0,n=!1){const s=tt||De;if(s){const i=s.type;{const a=ef(i,!1);if(a&&(a===e||a===We(e)||a===Hs(We(e))))return i}const o=ta(s[t]||i[t],e)||ta(s.appContext[t],e);return!o&&n?i:o}}function ta(t,e){return t&&(t[e]||t[We(e)]||t[Hs(We(e))])}function Ni(t,e,r,n){let s;const i=r,o=q(t);if(o||be(t)){const a=o&&zt(t);let l=!1,c=!1;a&&(l=!nt(t),c=Yt(t),t=Vs(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Jr(pt(t[u])):pt(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a+1,a,void 0,i)}else if(ae(t))if(t[Symbol.iterator])s=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=e(t[u],u,l,i)}}else s=[];return s}const Li=t=>t?Zc(t)?Qs(t):Li(t.parent):null,Sn=Pe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Li(t.parent),$root:t=>Li(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>$c(t),$forceUpdate:t=>t.f||(t.f=()=>{ko(t.update)}),$nextTick:t=>t.n||(t.n=Yr.bind(t.proxy)),$watch:t=>td.bind(t)}),fi=(t,e)=>t!==pe&&!t.__isScriptSetup&&ie(t,e),md={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:s,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return s[e];case 4:return r[e];case 3:return i[e]}else{if(fi(n,e))return o[e]=1,n[e];if(s!==pe&&ie(s,e))return o[e]=2,s[e];if(ie(i,e))return o[e]=3,i[e];if(r!==pe&&ie(r,e))return o[e]=4,r[e];Di&&(o[e]=0)}}const c=Sn[e];let u,h;if(c)return e==="$attrs"&&Le(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==pe&&ie(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,ie(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return fi(s,e)?(s[e]=r,!0):n!==pe&&ie(n,e)?(n[e]=r,!0):ie(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:s,props:i,type:o}},a){let l;return!!(r[a]||t!==pe&&a[0]!=="$"&&ie(t,a)||fi(e,a)||ie(i,a)||ie(n,a)||ie(Sn,a)||ie(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:ie(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function ra(t){return q(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Di=!0;function yd(t){const e=$c(t),r=t.proxy,n=t.ctx;Di=!1,e.beforeCreate&&na(e.beforeCreate,t,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:g,activated:y,deactivated:k,beforeDestroy:w,beforeUnmount:_,destroyed:b,unmounted:x,render:D,renderTracked:H,renderTriggered:U,errorCaptured:F,serverPrefetch:C,expose:V,inheritAttrs:Z,components:$,directives:X,filters:Ae}=e;if(c&&vd(c,n,null),o)for(const Q in o){const ne=o[Q];Y(ne)&&(n[Q]=ne.bind(r))}if(s){const Q=s.call(r,r);ae(Q)&&(t.data=Kn(Q))}if(Di=!0,i)for(const Q in i){const ne=i[Q],It=Y(ne)?ne.bind(r,r):Y(ne.get)?ne.get.bind(r,r):Pt,Xt=!Y(ne)&&Y(ne.set)?ne.set.bind(r):Pt,yt=Ue({get:It,set:Xt});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>yt.value,set:Ke=>yt.value=Ke})}if(a)for(const Q in a)jc(a[Q],n,r,Q);if(l){const Q=Y(l)?l.call(r):l;Reflect.ownKeys(Q).forEach(ne=>{gs(ne,Q[ne])})}u&&na(u,t,"c");function he(Q,ne){q(ne)?ne.forEach(It=>Q(It.bind(r))):ne&&Q(ne.bind(r))}if(he(cd,h),he(xc,d),he(ud,f),he(hd,g),he(od,y),he(ad,k),he(gd,F),he(pd,H),he(fd,U),he(Rc,_),he(Cc,x),he(dd,C),q(V))if(V.length){const Q=t.exposed||(t.exposed={});V.forEach(ne=>{Object.defineProperty(Q,ne,{get:()=>r[ne],set:It=>r[ne]=It,enumerable:!0})})}else t.exposed||(t.exposed={});D&&t.render===Pt&&(t.render=D),Z!=null&&(t.inheritAttrs=Z),$&&(t.components=$),X&&(t.directives=X),C&&Tc(t)}function vd(t,e,r=Pt){q(t)&&(t=Ui(t));for(const n in t){const s=t[n];let i;ae(s)?"default"in s?i=lt(s.from||n,s.default,!0):i=lt(s.from||n):i=lt(s),Se(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function na(t,e,r){gt(q(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function jc(t,e,r,n){let s=n.includes(".")?vc(r,n):()=>r[n];if(be(t)){const i=e[t];Y(i)&&Er(s,i)}else if(Y(t))Er(s,t.bind(r));else if(ae(t))if(q(t))t.forEach(i=>jc(i,e,r,n));else{const i=Y(t.handler)?t.handler.bind(r):e[t.handler];Y(i)&&Er(s,i,t)}}function $c(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!s.length&&!r&&!n?l=e:(l={},s.length&&s.forEach(c=>Es(l,c,o,!0)),Es(l,e,o)),ae(e)&&i.set(e,l),l}function Es(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&Es(t,i,r,!0),s&&s.forEach(o=>Es(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=bd[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const bd={data:sa,props:ia,emits:ia,methods:pn,computed:pn,beforeCreate:He,created:He,beforeMount:He,mounted:He,beforeUpdate:He,updated:He,beforeDestroy:He,beforeUnmount:He,destroyed:He,unmounted:He,activated:He,deactivated:He,errorCaptured:He,serverPrefetch:He,components:pn,directives:pn,watch:wd,provide:sa,inject:_d};function sa(t,e){return e?t?function(){return Pe(Y(t)?t.call(this,this):t,Y(e)?e.call(this,this):e)}:e:t}function _d(t,e){return pn(Ui(t),Ui(e))}function Ui(t){if(q(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function He(t,e){return t?[...new Set([].concat(t,e))]:e}function pn(t,e){return t?Pe(Object.create(null),t,e):e}function ia(t,e){return t?q(t)&&q(e)?[...new Set([...t,...e])]:Pe(Object.create(null),ra(t),ra(e??{})):e}function wd(t,e){if(!t)return e;if(!e)return t;const r=Pe(Object.create(null),t);for(const n in e)r[n]=He(t[n],e[n]);return r}function Nc(){return{app:null,config:{isNativeTag:Ul,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 kd=0;function Sd(t,e){return function(n,s=null){Y(n)||(n=Pe({},n)),s!=null&&!ae(s)&&(s=null);const i=Nc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:kd++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:rf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&Y(u.install)?(o.add(u),u.install(c,...h)):Y(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(n,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,Qs(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(gt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=Tr;Tr=c;try{return u()}finally{Tr=h}}};return c}}let Tr=null;const Ed=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${We(e)}Modifiers`]||t[`${cr(e)}Modifiers`];function Td(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||pe;let s=r;const i=e.startsWith("update:"),o=i&&Ed(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>be(u)?u.trim():u)),o.number&&(s=r.map(qs)));let a,l=n[a=ai(e)]||n[a=ai(We(e))];!l&&i&&(l=n[a=ai(cr(e))]),l&&gt(l,t,6,s);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,gt(c,t,6,s)}}const Ad=new WeakMap;function Lc(t,e,r=!1){const n=r?Ad:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!Y(t)){const l=c=>{const u=Lc(c,e,!0);u&&(a=!0,Pe(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(ae(t)&&n.set(t,null),null):(q(i)?i.forEach(l=>o[l]=null):Pe(o,i),ae(t)&&n.set(t,o),o)}function Js(t,e){return!t||!Ds(e)?!1:(e=e.slice(2).replace(/Once$/,""),ie(t,e[0].toLowerCase()+e.slice(1))||ie(t,cr(e))||ie(t,e))}function oa(t){const{type:e,vnode:r,proxy:n,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:g,inheritAttrs:y}=t,k=ks(t);let w,_;try{if(r.shapeFlag&4){const x=s||n,D=x;w=Rt(c.call(D,x,u,h,f,d,g)),_=a}else{const x=e;w=Rt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),_=e.props?a:xd(a)}}catch(x){En.length=0,Ws(x,t,1),w=ue(Ve)}let b=w;if(_&&y!==!1){const x=Object.keys(_),{shapeFlag:D}=b;x.length&&D&7&&(i&&x.some(Us)&&(_=Rd(_,i)),b=lr(b,_,!1,!0))}return r.dirs&&(b=lr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&$n(b,r.transition),w=b,ks(k),w}const xd=t=>{let e;for(const r in t)(r==="class"||r==="style"||Ds(r))&&((e||(e={}))[r]=t[r]);return e},Rd=(t,e)=>{const r={};for(const n in t)(!Us(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Cd(t,e,r){const{props:n,children:s,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?aa(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Dc(o,n,d)&&!Js(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?aa(n,o,c):!0:!!o;return!1}function aa(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let s=0;s<n.length;s++){const i=n[s];if(Dc(e,t,i)&&!Js(r,i))return!0}return!1}function Dc(t,e,r){const n=t[r],s=e[r];return r==="style"&&ae(n)&&ae(s)?!nn(n,s):n!==s}function Od({vnode:t,parent:e,suspense:r},n){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===t&&(s.suspense.vnode.el=s.el=n,t=s),s===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const Uc={},Bc=()=>Object.create(Uc),Mc=t=>Object.getPrototypeOf(t)===Uc;function Pd(t,e,r,n=!1){const s={},i=Bc();t.propsDefaults=Object.create(null),Hc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:cc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Id(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=te(s),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Js(t.emitsOptions,d))continue;const f=e[d];if(l)if(ie(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const g=We(d);s[g]=Bi(l,a,g,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Hc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!ie(e,h)&&((u=cr(h))===h||!ie(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Bi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!ie(e,h))&&(delete i[h],c=!0)}c&&Ht(t.attrs,"set","")}function Hc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(vn(l))continue;const c=e[l];let u;s&&ie(s,u=We(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Js(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=te(r),c=a||pe;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Bi(s,l,h,c[h],t,!ie(c,h))}}return o}function Bi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=ie(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Y(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Jn(s);n=c[r]=l.call(null,e),u()}}else n=l;s.ce&&s.ce._setProp(r,n)}o[0]&&(i&&!a?n=!1:o[1]&&(n===""||n===cr(r))&&(n=!0))}return n}const jd=new WeakMap;function qc(t,e,r=!1){const n=r?jd:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!Y(t)){const u=h=>{l=!0;const[d,f]=qc(h,e,!0);Pe(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return ae(t)&&n.set(t,Vr),Vr;if(q(i))for(let u=0;u<i.length;u++){const h=We(i[u]);la(h)&&(o[h]=pe)}else if(i)for(const u in i){const h=We(u);if(la(h)){const d=i[u],f=o[h]=q(d)||Y(d)?{type:d}:Pe({},d),g=f.type;let y=!1,k=!0;if(q(g))for(let w=0;w<g.length;++w){const _=g[w],b=Y(_)&&_.name;if(b==="Boolean"){y=!0;break}else b==="String"&&(k=!1)}else y=Y(g)&&g.name==="Boolean";f[0]=y,f[1]=k,(y||ie(f,"default"))&&a.push(h)}}const c=[o,a];return ae(t)&&n.set(t,c),c}function la(t){return t[0]!=="$"&&!vn(t)}const Eo=t=>t==="_"||t==="_ctx"||t==="$stable",To=t=>q(t)?t.map(Rt):[Rt(t)],$d=(t,e,r)=>{if(e._n)return e;const n=Kr((...s)=>To(e(...s)),r);return n._c=!1,n},Fc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(Eo(s))continue;const i=t[s];if(Y(i))e[s]=$d(s,i,n);else if(i!=null){const o=To(i);e[s]=()=>o}}},Vc=(t,e)=>{const r=To(e);t.slots.default=()=>r},zc=(t,e,r)=>{for(const n in e)(r||!Eo(n))&&(t[n]=e[n])},Nd=(t,e,r)=>{const n=t.slots=Bc();if(t.vnode.shapeFlag&32){const s=e._;s?(zc(n,e,r),r&&ql(n,"_",s,!0)):Fc(e,n)}else e&&Vc(t,e)},Ld=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=pe;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:zc(s,e,r):(i=!e.$stable,Fc(e,s)),o=e}else e&&(Vc(t,e),o={default:1});if(i)for(const a in s)!Eo(a)&&o[a]==null&&delete s[a]},Je=Hd;function Dd(t){return Ud(t)}function Ud(t,e){const r=Fs();r.__VUE__=!0;const{insert:n,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Pt,insertStaticContent:g}=t,y=(p,m,v,S=null,A=null,E=null,j=void 0,P=null,O=!!m.dynamicChildren)=>{if(p===m)return;p&&!_r(p,m)&&(S=T(p),Ke(p,A,E,!0),p=null),m.patchFlag===-2&&(O=!1,m.dynamicChildren=null);const{type:R,ref:K,shapeFlag:L}=m;switch(R){case Ys:k(p,m,v,S);break;case Ve:w(p,m,v,S);break;case gi:p==null&&_(m,v,S,j);break;case Ye:$(p,m,v,S,A,E,j,P,O);break;default:L&1?D(p,m,v,S,A,E,j,P,O):L&6?X(p,m,v,S,A,E,j,P,O):(L&64||L&128)&&R.process(p,m,v,S,A,E,j,P,O,z)}K!=null&&A?wn(K,p&&p.ref,E,m||p,!m):K==null&&p&&p.ref!=null&&wn(p.ref,null,E,p,!0)},k=(p,m,v,S)=>{if(p==null)n(m.el=a(m.children),v,S);else{const A=m.el=p.el;m.children!==p.children&&c(A,m.children)}},w=(p,m,v,S)=>{p==null?n(m.el=l(m.children||""),v,S):m.el=p.el},_=(p,m,v,S)=>{[p.el,p.anchor]=g(p.children,m,v,S,p.el,p.anchor)},b=({el:p,anchor:m},v,S)=>{let A;for(;p&&p!==m;)A=d(p),n(p,v,S),p=A;n(m,v,S)},x=({el:p,anchor:m})=>{let v;for(;p&&p!==m;)v=d(p),s(p),p=v;s(m)},D=(p,m,v,S,A,E,j,P,O)=>{if(m.type==="svg"?j="svg":m.type==="math"&&(j="mathml"),p==null)H(m,v,S,A,E,j,P,O);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),C(p,m,A,E,j,P,O)}finally{R&&R._endPatch()}}},H=(p,m,v,S,A,E,j,P)=>{let O,R;const{props:K,shapeFlag:L,transition:W,dirs:J}=p;if(O=p.el=o(p.type,E,K&&K.is,K),L&8?u(O,p.children):L&16&&F(p.children,O,null,S,A,pi(p,E),j,P),J&&dr(p,null,S,"created"),U(O,p,p.scopeId,j,S),K){for(const de in K)de!=="value"&&!vn(de)&&i(O,de,null,K[de],E,S);"value"in K&&i(O,"value",null,K.value,E),(R=K.onVnodeBeforeMount)&&wt(R,S,p)}J&&dr(p,null,S,"beforeMount");const re=Bd(A,W);re&&W.beforeEnter(O),n(O,m,v),((R=K&&K.onVnodeMounted)||re||J)&&Je(()=>{try{R&&wt(R,S,p),re&&W.enter(O),J&&dr(p,null,S,"mounted")}finally{}},A)},U=(p,m,v,S,A)=>{if(v&&f(p,v),S)for(let E=0;E<S.length;E++)f(p,S[E]);if(A){let E=A.subTree;if(m===E||Jc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const j=A.vnode;U(p,j,j.scopeId,j.slotScopeIds,A.parent)}}},F=(p,m,v,S,A,E,j,P,O=0)=>{for(let R=O;R<p.length;R++){const K=p[R]=P?Mt(p[R]):Rt(p[R]);y(null,K,m,v,S,A,E,j,P)}},C=(p,m,v,S,A,E,j)=>{const P=m.el=p.el;let{patchFlag:O,dynamicChildren:R,dirs:K}=m;O|=p.patchFlag&16;const L=p.props||pe,W=m.props||pe;let J;if(v&&fr(v,!1),(J=W.onVnodeBeforeUpdate)&&wt(J,v,m,p),K&&dr(m,p,v,"beforeUpdate"),v&&fr(v,!0),(L.innerHTML&&W.innerHTML==null||L.textContent&&W.textContent==null)&&u(P,""),R?V(p.dynamicChildren,R,P,v,S,pi(m,A),E):j||ne(p,m,P,null,v,S,pi(m,A),E,!1),O>0){if(O&16)Z(P,L,W,v,A);else if(O&2&&L.class!==W.class&&i(P,"class",null,W.class,A),O&4&&i(P,"style",L.style,W.style,A),O&8){const re=m.dynamicProps;for(let de=0;de<re.length;de++){const ge=re[de],xe=L[ge],je=W[ge];(je!==xe||ge==="value")&&i(P,ge,xe,je,A,v)}}O&1&&p.children!==m.children&&u(P,m.children)}else!j&&R==null&&Z(P,L,W,v,A);((J=W.onVnodeUpdated)||K)&&Je(()=>{J&&wt(J,v,m,p),K&&dr(m,p,v,"updated")},S)},V=(p,m,v,S,A,E,j)=>{for(let P=0;P<m.length;P++){const O=p[P],R=m[P],K=O.el&&(O.type===Ye||!_r(O,R)||O.shapeFlag&198)?h(O.el):v;y(O,R,K,null,S,A,E,j,!0)}},Z=(p,m,v,S,A)=>{if(m!==v){if(m!==pe)for(const E in m)!vn(E)&&!(E in v)&&i(p,E,m[E],null,A,S);for(const E in v){if(vn(E))continue;const j=v[E],P=m[E];j!==P&&E!=="value"&&i(p,E,P,j,A,S)}"value"in v&&i(p,"value",m.value,v.value,A)}},$=(p,m,v,S,A,E,j,P,O)=>{const R=m.el=p?p.el:a(""),K=m.anchor=p?p.anchor:a("");let{patchFlag:L,dynamicChildren:W,slotScopeIds:J}=m;J&&(P=P?P.concat(J):J),p==null?(n(R,v,S),n(K,v,S),F(m.children||[],v,K,A,E,j,P,O)):L>0&&L&64&&W&&p.dynamicChildren&&p.dynamicChildren.length===W.length?(V(p.dynamicChildren,W,v,A,E,j,P),(m.key!=null||A&&m===A.subTree)&&Wc(p,m,!0)):ne(p,m,v,K,A,E,j,P,O)},X=(p,m,v,S,A,E,j,P,O)=>{m.slotScopeIds=P,p==null?m.shapeFlag&512?A.ctx.activate(m,v,S,j,O):Ae(m,v,S,A,E,j,O):Be(p,m,O)},Ae=(p,m,v,S,A,E,j)=>{const P=p.component=Jd(p,S,A);if(Ks(p)&&(P.ctx.renderer=z),Yd(P,!1,j),P.asyncDep){if(A&&A.registerDep(P,he,j),!p.el){const O=P.subTree=ue(Ve);w(null,O,m,v),p.placeholder=O.el}}else he(P,p,m,v,A,E,j)},Be=(p,m,v)=>{const S=m.component=p.component;if(Cd(p,m,v))if(S.asyncDep&&!S.asyncResolved){Q(S,m,v);return}else S.next=m,S.update();else m.el=p.el,S.vnode=m},he=(p,m,v,S,A,E,j)=>{const P=()=>{if(p.isMounted){let{next:L,bu:W,u:J,parent:re,vnode:de}=p;{const bt=Kc(p);if(bt){L&&(L.el=de.el,Q(p,L,j)),bt.asyncDep.then(()=>{Je(()=>{p.isUnmounted||R()},A)});return}}let ge=L,xe;fr(p,!1),L?(L.el=de.el,Q(p,L,j)):L=de,W&&fs(W),(xe=L.props&&L.props.onVnodeBeforeUpdate)&&wt(xe,re,L,de),fr(p,!0);const je=oa(p),vt=p.subTree;p.subTree=je,y(vt,je,h(vt.el),T(vt),p,A,E),L.el=je.el,ge===null&&Od(p,je.el),J&&Je(J,A),(xe=L.props&&L.props.onVnodeUpdated)&&Je(()=>wt(xe,re,L,de),A)}else{let L;const{el:W,props:J}=m,{bm:re,m:de,parent:ge,root:xe,type:je}=p,vt=kn(m);fr(p,!1),re&&fs(re),!vt&&(L=J&&J.onVnodeBeforeMount)&&wt(L,ge,m),fr(p,!0);{xe.ce&&xe.ce._hasShadowRoot()&&xe.ce._injectChildStyle(je,p.parent?p.parent.type:void 0);const bt=p.subTree=oa(p);y(null,bt,v,S,p,A,E),m.el=bt.el}if(de&&Je(de,A),!vt&&(L=J&&J.onVnodeMounted)){const bt=m;Je(()=>wt(L,ge,bt),A)}(m.shapeFlag&256||ge&&kn(ge.vnode)&&ge.vnode.shapeFlag&256)&&p.a&&Je(p.a,A),p.isMounted=!0,m=v=S=null}};p.scope.on();const O=p.effect=new Jl(P);p.scope.off();const R=p.update=O.run.bind(O),K=p.job=O.runIfDirty.bind(O);K.i=p,K.id=p.uid,O.scheduler=()=>ko(K),fr(p,!0),R()},Q=(p,m,v)=>{m.component=p;const S=p.vnode.props;p.vnode=m,p.next=null,Id(p,m.props,S,v),Ld(p,m.children,v),Gt(),Yo(p),Jt()},ne=(p,m,v,S,A,E,j,P,O=!1)=>{const R=p&&p.children,K=p?p.shapeFlag:0,L=m.children,{patchFlag:W,shapeFlag:J}=m;if(W>0){if(W&128){Xt(R,L,v,S,A,E,j,P,O);return}else if(W&256){It(R,L,v,S,A,E,j,P,O);return}}J&8?(K&16&&st(R,A,E),L!==R&&u(v,L)):K&16?J&16?Xt(R,L,v,S,A,E,j,P,O):st(R,A,E,!0):(K&8&&u(v,""),J&16&&F(L,v,S,A,E,j,P,O))},It=(p,m,v,S,A,E,j,P,O)=>{p=p||Vr,m=m||Vr;const R=p.length,K=m.length,L=Math.min(R,K);let W;for(W=0;W<L;W++){const J=m[W]=O?Mt(m[W]):Rt(m[W]);y(p[W],J,v,null,A,E,j,P,O)}R>K?st(p,A,E,!0,!1,L):F(m,v,S,A,E,j,P,O,L)},Xt=(p,m,v,S,A,E,j,P,O)=>{let R=0;const K=m.length;let L=p.length-1,W=K-1;for(;R<=L&&R<=W;){const J=p[R],re=m[R]=O?Mt(m[R]):Rt(m[R]);if(_r(J,re))y(J,re,v,null,A,E,j,P,O);else break;R++}for(;R<=L&&R<=W;){const J=p[L],re=m[W]=O?Mt(m[W]):Rt(m[W]);if(_r(J,re))y(J,re,v,null,A,E,j,P,O);else break;L--,W--}if(R>L){if(R<=W){const J=W+1,re=J<K?m[J].el:S;for(;R<=W;)y(null,m[R]=O?Mt(m[R]):Rt(m[R]),v,re,A,E,j,P,O),R++}}else if(R>W)for(;R<=L;)Ke(p[R],A,E,!0),R++;else{const J=R,re=R,de=new Map;for(R=re;R<=W;R++){const Ze=m[R]=O?Mt(m[R]):Rt(m[R]);Ze.key!=null&&de.set(Ze.key,R)}let ge,xe=0;const je=W-re+1;let vt=!1,bt=0;const on=new Array(je);for(R=0;R<je;R++)on[R]=0;for(R=J;R<=L;R++){const Ze=p[R];if(xe>=je){Ke(Ze,A,E,!0);continue}let _t;if(Ze.key!=null)_t=de.get(Ze.key);else for(ge=re;ge<=W;ge++)if(on[ge-re]===0&&_r(Ze,m[ge])){_t=ge;break}_t===void 0?Ke(Ze,A,E,!0):(on[_t-re]=R+1,_t>=bt?bt=_t:vt=!0,y(Ze,m[_t],v,null,A,E,j,P,O),xe++)}const qo=vt?Md(on):Vr;for(ge=qo.length-1,R=je-1;R>=0;R--){const Ze=re+R,_t=m[Ze],Fo=m[Ze+1],Vo=Ze+1<K?Fo.el||Gc(Fo):S;on[R]===0?y(null,_t,v,Vo,A,E,j,P,O):vt&&(ge<0||R!==qo[ge]?yt(_t,v,Vo,2):ge--)}}},yt=(p,m,v,S,A=null)=>{const{el:E,type:j,transition:P,children:O,shapeFlag:R}=p;if(R&6){yt(p.component.subTree,m,v,S);return}if(R&128){p.suspense.move(m,v,S);return}if(R&64){j.move(p,m,v,z);return}if(j===Ye){n(E,m,v);for(let L=0;L<O.length;L++)yt(O[L],m,v,S);n(p.anchor,m,v);return}if(j===gi){b(p,m,v);return}if(S!==2&&R&1&&P)if(S===0)P.beforeEnter(E),n(E,m,v),Je(()=>P.enter(E),A);else{const{leave:L,delayLeave:W,afterLeave:J}=P,re=()=>{p.ctx.isUnmounted?s(E):n(E,m,v)},de=()=>{E._isLeaving&&E[Tt](!0),L(E,()=>{re(),J&&J()})};W?W(E,re,de):de()}else n(E,m,v)},Ke=(p,m,v,S=!1,A=!1)=>{const{type:E,props:j,ref:P,children:O,dynamicChildren:R,shapeFlag:K,patchFlag:L,dirs:W,cacheIndex:J,memo:re}=p;if(L===-2&&(A=!1),P!=null&&(Gt(),wn(P,null,v,p,!0),Jt()),J!=null&&(m.renderCache[J]=void 0),K&256){m.ctx.deactivate(p);return}const de=K&1&&W,ge=!kn(p);let xe;if(ge&&(xe=j&&j.onVnodeBeforeUnmount)&&wt(xe,m,p),K&6)hr(p.component,v,S);else{if(K&128){p.suspense.unmount(v,S);return}de&&dr(p,null,m,"beforeUnmount"),K&64?p.type.remove(p,m,v,z,S):R&&!R.hasOnce&&(E!==Ye||L>0&&L&64)?st(R,m,v,!1,!0):(E===Ye&&L&384||!A&&K&16)&&st(O,m,v),S&&Rr(p)}const je=re!=null&&J==null;(ge&&(xe=j&&j.onVnodeUnmounted)||de||je)&&Je(()=>{xe&&wt(xe,m,p),de&&dr(p,null,m,"unmounted"),je&&(p.el=null)},v)},Rr=p=>{const{type:m,el:v,anchor:S,transition:A}=p;if(m===Ye){Cr(v,S);return}if(m===gi){x(p);return}const E=()=>{s(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(p.shapeFlag&1&&A&&!A.persisted){const{leave:j,delayLeave:P}=A,O=()=>j(v,E);P?P(p.el,E,O):O()}else E()},Cr=(p,m)=>{let v;for(;p!==m;)v=d(p),s(p),p=v;s(m)},hr=(p,m,v)=>{const{bum:S,scope:A,job:E,subTree:j,um:P,m:O,a:R}=p;ca(O),ca(R),S&&fs(S),A.stop(),E&&(E.flags|=8,Ke(j,p,m,v)),P&&Je(P,m),Je(()=>{p.isUnmounted=!0},m)},st=(p,m,v,S=!1,A=!1,E=0)=>{for(let j=E;j<p.length;j++)Ke(p[j],m,v,S,A)},T=p=>{if(p.shapeFlag&6)return T(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const m=d(p.anchor||p.el),v=m&&m[rd];return v?d(v):m};let B=!1;const N=(p,m,v)=>{let S;p==null?m._vnode&&(Ke(m._vnode,null,null,!0),S=m._vnode.component):y(m._vnode||null,p,m,null,null,null,v),m._vnode=p,B||(B=!0,Yo(S),pc(),B=!1)},z={p:y,um:Ke,m:yt,r:Rr,mt:Ae,mc:F,pc:ne,pbc:V,n:T,o:t};return{render:N,hydrate:void 0,createApp:Sd(N)}}function pi({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function fr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Bd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Wc(t,e,r=!1){const n=t.children,s=e.children;if(q(n)&&q(s))for(let i=0;i<n.length;i++){const o=n[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Mt(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Wc(o,a)),a.type===Ys&&(a.patchFlag===-1&&(a=s[i]=Mt(a)),a.el=o.el),a.type===Ve&&!a.el&&(a.el=o.el)}}function Md(t){const e=t.slice(),r=[0];let n,s,i,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(s=r[r.length-1],t[s]<c){e[n]=s,r.push(n);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Kc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Kc(e)}function ca(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Gc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Gc(e.subTree):null}const Jc=t=>t.__isSuspense;function Hd(t,e){e&&e.pendingBranch?q(t)?e.effects.push(...t):e.effects.push(t):Yh(t)}const Ye=Symbol.for("v-fgt"),Ys=Symbol.for("v-txt"),Ve=Symbol.for("v-cmt"),gi=Symbol.for("v-stc"),En=[];let rt=null;function oe(t=!1){En.push(rt=t?null:[])}function qd(){En.pop(),rt=En[En.length-1]||null}let Nn=1;function Ts(t,e=!1){Nn+=t,t<0&&rt&&e&&(rt.hasOnce=!0)}function Yc(t){return t.dynamicChildren=Nn>0?rt||Vr:null,qd(),Nn>0&&rt&&rt.push(t),t}function Ee(t,e,r,n,s,i){return Yc(ve(t,e,r,n,s,i,!0))}function Wt(t,e,r,n,s){return Yc(ue(t,e,r,n,s,!0))}function As(t){return t?t.__v_isVNode===!0:!1}function _r(t,e){return t.type===e.type&&t.key===e.key}const Qc=({key:t})=>t??null,ms=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?be(t)||Se(t)||Y(t)?{i:tt,r:t,k:e,f:!!r}:t:null);function ve(t,e=null,r=null,n=0,s=null,i=t===Ye?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Qc(e),ref:e&&ms(e),scopeId:mc,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:tt};return a?(Ao(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=be(r)?8:16),Nn>0&&!o&&rt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&rt.push(l),l}const ue=Fd;function Fd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===Pc)&&(t=Ve),As(t)){const a=lr(t,e,!0);return r&&Ao(a,r),Nn>0&&!i&&rt&&(a.shapeFlag&6?rt[rt.indexOf(t)]=a:rt.push(a)),a.patchFlag=-2,a}if(tf(t)&&(t=t.__vccOpts),e){e=Vd(e);let{class:a,style:l}=e;a&&!be(a)&&(e.class=at(a)),ae(l)&&(zs(l)&&!q(l)&&(l=Pe({},l)),e.style=fo(l))}const o=be(t)?1:Jc(t)?128:bc(t)?64:ae(t)?4:Y(t)?2:0;return ve(t,e,r,n,s,o,i,!0)}function Vd(t){return t?zs(t)||Mc(t)?Pe({},t):t:null}function lr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Wd(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Qc(c),ref:e&&e.ref?r&&i?q(i)?i.concat(ms(e)):[i,ms(e)]:ms(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ye?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&lr(t.ssContent),ssFallback:t.ssFallback&&lr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&$n(u,l.clone(u)),u}function zd(t=" ",e=0){return ue(Ys,null,t,e)}function Qe(t="",e=!1){return e?(oe(),Wt(Ve,null,t)):ue(Ve,null,t)}function Rt(t){return t==null||typeof t=="boolean"?ue(Ve):q(t)?ue(Ye,null,t.slice()):As(t)?Mt(t):ue(Ys,null,String(t))}function Mt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:lr(t)}function Ao(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(q(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Ao(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Mc(e)?e._ctx=tt:s===3&&tt&&(tt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:tt},r=32):(e=String(e),n&64?(r=16,e=[zd(e)]):r=8);t.children=e,t.shapeFlag|=r}function Wd(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const s in n)if(s==="class")e.class!==n.class&&(e.class=at([e.class,n.class]));else if(s==="style")e.style=fo([e.style,n.style]);else if(Ds(s)){const i=e[s],o=n[s];o&&i!==o&&!(q(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Us(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function wt(t,e,r,n=null){gt(t,e,7,[r,n])}const Kd=Nc();let Gd=0;function Jd(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||Kd,i={uid:Gd++,vnode:t,type:n,parent:e,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:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:qc(n,s),emitsOptions:Lc(n,s),emit:null,emitted:null,propsDefaults:pe,inheritAttrs:n.inheritAttrs,ctx:pe,data:pe,props:pe,attrs:pe,slots:pe,refs:pe,setupState:pe,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Td.bind(null,i),t.ce&&t.ce(i),i}let De=null;const xo=()=>De||tt;let xs,Mi;{const t=Fs(),e=(r,n)=>{let s;return(s=t[r])||(s=t[r]=[]),s.push(n),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};xs=e("__VUE_INSTANCE_SETTERS__",r=>De=r),Mi=e("__VUE_SSR_SETTERS__",r=>Ln=r)}const Jn=t=>{const e=De;return xs(t),t.scope.on(),()=>{t.scope.off(),xs(e)}},ua=()=>{De&&De.scope.off(),xs(null)};function Zc(t){return t.vnode.shapeFlag&4}let Ln=!1;function Yd(t,e=!1,r=!1){e&&Mi(e);const{props:n,children:s}=t.vnode,i=Zc(t);Pd(t,n,i,e),Nd(t,s,r||e);const o=i?Qd(t,e):void 0;return e&&Mi(!1),o}function Qd(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,md);const{setup:n}=r;if(n){Gt();const s=t.setupContext=n.length>1?Xd(t):null,i=Jn(t),o=Gn(n,t,0,[t.props,s]),a=Bl(o);if(Jt(),i(),(a||t.sp)&&!kn(t)&&Tc(t),a){if(o.then(ua,ua),e)return o.then(l=>{ha(t,l)}).catch(l=>{Ws(l,t,0)});t.asyncDep=o}else ha(t,o)}else Xc(t)}function ha(t,e,r){Y(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ae(e)&&(t.setupState=hc(e)),Xc(t)}function Xc(t,e,r){const n=t.type;t.render||(t.render=n.render||Pt);{const s=Jn(t);Gt();try{yd(t)}finally{Jt(),s()}}}const Zd={get(t,e){return Le(t,"get",""),t[e]}};function Xd(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Zd),slots:t.slots,emit:t.emit,expose:e}}function Qs(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(hc(wo(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in Sn)return Sn[r](t)},has(e,r){return r in e||r in Sn}})):t.proxy}function ef(t,e=!0){return Y(t)?t.displayName||t.name:t.name||e&&t.__name}function tf(t){return Y(t)&&"__vccOpts"in t}const Ue=(t,e)=>zh(t,e,Ln);function Qr(t,e,r){try{Ts(-1);const n=arguments.length;return n===2?ae(e)&&!q(e)?As(e)?ue(t,null,[e]):ue(t,e):ue(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&As(r)&&(r=[r]),ue(t,e,r))}finally{Ts(1)}}const rf="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 zi;const ma=typeof window<"u"&&window.trustedTypes;if(ma)try{zi=ma.createPolicy("vue",{createHTML:t=>t})}catch{}const su=zi?t=>zi.createHTML(t):t=>t,af="http://www.w3.org/2000/svg",lf="http://www.w3.org/1998/Math/MathML",Dt=typeof document<"u"?document:null,ya=Dt&&Dt.createElement("template"),cf={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const s=e==="svg"?Dt.createElementNS(af,t):e==="mathml"?Dt.createElementNS(lf,t):r?Dt.createElement(t,{is:r}):Dt.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Dt.createTextNode(t),createComment:t=>Dt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Dt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,s,i){const o=r?r.previousSibling:e.lastChild;if(s&&(s===i||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),r),!(s===i||!(s=s.nextSibling)););else{ya.innerHTML=su(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=ya.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[o?o.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},tr="transition",dn="animation",Mn=Symbol("_vtc"),iu={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},uf=Pe({},Ec,iu),hf=t=>(t.displayName="Transition",t.props=uf,t),df=hf((t,{slots:e})=>en(ld,ff(t),e)),mr=(t,e=[])=>{q(t)?t.forEach(r=>r(...e)):t&&t(...e)},va=t=>t?q(t)?t.some(e=>e.length>1):t.length>1:!1;function ff(t){const e={};for(const N in t)N in iu||(e[N]=t[N]);if(t.css===!1)return e;const{name:r="v",type:n,duration:s,enterFromClass:i=`${r}-enter-from`,enterActiveClass:o=`${r}-enter-active`,enterToClass:a=`${r}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${r}-leave-from`,leaveActiveClass:d=`${r}-leave-active`,leaveToClass:f=`${r}-leave-to`}=t,g=pf(s),y=g&&g[0],S=g&&g[1],{onBeforeEnter:w,onEnter:b,onEnterCancelled:_,onLeave:x,onLeaveCancelled:B,onBeforeAppear:H=w,onAppear:M=b,onAppearCancelled:G=_}=e,C=(N,Q,Ae,Be)=>{N._enterCancelled=Be,yr(N,Q?u:a),yr(N,Q?c:o),Ae&&Ae()},J=(N,Q)=>{N._isLeaving=!1,yr(N,h),yr(N,f),yr(N,d),Q&&Q()},ee=N=>(Q,Ae)=>{const Be=N?M:b,he=()=>C(Q,N,Ae);mr(Be,[Q,he]),ba(()=>{yr(Q,N?l:i),jt(Q,N?u:a),va(Be)||_a(Q,n,y,he)})};return Pe(e,{onBeforeEnter(N){mr(w,[N]),jt(N,i),jt(N,o)},onBeforeAppear(N){mr(H,[N]),jt(N,l),jt(N,c)},onEnter:ee(!1),onAppear:ee(!0),onLeave(N,Q){N._isLeaving=!0;const Ae=()=>J(N,Q);jt(N,h),N._enterCancelled?(jt(N,d),Sa(N)):(Sa(N),jt(N,d)),ba(()=>{N._isLeaving&&(yr(N,h),jt(N,f),va(x)||_a(N,n,S,Ae))}),mr(x,[N,Ae])},onEnterCancelled(N){C(N,!1,void 0,!0),mr(_,[N])},onAppearCancelled(N){C(N,!0,void 0,!0),mr(G,[N])},onLeaveCancelled(N){J(N),mr(B,[N])}})}function pf(t){if(t==null)return null;if(ae(t))return[_i(t.enter),_i(t.leave)];{const e=_i(t);return[e,e]}}function _i(t){return fh(t)}function jt(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Mn]||(t[Mn]=new Set)).add(e)}function yr(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Mn];r&&(r.delete(e),r.size||(t[Mn]=void 0))}function ba(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let gf=0;function _a(t,e,r,n){const s=t._endId=++gf,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=mf(t,e);if(!o)return n();const c=o+"end";let u=0;const h=()=>{t.removeEventListener(c,d),i()},d=f=>{f.target===t&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),t.addEventListener(c,d)}function mf(t,e){const r=window.getComputedStyle(t),n=g=>(r[g]||"").split(", "),s=n(`${tr}Delay`),i=n(`${tr}Duration`),o=wa(s,i),a=n(`${dn}Delay`),l=n(`${dn}Duration`),c=wa(a,l);let u=null,h=0,d=0;e===tr?o>0&&(u=tr,h=o,d=i.length):e===dn?c>0&&(u=dn,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?tr:dn:null,d=u?u===tr?i.length:l.length:0);const f=u===tr&&/\b(?:transform|all)(?:,|$)/.test(n(`${tr}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function wa(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>ka(r)+ka(t[n])))}function ka(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function Sa(t){return(t?t.ownerDocument:document).body.offsetHeight}function yf(t,e,r){const n=t[Mn];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const Ea=Symbol("_vod"),vf=Symbol("_vsh"),bf=Symbol(""),_f=/(?:^|;)\s*display\s*:/;function wf(t,e,r){const n=t.style,s=be(r);let i=!1;if(r&&!s){if(e)if(be(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&vn(n,a,"")}else for(const o in e)r[o]==null&&vn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?Sf(t,o,!be(e)&&e?e[o]:void 0,a)||vn(n,o,a):vn(n,o,"")}}else if(s){if(e!==r){const o=n[bf];o&&(r+=";"+o),n.cssText=r,i=_f.test(r)}}else e&&t.removeAttribute("style");Ea in t&&(t[Ea]=i?n.display:"",t[vf]&&(n.display="none"))}const Ta=/\s*!important$/;function vn(t,e,r){if(q(r))r.forEach(n=>vn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=kf(t,e);Ta.test(r)?t.setProperty(hr(n),r.replace(Ta,""),"important"):t[n]=r}}const Aa=["Webkit","Moz","ms"],wi={};function kf(t,e){const r=wi[e];if(r)return r;let n=Ke(e);if(n!=="filter"&&n in t)return wi[e]=n;n=Vs(n);for(let s=0;s<Aa.length;s++){const i=Aa[s]+n;if(i in t)return wi[e]=i}return e}function Sf(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&be(n)&&r===n}const xa="http://www.w3.org/1999/xlink";function Ra(t,e,r,n,s,i=bh(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(xa,e.slice(6,e.length)):t.setAttributeNS(xa,e,r):r==null||i&&!Wl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":ct(r)?String(r):r)}function Ca(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?su(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let o=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=Wl(r):r==null&&a==="string"?(r="",o=!0):a==="number"&&(r=0,o=!0)}try{t[e]=r}catch{}o&&t.removeAttribute(s||e)}function or(t,e,r,n){t.addEventListener(e,r,n)}function Ef(t,e,r,n){t.removeEventListener(e,r,n)}const Oa=Symbol("_vei");function Tf(t,e,r,n,s=null){const i=t[Oa]||(t[Oa]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Af(e);if(n){const c=i[e]=Cf(n,s);or(t,a,c,l)}else o&&(Ef(t,a,o,l),i[e]=void 0)}}const Pa=/(?:Once|Passive|Capture)$/;function Af(t){let e;if(Pa.test(t)){e={};let n;for(;n=t.match(Pa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):hr(t.slice(2)),e]}let ki=0;const xf=Promise.resolve(),Rf=()=>ki||(xf.then(()=>ki=0),ki=Date.now());function Cf(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;gt(Of(n,r.value),e,5,[n])};return r.value=t,r.attached=Rf(),r}function Of(t,e){if(q(e)){const r=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{r.call(t),t._stopped=!0},e.map(n=>s=>!s._stopped&&n&&n(s))}else return e}const Ia=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Pf=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?yf(t,n,o):e==="style"?wf(t,r,n):Ms(e)?Hs(e)||Tf(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):If(t,e,n,o))?(Ca(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ra(t,e,n,o,i,e!=="value")):t._isVueCE&&($f(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!be(n)))?Ca(t,Ke(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),Ra(t,e,n,o))};function If(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ia(e)&&Y(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ia(e)&&be(r)?!1:e in t}function $f(t,e){const r=t._def.props;if(!r)return!1;const n=Ke(e);return Array.isArray(r)?r.some(s=>Ke(s)===n):Object.keys(r).some(s=>Ke(s)===n)}const tn=t=>{const e=t.props["onUpdate:modelValue"]||!1;return q(e)?r=>gs(e,r):e};function jf(t){t.target.composing=!0}function $a(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Wt=Symbol("_assign");function ja(t,e,r){return e&&(t=t.trim()),r&&(t=zs(t)),t}const Nf={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Wt]=tn(s);const i=n||s.props&&s.props.type==="number";or(t,e?"change":"input",o=>{o.target.composing||t[Wt](ja(t.value,r,i))}),(r||i)&&or(t,"change",()=>{t.value=ja(t.value,r,i)}),e||(or(t,"compositionstart",jf),or(t,"compositionend",$a),or(t,"change",$a))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Wt]=tn(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?zs(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(n&&e===r||s&&t.value.trim()===l)||(t.value=l)}},Vb={deep:!0,created(t,e,r){t[Wt]=tn(r),or(t,"change",()=>{const n=t._modelValue,s=Hn(t),i=t.checked,o=t[Wt];if(q(n)){const a=vo(n,s),l=a!==-1;if(i&&!l)o(n.concat(s));else if(!i&&l){const c=[...n];c.splice(a,1),o(c)}}else if(on(n)){const a=new Set(n);i?a.add(s):a.delete(s),o(a)}else o(ou(t,i))})},mounted:Na,beforeUpdate(t,e,r){t[Wt]=tn(r),Na(t,e,r)}};function Na(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(q(e))s=vo(e,n.props.value)>-1;else if(on(e))s=e.has(n.props.value);else{if(e===r)return;s=an(e,ou(t,!0))}t.checked!==s&&(t.checked=s)}const zb={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=on(e);or(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?zs(Hn(o)):Hn(o));t[Wt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,Xr(()=>{t._assigning=!1})}),t[Wt]=tn(n)},mounted(t,{value:e}){La(t,e)},beforeUpdate(t,e,r){t[Wt]=tn(r)},updated(t,{value:e}){t._assigning||La(t,e)}};function La(t,e){const r=t.multiple,n=q(e);if(!(r&&!n&&!on(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=Hn(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=vo(e,a)>-1}else o.selected=e.has(a);else if(an(Hn(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Hn(t){return"_value"in t?t._value:t.value}function ou(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const Lf=["ctrl","shift","alt","meta"],Df={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Lf.some(r=>t[`${r}Key`]&&!e.includes(r))},Kb=(t,e)=>{if(!t)return t;const r=t._withMods||(t._withMods={}),n=e.join(".");return r[n]||(r[n]=((s,...i)=>{for(let o=0;o<e.length;o++){const a=Df[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Uf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Wb=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=hr(s.key);if(e.some(o=>o===i||Uf[o]===i))return t(s)}))},Bf=Pe({patchProp:Pf},cf);let Da;function Mf(){return Da||(Da=Md(Bf))}const Hf=((...t)=>{const e=Mf().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=Ff(n);if(!s)return;const i=e._component;!Y(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,qf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function qf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ff(t){return be(t)?document.querySelector(t):t}/*!
18
+ **/let Hi;const da=typeof window<"u"&&window.trustedTypes;if(da)try{Hi=da.createPolicy("vue",{createHTML:t=>t})}catch{}const eu=Hi?t=>Hi.createHTML(t):t=>t,nf="http://www.w3.org/2000/svg",sf="http://www.w3.org/1998/Math/MathML",Dt=typeof document<"u"?document:null,fa=Dt&&Dt.createElement("template"),of={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const s=e==="svg"?Dt.createElementNS(nf,t):e==="mathml"?Dt.createElementNS(sf,t):r?Dt.createElement(t,{is:r}):Dt.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Dt.createTextNode(t),createComment:t=>Dt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Dt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,s,i){const o=r?r.previousSibling:e.lastChild;if(s&&(s===i||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),r),!(s===i||!(s=s.nextSibling)););else{fa.innerHTML=eu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=fa.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[o?o.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},er="transition",cn="animation",Dn=Symbol("_vtc"),tu={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},af=Pe({},_c,tu),lf=t=>(t.displayName="Transition",t.props=af,t),cf=lf((t,{slots:e})=>Qr(id,uf(t),e)),pr=(t,e=[])=>{q(t)?t.forEach(r=>r(...e)):t&&t(...e)},pa=t=>t?q(t)?t.some(e=>e.length>1):t.length>1:!1;function uf(t){const e={};for(const $ in t)$ in tu||(e[$]=t[$]);if(t.css===!1)return e;const{name:r="v",type:n,duration:s,enterFromClass:i=`${r}-enter-from`,enterActiveClass:o=`${r}-enter-active`,enterToClass:a=`${r}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${r}-leave-from`,leaveActiveClass:d=`${r}-leave-active`,leaveToClass:f=`${r}-leave-to`}=t,g=hf(s),y=g&&g[0],k=g&&g[1],{onBeforeEnter:w,onEnter:_,onEnterCancelled:b,onLeave:x,onLeaveCancelled:D,onBeforeAppear:H=w,onAppear:U=_,onAppearCancelled:F=b}=e,C=($,X,Ae,Be)=>{$._enterCancelled=Be,gr($,X?u:a),gr($,X?c:o),Ae&&Ae()},V=($,X)=>{$._isLeaving=!1,gr($,h),gr($,f),gr($,d),X&&X()},Z=$=>(X,Ae)=>{const Be=$?U:_,he=()=>C(X,$,Ae);pr(Be,[X,he]),ga(()=>{gr(X,$?l:i),$t(X,$?u:a),pa(Be)||ma(X,n,y,he)})};return Pe(e,{onBeforeEnter($){pr(w,[$]),$t($,i),$t($,o)},onBeforeAppear($){pr(H,[$]),$t($,l),$t($,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave($,X){$._isLeaving=!0;const Ae=()=>V($,X);$t($,h),$._enterCancelled?($t($,d),ba($)):(ba($),$t($,d)),ga(()=>{$._isLeaving&&(gr($,h),$t($,f),pa(x)||ma($,n,k,Ae))}),pr(x,[$,Ae])},onEnterCancelled($){C($,!1,void 0,!0),pr(b,[$])},onAppearCancelled($){C($,!0,void 0,!0),pr(F,[$])},onLeaveCancelled($){V($),pr(D,[$])}})}function hf(t){if(t==null)return null;if(ae(t))return[mi(t.enter),mi(t.leave)];{const e=mi(t);return[e,e]}}function mi(t){return uh(t)}function $t(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Dn]||(t[Dn]=new Set)).add(e)}function gr(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Dn];r&&(r.delete(e),r.size||(t[Dn]=void 0))}function ga(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let df=0;function ma(t,e,r,n){const s=t._endId=++df,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=ff(t,e);if(!o)return n();const c=o+"end";let u=0;const h=()=>{t.removeEventListener(c,d),i()},d=f=>{f.target===t&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),t.addEventListener(c,d)}function ff(t,e){const r=window.getComputedStyle(t),n=g=>(r[g]||"").split(", "),s=n(`${er}Delay`),i=n(`${er}Duration`),o=ya(s,i),a=n(`${cn}Delay`),l=n(`${cn}Duration`),c=ya(a,l);let u=null,h=0,d=0;e===er?o>0&&(u=er,h=o,d=i.length):e===cn?c>0&&(u=cn,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?er:cn:null,d=u?u===er?i.length:l.length:0);const f=u===er&&/\b(?:transform|all)(?:,|$)/.test(n(`${er}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ya(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>va(r)+va(t[n])))}function va(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function ba(t){return(t?t.ownerDocument:document).body.offsetHeight}function pf(t,e,r){const n=t[Dn];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const _a=Symbol("_vod"),gf=Symbol("_vsh"),mf=Symbol(""),yf=/(?:^|;)\s*display\s*:/;function vf(t,e,r){const n=t.style,s=be(r);let i=!1;if(r&&!s){if(e)if(be(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&gn(n,a,"")}else for(const o in e)r[o]==null&&gn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?_f(t,o,!be(e)&&e?e[o]:void 0,a)||gn(n,o,a):gn(n,o,"")}}else if(s){if(e!==r){const o=n[mf];o&&(r+=";"+o),n.cssText=r,i=yf.test(r)}}else e&&t.removeAttribute("style");_a in t&&(t[_a]=i?n.display:"",t[gf]&&(n.display="none"))}const wa=/\s*!important$/;function gn(t,e,r){if(q(r))r.forEach(n=>gn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=bf(t,e);wa.test(r)?t.setProperty(cr(n),r.replace(wa,""),"important"):t[n]=r}}const ka=["Webkit","Moz","ms"],yi={};function bf(t,e){const r=yi[e];if(r)return r;let n=We(e);if(n!=="filter"&&n in t)return yi[e]=n;n=Hs(n);for(let s=0;s<ka.length;s++){const i=ka[s]+n;if(i in t)return yi[e]=i}return e}function _f(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&be(n)&&r===n}const Sa="http://www.w3.org/1999/xlink";function Ea(t,e,r,n,s,i=mh(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(Sa,e.slice(6,e.length)):t.setAttributeNS(Sa,e,r):r==null||i&&!Fl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":ct(r)?String(r):r)}function Ta(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?eu(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let o=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=Fl(r):r==null&&a==="string"?(r="",o=!0):a==="number"&&(r=0,o=!0)}try{t[e]=r}catch{}o&&t.removeAttribute(s||e)}function ir(t,e,r,n){t.addEventListener(e,r,n)}function wf(t,e,r,n){t.removeEventListener(e,r,n)}const Aa=Symbol("_vei");function kf(t,e,r,n,s=null){const i=t[Aa]||(t[Aa]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Sf(e);if(n){const c=i[e]=Af(n,s);ir(t,a,c,l)}else o&&(wf(t,a,o,l),i[e]=void 0)}}const xa=/(?:Once|Passive|Capture)$/;function Sf(t){let e;if(xa.test(t)){e={};let n;for(;n=t.match(xa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):cr(t.slice(2)),e]}let vi=0;const Ef=Promise.resolve(),Tf=()=>vi||(Ef.then(()=>vi=0),vi=Date.now());function Af(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;gt(xf(n,r.value),e,5,[n])};return r.value=t,r.attached=Tf(),r}function xf(t,e){if(q(e)){const r=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{r.call(t),t._stopped=!0},e.map(n=>s=>!s._stopped&&n&&n(s))}else return e}const Ra=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Rf=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?pf(t,n,o):e==="style"?vf(t,r,n):Ds(e)?Us(e)||kf(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Cf(t,e,n,o))?(Ta(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ea(t,e,n,o,i,e!=="value")):t._isVueCE&&(Of(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!be(n)))?Ta(t,We(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),Ea(t,e,n,o))};function Cf(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ra(e)&&Y(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ra(e)&&be(r)?!1:e in t}function Of(t,e){const r=t._def.props;if(!r)return!1;const n=We(e);return Array.isArray(r)?r.some(s=>We(s)===n):Object.keys(r).some(s=>We(s)===n)}const Zr=t=>{const e=t.props["onUpdate:modelValue"]||!1;return q(e)?r=>fs(e,r):e};function Pf(t){t.target.composing=!0}function Ca(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Kt=Symbol("_assign");function Oa(t,e,r){return e&&(t=t.trim()),r&&(t=qs(t)),t}const If={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Kt]=Zr(s);const i=n||s.props&&s.props.type==="number";ir(t,e?"change":"input",o=>{o.target.composing||t[Kt](Oa(t.value,r,i))}),(r||i)&&ir(t,"change",()=>{t.value=Oa(t.value,r,i)}),e||(ir(t,"compositionstart",Pf),ir(t,"compositionend",Ca),ir(t,"change",Ca))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Kt]=Zr(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?qs(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(n&&e===r||s&&t.value.trim()===l)||(t.value=l)}},Hb={deep:!0,created(t,e,r){t[Kt]=Zr(r),ir(t,"change",()=>{const n=t._modelValue,s=Un(t),i=t.checked,o=t[Kt];if(q(n)){const a=po(n,s),l=a!==-1;if(i&&!l)o(n.concat(s));else if(!i&&l){const c=[...n];c.splice(a,1),o(c)}}else if(rn(n)){const a=new Set(n);i?a.add(s):a.delete(s),o(a)}else o(ru(t,i))})},mounted:Pa,beforeUpdate(t,e,r){t[Kt]=Zr(r),Pa(t,e,r)}};function Pa(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(q(e))s=po(e,n.props.value)>-1;else if(rn(e))s=e.has(n.props.value);else{if(e===r)return;s=nn(e,ru(t,!0))}t.checked!==s&&(t.checked=s)}const qb={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=rn(e);ir(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?qs(Un(o)):Un(o));t[Kt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,Yr(()=>{t._assigning=!1})}),t[Kt]=Zr(n)},mounted(t,{value:e}){Ia(t,e)},beforeUpdate(t,e,r){t[Kt]=Zr(r)},updated(t,{value:e}){t._assigning||Ia(t,e)}};function Ia(t,e){const r=t.multiple,n=q(e);if(!(r&&!n&&!rn(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=Un(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=po(e,a)>-1}else o.selected=e.has(a);else if(nn(Un(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Un(t){return"_value"in t?t._value:t.value}function ru(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const jf=["ctrl","shift","alt","meta"],$f={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>jf.some(r=>t[`${r}Key`]&&!e.includes(r))},Fb=(t,e)=>{if(!t)return t;const r=t._withMods||(t._withMods={}),n=e.join(".");return r[n]||(r[n]=((s,...i)=>{for(let o=0;o<e.length;o++){const a=$f[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Nf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Vb=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=cr(s.key);if(e.some(o=>o===i||Nf[o]===i))return t(s)}))},Lf=Pe({patchProp:Rf},of);let ja;function Df(){return ja||(ja=Dd(Lf))}const Uf=((...t)=>{const e=Df().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=Mf(n);if(!s)return;const i=e._component;!Y(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,Bf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function Bf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Mf(t){return be(t)?document.querySelector(t):t}/*!
19
19
  * pinia v3.0.4
20
20
  * (c) 2025 Eduardo San Martin Morote
21
21
  * @license MIT
22
- */let au;const ti=t=>au=t,lu=Symbol();function Ki(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Rn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Rn||(Rn={}));function Vf(){const t=Zl(!0),e=t.run(()=>et({}));let r=[],n=[];const s=To({install(i){ti(s),s._a=i,i.provide(lu,s),i.config.globalProperties.$pinia=s,n.forEach(o=>r.push(o)),n=[]},use(i){return this._a?r.push(i):n.push(i),this},_p:r,_a:null,_e:t,_s:new Map,state:e});return s}const cu=()=>{};function Ua(t,e,r,n=cu){t.add(e);const s=()=>{t.delete(e)&&n()};return!r&&Ql()&&wh(s),s}function jr(t,...e){t.forEach(r=>{r(...e)})}const zf=t=>t(),Ba=Symbol(),Si=Symbol();function Wi(t,e){t instanceof Map&&e instanceof Map?e.forEach((r,n)=>t.set(n,r)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const r in e){if(!e.hasOwnProperty(r))continue;const n=e[r],s=t[r];Ki(s)&&Ki(n)&&t.hasOwnProperty(r)&&!Se(n)&&!zt(n)?t[r]=Wi(s,n):t[r]=n}return t}const Kf=Symbol();function Wf(t){return!Ki(t)||!Object.prototype.hasOwnProperty.call(t,Kf)}const{assign:nr}=Object;function Gf(t){return!!(Se(t)&&t.effect)}function Jf(t,e,r,n){const{state:s,actions:i,getters:o}=e,a=r.state.value[t];let l;function c(){a||(r.state.value[t]=s?s():{});const u=Vh(r.state.value[t]);return nr(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=To(Ue(()=>{ti(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=uu(t,c,e,r,n,!0),l}function uu(t,e,r={},n,s,i){let o;const a=nr({actions:{}},r),l={deep:!0};let c,u,h=new Set,d=new Set,f;const g=n.state.value[t];!i&&!g&&(n.state.value[t]={});let y;function S(G){let C;c=u=!1,typeof G=="function"?(G(n.state.value[t]),C={type:Rn.patchFunction,storeId:t,events:f}):(Wi(n.state.value[t],G),C={type:Rn.patchObject,payload:G,storeId:t,events:f});const J=y=Symbol();Xr().then(()=>{y===J&&(c=!0)}),u=!0,jr(h,C,n.state.value[t])}const w=i?function(){const{state:C}=r,J=C?C():{};this.$patch(ee=>{nr(ee,J)})}:cu;function b(){o.stop(),h.clear(),d.clear(),n._s.delete(t)}const _=(G,C="")=>{if(Ba in G)return G[Si]=C,G;const J=function(){ti(n);const ee=Array.from(arguments),N=new Set,Q=new Set;function Ae(Z){N.add(Z)}function Be(Z){Q.add(Z)}jr(d,{args:ee,name:J[Si],store:B,after:Ae,onError:Be});let he;try{he=G.apply(this&&this.$id===t?this:B,ee)}catch(Z){throw jr(Q,Z),Z}return he instanceof Promise?he.then(Z=>(jr(N,Z),Z)).catch(Z=>(jr(Q,Z),Promise.reject(Z))):(jr(N,he),he)};return J[Ba]=!0,J[Si]=C,J},x={_p:n,$id:t,$onAction:Ua.bind(null,d),$patch:S,$reset:w,$subscribe(G,C={}){const J=Ua(h,G,C.detached,()=>ee()),ee=o.run(()=>Ar(()=>n.state.value[t],N=>{(C.flush==="sync"?u:c)&&G({storeId:t,type:Rn.direct,events:f},N)},nr({},l,C)));return J},$dispose:b},B=Yn(x);n._s.set(t,B);const M=(n._a&&n._a.runWithContext||zf)(()=>n._e.run(()=>(o=Zl()).run(()=>e({action:_}))));for(const G in M){const C=M[G];if(Se(C)&&!Gf(C)||zt(C))i||(g&&Wf(C)&&(Se(C)?C.value=g[G]:Wi(C,g[G])),n.state.value[t][G]=C);else if(typeof C=="function"){const J=_(C,G);M[G]=J,a.actions[G]=C}}return nr(B,M),nr(te(B),M),Object.defineProperty(B,"$state",{get:()=>n.state.value[t],set:G=>{S(C=>{nr(C,G)})}}),n._p.forEach(G=>{nr(B,o.run(()=>G({store:B,app:n._a,pinia:n,options:a})))}),g&&i&&r.hydrate&&r.hydrate(B.$state,g),c=!0,u=!0,B}/*! #__NO_SIDE_EFFECTS__ */function hu(t,e,r){let n;const s=typeof e=="function";n=s?r:e;function i(o,a){const l=td();return o=o||(l?lt(lu,null):null),o&&ti(o),o=au,o._s.has(t)||(s?uu(t,e,n,o):Jf(t,n,o)),o._s.get(t)}return i.$id=t,i}/*!
22
+ */let nu;const Zs=t=>nu=t,su=Symbol();function qi(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Tn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Tn||(Tn={}));function Hf(){const t=Kl(!0),e=t.run(()=>et({}));let r=[],n=[];const s=wo({install(i){Zs(s),s._a=i,i.provide(su,s),i.config.globalProperties.$pinia=s,n.forEach(o=>r.push(o)),n=[]},use(i){return this._a?r.push(i):n.push(i),this},_p:r,_a:null,_e:t,_s:new Map,state:e});return s}const iu=()=>{};function $a(t,e,r,n=iu){t.add(e);const s=()=>{t.delete(e)&&n()};return!r&&Gl()&&vh(s),s}function Pr(t,...e){t.forEach(r=>{r(...e)})}const qf=t=>t(),Na=Symbol(),bi=Symbol();function Fi(t,e){t instanceof Map&&e instanceof Map?e.forEach((r,n)=>t.set(n,r)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const r in e){if(!e.hasOwnProperty(r))continue;const n=e[r],s=t[r];qi(s)&&qi(n)&&t.hasOwnProperty(r)&&!Se(n)&&!zt(n)?t[r]=Fi(s,n):t[r]=n}return t}const Ff=Symbol();function Vf(t){return!qi(t)||!Object.prototype.hasOwnProperty.call(t,Ff)}const{assign:rr}=Object;function zf(t){return!!(Se(t)&&t.effect)}function Wf(t,e,r,n){const{state:s,actions:i,getters:o}=e,a=r.state.value[t];let l;function c(){a||(r.state.value[t]=s?s():{});const u=Hh(r.state.value[t]);return rr(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=wo(Ue(()=>{Zs(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=ou(t,c,e,r,n,!0),l}function ou(t,e,r={},n,s,i){let o;const a=rr({actions:{}},r),l={deep:!0};let c,u,h=new Set,d=new Set,f;const g=n.state.value[t];!i&&!g&&(n.state.value[t]={});let y;function k(F){let C;c=u=!1,typeof F=="function"?(F(n.state.value[t]),C={type:Tn.patchFunction,storeId:t,events:f}):(Fi(n.state.value[t],F),C={type:Tn.patchObject,payload:F,storeId:t,events:f});const V=y=Symbol();Yr().then(()=>{y===V&&(c=!0)}),u=!0,Pr(h,C,n.state.value[t])}const w=i?function(){const{state:C}=r,V=C?C():{};this.$patch(Z=>{rr(Z,V)})}:iu;function _(){o.stop(),h.clear(),d.clear(),n._s.delete(t)}const b=(F,C="")=>{if(Na in F)return F[bi]=C,F;const V=function(){Zs(n);const Z=Array.from(arguments),$=new Set,X=new Set;function Ae(Q){$.add(Q)}function Be(Q){X.add(Q)}Pr(d,{args:Z,name:V[bi],store:D,after:Ae,onError:Be});let he;try{he=F.apply(this&&this.$id===t?this:D,Z)}catch(Q){throw Pr(X,Q),Q}return he instanceof Promise?he.then(Q=>(Pr($,Q),Q)).catch(Q=>(Pr(X,Q),Promise.reject(Q))):(Pr($,he),he)};return V[Na]=!0,V[bi]=C,V},x={_p:n,$id:t,$onAction:$a.bind(null,d),$patch:k,$reset:w,$subscribe(F,C={}){const V=$a(h,F,C.detached,()=>Z()),Z=o.run(()=>Er(()=>n.state.value[t],$=>{(C.flush==="sync"?u:c)&&F({storeId:t,type:Tn.direct,events:f},$)},rr({},l,C)));return V},$dispose:_},D=Kn(x);n._s.set(t,D);const U=(n._a&&n._a.runWithContext||qf)(()=>n._e.run(()=>(o=Kl()).run(()=>e({action:b}))));for(const F in U){const C=U[F];if(Se(C)&&!zf(C)||zt(C))i||(g&&Vf(C)&&(Se(C)?C.value=g[F]:Fi(C,g[F])),n.state.value[t][F]=C);else if(typeof C=="function"){const V=b(C,F);U[F]=V,a.actions[F]=C}}return rr(D,U),rr(te(D),U),Object.defineProperty(D,"$state",{get:()=>n.state.value[t],set:F=>{k(C=>{rr(C,F)})}}),n._p.forEach(F=>{rr(D,o.run(()=>F({store:D,app:n._a,pinia:n,options:a})))}),g&&i&&r.hydrate&&r.hydrate(D.$state,g),c=!0,u=!0,D}/*! #__NO_SIDE_EFFECTS__ */function au(t,e,r){let n;const s=typeof e=="function";n=s?r:e;function i(o,a){const l=Zh();return o=o||(l?lt(su,null):null),o&&Zs(o),o=nu,o._s.has(t)||(s?ou(t,e,n,o):Wf(t,n,o)),o._s.get(t)}return i.$id=t,i}/*!
23
23
  * vue-router v4.6.4
24
24
  * (c) 2025 Eduardo San Martin Morote
25
25
  * @license MIT
26
- */const Hr=typeof document<"u";function du(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Yf(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&du(t.default)}const se=Object.assign;function Ei(t,e){const r={};for(const n in e){const s=e[n];r[n]=mt(s)?s.map(t):t(s)}return r}const Cn=()=>{},mt=Array.isArray;function Ma(t,e){const r={};for(const n in t)r[n]=n in e?e[n]:t[n];return r}const fu=/#/g,Zf=/&/g,Qf=/\//g,Xf=/=/g,ep=/\?/g,pu=/\+/g,tp=/%5B/g,rp=/%5D/g,gu=/%5E/g,np=/%60/g,mu=/%7B/g,sp=/%7C/g,yu=/%7D/g,ip=/%20/g;function Io(t){return t==null?"":encodeURI(""+t).replace(sp,"|").replace(tp,"[").replace(rp,"]")}function op(t){return Io(t).replace(mu,"{").replace(yu,"}").replace(gu,"^")}function Gi(t){return Io(t).replace(pu,"%2B").replace(ip,"+").replace(fu,"%23").replace(Zf,"%26").replace(np,"`").replace(mu,"{").replace(yu,"}").replace(gu,"^")}function ap(t){return Gi(t).replace(Xf,"%3D")}function lp(t){return Io(t).replace(fu,"%23").replace(ep,"%3F")}function cp(t){return lp(t).replace(Qf,"%2F")}function qn(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const up=/\/$/,hp=t=>t.replace(up,"");function Ti(t,e,r="/"){let n,s={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(n=e.slice(0,l),i=e.slice(l,a>0?a:e.length),s=t(i.slice(1))),a>=0&&(n=n||e.slice(0,a),o=e.slice(a,e.length)),n=gp(n??e,r),{fullPath:n+i+o,path:n,query:s,hash:qn(o)}}function dp(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Ha(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function fp(t,e,r){const n=e.matched.length-1,s=r.matched.length-1;return n>-1&&n===s&&rn(e.matched[n],r.matched[s])&&vu(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function rn(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function vu(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!pp(t[r],e[r]))return!1;return!0}function pp(t,e){return mt(t)?qa(t,e):mt(e)?qa(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function qa(t,e){return mt(e)?t.length===e.length&&t.every((r,n)=>r===e[n]):t.length===1&&t[0]===e}function gp(t,e){if(t.startsWith("/"))return t;if(!t)return e;const r=e.split("/"),n=t.split("/"),s=n[n.length-1];(s===".."||s===".")&&n.push("");let i=r.length-1,o,a;for(o=0;o<n.length;o++)if(a=n[o],a!==".")if(a==="..")i>1&&i--;else break;return r.slice(0,i).join("/")+"/"+n.slice(o).join("/")}const rr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ji=(function(t){return t.pop="pop",t.push="push",t})({}),Ai=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function mp(t){if(!t)if(Hr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),hp(t)}const yp=/^[^#]+#/;function vp(t,e){return t.replace(yp,"#")+e}function bp(t,e){const r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-r.left-(e.left||0),top:n.top-r.top-(e.top||0)}}const ri=()=>({left:window.scrollX,top:window.scrollY});function _p(t){let e;if("el"in t){const r=t.el,n=typeof r=="string"&&r.startsWith("#"),s=typeof r=="string"?n?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!s)return;e=bp(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Fa(t,e){return(history.state?history.state.position-e:-1)+t}const Yi=new Map;function wp(t,e){Yi.set(t,e)}function kp(t){const e=Yi.get(t);return Yi.delete(t),e}function Sp(t){return typeof t=="string"||t&&typeof t=="object"}function bu(t){return typeof t=="string"||typeof t=="symbol"}let we=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const _u=Symbol("");we.MATCHER_NOT_FOUND+"",we.NAVIGATION_GUARD_REDIRECT+"",we.NAVIGATION_ABORTED+"",we.NAVIGATION_CANCELLED+"",we.NAVIGATION_DUPLICATED+"";function nn(t,e){return se(new Error,{type:t,[_u]:!0},e)}function Nt(t,e){return t instanceof Error&&_u in t&&(e==null||!!(t.type&e))}const Ep=["params","query","hash"];function Tp(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of Ep)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Ap(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<r.length;++n){const s=r[n].replace(pu," "),i=s.indexOf("="),o=qn(i<0?s:s.slice(0,i)),a=i<0?null:qn(s.slice(i+1));if(o in e){let l=e[o];mt(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function Va(t){let e="";for(let r in t){const n=t[r];if(r=ap(r),n==null){n!==void 0&&(e+=(e.length?"&":"")+r);continue}(mt(n)?n.map(s=>s&&Gi(s)):[n&&Gi(n)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+r,s!=null&&(e+="="+s))})}return e}function xp(t){const e={};for(const r in t){const n=t[r];n!==void 0&&(e[r]=mt(n)?n.map(s=>s==null?null:""+s):n==null?n:""+n)}return e}const Rp=Symbol(""),za=Symbol(""),ni=Symbol(""),$o=Symbol(""),Zi=Symbol("");function fn(){let t=[];function e(n){return t.push(n),()=>{const s=t.indexOf(n);s>-1&&t.splice(s,1)}}function r(){t=[]}return{add:e,list:()=>t.slice(),reset:r}}function ir(t,e,r,n,s,i=o=>o()){const o=n&&(n.enterCallbacks[s]=n.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(nn(we.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):Sp(d)?l(nn(we.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&n.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(n&&n.instances[s],e,r,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function xi(t,e,r,n,s=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(du(l)){const c=(l.__vccOpts||l)[e];c&&i.push(ir(c,r,n,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=Yf(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&ir(d,r,n,o,a,s)()}))}}return i}function Cp(t,e){const r=[],n=[],s=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>rn(c,a))?n.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>rn(c,l))||s.push(l))}return[r,n,s]}/*!
26
+ */const Ur=typeof document<"u";function lu(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Kf(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&lu(t.default)}const se=Object.assign;function _i(t,e){const r={};for(const n in e){const s=e[n];r[n]=mt(s)?s.map(t):t(s)}return r}const An=()=>{},mt=Array.isArray;function La(t,e){const r={};for(const n in t)r[n]=n in e?e[n]:t[n];return r}const cu=/#/g,Gf=/&/g,Jf=/\//g,Yf=/=/g,Qf=/\?/g,uu=/\+/g,Zf=/%5B/g,Xf=/%5D/g,hu=/%5E/g,ep=/%60/g,du=/%7B/g,tp=/%7C/g,fu=/%7D/g,rp=/%20/g;function Ro(t){return t==null?"":encodeURI(""+t).replace(tp,"|").replace(Zf,"[").replace(Xf,"]")}function np(t){return Ro(t).replace(du,"{").replace(fu,"}").replace(hu,"^")}function Vi(t){return Ro(t).replace(uu,"%2B").replace(rp,"+").replace(cu,"%23").replace(Gf,"%26").replace(ep,"`").replace(du,"{").replace(fu,"}").replace(hu,"^")}function sp(t){return Vi(t).replace(Yf,"%3D")}function ip(t){return Ro(t).replace(cu,"%23").replace(Qf,"%3F")}function op(t){return ip(t).replace(Jf,"%2F")}function Bn(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const ap=/\/$/,lp=t=>t.replace(ap,"");function wi(t,e,r="/"){let n,s={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(n=e.slice(0,l),i=e.slice(l,a>0?a:e.length),s=t(i.slice(1))),a>=0&&(n=n||e.slice(0,a),o=e.slice(a,e.length)),n=dp(n??e,r),{fullPath:n+i+o,path:n,query:s,hash:Bn(o)}}function cp(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Da(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function up(t,e,r){const n=e.matched.length-1,s=r.matched.length-1;return n>-1&&n===s&&Xr(e.matched[n],r.matched[s])&&pu(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function Xr(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function pu(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!hp(t[r],e[r]))return!1;return!0}function hp(t,e){return mt(t)?Ua(t,e):mt(e)?Ua(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Ua(t,e){return mt(e)?t.length===e.length&&t.every((r,n)=>r===e[n]):t.length===1&&t[0]===e}function dp(t,e){if(t.startsWith("/"))return t;if(!t)return e;const r=e.split("/"),n=t.split("/"),s=n[n.length-1];(s===".."||s===".")&&n.push("");let i=r.length-1,o,a;for(o=0;o<n.length;o++)if(a=n[o],a!==".")if(a==="..")i>1&&i--;else break;return r.slice(0,i).join("/")+"/"+n.slice(o).join("/")}const tr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let zi=(function(t){return t.pop="pop",t.push="push",t})({}),ki=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function fp(t){if(!t)if(Ur){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),lp(t)}const pp=/^[^#]+#/;function gp(t,e){return t.replace(pp,"#")+e}function mp(t,e){const r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-r.left-(e.left||0),top:n.top-r.top-(e.top||0)}}const Xs=()=>({left:window.scrollX,top:window.scrollY});function yp(t){let e;if("el"in t){const r=t.el,n=typeof r=="string"&&r.startsWith("#"),s=typeof r=="string"?n?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!s)return;e=mp(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Ba(t,e){return(history.state?history.state.position-e:-1)+t}const Wi=new Map;function vp(t,e){Wi.set(t,e)}function bp(t){const e=Wi.get(t);return Wi.delete(t),e}function _p(t){return typeof t=="string"||t&&typeof t=="object"}function gu(t){return typeof t=="string"||typeof t=="symbol"}let we=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const mu=Symbol("");we.MATCHER_NOT_FOUND+"",we.NAVIGATION_GUARD_REDIRECT+"",we.NAVIGATION_ABORTED+"",we.NAVIGATION_CANCELLED+"",we.NAVIGATION_DUPLICATED+"";function en(t,e){return se(new Error,{type:t,[mu]:!0},e)}function Nt(t,e){return t instanceof Error&&mu in t&&(e==null||!!(t.type&e))}const wp=["params","query","hash"];function kp(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of wp)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Sp(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<r.length;++n){const s=r[n].replace(uu," "),i=s.indexOf("="),o=Bn(i<0?s:s.slice(0,i)),a=i<0?null:Bn(s.slice(i+1));if(o in e){let l=e[o];mt(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function Ma(t){let e="";for(let r in t){const n=t[r];if(r=sp(r),n==null){n!==void 0&&(e+=(e.length?"&":"")+r);continue}(mt(n)?n.map(s=>s&&Vi(s)):[n&&Vi(n)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+r,s!=null&&(e+="="+s))})}return e}function Ep(t){const e={};for(const r in t){const n=t[r];n!==void 0&&(e[r]=mt(n)?n.map(s=>s==null?null:""+s):n==null?n:""+n)}return e}const Tp=Symbol(""),Ha=Symbol(""),ei=Symbol(""),Co=Symbol(""),Ki=Symbol("");function un(){let t=[];function e(n){return t.push(n),()=>{const s=t.indexOf(n);s>-1&&t.splice(s,1)}}function r(){t=[]}return{add:e,list:()=>t.slice(),reset:r}}function sr(t,e,r,n,s,i=o=>o()){const o=n&&(n.enterCallbacks[s]=n.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(en(we.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):_p(d)?l(en(we.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&n.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(n&&n.instances[s],e,r,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Si(t,e,r,n,s=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(lu(l)){const c=(l.__vccOpts||l)[e];c&&i.push(sr(c,r,n,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=Kf(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&sr(d,r,n,o,a,s)()}))}}return i}function Ap(t,e){const r=[],n=[],s=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>Xr(c,a))?n.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>Xr(c,l))||s.push(l))}return[r,n,s]}/*!
27
27
  * vue-router v4.6.4
28
28
  * (c) 2025 Eduardo San Martin Morote
29
29
  * @license MIT
30
- */let Op=()=>location.protocol+"//"+location.host;function wu(t,e){const{pathname:r,search:n,hash:s}=e,i=t.indexOf("#");if(i>-1){let o=s.includes(t.slice(i))?t.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Ha(a,"")}return Ha(r,t)+n+s}function Pp(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=wu(t,location),g=r.value,y=e.value;let S=0;if(d){if(r.value=f,e.value=d,o&&o===g){o=null;return}S=y?d.position-y.position:0}else n(f);s.forEach(w=>{w(r.value,g,{delta:S,type:Ji.pop,direction:S?S>0?Ai.forward:Ai.back:Ai.unknown})})};function l(){o=r.value}function c(d){s.push(d);const f=()=>{const g=s.indexOf(d);g>-1&&s.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(se({},d.state,{scroll:ri()}),"")}}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 Ka(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?ri():null}}function Ip(t){const{history:e,location:r}=window,n={value:wu(t,r)},s={value:e.state};s.value||i(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:Op()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,se({},e.state,Ka(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=se({},s.value,e.state,{forward:l,scroll:ri()});i(u.current,u,!0),i(l,se({},Ka(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function $p(t){t=mp(t);const e=Ip(t),r=Pp(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=se({location:"",base:t,go:n,createHref:vp.bind(null,t)},e,r);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}let Sr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Ce=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(Ce||{});const jp={type:Sr.Static,value:""},Np=/[a-zA-Z0-9_]/;function Lp(t){if(!t)return[[]];if(t==="/")return[[jp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Ce.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Ce.Static?i.push({type:Sr.Static,value:c}):r===Ce.Param||r===Ce.ParamRegExp||r===Ce.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Sr.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==Ce.ParamRegExp){n=r,r=Ce.EscapeNext;continue}switch(r){case Ce.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Ce.Param):d();break;case Ce.EscapeNext:d(),r=n;break;case Ce.Param:l==="("?r=Ce.ParamRegExp:Np.test(l)?d():(h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ce.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Ce.ParamRegExpEnd:u+=l;break;case Ce.ParamRegExpEnd:h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Ce.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Wa="[^/]+?",Dp={sensitive:!1,strict:!1,start:!0,end:!0};var qe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(qe||{});const Up=/[.+*?^${}()[\]/\\]/g;function Bp(t,e){const r=se({},Dp,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[qe.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=qe.Segment+(r.sensitive?qe.BonusCaseSensitive:0);if(d.type===Sr.Static)h||(s+="/"),s+=d.value.replace(Up,"\\$&"),f+=qe.Static;else if(d.type===Sr.Param){const{value:g,repeatable:y,optional:S,regexp:w}=d;i.push({name:g,repeatable:y,optional:S});const b=w||Wa;if(b!==Wa){f+=qe.BonusCustomRegExp;try{`${b}`}catch(x){throw new Error(`Invalid custom RegExp for param "${g}" (${b}): `+x.message)}}let _=y?`((?:${b})(?:/(?:${b}))*)`:`(${b})`;h||(_=S&&c.length<2?`(?:/${_})`:"/"+_),S&&(_+="?"),s+=_,f+=qe.Dynamic,S&&(f+=qe.BonusOptional),y&&(f+=qe.BonusRepeatable),b===".*"&&(f+=qe.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=qe.BonusStrict}r.strict||(s+="/?"),r.end?s+="$":r.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",g=i[d-1];h[g.name]=f&&g.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Sr.Static)u+=f.value;else if(f.type===Sr.Param){const{value:g,repeatable:y,optional:S}=f,w=g in c?c[g]:"";if(mt(w)&&!y)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const b=mt(w)?w.join("/"):w;if(!b)if(S)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${g}"`);u+=b}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function Mp(t,e){let r=0;for(;r<t.length&&r<e.length;){const n=e[r]-t[r];if(n)return n;r++}return t.length<e.length?t.length===1&&t[0]===qe.Static+qe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===qe.Static+qe.Segment?1:-1:0}function ku(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=Mp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Ga(n))return 1;if(Ga(s))return-1}return s.length-n.length}function Ga(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Hp={strict:!1,end:!0,sensitive:!1};function qp(t,e,r){const n=Bp(Lp(t.path),r),s=se(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Fp(t,e){const r=[],n=new Map;e=Ma(Hp,e);function s(h){return n.get(h)}function i(h,d,f){const g=!f,y=Ya(h);y.aliasOf=f&&f.record;const S=Ma(e,h),w=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const B of x)w.push(Ya(se({},y,{components:f?f.record.components:y.components,path:B,aliasOf:f?f.record:y})))}let b,_;for(const x of w){const{path:B}=x;if(d&&B[0]!=="/"){const H=d.record.path,M=H[H.length-1]==="/"?"":"/";x.path=d.record.path+(B&&M+B)}if(b=qp(x,d,S),f?f.alias.push(b):(_=_||b,_!==b&&_.alias.push(b),g&&h.name&&!Za(b)&&o(h.name)),Su(b)&&l(b),y.children){const H=y.children;for(let M=0;M<H.length;M++)i(H[M],b,f&&f.children[M])}f=f||b}return _?()=>{o(_)}:Cn}function o(h){if(bu(h)){const d=n.get(h);d&&(n.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&n.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=Kp(h,r);r.splice(d,0,h),h.record.name&&!Za(h)&&n.set(h.record.name,h)}function c(h,d){let f,g={},y,S;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw nn(we.MATCHER_NOT_FOUND,{location:h});S=f.record.name,g=se(Ja(d.params,f.keys.filter(_=>!_.optional).concat(f.parent?f.parent.keys.filter(_=>_.optional):[]).map(_=>_.name)),h.params&&Ja(h.params,f.keys.map(_=>_.name))),y=f.stringify(g)}else if(h.path!=null)y=h.path,f=r.find(_=>_.re.test(y)),f&&(g=f.parse(y),S=f.record.name);else{if(f=d.name?n.get(d.name):r.find(_=>_.re.test(d.path)),!f)throw nn(we.MATCHER_NOT_FOUND,{location:h,currentLocation:d});S=f.record.name,g=se({},d.params,h.params),y=f.stringify(g)}const w=[];let b=f;for(;b;)w.unshift(b.record),b=b.parent;return{name:S,path:y,params:g,matched:w,meta:zp(w)}}t.forEach(h=>i(h));function u(){r.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Ja(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Ya(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Vp(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Vp(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const n in t.components)e[n]=typeof r=="object"?r[n]:r;return e}function Za(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function zp(t){return t.reduce((e,r)=>se(e,r.meta),{})}function Kp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;ku(t,e[i])<0?n=i:r=i+1}const s=Wp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Wp(t){let e=t;for(;e=e.parent;)if(Su(e)&&ku(t,e)===0)return e}function Su({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Qa(t){const e=lt(ni),r=lt($o),n=Ue(()=>{const l=_e(t.to);return e.resolve(l)}),s=Ue(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(rn.bind(null,u));if(d>-1)return d;const f=Xa(l[c-2]);return c>1&&Xa(u)===f&&h[h.length-1].path!==f?h.findIndex(rn.bind(null,l[c-2])):d}),i=Ue(()=>s.value>-1&&Qp(r.params,n.value.params)),o=Ue(()=>s.value>-1&&s.value===r.matched.length-1&&vu(r.params,n.value.params));function a(l={}){if(Zp(l)){const c=e[_e(t.replace)?"replace":"push"](_e(t.to)).catch(Cn);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Ue(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function Gp(t){return t.length===1?t[0]:t}const Jp=dr({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:Qa,setup(t,{slots:e}){const r=Yn(Qa(t)),{options:n}=lt(ni),s=Ue(()=>({[el(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[el(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&Gp(e.default(r));return t.custom?i:en("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:s.value},i)}}}),Yp=Jp;function Zp(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Qp(t,e){for(const r in e){const n=e[r],s=t[r];if(typeof n=="string"){if(n!==s)return!1}else if(!mt(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Xa(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const el=(t,e,r)=>t??e??r,Xp=dr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=lt(Zi),s=Ue(()=>t.route||n.value),i=lt(za,0),o=Ue(()=>{let c=_e(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Ue(()=>s.value.matched[o.value]);ys(za,Ue(()=>o.value+1)),ys(Rp,a),ys(Zi,s);const l=et();return Ar(()=>[l.value,a.value,t.name],([c,u,h],[d,f,g])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!rn(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=s.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return tl(r.default,{Component:d,route:c});const f=h.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,S=en(d,se({},g,e,{onVnodeUnmounted:w=>{w.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return tl(r.default,{Component:S,route:c})||S}}});function tl(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const eg=Xp;function tg(t){const e=Fp(t.routes,t),r=t.parseQuery||Ap,n=t.stringifyQuery||Va,s=t.history,i=fn(),o=fn(),a=fn(),l=Hh(rr);let c=rr;Hr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ei.bind(null,T=>""+T),h=Ei.bind(null,cp),d=Ei.bind(null,qn);function f(T,D){let j,F;return bu(T)?(j=e.getRecordMatcher(T),F=D):F=T,e.addRoute(F,j)}function g(T){const D=e.getRecordMatcher(T);D&&e.removeRoute(D)}function y(){return e.getRoutes().map(T=>T.record)}function S(T){return!!e.getRecordMatcher(T)}function w(T,D){if(D=se({},D||l.value),typeof T=="string"){const v=Ti(r,T,D.path),k=e.resolve({path:v.path},D),A=s.createHref(v.fullPath);return se(v,k,{params:d(k.params),hash:qn(v.hash),redirectedFrom:void 0,href:A})}let j;if(T.path!=null)j=se({},T,{path:Ti(r,T.path,D.path).path});else{const v=se({},T.params);for(const k in v)v[k]==null&&delete v[k];j=se({},T,{params:h(v)}),D.params=h(D.params)}const F=e.resolve(j,D),X=T.hash||"";F.params=u(d(F.params));const p=dp(n,se({},T,{hash:op(X),path:F.path})),m=s.createHref(p);return se({fullPath:p,hash:X,query:n===Va?xp(T.query):T.query||{}},F,{redirectedFrom:void 0,href:m})}function b(T){return typeof T=="string"?Ti(r,T,l.value.path):se({},T)}function _(T,D){if(c!==T)return nn(we.NAVIGATION_CANCELLED,{from:D,to:T})}function x(T){return M(T)}function B(T){return x(se(b(T),{replace:!0}))}function H(T,D){const j=T.matched[T.matched.length-1];if(j&&j.redirect){const{redirect:F}=j;let X=typeof F=="function"?F(T,D):F;return typeof X=="string"&&(X=X.includes("?")||X.includes("#")?X=b(X):{path:X},X.params={}),se({query:T.query,hash:T.hash,params:X.path!=null?{}:T.params},X)}}function M(T,D){const j=c=w(T),F=l.value,X=T.state,p=T.force,m=T.replace===!0,v=H(j,F);if(v)return M(se(b(v),{state:typeof v=="object"?se({},X,v.state):X,force:p,replace:m}),D||j);const k=j;k.redirectedFrom=D;let A;return!p&&fp(n,F,j)&&(A=nn(we.NAVIGATION_DUPLICATED,{to:k,from:F}),yt(F,F,!0,!1)),(A?Promise.resolve(A):J(k,F)).catch(E=>Nt(E)?Nt(E,we.NAVIGATION_GUARD_REDIRECT)?E:er(E):ne(E,k,F)).then(E=>{if(E){if(Nt(E,we.NAVIGATION_GUARD_REDIRECT))return M(se({replace:m},b(E.to),{state:typeof E.to=="object"?se({},X,E.to.state):X,force:p}),D||k)}else E=N(k,F,!0,m,X);return ee(k,F,E),E})}function G(T,D){const j=_(T,D);return j?Promise.reject(j):Promise.resolve()}function C(T){const D=Ir.values().next().value;return D&&typeof D.runWithContext=="function"?D.runWithContext(T):T()}function J(T,D){let j;const[F,X,p]=Cp(T,D);j=xi(F.reverse(),"beforeRouteLeave",T,D);for(const v of F)v.leaveGuards.forEach(k=>{j.push(ir(k,T,D))});const m=G.bind(null,T,D);return j.push(m),st(j).then(()=>{j=[];for(const v of i.list())j.push(ir(v,T,D));return j.push(m),st(j)}).then(()=>{j=xi(X,"beforeRouteUpdate",T,D);for(const v of X)v.updateGuards.forEach(k=>{j.push(ir(k,T,D))});return j.push(m),st(j)}).then(()=>{j=[];for(const v of p)if(v.beforeEnter)if(mt(v.beforeEnter))for(const k of v.beforeEnter)j.push(ir(k,T,D));else j.push(ir(v.beforeEnter,T,D));return j.push(m),st(j)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),j=xi(p,"beforeRouteEnter",T,D,C),j.push(m),st(j))).then(()=>{j=[];for(const v of o.list())j.push(ir(v,T,D));return j.push(m),st(j)}).catch(v=>Nt(v,we.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function ee(T,D,j){a.list().forEach(F=>C(()=>F(T,D,j)))}function N(T,D,j,F,X){const p=_(T,D);if(p)return p;const m=D===rr,v=Hr?history.state:{};j&&(F||m?s.replace(T.fullPath,se({scroll:m&&v&&v.scroll},X)):s.push(T.fullPath,X)),l.value=T,yt(T,D,j,m),er()}let Q;function Ae(){Q||(Q=s.listen((T,D,j)=>{if(!fr.listening)return;const F=w(T),X=H(F,fr.currentRoute.value);if(X){M(se(X,{replace:!0,force:!0}),F).catch(Cn);return}c=F;const p=l.value;Hr&&wp(Fa(p.fullPath,j.delta),ri()),J(F,p).catch(m=>Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_CANCELLED)?m:Nt(m,we.NAVIGATION_GUARD_REDIRECT)?(M(se(b(m.to),{force:!0}),F).then(v=>{Nt(v,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&!j.delta&&j.type===Ji.pop&&s.go(-1,!1)}).catch(Cn),Promise.reject()):(j.delta&&s.go(-j.delta,!1),ne(m,F,p))).then(m=>{m=m||N(F,p,!1),m&&(j.delta&&!Nt(m,we.NAVIGATION_CANCELLED)?s.go(-j.delta,!1):j.type===Ji.pop&&Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ee(F,p,m)}).catch(Cn)}))}let Be=fn(),he=fn(),Z;function ne(T,D,j){er(T);const F=he.list();return F.length?F.forEach(X=>X(T,D,j)):console.error(T),Promise.reject(T)}function It(){return Z&&l.value!==rr?Promise.resolve():new Promise((T,D)=>{Be.add([T,D])})}function er(T){return Z||(Z=!T,Ae(),Be.list().forEach(([D,j])=>T?j(T):D()),Be.reset()),T}function yt(T,D,j,F){const{scrollBehavior:X}=t;if(!Hr||!X)return Promise.resolve();const p=!j&&kp(Fa(T.fullPath,0))||(F||!j)&&history.state&&history.state.scroll||null;return Xr().then(()=>X(T,D,p)).then(m=>m&&_p(m)).catch(m=>ne(m,T,D))}const We=T=>s.go(T);let Pr;const Ir=new Set,fr={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:e.clearRoutes,hasRoute:S,getRoutes:y,resolve:w,options:t,push:x,replace:B,go:We,back:()=>We(-1),forward:()=>We(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:he.add,isReady:It,install(T){T.component("RouterLink",Yp),T.component("RouterView",eg),T.config.globalProperties.$router=fr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),Hr&&!Pr&&l.value===rr&&(Pr=!0,x(s.location).catch(F=>{}));const D={};for(const F in rr)Object.defineProperty(D,F,{get:()=>l.value[F],enumerable:!0});T.provide(ni,fr),T.provide($o,fc(D)),T.provide(Zi,l);const j=T.unmount;Ir.add(T),T.unmount=function(){Ir.delete(T),Ir.size<1&&(c=rr,Q&&Q(),Q=null,l.value=rr,Pr=!1,Z=!1),j()}}};function st(T){return T.reduce((D,j)=>D.then(()=>C(j)),Promise.resolve())}return fr}function rg(){return lt(ni)}function jo(t){return lt($o)}const ng="/logo.svg",sg=["width","height"],ig=dr({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(oe(),Ee("img",{src:ng,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,sg))}});/**
30
+ */let xp=()=>location.protocol+"//"+location.host;function yu(t,e){const{pathname:r,search:n,hash:s}=e,i=t.indexOf("#");if(i>-1){let o=s.includes(t.slice(i))?t.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Da(a,"")}return Da(r,t)+n+s}function Rp(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=yu(t,location),g=r.value,y=e.value;let k=0;if(d){if(r.value=f,e.value=d,o&&o===g){o=null;return}k=y?d.position-y.position:0}else n(f);s.forEach(w=>{w(r.value,g,{delta:k,type:zi.pop,direction:k?k>0?ki.forward:ki.back:ki.unknown})})};function l(){o=r.value}function c(d){s.push(d);const f=()=>{const g=s.indexOf(d);g>-1&&s.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(se({},d.state,{scroll:Xs()}),"")}}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 qa(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?Xs():null}}function Cp(t){const{history:e,location:r}=window,n={value:yu(t,r)},s={value:e.state};s.value||i(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:xp()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,se({},e.state,qa(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=se({},s.value,e.state,{forward:l,scroll:Xs()});i(u.current,u,!0),i(l,se({},qa(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function Op(t){t=fp(t);const e=Cp(t),r=Rp(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=se({location:"",base:t,go:n,createHref:gp.bind(null,t)},e,r);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}let wr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Ce=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(Ce||{});const Pp={type:wr.Static,value:""},Ip=/[a-zA-Z0-9_]/;function jp(t){if(!t)return[[]];if(t==="/")return[[Pp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Ce.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Ce.Static?i.push({type:wr.Static,value:c}):r===Ce.Param||r===Ce.ParamRegExp||r===Ce.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:wr.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==Ce.ParamRegExp){n=r,r=Ce.EscapeNext;continue}switch(r){case Ce.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Ce.Param):d();break;case Ce.EscapeNext:d(),r=n;break;case Ce.Param:l==="("?r=Ce.ParamRegExp:Ip.test(l)?d():(h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ce.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Ce.ParamRegExpEnd:u+=l;break;case Ce.ParamRegExpEnd:h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Ce.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Fa="[^/]+?",$p={sensitive:!1,strict:!1,start:!0,end:!0};var qe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(qe||{});const Np=/[.+*?^${}()[\]/\\]/g;function Lp(t,e){const r=se({},$p,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[qe.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=qe.Segment+(r.sensitive?qe.BonusCaseSensitive:0);if(d.type===wr.Static)h||(s+="/"),s+=d.value.replace(Np,"\\$&"),f+=qe.Static;else if(d.type===wr.Param){const{value:g,repeatable:y,optional:k,regexp:w}=d;i.push({name:g,repeatable:y,optional:k});const _=w||Fa;if(_!==Fa){f+=qe.BonusCustomRegExp;try{`${_}`}catch(x){throw new Error(`Invalid custom RegExp for param "${g}" (${_}): `+x.message)}}let b=y?`((?:${_})(?:/(?:${_}))*)`:`(${_})`;h||(b=k&&c.length<2?`(?:/${b})`:"/"+b),k&&(b+="?"),s+=b,f+=qe.Dynamic,k&&(f+=qe.BonusOptional),y&&(f+=qe.BonusRepeatable),_===".*"&&(f+=qe.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=qe.BonusStrict}r.strict||(s+="/?"),r.end?s+="$":r.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",g=i[d-1];h[g.name]=f&&g.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===wr.Static)u+=f.value;else if(f.type===wr.Param){const{value:g,repeatable:y,optional:k}=f,w=g in c?c[g]:"";if(mt(w)&&!y)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const _=mt(w)?w.join("/"):w;if(!_)if(k)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${g}"`);u+=_}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function Dp(t,e){let r=0;for(;r<t.length&&r<e.length;){const n=e[r]-t[r];if(n)return n;r++}return t.length<e.length?t.length===1&&t[0]===qe.Static+qe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===qe.Static+qe.Segment?1:-1:0}function vu(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=Dp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Va(n))return 1;if(Va(s))return-1}return s.length-n.length}function Va(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Up={strict:!1,end:!0,sensitive:!1};function Bp(t,e,r){const n=Lp(jp(t.path),r),s=se(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Mp(t,e){const r=[],n=new Map;e=La(Up,e);function s(h){return n.get(h)}function i(h,d,f){const g=!f,y=Wa(h);y.aliasOf=f&&f.record;const k=La(e,h),w=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const D of x)w.push(Wa(se({},y,{components:f?f.record.components:y.components,path:D,aliasOf:f?f.record:y})))}let _,b;for(const x of w){const{path:D}=x;if(d&&D[0]!=="/"){const H=d.record.path,U=H[H.length-1]==="/"?"":"/";x.path=d.record.path+(D&&U+D)}if(_=Bp(x,d,k),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),g&&h.name&&!Ka(_)&&o(h.name)),bu(_)&&l(_),y.children){const H=y.children;for(let U=0;U<H.length;U++)i(H[U],_,f&&f.children[U])}f=f||_}return b?()=>{o(b)}:An}function o(h){if(gu(h)){const d=n.get(h);d&&(n.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&n.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=Fp(h,r);r.splice(d,0,h),h.record.name&&!Ka(h)&&n.set(h.record.name,h)}function c(h,d){let f,g={},y,k;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw en(we.MATCHER_NOT_FOUND,{location:h});k=f.record.name,g=se(za(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&za(h.params,f.keys.map(b=>b.name))),y=f.stringify(g)}else if(h.path!=null)y=h.path,f=r.find(b=>b.re.test(y)),f&&(g=f.parse(y),k=f.record.name);else{if(f=d.name?n.get(d.name):r.find(b=>b.re.test(d.path)),!f)throw en(we.MATCHER_NOT_FOUND,{location:h,currentLocation:d});k=f.record.name,g=se({},d.params,h.params),y=f.stringify(g)}const w=[];let _=f;for(;_;)w.unshift(_.record),_=_.parent;return{name:k,path:y,params:g,matched:w,meta:qp(w)}}t.forEach(h=>i(h));function u(){r.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function za(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Wa(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Hp(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Hp(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const n in t.components)e[n]=typeof r=="object"?r[n]:r;return e}function Ka(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function qp(t){return t.reduce((e,r)=>se(e,r.meta),{})}function Fp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;vu(t,e[i])<0?n=i:r=i+1}const s=Vp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Vp(t){let e=t;for(;e=e.parent;)if(bu(e)&&vu(t,e)===0)return e}function bu({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Ga(t){const e=lt(ei),r=lt(Co),n=Ue(()=>{const l=_e(t.to);return e.resolve(l)}),s=Ue(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(Xr.bind(null,u));if(d>-1)return d;const f=Ja(l[c-2]);return c>1&&Ja(u)===f&&h[h.length-1].path!==f?h.findIndex(Xr.bind(null,l[c-2])):d}),i=Ue(()=>s.value>-1&&Jp(r.params,n.value.params)),o=Ue(()=>s.value>-1&&s.value===r.matched.length-1&&pu(r.params,n.value.params));function a(l={}){if(Gp(l)){const c=e[_e(t.replace)?"replace":"push"](_e(t.to)).catch(An);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Ue(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function zp(t){return t.length===1?t[0]:t}const Wp=ur({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:Ga,setup(t,{slots:e}){const r=Kn(Ga(t)),{options:n}=lt(ei),s=Ue(()=>({[Ya(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[Ya(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&zp(e.default(r));return t.custom?i:Qr("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:s.value},i)}}}),Kp=Wp;function Gp(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Jp(t,e){for(const r in e){const n=e[r],s=t[r];if(typeof n=="string"){if(n!==s)return!1}else if(!mt(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Ja(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ya=(t,e,r)=>t??e??r,Yp=ur({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=lt(Ki),s=Ue(()=>t.route||n.value),i=lt(Ha,0),o=Ue(()=>{let c=_e(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Ue(()=>s.value.matched[o.value]);gs(Ha,Ue(()=>o.value+1)),gs(Tp,a),gs(Ki,s);const l=et();return Er(()=>[l.value,a.value,t.name],([c,u,h],[d,f,g])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!Xr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=s.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return Qa(r.default,{Component:d,route:c});const f=h.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,k=Qr(d,se({},g,e,{onVnodeUnmounted:w=>{w.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Qa(r.default,{Component:k,route:c})||k}}});function Qa(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const Qp=Yp;function Zp(t){const e=Mp(t.routes,t),r=t.parseQuery||Sp,n=t.stringifyQuery||Ma,s=t.history,i=un(),o=un(),a=un(),l=Uh(tr);let c=tr;Ur&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=_i.bind(null,T=>""+T),h=_i.bind(null,op),d=_i.bind(null,Bn);function f(T,B){let N,z;return gu(T)?(N=e.getRecordMatcher(T),z=B):z=T,e.addRoute(z,N)}function g(T){const B=e.getRecordMatcher(T);B&&e.removeRoute(B)}function y(){return e.getRoutes().map(T=>T.record)}function k(T){return!!e.getRecordMatcher(T)}function w(T,B){if(B=se({},B||l.value),typeof T=="string"){const v=wi(r,T,B.path),S=e.resolve({path:v.path},B),A=s.createHref(v.fullPath);return se(v,S,{params:d(S.params),hash:Bn(v.hash),redirectedFrom:void 0,href:A})}let N;if(T.path!=null)N=se({},T,{path:wi(r,T.path,B.path).path});else{const v=se({},T.params);for(const S in v)v[S]==null&&delete v[S];N=se({},T,{params:h(v)}),B.params=h(B.params)}const z=e.resolve(N,B),ee=T.hash||"";z.params=u(d(z.params));const p=cp(n,se({},T,{hash:np(ee),path:z.path})),m=s.createHref(p);return se({fullPath:p,hash:ee,query:n===Ma?Ep(T.query):T.query||{}},z,{redirectedFrom:void 0,href:m})}function _(T){return typeof T=="string"?wi(r,T,l.value.path):se({},T)}function b(T,B){if(c!==T)return en(we.NAVIGATION_CANCELLED,{from:B,to:T})}function x(T){return U(T)}function D(T){return x(se(_(T),{replace:!0}))}function H(T,B){const N=T.matched[T.matched.length-1];if(N&&N.redirect){const{redirect:z}=N;let ee=typeof z=="function"?z(T,B):z;return typeof ee=="string"&&(ee=ee.includes("?")||ee.includes("#")?ee=_(ee):{path:ee},ee.params={}),se({query:T.query,hash:T.hash,params:ee.path!=null?{}:T.params},ee)}}function U(T,B){const N=c=w(T),z=l.value,ee=T.state,p=T.force,m=T.replace===!0,v=H(N,z);if(v)return U(se(_(v),{state:typeof v=="object"?se({},ee,v.state):ee,force:p,replace:m}),B||N);const S=N;S.redirectedFrom=B;let A;return!p&&up(n,z,N)&&(A=en(we.NAVIGATION_DUPLICATED,{to:S,from:z}),yt(z,z,!0,!1)),(A?Promise.resolve(A):V(S,z)).catch(E=>Nt(E)?Nt(E,we.NAVIGATION_GUARD_REDIRECT)?E:Xt(E):ne(E,S,z)).then(E=>{if(E){if(Nt(E,we.NAVIGATION_GUARD_REDIRECT))return U(se({replace:m},_(E.to),{state:typeof E.to=="object"?se({},ee,E.to.state):ee,force:p}),B||S)}else E=$(S,z,!0,m,ee);return Z(S,z,E),E})}function F(T,B){const N=b(T,B);return N?Promise.reject(N):Promise.resolve()}function C(T){const B=Cr.values().next().value;return B&&typeof B.runWithContext=="function"?B.runWithContext(T):T()}function V(T,B){let N;const[z,ee,p]=Ap(T,B);N=Si(z.reverse(),"beforeRouteLeave",T,B);for(const v of z)v.leaveGuards.forEach(S=>{N.push(sr(S,T,B))});const m=F.bind(null,T,B);return N.push(m),st(N).then(()=>{N=[];for(const v of i.list())N.push(sr(v,T,B));return N.push(m),st(N)}).then(()=>{N=Si(ee,"beforeRouteUpdate",T,B);for(const v of ee)v.updateGuards.forEach(S=>{N.push(sr(S,T,B))});return N.push(m),st(N)}).then(()=>{N=[];for(const v of p)if(v.beforeEnter)if(mt(v.beforeEnter))for(const S of v.beforeEnter)N.push(sr(S,T,B));else N.push(sr(v.beforeEnter,T,B));return N.push(m),st(N)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),N=Si(p,"beforeRouteEnter",T,B,C),N.push(m),st(N))).then(()=>{N=[];for(const v of o.list())N.push(sr(v,T,B));return N.push(m),st(N)}).catch(v=>Nt(v,we.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function Z(T,B,N){a.list().forEach(z=>C(()=>z(T,B,N)))}function $(T,B,N,z,ee){const p=b(T,B);if(p)return p;const m=B===tr,v=Ur?history.state:{};N&&(z||m?s.replace(T.fullPath,se({scroll:m&&v&&v.scroll},ee)):s.push(T.fullPath,ee)),l.value=T,yt(T,B,N,m),Xt()}let X;function Ae(){X||(X=s.listen((T,B,N)=>{if(!hr.listening)return;const z=w(T),ee=H(z,hr.currentRoute.value);if(ee){U(se(ee,{replace:!0,force:!0}),z).catch(An);return}c=z;const p=l.value;Ur&&vp(Ba(p.fullPath,N.delta),Xs()),V(z,p).catch(m=>Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_CANCELLED)?m:Nt(m,we.NAVIGATION_GUARD_REDIRECT)?(U(se(_(m.to),{force:!0}),z).then(v=>{Nt(v,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===zi.pop&&s.go(-1,!1)}).catch(An),Promise.reject()):(N.delta&&s.go(-N.delta,!1),ne(m,z,p))).then(m=>{m=m||$(z,p,!1),m&&(N.delta&&!Nt(m,we.NAVIGATION_CANCELLED)?s.go(-N.delta,!1):N.type===zi.pop&&Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),Z(z,p,m)}).catch(An)}))}let Be=un(),he=un(),Q;function ne(T,B,N){Xt(T);const z=he.list();return z.length?z.forEach(ee=>ee(T,B,N)):console.error(T),Promise.reject(T)}function It(){return Q&&l.value!==tr?Promise.resolve():new Promise((T,B)=>{Be.add([T,B])})}function Xt(T){return Q||(Q=!T,Ae(),Be.list().forEach(([B,N])=>T?N(T):B()),Be.reset()),T}function yt(T,B,N,z){const{scrollBehavior:ee}=t;if(!Ur||!ee)return Promise.resolve();const p=!N&&bp(Ba(T.fullPath,0))||(z||!N)&&history.state&&history.state.scroll||null;return Yr().then(()=>ee(T,B,p)).then(m=>m&&yp(m)).catch(m=>ne(m,T,B))}const Ke=T=>s.go(T);let Rr;const Cr=new Set,hr={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:e.clearRoutes,hasRoute:k,getRoutes:y,resolve:w,options:t,push:x,replace:D,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:he.add,isReady:It,install(T){T.component("RouterLink",Kp),T.component("RouterView",Qp),T.config.globalProperties.$router=hr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),Ur&&!Rr&&l.value===tr&&(Rr=!0,x(s.location).catch(z=>{}));const B={};for(const z in tr)Object.defineProperty(B,z,{get:()=>l.value[z],enumerable:!0});T.provide(ei,hr),T.provide(Co,cc(B)),T.provide(Ki,l);const N=T.unmount;Cr.add(T),T.unmount=function(){Cr.delete(T),Cr.size<1&&(c=tr,X&&X(),X=null,l.value=tr,Rr=!1,Q=!1),N()}}};function st(T){return T.reduce((B,N)=>B.then(()=>C(N)),Promise.resolve())}return hr}function Xp(){return lt(ei)}function Oo(t){return lt(Co)}const eg="/logo.svg",tg=["width","height"],rg=ur({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(oe(),Ee("img",{src:eg,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,tg))}});/**
31
31
  * @license lucide-vue-next v0.474.0 - ISC
32
32
  *
33
33
  * This source code is licensed under the ISC license.
34
34
  * See the LICENSE file in the root directory of this source tree.
35
- */const og=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
35
+ */const ng=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
36
36
  * @license lucide-vue-next v0.474.0 - ISC
37
37
  *
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
- */var ss={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
40
+ */var rs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
41
41
  * @license lucide-vue-next v0.474.0 - ISC
42
42
  *
43
43
  * This source code is licensed under the ISC license.
44
44
  * See the LICENSE file in the root directory of this source tree.
45
- */const ag=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>en("svg",{...ss,width:t||ss.width,height:t||ss.height,stroke:n||ss.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${og(i??"icon")}`],...a},[...s.map(c=>en(...c)),...l.default?[l.default()]:[]]);/**
45
+ */const sg=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>Qr("svg",{...rs,width:t||rs.width,height:t||rs.height,stroke:n||rs.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${ng(i??"icon")}`],...a},[...s.map(c=>Qr(...c)),...l.default?[l.default()]:[]]);/**
46
46
  * @license lucide-vue-next v0.474.0 - ISC
47
47
  *
48
48
  * This source code is licensed under the ISC license.
49
49
  * See the LICENSE file in the root directory of this source tree.
50
- */const Te=(t,e)=>(r,{slots:n})=>en(ag,{...r,iconNode:e,name:t},n);/**
50
+ */const Te=(t,e)=>(r,{slots:n})=>Qr(sg,{...r,iconNode:e,name:t},n);/**
51
51
  * @license lucide-vue-next v0.474.0 - ISC
52
52
  *
53
53
  * This source code is licensed under the ISC license.
54
54
  * See the LICENSE file in the root directory of this source tree.
55
- */const lg=Te("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
55
+ */const ig=Te("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
56
56
  * @license lucide-vue-next v0.474.0 - ISC
57
57
  *
58
58
  * This source code is licensed under the ISC license.
59
59
  * See the LICENSE file in the root directory of this source tree.
60
- */const cg=Te("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
60
+ */const og=Te("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
61
61
  * @license lucide-vue-next v0.474.0 - ISC
62
62
  *
63
63
  * This source code is licensed under the ISC license.
64
64
  * See the LICENSE file in the root directory of this source tree.
65
- */const ug=Te("ChartColumnIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
65
+ */const ag=Te("ChartColumnIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
66
66
  * @license lucide-vue-next v0.474.0 - ISC
67
67
  *
68
68
  * This source code is licensed under the ISC license.
69
69
  * See the LICENSE file in the root directory of this source tree.
70
- */const hg=Te("ClipboardListIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
70
+ */const lg=Te("ClipboardListIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
71
71
  * @license lucide-vue-next v0.474.0 - ISC
72
72
  *
73
73
  * This source code is licensed under the ISC license.
74
74
  * See the LICENSE file in the root directory of this source tree.
75
- */const dg=Te("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
75
+ */const cg=Te("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
76
76
  * @license lucide-vue-next v0.474.0 - ISC
77
77
  *
78
78
  * This source code is licensed under the ISC license.
79
79
  * See the LICENSE file in the root directory of this source tree.
80
- */const fg=Te("GithubIcon",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
80
+ */const ug=Te("GithubIcon",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
81
81
  * @license lucide-vue-next v0.474.0 - ISC
82
82
  *
83
83
  * This source code is licensed under the ISC license.
84
84
  * See the LICENSE file in the root directory of this source tree.
85
- */const pg=Te("HistoryIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
85
+ */const hg=Te("HistoryIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
86
86
  * @license lucide-vue-next v0.474.0 - ISC
87
87
  *
88
88
  * This source code is licensed under the ISC license.
89
89
  * See the LICENSE file in the root directory of this source tree.
90
- */const Eu=Te("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
90
+ */const _u=Te("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
91
91
  * @license lucide-vue-next v0.474.0 - ISC
92
92
  *
93
93
  * This source code is licensed under the ISC license.
94
94
  * See the LICENSE file in the root directory of this source tree.
95
- */const gg=Te("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
95
+ */const dg=Te("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
96
96
  * @license lucide-vue-next v0.474.0 - ISC
97
97
  *
98
98
  * This source code is licensed under the ISC license.
99
99
  * See the LICENSE file in the root directory of this source tree.
100
- */const mg=Te("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
100
+ */const fg=Te("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
101
101
  * @license lucide-vue-next v0.474.0 - ISC
102
102
  *
103
103
  * This source code is licensed under the ISC license.
104
104
  * See the LICENSE file in the root directory of this source tree.
105
- */const rl=Te("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
105
+ */const Za=Te("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
106
106
  * @license lucide-vue-next v0.474.0 - ISC
107
107
  *
108
108
  * This source code is licensed under the ISC license.
109
109
  * See the LICENSE file in the root directory of this source tree.
110
- */const yg=Te("Minimize2Icon",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
110
+ */const pg=Te("Minimize2Icon",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
111
111
  * @license lucide-vue-next v0.474.0 - ISC
112
112
  *
113
113
  * This source code is licensed under the ISC license.
114
114
  * See the LICENSE file in the root directory of this source tree.
115
- */const vg=Te("PanelLeftCloseIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
115
+ */const gg=Te("PanelLeftCloseIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
116
116
  * @license lucide-vue-next v0.474.0 - ISC
117
117
  *
118
118
  * This source code is licensed under the ISC license.
119
119
  * See the LICENSE file in the root directory of this source tree.
120
- */const bg=Te("PanelLeftOpenIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
120
+ */const mg=Te("PanelLeftOpenIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
121
121
  * @license lucide-vue-next v0.474.0 - ISC
122
122
  *
123
123
  * This source code is licensed under the ISC license.
124
124
  * See the LICENSE file in the root directory of this source tree.
125
- */const _g=Te("PuzzleIcon",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
125
+ */const yg=Te("PuzzleIcon",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
126
126
  * @license lucide-vue-next v0.474.0 - ISC
127
127
  *
128
128
  * This source code is licensed under the ISC license.
129
129
  * See the LICENSE file in the root directory of this source tree.
130
- */const wg=Te("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
130
+ */const vg=Te("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
131
131
  * @license lucide-vue-next v0.474.0 - ISC
132
132
  *
133
133
  * This source code is licensed under the ISC license.
134
134
  * See the LICENSE file in the root directory of this source tree.
135
- */const kg=Te("ServerIcon",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
135
+ */const bg=Te("ServerIcon",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
136
136
  * @license lucide-vue-next v0.474.0 - ISC
137
137
  *
138
138
  * This source code is licensed under the ISC license.
139
139
  * See the LICENSE file in the root directory of this source tree.
140
- */const Sg=Te("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
140
+ */const _g=Te("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
141
141
  * @license lucide-vue-next v0.474.0 - ISC
142
142
  *
143
143
  * This source code is licensed under the ISC license.
144
144
  * See the LICENSE file in the root directory of this source tree.
145
- */const Eg=Te("SquareIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
145
+ */const wg=Te("SquareIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
146
146
  * @license lucide-vue-next v0.474.0 - ISC
147
147
  *
148
148
  * This source code is licensed under the ISC license.
149
149
  * See the LICENSE file in the root directory of this source tree.
150
- */const Tg=Te("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
150
+ */const kg=Te("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
151
151
  * @license lucide-vue-next v0.474.0 - ISC
152
152
  *
153
153
  * This source code is licensed under the ISC license.
154
154
  * See the LICENSE file in the root directory of this source tree.
155
- */const Ag=Te("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),xg={key:0,class:"text-base font-bold tracking-tight bg-gradient-brand bg-clip-text text-transparent"},Rg=["title"],Cg={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},Og={key:0},Pg={class:"border-t border-border p-2 space-y-0.5"},Ig={key:0},$g=["href"],nl="https://github.com/michaeljolley/io",jg=dr({__name:"AppSidebar",setup(t){const e=jo(),r=et(!1),n=[{name:"Chat",icon:rl,path:"/"},{name:"History",icon:pg,path:"/history"},{name:"Squads",icon:Ag,path:"/squads"},{name:"Health",icon:lg,path:"/squads/health"},{name:"Usage",icon:ug,path:"/usage"},{name:"Audit Log",icon:hg,path:"/audit-log"},{name:"Skills",icon:_g,path:"/skills"},{name:"MCP Servers",icon:kg,path:"/mcp"},{name:"Schedules",icon:dg,path:"/schedules"},{name:"Wiki",icon:cg,path:"/wiki"}],s=[{name:"Chat",icon:rl,path:"/"},{name:"Feed",icon:Eu,path:"/feed"},{name:"Settings",icon:Sg,path:"/settings"}],i="1.4.0",o=Ue(()=>{let l="";const c=[...n,...s];for(const u of c){const h=u.path;(h==="/"?e.path==="/":e.path===h||e.path.startsWith(h+"/"))&&h.length>l.length&&(l=h)}return l});function a(){r.value=!r.value}return(l,c)=>{const u=xo("router-link");return oe(),Ee("aside",{class:at(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[ve("div",{class:at(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[ue(u,{to:"/",class:at(["flex items-center gap-2",r.value?"justify-center":""])},{default:Yr(()=>[ue(ig,{size:24}),r.value?Ze("",!0):(oe(),Ee("h1",xg,"IO"))]),_:1},8,["class"]),r.value?Ze("",!0):(oe(),Ee("button",{key:0,onClick:a,class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:r.value?"Expand sidebar":"Collapse sidebar"},[ue(_e(vg),{class:"w-4 h-4"})],8,Rg))],2),r.value?(oe(),Ee("button",{key:0,onClick:a,class:"mx-auto mt-2 p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Expand sidebar"},[ue(_e(bg),{class:"w-4 h-4"})])):Ze("",!0),ve("nav",Cg,[(oe(),Ee(Ye,null,Bi(n,h=>ue(u,{key:h.path,to:h.path,class:at(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Yr(()=>[(oe(),Kt(sa(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Ze("",!0):(oe(),Ee("span",Og,ms(h.name),1))]),_:2},1032,["to","class","title"])),64))]),ve("div",Pg,[(oe(),Ee(Ye,null,Bi(s,h=>ue(u,{key:h.path,to:h.path,class:at(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Yr(()=>[(oe(),Kt(sa(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Ze("",!0):(oe(),Ee("span",Ig,ms(h.name),1))]),_:2},1032,["to","class","title"])),64)),ve("div",{class:at(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?Ze("",!0):(oe(),Ee("a",{key:0,href:`${nl}/releases/tag/v${_e(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+ms(_e(i)),9,$g)),ve("a",{href:nl,target:"_blank",class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[ue(_e(fg),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function si(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Ng(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}const Lg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class No extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Dg extends No{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class sl extends No{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class il extends No{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Qi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Qi||(Qi={}));class Ug{constructor(e,{headers:r={},customFetch:n,region:s=Qi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=Lg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ng(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=n;let d={},{region:f}=n;f||(f=this.region);const g=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let y;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",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let S=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(S=o.signal,u.addEventListener("abort",()=>o.abort())):S=o.signal);const w=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:S}).catch(B=>{throw new Dg(B)}),b=w.headers.get("x-relay-error");if(b&&b==="true")throw new sl(w);if(!w.ok)throw new il(w);let _=((s=w.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return _==="application/json"?x=yield w.json():_==="application/octet-stream"||_==="application/pdf"?x=yield w.blob():_==="text/event-stream"?x=w:_==="multipart/form-data"?x=yield w.formData():x=yield w.text(),{data:x,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof il||a instanceof sl?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Tu=3,ol=t=>Math.min(1e3*2**t,3e4),Bg=[520,503],Au=["GET","HEAD","OPTIONS"];var Mg=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function al(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function Hg(t,e,r,n){return!(!n||r>=Tu||!Au.includes(t)||!Bg.includes(e))}var qg=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await n(r.url.toString(),{method:r.method,headers:c,body:JSON.stringify(r.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Au.includes(r.method))throw h;if(r.retryEnabled&&o<Tu){const d=ol(o);o++,await al(d,r.signal);continue}throw h}if(Hg(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:ol(o);await u.text(),o++,await al(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,g,y;const b=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",_=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(g=o==null?void 0:o.name)!==null&&g!==void 0?g:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
155
+ */const Sg=Te("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Eg={key:0,class:"text-base font-bold tracking-tight bg-gradient-brand bg-clip-text text-transparent"},Tg=["title"],Ag={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},xg={key:0},Rg={class:"border-t border-border p-2 space-y-0.5"},Cg={key:0},Og=["href"],Xa="https://github.com/michaeljolley/io",Pg=ur({__name:"AppSidebar",setup(t){const e=Oo(),r=et(!1),n=[{name:"Chat",icon:Za,path:"/"},{name:"History",icon:hg,path:"/history"},{name:"Squads",icon:Sg,path:"/squads"},{name:"Health",icon:ig,path:"/squads/health"},{name:"Usage",icon:ag,path:"/usage"},{name:"Audit Log",icon:lg,path:"/audit-log"},{name:"Skills",icon:yg,path:"/skills"},{name:"MCP Servers",icon:bg,path:"/mcp"},{name:"Schedules",icon:cg,path:"/schedules"},{name:"Wiki",icon:og,path:"/wiki"}],s=[{name:"Chat",icon:Za,path:"/"},{name:"Feed",icon:_u,path:"/feed"},{name:"Settings",icon:_g,path:"/settings"}],i="1.4.2",o=Ue(()=>{let l="";const c=[...n,...s];for(const u of c){const h=u.path;(h==="/"?e.path==="/":e.path===h||e.path.startsWith(h+"/"))&&h.length>l.length&&(l=h)}return l});function a(){r.value=!r.value}return(l,c)=>{const u=So("router-link");return oe(),Ee("aside",{class:at(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[ve("div",{class:at(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[ue(u,{to:"/",class:at(["flex items-center gap-2",r.value?"justify-center":""])},{default:Kr(()=>[ue(rg,{size:24}),r.value?Qe("",!0):(oe(),Ee("h1",Eg,"IO"))]),_:1},8,["class"]),r.value?Qe("",!0):(oe(),Ee("button",{key:0,onClick:a,class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:r.value?"Expand sidebar":"Collapse sidebar"},[ue(_e(gg),{class:"w-4 h-4"})],8,Tg))],2),r.value?(oe(),Ee("button",{key:0,onClick:a,class:"mx-auto mt-2 p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Expand sidebar"},[ue(_e(mg),{class:"w-4 h-4"})])):Qe("",!0),ve("nav",Ag,[(oe(),Ee(Ye,null,Ni(n,h=>ue(u,{key:h.path,to:h.path,class:at(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Kr(()=>[(oe(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Qe("",!0):(oe(),Ee("span",xg,ps(h.name),1))]),_:2},1032,["to","class","title"])),64))]),ve("div",Rg,[(oe(),Ee(Ye,null,Ni(s,h=>ue(u,{key:h.path,to:h.path,class:at(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Kr(()=>[(oe(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Qe("",!0):(oe(),Ee("span",Cg,ps(h.name),1))]),_:2},1032,["to","class","title"])),64)),ve("div",{class:at(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?Qe("",!0):(oe(),Ee("a",{key:0,href:`${Xa}/releases/tag/v${_e(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+ps(_e(i)),9,Og)),ve("a",{href:Xa,target:"_blank",class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[ue(_e(ug),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function ti(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Ig(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}const jg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Po extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class $g extends Po{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class el extends Po{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class tl extends Po{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Gi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Gi||(Gi={}));class Ng{constructor(e,{headers:r={},customFetch:n,region:s=Gi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=jg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ig(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=n;let d={},{region:f}=n;f||(f=this.region);const g=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let y;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",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let k=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(k=o.signal,u.addEventListener("abort",()=>o.abort())):k=o.signal);const w=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:k}).catch(D=>{throw new $g(D)}),_=w.headers.get("x-relay-error");if(_&&_==="true")throw new el(w);if(!w.ok)throw new tl(w);let b=((s=w.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return b==="application/json"?x=yield w.json():b==="application/octet-stream"||b==="application/pdf"?x=yield w.blob():b==="text/event-stream"?x=w:b==="multipart/form-data"?x=yield w.formData():x=yield w.text(),{data:x,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof tl||a instanceof el?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const wu=3,rl=t=>Math.min(1e3*2**t,3e4),Lg=[520,503],ku=["GET","HEAD","OPTIONS"];var Dg=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function nl(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function Ug(t,e,r,n){return!(!n||r>=wu||!ku.includes(t)||!Lg.includes(e))}var Bg=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await n(r.url.toString(),{method:r.method,headers:c,body:JSON.stringify(r.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!ku.includes(r.method))throw h;if(r.retryEnabled&&o<wu){const d=rl(o);o++,await nl(d,r.signal);continue}throw h}if(Ug(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:rl(o);await u.text(),o++,await nl(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,g,y;const _=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(g=o==null?void 0:o.name)!==null&&g!==void 0?g:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
156
156
 
157
- Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${b}`,_&&(l+=` (${_})`),h!=null&&h.stack&&(l+=`
158
- ${h.stack}`)}else{var S;l=(S=o==null?void 0:o.stack)!==null&&S!==void 0?S:""}const w=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",w>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${w} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",w>this.urlLengthLimit&&(c+=`. Your request URL is ${w} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=d:n=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Mg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Fg=class extends qg{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"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(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const ll=new RegExp("[,()]");var qr=class extends Fg{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&ll.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&ll.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Vg=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new qr({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new qr({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new qr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new qr({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new qr({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fn(t){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn(t)}function zg(t,e){if(Fn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Kg(t){var e=zg(t,"string");return Fn(e)=="symbol"?e:e+""}function Wg(t,e,r){return(e=Kg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function is(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cl(Object(r),!0).forEach(function(n){Wg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Gg=class xu{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const g=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,is(is({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",g)})}return l(c,is(is({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Vg(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new xu(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=n&&Object.values(r).some(u);h?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(a="POST",c=r);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new qr({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 Jg{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const 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:
157
+ Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${_}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
158
+ ${h.stack}`)}else{var k;l=(k=o==null?void 0:o.stack)!==null&&k!==void 0?k:""}const w=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",w>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${w} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",w>this.urlLengthLimit&&(c+=`. Your request URL is ${w} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=d:n=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Dg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Mg=class extends Bg{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"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(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const sl=new RegExp("[,()]");var Br=class extends Mg{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&sl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&sl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Hg=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new Br({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Br({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new Br({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Br({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Br({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Mn(t){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(t)}function qg(t,e){if(Mn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Mn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fg(t){var e=qg(t,"string");return Mn(e)=="symbol"?e:e+""}function Vg(t,e,r){return(e=Fg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function il(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ns(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?il(Object(r),!0).forEach(function(n){Vg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var zg=class Su{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const g=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,ns(ns({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",g)})}return l(c,ns(ns({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Hg(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new Su(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=n&&Object.values(r).some(u);h?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(a="POST",c=r);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new Br({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 Wg{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const 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:
159
159
  import ws from "ws"
160
160
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
161
161
 
162
- Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Yg="2.106.2",Zg=`realtime-js/${Yg}`,Qg="1.0.0",Ru="2.0.0",Xg=Ru,em=1e4,tm=100,ar={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Cu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Xi={connecting:"connecting",closing:"closing",closed:"closed"};class rm{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var s,i;const o=e.topic,a=(s=e.ref)!==null&&s!==void 0?s:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let g=new DataView(f),y=0;g.setUint8(y++,this.KINDS.userBroadcastPush),g.setUint8(y++,l.length),g.setUint8(y++,a.length),g.setUint8(y++,o.length),g.setUint8(y++,c.length),g.setUint8(y++,h.length),g.setUint8(y++,r),Array.from(l,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(a,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(o,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(c,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(h,w=>g.setUint8(y++,w.charCodeAt(0)));var S=new Uint8Array(f.byteLength+n.byteLength);return S.set(new Uint8Array(f),0),S.set(new Uint8Array(n),f.byteLength),S.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,o,a,l]=n;return r({join_ref:s,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+s));l=l+s;const u=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,g={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(g.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var me;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(me||(me={}));const ul=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=nm(o,t,e,s),i),{}):{}},nm=(t,e,r,n)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?Ou(i,o):eo(o)},Ou=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return am(e,r)}switch(t){case me.bool:return sm(e);case me.float4:case me.float8:case me.int2:case me.int4:case me.int8:case me.numeric:case me.oid:return im(e);case me.json:case me.jsonb:return om(e);case me.timestamp:return lm(e);case me.abstime:case me.date:case me.daterange:case me.int4range:case me.int8range:case me.money:case me.reltime:case me.text:case me.time:case me.timestamptz:case me.timetz:case me.tsrange:case me.tstzrange:return eo(e);default:return eo(e)}},eo=t=>t,sm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},im=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},om=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},am=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ou(e,a))}return t},lm=t=>typeof t=="string"?t.replace(" ","T"):t,Pu=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var On=t=>typeof t=="function"?t:function(){return t},cm=typeof self<"u"?self:null,Fr=typeof window<"u"?window:null,At=cm||Fr||globalThis,um="2.0.0",hm=1e4,dm=1e3,Ct={connecting:0,open:1,closing:2,closed:3},Ge={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ut={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},to={longpoll:"longpoll",websocket:"websocket"},fm={complete:4},ro="base64url.bearer.phx.",os=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Iu=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},pm=class{constructor(t,e,r){this.state=Ge.closed,this.topic=t,this.params=On(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new os(this,Ut.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Iu(()=>{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=Ge.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Ge.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Ge.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Ge.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,Ut.leave,On({}),this.timeout).send(),this.state=Ge.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ut.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ge.closed,this.bindings=[]}onClose(t){this.on(Ut.close,t)}onError(t){return this.on(Ut.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new os(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Ge.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ut.close,"leave")},r=new os(this,Ut.leave,On({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Ge.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Ge.closed}isErrored(){return this.state===Ge.errored}isJoined(){return this.state===Ge.joined}isJoining(){return this.state===Ge.joining}isLeaving(){return this.state===Ge.leaving}},Os=class{static request(t,e,r,n,s,i,o){if(At.XDomainRequest){let a=new At.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(At.XMLHttpRequest){let a=new At.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(At.fetch&&At.AbortController)return this.fetchRequest(t,e,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,o){let a={method:t,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),At.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,n,s,i,o){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(n))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===fm.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},gm=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},Nr=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ro)&&(this.authToken=atob(e[1].slice(ro.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=Ct.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+to.websocket),"$1/"+to.longpoll)}endpointURL(){return Os.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=Ct.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ct.open||this.readyState===Ct.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ct.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=gm(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
163
- `),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=Ct.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=Os.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},mm=class bn{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=bn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=bn.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=bn.syncDiff(this.state,s,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return bn.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(y=>y.phx_ref),d=u.metas.map(y=>y.phx_ref),f=c.metas.filter(y=>d.indexOf(y.phx_ref)<0),g=u.metas.filter(y=>h.indexOf(y.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),g.length>0&&(a[l]=this.clone(u),a[l].metas=g)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},n,s)}static syncDiff(e,r,n,s){let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}n(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},as={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,o=this.META_LENGTH+e.length+r.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+n));o=o+n;let l=r.decode(t.slice(o,o+s));o=o+s;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+s));a=a+s;let u=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ut.reply,payload:f}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+n));i=i+n;let a=r.decode(t.slice(i,i+s));i=i+s;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},ym=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||hm,this.transport=e.transport||At.WebSocket||Nr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=At&&At.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=as.encode.bind(as),this.defaultDecoder=as.decode.bind(as),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Nr?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Fr&&Fr.addEventListener&&(Fr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Fr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Fr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=On(e.params||{}),this.endPoint=`${t}/${to.websocket}`,this.vsn=e.vsn||um,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Iu(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return Nr}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Os.appendParams(Os.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=On(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Nr?this.connectWithFallback(Nr,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case Nr:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ro}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),n&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),dm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===Ct.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ut.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ct.connecting:return"connecting";case Ct.open:return"open";case Ct.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new pm(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(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||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,n,s,o)&&l.trigger(n,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Pn{constructor(e,r){const n=bm(r);this.presence=new mm(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Pn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Pn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Pn.transformState(this.presence.state)}static transformState(e){return e=vm(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=bs(s),r},{})}static onJoinPayload(e,r,n){const s=hl(r),i=bs(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=hl(r),i=bs(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function bs(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function vm(t){return JSON.parse(JSON.stringify(t))}function bm(t){return(t==null?void 0:t.events)&&{events:t.events}}function hl(t){return t!=null&&t.metas?bs(t):[]}var dl;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(dl||(dl={}));class _m{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Pn(this.channel.channelAdapter,r)}}function wm(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class km{constructor(e,r,n){const s=Sm(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>tm){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(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===ar.joined}isJoined(){return this.state===ar.joined}isJoining(){return this.state===ar.joining}isClosed(){return this.state===ar.closed}isLeaving(){return this.state===ar.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Sm(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var fl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(fl||(fl={}));var Kr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Kr||(Kr={}));var Bt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Bt||(Bt={}));class In{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new km(this.socket.socketAdapter,e,this.params),this.presence=new _m(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Pu(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(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Kr.PRESENCE]&&this.bindings[Kr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(Bt.CHANNEL_ERROR,wm(f))}),this._onClose(()=>e==null?void 0:e(Bt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Bt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=ar.errored;const g=Object.values(f).join(", ")||"error";e==null||e(Bt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{e==null||e(Bt.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&In.isFilterValueEqual(f.schema,u)&&In.isFilterValueEqual(f.table,h)&&In.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=ar.errored,r==null||r(Bt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=ar.errored&&r&&r(Bt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Kr.PRESENCE||e===Kr.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.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(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=r.timeout)!==null&&n!==void 0?n: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(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(e,r,n){const s=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,n),o={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,g=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:o}=Cu;return r&&[n,s,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.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 r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=ul(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ul(e.columns,e.old_record)),r}}class Em{constructor(e,r){this.socket=new ym(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Xi.connecting}isDisconnecting(){return this.socket.connectionState()==Xi.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const pl={HEARTBEAT_INTERVAL:25e3},Tm=[1e3,2e3,5e3,1e4],Am=1e4;function xm(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function Rm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return xm()}const Cm=`
162
+ Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Kg="2.106.2",Gg=`realtime-js/${Kg}`,Jg="1.0.0",Eu="2.0.0",Yg=Eu,Qg=1e4,Zg=100,or={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Tu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ji={connecting:"connecting",closing:"closing",closed:"closed"};class Xg{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var s,i;const o=e.topic,a=(s=e.ref)!==null&&s!==void 0?s:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let g=new DataView(f),y=0;g.setUint8(y++,this.KINDS.userBroadcastPush),g.setUint8(y++,l.length),g.setUint8(y++,a.length),g.setUint8(y++,o.length),g.setUint8(y++,c.length),g.setUint8(y++,h.length),g.setUint8(y++,r),Array.from(l,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(a,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(o,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(c,w=>g.setUint8(y++,w.charCodeAt(0))),Array.from(h,w=>g.setUint8(y++,w.charCodeAt(0)));var k=new Uint8Array(f.byteLength+n.byteLength);return k.set(new Uint8Array(f),0),k.set(new Uint8Array(n),f.byteLength),k.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,o,a,l]=n;return r({join_ref:s,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+s));l=l+s;const u=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,g={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(g.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var me;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(me||(me={}));const ol=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=em(o,t,e,s),i),{}):{}},em=(t,e,r,n)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?Au(i,o):Yi(o)},Au=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return sm(e,r)}switch(t){case me.bool:return tm(e);case me.float4:case me.float8:case me.int2:case me.int4:case me.int8:case me.numeric:case me.oid:return rm(e);case me.json:case me.jsonb:return nm(e);case me.timestamp:return im(e);case me.abstime:case me.date:case me.daterange:case me.int4range:case me.int8range:case me.money:case me.reltime:case me.text:case me.time:case me.timestamptz:case me.timetz:case me.tsrange:case me.tstzrange:return Yi(e);default:return Yi(e)}},Yi=t=>t,tm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},rm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},nm=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},sm=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Au(e,a))}return t},im=t=>typeof t=="string"?t.replace(" ","T"):t,xu=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var xn=t=>typeof t=="function"?t:function(){return t},om=typeof self<"u"?self:null,Mr=typeof window<"u"?window:null,At=om||Mr||globalThis,am="2.0.0",lm=1e4,cm=1e3,Ct={connecting:0,open:1,closing:2,closed:3},Ge={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ut={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Qi={longpoll:"longpoll",websocket:"websocket"},um={complete:4},Zi="base64url.bearer.phx.",ss=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Ru=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},hm=class{constructor(t,e,r){this.state=Ge.closed,this.topic=t,this.params=xn(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ss(this,Ut.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ru(()=>{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=Ge.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Ge.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Ge.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Ge.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new ss(this,Ut.leave,xn({}),this.timeout).send(),this.state=Ge.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ut.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ge.closed,this.bindings=[]}onClose(t){this.on(Ut.close,t)}onError(t){return this.on(Ut.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new ss(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Ge.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ut.close,"leave")},r=new ss(this,Ut.leave,xn({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Ge.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Ge.closed}isErrored(){return this.state===Ge.errored}isJoined(){return this.state===Ge.joined}isJoining(){return this.state===Ge.joining}isLeaving(){return this.state===Ge.leaving}},Rs=class{static request(t,e,r,n,s,i,o){if(At.XDomainRequest){let a=new At.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(At.XMLHttpRequest){let a=new At.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(At.fetch&&At.AbortController)return this.fetchRequest(t,e,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,o){let a={method:t,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),At.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,n,s,i,o){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(n))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===um.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},dm=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},Ir=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Zi)&&(this.authToken=atob(e[1].slice(Zi.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=Ct.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Qi.websocket),"$1/"+Qi.longpoll)}endpointURL(){return Rs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=Ct.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ct.open||this.readyState===Ct.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ct.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=dm(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
163
+ `),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=Ct.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=Rs.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},fm=class mn{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=mn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=mn.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=mn.syncDiff(this.state,s,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return mn.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(y=>y.phx_ref),d=u.metas.map(y=>y.phx_ref),f=c.metas.filter(y=>d.indexOf(y.phx_ref)<0),g=u.metas.filter(y=>h.indexOf(y.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),g.length>0&&(a[l]=this.clone(u),a[l].metas=g)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},n,s)}static syncDiff(e,r,n,s){let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}n(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},is={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,o=this.META_LENGTH+e.length+r.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+n));o=o+n;let l=r.decode(t.slice(o,o+s));o=o+s;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+s));a=a+s;let u=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ut.reply,payload:f}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+n));i=i+n;let a=r.decode(t.slice(i,i+s));i=i+s;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},pm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||lm,this.transport=e.transport||At.WebSocket||Ir,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=At&&At.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=is.encode.bind(is),this.defaultDecoder=is.decode.bind(is),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Ir?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Mr&&Mr.addEventListener&&(Mr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Mr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Mr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=xn(e.params||{}),this.endPoint=`${t}/${Qi.websocket}`,this.vsn=e.vsn||am,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ru(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return Ir}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Rs.appendParams(Rs.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=xn(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ir?this.connectWithFallback(Ir,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case Ir:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Zi}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),n&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),cm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===Ct.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ut.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ct.connecting:return"connecting";case Ct.open:return"open";case Ct.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new hm(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(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||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,n,s,o)&&l.trigger(n,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Rn{constructor(e,r){const n=mm(r);this.presence=new fm(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Rn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Rn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rn.transformState(this.presence.state)}static transformState(e){return e=gm(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=ys(s),r},{})}static onJoinPayload(e,r,n){const s=al(r),i=ys(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=al(r),i=ys(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function ys(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function gm(t){return JSON.parse(JSON.stringify(t))}function mm(t){return(t==null?void 0:t.events)&&{events:t.events}}function al(t){return t!=null&&t.metas?ys(t):[]}var ll;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ll||(ll={}));class ym{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Rn(this.channel.channelAdapter,r)}}function vm(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class bm{constructor(e,r,n){const s=_m(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Zg){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(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===or.joined}isJoined(){return this.state===or.joined}isJoining(){return this.state===or.joining}isClosed(){return this.state===or.closed}isLeaving(){return this.state===or.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function _m(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var cl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(cl||(cl={}));var Fr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Fr||(Fr={}));var Bt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Bt||(Bt={}));class Cn{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new bm(this.socket.socketAdapter,e,this.params),this.presence=new ym(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=xu(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(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Fr.PRESENCE]&&this.bindings[Fr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(Bt.CHANNEL_ERROR,vm(f))}),this._onClose(()=>e==null?void 0:e(Bt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Bt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=or.errored;const g=Object.values(f).join(", ")||"error";e==null||e(Bt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{e==null||e(Bt.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&Cn.isFilterValueEqual(f.schema,u)&&Cn.isFilterValueEqual(f.table,h)&&Cn.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=or.errored,r==null||r(Bt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=or.errored&&r&&r(Bt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Fr.PRESENCE||e===Fr.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.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(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=r.timeout)!==null&&n!==void 0?n: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(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(e,r,n){const s=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,n),o={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,g=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:o}=Tu;return r&&[n,s,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.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 r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=ol(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ol(e.columns,e.old_record)),r}}class wm{constructor(e,r){this.socket=new pm(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Ji.connecting}isDisconnecting(){return this.socket.connectionState()==Ji.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ul={HEARTBEAT_INTERVAL:25e3},km=[1e3,2e3,5e3,1e4],Sm=1e4;function Em(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function Tm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Em()}const Am=`
164
164
  addEventListener("message", (e) => {
165
165
  if (e.data.event === "start") {
166
166
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
167
167
  }
168
- });`;class Om{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;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 rm,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),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new Em(e,s),this.httpEndpoint=Pu(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r}
168
+ });`;class xm{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;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 Xg,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),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new wm(e,s),this.httpEndpoint=xu(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r}
169
169
 
170
170
  To use Realtime in Node.js, you need to provide a WebSocket implementation:
171
171
 
@@ -178,10 +178,10 @@ Option 2: Install and provide the "ws" package:
178
178
  const client = new RealtimeClient(url, {
179
179
  ...options,
180
180
  transport: ws
181
- })`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||Xi.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new In(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:Zg};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Cu.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Cm],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const g={};g.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:em,g.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:pl.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:pl.HEARTBEAT_INTERVAL),g.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Jg.getWebSocketConstructor(),g.params=e==null?void 0:e.params,g.logger=e==null?void 0:e.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),g.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:Rm(),g.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(b=>Tm[b-1]||Am);let y,S;const w=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Xg;switch(w){case Qg:y=(b,_)=>_(JSON.stringify(b)),S=(b,_)=>_(JSON.parse(b));break;case Ru:y=this.serializer.encode.bind(this.serializer),S=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=w,g.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:y,g.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:S,g.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,g.params=Object.assign(Object.assign({},g.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Vn=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Pm(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Im(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function $m(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Pm(t.baseUrl,n,s),l=await Im(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,g=f==null?void 0:f.error;throw new Vn((g==null?void 0:g.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function ls(t){return t.join("")}var jm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:ls(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ls(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ls(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ls(t.namespace)}`}),!0}catch(e){if(e instanceof Vn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Vn&&r.status===409)return;throw r}}};function Lr(t){return t.join("")}var Nm=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Lr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Vn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Vn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},Lm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=$m({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new jm(this.client,e),this.tableOps=new Nm(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function zn(t){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(t)}function Dm(t,e){if(zn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(zn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Um(t){var e=Dm(t,"string");return zn(e)=="symbol"?e:e+""}function Bm(t,e,r){return(e=Um(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function K(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gl(Object(r),!0).forEach(function(n){Bm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ii=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function oi(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var no=class extends ii{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return K({},super.toJSON())}},$u=class extends ii{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Ps(t,e,r){const n=K({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Mm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Hm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),qm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},so=t=>{if(Array.isArray(t))return t.map(r=>so(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=so(n)}),e},Fm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),ml=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},Vm=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;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+"";e(new no(ml(o),i,a,n))}).catch(()=>{const o=i+"";e(new no(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new $u(ml(t),t,n))},zm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return K(K({},s),r);if(qm(n)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),K(K({},s),r)};async function pn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,zm(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.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=>Vm(c,l,n,o))})}function ju(t="storage"){return{get:async(e,r,n,s)=>pn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>pn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>pn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>pn(e,"HEAD",r,K(K({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>pn(e,"DELETE",r,s,i,n,t)}}const Km=ju("storage"),{get:Kn,post:ht,put:io,head:Wm,remove:Lo}=Km,Xe=ju("vectors");var ln=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Mm(e),this.fetch=Hm(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Ps(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(oi(r))return{data:null,error:r};throw r}}};let Nu;Nu=Symbol.toStringTag;var Gm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Nu]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(oi(e))return{data:null,error:e};throw e}}};let Lu;Lu=Symbol.toStringTag;var Jm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Lu]="BlobDownloadBuilder",this.promise=null}asStream(){return new Gm(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(oi(e))return{data:null,error:e};throw e}}};const Ym={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},yl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Zm=class extends ln{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=K(K({},yl),n);let a=K(K({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,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")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?io:ht)(s.fetch,`${s.url}/object/${u}`,i,K({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l;const c=K(K({},yl),n);let u=K(K({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=r,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")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))u=Ps(u,d,f);return{path:i,fullPath:(await io(s.fetch,a.toString(),l,K({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=K({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await ht(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new ii("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await ht(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await ht(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await ht(n.fetch,`${n.url}/object/sign/${s}`,K({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await ht(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const o=i.toString();return s.map(a=>K(K({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),a=()=>Kn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Jm(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>so(await Kn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Wm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(oi(s)){var n;const i=s instanceof no?s.status:s instanceof $u?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=K(K(K({},Ym),e),{},{prefix:t||""});return await ht(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=K({},t);return await ht(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const Qm="2.106.2",Xn={"X-Client-Info":`storage-js/${Qm}`};var Xm=class extends ln{constructor(t,e={},r,n){const s=new URL(t);n!=null&&n.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=K(K({},Xn),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Kn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Kn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ht(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await io(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await ht(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},ey=class extends ln{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=K(K({},Xn),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ht(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Kn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Fm(t))throw new ii("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new Lm({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{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(n)throw l;return{data:null,error:l}}}}})}},ty=class extends ln{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=K(K({},Xn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},ry=class extends ln{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=K(K({},Xn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ny=class extends ln{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=K(K({},Xn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},sy=class extends ny{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new iy(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},iy=class extends ty{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new oy(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},oy=class extends ry{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,K(K({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},ay=class extends Xm{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Zm(this.url,this.headers,t,this.fetch)}get vectors(){return new sy(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ey(this.url+"/iceberg",this.headers,this.fetch)}};const Du="2.106.2",Vr=30*1e3,oo=3,Ri=oo*Vr,ly="http://localhost:9999",cy="supabase.auth.token",uy={"X-Client-Info":`gotrue-js/${Du}`},ao="X-Supabase-Api-Version",Uu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},hy=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,dy=600*1e3;class sn extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function I(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class fy extends sn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function py(t){return I(t)&&t.name==="AuthApiError"}class dt extends sn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Xt extends sn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Ie extends Xt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function cs(t){return I(t)&&t.name==="AuthSessionMissingError"}class Dr extends Xt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class us extends Xt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class hs extends Xt{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function gy(t){return I(t)&&t.name==="AuthImplicitGrantRedirectError"}class vl extends Xt{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class my 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 lo extends Xt{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ci(t){return I(t)&&t.name==="AuthRetryableFetchError"}class bl extends Xt{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class co extends Xt{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Is="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),_l=`
182
- \r=`.split(""),yy=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<_l.length;e+=1)t[_l[e].charCodeAt(0)]=-2;for(let e=0;e<Is.length;e+=1)t[Is[e].charCodeAt(0)]=e;return t})();function wl(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}}function Bu(t,e,r){const n=yy[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function kl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{_y(o,n,r)};for(let o=0;o<t.length;o+=1)Bu(t.charCodeAt(o),s,i);return e.join("")}function vy(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function by(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}vy(n,e)}}function _y(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Zr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Bu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function wy(t){const e=[];return by(t,r=>e.push(r)),new Uint8Array(e)}function Er(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>wl(s,r,n)),wl(null,r,n),e.join("")}function ky(t){return Math.round(Date.now()/1e3)+t}function Sy(){return Symbol("auth-callback")}const Ne=()=>typeof window<"u"&&typeof document<"u",vr={tested:!1,writable:!1},Mu=()=>{if(!Ne())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(vr.tested)return vr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),vr.tested=!0,vr.writable=!0}catch{vr.tested=!0,vr.writable=!1}return vr.writable};function Ey(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Hu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ty=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",zr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},br=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},je=async(t,e)=>{await t.removeItem(e)};class ai{constructor(){this.promise=new ai.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}ai.promiseConstructor=Promise;function ds(t){const e=t.split(".");if(e.length!==3)throw new co("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!hy.test(e[n]))throw new co("JWT not in base64url format");return{header:JSON.parse(kl(e[0])),payload:JSON.parse(kl(e[1])),signature:Zr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Ay(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function xy(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function Ry(t){return("0"+t.toString(16)).substr(-2)}function Cy(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,Ry).join("")}async function Oy(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Py(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await Oy(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ur(t,e,r=!1){const n=Cy();let s=n;r&&(s+="/recovery"),await zr(t,`${e}-code-verifier`,s);const i=await Py(n);return[i,n===i?"plain":"s256"]}const Iy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function $y(t){const e=t.headers.get(ao);if(!e||!e.match(Iy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function jy(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Ny(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Ly=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Lt(t){if(!Ly.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ut(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Oi(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Dy(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function Sl(t){return JSON.parse(JSON.stringify(t))}const wr=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},Uy=[502,503,504,520,521,522,523,524,530];async function El(t){var e;if(!Ty(t))throw new lo(wr(t),0);if(Uy.includes(t.status))throw new lo(wr(t),t.status);let r;try{r=await t.json()}catch(i){throw new dt(wr(i),i)}let n;const s=$y(t);if(s&&s.getTime()>=Uu["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new bl(wr(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ie}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new bl(wr(r),t.status,r.weak_password.reasons);throw new fy(wr(r),t.status||500,n)}const By=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function U(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[ao]||(i[ao]=Uu["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await My(t,e,r+a,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function My(t,e,r,n,s,i){const o=By(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new lo(wr(l),0)}if(a.ok||await El(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await El(l)}}function ot(t){var e;let r=null;Fy(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=ky(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function Tl(t){const e=ot(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function lr(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Hy(t){return{data:t,error:null}}function qy(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=si(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Al(t){return t}function Fy(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Pi=["global","local","others"];class Vy{_encodePathSegment(e){if(e==="."||e==="..")throw new sn("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Hu(n),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(e,r=Pi[0]){if(Pi.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Pi.join(", ")}`);try{return await U(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(I(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await U(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:lr})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=si(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await U(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:qy,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(I(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await U(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:lr})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Al});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const y=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Lt(e);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:lr})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Lt(e);try{return await U(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:lr})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Lt(e);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:lr})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Lt(e.userId);try{const{data:r,error:n}=await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Lt(e.userId),Lt(e.id);try{return{data:await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Al});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const y=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(g.split(";")[1].split("=")[1]);c[`${S}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await U(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await U(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await U(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await U(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(I(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await U(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await U(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await U(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await U(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){ut(this.experimental),Lt(e.userId);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){ut(this.experimental),Lt(e.userId),Lt(e.passkeyId);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}}function xl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const kt={debug:!!(globalThis&&Mu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class qu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Rl extends qu{}async function zy(t,e,r){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Rl(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(kt.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 r()}})}catch(i){if(e>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(n.signal.aborted)return kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new Rl(`Lock "${t}" was released because another request stole it`)}throw i}}function Ky(){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 Fu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Wy(t){return parseInt(t,16)}function Gy(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Jy(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
183
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Fu(t.address),g=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
184
- `:"",S=`${g} wants you to sign in with your Ethereum account:
181
+ })`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||Ji.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new Cn(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:Gg};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Tu.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Am],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const g={};g.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:Qg,g.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ul.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:ul.HEARTBEAT_INTERVAL),g.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Wg.getWebSocketConstructor(),g.params=e==null?void 0:e.params,g.logger=e==null?void 0:e.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),g.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:Tm(),g.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>km[_-1]||Sm);let y,k;const w=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Yg;switch(w){case Jg:y=(_,b)=>b(JSON.stringify(_)),k=(_,b)=>b(JSON.parse(_));break;case Eu:y=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=w,g.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:y,g.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:k,g.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,g.params=Object.assign(Object.assign({},g.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Hn=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Rm(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Cm(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Om(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Rm(t.baseUrl,n,s),l=await Cm(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,g=f==null?void 0:f.error;throw new Hn((g==null?void 0:g.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function os(t){return t.join("")}var Pm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:os(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${os(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${os(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${os(t.namespace)}`}),!0}catch(e){if(e instanceof Hn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return;throw r}}};function jr(t){return t.join("")}var Im=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${jr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},jm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Om({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Pm(this.client,e),this.tableOps=new Im(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function qn(t){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qn(t)}function $m(t,e){if(qn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nm(t){var e=$m(t,"string");return qn(e)=="symbol"?e:e+""}function Lm(t,e,r){return(e=Nm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function G(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hl(Object(r),!0).forEach(function(n){Lm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ri=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ni(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Xi=class extends ri{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return G({},super.toJSON())}},Cu=class extends ri{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Cs(t,e,r){const n=G({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Dm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Um=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Bm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},eo=t=>{if(Array.isArray(t))return t.map(r=>eo(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=eo(n)}),e},Mm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),dl=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},Hm=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;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+"";e(new Xi(dl(o),i,a,n))}).catch(()=>{const o=i+"";e(new Xi(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new Cu(dl(t),t,n))},qm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return G(G({},s),r);if(Bm(n)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Cs(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),G(G({},s),r)};async function hn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,qm(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.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=>Hm(c,l,n,o))})}function Ou(t="storage"){return{get:async(e,r,n,s)=>hn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>hn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>hn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>hn(e,"HEAD",r,G(G({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>hn(e,"DELETE",r,s,i,n,t)}}const Fm=Ou("storage"),{get:Fn,post:ht,put:to,head:Vm,remove:Io}=Fm,Xe=Ou("vectors");var sn=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Dm(e),this.fetch=Um(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Cs(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ni(r))return{data:null,error:r};throw r}}};let Pu;Pu=Symbol.toStringTag;var zm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Pu]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ni(e))return{data:null,error:e};throw e}}};let Iu;Iu=Symbol.toStringTag;var Wm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Iu]="BlobDownloadBuilder",this.promise=null}asStream(){return new zm(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ni(e))return{data:null,error:e};throw e}}};const Km={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Gm=class extends sn{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=G(G({},fl),n);let a=G(G({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,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")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))a=Cs(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?to:ht)(s.fetch,`${s.url}/object/${u}`,i,G({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l;const c=G(G({},fl),n);let u=G(G({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=r,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")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))u=Cs(u,d,f);return{path:i,fullPath:(await to(s.fetch,a.toString(),l,G({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=G({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await ht(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new ri("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await ht(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await ht(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await ht(n.fetch,`${n.url}/object/sign/${s}`,G({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await ht(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const o=i.toString();return s.map(a=>G(G({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),a=()=>Fn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Wm(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>eo(await Fn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Vm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ni(s)){var n;const i=s instanceof Xi?s.status:s instanceof Cu?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Io(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=G(G(G({},Km),e),{},{prefix:t||""});return await ht(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=G({},t);return await ht(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const Jm="2.106.2",Yn={"X-Client-Info":`storage-js/${Jm}`};var Ym=class extends sn{constructor(t,e={},r,n){const s=new URL(t);n!=null&&n.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=G(G({},Yn),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Fn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ht(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await to(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await ht(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Qm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ht(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Fn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Mm(t))throw new ri("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new jm({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{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(n)throw l;return{data:null,error:l}}}}})}},Zm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Xm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ey=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},ty=class extends ey{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new ry(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},ry=class extends Zm{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new ny(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},ny=class extends Xm{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},sy=class extends Ym{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Gm(this.url,this.headers,t,this.fetch)}get vectors(){return new ty(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Qm(this.url+"/iceberg",this.headers,this.fetch)}};const ju="2.106.2",Hr=30*1e3,ro=3,Ei=ro*Hr,iy="http://localhost:9999",oy="supabase.auth.token",ay={"X-Client-Info":`gotrue-js/${ju}`},no="X-Supabase-Api-Version",$u={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ly=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,cy=600*1e3;class tn extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function I(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class uy extends tn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function hy(t){return I(t)&&t.name==="AuthApiError"}class dt extends tn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Zt extends tn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Ie extends Zt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function as(t){return I(t)&&t.name==="AuthSessionMissingError"}class $r extends Zt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ls extends Zt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class cs extends Zt{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function dy(t){return I(t)&&t.name==="AuthImplicitGrantRedirectError"}class pl extends Zt{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class fy extends Zt{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 so extends Zt{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ti(t){return I(t)&&t.name==="AuthRetryableFetchError"}class gl extends Zt{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class io extends Zt{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ml=`
182
+ \r=`.split(""),py=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ml.length;e+=1)t[ml[e].charCodeAt(0)]=-2;for(let e=0;e<Os.length;e+=1)t[Os[e].charCodeAt(0)]=e;return t})();function yl(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Os[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Os[n]),e.queuedBits-=6}}function Nu(t,e,r){const n=py[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function vl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{yy(o,n,r)};for(let o=0;o<t.length;o+=1)Nu(t.charCodeAt(o),s,i);return e.join("")}function gy(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function my(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}gy(n,e)}}function yy(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Gr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Nu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function vy(t){const e=[];return my(t,r=>e.push(r)),new Uint8Array(e)}function kr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>yl(s,r,n)),yl(null,r,n),e.join("")}function by(t){return Math.round(Date.now()/1e3)+t}function _y(){return Symbol("auth-callback")}const Ne=()=>typeof window<"u"&&typeof document<"u",mr={tested:!1,writable:!1},Lu=()=>{if(!Ne())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(mr.tested)return mr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),mr.tested=!0,mr.writable=!0}catch{mr.tested=!0,mr.writable=!1}return mr.writable};function wy(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Du=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ky=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",qr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},yr=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},$e=async(t,e)=>{await t.removeItem(e)};class si{constructor(){this.promise=new si.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}si.promiseConstructor=Promise;function us(t){const e=t.split(".");if(e.length!==3)throw new io("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!ly.test(e[n]))throw new io("JWT not in base64url format");return{header:JSON.parse(vl(e[0])),payload:JSON.parse(vl(e[1])),signature:Gr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Sy(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Ey(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function Ty(t){return("0"+t.toString(16)).substr(-2)}function Ay(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,Ty).join("")}async function xy(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Ry(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await xy(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Nr(t,e,r=!1){const n=Ay();let s=n;r&&(s+="/recovery"),await qr(t,`${e}-code-verifier`,s);const i=await Ry(n);return[i,n===i?"plain":"s256"]}const Cy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Oy(t){const e=t.headers.get(no);if(!e||!e.match(Cy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Py(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Iy(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const jy=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Lt(t){if(!jy.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ut(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Ai(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function $y(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function bl(t){return JSON.parse(JSON.stringify(t))}const br=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},Ny=[502,503,504,520,521,522,523,524,530];async function _l(t){var e;if(!ky(t))throw new so(br(t),0);if(Ny.includes(t.status))throw new so(br(t),t.status);let r;try{r=await t.json()}catch(i){throw new dt(br(i),i)}let n;const s=Oy(t);if(s&&s.getTime()>=$u["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new gl(br(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ie}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new gl(br(r),t.status,r.weak_password.reasons);throw new uy(br(r),t.status||500,n)}const Ly=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function M(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[no]||(i[no]=$u["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Dy(t,e,r+a,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function Dy(t,e,r,n,s,i){const o=Ly(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new so(br(l),0)}if(a.ok||await _l(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await _l(l)}}function ot(t){var e;let r=null;My(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=by(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function wl(t){const e=ot(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function ar(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Uy(t){return{data:t,error:null}}function By(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=ti(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function kl(t){return t}function My(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const xi=["global","local","others"];class Hy{_encodePathSegment(e){if(e==="."||e==="..")throw new tn("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Du(n),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(e,r=xi[0]){if(xi.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${xi.join(", ")}`);try{return await M(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(I(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await M(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ti(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await M(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:By,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(I(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await M(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ar})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await M(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:kl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const y=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(g.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Lt(e);try{return await M(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ar})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Lt(e);try{return await M(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Lt(e);try{return await M(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Lt(e.userId);try{const{data:r,error:n}=await M(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Lt(e.userId),Lt(e.id);try{return{data:await M(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await M(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:kl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const y=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(g.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await M(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await M(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await M(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await M(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await M(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await M(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(I(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await M(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await M(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await M(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await M(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){ut(this.experimental),Lt(e.userId);try{return await M(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){ut(this.experimental),Lt(e.userId),Lt(e.passkeyId);try{return await M(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}}function Sl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const kt={debug:!!(globalThis&&Lu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Uu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class El extends Uu{}async function qy(t,e,r){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new El(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(kt.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 r()}})}catch(i){if(e>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(n.signal.aborted)return kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new El(`Lock "${t}" was released because another request stole it`)}throw i}}function Fy(){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 Bu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Vy(t){return parseInt(t,16)}function zy(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Wy(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
183
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Bu(t.address),g=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
184
+ `:"",k=`${g} wants you to sign in with your Ethereum account:
185
185
  ${f}
186
186
 
187
187
  ${y}`;let w=`URI: ${h}
@@ -191,16 +191,17 @@ Nonce: ${o}`:""}
191
191
  Issued At: ${i.toISOString()}`;if(s&&(w+=`
192
192
  Expiration Time: ${s.toISOString()}`),a&&(w+=`
193
193
  Not Before: ${a.toISOString()}`),l&&(w+=`
194
- Request ID: ${l}`),c){let b=`
195
- Resources:`;for(const _ of c){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);b+=`
196
- - ${_}`}w+=b}return`${S}
197
- ${w}`}class Re extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Re{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Yy({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Re({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Re({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Re({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Re({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Re({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Re({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Re({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Vu(o)){if(i.rp.id!==o)return new Re({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Re({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Re({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Zy({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Re({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Vu(n)){if(r.rpId!==n)return new Re({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Re({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Qy{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const uo=new Qy;function Cl(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=si(t,["challenge","user","excludeCredentials"]),i=Zr(e).buffer,o=Object.assign(Object.assign({},r),{id:Zr(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Zr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Ol(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=si(t,["challenge","allowCredentials"]),s=Zr(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Zr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function Pl(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:Er(new Uint8Array(t.response.attestationObject)),clientDataJSON:Er(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Il(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Er(new Uint8Array(s.authenticatorData)),clientDataJSON:Er(new Uint8Array(s.clientDataJSON)),signature:Er(new Uint8Array(s.signature)),userHandle:s.userHandle?Er(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Vu(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function js(){var t,e;return!!(Ne()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function zu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:Yy({error:e,options:t})}}}async function Ku(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:Zy({error:e,options:t})}}}const Xy={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},ev={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ns(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(e(o)){const a=n[i];e(a)?n[i]=Ns(a,o):n[i]=Ns(o)}else n[i]=o}return n}function tv(t,e){return Ns(Xy,t,e||{})}function rv(t,e){return Ns(ev,t,e||{})}class nv{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const c=s??uo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=n;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,g=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${g}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=tv(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await zu({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=rv(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Ku(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new dt("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new sn("rpId is required for WebAuthn authentication")};try{if(!js())return{data:null,error:new dt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new sn("rpId is required for WebAuthn registration")};try{if(!js())return{data:null,error:new dt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in register",o)}}}}Ky();const sv={url:ly,storageKey:cy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:uy,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function $l(t,e,r){return await r()}const Br={};class Wn{get jwks(){var e,r;return(r=(e=Br[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Br[this.storageKey]=Object.assign(Object.assign({},Br[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Br[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Br[this.storageKey]=Object.assign(Object.assign({},Br[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,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({},sv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=Wn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Wn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ne()){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=(n=o.experimental)!==null&&n!==void 0?n:{},this.admin=new Vy({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Hu(o.fetch),this.lock=o.lock||$l,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&&Ne()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=zy:this.lock=$l,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 nv(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:Mu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=xl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=xl(this.memoryStorage)),Ne()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Du}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Ne()&&(r=Ey(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ne()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),gy(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=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(r){return I(r)?this._returnResult({error:r}):this._returnResult({error:new dt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:ot}),{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(I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await Ur(this.storage,this.storageKey)),i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:g},xform:ot})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},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:ot})}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 je(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 je(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await U(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:Tl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await U(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:Tl})}else throw new us("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new Dr;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,o,a,l,c,u,h,d;let f,g;if("message"in e)f=e.message,g=e.signature;else{const{chain:y,wallet:S,statement:w,options:b}=e;let _;if(Ne())if(typeof S=="object")_=S;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")_=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 S!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=S}const x=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),B=await _.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!B||B.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const H=Fu(B[0]);let M=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!M){const C=await _.request({method:"eth_chainId"});M=Wy(C)}const G={domain:x.host,address:H,statement:w,uri:x.href,version:"1",chainId:M,nonce:(s=b==null?void 0:b.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Jy(G),g=await _.request({method:"personal_sign",params:[Gy(f),H]})}try{const{data:y,error:S}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ot});if(S)throw S;if(!y||!y.session||!y.user){const w=new Dr;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:S})}catch(y){if(I(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,s,i,o,a,l,c,u,h,d,f;let g,y;if("message"in e)g=e.message,y=e.signature;else{const{chain:S,wallet:w,statement:b,options:_}=e;let x;if(Ne())if(typeof w=="object")x=w;else{const H=window;if("solana"in H&&typeof H.solana=="object"&&("signIn"in H.solana&&typeof H.solana.signIn=="function"||"signMessage"in H.solana&&typeof H.solana.signMessage=="function"))x=H.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const B=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in x&&x.signIn){const H=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:B.host,uri:B.href}),b?{statement:b}:null));let M;if(Array.isArray(H)&&H[0]&&typeof H[0]=="object")M=H[0];else if(H&&typeof H=="object"&&"signedMessage"in H&&"signature"in H)M=H;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in M&&"signature"in M&&(typeof M.signedMessage=="string"||M.signedMessage instanceof Uint8Array)&&M.signature instanceof Uint8Array)g=typeof M.signedMessage=="string"?M.signedMessage:new TextDecoder().decode(M.signedMessage),y=M.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${B.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${B.href}`,`Issued At: ${(s=(n=_==null?void 0:_.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(u=_==null?void 0:_.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(M=>`- ${M}`)]:[]].join(`
198
- `);const H=await x.signMessage(new TextEncoder().encode(g),"utf8");if(!H||!(H instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=H}}try{const{data:S,error:w}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Er(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ot});if(w)throw w;if(!S||!S.session||!S.user){const b=new Dr;return this._returnResult({data:{user:null,session:null},error:b})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:w})}catch(S){if(I(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async _exchangeCodeForSession(e){const r=await br(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new my;const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ot});if(await je(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Dr;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 je(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ot}),{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 Dr;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Ur(this.storage,this.storageKey));const{error:h}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await U(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 je(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:a}=await U(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ot});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Ur(this.storage,this.storageKey));const c=await U(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Hy});return!((i=c.data)===null||i===void 0)&&i.url&&Ne()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await je(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Ie;const{error:s}=await U(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(I(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await U(this.fetch,"POST",r,{headers:this.headers,body:{email:n,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 e){const{phone:n,type:s,options:i}=e,{data:o,error:a}=await U(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,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(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await br(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Ri:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await br(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Oi()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=Dy(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.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(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:lr}):await this._useSession(async r=>{var n,s,i;const{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ie}:await U(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:lr})})}catch(r){if(I(r))return cs(r)&&(await this._removeSession(),await je(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new Ie;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Ur(this.storage,this.storageKey));const{data:c,error:u}=await U(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:lr});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(n){if(await je(this.storage,`${this.storageKey}-code-verifier`),I(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ie;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=ds(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(I(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Ie;const{data:s,error:i}=await this._callRefreshToken(e.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(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Ne())throw new hs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new hs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new vl("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(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new vl("No code detected.");const{data:_,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const B=new URL(window.location.href);return B.searchParams.delete("code"),window.history.replaceState(window.history.state,"",B.toString()),{data:{session:_.session,redirectType:(n=_.redirectType)!==null&&n!==void 0?n: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}=e;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 g=f-h;g*1e3<=Vr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:S,error:w}=await this._getUser(o);if(w)throw w;const b={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(s){if(I(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await br(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!cs(i))return this._returnResult({error:i});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(py(a)&&(a.status===404||a.status===401||a.status===403)||cs(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await je(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=Sy(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),cs(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Ur(this.storage,this.storageKey,!0));try{return await U(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await je(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,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`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await U(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 Ne()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(I(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ot}),{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 Dr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await je(this.storage,`${this.storageKey}-code-verifier`),I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await U(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await xy(async s=>(s>0&&await Ay(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await U(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ot})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Ci(i)&&Date.now()+o-n<Vr})}catch(n){if(this._debug(r,"error",n),I(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Ne()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await br(this.storage,this.storageKey);if(s&&this.userStorage){let o=await br(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await zr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Oi()}else if(s&&!s.user&&!s.user){const o=await br(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await je(this.storage,this.storageKey+"-user"),await zr(this.storage,this.storageKey,s)):s.user=Oi()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ri;if(this._debug(n,`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),Ci(o)||(this._debug(n,"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(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Ie;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ai;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Ie;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),I(i)){const o={data:null,error:i};return Ci(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await je(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await zr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=Sl(s);await zr(this.storage,this.storageKey,i)}else{const s=Sl(r);await zr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await je(this.storage,this.storageKey),await je(this.storage,this.storageKey+"-code-verifier"),await je(this.storage,this.storageKey+"-user"),this.userStorage&&await je(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ne()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Vr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Vr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Vr}ms, refresh threshold is ${oo} ticks`),s<=oo&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof qu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ne()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Ur(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await U(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await U(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.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(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Pl(e.webauthn.credential_response):Il(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.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:Cl(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:Ol(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:f}=ds(e);let g=null;f.aal&&(g=f.aal);let y=g;const{data:{user:S},error:w}=await this.getUser(e);if(w)return this._returnResult({data:null,error:w});((n=(r=S==null?void 0:S.factors)===null||r===void 0?void 0:r.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const _=f.amr||[];return{data:{currentLevel:g,nextLevel:y,currentAuthenticationMethods:_},error:null}}catch(f){if(I(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(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await U(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Ie})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Ie});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Ie});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await U(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Ie})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await U(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ie})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+dy>s)return n;const{data:i,error:o}=await U(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,n=i.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});n=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=ds(n);r!=null&&r.allowExpired||jy(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,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Ny(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,wy(`${a}.${l}`)))throw new co("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;ut(this.experimental);try{if(!js())return this._returnResult({data:null,error:new dt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=Ol(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:uo.createNewAbortSignal(),{data:c,error:u}=await Ku({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new dt("WebAuthn ceremony failed",null)});const h=Il(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;ut(this.experimental);try{if(!js())return this._returnResult({data:null,error:new dt("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=Cl(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:uo.createNewAbortSignal(),{data:l,error:c}=await zu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new dt("WebAuthn ceremony failed",null)});const u=Pl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){ut(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Ie});const{data:s,error:i}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;ut(this.experimental);try{const{data:n,error:s}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){ut(this.experimental);try{const{data:r,error:n}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ot});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){ut(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Ie});const{data:s,error:i}=await U(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{data:i,error:o}=await U(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{error:i}=await U(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}}Wn.nextInstanceID={};const iv=Wn,ov="2.106.2";let _n="";typeof Deno<"u"?_n="deno":typeof document<"u"?_n="web":typeof navigator<"u"&&navigator.product==="ReactNative"?_n="react-native":_n="node";const av={"X-Client-Info":`supabase-js-${_n}/${ov}`},lv={headers:av},cv={schema:"public"},uv={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},hv={},dv={enabled:!1,respectSamplingDecision:!0};function fv(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,[])).next())})}let Ii=null;const pv="@opentelemetry/api";function gv(){return Ii===null&&(Ii=import(pv).catch(()=>null)),Ii}function mv(){return fv(this,void 0,void 0,function*(){try{const t=yield gv();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function yv(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(s)||!o.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function vv(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(bv(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function bv(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function _v(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Gn(t){"@babel/helpers - typeof";return Gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gn(t)}function wv(t,e){if(Gn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kv(t){var e=wv(t,"string");return Gn(e)=="symbol"?e:e+""}function Sv(t,e,r){return(e=kv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jl(Object(r),!0).forEach(function(n){Sv(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Ev=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Tv=()=>Headers,Av=(t,e,r,n,s)=>{const i=Ev(n),o=Tv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?_v(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let g=new o(h==null?void 0:h.headers);if(g.has("apikey")||g.set("apikey",t),g.has("Authorization")||g.set("Authorization",`Bearer ${f}`),c){const y=await xv(u,c,l);y&&(y.traceparent&&!g.has("traceparent")&&g.set("traceparent",y.traceparent),y.tracestate&&!g.has("tracestate")&&g.set("tracestate",y.tracestate),y.baggage&&!g.has("baggage")&&g.set("baggage",y.baggage))}return i(u,ke(ke({},h),{},{headers:g}))}};async function xv(t,e,r){if(!vv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await mv();if(!n||!n.traceparent)return null;if(r){const s=yv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Nl(t){return typeof t=="boolean"?{enabled:t}:t}function Rv(t){return t.endsWith("/")?t:t+"/"}function Cv(t,e){var r,n,s,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:g,global:y}=e,S=Nl(t.tracePropagation),w=Nl(e.tracePropagation),b={db:ke(ke({},d),l),auth:ke(ke({},f),c),realtime:ke(ke({},g),u),storage:{},global:ke(ke(ke({},y),h),{},{headers:ke(ke({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=S==null?void 0:S.enabled)!==null&&i!==void 0?i:w==null?void 0:w.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=S==null?void 0:S.respectSamplingDecision)!==null&&a!==void 0?a:w==null?void 0:w.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?b.accessToken=t.accessToken:delete b.accessToken,b}function Ov(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Rv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Pv=class extends iv{constructor(t){super(t)}},Iv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=Ov(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:cv,realtime:hv,auth:ke(ke({},uv),{},{storageKey:o}),global:lv,tracePropagation:dv},l=Cv(r??{},a);if(this.settings=l,this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",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=Av(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(ke({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new Gg(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 ay(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Ug(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,g){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Pv({url:this.authUrl.href,headers:ke(ke({},y),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Om(this.realtimeUrl.href,ke(ke({},t),{},{params:ke(ke({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const $v=(t,e,r)=>new Iv(t,e,r);function jv(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}jv()&&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 Wu=null,Ll=!1;async function Nv(){if(!Ll){Ll=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Wu=$v(e,r))}catch{}}}function fs(){return Wu}const Cr=hu("auth",()=>{const t=et(localStorage.getItem("io_token")),e=et(localStorage.getItem("io_email")),r=et(!1),n=Ue(()=>!!t.value);function s(){const l=fs();l&&l.auth.onAuthStateChange((c,u)=>{var h,d;u?(t.value=u.access_token,e.value=((h=u.user)==null?void 0:h.email)??null,localStorage.setItem("io_token",u.access_token),(d=u.user)!=null&&d.email&&localStorage.setItem("io_email",u.user.email)):(t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"))})}async function i(l,c){var h,d;const u=fs();if(!u)throw new Error("Auth not configured");r.value=!0;try{const{data:f,error:g}=await u.auth.signInWithPassword({email:l,password:c});if(g)throw g;t.value=((h=f.session)==null?void 0:h.access_token)??null,e.value=((d=f.user)==null?void 0:d.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function o(){const l=fs();l&&await l.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email")}async function a(){const l=fs();if(!l)return;const{data:c,error:u}=await l.auth.refreshSession();if(u||!c.session){t.value=null,localStorage.removeItem("io_token");return}t.value=c.session.access_token,localStorage.setItem("io_token",c.session.access_token)}return{token:t,email:e,loading:r,isAuthenticated:n,login:i,logout:o,refreshToken:a,initAuthListener:s}}),Lv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:Cr},Symbol.toStringTag,{value:"Module"})),Dv={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},Uv={class:"flex items-center gap-2"},Bv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Mv=dr({__name:"AppHeader",setup(t){const e=Cr(),r=rg();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=xo("router-link");return oe(),Ee("header",Dv,[i[0]||(i[0]=ve("div",null,null,-1)),ve("div",Uv,[ue(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Yr(()=>[ue(_e(Eu),{class:"w-4 h-4"})]),_:1}),ve("div",Bv,[ue(_e(Tg),{class:"w-3.5 h-3.5 text-muted-foreground"})]),ve("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[ue(_e(gg),{class:"w-4 h-4"})])])])}}}),Hv=[{path:"/login",name:"login",component:()=>Me(()=>import("./LoginView-AnOP3Mau.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>Me(()=>import("./ChatView-BBopM_A3.js"),[])},{path:"/squads",name:"squads",component:()=>Me(()=>import("./SquadsView-fammrB7r.js"),__vite__mapDeps([0,1,2]))},{path:"/squads/health",name:"squad-health",component:()=>Me(()=>import("./SquadHealthView-CVJiAgVW.js"),__vite__mapDeps([3,4,2]))},{path:"/squads/:id",name:"squad-detail",component:()=>Me(()=>import("./SquadDetailView-BKXLWvwn.js"),__vite__mapDeps([5,1,6,2,7,8]))},{path:"/feed",name:"feed",component:()=>Me(()=>import("./FeedView-Bo4p1stx.js"),__vite__mapDeps([9,1,7]))},{path:"/skills",name:"skills",component:()=>Me(()=>import("./SkillsView-D_NHLk7C.js"),__vite__mapDeps([10,11,12,13,6,7]))},{path:"/mcp",name:"mcp",component:()=>Me(()=>import("./McpView-DPcihjuB.js"),__vite__mapDeps([14,11,7]))},{path:"/schedules",name:"schedules",component:()=>Me(()=>import("./SchedulesView-B2o3vMm-.js"),__vite__mapDeps([15,1,11,7]))},{path:"/history",name:"history",component:()=>Me(()=>import("./HistoryView-ChTuQvXr.js"),__vite__mapDeps([16,12,8,7]))},{path:"/wiki",name:"wiki",component:()=>Me(()=>import("./WikiView-B5TOMnOg.js"),__vite__mapDeps([17,12,11,13,7,6]))},{path:"/usage",name:"usage",component:()=>Me(()=>import("./UsageView-Cy5Mbprb.js"),__vite__mapDeps([18,4]))},{path:"/audit-log",name:"audit-log",component:()=>Me(()=>import("./AuditLogView-DqxVzjd_.js"),[])},{path:"/settings",name:"settings",component:()=>Me(()=>import("./SettingsView-rtMUmH43.js"),[])}],Ls=tg({history:$p(),routes:Hv});Ls.beforeEach(t=>{const e=Cr();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});const Zt="/api";function qv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}async function ur(){const t=Cr(),e={"Content-Type":"application/json"};return t.token&&qv(t.token)&&await t.refreshToken(),t.token&&(e.Authorization=`Bearer ${t.token}`),e}async function li(t,e){if(t.status===401){const r=Cr();try{if(await r.refreshToken(),r.token){const n=await e();if(n.status===401)throw r.logout(),Ls.push("/login"),new Error("Session expired");return n}}catch{}throw r.logout(),Ls.push("/login"),new Error("Session expired")}return t}async function Gb(t){const e=await li(await fetch(`${Zt}${t}`,{headers:await ur()}),async()=>fetch(`${Zt}${t}`,{headers:await ur()}));if(!e.ok)throw new Error(`API error: ${e.status}`);return e.json()}async function Fv(t,e){const r={method:"POST",headers:await ur(),body:e?JSON.stringify(e):void 0},n=await li(await fetch(`${Zt}${t}`,r),async()=>fetch(`${Zt}${t}`,{...r,headers:await ur()}));if(!n.ok)throw new Error(`API error: ${n.status}`);return n.json()}async function Jb(t,e){const r={method:"PUT",headers:await ur(),body:e?JSON.stringify(e):void 0},n=await li(await fetch(`${Zt}${t}`,r),async()=>fetch(`${Zt}${t}`,{...r,headers:await ur()}));if(!n.ok)throw new Error(`API error: ${n.status}`);return n.json()}async function Yb(t){const e={method:"DELETE",headers:await ur()},r=await li(await fetch(`${Zt}${t}`,e),async()=>fetch(`${Zt}${t}`,{...e,headers:await ur()}));if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}function Zb(){const t=Cr(),e=`${Zt}/stream?token=${t.token??""}`;return new EventSource(e)}const Vv=hu("chat",()=>{const t=et([]),e=et(!1),r=et(null),n=et(crypto.randomUUID());function s(l){const c={id:crypto.randomUUID(),role:"user",content:l,timestamp:new Date};return t.value.push(c),c}async function i(l){s(l),e.value=!0;const c={id:crypto.randomUUID(),role:"assistant",content:"",timestamp:new Date,streaming:!0};t.value.push(c);try{const u=await Fv("/message",{prompt:l,conversationId:n.value});c.content=u.content,c.streaming=!1,u.conversationId&&(n.value=u.conversationId)}catch(u){c.content=`Error: ${u.message}`,c.streaming=!1}finally{e.value=!1}}function o(l){const c=t.value[t.value.length-1];c!=null&&c.streaming&&(c.content=l)}function a(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:i,updateStreamingMessage:o,clearMessages:a}});function Do(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Or=Do();function Gu(t){Or=t}var $n={exec:()=>null};function le(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ze.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var ze={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},zv=/^(?:[ \t]*(?:\n|$))+/,Kv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wv=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,es=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uo=/(?:[*+-]|\d{1,9}[.)])/,Ju=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yu=le(Ju).replace(/bull/g,Uo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Jv=le(Ju).replace(/bull/g,Uo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Bo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yv=/^[^\n]+/,Mo=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Zv=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qv=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Uo).getRegex(),ci="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ho=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xv=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ho).replace("tag",ci).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zu=le(Bo).replace("hr",es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),eb=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Zu).getRegex(),qo={blockquote:eb,code:Kv,def:Zv,fences:Wv,heading:Gv,hr:es,html:Xv,lheading:Yu,list:Qv,newline:zv,paragraph:Zu,table:$n,text:Yv},Dl=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),tb={...qo,lheading:Jv,table:Dl,paragraph:le(Bo).replace("hr",es).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex()},rb={...qo,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ho).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Bo).replace("hr",es).replace("heading",` *#{1,6} *[^
199
- ]`).replace("lheading",Yu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Qu=/^( {2,}|\\)\n(?!\s*$)/,ib=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ui=/[\p{P}\p{S}]/u,Fo=/[\s\p{P}\p{S}]/u,Xu=/[^\s\p{P}\p{S}]/u,ob=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Fo).getRegex(),eh=/(?!~)[\p{P}\p{S}]/u,ab=/(?!~)[\s\p{P}\p{S}]/u,lb=/(?:[^\s\p{P}\p{S}]|~)/u,cb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,th=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ub=le(th,"u").replace(/punct/g,ui).getRegex(),hb=le(th,"u").replace(/punct/g,eh).getRegex(),rh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",db=le(rh,"gu").replace(/notPunctSpace/g,Xu).replace(/punctSpace/g,Fo).replace(/punct/g,ui).getRegex(),fb=le(rh,"gu").replace(/notPunctSpace/g,lb).replace(/punctSpace/g,ab).replace(/punct/g,eh).getRegex(),pb=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Xu).replace(/punctSpace/g,Fo).replace(/punct/g,ui).getRegex(),gb=le(/\\(punct)/,"gu").replace(/punct/g,ui).getRegex(),mb=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),yb=le(Ho).replace("(?:-->|$)","-->").getRegex(),vb=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",yb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ds=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,bb=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ds).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nh=le(/^!?\[(label)\]\[(ref)\]/).replace("label",Ds).replace("ref",Mo).getRegex(),sh=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mo).getRegex(),_b=le("reflink|nolink(?!\\()","g").replace("reflink",nh).replace("nolink",sh).getRegex(),Vo={_backpedal:$n,anyPunctuation:gb,autolink:mb,blockSkip:cb,br:Qu,code:sb,del:$n,emStrongLDelim:ub,emStrongRDelimAst:db,emStrongRDelimUnd:pb,escape:nb,link:bb,nolink:sh,punctuation:ob,reflink:nh,reflinkSearch:_b,tag:vb,text:ib,url:$n},wb={...Vo,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",Ds).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ds).getRegex()},ho={...Vo,emStrongRDelimAst:fb,emStrongLDelim:hb,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},kb={...ho,br:le(Qu).replace("{2,}","*").getRegex(),text:le(ho.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ps={normal:qo,gfm:tb,pedantic:rb},gn={normal:Vo,gfm:ho,breaks:kb,pedantic:wb},Sb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ul=t=>Sb[t];function St(t,e){if(e){if(ze.escapeTest.test(t))return t.replace(ze.escapeReplace,Ul)}else if(ze.escapeTestNoEncode.test(t))return t.replace(ze.escapeReplaceNoEncode,Ul);return t}function Bl(t){try{t=encodeURI(t).replace(ze.percentDecode,"%")}catch{return null}return t}function Ml(t,e){var i;const r=t.replace(ze.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(ze.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(ze.slashPipe,"|");return n}function mn(t,e,r){const n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function Eb(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Hl(t,e,r,n,s){const i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Tb(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const s=n[1];return e.split(`
194
+ Request ID: ${l}`),c){let _=`
195
+ Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);_+=`
196
+ - ${b}`}w+=_}return`${k}
197
+ ${w}`}class Re extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Ps extends Re{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Ky({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Re({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Re({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Re({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Re({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Re({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Re({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Re({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Mu(o)){if(i.rp.id!==o)return new Re({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Re({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Re({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Gy({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Re({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Mu(n)){if(r.rpId!==n)return new Re({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Re({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Jy{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const oo=new Jy;function Tl(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=ti(t,["challenge","user","excludeCredentials"]),i=Gr(e).buffer,o=Object.assign(Object.assign({},r),{id:Gr(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Gr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Al(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=ti(t,["challenge","allowCredentials"]),s=Gr(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Gr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function xl(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:kr(new Uint8Array(t.response.attestationObject)),clientDataJSON:kr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rl(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:kr(new Uint8Array(s.authenticatorData)),clientDataJSON:kr(new Uint8Array(s.clientDataJSON)),signature:kr(new Uint8Array(s.signature)),userHandle:s.userHandle?kr(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Mu(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Is(){var t,e;return!!(Ne()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Hu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Ky({error:e,options:t})}}}async function qu(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Gy({error:e,options:t})}}}const Yy={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Qy={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(e(o)){const a=n[i];e(a)?n[i]=js(a,o):n[i]=js(o)}else n[i]=o}return n}function Zy(t,e){return js(Yy,t,e||{})}function Xy(t,e){return js(Qy,t,e||{})}class ev{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const c=s??oo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=n;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,g=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${g}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Zy(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Hu({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=Xy(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await qu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new dt("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new tn("rpId is required for WebAuthn authentication")};try{if(!Is())return{data:null,error:new dt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new tn("rpId is required for WebAuthn registration")};try{if(!Is())return{data:null,error:new dt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in register",o)}}}}Fy();const tv={url:iy,storageKey:oy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ay,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Cl(t,e,r){return await r()}const Lr={};class Vn{get jwks(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,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({},tv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=Vn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Vn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ne()){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=(n=o.experimental)!==null&&n!==void 0?n:{},this.admin=new Hy({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Du(o.fetch),this.lock=o.lock||Cl,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&&Ne()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=qy:this.lock=Cl,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new ev(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:Lu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),Ne()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ju}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Ne()&&(r=wy(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ne()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),dy(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=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(r){return I(r)?this._returnResult({error:r}):this._returnResult({error:new dt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:ot}),{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(I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await Nr(this.storage,this.storageKey)),i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:g},xform:ot})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},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:ot})}else throw new ls("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await $e(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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await M(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:wl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await M(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:wl})}else throw new ls("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new $r;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,o,a,l,c,u,h,d;let f,g;if("message"in e)f=e.message,g=e.signature;else{const{chain:y,wallet:k,statement:w,options:_}=e;let b;if(Ne())if(typeof k=="object")b=k;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")b=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 k!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=k}const x=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href),D=await b.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 H=Bu(D[0]);let U=(n=_==null?void 0:_.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!U){const C=await b.request({method:"eth_chainId"});U=Vy(C)}const F={domain:x.host,address:H,statement:w,uri:x.href,version:"1",chainId:U,nonce:(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Wy(F),g=await b.request({method:"personal_sign",params:[zy(f),H]})}try{const{data:y,error:k}=await M(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ot});if(k)throw k;if(!y||!y.session||!y.user){const w=new $r;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:k})}catch(y){if(I(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,s,i,o,a,l,c,u,h,d,f;let g,y;if("message"in e)g=e.message,y=e.signature;else{const{chain:k,wallet:w,statement:_,options:b}=e;let x;if(Ne())if(typeof w=="object")x=w;else{const H=window;if("solana"in H&&typeof H.solana=="object"&&("signIn"in H.solana&&typeof H.solana.signIn=="function"||"signMessage"in H.solana&&typeof H.solana.signMessage=="function"))x=H.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const D=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in x&&x.signIn){const H=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),_?{statement:_}:null));let U;if(Array.isArray(H)&&H[0]&&typeof H[0]=="object")U=H[0];else if(H&&typeof H=="object"&&"signedMessage"in H&&"signature"in H)U=H;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in U&&"signature"in U&&(typeof U.signedMessage=="string"||U.signedMessage instanceof Uint8Array)&&U.signature instanceof Uint8Array)g=typeof U.signedMessage=="string"?U.signedMessage:new TextDecoder().decode(U.signedMessage),y=U.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${D.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(s=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(U=>`- ${U}`)]:[]].join(`
198
+ `);const H=await x.signMessage(new TextEncoder().encode(g),"utf8");if(!H||!(H instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=H}}try{const{data:k,error:w}=await M(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:kr(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ot});if(w)throw w;if(!k||!k.session||!k.user){const _=new $r;return this._returnResult({data:{user:null,session:null},error:_})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:w})}catch(k){if(I(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const r=await yr(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new fy;const{data:i,error:o}=await M(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ot});if(await $e(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new $r;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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await M(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ot}),{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 $r;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Nr(this.storage,this.storageKey));const{error:h}=await M(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await M(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 ls("You must provide either an email or phone number.")}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:a}=await M(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ot});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Nr(this.storage,this.storageKey));const c=await M(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Uy});return!((i=c.data)===null||i===void 0)&&i.url&&Ne()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Ie;const{error:s}=await M(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(I(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await M(this.fetch,"POST",r,{headers:this.headers,body:{email:n,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 e){const{phone:n,type:s,options:i}=e,{data:o,error:a}=await M(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,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 ls("You must provide either an email or phone number and a type")}catch(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await yr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Ei:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await yr(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ai()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=$y(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.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(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await M(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ar}):await this._useSession(async r=>{var n,s,i;const{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ie}:await M(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:ar})})}catch(r){if(I(r))return as(r)&&(await this._removeSession(),await $e(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new Ie;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Nr(this.storage,this.storageKey));const{data:c,error:u}=await M(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:ar});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(n){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ie;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=us(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(I(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Ie;const{data:s,error:i}=await this._callRefreshToken(e.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(r){if(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Ne())throw new cs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new cs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new pl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new cs("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new pl("No code detected.");const{data:b,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:b.session,redirectType:(n=b.redirectType)!==null&&n!==void 0?n: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}=e;if(!o||!l||!a||!u)throw new cs("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const g=f-h;g*1e3<=Hr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:k,error:w}=await this._getUser(o);if(w)throw w;const _={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(s){if(I(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await yr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!as(i))return this._returnResult({error:i});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(hy(a)&&(a.status===404||a.status===401||a.status===403)||as(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await $e(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=_y(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),as(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Nr(this.storage,this.storageKey,!0));try{return await M(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,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`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await M(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 Ne()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(I(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await M(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ot}),{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 $r}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await M(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await Ey(async s=>(s>0&&await Sy(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await M(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ot})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Ti(i)&&Date.now()+o-n<Hr})}catch(n){if(this._debug(r,"error",n),I(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Ne()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await yr(this.storage,this.storageKey);if(s&&this.userStorage){let o=await yr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await qr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ai()}else if(s&&!s.user&&!s.user){const o=await yr(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await $e(this.storage,this.storageKey+"-user"),await qr(this.storage,this.storageKey,s)):s.user=Ai()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ei;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ei}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Ti(o)||(this._debug(n,"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(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Ie;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new si;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Ie;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),I(i)){const o={data:null,error:i};return Ti(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await $e(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await qr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=bl(s);await qr(this.storage,this.storageKey,i)}else{const s=bl(r);await qr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $e(this.storage,this.storageKey),await $e(this.storage,this.storageKey+"-code-verifier"),await $e(this.storage,this.storageKey+"-user"),this.userStorage&&await $e(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ne()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Hr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Hr}ms, refresh threshold is ${ro} ticks`),s<=ro&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof Uu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ne()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Nr(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await M(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await M(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.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(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?xl(e.webauthn.credential_response):Rl(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await M(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await M(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.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:Tl(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:Al(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:f}=us(e);let g=null;f.aal&&(g=f.aal);let y=g;const{data:{user:k},error:w}=await this.getUser(e);if(w)return this._returnResult({data:null,error:w});((n=(r=k==null?void 0:k.factors)===null||r===void 0?void 0:r.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const b=f.amr||[];return{data:{currentLevel:g,nextLevel:y,currentAuthenticationMethods:b},error:null}}catch(f){if(I(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}=us(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(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await M(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Ie})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Ie});const o=await M(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Ie});const o=await M(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await M(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Ie})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await M(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ie})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+cy>s)return n;const{data:i,error:o}=await M(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,n=i.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});n=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=us(n);r!=null&&r.allowExpired||Py(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,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Iy(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,vy(`${a}.${l}`)))throw new io("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=Al(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:oo.createNewAbortSignal(),{data:c,error:u}=await qu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new dt("WebAuthn ceremony failed",null)});const h=Rl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("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=Tl(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:oo.createNewAbortSignal(),{data:l,error:c}=await Hu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new dt("WebAuthn ceremony failed",null)});const u=xl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){ut(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Ie});const{data:s,error:i}=await M(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{data:i,error:o}=await M(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;ut(this.experimental);try{const{data:n,error:s}=await M(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){ut(this.experimental);try{const{data:r,error:n}=await M(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ot});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){ut(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Ie});const{data:s,error:i}=await M(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{data:i,error:o}=await M(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){ut(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ie});const{error:i}=await M(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}}Vn.nextInstanceID={};const rv=Vn,nv="2.106.2";let yn="";typeof Deno<"u"?yn="deno":typeof document<"u"?yn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?yn="react-native":yn="node";const sv={"X-Client-Info":`supabase-js-${yn}/${nv}`},iv={headers:sv},ov={schema:"public"},av={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},lv={},cv={enabled:!1,respectSamplingDecision:!0};function uv(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,[])).next())})}let Ri=null;const hv="@opentelemetry/api";function dv(){return Ri===null&&(Ri=import(hv).catch(()=>null)),Ri}function fv(){return uv(this,void 0,void 0,function*(){try{const t=yield dv();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function pv(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(s)||!o.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function gv(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(mv(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function mv(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function yv(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function zn(t){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(t)}function vv(t,e){if(zn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(zn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bv(t){var e=vv(t,"string");return zn(e)=="symbol"?e:e+""}function _v(t,e,r){return(e=bv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ol(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ol(Object(r),!0).forEach(function(n){_v(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ol(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const wv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),kv=()=>Headers,Sv=(t,e,r,n,s)=>{const i=wv(n),o=kv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?yv(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let g=new o(h==null?void 0:h.headers);if(g.has("apikey")||g.set("apikey",t),g.has("Authorization")||g.set("Authorization",`Bearer ${f}`),c){const y=await Ev(u,c,l);y&&(y.traceparent&&!g.has("traceparent")&&g.set("traceparent",y.traceparent),y.tracestate&&!g.has("tracestate")&&g.set("tracestate",y.tracestate),y.baggage&&!g.has("baggage")&&g.set("baggage",y.baggage))}return i(u,ke(ke({},h),{},{headers:g}))}};async function Ev(t,e,r){if(!gv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await fv();if(!n||!n.traceparent)return null;if(r){const s=pv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Pl(t){return typeof t=="boolean"?{enabled:t}:t}function Tv(t){return t.endsWith("/")?t:t+"/"}function Av(t,e){var r,n,s,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:g,global:y}=e,k=Pl(t.tracePropagation),w=Pl(e.tracePropagation),_={db:ke(ke({},d),l),auth:ke(ke({},f),c),realtime:ke(ke({},g),u),storage:{},global:ke(ke(ke({},y),h),{},{headers:ke(ke({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=k==null?void 0:k.enabled)!==null&&i!==void 0?i:w==null?void 0:w.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=k==null?void 0:k.respectSamplingDecision)!==null&&a!==void 0?a:w==null?void 0:w.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function xv(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Tv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Rv=class extends rv{constructor(t){super(t)}},Cv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=xv(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:ov,realtime:lv,auth:ke(ke({},av),{},{storageKey:o}),global:iv,tracePropagation:cv},l=Av(r??{},a);if(this.settings=l,this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",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=Sv(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(ke({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new zg(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 sy(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Ng(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,g){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Rv({url:this.authUrl.href,headers:ke(ke({},y),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new xm(this.realtimeUrl.href,ke(ke({},t),{},{params:ke(ke({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Ov=(t,e,r)=>new Cv(t,e,r);function Pv(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Pv()&&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 Fu=null,Il=!1;async function Iv(){if(!Il){Il=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Fu=Ov(e,r))}catch{}}}function hs(){return Fu}const Qn=au("auth",()=>{const t=et(localStorage.getItem("io_token")),e=et(localStorage.getItem("io_email")),r=et(!1);let n=null;const s=Ue(()=>!!t.value);function i(h,d=3e5){try{return JSON.parse(atob(h.split(".")[1])).exp*1e3<=Date.now()+d}catch{return!0}}function o(){const h=hs();h&&(h.auth.onAuthStateChange((d,f)=>{var g,y;f?(t.value=f.access_token,e.value=((g=f.user)==null?void 0:g.email)??null,localStorage.setItem("io_token",f.access_token),(y=f.user)!=null&&y.email&&localStorage.setItem("io_email",f.user.email)):(t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"))}),a())}function a(){n||(n=setInterval(async()=>{t.value&&i(t.value)&&await u()},300*1e3))}async function l(h,d){var g,y;const f=hs();if(!f)throw new Error("Auth not configured");r.value=!0;try{const{data:k,error:w}=await f.auth.signInWithPassword({email:h,password:d});if(w)throw w;t.value=((g=k.session)==null?void 0:g.access_token)??null,e.value=((y=k.user)==null?void 0:y.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function c(){const h=hs();h&&await h.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"),n&&(clearInterval(n),n=null)}async function u(){const h=hs();if(!h)return;const{data:d,error:f}=await h.auth.refreshSession();if(!f&&d.session){t.value=d.session.access_token,localStorage.setItem("io_token",d.session.access_token);return}const{data:g}=await h.auth.getSession();if(g.session){t.value=g.session.access_token,localStorage.setItem("io_token",g.session.access_token);return}t.value=null,localStorage.removeItem("io_token")}return{token:t,email:e,loading:r,isAuthenticated:s,login:l,logout:c,refreshToken:u,initAuthListener:o}}),jv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:Qn},Symbol.toStringTag,{value:"Module"})),$v={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},Nv={class:"flex items-center gap-2"},Lv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Dv=ur({__name:"AppHeader",setup(t){const e=Qn(),r=Xp();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=So("router-link");return oe(),Ee("header",$v,[i[0]||(i[0]=ve("div",null,null,-1)),ve("div",Nv,[ue(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Kr(()=>[ue(_e(_u),{class:"w-4 h-4"})]),_:1}),ve("div",Lv,[ue(_e(kg),{class:"w-3.5 h-3.5 text-muted-foreground"})]),ve("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[ue(_e(dg),{class:"w-4 h-4"})])])])}}}),Uv=5e3;function Bv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}const Mv=au("chat",()=>{const t=et([]),e=et(!1),r=et(null),n=et(crypto.randomUUID());function s(l){const c={id:crypto.randomUUID(),role:"user",content:l,timestamp:new Date};return t.value.push(c),c}async function i(l){s(l),e.value=!0;const c={id:crypto.randomUUID(),role:"assistant",content:"",timestamp:new Date,streaming:!0};t.value.push(c);let u=Date.now();try{const h=Qn();h.token&&Bv(h.token)&&await h.refreshToken();const d={"Content-Type":"application/json"};h.token&&(d.Authorization=`Bearer ${h.token}`);const f=await fetch("/api/message",{method:"POST",headers:d,body:JSON.stringify({prompt:l,conversationId:n.value})});if(!f.ok||!f.body)throw new Error(`API error: ${f.status}`);const g=f.body.getReader(),y=new TextDecoder;let k="";for(;;){const{done:w,value:_}=await g.read();if(w)break;k+=y.decode(_,{stream:!0});const b=k.split(`
199
+ `);k=b.pop()??"";let x="";for(const D of b)if(D.startsWith("event: "))x=D.slice(7);else if(D.startsWith("data: ")){const H=D.slice(6);try{const U=JSON.parse(H);if(x==="delta"){const F=Date.now(),C=t.value[t.value.length-1];if(C&&!C.streaming&&C.role==="assistant"&&F-u>Uv){const V={id:crypto.randomUUID(),role:"assistant",content:U.content,timestamp:new Date,streaming:!0};t.value.push(V)}else{const V=t.value.filter($=>$.streaming),Z=V[V.length-1];Z&&(Z.content=U.content)}u=F}else if(x==="done"){const F=t.value.filter(V=>V.streaming),C=F[F.length-1];C&&(C.content=U.content,C.streaming=!1),U.conversationId&&(n.value=U.conversationId)}else if(x==="error"){const F=t.value.filter(V=>V.streaming),C=F[F.length-1];C&&(C.content=`Error: ${U.error}`,C.streaming=!1)}}catch{}x=""}else D.startsWith(":")}}catch(h){const d=t.value.filter(g=>g.streaming),f=d[d.length-1];f&&(f.content=`Error: ${h.message}`,f.streaming=!1)}finally{e.value=!1}}function o(l){const c=t.value[t.value.length-1];c!=null&&c.streaming&&(c.content=l)}function a(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:i,updateStreamingMessage:o,clearMessages:a}});function jo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var xr=jo();function Vu(t){xr=t}var On={exec:()=>null};function le(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ze.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var ze={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Hv=/^(?:[ \t]*(?:\n|$))+/,qv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fv=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$o=/(?:[*+-]|\d{1,9}[.)])/,zu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wu=le(zu).replace(/bull/g,$o).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),zv=le(zu).replace(/bull/g,$o).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),No=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wv=/^[^\n]+/,Lo=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Kv=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Lo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gv=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$o).getRegex(),ii="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Do=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Jv=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Do).replace("tag",ii).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ku=le(No).replace("hr",Zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex(),Yv=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ku).getRegex(),Uo={blockquote:Yv,code:qv,def:Kv,fences:Fv,heading:Vv,hr:Zn,html:Jv,lheading:Wu,list:Gv,newline:Hv,paragraph:Ku,table:On,text:Wv},jl=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex(),Qv={...Uo,lheading:zv,table:jl,paragraph:le(No).replace("hr",Zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex()},Zv={...Uo,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Do).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:On,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(No).replace("hr",Zn).replace("heading",` *#{1,6} *[^
200
+ ]`).replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gu=/^( {2,}|\\)\n(?!\s*$)/,tb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oi=/[\p{P}\p{S}]/u,Bo=/[\s\p{P}\p{S}]/u,Ju=/[^\s\p{P}\p{S}]/u,rb=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Bo).getRegex(),Yu=/(?!~)[\p{P}\p{S}]/u,nb=/(?!~)[\s\p{P}\p{S}]/u,sb=/(?:[^\s\p{P}\p{S}]|~)/u,ib=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Qu=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ob=le(Qu,"u").replace(/punct/g,oi).getRegex(),ab=le(Qu,"u").replace(/punct/g,Yu).getRegex(),Zu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lb=le(Zu,"gu").replace(/notPunctSpace/g,Ju).replace(/punctSpace/g,Bo).replace(/punct/g,oi).getRegex(),cb=le(Zu,"gu").replace(/notPunctSpace/g,sb).replace(/punctSpace/g,nb).replace(/punct/g,Yu).getRegex(),ub=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ju).replace(/punctSpace/g,Bo).replace(/punct/g,oi).getRegex(),hb=le(/\\(punct)/,"gu").replace(/punct/g,oi).getRegex(),db=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fb=le(Do).replace("(?:-->|$)","-->").getRegex(),pb=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",fb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$s=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,gb=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",$s).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xu=le(/^!?\[(label)\]\[(ref)\]/).replace("label",$s).replace("ref",Lo).getRegex(),eh=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Lo).getRegex(),mb=le("reflink|nolink(?!\\()","g").replace("reflink",Xu).replace("nolink",eh).getRegex(),Mo={_backpedal:On,anyPunctuation:hb,autolink:db,blockSkip:ib,br:Gu,code:eb,del:On,emStrongLDelim:ob,emStrongRDelimAst:lb,emStrongRDelimUnd:ub,escape:Xv,link:gb,nolink:eh,punctuation:rb,reflink:Xu,reflinkSearch:mb,tag:pb,text:tb,url:On},yb={...Mo,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",$s).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$s).getRegex()},ao={...Mo,emStrongRDelimAst:cb,emStrongLDelim:ab,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},vb={...ao,br:le(Gu).replace("{2,}","*").getRegex(),text:le(ao.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ds={normal:Uo,gfm:Qv,pedantic:Zv},dn={normal:Mo,gfm:ao,breaks:vb,pedantic:yb},bb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$l=t=>bb[t];function St(t,e){if(e){if(ze.escapeTest.test(t))return t.replace(ze.escapeReplace,$l)}else if(ze.escapeTestNoEncode.test(t))return t.replace(ze.escapeReplaceNoEncode,$l);return t}function Nl(t){try{t=encodeURI(t).replace(ze.percentDecode,"%")}catch{return null}return t}function Ll(t,e){var i;const r=t.replace(ze.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(ze.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(ze.slashPipe,"|");return n}function fn(t,e,r){const n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function _b(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Dl(t,e,r,n,s){const i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function wb(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const s=n[1];return e.split(`
200
201
  `).map(i=>{const o=i.match(r.other.beginningSpace);if(o===null)return i;const[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
201
- `)}var Us=class{constructor(t){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=t||Or}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:mn(r,`
202
- `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=Tb(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=mn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:mn(e[0],`
203
- `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=mn(e[0],`
202
+ `)}var Ns=class{constructor(t){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=t||xr}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:fn(r,`
203
+ `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=wb(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=fn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:fn(e[0],`
204
+ `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=fn(e[0],`
204
205
  `).split(`
205
206
  `),n="",s="";const i=[];for(;r.length>0;){let o=!1;const a=[];let l;for(l=0;l<r.length;l++)if(this.rules.other.blockquoteStart.test(r[l]))a.push(r[l]),o=!0;else if(!o)a.push(r[l]);else break;r=r.slice(l);const c=a.join(`
206
207
  `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
@@ -214,13 +215,13 @@ ${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
214
215
  `);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim();const n=r.length>1,s={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let l=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=e[2].split(`
215
216
  `,1)[0].replace(this.rules.other.listReplaceTabs,w=>" ".repeat(3*w.length)),d=t.split(`
216
217
  `,1)[0],f=!h.trim(),g=0;if(this.options.pedantic?(g=2,u=h.trimStart()):f?g=e[1].length+1:(g=e[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=h.slice(g),g+=e[1].length),f&&this.rules.other.blankLine.test(d)&&(c+=d+`
217
- `,t=t.substring(d.length+1),l=!0),!l){const w=this.rules.other.nextBulletRegex(g),b=this.rules.other.hrRegex(g),_=this.rules.other.fencesBeginRegex(g),x=this.rules.other.headingBeginRegex(g),B=this.rules.other.htmlBeginRegex(g);for(;t;){const H=t.split(`
218
- `,1)[0];let M;if(d=H,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),M=d):M=d.replace(this.rules.other.tabCharGlobal," "),_.test(d)||x.test(d)||B.test(d)||w.test(d)||b.test(d))break;if(M.search(this.rules.other.nonSpaceChar)>=g||!d.trim())u+=`
219
- `+M.slice(g);else{if(f||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(h)||x.test(h)||b.test(h))break;u+=`
218
+ `,t=t.substring(d.length+1),l=!0),!l){const w=this.rules.other.nextBulletRegex(g),_=this.rules.other.hrRegex(g),b=this.rules.other.fencesBeginRegex(g),x=this.rules.other.headingBeginRegex(g),D=this.rules.other.htmlBeginRegex(g);for(;t;){const H=t.split(`
219
+ `,1)[0];let U;if(d=H,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),U=d):U=d.replace(this.rules.other.tabCharGlobal," "),b.test(d)||x.test(d)||D.test(d)||w.test(d)||_.test(d))break;if(U.search(this.rules.other.nonSpaceChar)>=g||!d.trim())u+=`
220
+ `+U.slice(g);else{if(f||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(h)||x.test(h)||_.test(h))break;u+=`
220
221
  `+d}!f&&!d.trim()&&(f=!0),c+=H+`
221
- `,t=t.substring(H.length+1),h=M.slice(g)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,S;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(S=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:S,loose:!1,text:u,tokens:[]}),s.raw+=c}const a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(h=>h.type==="space"),u=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=Ml(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
222
- `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const a of n)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<r.length;a++)i.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:i.align[a]});for(const a of s)i.rows.push(Ml(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
223
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=mn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=Eb(e[2],"()");if(i===-2)return;if(i>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),Hl(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Hl(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,a,l=i,c=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(n=u.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=[...o].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const h=[...n[0]][0].length,d=t.slice(0,i+n.index+h+a);if(Math.min(i,a)%2){const g=d.slice(1,-1);return{type:"em",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}const f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Ft=class fo{constructor(e){fe(this,"tokens");fe(this,"options");fe(this,"state");fe(this,"tokenizer");fe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Or,this.options.tokenizer=this.options.tokenizer||new Us,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:ze,block:ps.normal,inline:gn.normal};this.options.pedantic?(r.block=ps.pedantic,r.inline=gn.pedantic):this.options.gfm&&(r.block=ps.gfm,this.options.breaks?r.inline=gn.breaks:r.inline=gn.gfm),this.tokenizer.rules=r}static get rules(){return{block:ps,inline:gn}}static lex(e,r){return new fo(r).lex(e)}static lexInline(e,r){return new fo(r).inlineTokens(e)}lex(e){e=e.replace(ze.carriageReturn,`
222
+ `,t=t.substring(H.length+1),h=U.slice(g)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,k;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(k=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:k,loose:!1,text:u,tokens:[]}),s.raw+=c}const a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(h=>h.type==="space"),u=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=Ll(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
223
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const a of n)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<r.length;a++)i.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:i.align[a]});for(const a of s)i.rows.push(Ll(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
224
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=fn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=_b(e[2],"()");if(i===-2)return;if(i>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),Dl(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Dl(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,a,l=i,c=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(n=u.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=[...o].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const h=[...n[0]][0].length,d=t.slice(0,i+n.index+h+a);if(Math.min(i,a)%2){const g=d.slice(1,-1);return{type:"em",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}const f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Ft=class lo{constructor(e){fe(this,"tokens");fe(this,"options");fe(this,"state");fe(this,"tokenizer");fe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||xr,this.options.tokenizer=this.options.tokenizer||new Ns,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:ze,block:ds.normal,inline:dn.normal};this.options.pedantic?(r.block=ds.pedantic,r.inline=dn.pedantic):this.options.gfm&&(r.block=ds.gfm,this.options.breaks?r.inline=dn.breaks:r.inline=dn.gfm),this.tokenizer.rules=r}static get rules(){return{block:ds,inline:dn}}static lex(e,r){return new lo(r).lex(e)}static lexInline(e,r){return new lo(r).inlineTokens(e)}lex(e){e=e.replace(ze.carriageReturn,`
224
225
  `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(ze.tabCharGlobal," ").replace(ze.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
225
226
  `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
226
227
  `+a.raw,c.text+=`
@@ -230,7 +231,7 @@ ${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
230
231
  `+a.raw,c.text+=`
231
232
  `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a),n=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
232
233
  `+a.raw,c.text+=`
233
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var a,l,c;let n=e,s=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let u;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(d=>(u=d.call({lexer:this},e,r))?(e=e.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const d=r.at(-1);u.type==="text"&&(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(e,n,o)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),r.push(u);continue}let h=e;if((c=this.options.extensions)!=null&&c.startInline){let d=1/0;const f=e.slice(1);let g;this.options.extensions.startInline.forEach(y=>{g=y.call({lexer:this},f),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(h=e.substring(0,d+1))}if(u=this.tokenizer.inlineText(h)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const d=r.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}},Bs=class{constructor(t){fe(this,"options");fe(this,"parser");this.options=t||Or}space(t){return""}code({text:t,lang:e,escaped:r}){var i;const n=(i=(e||"").match(ze.notSpaceStart))==null?void 0:i[0],s=t.replace(ze.endingNewline,"")+`
234
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var a,l,c;let n=e,s=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let u;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(d=>(u=d.call({lexer:this},e,r))?(e=e.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const d=r.at(-1);u.type==="text"&&(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(e,n,o)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),r.push(u);continue}let h=e;if((c=this.options.extensions)!=null&&c.startInline){let d=1/0;const f=e.slice(1);let g;this.options.extensions.startInline.forEach(y=>{g=y.call({lexer:this},f),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(h=e.substring(0,d+1))}if(u=this.tokenizer.inlineText(h)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const d=r.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}},Ls=class{constructor(t){fe(this,"options");fe(this,"parser");this.options=t||xr}space(t){return""}code({text:t,lang:e,escaped:r}){var i;const n=(i=(e||"").match(ze.notSpaceStart))==null?void 0:i[0],s=t.replace(ze.endingNewline,"")+`
234
235
  `;return n?'<pre><code class="language-'+St(n)+'">'+(r?s:St(s,!0))+`</code></pre>
235
236
  `:"<pre><code>"+(r?s:St(s,!0))+`</code></pre>
236
237
  `}blockquote({tokens:t}){return`<blockquote>
@@ -248,6 +249,6 @@ ${this.parser.parse(t)}</blockquote>
248
249
  `}tablerow({text:t}){return`<tr>
249
250
  ${t}</tr>
250
251
  `}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
251
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${St(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),s=Bl(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+St(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const s=Bl(t);if(s===null)return St(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${St(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:St(t.text)}},zo=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Vt=class po{constructor(e){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=e||Or,this.options.renderer=this.options.renderer||new Bs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zo}static parse(e,r){return new po(r).parse(e)}static parseInline(e,r){return new po(r).parseInline(e)}parse(e,r=!0){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){n+=u||"";continue}}const l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
252
- `+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}const l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},$i,_s=($i=class{constructor(t){fe(this,"options");fe(this,"block");this.options=t||Or}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ft.lex:Ft.lexInline}provideParser(){return this.block?Vt.parse:Vt.parseInline}},fe($i,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),$i),Ab=class{constructor(...t){fe(this,"defaults",Do());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",Vt);fe(this,"Renderer",Bs);fe(this,"TextRenderer",zo);fe(this,"Lexer",Ft);fe(this,"Tokenizer",Us);fe(this,"Hooks",_s);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(const i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{const o=i;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,e));for(const a of o.rows)for(const l of a)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=i;r=r.concat(this.walkTokens(o.items,e));break}default:{const o=i;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const l=o[a].flat(1/0);r=r.concat(this.walkTokens(l,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){const s=this.defaults.renderer||new Bs(this.defaults);for(const i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,a=r.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new Us(this.defaults);for(const i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,a=r.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new _s;for(const i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,a=r.hooks[o],l=s[o];_s.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(s,c)).then(h=>l.call(s,h));const u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ft.lex(t,e??this.defaults)}parser(t,e){return Vt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const a=i.hooks?i.hooks.provideLexer():t?Ft.lex:Ft.lexInline,l=i.hooks?i.hooks.provideParser():t?Vt.parse:Vt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>l(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let c=a(r,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=l(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return o(c)}}}onError(t,e){return r=>{if(r.message+=`
253
- Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+St(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Rr=new Ab;function ce(t,e){return Rr.parse(t,e)}ce.options=ce.setOptions=function(t){return Rr.setOptions(t),ce.defaults=Rr.defaults,Gu(ce.defaults),ce};ce.getDefaults=Do;ce.defaults=Or;ce.use=function(...t){return Rr.use(...t),ce.defaults=Rr.defaults,Gu(ce.defaults),ce};ce.walkTokens=function(t,e){return Rr.walkTokens(t,e)};ce.parseInline=Rr.parseInline;ce.Parser=Vt;ce.parser=Vt.parse;ce.Renderer=Bs;ce.TextRenderer=zo;ce.Lexer=Ft;ce.lexer=Ft.lex;ce.Tokenizer=Us;ce.Hooks=_s;ce.parse=ce;ce.options;ce.setOptions;ce.use;ce.walkTokens;ce.parseInline;Vt.parse;Ft.lex;const xb=["innerHTML"],Rb=dr({__name:"MarkdownContent",props:{content:{}},setup(t){const e=t,r=Ue(()=>e.content?ce.parse(e.content,{async:!1}):"");return(n,s)=>(oe(),Ee("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:r.value},null,8,xb))}}),Cb={key:0,class:"fixed bottom-6 right-6 z-50 w-96 h-[500px] bg-card border border-border rounded-xl shadow-2xl flex flex-col overflow-hidden"},Ob={class:"flex items-center justify-between px-4 py-3 border-b border-border bg-header"},Pb={key:0,class:"flex items-center justify-center h-full"},Ib={key:1,class:"text-muted-foreground"},$b={key:2,class:"inline-block w-1.5 h-3 bg-current animate-pulse ml-1"},jb={class:"border-t border-border p-3"},Nb={class:"flex gap-2 items-end"},Lb=["disabled"],Db=dr({__name:"ChatOverlay",setup(t){const e=Vv(),r=jo(),n=et(!1),s=et(""),i=et(),o=()=>r.path==="/";function a(){o()||(n.value=!n.value)}async function l(){const h=s.value.trim();!h||e.isStreaming||(s.value="",await e.sendMessage(h))}function c(h){h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),l())}function u(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}return Ar(()=>e.messages.map(h=>h.content),async()=>{await Xr(),u()},{deep:!0}),Ar(()=>e.messages.length,async()=>{await Xr(),u()}),(h,d)=>(oe(),Ee(Ye,null,[!n.value&&!o()?(oe(),Ee("button",{key:0,onClick:a,class:"fixed bottom-6 right-6 z-50 w-12 h-12 rounded-full btn-gradient flex items-center justify-center shadow-glow-lg hover:scale-105 transition-transform",title:"Chat with IO"},[ue(_e(mg),{class:"w-5 h-5 text-white"})])):Ze("",!0),ue(df,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-95","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-95"},{default:Yr(()=>[n.value?(oe(),Ee("div",Cb,[ve("div",Ob,[d[2]||(d[2]=ve("div",{class:"flex items-center gap-2"},[ve("div",{class:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),ve("span",{class:"text-sm font-medium"},"IO Assistant")],-1)),ve("button",{onClick:d[0]||(d[0]=f=>n.value=!1),class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"},[ue(_e(yg),{class:"w-4 h-4"})])]),ve("div",{ref_key:"messagesContainer",ref:i,class:"flex-1 overflow-y-auto p-3 space-y-3"},[_e(e).messages.length===0?(oe(),Ee("div",Pb,[...d[3]||(d[3]=[ve("p",{class:"text-xs text-muted-foreground"},"Send a message to chat with IO",-1)])])):Ze("",!0),(oe(!0),Ee(Ye,null,Bi(_e(e).messages,f=>(oe(),Ee("div",{key:f.id,class:at(["flex",f.role==="user"?"justify-end":"justify-start"])},[ve("div",{class:at(["max-w-[80%] rounded-lg px-3 py-2 text-xs",f.role==="user"?"bg-primary text-primary-foreground":"bg-secondary text-foreground"])},[f.content?(oe(),Kt(Rb,{key:0,content:f.content,class:at(f.role==="user"?"prose-invert":"")},null,8,["content","class"])):(oe(),Ee("span",Ib,"...")),f.streaming?(oe(),Ee("div",$b)):Ze("",!0)],2)],2))),128))],512),ve("div",jb,[ve("div",Nb,[ed(ve("textarea",{"onUpdate:modelValue":d[1]||(d[1]=f=>s.value=f),onKeydown:c,placeholder:"Message IO...",rows:"1",class:"flex-1 resize-none rounded-md border border-input bg-input px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring min-h-[36px] max-h-[80px]"},null,544),[[Nf,s.value]]),ve("button",{onClick:l,disabled:!s.value.trim()||_e(e).isStreaming,class:"rounded-md bg-primary text-primary-foreground p-2 hover:bg-primary/90 disabled:opacity-50 transition-colors"},[_e(e).isStreaming?(oe(),Kt(_e(Eg),{key:1,class:"w-3.5 h-3.5"})):(oe(),Kt(_e(wg),{key:0,class:"w-3.5 h-3.5"}))],8,Lb)])])])):Ze("",!0)]),_:1})],64))}}),Ub={class:"flex h-screen overflow-hidden"},Bb={class:"flex-1 flex flex-col overflow-hidden"},Mb={class:"flex-1 overflow-auto"},Hb=dr({__name:"App",setup(t){const e=Cr(),r=jo(),n=Ue(()=>e.isAuthenticated&&r.name!=="login");return(s,i)=>{const o=xo("router-view");return oe(),Ee("div",Ub,[n.value?(oe(),Kt(jg,{key:0})):Ze("",!0),ve("div",Bb,[n.value?(oe(),Kt(Mv,{key:0})):Ze("",!0),ve("main",Mb,[ue(o)])]),n.value?(oe(),Kt(Db,{key:1})):Ze("",!0)])}}});async function qb(){await Nv();const t=Hf(Hb);t.use(Vf()),t.use(Ls);const{useAuthStore:e}=await Me(async()=>{const{useAuthStore:n}=await Promise.resolve().then(()=>Lv);return{useAuthStore:n}},void 0),r=e();r.initAuthListener(),r.token&&await r.refreshToken(),t.mount("#app")}qb();export{Kb as $,lg as A,cg as B,ug as C,et as D,Bi as E,Ye as F,xo as G,pg as H,Eu as I,ms as J,_e as K,Cr as L,rl as M,Vv as N,jo as O,_g as P,rg as Q,Vb as R,wg as S,zb as T,Tg as U,Nf as V,Ar as W,Yr as X,ed as Y,Wb as Z,ig as _,hg as a,dg as b,kg as c,Eg as d,Ag as e,Rb as f,Yb as g,Gb as h,Fv as i,Jb as j,Ue as k,ve as l,Kt as m,Ze as n,Ee as o,Zb as p,Te as q,Gd as r,ue as s,dr as t,Xr as u,at as v,yo as w,Pc as x,$c as y,oe as z};
252
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${St(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),s=Nl(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+St(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const s=Nl(t);if(s===null)return St(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${St(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:St(t.text)}},Ho=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Vt=class co{constructor(e){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=e||xr,this.options.renderer=this.options.renderer||new Ls,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ho}static parse(e,r){return new co(r).parse(e)}static parseInline(e,r){return new co(r).parseInline(e)}parse(e,r=!0){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){n+=u||"";continue}}const l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
253
+ `+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}const l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},Ci,vs=(Ci=class{constructor(t){fe(this,"options");fe(this,"block");this.options=t||xr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ft.lex:Ft.lexInline}provideParser(){return this.block?Vt.parse:Vt.parseInline}},fe(Ci,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ci),kb=class{constructor(...t){fe(this,"defaults",jo());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",Vt);fe(this,"Renderer",Ls);fe(this,"TextRenderer",Ho);fe(this,"Lexer",Ft);fe(this,"Tokenizer",Ns);fe(this,"Hooks",vs);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(const i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{const o=i;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,e));for(const a of o.rows)for(const l of a)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=i;r=r.concat(this.walkTokens(o.items,e));break}default:{const o=i;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const l=o[a].flat(1/0);r=r.concat(this.walkTokens(l,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){const s=this.defaults.renderer||new Ls(this.defaults);for(const i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,a=r.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new Ns(this.defaults);for(const i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,a=r.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new vs;for(const i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,a=r.hooks[o],l=s[o];vs.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(s,c)).then(h=>l.call(s,h));const u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ft.lex(t,e??this.defaults)}parser(t,e){return Vt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const a=i.hooks?i.hooks.provideLexer():t?Ft.lex:Ft.lexInline,l=i.hooks?i.hooks.provideParser():t?Vt.parse:Vt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>l(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let c=a(r,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=l(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return o(c)}}}onError(t,e){return r=>{if(r.message+=`
254
+ Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+St(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ar=new kb;function ce(t,e){return Ar.parse(t,e)}ce.options=ce.setOptions=function(t){return Ar.setOptions(t),ce.defaults=Ar.defaults,Vu(ce.defaults),ce};ce.getDefaults=jo;ce.defaults=xr;ce.use=function(...t){return Ar.use(...t),ce.defaults=Ar.defaults,Vu(ce.defaults),ce};ce.walkTokens=function(t,e){return Ar.walkTokens(t,e)};ce.parseInline=Ar.parseInline;ce.Parser=Vt;ce.parser=Vt.parse;ce.Renderer=Ls;ce.TextRenderer=Ho;ce.Lexer=Ft;ce.lexer=Ft.lex;ce.Tokenizer=Ns;ce.Hooks=vs;ce.parse=ce;ce.options;ce.setOptions;ce.use;ce.walkTokens;ce.parseInline;Vt.parse;Ft.lex;const Sb=["innerHTML"],Eb=ur({__name:"MarkdownContent",props:{content:{}},setup(t){const e=t,r=Ue(()=>e.content?ce.parse(e.content,{async:!1}):"");return(n,s)=>(oe(),Ee("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:r.value},null,8,Sb))}}),Tb={key:0,class:"fixed bottom-6 right-6 z-50 w-96 h-[500px] bg-card border border-border rounded-xl shadow-2xl flex flex-col overflow-hidden"},Ab={class:"flex items-center justify-between px-4 py-3 border-b border-border bg-header"},xb={key:0,class:"flex items-center justify-center h-full"},Rb={key:1,class:"text-muted-foreground"},Cb={key:2,class:"inline-block w-1.5 h-3 bg-current animate-pulse ml-1"},Ob={class:"border-t border-border p-3"},Pb={class:"flex gap-2 items-end"},Ib=["disabled"],jb=ur({__name:"ChatOverlay",setup(t){const e=Mv(),r=Oo(),n=et(!1),s=et(""),i=et(),o=()=>r.path==="/";function a(){o()||(n.value=!n.value)}async function l(){const h=s.value.trim();!h||e.isStreaming||(s.value="",await e.sendMessage(h))}function c(h){h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),l())}function u(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}return Er(()=>e.messages.map(h=>h.content),async()=>{await Yr(),u()},{deep:!0}),Er(()=>e.messages.length,async()=>{await Yr(),u()}),(h,d)=>(oe(),Ee(Ye,null,[!n.value&&!o()?(oe(),Ee("button",{key:0,onClick:a,class:"fixed bottom-6 right-6 z-50 w-12 h-12 rounded-full btn-gradient flex items-center justify-center shadow-glow-lg hover:scale-105 transition-transform",title:"Chat with IO"},[ue(_e(fg),{class:"w-5 h-5 text-white"})])):Qe("",!0),ue(cf,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-95","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-95"},{default:Kr(()=>[n.value?(oe(),Ee("div",Tb,[ve("div",Ab,[d[2]||(d[2]=ve("div",{class:"flex items-center gap-2"},[ve("div",{class:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),ve("span",{class:"text-sm font-medium"},"IO Assistant")],-1)),ve("button",{onClick:d[0]||(d[0]=f=>n.value=!1),class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"},[ue(_e(pg),{class:"w-4 h-4"})])]),ve("div",{ref_key:"messagesContainer",ref:i,class:"flex-1 overflow-y-auto p-3 space-y-3"},[_e(e).messages.length===0?(oe(),Ee("div",xb,[...d[3]||(d[3]=[ve("p",{class:"text-xs text-muted-foreground"},"Send a message to chat with IO",-1)])])):Qe("",!0),(oe(!0),Ee(Ye,null,Ni(_e(e).messages,f=>(oe(),Ee("div",{key:f.id,class:at(["flex",f.role==="user"?"justify-end":"justify-start"])},[ve("div",{class:at(["max-w-[80%] rounded-lg px-3 py-2 text-xs",f.role==="user"?"bg-primary text-primary-foreground":"bg-secondary text-foreground"])},[f.content?(oe(),Wt(Eb,{key:0,content:f.content,class:at(f.role==="user"?"prose-invert":"")},null,8,["content","class"])):(oe(),Ee("span",Rb,"...")),f.streaming?(oe(),Ee("div",Cb)):Qe("",!0)],2)],2))),128))],512),ve("div",Ob,[ve("div",Pb,[Qh(ve("textarea",{"onUpdate:modelValue":d[1]||(d[1]=f=>s.value=f),onKeydown:c,placeholder:"Message IO...",rows:"1",class:"flex-1 resize-none rounded-md border border-input bg-input px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring min-h-[36px] max-h-[80px]"},null,544),[[If,s.value]]),ve("button",{onClick:l,disabled:!s.value.trim()||_e(e).isStreaming,class:"rounded-md bg-primary text-primary-foreground p-2 hover:bg-primary/90 disabled:opacity-50 transition-colors"},[_e(e).isStreaming?(oe(),Wt(_e(wg),{key:1,class:"w-3.5 h-3.5"})):(oe(),Wt(_e(vg),{key:0,class:"w-3.5 h-3.5"}))],8,Ib)])])])):Qe("",!0)]),_:1})],64))}}),$b={class:"flex h-screen overflow-hidden"},Nb={class:"flex-1 flex flex-col overflow-hidden"},Lb={class:"flex-1 overflow-auto"},Db=ur({__name:"App",setup(t){const e=Qn(),r=Oo(),n=Ue(()=>e.isAuthenticated&&r.name!=="login");return(s,i)=>{const o=So("router-view");return oe(),Ee("div",$b,[n.value?(oe(),Wt(Pg,{key:0})):Qe("",!0),ve("div",Nb,[n.value?(oe(),Wt(Dv,{key:0})):Qe("",!0),ve("main",Lb,[ue(o)])]),n.value?(oe(),Wt(jb,{key:1})):Qe("",!0)])}}}),Ub=[{path:"/login",name:"login",component:()=>Me(()=>import("./LoginView-bg8Sl_Gw.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>Me(()=>import("./ChatView-DXpE1NMj.js"),[])},{path:"/squads",name:"squads",component:()=>Me(()=>import("./SquadsView-C5wQPkBA.js"),__vite__mapDeps([0,1,2,3]))},{path:"/squads/health",name:"squad-health",component:()=>Me(()=>import("./SquadHealthView-IjOdIla7.js"),__vite__mapDeps([4,1,5,3]))},{path:"/squads/:id",name:"squad-detail",component:()=>Me(()=>import("./SquadDetailView-p4c6XQ5a.js"),__vite__mapDeps([6,1,2,7,3,8,9]))},{path:"/feed",name:"feed",component:()=>Me(()=>import("./FeedView-Clis71Lg.js"),__vite__mapDeps([10,1,2,8]))},{path:"/skills",name:"skills",component:()=>Me(()=>import("./SkillsView-Dv-337Yq.js"),__vite__mapDeps([11,1,12,13,14,7,8]))},{path:"/mcp",name:"mcp",component:()=>Me(()=>import("./McpView-CBepc2JJ.js"),__vite__mapDeps([15,1,12,8]))},{path:"/schedules",name:"schedules",component:()=>Me(()=>import("./SchedulesView-DDFUUMPG.js"),__vite__mapDeps([16,1,2,12,8]))},{path:"/history",name:"history",component:()=>Me(()=>import("./HistoryView-B1EJ2Q9S.js"),__vite__mapDeps([17,1,13,9,8]))},{path:"/wiki",name:"wiki",component:()=>Me(()=>import("./WikiView-CKBw5FOf.js"),__vite__mapDeps([18,1,13,12,14,8,7]))},{path:"/usage",name:"usage",component:()=>Me(()=>import("./UsageView-BcHfPX-N.js"),__vite__mapDeps([19,1,5]))},{path:"/audit-log",name:"audit-log",component:()=>Me(()=>import("./AuditLogView-eyz02XQx.js"),__vite__mapDeps([20,1]))},{path:"/settings",name:"settings",component:()=>Me(()=>import("./SettingsView-BFfDRToB.js"),__vite__mapDeps([21,1]))}],th=Zp({history:Op(),routes:Ub});th.beforeEach(t=>{const e=Qn();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function Bb(){await Iv();const t=Uf(Db);t.use(Hf()),t.use(th);const{useAuthStore:e}=await Me(async()=>{const{useAuthStore:n}=await Promise.resolve().then(()=>jv);return{useAuthStore:n}},void 0),r=e();r.initAuthListener(),r.token&&await r.refreshToken(),t.mount("#app")}Bb();export{ig as A,og as B,ag as C,_e as D,Qn as E,Ye as F,Mv as G,hg as H,_u as I,Oo as J,Xp as K,Hb as L,Za as M,qb as N,If as O,yg as P,Er as Q,Kr as R,vg as S,Qh as T,kg as U,Vb as V,Fb as W,rg as _,lg as a,cg as b,bg as c,wg as d,Sg as e,Eb as f,Ue as g,ve as h,Wt as i,Qe as j,Ee as k,Te as l,zd as m,ue as n,ur as o,Yr as p,at as q,fo as r,xc as s,Cc as t,oe as u,et as v,Ni as w,So as x,th as y,ps as z};