codexapp 0.1.56 → 0.1.58

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.
@@ -1,1429 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
2
- * @vue/shared v3.5.31
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/function hl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const St={},bs=[],sr=()=>{},ld=()=>!1,Ti=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Si=e=>e.startsWith("onUpdate:"),Ht=Object.assign,pl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},jh=Object.prototype.hasOwnProperty,vt=(e,t)=>jh.call(e,t),Ge=Array.isArray,_s=e=>ko(e)==="[object Map]",cd=e=>ko(e)==="[object Set]",Jl=e=>ko(e)==="[object Date]",Ke=e=>typeof e=="function",Ot=e=>typeof e=="string",Vn=e=>typeof e=="symbol",yt=e=>e!==null&&typeof e=="object",ud=e=>(yt(e)||Ke(e))&&Ke(e.then)&&Ke(e.catch),dd=Object.prototype.toString,ko=e=>dd.call(e),Uh=e=>ko(e).slice(8,-1),fd=e=>ko(e)==="[object Object]",ml=e=>Ot(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Xs=hl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ii=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Fh=/-\w/g,yn=Ii(e=>e.replace(Fh,t=>t.slice(1).toUpperCase())),Bh=/\B([A-Z])/g,Hr=Ii(e=>e.replace(Bh,"-$1").toLowerCase()),Ei=Ii(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zi=Ii(e=>e?`on${Ei(e)}`:""),er=(e,t)=>!Object.is(e,t),Yo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},hd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},gl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Hh=e=>{const t=Ot(e)?Number(e):NaN;return isNaN(t)?e:t};let Yl;const Ci=()=>Yl||(Yl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Fr(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Ot(r)?Gh(r):Fr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Ot(e)||yt(e))return e}const Wh=/;(?![^(]*\))/g,Vh=/:([^]+)/,zh=/\/\*[^]*?\*\//g;function Gh(e){const t={};return e.replace(zh,"").split(Wh).forEach(n=>{if(n){const r=n.split(Vh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function st(e){let t="";if(Ot(e))t=e;else if(Ge(e))for(let n=0;n<e.length;n++){const r=st(e[n]);r&&(t+=r+" ")}else if(yt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const qh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Kh=hl(qh);function pd(e){return!!e||e===""}function Jh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=vl(e[r],t[r]);return n}function vl(e,t){if(e===t)return!0;let n=Jl(e),r=Jl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Vn(e),r=Vn(t),n||r)return e===t;if(n=Ge(e),r=Ge(t),n||r)return n&&r?Jh(e,t):!1;if(n=yt(e),r=yt(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!vl(e[i],t[i]))return!1}}return String(e)===String(t)}const md=e=>!!(e&&e.__v_isRef===!0),ae=e=>Ot(e)?e:e==null?"":Ge(e)||yt(e)&&(e.toString===dd||!Ke(e.toString))?md(e)?ae(e.value):JSON.stringify(e,gd,2):String(e),gd=(e,t)=>md(t)?gd(e,t.value):_s(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ea(r,o)+" =>"]=s,n),{})}:cd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ea(n))}:Vn(t)?ea(t):yt(t)&&!Ge(t)&&!fd(t)?String(t):t,ea=(e,t="")=>{var n;return Vn(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
6
- * @vue/reactivity v3.5.31
7
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
- * @license MIT
9
- **/let Sn;class Yh{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Sn,!t&&Sn&&(this.index=(Sn.scopes||(Sn.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Sn;try{return Sn=this,t()}finally{Sn=n}}}on(){++this._on===1&&(this.prevScope=Sn,Sn=this)}off(){this._on>0&&--this._on===0&&(Sn=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Xh(){return Sn}let Et;const ta=new WeakSet;class vd{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Sn&&Sn.active&&Sn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ta.has(this)&&(ta.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||wd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xl(this),bd(this);const t=Et,n=Bn;Et=this,Bn=!0;try{return this.fn()}finally{_d(this),Et=t,Bn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)bl(t);this.deps=this.depsTail=void 0,Xl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ta.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Oa(this)&&this.run()}get dirty(){return Oa(this)}}let yd=0,Qs,Zs;function wd(e,t=!1){if(e.flags|=8,t){e.next=Zs,Zs=e;return}e.next=Qs,Qs=e}function yl(){yd++}function wl(){if(--yd>0)return;if(Zs){let t=Zs;for(Zs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Qs;){let t=Qs;for(Qs=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function bd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function _d(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),bl(r),Qh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Oa(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(kd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function kd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ao)||(e.globalVersion=ao,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Oa(e))))return;e.flags|=2;const t=e.dep,n=Et,r=Bn;Et=e,Bn=!0;try{bd(e);const s=e.fn(e._value);(t.version===0||er(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Et=n,Bn=r,_d(e),e.flags&=-3}}function bl(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)bl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Qh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Bn=!0;const Td=[];function br(){Td.push(Bn),Bn=!1}function _r(){const e=Td.pop();Bn=e===void 0?!0:e}function Xl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Et;Et=void 0;try{t()}finally{Et=n}}}let ao=0;class Zh{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class _l{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Et||!Bn||Et===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Et)n=this.activeLink=new Zh(Et,this),Et.deps?(n.prevDep=Et.depsTail,Et.depsTail.nextDep=n,Et.depsTail=n):Et.deps=Et.depsTail=n,Sd(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Et.depsTail,n.nextDep=void 0,Et.depsTail.nextDep=n,Et.depsTail=n,Et.deps===n&&(Et.deps=r)}return n}trigger(t){this.version++,ao++,this.notify(t)}notify(t){yl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{wl()}}}function Sd(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Sd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Na=new WeakMap,is=Symbol(""),Da=Symbol(""),lo=Symbol("");function on(e,t,n){if(Bn&&Et){let r=Na.get(e);r||Na.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new _l),s.map=r,s.key=n),s.track()}}function mr(e,t,n,r,s,o){const i=Na.get(e);if(!i){ao++;return}const a=l=>{l&&l.trigger()};if(yl(),t==="clear")i.forEach(a);else{const l=Ge(e),u=l&&ml(n);if(l&&n==="length"){const c=Number(r);i.forEach((f,m)=>{(m==="length"||m===lo||!Vn(m)&&m>=c)&&a(f)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(lo)),t){case"add":l?u&&a(i.get("length")):(a(i.get(is)),_s(e)&&a(i.get(Da)));break;case"delete":l||(a(i.get(is)),_s(e)&&a(i.get(Da)));break;case"set":_s(e)&&a(i.get(is));break}}wl()}function ps(e){const t=ht(e);return t===e?t:(on(t,"iterate",lo),jn(e)?t:t.map(zn))}function Ai(e){return on(e=ht(e),"iterate",lo),e}function Qn(e,t){return kr(e)?xs(as(e)?zn(t):t):zn(t)}const ep={__proto__:null,[Symbol.iterator](){return na(this,Symbol.iterator,e=>Qn(this,e))},concat(...e){return ps(this).concat(...e.map(t=>Ge(t)?ps(t):t))},entries(){return na(this,"entries",e=>(e[1]=Qn(this,e[1]),e))},every(e,t){return cr(this,"every",e,t,void 0,arguments)},filter(e,t){return cr(this,"filter",e,t,n=>n.map(r=>Qn(this,r)),arguments)},find(e,t){return cr(this,"find",e,t,n=>Qn(this,n),arguments)},findIndex(e,t){return cr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return cr(this,"findLast",e,t,n=>Qn(this,n),arguments)},findLastIndex(e,t){return cr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return cr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ra(this,"includes",e)},indexOf(...e){return ra(this,"indexOf",e)},join(e){return ps(this).join(e)},lastIndexOf(...e){return ra(this,"lastIndexOf",e)},map(e,t){return cr(this,"map",e,t,void 0,arguments)},pop(){return Vs(this,"pop")},push(...e){return Vs(this,"push",e)},reduce(e,...t){return Ql(this,"reduce",e,t)},reduceRight(e,...t){return Ql(this,"reduceRight",e,t)},shift(){return Vs(this,"shift")},some(e,t){return cr(this,"some",e,t,void 0,arguments)},splice(...e){return Vs(this,"splice",e)},toReversed(){return ps(this).toReversed()},toSorted(e){return ps(this).toSorted(e)},toSpliced(...e){return ps(this).toSpliced(...e)},unshift(...e){return Vs(this,"unshift",e)},values(){return na(this,"values",e=>Qn(this,e))}};function na(e,t,n){const r=Ai(e),s=r[t]();return r!==e&&!jn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const tp=Array.prototype;function cr(e,t,n,r,s,o){const i=Ai(e),a=i!==e&&!jn(e),l=i[t];if(l!==tp[t]){const f=l.apply(e,o);return a?zn(f):f}let u=n;i!==e&&(a?u=function(f,m){return n.call(this,Qn(e,f),m,e)}:n.length>2&&(u=function(f,m){return n.call(this,f,m,e)}));const c=l.call(i,u,r);return a&&s?s(c):c}function Ql(e,t,n,r){const s=Ai(e),o=s!==e&&!jn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(u,c,f){return a&&(a=!1,u=Qn(e,u)),n.call(this,u,Qn(e,c),f,e)}):n.length>3&&(i=function(u,c,f){return n.call(this,u,c,f,e)}));const l=s[t](i,...r);return a?Qn(e,l):l}function ra(e,t,n){const r=ht(e);on(r,"iterate",lo);const s=r[t](...n);return(s===-1||s===!1)&&Sl(n[0])?(n[0]=ht(n[0]),r[t](...n)):s}function Vs(e,t,n=[]){br(),yl();const r=ht(e)[t].apply(e,n);return wl(),_r(),r}const np=hl("__proto__,__v_isRef,__isVue"),Id=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Vn));function rp(e){Vn(e)||(e=String(e));const t=ht(this);return on(t,"has",e),t.hasOwnProperty(e)}class Ed{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?hp:Rd:o?xd:Ad).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ge(t);if(!s){let l;if(i&&(l=ep[n]))return l;if(n==="hasOwnProperty")return rp}const a=Reflect.get(t,n,cn(t)?t:r);if((Vn(n)?Id.has(n):np(n))||(s||on(t,"get",n),o))return a;if(cn(a)){const l=i&&ml(n)?a:a.value;return s&&yt(l)?ja(l):l}return yt(a)?s?ja(a):xi(a):a}}class Cd extends Ed{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ge(t)&&ml(n);if(!this._isShallow){const u=kr(o);if(!jn(r)&&!kr(r)&&(o=ht(o),r=ht(r)),!i&&cn(o)&&!cn(r))return u||(o.value=r),!0}const a=i?Number(n)<t.length:vt(t,n),l=Reflect.set(t,n,r,cn(t)?t:s);return t===ht(s)&&(a?er(r,o)&&mr(t,"set",n,r):mr(t,"add",n,r)),l}deleteProperty(t,n){const r=vt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&mr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!Vn(n)||!Id.has(n))&&on(t,"has",n),r}ownKeys(t){return on(t,"iterate",Ge(t)?"length":is),Reflect.ownKeys(t)}}class sp extends Ed{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const op=new Cd,ip=new sp,ap=new Cd(!0);const La=e=>e,Bo=e=>Reflect.getPrototypeOf(e);function lp(e,t,n){return function(...r){const s=this.__v_raw,o=ht(s),i=_s(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,u=s[e](...r),c=n?La:t?xs:zn;return!t&&on(o,"iterate",l?Da:is),Ht(Object.create(u),{next(){const{value:f,done:m}=u.next();return m?{value:f,done:m}:{value:a?[c(f[0]),c(f[1])]:c(f),done:m}}})}}function Ho(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function cp(e,t){const n={get(s){const o=this.__v_raw,i=ht(o),a=ht(s);e||(er(s,a)&&on(i,"get",s),on(i,"get",a));const{has:l}=Bo(i),u=t?La:e?xs:zn;if(l.call(i,s))return u(o.get(s));if(l.call(i,a))return u(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&on(ht(s),"iterate",is),s.size},has(s){const o=this.__v_raw,i=ht(o),a=ht(s);return e||(er(s,a)&&on(i,"has",s),on(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=ht(a),u=t?La:e?xs:zn;return!e&&on(l,"iterate",is),a.forEach((c,f)=>s.call(o,u(c),u(f),i))}};return Ht(n,e?{add:Ho("add"),set:Ho("set"),delete:Ho("delete"),clear:Ho("clear")}:{add(s){const o=ht(this),i=Bo(o),a=ht(s),l=!t&&!jn(s)&&!kr(s)?a:s;return i.has.call(o,l)||er(s,l)&&i.has.call(o,s)||er(a,l)&&i.has.call(o,a)||(o.add(l),mr(o,"add",l,l)),this},set(s,o){!t&&!jn(o)&&!kr(o)&&(o=ht(o));const i=ht(this),{has:a,get:l}=Bo(i);let u=a.call(i,s);u||(s=ht(s),u=a.call(i,s));const c=l.call(i,s);return i.set(s,o),u?er(o,c)&&mr(i,"set",s,o):mr(i,"add",s,o),this},delete(s){const o=ht(this),{has:i,get:a}=Bo(o);let l=i.call(o,s);l||(s=ht(s),l=i.call(o,s)),a&&a.call(o,s);const u=o.delete(s);return l&&mr(o,"delete",s,void 0),u},clear(){const s=ht(this),o=s.size!==0,i=s.clear();return o&&mr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=lp(s,e,t)}),n}function kl(e,t){const n=cp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(vt(n,s)&&s in r?n:r,s,o)}const up={get:kl(!1,!1)},dp={get:kl(!1,!0)},fp={get:kl(!0,!1)};const Ad=new WeakMap,xd=new WeakMap,Rd=new WeakMap,hp=new WeakMap;function pp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function mp(e){return e.__v_skip||!Object.isExtensible(e)?0:pp(Uh(e))}function xi(e){return kr(e)?e:Tl(e,!1,op,up,Ad)}function Pd(e){return Tl(e,!1,ap,dp,xd)}function ja(e){return Tl(e,!0,ip,fp,Rd)}function Tl(e,t,n,r,s){if(!yt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=mp(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function as(e){return kr(e)?as(e.__v_raw):!!(e&&e.__v_isReactive)}function kr(e){return!!(e&&e.__v_isReadonly)}function jn(e){return!!(e&&e.__v_isShallow)}function Sl(e){return e?!!e.__v_raw:!1}function ht(e){const t=e&&e.__v_raw;return t?ht(t):e}function gp(e){return!vt(e,"__v_skip")&&Object.isExtensible(e)&&hd(e,"__v_skip",!0),e}const zn=e=>yt(e)?xi(e):e,xs=e=>yt(e)?ja(e):e;function cn(e){return e?e.__v_isRef===!0:!1}function N(e){return Md(e,!1)}function vp(e){return Md(e,!0)}function Md(e,t){return cn(e)?e:new yp(e,t)}class yp{constructor(t,n){this.dep=new _l,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ht(t),this._value=n?t:zn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||jn(t)||kr(t);t=r?t:ht(t),er(t,n)&&(this._rawValue=t,this._value=r?t:zn(t),this.dep.trigger())}}function _e(e){return cn(e)?e.value:e}const wp={get:(e,t,n)=>t==="__v_raw"?e:_e(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return cn(s)&&!cn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function $d(e){return as(e)?e:new Proxy(e,wp)}class bp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new _l(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ao-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Et!==this)return wd(this,!0),!0}get value(){const t=this.dep.track();return kd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function _p(e,t,n=!1){let r,s;return Ke(e)?r=e:(r=e.get,s=e.set),new bp(r,s,n)}const Wo={},ii=new WeakMap;let es;function kp(e,t=!1,n=es){if(n){let r=ii.get(n);r||ii.set(n,r=[]),r.push(e)}}function Tp(e,t,n=St){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,u=F=>s?F:jn(F)||s===!1||s===0?gr(F,1):gr(F);let c,f,m,S,L=!1,O=!1;if(cn(e)?(f=()=>e.value,L=jn(e)):as(e)?(f=()=>u(e),L=!0):Ge(e)?(O=!0,L=e.some(F=>as(F)||jn(F)),f=()=>e.map(F=>{if(cn(F))return F.value;if(as(F))return u(F);if(Ke(F))return l?l(F,2):F()})):Ke(e)?t?f=l?()=>l(e,2):e:f=()=>{if(m){br();try{m()}finally{_r()}}const F=es;es=c;try{return l?l(e,3,[S]):e(S)}finally{es=F}}:f=sr,t&&s){const F=f,ne=s===!0?1/0:s;f=()=>gr(F(),ne)}const V=Xh(),R=()=>{c.stop(),V&&V.active&&pl(V.effects,c)};if(o&&t){const F=t;t=(...ne)=>{F(...ne),R()}}let P=O?new Array(e.length).fill(Wo):Wo;const B=F=>{if(!(!(c.flags&1)||!c.dirty&&!F))if(t){const ne=c.run();if(s||L||(O?ne.some((oe,we)=>er(oe,P[we])):er(ne,P))){m&&m();const oe=es;es=c;try{const we=[ne,P===Wo?void 0:O&&P[0]===Wo?[]:P,S];P=ne,l?l(t,3,we):t(...we)}finally{es=oe}}}else c.run()};return a&&a(B),c=new vd(f),c.scheduler=i?()=>i(B,!1):B,S=F=>kp(F,!1,c),m=c.onStop=()=>{const F=ii.get(c);if(F){if(l)l(F,4);else for(const ne of F)ne();ii.delete(c)}},t?r?B(!0):P=c.run():i?i(B.bind(null,!0),!0):c.run(),R.pause=c.pause.bind(c),R.resume=c.resume.bind(c),R.stop=R,R}function gr(e,t=1/0,n){if(t<=0||!yt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,cn(e))gr(e.value,t,n);else if(Ge(e))for(let r=0;r<e.length;r++)gr(e[r],t,n);else if(cd(e)||_s(e))e.forEach(r=>{gr(r,t,n)});else if(fd(e)){for(const r in e)gr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&gr(e[r],t,n)}return e}/**
10
- * @vue/runtime-core v3.5.31
11
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
- * @license MIT
13
- **/function To(e,t,n,r){try{return r?e(...r):e()}catch(s){Ri(s,t,n)}}function Gn(e,t,n,r){if(Ke(e)){const s=To(e,t,n,r);return s&&ud(s)&&s.catch(o=>{Ri(o,t,n)}),s}if(Ge(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Gn(e[o],t,n,r));return s}}function Ri(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||St;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](e,l,u)===!1)return}a=a.parent}if(o){br(),To(o,null,10,[e,l,u]),_r();return}}Sp(e,n,s,r,i)}function Sp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const gn=[];let Yn=-1;const ks=[];let $r=null,gs=0;const Od=Promise.resolve();let ai=null;function Xt(e){const t=ai||Od;return e?t.then(this?e.bind(this):e):t}function Ip(e){let t=Yn+1,n=gn.length;for(;t<n;){const r=t+n>>>1,s=gn[r],o=co(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Il(e){if(!(e.flags&1)){const t=co(e),n=gn[gn.length-1];!n||!(e.flags&2)&&t>=co(n)?gn.push(e):gn.splice(Ip(t),0,e),e.flags|=1,Nd()}}function Nd(){ai||(ai=Od.then(Ld))}function Ep(e){Ge(e)?ks.push(...e):$r&&e.id===-1?$r.splice(gs+1,0,e):e.flags&1||(ks.push(e),e.flags|=1),Nd()}function Zl(e,t,n=Yn+1){for(;n<gn.length;n++){const r=gn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;gn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Dd(e){if(ks.length){const t=[...new Set(ks)].sort((n,r)=>co(n)-co(r));if(ks.length=0,$r){$r.push(...t);return}for($r=t,gs=0;gs<$r.length;gs++){const n=$r[gs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}$r=null,gs=0}}const co=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ld(e){try{for(Yn=0;Yn<gn.length;Yn++){const t=gn[Yn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),To(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Yn<gn.length;Yn++){const t=gn[Yn];t&&(t.flags&=-2)}Yn=-1,gn.length=0,Dd(),ai=null,(gn.length||ks.length)&&Ld()}}let Qt=null,jd=null;function li(e){const t=Qt;return Qt=e,jd=e&&e.type.__scopeId||null,t}function bt(e,t=Qt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&hi(-1);const o=li(t);let i;try{i=e(...s)}finally{li(o),r._d&&hi(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Tr(e,t){if(Qt===null)return e;const n=Ni(Qt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=St]=t[s];o&&(Ke(o)&&(o={mounted:o,updated:o}),o.deep&&gr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Jr(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(br(),Gn(l,n,8,[e.el,a,e,t]),_r())}}function Xo(e,t){if(ln){let n=ln.provides;const r=ln.parent&&ln.parent.provides;r===n&&(n=ln.provides=Object.create(r)),n[e]=t}}function Hn(e,t,n=!1){const r=Rl();if(r||Ss){let s=Ss?Ss._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&Ke(t)?t.call(r&&r.proxy):t}}const Cp=Symbol.for("v-scx"),Ap=()=>Hn(Cp);function at(e,t,n){return Ud(e,t,n)}function Ud(e,t,n=St){const{immediate:r,deep:s,flush:o,once:i}=n,a=Ht({},n),l=t&&r||!t&&o!=="post";let u;if(mo){if(o==="sync"){const S=Ap();u=S.__watcherHandles||(S.__watcherHandles=[])}else if(!l){const S=()=>{};return S.stop=sr,S.resume=sr,S.pause=sr,S}}const c=ln;a.call=(S,L,O)=>Gn(S,c,L,O);let f=!1;o==="post"?a.scheduler=S=>{sn(S,c&&c.suspense)}:o!=="sync"&&(f=!0,a.scheduler=(S,L)=>{L?S():Il(S)}),a.augmentJob=S=>{t&&(S.flags|=4),f&&(S.flags|=2,c&&(S.id=c.uid,S.i=c))};const m=Tp(e,t,a);return mo&&(u?u.push(m):l&&m()),m}function xp(e,t,n){const r=this.proxy,s=Ot(e)?e.includes(".")?Fd(r,e):()=>r[e]:e.bind(r,r);let o;Ke(t)?o=t:(o=t.handler,n=t);const i=Io(this),a=Ud(s,o.bind(r),n);return i(),a}function Fd(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const Bd=Symbol("_vte"),Hd=e=>e.__isTeleport,eo=e=>e&&(e.disabled||e.disabled===""),Rp=e=>e&&(e.defer||e.defer===""),ec=e=>typeof SVGElement<"u"&&e instanceof SVGElement,tc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ua=(e,t)=>{const n=e&&e.to;return Ot(n)?t?t(n):null:n},Wd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,u){const{mc:c,pc:f,pbc:m,o:{insert:S,querySelector:L,createText:O,createComment:V}}=u,R=eo(t.props);let{shapeFlag:P,children:B,dynamicChildren:F}=t;if(e==null){const ne=t.el=O(""),oe=t.anchor=O("");S(ne,n,r),S(oe,n,r);const we=(ue,ce)=>{P&16&&c(B,ue,ce,s,o,i,a,l)},Se=()=>{const ue=t.target=Ua(t.props,L),ce=Fa(ue,t,O,S);ue&&(i!=="svg"&&ec(ue)?i="svg":i!=="mathml"&&tc(ue)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ue),R||(we(ue,ce),Qo(t,!1)))};R&&(we(n,oe),Qo(t,!0)),Rp(t.props)||o&&o.pendingBranch?(t.el.__isMounted=!1,sn(()=>{t.el.__isMounted===!1&&(Se(),delete t.el.__isMounted)},o)):Se()}else{t.el=e.el,t.targetStart=e.targetStart;const ne=t.anchor=e.anchor,oe=t.target=e.target,we=t.targetAnchor=e.targetAnchor;if(e.el.__isMounted===!1){sn(()=>{Wd.process(e,t,n,r,s,o,i,a,l,u)},o);return}const Se=eo(e.props),ue=Se?n:oe,ce=Se?ne:we;if(i==="svg"||ec(oe)?i="svg":(i==="mathml"||tc(oe))&&(i="mathml"),F?(m(e.dynamicChildren,F,ue,s,o,i,a),Al(e,t,!0)):l||f(e,t,ue,ce,s,o,i,a,!1),R)Se?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Vo(t,n,ne,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const be=t.target=Ua(t.props,L);be&&Vo(t,be,null,u,0)}else Se&&Vo(t,oe,we,u,1);Qo(t,R)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:u,targetAnchor:c,target:f,props:m}=e;if(f&&(s(u),s(c)),o&&s(l),i&16){const S=o||!eo(m);for(let L=0;L<a.length;L++){const O=a[L];r(O,t,n,S,!!O.dynamicChildren)}}},move:Vo,hydrate:Pp};function Vo(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:u,props:c}=e,f=o===2;if(f&&r(i,t,n),(!f||eo(c))&&l&16)for(let m=0;m<u.length;m++)s(u[m],t,n,2);f&&r(a,t,n)}function Pp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:u,createText:c}},f){function m(V,R){let P=R;for(;P;){if(P&&P.nodeType===8){if(P.data==="teleport start anchor")t.targetStart=P;else if(P.data==="teleport anchor"){t.targetAnchor=P,V._lpa=t.targetAnchor&&i(t.targetAnchor);break}}P=i(P)}}function S(V,R){R.anchor=f(i(V),R,a(V),n,r,s,o)}const L=t.target=Ua(t.props,l),O=eo(t.props);if(L){const V=L._lpa||L.firstChild;t.shapeFlag&16&&(O?(S(e,t),m(L,V),t.targetAnchor||Fa(L,t,c,u,a(e)===L?e:null)):(t.anchor=i(e),m(L,V),t.targetAnchor||Fa(L,t,c,u),f(V&&i(V),t,L,n,r,s,o))),Qo(t,O)}else O&&t.shapeFlag&16&&(S(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const ci=Wd;function Qo(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Fa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Bd]=i,e&&(r(o,e,s),r(i,e,s)),i}const Xn=Symbol("_leaveCb"),zs=Symbol("_enterCb");function Mp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ar(()=>{e.isMounted=!0}),Ar(()=>{e.isUnmounting=!0}),e}const Dn=[Function,Array],Vd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Dn,onEnter:Dn,onAfterEnter:Dn,onEnterCancelled:Dn,onBeforeLeave:Dn,onLeave:Dn,onAfterLeave:Dn,onLeaveCancelled:Dn,onBeforeAppear:Dn,onAppear:Dn,onAfterAppear:Dn,onAppearCancelled:Dn},zd=e=>{const t=e.subTree;return t.component?zd(t.component):t},$p={name:"BaseTransition",props:Vd,setup(e,{slots:t}){const n=Rl(),r=Mp();return()=>{const s=t.default&&Kd(t.default(),!0);if(!s||!s.length)return;const o=Gd(s),i=ht(e),{mode:a}=i;if(r.isLeaving)return sa(o);const l=nc(o);if(!l)return sa(o);let u=Ba(l,i,r,n,f=>u=f);l.type!==an&&uo(l,u);let c=n.subTree&&nc(n.subTree);if(c&&c.type!==an&&!ns(c,l)&&zd(n).type!==an){let f=Ba(c,i,r,n);if(uo(c,f),a==="out-in"&&l.type!==an)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,c=void 0},sa(o);a==="in-out"&&l.type!==an?f.delayLeave=(m,S,L)=>{const O=qd(r,c);O[String(c.key)]=c,m[Xn]=()=>{S(),m[Xn]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{L(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Gd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==an){t=n;break}}return t}const Op=$p;function qd(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Ba(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:f,onBeforeLeave:m,onLeave:S,onAfterLeave:L,onLeaveCancelled:O,onBeforeAppear:V,onAppear:R,onAfterAppear:P,onAppearCancelled:B}=t,F=String(e.key),ne=qd(n,e),oe=(ue,ce)=>{ue&&Gn(ue,r,9,ce)},we=(ue,ce)=>{const be=ce[1];oe(ue,ce),Ge(ue)?ue.every(K=>K.length<=1)&&be():ue.length<=1&&be()},Se={mode:i,persisted:a,beforeEnter(ue){let ce=l;if(!n.isMounted)if(o)ce=V||l;else return;ue[Xn]&&ue[Xn](!0);const be=ne[F];be&&ns(e,be)&&be.el[Xn]&&be.el[Xn](),oe(ce,[ue])},enter(ue){if(ne[F]===e)return;let ce=u,be=c,K=f;if(!n.isMounted)if(o)ce=R||u,be=P||c,K=B||f;else return;let ke=!1;ue[zs]=Ue=>{ke||(ke=!0,Ue?oe(K,[ue]):oe(be,[ue]),Se.delayedLeave&&Se.delayedLeave(),ue[zs]=void 0)};const Ne=ue[zs].bind(null,!1);ce?we(ce,[ue,Ne]):Ne()},leave(ue,ce){const be=String(e.key);if(ue[zs]&&ue[zs](!0),n.isUnmounting)return ce();oe(m,[ue]);let K=!1;ue[Xn]=Ne=>{K||(K=!0,ce(),Ne?oe(O,[ue]):oe(L,[ue]),ue[Xn]=void 0,ne[be]===e&&delete ne[be])};const ke=ue[Xn].bind(null,!1);ne[be]=e,S?we(S,[ue,ke]):ke()},clone(ue){const ce=Ba(ue,t,n,r,s);return s&&s(ce),ce}};return Se}function sa(e){if(Pi(e))return e=Br(e),e.children=null,e}function nc(e){if(!Pi(e))return Hd(e.type)&&e.children?Gd(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Ke(n.default))return n.default()}}function uo(e,t){e.shapeFlag&6&&e.component?(e.transition=t,uo(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Kd(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===Ve?(i.patchFlag&128&&s++,r=r.concat(Kd(i.children,t,a))):(t||i.type!==an)&&r.push(a!=null?Br(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Wt(e,t){return Ke(e)?Ht({name:e.name},t,{setup:e}):e}function Jd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function rc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ui=new WeakMap;function to(e,t,n,r,s=!1){if(Ge(e)){e.forEach((O,V)=>to(O,t&&(Ge(t)?t[V]:t),n,r,s));return}if(Ts(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&to(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Ni(r.component):r.el,i=s?null:o,{i:a,r:l}=e,u=t&&t.r,c=a.refs===St?a.refs={}:a.refs,f=a.setupState,m=ht(f),S=f===St?ld:O=>rc(c,O)?!1:vt(m,O),L=(O,V)=>!(V&&rc(c,V));if(u!=null&&u!==l){if(sc(t),Ot(u))c[u]=null,S(u)&&(f[u]=null);else if(cn(u)){const O=t;L(u,O.k)&&(u.value=null),O.k&&(c[O.k]=null)}}if(Ke(l))To(l,a,12,[i,c]);else{const O=Ot(l),V=cn(l);if(O||V){const R=()=>{if(e.f){const P=O?S(l)?f[l]:c[l]:L()||!e.k?l.value:c[e.k];if(s)Ge(P)&&pl(P,o);else if(Ge(P))P.includes(o)||P.push(o);else if(O)c[l]=[o],S(l)&&(f[l]=c[l]);else{const B=[o];L(l,e.k)&&(l.value=B),e.k&&(c[e.k]=B)}}else O?(c[l]=i,S(l)&&(f[l]=i)):V&&(L(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const P=()=>{R(),ui.delete(e)};P.id=-1,ui.set(e,P),sn(P,n)}else sc(e),R()}}}function sc(e){const t=ui.get(e);t&&(t.flags|=8,ui.delete(e))}Ci().requestIdleCallback;Ci().cancelIdleCallback;const Ts=e=>!!e.type.__asyncLoader,Pi=e=>e.type.__isKeepAlive;function Np(e,t){Yd(e,"a",t)}function Dp(e,t){Yd(e,"da",t)}function Yd(e,t,n=ln){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Mi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Pi(s.parent.vnode)&&Lp(r,t,n,s),s=s.parent}}function Lp(e,t,n,r){const s=Mi(t,e,r,!0);So(()=>{pl(r[t],s)},n)}function Mi(e,t,n=ln,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{br();const a=Io(n),l=Gn(t,n,e,i);return a(),_r(),l});return r?s.unshift(o):s.push(o),o}}const Cr=e=>(t,n=ln)=>{(!mo||e==="sp")&&Mi(e,(...r)=>t(...r),n)},jp=Cr("bm"),ar=Cr("m"),Up=Cr("bu"),Fp=Cr("u"),Ar=Cr("bum"),So=Cr("um"),Bp=Cr("sp"),Hp=Cr("rtg"),Wp=Cr("rtc");function Vp(e,t=ln){Mi("ec",e,t)}const zp="components",Xd=Symbol.for("v-ndc");function di(e){return Ot(e)?Gp(zp,e,!1)||e:e||Xd}function Gp(e,t,n=!0,r=!1){const s=Qt||ln;if(s){const o=s.type;{const a=Rm(o,!1);if(a&&(a===t||a===yn(t)||a===Ei(yn(t))))return o}const i=oc(s[e]||o[e],t)||oc(s.appContext[e],t);return!i&&r?o:i}}function oc(e,t){return e&&(e[t]||e[yn(t)]||e[Ei(yn(t))])}function _t(e,t,n,r){let s;const o=n,i=Ge(e);if(i||Ot(e)){const a=i&&as(e);let l=!1,u=!1;a&&(l=!jn(e),u=kr(e),e=Ai(e)),s=new Array(e.length);for(let c=0,f=e.length;c<f;c++)s[c]=t(l?u?xs(zn(e[c])):zn(e[c]):e[c],c,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(yt(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function rr(e,t,n={},r,s){if(Qt.ce||Qt.parent&&Ts(Qt.parent)&&Qt.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),v(),dt(Ve,null,[Pe("slot",n,r)],u?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),v();const i=o&&Qd(o(n)),a=n.key||i&&i.key,l=dt(Ve,{key:(a&&!Vn(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Qd(e){return e.some(t=>ho(t)?!(t.type===an||t.type===Ve&&!Qd(t.children)):!0)?e:null}const Ha=e=>e?wf(e)?Ni(e):Ha(e.parent):null,no=Ht(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ha(e.parent),$root:e=>Ha(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ef(e),$forceUpdate:e=>e.f||(e.f=()=>{Il(e.update)}),$nextTick:e=>e.n||(e.n=Xt.bind(e.proxy)),$watch:e=>xp.bind(e)}),oa=(e,t)=>e!==St&&!e.__isScriptSetup&&vt(e,t),qp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const m=i[t];if(m!==void 0)switch(m){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(oa(r,t))return i[t]=1,r[t];if(s!==St&&vt(s,t))return i[t]=2,s[t];if(vt(o,t))return i[t]=3,o[t];if(n!==St&&vt(n,t))return i[t]=4,n[t];Wa&&(i[t]=0)}}const u=no[t];let c,f;if(u)return t==="$attrs"&&on(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==St&&vt(n,t))return i[t]=4,n[t];if(f=l.config.globalProperties,vt(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return oa(s,t)?(s[t]=n,!0):r!==St&&vt(r,t)?(r[t]=n,!0):vt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:o,type:i}},a){let l;return!!(n[a]||e!==St&&a[0]!=="$"&&vt(e,a)||oa(t,a)||vt(o,a)||vt(r,a)||vt(no,a)||vt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:vt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Kp(){return Jp().slots}function Jp(e){const t=Rl();return t.setupContext||(t.setupContext=_f(t))}function ic(e){return Ge(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Wa=!0;function Yp(e){const t=ef(e),n=e.proxy,r=e.ctx;Wa=!1,t.beforeCreate&&ac(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:m,beforeUpdate:S,updated:L,activated:O,deactivated:V,beforeDestroy:R,beforeUnmount:P,destroyed:B,unmounted:F,render:ne,renderTracked:oe,renderTriggered:we,errorCaptured:Se,serverPrefetch:ue,expose:ce,inheritAttrs:be,components:K,directives:ke,filters:Ne}=t;if(u&&Xp(u,r,null),i)for(const $e in i){const De=i[$e];Ke(De)&&(r[$e]=De.bind(n))}if(s){const $e=s.call(n,n);yt($e)&&(e.data=xi($e))}if(Wa=!0,o)for(const $e in o){const De=o[$e],ze=Ke(De)?De.bind(n,n):Ke(De.get)?De.get.bind(n,n):sr,tt=!Ke(De)&&Ke(De.set)?De.set.bind(n):sr,Oe=ie({get:ze,set:tt});Object.defineProperty(r,$e,{enumerable:!0,configurable:!0,get:()=>Oe.value,set:Qe=>Oe.value=Qe})}if(a)for(const $e in a)Zd(a[$e],r,n,$e);if(l){const $e=Ke(l)?l.call(n):l;Reflect.ownKeys($e).forEach(De=>{Xo(De,$e[De])})}c&&ac(c,e,"c");function Ce($e,De){Ge(De)?De.forEach(ze=>$e(ze.bind(n))):De&&$e(De.bind(n))}if(Ce(jp,f),Ce(ar,m),Ce(Up,S),Ce(Fp,L),Ce(Np,O),Ce(Dp,V),Ce(Vp,Se),Ce(Wp,oe),Ce(Hp,we),Ce(Ar,P),Ce(So,F),Ce(Bp,ue),Ge(ce))if(ce.length){const $e=e.exposed||(e.exposed={});ce.forEach(De=>{Object.defineProperty($e,De,{get:()=>n[De],set:ze=>n[De]=ze,enumerable:!0})})}else e.exposed||(e.exposed={});ne&&e.render===sr&&(e.render=ne),be!=null&&(e.inheritAttrs=be),K&&(e.components=K),ke&&(e.directives=ke),ue&&Jd(e)}function Xp(e,t,n=sr){Ge(e)&&(e=Va(e));for(const r in e){const s=e[r];let o;yt(s)?"default"in s?o=Hn(s.from||r,s.default,!0):o=Hn(s.from||r):o=Hn(s),cn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function ac(e,t,n){Gn(Ge(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Zd(e,t,n,r){let s=r.includes(".")?Fd(n,r):()=>n[r];if(Ot(e)){const o=t[e];Ke(o)&&at(s,o)}else if(Ke(e))at(s,e.bind(n));else if(yt(e))if(Ge(e))e.forEach(o=>Zd(o,t,n,r));else{const o=Ke(e.handler)?e.handler.bind(n):t[e.handler];Ke(o)&&at(s,o,e)}}function ef(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(u=>fi(l,u,i,!0)),fi(l,t,i)),yt(t)&&o.set(t,l),l}function fi(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&fi(e,o,n,!0),s&&s.forEach(i=>fi(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Qp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Qp={data:lc,props:cc,emits:cc,methods:Ys,computed:Ys,beforeCreate:pn,created:pn,beforeMount:pn,mounted:pn,beforeUpdate:pn,updated:pn,beforeDestroy:pn,beforeUnmount:pn,destroyed:pn,unmounted:pn,activated:pn,deactivated:pn,errorCaptured:pn,serverPrefetch:pn,components:Ys,directives:Ys,watch:em,provide:lc,inject:Zp};function lc(e,t){return t?e?function(){return Ht(Ke(e)?e.call(this,this):e,Ke(t)?t.call(this,this):t)}:t:e}function Zp(e,t){return Ys(Va(e),Va(t))}function Va(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function pn(e,t){return e?[...new Set([].concat(e,t))]:t}function Ys(e,t){return e?Ht(Object.create(null),e,t):t}function cc(e,t){return e?Ge(e)&&Ge(t)?[...new Set([...e,...t])]:Ht(Object.create(null),ic(e),ic(t??{})):t}function em(e,t){if(!e)return t;if(!t)return e;const n=Ht(Object.create(null),e);for(const r in t)n[r]=pn(e[r],t[r]);return n}function tf(){return{app:null,config:{isNativeTag:ld,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 tm=0;function nm(e,t){return function(r,s=null){Ke(r)||(r=Ht({},r)),s!=null&&!yt(s)&&(s=null);const o=tf(),i=new WeakSet,a=[];let l=!1;const u=o.app={_uid:tm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Mm,get config(){return o.config},set config(c){},use(c,...f){return i.has(c)||(c&&Ke(c.install)?(i.add(c),c.install(u,...f)):Ke(c)&&(i.add(c),c(u,...f))),u},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),u},component(c,f){return f?(o.components[c]=f,u):o.components[c]},directive(c,f){return f?(o.directives[c]=f,u):o.directives[c]},mount(c,f,m){if(!l){const S=u._ceVNode||Pe(r,s);return S.appContext=o,m===!0?m="svg":m===!1&&(m=void 0),e(S,c,m),l=!0,u._container=c,c.__vue_app__=u,Ni(S.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Gn(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,f){return o.provides[c]=f,u},runWithContext(c){const f=Ss;Ss=u;try{return c()}finally{Ss=f}}};return u}}let Ss=null;const rm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${yn(t)}Modifiers`]||e[`${Hr(t)}Modifiers`];function sm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||St;let s=n;const o=t.startsWith("update:"),i=o&&rm(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Ot(c)?c.trim():c)),i.number&&(s=n.map(gl)));let a,l=r[a=Zi(t)]||r[a=Zi(yn(t))];!l&&o&&(l=r[a=Zi(Hr(t))]),l&&Gn(l,e,6,s);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Gn(u,e,6,s)}}const om=new WeakMap;function nf(e,t,n=!1){const r=n?om:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Ke(e)){const l=u=>{const c=nf(u,t,!0);c&&(a=!0,Ht(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(yt(e)&&r.set(e,null),null):(Ge(o)?o.forEach(l=>i[l]=null):Ht(i,o),yt(e)&&r.set(e,i),i)}function $i(e,t){return!e||!Ti(t)?!1:(t=t.slice(2).replace(/Once$/,""),vt(e,t[0].toLowerCase()+t.slice(1))||vt(e,Hr(t))||vt(e,t))}function uc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:u,renderCache:c,props:f,data:m,setupState:S,ctx:L,inheritAttrs:O}=e,V=li(e);let R,P;try{if(n.shapeFlag&4){const F=s||r,ne=F;R=Zn(u.call(ne,F,c,f,S,m,L)),P=a}else{const F=t;R=Zn(F.length>1?F(f,{attrs:a,slots:i,emit:l}):F(f,null)),P=t.props?a:im(a)}}catch(F){ro.length=0,Ri(F,e,1),R=Pe(an)}let B=R;if(P&&O!==!1){const F=Object.keys(P),{shapeFlag:ne}=B;F.length&&ne&7&&(o&&F.some(Si)&&(P=am(P,o)),B=Br(B,P,!1,!0))}return n.dirs&&(B=Br(B,null,!1,!0),B.dirs=B.dirs?B.dirs.concat(n.dirs):n.dirs),n.transition&&uo(B,n.transition),R=B,li(V),R}const im=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ti(n))&&((t||(t={}))[n]=e[n]);return t},am=(e,t)=>{const n={};for(const r in e)(!Si(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function lm(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?dc(r,i,u):!!i;if(l&8){const c=t.dynamicProps;for(let f=0;f<c.length;f++){const m=c[f];if(rf(i,r,m)&&!$i(u,m))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?dc(r,i,u):!0:!!i;return!1}function dc(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const o=r[s];if(rf(t,e,o)&&!$i(n,o))return!0}return!1}function rf(e,t,n){const r=e[n],s=t[n];return n==="style"&&yt(r)&&yt(s)?!vl(r,s):r!==s}function cm({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const sf={},of=()=>Object.create(sf),af=e=>Object.getPrototypeOf(e)===sf;function um(e,t,n,r=!1){const s={},o=of();e.propsDefaults=Object.create(null),lf(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Pd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function dm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=ht(s),[l]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let f=0;f<c.length;f++){let m=c[f];if($i(e.emitsOptions,m))continue;const S=t[m];if(l)if(vt(o,m))S!==o[m]&&(o[m]=S,u=!0);else{const L=yn(m);s[L]=za(l,a,L,S,e,!1)}else S!==o[m]&&(o[m]=S,u=!0)}}}else{lf(e,t,s,o)&&(u=!0);let c;for(const f in a)(!t||!vt(t,f)&&((c=Hr(f))===f||!vt(t,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(s[f]=za(l,a,f,void 0,e,!0)):delete s[f]);if(o!==a)for(const f in o)(!t||!vt(t,f))&&(delete o[f],u=!0)}u&&mr(e.attrs,"set","")}function lf(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Xs(l))continue;const u=t[l];let c;s&&vt(s,c=yn(l))?!o||!o.includes(c)?n[c]=u:(a||(a={}))[c]=u:$i(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,i=!0)}if(o){const l=ht(n),u=a||St;for(let c=0;c<o.length;c++){const f=o[c];n[f]=za(s,l,f,u[f],e,!vt(u,f))}}return i}function za(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=vt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Ke(l)){const{propsDefaults:u}=s;if(n in u)r=u[n];else{const c=Io(s);r=u[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Hr(n))&&(r=!0))}return r}const fm=new WeakMap;function cf(e,t,n=!1){const r=n?fm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Ke(e)){const c=f=>{l=!0;const[m,S]=cf(f,t,!0);Ht(i,m),S&&a.push(...S)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return yt(e)&&r.set(e,bs),bs;if(Ge(o))for(let c=0;c<o.length;c++){const f=yn(o[c]);fc(f)&&(i[f]=St)}else if(o)for(const c in o){const f=yn(c);if(fc(f)){const m=o[c],S=i[f]=Ge(m)||Ke(m)?{type:m}:Ht({},m),L=S.type;let O=!1,V=!0;if(Ge(L))for(let R=0;R<L.length;++R){const P=L[R],B=Ke(P)&&P.name;if(B==="Boolean"){O=!0;break}else B==="String"&&(V=!1)}else O=Ke(L)&&L.name==="Boolean";S[0]=O,S[1]=V,(O||vt(S,"default"))&&a.push(f)}}const u=[i,a];return yt(e)&&r.set(e,u),u}function fc(e){return e[0]!=="$"&&!Xs(e)}const El=e=>e==="_"||e==="_ctx"||e==="$stable",Cl=e=>Ge(e)?e.map(Zn):[Zn(e)],hm=(e,t,n)=>{if(t._n)return t;const r=bt((...s)=>Cl(t(...s)),n);return r._c=!1,r},uf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(El(s))continue;const o=e[s];if(Ke(o))t[s]=hm(s,o,r);else if(o!=null){const i=Cl(o);t[s]=()=>i}}},df=(e,t)=>{const n=Cl(t);e.slots.default=()=>n},ff=(e,t,n)=>{for(const r in t)(n||!El(r))&&(e[r]=t[r])},pm=(e,t,n)=>{const r=e.slots=of();if(e.vnode.shapeFlag&32){const s=t._;s?(ff(r,t,n),n&&hd(r,"_",s,!0)):uf(t,r)}else t&&df(e,t)},mm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=St;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:ff(s,t,n):(o=!t.$stable,uf(t,s)),i=t}else t&&(df(e,t),i={default:1});if(o)for(const a in s)!El(a)&&i[a]==null&&delete s[a]},sn=bm;function gm(e){return vm(e)}function vm(e,t){const n=Ci();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:m,setScopeId:S=sr,insertStaticContent:L}=e,O=(b,T,M,Y=null,ee=null,H=null,G=void 0,W=null,q=!!T.dynamicChildren)=>{if(b===T)return;b&&!ns(b,T)&&(Y=X(b),Qe(b,ee,H,!0),b=null),T.patchFlag===-2&&(q=!1,T.dynamicChildren=null);const{type:z,ref:me,shapeFlag:ve}=T;switch(z){case Oi:V(b,T,M,Y);break;case an:R(b,T,M,Y);break;case aa:b==null&&P(T,M,Y,G);break;case Ve:K(b,T,M,Y,ee,H,G,W,q);break;default:ve&1?ne(b,T,M,Y,ee,H,G,W,q):ve&6?ke(b,T,M,Y,ee,H,G,W,q):(ve&64||ve&128)&&z.process(b,T,M,Y,ee,H,G,W,q,Ie)}me!=null&&ee?to(me,b&&b.ref,H,T||b,!T):me==null&&b&&b.ref!=null&&to(b.ref,null,H,b,!0)},V=(b,T,M,Y)=>{if(b==null)r(T.el=a(T.children),M,Y);else{const ee=T.el=b.el;T.children!==b.children&&u(ee,T.children)}},R=(b,T,M,Y)=>{b==null?r(T.el=l(T.children||""),M,Y):T.el=b.el},P=(b,T,M,Y)=>{[b.el,b.anchor]=L(b.children,T,M,Y,b.el,b.anchor)},B=({el:b,anchor:T},M,Y)=>{let ee;for(;b&&b!==T;)ee=m(b),r(b,M,Y),b=ee;r(T,M,Y)},F=({el:b,anchor:T})=>{let M;for(;b&&b!==T;)M=m(b),s(b),b=M;s(T)},ne=(b,T,M,Y,ee,H,G,W,q)=>{if(T.type==="svg"?G="svg":T.type==="math"&&(G="mathml"),b==null)oe(T,M,Y,ee,H,G,W,q);else{const z=b.el&&b.el._isVueCE?b.el:null;try{z&&z._beginPatch(),ue(b,T,ee,H,G,W,q)}finally{z&&z._endPatch()}}},oe=(b,T,M,Y,ee,H,G,W)=>{let q,z;const{props:me,shapeFlag:ve,transition:ye,dirs:Re}=b;if(q=b.el=i(b.type,H,me&&me.is,me),ve&8?c(q,b.children):ve&16&&Se(b.children,q,null,Y,ee,ia(b,H),G,W),Re&&Jr(b,null,Y,"created"),we(q,b,b.scopeId,G,Y),me){for(const Fe in me)Fe!=="value"&&!Xs(Fe)&&o(q,Fe,null,me[Fe],H,Y);"value"in me&&o(q,"value",null,me.value,H),(z=me.onVnodeBeforeMount)&&Jn(z,Y,b)}Re&&Jr(b,null,Y,"beforeMount");const We=ym(ee,ye);We&&ye.beforeEnter(q),r(q,T,M),((z=me&&me.onVnodeMounted)||We||Re)&&sn(()=>{try{z&&Jn(z,Y,b),We&&ye.enter(q),Re&&Jr(b,null,Y,"mounted")}finally{}},ee)},we=(b,T,M,Y,ee)=>{if(M&&S(b,M),Y)for(let H=0;H<Y.length;H++)S(b,Y[H]);if(ee){let H=ee.subTree;if(T===H||mf(H.type)&&(H.ssContent===T||H.ssFallback===T)){const G=ee.vnode;we(b,G,G.scopeId,G.slotScopeIds,ee.parent)}}},Se=(b,T,M,Y,ee,H,G,W,q=0)=>{for(let z=q;z<b.length;z++){const me=b[z]=W?pr(b[z]):Zn(b[z]);O(null,me,T,M,Y,ee,H,G,W)}},ue=(b,T,M,Y,ee,H,G)=>{const W=T.el=b.el;let{patchFlag:q,dynamicChildren:z,dirs:me}=T;q|=b.patchFlag&16;const ve=b.props||St,ye=T.props||St;let Re;if(M&&Yr(M,!1),(Re=ye.onVnodeBeforeUpdate)&&Jn(Re,M,T,b),me&&Jr(T,b,M,"beforeUpdate"),M&&Yr(M,!0),(ve.innerHTML&&ye.innerHTML==null||ve.textContent&&ye.textContent==null)&&c(W,""),z?ce(b.dynamicChildren,z,W,M,Y,ia(T,ee),H):G||De(b,T,W,null,M,Y,ia(T,ee),H,!1),q>0){if(q&16)be(W,ve,ye,M,ee);else if(q&2&&ve.class!==ye.class&&o(W,"class",null,ye.class,ee),q&4&&o(W,"style",ve.style,ye.style,ee),q&8){const We=T.dynamicProps;for(let Fe=0;Fe<We.length;Fe++){const Me=We[Fe],Ye=ve[Me],et=ye[Me];(et!==Ye||Me==="value")&&o(W,Me,Ye,et,ee,M)}}q&1&&b.children!==T.children&&c(W,T.children)}else!G&&z==null&&be(W,ve,ye,M,ee);((Re=ye.onVnodeUpdated)||me)&&sn(()=>{Re&&Jn(Re,M,T,b),me&&Jr(T,b,M,"updated")},Y)},ce=(b,T,M,Y,ee,H,G)=>{for(let W=0;W<T.length;W++){const q=b[W],z=T[W],me=q.el&&(q.type===Ve||!ns(q,z)||q.shapeFlag&198)?f(q.el):M;O(q,z,me,null,Y,ee,H,G,!0)}},be=(b,T,M,Y,ee)=>{if(T!==M){if(T!==St)for(const H in T)!Xs(H)&&!(H in M)&&o(b,H,T[H],null,ee,Y);for(const H in M){if(Xs(H))continue;const G=M[H],W=T[H];G!==W&&H!=="value"&&o(b,H,W,G,ee,Y)}"value"in M&&o(b,"value",T.value,M.value,ee)}},K=(b,T,M,Y,ee,H,G,W,q)=>{const z=T.el=b?b.el:a(""),me=T.anchor=b?b.anchor:a("");let{patchFlag:ve,dynamicChildren:ye,slotScopeIds:Re}=T;Re&&(W=W?W.concat(Re):Re),b==null?(r(z,M,Y),r(me,M,Y),Se(T.children||[],M,me,ee,H,G,W,q)):ve>0&&ve&64&&ye&&b.dynamicChildren&&b.dynamicChildren.length===ye.length?(ce(b.dynamicChildren,ye,M,ee,H,G,W),(T.key!=null||ee&&T===ee.subTree)&&Al(b,T,!0)):De(b,T,M,me,ee,H,G,W,q)},ke=(b,T,M,Y,ee,H,G,W,q)=>{T.slotScopeIds=W,b==null?T.shapeFlag&512?ee.ctx.activate(T,M,Y,G,q):Ne(T,M,Y,ee,H,G,q):Ue(b,T,q)},Ne=(b,T,M,Y,ee,H,G)=>{const W=b.component=Em(b,Y,ee);if(Pi(b)&&(W.ctx.renderer=Ie),Cm(W,!1,G),W.asyncDep){if(ee&&ee.registerDep(W,Ce,G),!b.el){const q=W.subTree=Pe(an);R(null,q,T,M),b.placeholder=q.el}}else Ce(W,b,T,M,ee,H,G)},Ue=(b,T,M)=>{const Y=T.component=b.component;if(lm(b,T,M))if(Y.asyncDep&&!Y.asyncResolved){$e(Y,T,M);return}else Y.next=T,Y.update();else T.el=b.el,Y.vnode=T},Ce=(b,T,M,Y,ee,H,G)=>{const W=()=>{if(b.isMounted){let{next:ve,bu:ye,u:Re,parent:We,vnode:Fe}=b;{const ft=hf(b);if(ft){ve&&(ve.el=Fe.el,$e(b,ve,G)),ft.asyncDep.then(()=>{sn(()=>{b.isUnmounted||z()},ee)});return}}let Me=ve,Ye;Yr(b,!1),ve?(ve.el=Fe.el,$e(b,ve,G)):ve=Fe,ye&&Yo(ye),(Ye=ve.props&&ve.props.onVnodeBeforeUpdate)&&Jn(Ye,We,ve,Fe),Yr(b,!0);const et=uc(b),xt=b.subTree;b.subTree=et,O(xt,et,f(xt.el),X(xt),b,ee,H),ve.el=et.el,Me===null&&cm(b,et.el),Re&&sn(Re,ee),(Ye=ve.props&&ve.props.onVnodeUpdated)&&sn(()=>Jn(Ye,We,ve,Fe),ee)}else{let ve;const{el:ye,props:Re}=T,{bm:We,m:Fe,parent:Me,root:Ye,type:et}=b,xt=Ts(T);Yr(b,!1),We&&Yo(We),!xt&&(ve=Re&&Re.onVnodeBeforeMount)&&Jn(ve,Me,T),Yr(b,!0);{Ye.ce&&Ye.ce._hasShadowRoot()&&Ye.ce._injectChildStyle(et,b.parent?b.parent.type:void 0);const ft=b.subTree=uc(b);O(null,ft,M,Y,b,ee,H),T.el=ft.el}if(Fe&&sn(Fe,ee),!xt&&(ve=Re&&Re.onVnodeMounted)){const ft=T;sn(()=>Jn(ve,Me,ft),ee)}(T.shapeFlag&256||Me&&Ts(Me.vnode)&&Me.vnode.shapeFlag&256)&&b.a&&sn(b.a,ee),b.isMounted=!0,T=M=Y=null}};b.scope.on();const q=b.effect=new vd(W);b.scope.off();const z=b.update=q.run.bind(q),me=b.job=q.runIfDirty.bind(q);me.i=b,me.id=b.uid,q.scheduler=()=>Il(me),Yr(b,!0),z()},$e=(b,T,M)=>{T.component=b;const Y=b.vnode.props;b.vnode=T,b.next=null,dm(b,T.props,Y,M),mm(b,T.children,M),br(),Zl(b),_r()},De=(b,T,M,Y,ee,H,G,W,q=!1)=>{const z=b&&b.children,me=b?b.shapeFlag:0,ve=T.children,{patchFlag:ye,shapeFlag:Re}=T;if(ye>0){if(ye&128){tt(z,ve,M,Y,ee,H,G,W,q);return}else if(ye&256){ze(z,ve,M,Y,ee,H,G,W,q);return}}Re&8?(me&16&&Je(z,ee,H),ve!==z&&c(M,ve)):me&16?Re&16?tt(z,ve,M,Y,ee,H,G,W,q):Je(z,ee,H,!0):(me&8&&c(M,""),Re&16&&Se(ve,M,Y,ee,H,G,W,q))},ze=(b,T,M,Y,ee,H,G,W,q)=>{b=b||bs,T=T||bs;const z=b.length,me=T.length,ve=Math.min(z,me);let ye;for(ye=0;ye<ve;ye++){const Re=T[ye]=q?pr(T[ye]):Zn(T[ye]);O(b[ye],Re,M,null,ee,H,G,W,q)}z>me?Je(b,ee,H,!0,!1,ve):Se(T,M,Y,ee,H,G,W,q,ve)},tt=(b,T,M,Y,ee,H,G,W,q)=>{let z=0;const me=T.length;let ve=b.length-1,ye=me-1;for(;z<=ve&&z<=ye;){const Re=b[z],We=T[z]=q?pr(T[z]):Zn(T[z]);if(ns(Re,We))O(Re,We,M,null,ee,H,G,W,q);else break;z++}for(;z<=ve&&z<=ye;){const Re=b[ve],We=T[ye]=q?pr(T[ye]):Zn(T[ye]);if(ns(Re,We))O(Re,We,M,null,ee,H,G,W,q);else break;ve--,ye--}if(z>ve){if(z<=ye){const Re=ye+1,We=Re<me?T[Re].el:Y;for(;z<=ye;)O(null,T[z]=q?pr(T[z]):Zn(T[z]),M,We,ee,H,G,W,q),z++}}else if(z>ye)for(;z<=ve;)Qe(b[z],ee,H,!0),z++;else{const Re=z,We=z,Fe=new Map;for(z=We;z<=ye;z++){const pt=T[z]=q?pr(T[z]):Zn(T[z]);pt.key!=null&&Fe.set(pt.key,z)}let Me,Ye=0;const et=ye-We+1;let xt=!1,ft=0;const Ct=new Array(et);for(z=0;z<et;z++)Ct[z]=0;for(z=Re;z<=ve;z++){const pt=b[z];if(Ye>=et){Qe(pt,ee,H,!0);continue}let Pt;if(pt.key!=null)Pt=Fe.get(pt.key);else for(Me=We;Me<=ye;Me++)if(Ct[Me-We]===0&&ns(pt,T[Me])){Pt=Me;break}Pt===void 0?Qe(pt,ee,H,!0):(Ct[Pt-We]=z+1,Pt>=ft?ft=Pt:xt=!0,O(pt,T[Pt],M,null,ee,H,G,W,q),Ye++)}const Lt=xt?wm(Ct):bs;for(Me=Lt.length-1,z=et-1;z>=0;z--){const pt=We+z,Pt=T[pt],mt=T[pt+1],Vt=pt+1<me?mt.el||pf(mt):Y;Ct[z]===0?O(null,Pt,M,Vt,ee,H,G,W,q):xt&&(Me<0||z!==Lt[Me]?Oe(Pt,M,Vt,2):Me--)}}},Oe=(b,T,M,Y,ee=null)=>{const{el:H,type:G,transition:W,children:q,shapeFlag:z}=b;if(z&6){Oe(b.component.subTree,T,M,Y);return}if(z&128){b.suspense.move(T,M,Y);return}if(z&64){G.move(b,T,M,Ie);return}if(G===Ve){r(H,T,M);for(let ve=0;ve<q.length;ve++)Oe(q[ve],T,M,Y);r(b.anchor,T,M);return}if(G===aa){B(b,T,M);return}if(Y!==2&&z&1&&W)if(Y===0)W.beforeEnter(H),r(H,T,M),sn(()=>W.enter(H),ee);else{const{leave:ve,delayLeave:ye,afterLeave:Re}=W,We=()=>{b.ctx.isUnmounted?s(H):r(H,T,M)},Fe=()=>{H._isLeaving&&H[Xn](!0),ve(H,()=>{We(),Re&&Re()})};ye?ye(H,We,Fe):Fe()}else r(H,T,M)},Qe=(b,T,M,Y=!1,ee=!1)=>{const{type:H,props:G,ref:W,children:q,dynamicChildren:z,shapeFlag:me,patchFlag:ve,dirs:ye,cacheIndex:Re,memo:We}=b;if(ve===-2&&(ee=!1),W!=null&&(br(),to(W,null,M,b,!0),_r()),Re!=null&&(T.renderCache[Re]=void 0),me&256){T.ctx.deactivate(b);return}const Fe=me&1&&ye,Me=!Ts(b);let Ye;if(Me&&(Ye=G&&G.onVnodeBeforeUnmount)&&Jn(Ye,T,b),me&6)Ze(b.component,M,Y);else{if(me&128){b.suspense.unmount(M,Y);return}Fe&&Jr(b,null,T,"beforeUnmount"),me&64?b.type.remove(b,T,M,Ie,Y):z&&!z.hasOnce&&(H!==Ve||ve>0&&ve&64)?Je(z,T,M,!1,!0):(H===Ve&&ve&384||!ee&&me&16)&&Je(q,T,M),Y&&wt(b)}const et=We!=null&&Re==null;(Me&&(Ye=G&&G.onVnodeUnmounted)||Fe||et)&&sn(()=>{Ye&&Jn(Ye,T,b),Fe&&Jr(b,null,T,"unmounted"),et&&(b.el=null)},M)},wt=b=>{const{type:T,el:M,anchor:Y,transition:ee}=b;if(T===Ve){ct(M,Y);return}if(T===aa){F(b);return}const H=()=>{s(M),ee&&!ee.persisted&&ee.afterLeave&&ee.afterLeave()};if(b.shapeFlag&1&&ee&&!ee.persisted){const{leave:G,delayLeave:W}=ee,q=()=>G(M,H);W?W(b.el,H,q):q()}else H()},ct=(b,T)=>{let M;for(;b!==T;)M=m(b),s(b),b=M;s(T)},Ze=(b,T,M)=>{const{bum:Y,scope:ee,job:H,subTree:G,um:W,m:q,a:z}=b;hc(q),hc(z),Y&&Yo(Y),ee.stop(),H&&(H.flags|=8,Qe(G,b,T,M)),W&&sn(W,T),sn(()=>{b.isUnmounted=!0},T)},Je=(b,T,M,Y=!1,ee=!1,H=0)=>{for(let G=H;G<b.length;G++)Qe(b[G],T,M,Y,ee)},X=b=>{if(b.shapeFlag&6)return X(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const T=m(b.anchor||b.el),M=T&&T[Bd];return M?m(M):T};let de=!1;const fe=(b,T,M)=>{let Y;b==null?T._vnode&&(Qe(T._vnode,null,null,!0),Y=T._vnode.component):O(T._vnode||null,b,T,null,null,null,M),T._vnode=b,de||(de=!0,Zl(Y),Dd(),de=!1)},Ie={p:O,um:Qe,m:Oe,r:wt,mt:Ne,mc:Se,pc:De,pbc:ce,n:X,o:e};return{render:fe,hydrate:void 0,createApp:nm(fe)}}function ia({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Yr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ym(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Al(e,t,n=!1){const r=e.children,s=t.children;if(Ge(r)&&Ge(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=pr(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Al(i,a)),a.type===Oi&&(a.patchFlag===-1&&(a=s[o]=pr(a)),a.el=i.el),a.type===an&&!a.el&&(a.el=i.el)}}function wm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(s=n[n.length-1],e[s]<u){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<u?o=a+1:i=a;u<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function hf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:hf(t)}function hc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function pf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?pf(t.subTree):null}const mf=e=>e.__isSuspense;function bm(e,t){t&&t.pendingBranch?Ge(e)?t.effects.push(...e):t.effects.push(e):Ep(e)}const Ve=Symbol.for("v-fgt"),Oi=Symbol.for("v-txt"),an=Symbol.for("v-cmt"),aa=Symbol.for("v-stc"),ro=[];let xn=null;function v(e=!1){ro.push(xn=e?null:[])}function _m(){ro.pop(),xn=ro[ro.length-1]||null}let fo=1;function hi(e,t=!1){fo+=e,e<0&&xn&&t&&(xn.hasOnce=!0)}function gf(e){return e.dynamicChildren=fo>0?xn||bs:null,_m(),fo>0&&xn&&xn.push(e),e}function E(e,t,n,r,s,o){return gf(h(e,t,n,r,s,o,!0))}function dt(e,t,n,r,s){return gf(Pe(e,t,n,r,s,!0))}function ho(e){return e?e.__v_isVNode===!0:!1}function ns(e,t){return e.type===t.type&&e.key===t.key}const vf=({key:e})=>e??null,Zo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ot(e)||cn(e)||Ke(e)?{i:Qt,r:e,k:t,f:!!n}:e:null);function h(e,t=null,n=null,r=0,s=null,o=e===Ve?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&vf(t),ref:t&&Zo(t),scopeId:jd,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Qt};return a?(xl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Ot(n)?8:16),fo>0&&!i&&xn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&xn.push(l),l}const Pe=km;function km(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Xd)&&(e=an),ho(e)){const a=Br(e,t,!0);return n&&xl(a,n),fo>0&&!o&&xn&&(a.shapeFlag&6?xn[xn.indexOf(e)]=a:xn.push(a)),a.patchFlag=-2,a}if(Pm(e)&&(e=e.__vccOpts),t){t=Tm(t);let{class:a,style:l}=t;a&&!Ot(a)&&(t.class=st(a)),yt(l)&&(Sl(l)&&!Ge(l)&&(l=Ht({},l)),t.style=Fr(l))}const i=Ot(e)?1:mf(e)?128:Hd(e)?64:yt(e)?4:Ke(e)?2:0;return h(e,t,n,r,s,i,o,!0)}function Tm(e){return e?Sl(e)||af(e)?Ht({},e):e:null}function Br(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,u=t?yf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&vf(u),ref:t&&t.ref?n&&o?Ge(o)?o.concat(Zo(t)):[o,Zo(t)]:Zo(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ve?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Br(e.ssContent),ssFallback:e.ssFallback&&Br(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&uo(c,l.clone(c)),c}function po(e=" ",t=0){return Pe(Oi,null,e,t)}function le(e="",t=!1){return t?(v(),dt(an,null,e)):Pe(an,null,e)}function Zn(e){return e==null||typeof e=="boolean"?Pe(an):Ge(e)?Pe(Ve,null,e.slice()):ho(e)?pr(e):Pe(Oi,null,String(e))}function pr(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Br(e)}function xl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ge(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),xl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!af(t)?t._ctx=Qt:s===3&&Qt&&(Qt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ke(t)?(t={default:t,_ctx:Qt},n=32):(t=String(t),r&64?(n=16,t=[po(t)]):n=8);e.children=t,e.shapeFlag|=n}function yf(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=st([t.class,r.class]));else if(s==="style")t.style=Fr([t.style,r.style]);else if(Ti(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ge(o)&&o.includes(i))?t[s]=o?[].concat(o,i):i:i==null&&o==null&&!Si(s)&&(t[s]=i)}else s!==""&&(t[s]=r[s])}return t}function Jn(e,t,n,r=null){Gn(e,t,7,[n,r])}const Sm=tf();let Im=0;function Em(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Sm,o={uid:Im++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:cf(r,s),emitsOptions:nf(r,s),emit:null,emitted:null,propsDefaults:St,inheritAttrs:r.inheritAttrs,ctx:St,data:St,props:St,attrs:St,slots:St,refs:St,setupState:St,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=sm.bind(null,o),e.ce&&e.ce(o),o}let ln=null;const Rl=()=>ln||Qt;let pi,Ga;{const e=Ci(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};pi=t("__VUE_INSTANCE_SETTERS__",n=>ln=n),Ga=t("__VUE_SSR_SETTERS__",n=>mo=n)}const Io=e=>{const t=ln;return pi(e),e.scope.on(),()=>{e.scope.off(),pi(t)}},pc=()=>{ln&&ln.scope.off(),pi(null)};function wf(e){return e.vnode.shapeFlag&4}let mo=!1;function Cm(e,t=!1,n=!1){t&&Ga(t);const{props:r,children:s}=e.vnode,o=wf(e);um(e,r,o,t),pm(e,s,n||t);const i=o?Am(e,t):void 0;return t&&Ga(!1),i}function Am(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,qp);const{setup:r}=n;if(r){br();const s=e.setupContext=r.length>1?_f(e):null,o=Io(e),i=To(r,e,0,[e.props,s]),a=ud(i);if(_r(),o(),(a||e.sp)&&!Ts(e)&&Jd(e),a){if(i.then(pc,pc),t)return i.then(l=>{mc(e,l)}).catch(l=>{Ri(l,e,0)});e.asyncDep=i}else mc(e,i)}else bf(e)}function mc(e,t,n){Ke(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:yt(t)&&(e.setupState=$d(t)),bf(e)}function bf(e,t,n){const r=e.type;e.render||(e.render=r.render||sr);{const s=Io(e);br();try{Yp(e)}finally{_r(),s()}}}const xm={get(e,t){return on(e,"get",""),e[t]}};function _f(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,xm),slots:e.slots,emit:e.emit,expose:t}}function Ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy($d(gp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in no)return no[n](e)},has(t,n){return n in t||n in no}})):e.proxy}function Rm(e,t=!0){return Ke(e)?e.displayName||e.name:e.name||t&&e.__name}function Pm(e){return Ke(e)&&"__vccOpts"in e}const ie=(e,t)=>_p(e,t,mo);function Pl(e,t,n){try{hi(-1);const r=arguments.length;return r===2?yt(t)&&!Ge(t)?ho(t)?Pe(e,null,[t]):Pe(e,t):Pe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ho(n)&&(n=[n]),Pe(e,t,n))}finally{hi(1)}}const Mm="3.5.31";/**
14
- * @vue/runtime-dom v3.5.31
15
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
- * @license MIT
17
- **/let qa;const gc=typeof window<"u"&&window.trustedTypes;if(gc)try{qa=gc.createPolicy("vue",{createHTML:e=>e})}catch{}const kf=qa?e=>qa.createHTML(e):e=>e,$m="http://www.w3.org/2000/svg",Om="http://www.w3.org/1998/Math/MathML",fr=typeof document<"u"?document:null,vc=fr&&fr.createElement("template"),Nm={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?fr.createElementNS($m,e):t==="mathml"?fr.createElementNS(Om,e):n?fr.createElement(e,{is:n}):fr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>fr.createTextNode(e),createComment:e=>fr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>fr.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{vc.innerHTML=kf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=vc.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},xr="transition",Gs="animation",go=Symbol("_vtc"),Tf={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},Dm=Ht({},Vd,Tf),Lm=e=>(e.displayName="Transition",e.props=Dm,e),Sf=Lm((e,{slots:t})=>Pl(Op,jm(e),t)),Xr=(e,t=[])=>{Ge(e)?e.forEach(n=>n(...t)):e&&e(...t)},yc=e=>e?Ge(e)?e.some(t=>t.length>1):e.length>1:!1;function jm(e){const t={};for(const K in e)K in Tf||(t[K]=e[K]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:u=i,appearToClass:c=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:S=`${n}-leave-to`}=e,L=Um(s),O=L&&L[0],V=L&&L[1],{onBeforeEnter:R,onEnter:P,onEnterCancelled:B,onLeave:F,onLeaveCancelled:ne,onBeforeAppear:oe=R,onAppear:we=P,onAppearCancelled:Se=B}=t,ue=(K,ke,Ne,Ue)=>{K._enterCancelled=Ue,Qr(K,ke?c:a),Qr(K,ke?u:i),Ne&&Ne()},ce=(K,ke)=>{K._isLeaving=!1,Qr(K,f),Qr(K,S),Qr(K,m),ke&&ke()},be=K=>(ke,Ne)=>{const Ue=K?we:P,Ce=()=>ue(ke,K,Ne);Xr(Ue,[ke,Ce]),wc(()=>{Qr(ke,K?l:o),ur(ke,K?c:a),yc(Ue)||bc(ke,r,O,Ce)})};return Ht(t,{onBeforeEnter(K){Xr(R,[K]),ur(K,o),ur(K,i)},onBeforeAppear(K){Xr(oe,[K]),ur(K,l),ur(K,u)},onEnter:be(!1),onAppear:be(!0),onLeave(K,ke){K._isLeaving=!0;const Ne=()=>ce(K,ke);ur(K,f),K._enterCancelled?(ur(K,m),Tc(K)):(Tc(K),ur(K,m)),wc(()=>{K._isLeaving&&(Qr(K,f),ur(K,S),yc(F)||bc(K,r,V,Ne))}),Xr(F,[K,Ne])},onEnterCancelled(K){ue(K,!1,void 0,!0),Xr(B,[K])},onAppearCancelled(K){ue(K,!0,void 0,!0),Xr(Se,[K])},onLeaveCancelled(K){ce(K),Xr(ne,[K])}})}function Um(e){if(e==null)return null;if(yt(e))return[la(e.enter),la(e.leave)];{const t=la(e);return[t,t]}}function la(e){return Hh(e)}function ur(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[go]||(e[go]=new Set)).add(t)}function Qr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[go];n&&(n.delete(t),n.size||(e[go]=void 0))}function wc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Fm=0;function bc(e,t,n,r){const s=e._endId=++Fm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Bm(e,t);if(!i)return r();const u=i+"end";let c=0;const f=()=>{e.removeEventListener(u,m),o()},m=S=>{S.target===e&&++c>=l&&f()};setTimeout(()=>{c<l&&f()},a+1),e.addEventListener(u,m)}function Bm(e,t){const n=window.getComputedStyle(e),r=L=>(n[L]||"").split(", "),s=r(`${xr}Delay`),o=r(`${xr}Duration`),i=_c(s,o),a=r(`${Gs}Delay`),l=r(`${Gs}Duration`),u=_c(a,l);let c=null,f=0,m=0;t===xr?i>0&&(c=xr,f=i,m=o.length):t===Gs?u>0&&(c=Gs,f=u,m=l.length):(f=Math.max(i,u),c=f>0?i>u?xr:Gs:null,m=c?c===xr?o.length:l.length:0);const S=c===xr&&/\b(?:transform|all)(?:,|$)/.test(r(`${xr}Property`).toString());return{type:c,timeout:f,propCount:m,hasTransform:S}}function _c(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>kc(n)+kc(e[r])))}function kc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Tc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Hm(e,t,n){const r=e[go];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Sc=Symbol("_vod"),Wm=Symbol("_vsh"),Vm=Symbol(""),zm=/(?:^|;)\s*display\s*:/;function Gm(e,t,n){const r=e.style,s=Ot(n);let o=!1;if(n&&!s){if(t)if(Ot(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&ei(r,a,"")}else for(const i in t)n[i]==null&&ei(r,i,"");for(const i in n)i==="display"&&(o=!0),ei(r,i,n[i])}else if(s){if(t!==n){const i=r[Vm];i&&(n+=";"+i),r.cssText=n,o=zm.test(n)}}else t&&e.removeAttribute("style");Sc in e&&(e[Sc]=o?r.display:"",e[Wm]&&(r.display="none"))}const Ic=/\s*!important$/;function ei(e,t,n){if(Ge(n))n.forEach(r=>ei(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=qm(e,t);Ic.test(n)?e.setProperty(Hr(r),n.replace(Ic,""),"important"):e[r]=n}}const Ec=["Webkit","Moz","ms"],ca={};function qm(e,t){const n=ca[t];if(n)return n;let r=yn(t);if(r!=="filter"&&r in e)return ca[t]=r;r=Ei(r);for(let s=0;s<Ec.length;s++){const o=Ec[s]+r;if(o in e)return ca[t]=o}return t}const Cc="http://www.w3.org/1999/xlink";function Ac(e,t,n,r,s,o=Kh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Cc,t.slice(6,t.length)):e.setAttributeNS(Cc,t,n):n==null||o&&!pd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Vn(n)?String(n):n)}function xc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?kf(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const a=o==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=pd(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function vs(e,t,n,r){e.addEventListener(t,n,r)}function Km(e,t,n,r){e.removeEventListener(t,n,r)}const Rc=Symbol("_vei");function Jm(e,t,n,r,s=null){const o=e[Rc]||(e[Rc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Ym(t);if(r){const u=o[t]=Zm(r,s);vs(e,a,u,l)}else i&&(Km(e,a,i,l),o[t]=void 0)}}const Pc=/(?:Once|Passive|Capture)$/;function Ym(e){let t;if(Pc.test(e)){t={};let r;for(;r=e.match(Pc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Hr(e.slice(2)),t]}let ua=0;const Xm=Promise.resolve(),Qm=()=>ua||(Xm.then(()=>ua=0),ua=Date.now());function Zm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Gn(eg(r,n.value),t,5,[r])};return n.value=e,n.attached=Qm(),n}function eg(e,t){if(Ge(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Mc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,tg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Hm(e,r,i):t==="style"?Gm(e,n,r):Ti(t)?Si(t)||Jm(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):ng(e,t,r,i))?(xc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ac(e,t,r,i,o,t!=="value")):e._isVueCE&&(rg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Ot(r)))?xc(e,yn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ac(e,t,r,i))};function ng(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Mc(t)&&Ke(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Mc(t)&&Ot(n)?!1:t in e}function rg(e,t){const n=e._def.props;if(!n)return!1;const r=yn(t);return Array.isArray(n)?n.some(s=>yn(s)===r):Object.keys(n).some(s=>yn(s)===r)}const $c=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ge(t)?n=>Yo(t,n):t};function sg(e){e.target.composing=!0}function Oc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function Nc(e,t,n){return t&&(e=e.trim()),n&&(e=gl(e)),e}const Sr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[da]=$c(s);const o=r||s.props&&s.props.type==="number";vs(e,t?"change":"input",i=>{i.target.composing||e[da](Nc(e.value,n,o))}),(n||o)&&vs(e,"change",()=>{e.value=Nc(e.value,n,o)}),t||(vs(e,"compositionstart",sg),vs(e,"compositionend",Oc),vs(e,"change",Oc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[da]=$c(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?gl(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},og=["ctrl","shift","alt","meta"],ig={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>og.some(n=>e[`${n}Key`]&&!t.includes(n))},rt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const a=ig[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},ag={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},vn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Hr(s.key);if(t.some(i=>i===o||ag[i]===o))return e(s)}))},lg=Ht({patchProp:tg},Nm);let Dc;function cg(){return Dc||(Dc=gm(lg))}const ug=((...e)=>{const t=cg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=fg(r);if(!s)return;const o=t._component;!Ke(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,dg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function dg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function fg(e){return Ot(e)?document.querySelector(e):e}/*!
18
- * vue-router v4.6.4
19
- * (c) 2025 Eduardo San Martin Morote
20
- * @license MIT
21
- */const ys=typeof document<"u";function If(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&If(e.default)}const gt=Object.assign;function fa(e,t){const n={};for(const r in t){const s=t[r];n[r]=qn(s)?s.map(e):e(s)}return n}const so=()=>{},qn=Array.isArray;function Lc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Ef=/#/g,pg=/&/g,mg=/\//g,gg=/=/g,vg=/\?/g,Cf=/\+/g,yg=/%5B/g,wg=/%5D/g,Af=/%5E/g,bg=/%60/g,xf=/%7B/g,_g=/%7C/g,Rf=/%7D/g,kg=/%20/g;function Ml(e){return e==null?"":encodeURI(""+e).replace(_g,"|").replace(yg,"[").replace(wg,"]")}function Tg(e){return Ml(e).replace(xf,"{").replace(Rf,"}").replace(Af,"^")}function Ka(e){return Ml(e).replace(Cf,"%2B").replace(kg,"+").replace(Ef,"%23").replace(pg,"%26").replace(bg,"`").replace(xf,"{").replace(Rf,"}").replace(Af,"^")}function Sg(e){return Ka(e).replace(gg,"%3D")}function Ig(e){return Ml(e).replace(Ef,"%23").replace(vg,"%3F")}function Eg(e){return Ig(e).replace(mg,"%2F")}function vo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Cg=/\/$/,Ag=e=>e.replace(Cg,"");function ha(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),o=t.slice(l,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Mg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:vo(i)}}function xg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Rg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Rs(t.matched[r],n.matched[s])&&Pf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Rs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Pf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Pg(e[n],t[n]))return!1;return!0}function Pg(e,t){return qn(e)?Uc(e,t):qn(t)?Uc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Uc(e,t){return qn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Mg(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Rr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ja=(function(e){return e.pop="pop",e.push="push",e})({}),pa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function $g(e){if(!e)if(ys){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Ag(e)}const Og=/^[^#]+#/;function Ng(e,t){return e.replace(Og,"#")+t}function Dg(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Di=()=>({left:window.scrollX,top:window.scrollY});function Lg(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Dg(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Fc(e,t){return(history.state?history.state.position-t:-1)+e}const Ya=new Map;function jg(e,t){Ya.set(e,t)}function Ug(e){const t=Ya.get(e);return Ya.delete(e),t}function Fg(e){return typeof e=="string"||e&&typeof e=="object"}function Mf(e){return typeof e=="string"||typeof e=="symbol"}let Dt=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const $f=Symbol("");Dt.MATCHER_NOT_FOUND+"",Dt.NAVIGATION_GUARD_REDIRECT+"",Dt.NAVIGATION_ABORTED+"",Dt.NAVIGATION_CANCELLED+"",Dt.NAVIGATION_DUPLICATED+"";function Ps(e,t){return gt(new Error,{type:e,[$f]:!0},t)}function dr(e,t){return e instanceof Error&&$f in e&&(t==null||!!(e.type&t))}const Bg=["params","query","hash"];function Hg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Bg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Wg(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(Cf," "),o=s.indexOf("="),i=vo(o<0?s:s.slice(0,o)),a=o<0?null:vo(s.slice(o+1));if(i in t){let l=t[i];qn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Bc(e){let t="";for(let n in e){const r=e[n];if(n=Sg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(qn(r)?r.map(s=>s&&Ka(s)):[r&&Ka(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Vg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=qn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const zg=Symbol(""),Hc=Symbol(""),Li=Symbol(""),$l=Symbol(""),Xa=Symbol("");function qs(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Or(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const u=m=>{m===!1?l(Ps(Dt.NAVIGATION_ABORTED,{from:n,to:t})):m instanceof Error?l(m):Fg(m)?l(Ps(Dt.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(i&&r.enterCallbacks[s]===i&&typeof m=="function"&&i.push(m),a())},c=o(()=>e.call(r&&r.instances[s],t,n,u));let f=Promise.resolve(c);e.length<3&&(f=f.then(u)),f.catch(m=>l(m))})}function ma(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(If(l)){const u=(l.__vccOpts||l)[t];u&&o.push(Or(u,n,r,i,a,s))}else{let u=l();o.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const f=hg(c)?c.default:c;i.mods[a]=c,i.components[a]=f;const m=(f.__vccOpts||f)[t];return m&&Or(m,n,r,i,a,s)()}))}}return o}function Gg(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const a=t.matched[i];a&&(e.matched.find(u=>Rs(u,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(u=>Rs(u,l))||s.push(l))}return[n,r,s]}/*!
22
- * vue-router v4.6.4
23
- * (c) 2025 Eduardo San Martin Morote
24
- * @license MIT
25
- */let qg=()=>location.protocol+"//"+location.host;function Of(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),jc(a,"")}return jc(n,e)+r+s}function Kg(e,t,n,r){let s=[],o=[],i=null;const a=({state:m})=>{const S=Of(e,location),L=n.value,O=t.value;let V=0;if(m){if(n.value=S,t.value=m,i&&i===L){i=null;return}V=O?m.position-O.position:0}else r(S);s.forEach(R=>{R(n.value,L,{delta:V,type:Ja.pop,direction:V?V>0?pa.forward:pa.back:pa.unknown})})};function l(){i=n.value}function u(m){s.push(m);const S=()=>{const L=s.indexOf(m);L>-1&&s.splice(L,1)};return o.push(S),S}function c(){if(document.visibilityState==="hidden"){const{history:m}=window;if(!m.state)return;m.replaceState(gt({},m.state,{scroll:Di()}),"")}}function f(){for(const m of o)m();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:u,destroy:f}}function Wc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Di():null}}function Jg(e){const{history:t,location:n}=window,r={value:Of(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(l,u,c){const f=e.indexOf("#"),m=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+l:qg()+e+l;try{t[c?"replaceState":"pushState"](u,"",m),s.value=u}catch(S){console.error(S),n[c?"replace":"assign"](m)}}function i(l,u){o(l,gt({},t.state,Wc(s.value.back,l,s.value.forward,!0),u,{position:s.value.position}),!0),r.value=l}function a(l,u){const c=gt({},s.value,t.state,{forward:l,scroll:Di()});o(c.current,c,!0),o(l,gt({},Wc(r.value,l,null),{position:c.position+1},u),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Yg(e){e=$g(e);const t=Jg(e),n=Kg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=gt({location:"",base:e,go:r,createHref:Ng.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function Xg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Yg(e)}let ss=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Bt=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(Bt||{});const Qg={type:ss.Static,value:""},Zg=/[a-zA-Z0-9_]/;function ev(e){if(!e)return[[]];if(e==="/")return[[Qg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(S){throw new Error(`ERR (${n})/"${u}": ${S}`)}let n=Bt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,u="",c="";function f(){u&&(n===Bt.Static?o.push({type:ss.Static,value:u}):n===Bt.Param||n===Bt.ParamRegExp||n===Bt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:ss.Param,value:u,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),u="")}function m(){u+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Bt.ParamRegExp){r=n,n=Bt.EscapeNext;continue}switch(n){case Bt.Static:l==="/"?(u&&f(),i()):l===":"?(f(),n=Bt.Param):m();break;case Bt.EscapeNext:m(),n=r;break;case Bt.Param:l==="("?n=Bt.ParamRegExp:Zg.test(l)?m():(f(),n=Bt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Bt.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Bt.ParamRegExpEnd:c+=l;break;case Bt.ParamRegExpEnd:f(),n=Bt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===Bt.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),f(),i(),s}const Vc="[^/]+?",tv={sensitive:!1,strict:!1,start:!0,end:!0};var mn=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e})(mn||{});const nv=/[.+*?^${}()[\]/\\]/g;function rv(e,t){const n=gt({},tv,t),r=[];let s=n.start?"^":"";const o=[];for(const u of e){const c=u.length?[]:[mn.Root];n.strict&&!u.length&&(s+="/");for(let f=0;f<u.length;f++){const m=u[f];let S=mn.Segment+(n.sensitive?mn.BonusCaseSensitive:0);if(m.type===ss.Static)f||(s+="/"),s+=m.value.replace(nv,"\\$&"),S+=mn.Static;else if(m.type===ss.Param){const{value:L,repeatable:O,optional:V,regexp:R}=m;o.push({name:L,repeatable:O,optional:V});const P=R||Vc;if(P!==Vc){S+=mn.BonusCustomRegExp;try{`${P}`}catch(F){throw new Error(`Invalid custom RegExp for param "${L}" (${P}): `+F.message)}}let B=O?`((?:${P})(?:/(?:${P}))*)`:`(${P})`;f||(B=V&&u.length<2?`(?:/${B})`:"/"+B),V&&(B+="?"),s+=B,S+=mn.Dynamic,V&&(S+=mn.BonusOptional),O&&(S+=mn.BonusRepeatable),P===".*"&&(S+=mn.BonusWildcard)}c.push(S)}r.push(c)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].length-1]+=mn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(u){const c=u.match(i),f={};if(!c)return null;for(let m=1;m<c.length;m++){const S=c[m]||"",L=o[m-1];f[L.name]=S&&L.repeatable?S.split("/"):S}return f}function l(u){let c="",f=!1;for(const m of e){(!f||!c.endsWith("/"))&&(c+="/"),f=!1;for(const S of m)if(S.type===ss.Static)c+=S.value;else if(S.type===ss.Param){const{value:L,repeatable:O,optional:V}=S,R=L in u?u[L]:"";if(qn(R)&&!O)throw new Error(`Provided param "${L}" is an array but it is not repeatable (* or + modifiers)`);const P=qn(R)?R.join("/"):R;if(!P)if(V)m.length<2&&(c.endsWith("/")?c=c.slice(0,-1):f=!0);else throw new Error(`Missing required param "${L}"`);c+=P}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function sv(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===mn.Static+mn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===mn.Static+mn.Segment?1:-1:0}function Nf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=sv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(zc(r))return 1;if(zc(s))return-1}return s.length-r.length}function zc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const ov={strict:!1,end:!0,sensitive:!1};function iv(e,t,n){const r=rv(ev(e.path),n),s=gt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function av(e,t){const n=[],r=new Map;t=Lc(ov,t);function s(f){return r.get(f)}function o(f,m,S){const L=!S,O=qc(f);O.aliasOf=S&&S.record;const V=Lc(t,f),R=[O];if("alias"in f){const F=typeof f.alias=="string"?[f.alias]:f.alias;for(const ne of F)R.push(qc(gt({},O,{components:S?S.record.components:O.components,path:ne,aliasOf:S?S.record:O})))}let P,B;for(const F of R){const{path:ne}=F;if(m&&ne[0]!=="/"){const oe=m.record.path,we=oe[oe.length-1]==="/"?"":"/";F.path=m.record.path+(ne&&we+ne)}if(P=iv(F,m,V),S?S.alias.push(P):(B=B||P,B!==P&&B.alias.push(P),L&&f.name&&!Kc(P)&&i(f.name)),Df(P)&&l(P),O.children){const oe=O.children;for(let we=0;we<oe.length;we++)o(oe[we],P,S&&S.children[we])}S=S||P}return B?()=>{i(B)}:so}function i(f){if(Mf(f)){const m=r.get(f);m&&(r.delete(f),n.splice(n.indexOf(m),1),m.children.forEach(i),m.alias.forEach(i))}else{const m=n.indexOf(f);m>-1&&(n.splice(m,1),f.record.name&&r.delete(f.record.name),f.children.forEach(i),f.alias.forEach(i))}}function a(){return n}function l(f){const m=uv(f,n);n.splice(m,0,f),f.record.name&&!Kc(f)&&r.set(f.record.name,f)}function u(f,m){let S,L={},O,V;if("name"in f&&f.name){if(S=r.get(f.name),!S)throw Ps(Dt.MATCHER_NOT_FOUND,{location:f});V=S.record.name,L=gt(Gc(m.params,S.keys.filter(B=>!B.optional).concat(S.parent?S.parent.keys.filter(B=>B.optional):[]).map(B=>B.name)),f.params&&Gc(f.params,S.keys.map(B=>B.name))),O=S.stringify(L)}else if(f.path!=null)O=f.path,S=n.find(B=>B.re.test(O)),S&&(L=S.parse(O),V=S.record.name);else{if(S=m.name?r.get(m.name):n.find(B=>B.re.test(m.path)),!S)throw Ps(Dt.MATCHER_NOT_FOUND,{location:f,currentLocation:m});V=S.record.name,L=gt({},m.params,f.params),O=S.stringify(L)}const R=[];let P=S;for(;P;)R.unshift(P.record),P=P.parent;return{name:V,path:O,params:L,matched:R,meta:cv(R)}}e.forEach(f=>o(f));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:u,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Gc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function qc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:lv(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function lv(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Kc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function cv(e){return e.reduce((t,n)=>gt(t,n.meta),{})}function uv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Nf(e,t[o])<0?r=o:n=o+1}const s=dv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function dv(e){let t=e;for(;t=t.parent;)if(Df(t)&&Nf(e,t)===0)return t}function Df({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Jc(e){const t=Hn(Li),n=Hn($l),r=ie(()=>{const l=_e(e.to);return t.resolve(l)}),s=ie(()=>{const{matched:l}=r.value,{length:u}=l,c=l[u-1],f=n.matched;if(!c||!f.length)return-1;const m=f.findIndex(Rs.bind(null,c));if(m>-1)return m;const S=Yc(l[u-2]);return u>1&&Yc(c)===S&&f[f.length-1].path!==S?f.findIndex(Rs.bind(null,l[u-2])):m}),o=ie(()=>s.value>-1&&gv(n.params,r.value.params)),i=ie(()=>s.value>-1&&s.value===n.matched.length-1&&Pf(n.params,r.value.params));function a(l={}){if(mv(l)){const u=t[_e(e.replace)?"replace":"push"](_e(e.to)).catch(so);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:ie(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function fv(e){return e.length===1?e[0]:e}const hv=Wt({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:Jc,setup(e,{slots:t}){const n=xi(Jc(e)),{options:r}=Hn(Li),s=ie(()=>({[Xc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Xc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&fv(t.default(n));return e.custom?o:Pl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),pv=hv;function mv(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function gv(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!qn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Yc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xc=(e,t,n)=>e??t??n,vv=Wt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Hn(Xa),s=ie(()=>e.route||r.value),o=Hn(Hc,0),i=ie(()=>{let u=_e(o);const{matched:c}=s.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),a=ie(()=>s.value.matched[i.value]);Xo(Hc,ie(()=>i.value+1)),Xo(zg,a),Xo(Xa,s);const l=N();return at(()=>[l.value,a.value,e.name],([u,c,f],[m,S,L])=>{c&&(c.instances[f]=u,S&&S!==c&&u&&u===m&&(c.leaveGuards.size||(c.leaveGuards=S.leaveGuards),c.updateGuards.size||(c.updateGuards=S.updateGuards))),u&&c&&(!S||!Rs(c,S)||!m)&&(c.enterCallbacks[f]||[]).forEach(O=>O(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,f=a.value,m=f&&f.components[c];if(!m)return Qc(n.default,{Component:m,route:u});const S=f.props[c],L=S?S===!0?u.params:typeof S=="function"?S(u):S:null,V=Pl(m,gt({},L,t,{onVnodeUnmounted:R=>{R.component.isUnmounted&&(f.instances[c]=null)},ref:l}));return Qc(n.default,{Component:V,route:u})||V}}});function Qc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const yv=vv;function wv(e){const t=av(e.routes,e),n=e.parseQuery||Wg,r=e.stringifyQuery||Bc,s=e.history,o=qs(),i=qs(),a=qs(),l=vp(Rr);let u=Rr;ys&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fa.bind(null,X=>""+X),f=fa.bind(null,Eg),m=fa.bind(null,vo);function S(X,de){let fe,Ie;return Mf(X)?(fe=t.getRecordMatcher(X),Ie=de):Ie=X,t.addRoute(Ie,fe)}function L(X){const de=t.getRecordMatcher(X);de&&t.removeRoute(de)}function O(){return t.getRoutes().map(X=>X.record)}function V(X){return!!t.getRecordMatcher(X)}function R(X,de){if(de=gt({},de||l.value),typeof X=="string"){const M=ha(n,X,de.path),Y=t.resolve({path:M.path},de),ee=s.createHref(M.fullPath);return gt(M,Y,{params:m(Y.params),hash:vo(M.hash),redirectedFrom:void 0,href:ee})}let fe;if(X.path!=null)fe=gt({},X,{path:ha(n,X.path,de.path).path});else{const M=gt({},X.params);for(const Y in M)M[Y]==null&&delete M[Y];fe=gt({},X,{params:f(M)}),de.params=f(de.params)}const Ie=t.resolve(fe,de),Te=X.hash||"";Ie.params=c(m(Ie.params));const b=xg(r,gt({},X,{hash:Tg(Te),path:Ie.path})),T=s.createHref(b);return gt({fullPath:b,hash:Te,query:r===Bc?Vg(X.query):X.query||{}},Ie,{redirectedFrom:void 0,href:T})}function P(X){return typeof X=="string"?ha(n,X,l.value.path):gt({},X)}function B(X,de){if(u!==X)return Ps(Dt.NAVIGATION_CANCELLED,{from:de,to:X})}function F(X){return we(X)}function ne(X){return F(gt(P(X),{replace:!0}))}function oe(X,de){const fe=X.matched[X.matched.length-1];if(fe&&fe.redirect){const{redirect:Ie}=fe;let Te=typeof Ie=="function"?Ie(X,de):Ie;return typeof Te=="string"&&(Te=Te.includes("?")||Te.includes("#")?Te=P(Te):{path:Te},Te.params={}),gt({query:X.query,hash:X.hash,params:Te.path!=null?{}:X.params},Te)}}function we(X,de){const fe=u=R(X),Ie=l.value,Te=X.state,b=X.force,T=X.replace===!0,M=oe(fe,Ie);if(M)return we(gt(P(M),{state:typeof M=="object"?gt({},Te,M.state):Te,force:b,replace:T}),de||fe);const Y=fe;Y.redirectedFrom=de;let ee;return!b&&Rg(r,Ie,fe)&&(ee=Ps(Dt.NAVIGATION_DUPLICATED,{to:Y,from:Ie}),Oe(Ie,Ie,!0,!1)),(ee?Promise.resolve(ee):ce(Y,Ie)).catch(H=>dr(H)?dr(H,Dt.NAVIGATION_GUARD_REDIRECT)?H:tt(H):De(H,Y,Ie)).then(H=>{if(H){if(dr(H,Dt.NAVIGATION_GUARD_REDIRECT))return we(gt({replace:T},P(H.to),{state:typeof H.to=="object"?gt({},Te,H.to.state):Te,force:b}),de||Y)}else H=K(Y,Ie,!0,T,Te);return be(Y,Ie,H),H})}function Se(X,de){const fe=B(X,de);return fe?Promise.reject(fe):Promise.resolve()}function ue(X){const de=ct.values().next().value;return de&&typeof de.runWithContext=="function"?de.runWithContext(X):X()}function ce(X,de){let fe;const[Ie,Te,b]=Gg(X,de);fe=ma(Ie.reverse(),"beforeRouteLeave",X,de);for(const M of Ie)M.leaveGuards.forEach(Y=>{fe.push(Or(Y,X,de))});const T=Se.bind(null,X,de);return fe.push(T),Je(fe).then(()=>{fe=[];for(const M of o.list())fe.push(Or(M,X,de));return fe.push(T),Je(fe)}).then(()=>{fe=ma(Te,"beforeRouteUpdate",X,de);for(const M of Te)M.updateGuards.forEach(Y=>{fe.push(Or(Y,X,de))});return fe.push(T),Je(fe)}).then(()=>{fe=[];for(const M of b)if(M.beforeEnter)if(qn(M.beforeEnter))for(const Y of M.beforeEnter)fe.push(Or(Y,X,de));else fe.push(Or(M.beforeEnter,X,de));return fe.push(T),Je(fe)}).then(()=>(X.matched.forEach(M=>M.enterCallbacks={}),fe=ma(b,"beforeRouteEnter",X,de,ue),fe.push(T),Je(fe))).then(()=>{fe=[];for(const M of i.list())fe.push(Or(M,X,de));return fe.push(T),Je(fe)}).catch(M=>dr(M,Dt.NAVIGATION_CANCELLED)?M:Promise.reject(M))}function be(X,de,fe){a.list().forEach(Ie=>ue(()=>Ie(X,de,fe)))}function K(X,de,fe,Ie,Te){const b=B(X,de);if(b)return b;const T=de===Rr,M=ys?history.state:{};fe&&(Ie||T?s.replace(X.fullPath,gt({scroll:T&&M&&M.scroll},Te)):s.push(X.fullPath,Te)),l.value=X,Oe(X,de,fe,T),tt()}let ke;function Ne(){ke||(ke=s.listen((X,de,fe)=>{if(!Ze.listening)return;const Ie=R(X),Te=oe(Ie,Ze.currentRoute.value);if(Te){we(gt(Te,{replace:!0,force:!0}),Ie).catch(so);return}u=Ie;const b=l.value;ys&&jg(Fc(b.fullPath,fe.delta),Di()),ce(Ie,b).catch(T=>dr(T,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_CANCELLED)?T:dr(T,Dt.NAVIGATION_GUARD_REDIRECT)?(we(gt(P(T.to),{force:!0}),Ie).then(M=>{dr(M,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_DUPLICATED)&&!fe.delta&&fe.type===Ja.pop&&s.go(-1,!1)}).catch(so),Promise.reject()):(fe.delta&&s.go(-fe.delta,!1),De(T,Ie,b))).then(T=>{T=T||K(Ie,b,!1),T&&(fe.delta&&!dr(T,Dt.NAVIGATION_CANCELLED)?s.go(-fe.delta,!1):fe.type===Ja.pop&&dr(T,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),be(Ie,b,T)}).catch(so)}))}let Ue=qs(),Ce=qs(),$e;function De(X,de,fe){tt(X);const Ie=Ce.list();return Ie.length?Ie.forEach(Te=>Te(X,de,fe)):console.error(X),Promise.reject(X)}function ze(){return $e&&l.value!==Rr?Promise.resolve():new Promise((X,de)=>{Ue.add([X,de])})}function tt(X){return $e||($e=!X,Ne(),Ue.list().forEach(([de,fe])=>X?fe(X):de()),Ue.reset()),X}function Oe(X,de,fe,Ie){const{scrollBehavior:Te}=e;if(!ys||!Te)return Promise.resolve();const b=!fe&&Ug(Fc(X.fullPath,0))||(Ie||!fe)&&history.state&&history.state.scroll||null;return Xt().then(()=>Te(X,de,b)).then(T=>T&&Lg(T)).catch(T=>De(T,X,de))}const Qe=X=>s.go(X);let wt;const ct=new Set,Ze={currentRoute:l,listening:!0,addRoute:S,removeRoute:L,clearRoutes:t.clearRoutes,hasRoute:V,getRoutes:O,resolve:R,options:e,push:F,replace:ne,go:Qe,back:()=>Qe(-1),forward:()=>Qe(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ce.add,isReady:ze,install(X){X.component("RouterLink",pv),X.component("RouterView",yv),X.config.globalProperties.$router=Ze,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),ys&&!wt&&l.value===Rr&&(wt=!0,F(s.location).catch(Ie=>{}));const de={};for(const Ie in Rr)Object.defineProperty(de,Ie,{get:()=>l.value[Ie],enumerable:!0});X.provide(Li,Ze),X.provide($l,Pd(de)),X.provide(Xa,l);const fe=X.unmount;ct.add(X),X.unmount=function(){ct.delete(X),ct.size<1&&(u=Rr,ke&&ke(),ke=null,l.value=Rr,wt=!1,$e=!1),fe()}}};function Je(X){return X.reduce((de,fe)=>de.then(()=>ue(fe)),Promise.resolve())}return Ze}function bv(){return Hn(Li)}function _v(e){return Hn($l)}const Zc=768;function Lf(){const e=N(typeof window<"u"?window.innerWidth<Zc:!1);let t=null;function n(r){e.value=r.matches}return ar(()=>{t=window.matchMedia(`(max-width: ${Zc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),So(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const kv={key:0,class:"desktop-sidebar"},Tv={class:"desktop-main"},eu="codex-web-local.sidebar-width.v1",Sv=260,Iv=620,tu=320,nu="100dvh",Ev=Wt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Lf();function r(L){return Math.min(Iv,Math.max(Sv,L))}function s(){if(typeof window>"u")return tu;const L=window.localStorage.getItem(eu),O=Number(L);return Number.isFinite(O)?r(O):tu}const o=N(s()),i=N(nu);function a(){var O;if(typeof window>"u")return nu;const L=((O=window.visualViewport)==null?void 0:O.height)??window.innerHeight;return`${Math.max(Math.round(L),0)}px`}let l=0;function u(){i.value=a()}function c(){l||(l=window.requestAnimationFrame(()=>{l=0,u()}))}const f=ie(()=>{const L={"--layout-height":i.value};return n.value||t.isSidebarCollapsed?{...L,"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{...L,"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"}});function m(L){typeof window>"u"||window.localStorage.setItem(eu,String(L))}function S(L){L.preventDefault();const O=L.clientX,V=o.value,R=B=>{const F=B.clientX-O;o.value=r(V+F)},P=()=>{m(o.value),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",P)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",P)}return ar(()=>{var L,O;u(),window.addEventListener("resize",c),(L=window.visualViewport)==null||L.addEventListener("resize",c),(O=window.visualViewport)==null||O.addEventListener("scroll",c)}),So(()=>{var L,O;l&&(cancelAnimationFrame(l),l=0),window.removeEventListener("resize",c),(L=window.visualViewport)==null||L.removeEventListener("resize",c),(O=window.visualViewport)==null||O.removeEventListener("scroll",c)}),(L,O)=>(v(),E("div",{class:st(["desktop-layout",{"is-mobile":_e(n)}]),style:Fr(f.value)},[_e(n)?(v(),dt(ci,{key:0,to:"body"},[Pe(Sf,{name:"drawer"},{default:bt(()=>[e.isSidebarCollapsed?le("",!0):(v(),E("div",{key:0,class:"mobile-drawer-backdrop",onClick:O[1]||(O[1]=V=>L.$emit("close-sidebar"))},[h("aside",{class:"mobile-drawer",onClick:O[0]||(O[0]=rt(()=>{},["stop"]))},[rr(L.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):le("",!0),_e(n)?le("",!0):(v(),E(Ve,{key:1},[e.isSidebarCollapsed?le("",!0):(v(),E("aside",kv,[rr(L.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?le("",!0):(v(),E("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:S},null,32))],64)),h("section",Tv,[rr(L.$slots,"content",{},void 0)])],6))}}),lt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Cv=lt(Ev,[["__scopeId","data-v-d24ef967"]]),Av={},xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Rv(e,t){return v(),E("svg",xv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const ji=lt(Av,[["render",Rv]]),Pv={},Mv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $v(e,t){return v(),E("svg",Mv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const jf=lt(Pv,[["render",$v]]),Ov={},Nv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Dv(e,t){return v(),E("svg",Nv,[...t[0]||(t[0]=[h("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const Ks=lt(Ov,[["render",Dv]]),Lv={},jv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Uv(e,t){return v(),E("svg",jv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const mi=lt(Lv,[["render",Uv]]),Fv={},Bv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hv(e,t){return v(),E("svg",Bv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const Ui=lt(Fv,[["render",Hv]]),Wv={},Vv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zv(e,t){return v(),E("svg",Vv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const Gv=lt(Wv,[["render",zv]]),qv={},Kv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Jv(e,t){return v(),E("svg",Kv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const ti=lt(qv,[["render",Jv]]),Yv={},Xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Qv(e,t){return v(),E("svg",Xv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 4.5l-4 4L7 10l-1.5 1.5l7 7L14 17l1.5-4l4-4M9 15l-4.5 4.5M14.5 4L20 9.5"},null,-1)])])}const ga=lt(Yv,[["render",Qv]]),Zv={key:0,class:"sidebar-menu-row-left"},ey={class:"sidebar-menu-row-main"},ty={key:1,class:"sidebar-menu-row-right"},ny={key:0,class:"sidebar-menu-row-right-default"},ry={key:1,class:"sidebar-menu-row-right-hover"},sy=Wt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Kp(),r=ie(()=>!!n.left),s=ie(()=>!!n.right),o=ie(()=>!!n["right-hover"]),i=ie(()=>s.value||o.value);return(a,l)=>(v(),dt(di(t.as),yf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:bt(()=>[r.value?(v(),E("span",Zv,[rr(a.$slots,"left",{},void 0,!0)])):le("",!0),h("span",ey,[rr(a.$slots,"default",{},void 0,!0)]),i.value?(v(),E("span",ty,[s.value?(v(),E("span",ny,[rr(a.$slots,"right",{},void 0,!0)])):le("",!0),o.value?(v(),E("span",ry,[rr(a.$slots,"right-hover",{},void 0,!0)])):le("",!0)])):le("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Zr=lt(sy,[["__scopeId","data-v-daeca4df"]]),oy={class:"thread-tree-root"},iy={key:0,class:"pinned-section"},ay={class:"thread-list"},ly={class:"thread-left-stack"},cy=["data-state"],uy=["onClick"],dy=["onClick"],fy={class:"thread-row-title-wrap"},hy={class:"thread-row-title"},py={class:"thread-row-time"},my=["onClick"],gy=["onClick"],vy=["onClick"],yy=["onClick"],wy=["onClick"],by=["onClick"],_y=["aria-expanded"],ky=["data-active"],Ty={key:0},Sy=["data-active"],Iy={key:0},Ey={key:1,class:"thread-tree-no-results"},Cy={key:2,class:"thread-tree-loading"},Ay={key:3,class:"thread-list thread-list-global"},xy={class:"thread-left-stack"},Ry=["data-state"],Py=["onClick"],My=["onClick"],$y={class:"thread-row-title-wrap"},Oy={class:"thread-row-title"},Ny={class:"thread-row-time"},Dy=["onClick"],Ly=["onClick"],jy=["onClick"],Uy=["onClick"],Fy=["onClick"],By=["onClick"],Hy=["data-project-name","data-expanded","data-dragging"],Wy={class:"project-icon-stack"},Vy={class:"project-icon-folder"},zy={class:"project-icon-chevron"},Gy=["data-dragging-handle","onMousedown"],qy={class:"project-title"},Ky={class:"project-hover-controls"},Jy=["onClick"],Yy=["onClick"],Xy=["onClick"],Qy=["onInput"],Zy=["aria-label","title","onClick"],ew={key:0,class:"thread-list"},tw={class:"thread-left-stack"},nw=["data-state"],rw=["onClick"],sw=["onClick"],ow={class:"thread-row-title-wrap"},iw={class:"thread-row-title"},aw={class:"thread-row-time"},lw=["onClick"],cw=["onClick"],uw=["onClick"],dw=["onClick"],fw=["onClick"],hw=["onClick"],pw=["onClick"],mw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},gw=["onKeydown"],vw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},yw={class:"rename-thread-subtitle"},ww=4,ru=6,su="codex-web-local.thread-view-mode.v1",ou="codex-web-local.collapsed-projects.v1",bw=Wt({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread"],setup(e,{emit:t}){const n=e,r=t,s=N({}),o=N({}),i=N([]),a=N(""),l=N(""),u=N("actions"),c=N(""),f=N(!1),m=N(""),S=N(""),L=N(null),O=N(!1),V=N(""),R=N(""),P=N(null),B=N(null),F=N(null);let ne=null,oe=null;const we=N(""),Se=N({}),ue=new Map,ce=new Map,be=new Map,K=new WeakMap,ke=N(null),Ne=N(!1),Ue=N(De()),Ce=typeof window<"u"?new ResizeObserver(k=>{for(const $ of k){const D=$.target,Q=K.get(D);Q&&Ut(Q,D)}}):null;function $e(){if(typeof window>"u")return{};try{const k=window.localStorage.getItem(ou);if(!k)return{};const $=JSON.parse(k);return!$||typeof $!="object"||Array.isArray($)?{}:$}catch{return{}}}function De(){return typeof window>"u"?"project":window.localStorage.getItem(su)==="chronological"?"chronological":"project"}o.value=$e(),at(o,k=>{typeof window>"u"||window.localStorage.setItem(ou,JSON.stringify(k))},{deep:!0}),at(Ue,k=>{typeof window>"u"||window.localStorage.setItem(su,k)});const ze=ie(()=>n.searchQuery.trim().toLowerCase()),tt=ie(()=>ze.value.length>0),Oe=ie(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),Qe=ie(()=>new Set(i.value));function wt(k){if(!tt.value)return!0;if(Oe.value)return Oe.value.has(k.id);const $=ze.value;return k.title.toLowerCase().includes($)||k.preview.toLowerCase().includes($)}const ct=ie(()=>tt.value?n.groups.map(k=>({...k,threads:k.threads.filter(wt)})).filter(k=>k.threads.length>0):n.groups),Ze=ie(()=>Ue.value==="chronological"),Je=ie(()=>{const k=ct.value,$=[];for(const D of k)for(const Q of D.threads)Qe.value.has(Q.id)||$.push(Q);return $.sort((D,Q)=>{const je=new Date(D.updatedAtIso||D.createdAtIso).getTime();return new Date(Q.updatedAtIso||Q.createdAtIso).getTime()-je})}),X=ie(()=>{const k=new Map;for(const $ of n.groups)for(const D of $.threads)k.set(D.id,D);return k}),de=ie(()=>{const k=new Map;for(const $ of n.groups)for(const D of $.threads)k.set(D.id,$.projectName);return k}),fe=ie(()=>{const k=new Map;for(const $ of n.groups){const D=$.threads.filter(Q=>!Qe.value.has(Q.id));k.set($.projectName,D)}return k}),Ie=ie(()=>{const k=new Map;for(const $ of n.groups)for(const D of $.threads){const Q=new Date(D.updatedAtIso||D.createdAtIso).getTime();k.set(D.id,Q)}return k}),Te=ie(()=>i.value.map(k=>X.value.get(k)??null).filter(k=>k!==null).filter(wt)),b=ie(()=>{const k=F.value;if(!k||k.dropTargetIndexFull===null||n.groups.length===0)return null;const $=Math.max(0,Math.min(k.dropTargetIndexFull,n.groups.length)),D=$>k.fromIndex?$-1:$,Q=Math.max(0,Math.min(D,n.groups.length-1));return Q===k.fromIndex?null:Q}),T=ie(()=>{const $=(tt.value?ct.value:n.groups).map(Tn=>Tn.projectName),D=F.value,Q=b.value;if(!D||Q===null)return $;const je=[...$],[Ft]=je.splice(D.fromIndex,1);return Ft?(je.splice(Q,0,Ft),je):$}),M=ie(()=>{const k={};let $=0;for(const D of T.value)k[D]=$,$+=$t(D);return k}),Y=ie(()=>{let k=0;for(const $ of T.value)k+=$t($);return{height:`${Math.max(0,k)}px`}});function ee(k){if(Number.isNaN(k))return"n/a";const $=Math.abs(Date.now()-k);if($<6e4)return"now";const D=Math.floor($/6e4);if(D<60)return`${D}m`;const Q=Math.floor(D/60);return Q<24?`${Q}h`:`${Math.floor(Q/24)}d`}function H(k){const $=Ie.value.get(k.id);return ee(typeof $=="number"?$:new Date(k.updatedAtIso||k.createdAtIso).getTime())}function G(k){return Qe.value.has(k)}function W(k){if(G(k)){i.value=i.value.filter($=>$!==k);return}i.value=[k,...i.value]}function q(k){r("select",k)}function z(k){r("export-thread",k),Me()}function me(k){r("fork-thread",k),Me()}function ve(k){return`start new thread ${mt(k)}`}function ye(k){r("start-new-thread",k)}function Re(k){r("browse-thread-files",k),Me()}function We(k){l.value===k&&Me()}function Fe(k){return l.value===k}function Me(){l.value=""}function Ye(k){if(l.value===k){Me();return}l.value=k}function et(k,$){k.preventDefault(),l.value=$}function xt(k,$){m.value=k,S.value=$,f.value=!0,Me(),Xt(()=>{var D,Q;(D=L.value)==null||D.focus(),(Q=L.value)==null||Q.select()})}function ft(){f.value=!1,m.value="",S.value=""}function Ct(){const k=m.value,$=S.value.trim();!k||!$||(r("rename-thread",{threadId:k,title:$}),ft())}function Lt(k,$){V.value=k,R.value=$,O.value=!0,Me()}function pt(){O.value=!1,V.value="",R.value=""}function Pt(){const k=V.value;k&&(i.value=i.value.filter($=>$!==k),r("archive",k),pt())}function mt(k){return n.projectDisplayNameById[k]??k}function Vt(k){return a.value===k}function nt(){a.value="",u.value="actions",c.value=""}function bn(){Ne.value=!Ne.value}function zt(k){Ue.value=k,Ne.value=!1}function Mt(k){if(a.value===k){nt();return}a.value=k,u.value="actions",c.value=mt(k)}function un(k){a.value=k,u.value="rename",c.value=mt(k)}function kt(k){r("rename-project",{projectName:k,displayName:c.value})}function It(k){r("remove-project",k),nt()}function en(k,$){if(!k.altKey||k.key!=="ArrowUp"&&k.key!=="ArrowDown")return;const D=n.groups.findIndex(Ft=>Ft.projectName===$);if(D<0)return;const Q=k.key==="ArrowUp"?-1:1,je=Math.max(0,Math.min(D+Q,n.groups.length-1));je!==D&&(k.preventDefault(),r("reorder-project",{projectName:$,toIndex:je}))}function jt(k){return s.value[k]===!0}function At(k){return o.value[k]===!0}function Gt(k){s.value={...s.value,[k]:!jt(k)}}function In(k){if(we.value===k){we.value="";return}o.value={...o.value,[k]:!At(k)}}function $t(k){const $=Se.value[k]??0,D=F.value,je=((D==null?void 0:D.projectName)===k?D.groupHeight:null)??$,Ft=At(k)?0:ru;return Math.max(0,je+Ft)}function En(k,$){const D=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(D){ce.set(k,D);return}ce.delete(k)}function Yt(k,$){const D=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(D){be.set(k,D);return}be.delete(k)}function He(k){const $=a.value;if(!$)return!1;const D=ce.get($);if(!D)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(D))return!0;const je=k.target;return je instanceof Node?D.contains(je):!1}function Le(k){const $=l.value;if(!$)return!1;const D=be.get($);if(!D)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(D))return!0;const je=k.target;return je instanceof Node?D.contains(je):!1}function qt(k){if(Ne.value){const $=ke.value,D=typeof k.composedPath=="function"?k.composedPath():[];!!$&&(D.includes($)||k.target instanceof Node&&$.contains(k.target))||(Ne.value=!1)}a.value&&(He(k)||nt(),l.value&&(Le(k)||Me()))}function dn(k){a.value&&!He(k)&&nt(),l.value&&!Le(k)&&Me()}function Pn(){Ne.value&&(Ne.value=!1),a.value&&nt(),l.value&&Me()}function _n(){window.addEventListener("pointerdown",qt,{capture:!0}),window.addEventListener("focusin",dn,{capture:!0}),window.addEventListener("blur",Pn)}function Kt(){window.removeEventListener("pointerdown",qt,{capture:!0}),window.removeEventListener("focusin",dn,{capture:!0}),window.removeEventListener("blur",Pn)}function Ut(k,$){const D=$.getBoundingClientRect().height;if(!Number.isFinite(D)||D<=0)return;const Q=Se.value[k];Q!==void 0&&Math.abs(Q-D)<.5||(Se.value={...Se.value,[k]:D})}function tn(k,$){const D=ue.get(k);D&&D!==$&&Ce&&Ce.unobserve(D);const Q=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(Q){ue.set(k,Q),K.set(Q,k),Ut(k,Q),Ce==null||Ce.observe(Q);return}D&&(Ce==null||Ce.unobserve(D)),ue.delete(k)}function fn(k,$){if(k.button!==0||B.value||F.value)return;const D=n.groups.findIndex(Tn=>Tn.projectName===$),Q=ue.get($);if(D<0||!Q)return;const je=Q.getBoundingClientRect(),Ft=At($)?0:ru;B.value={projectName:$,fromIndex:D,startClientX:k.clientX,startClientY:k.clientY,pointerOffsetY:k.clientY-je.top,groupLeft:je.left,groupWidth:je.width,groupHeight:je.height,groupOuterHeight:je.height+Ft},k.preventDefault(),Un()}function Un(){window.addEventListener("mousemove",$n),window.addEventListener("mouseup",kn),window.addEventListener("keydown",Cn)}function Mn(){window.removeEventListener("mousemove",$n),window.removeEventListener("mouseup",kn),window.removeEventListener("keydown",Cn)}function $n(k){ne={clientX:k.clientX,clientY:k.clientY},w()}function kn(k){I({clientX:k.clientX,clientY:k.clientY});const $=F.value;if($&&b.value!==null){const D=n.groups.findIndex(Q=>Q.projectName===$.projectName);if(D>=0){const Q=b.value;Q!==D&&r("reorder-project",{projectName:$.projectName,toIndex:Q})}}On()}function Cn(k){k.key==="Escape"&&(!B.value&&!F.value||(k.preventDefault(),On()))}function On(){oe!==null&&(window.cancelAnimationFrame(oe),oe=null),ne=null,B.value=null,F.value=null,we.value="",Mn()}function w(){oe===null&&(oe=window.requestAnimationFrame(()=>{if(oe=null,!ne)return;const k=ne;ne=null,I(k)}))}function I(k){const $=B.value;if(!F.value&&$){const D=k.clientX-$.startClientX,Q=k.clientY-$.startClientY;if(Math.hypot(D,Q)<ww)return;nt(),we.value=$.projectName,F.value={projectName:$.projectName,fromIndex:$.fromIndex,pointerOffsetY:$.pointerOffsetY,groupLeft:$.groupLeft,groupWidth:$.groupWidth,groupHeight:$.groupHeight,groupOuterHeight:$.groupOuterHeight,ghostTop:k.clientY-$.pointerOffsetY,dropTargetIndexFull:null}}F.value&&A(k)}function A(k){const $=F.value;if(!$)return;if($.ghostTop=k.clientY-$.pointerOffsetY,!J(k)){$.dropTargetIndexFull=null;return}const D=k.clientY,Q=P.value;if(!Q){$.dropTargetIndexFull=null;return}const je=Q.getBoundingClientRect(),Ft=new Map(n.groups.map((hn,Nn)=>[hn.projectName,Nn])),Tn=n.groups.map(hn=>hn.projectName).filter(hn=>hn!==$.projectName);let ds=0,fs=n.groups.length;for(const hn of Tn){const Nn=Ft.get(hn);if(Nn===void 0)continue;const Vr=$t(hn),js=je.top+ds+Vr/2;if(D<js){fs=Nn;break}ds+=Vr}$.dropTargetIndexFull=fs}function J(k){const $=P.value;if(!$)return!1;const D=$.getBoundingClientRect(),Q=k.clientX>=D.left&&k.clientX<=D.right,je=k.clientY>=D.top-32&&k.clientY<=D.bottom+32;return Q&&je}function y(k){var $;return(($=F.value)==null?void 0:$.projectName)===k}function C(k){const $=F.value,D=M.value[k]??0,Q=l.value?de.value.get(l.value)??"":"",je=a.value===k||Q===k;return!$||$.projectName!==k?{position:"absolute",top:"0",left:"0",right:"0",zIndex:je?"40":"1",transform:`translate3d(0, ${D}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${$.groupLeft}px`,width:`${$.groupWidth}px`,height:`${$.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${$.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function j(k){return fe.value.get(k.projectName)??[]}function te(k){if(tt.value)return j(k);if(At(k.projectName))return[];const $=j(k);return jt(k.projectName)?$:$.slice(0,10)}function Ae(k){return tt.value?!1:!At(k.projectName)&&j(k).length>10}function Xe(k){return j(k).length>0}function ut(k){return k.inProgress?"working":k.unread?"unread":"idle"}at(()=>n.groups.map(k=>k.projectName),k=>{var je,Ft;const $=((je=F.value)==null?void 0:je.projectName)??((Ft=B.value)==null?void 0:Ft.projectName)??"";$&&!n.groups.some(Tn=>Tn.projectName===$)&&On();const D=new Set(k),Q=Object.fromEntries(Object.entries(Se.value).filter(([Tn])=>D.has(Tn)));Object.keys(Q).length!==Object.keys(Se.value).length&&(Se.value=Q)});const Rt=ie(()=>Ne.value||a.value!=="");return at(Rt,k=>{if(k){_n();return}Kt()}),Ar(()=>{for(const k of ue.values())Ce==null||Ce.unobserve(k);ue.clear(),ce.clear(),Kt(),On()}),(k,$)=>(v(),E("section",oy,[Te.value.length>0?(v(),E("section",iy,[h("ul",ay,[(v(!0),E(Ve,null,_t(Te.value,D=>(v(),E("li",{key:D.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":D.id===e.selectedThreadId,"data-pinned":G(D.id),"force-right-hover":Fe(D.id),onMouseleave:Q=>We(D.id),onContextmenu:Q=>et(Q,D.id)},{left:bt(()=>[h("span",ly,[D.inProgress||D.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(D)},null,8,cy)):le("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>W(D.id)},[Pe(ga,{class:"thread-icon"})],8,uy)])]),right:bt(()=>[h("span",py,ae(H(D)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:Q=>Yt(D.id,Q),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(Q=>Ye(D.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,my),Fe(D.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[0]||($[0]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:Q=>Re(D.id)}," Browse files ",8,gy),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>z(D.id)}," Export chat ",8,vy),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>me(D.id)}," Create chat fork ",8,yy),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>xt(D.id,D.title)}," Rename thread ",8,wy),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Lt(D.id,D.title)}," Delete thread ",8,by)])):le("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Q=>q(D.id)},[h("span",fy,[h("span",hy,ae(D.title),1),D.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,dy)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])])):le("",!0),Pe(Zr,{as:"header",class:"thread-tree-header-row"},{right:bt(()=>[h("div",{ref_key:"organizeMenuWrapRef",ref:ke,class:"organize-menu-wrap"},[h("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Ne.value,"aria-label":"Organize threads",title:"Organize threads",onClick:bn},[Pe(Ks,{class:"thread-icon"})],8,_y),Ne.value?(v(),E("div",{key:0,class:"organize-menu-panel",onClick:$[3]||($[3]=rt(()=>{},["stop"]))},[$[11]||($[11]=h("p",{class:"organize-menu-title"},"Organize",-1)),h("button",{class:"organize-menu-item","data-active":Ue.value==="project",type:"button",onClick:$[1]||($[1]=D=>zt("project"))},[$[9]||($[9]=h("span",null,"By project",-1)),Ue.value==="project"?(v(),E("span",Ty,"✓")):le("",!0)],8,ky),h("button",{class:"organize-menu-item","data-active":Ue.value==="chronological",type:"button",onClick:$[2]||($[2]=D=>zt("chronological"))},[$[10]||($[10]=h("span",null,"Chronological list",-1)),Ue.value==="chronological"?(v(),E("span",Iy,"✓")):le("",!0)],8,Sy)])):le("",!0)],512)]),default:bt(()=>[$[12]||($[12]=h("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),tt.value&&ct.value.length===0?(v(),E("p",Ey,"No matching threads")):e.isLoading&&e.groups.length===0?(v(),E("p",Cy,"Loading threads...")):Ze.value?(v(),E("ul",Ay,[(v(!0),E(Ve,null,_t(Je.value,D=>(v(),E("li",{key:D.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":D.id===e.selectedThreadId,"data-pinned":G(D.id),"force-right-hover":Fe(D.id),onMouseleave:Q=>We(D.id),onContextmenu:Q=>et(Q,D.id)},{left:bt(()=>[h("span",xy,[D.inProgress||D.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(D)},null,8,Ry)):le("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>W(D.id)},[Pe(ga,{class:"thread-icon"})],8,Py)])]),right:bt(()=>[h("span",Ny,ae(H(D)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:Q=>Yt(D.id,Q),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(Q=>Ye(D.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,Dy),Fe(D.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[4]||($[4]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:Q=>Re(D.id)}," Browse files ",8,Ly),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>z(D.id)}," Export chat ",8,jy),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>me(D.id)}," Create chat fork ",8,Uy),h("button",{class:"thread-menu-item",type:"button",onClick:Q=>xt(D.id,D.title)}," Rename thread ",8,Fy),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Lt(D.id,D.title)}," Delete thread ",8,By)])):le("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Q=>q(D.id)},[h("span",$y,[h("span",Oy,ae(D.title),1),D.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,My)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])):(v(),E("div",{key:4,ref_key:"groupsContainerRef",ref:P,class:"thread-tree-groups",style:Fr(Y.value)},[(v(!0),E(Ve,null,_t(ct.value,D=>(v(),E("article",{key:D.projectName,ref_for:!0,ref:Q=>tn(D.projectName,Q),class:"project-group","data-project-name":D.projectName,"data-expanded":!At(D.projectName),"data-dragging":y(D.projectName),style:Fr(C(D.projectName))},[Pe(Zr,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Q=>In(D.projectName),onKeydown:[Q=>en(Q,D.projectName),vn(rt(Q=>In(D.projectName),["prevent"]),["enter"]),vn(rt(Q=>In(D.projectName),["prevent"]),["space"])]},{left:bt(()=>[h("span",Wy,[h("span",Vy,[At(D.projectName)?(v(),dt(Ui,{key:0,class:"thread-icon"})):(v(),dt(Gv,{key:1,class:"thread-icon"}))]),h("span",zy,[At(D.projectName)?(v(),dt(jf,{key:0,class:"thread-icon"})):(v(),dt(ji,{key:1,class:"thread-icon"}))])])]),right:bt(()=>[h("div",Ky,[h("div",{ref_for:!0,ref:Q=>En(D.projectName,Q),class:"project-menu-wrap"},[h("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:rt(Q=>Mt(D.projectName),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,Jy),Vt(D.projectName)?(v(),E("div",{key:0,class:"project-menu-panel",onClick:$[6]||($[6]=rt(()=>{},["stop"]))},[u.value==="actions"?(v(),E(Ve,{key:0},[h("button",{class:"project-menu-item",type:"button",onClick:Q=>un(D.projectName)}," Edit name ",8,Yy),h("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Q=>It(D.projectName)}," Remove ",8,Xy)],64)):(v(),E(Ve,{key:1},[$[13]||($[13]=h("label",{class:"project-menu-label"},"Project name",-1)),Tr(h("input",{"onUpdate:modelValue":$[5]||($[5]=Q=>c.value=Q),class:"project-menu-input",type:"text",onInput:Q=>kt(D.projectName)},null,40,Qy),[[Sr,c.value]])],64))])):le("",!0)],512),h("button",{class:"thread-start-button",type:"button","aria-label":ve(D.projectName),title:ve(D.projectName),onClick:rt(Q=>ye(D.projectName),["stop"])},[Pe(mi,{class:"thread-icon"})],8,Zy)])]),default:bt(()=>[h("span",{class:"project-main-button","data-dragging-handle":y(D.projectName),onMousedown:rt(Q=>fn(Q,D.projectName),["left"])},[h("span",qy,ae(mt(D.projectName)),1)],40,Gy)]),_:2},1032,["onClick","onKeydown"]),Xe(D)?(v(),E("ul",ew,[(v(!0),E(Ve,null,_t(te(D),Q=>(v(),E("li",{key:Q.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":Q.id===e.selectedThreadId,"data-pinned":G(Q.id),"force-right-hover":Fe(Q.id),onMouseleave:je=>We(Q.id),onContextmenu:je=>et(je,Q.id)},{left:bt(()=>[h("span",tw,[Q.inProgress||Q.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(Q)},null,8,nw)):le("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:je=>W(Q.id)},[Pe(ga,{class:"thread-icon"})],8,rw)])]),right:bt(()=>[h("span",aw,ae(H(Q)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:je=>Yt(Q.id,je),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(je=>Ye(Q.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,lw),Fe(Q.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[7]||($[7]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:je=>Re(Q.id)}," Browse files ",8,cw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>z(Q.id)}," Export chat ",8,uw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>me(Q.id)}," Create chat fork ",8,dw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>xt(Q.id,Q.title)}," Rename thread ",8,fw),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:je=>Lt(Q.id,Q.title)}," Delete thread ",8,hw)])):le("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:je=>q(Q.id)},[h("span",ow,[h("span",iw,ae(Q.title),1),Q.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,sw)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])):(v(),dt(Zr,{key:1,as:"p",class:"project-empty-row"},{left:bt(()=>[...$[14]||($[14]=[h("span",{class:"project-empty-spacer"},null,-1)])]),default:bt(()=>[$[15]||($[15]=h("span",{class:"project-empty"},"No threads",-1))]),_:1})),Ae(D)?(v(),dt(Zr,{key:2,class:"thread-show-more-row"},{left:bt(()=>[...$[16]||($[16]=[h("span",{class:"thread-show-more-spacer"},null,-1)])]),default:bt(()=>[h("button",{class:"thread-show-more-button",type:"button",onClick:Q=>Gt(D.projectName)},ae(jt(D.projectName)?"Show less":"Show more"),9,pw)]),_:2},1024)):le("",!0)],12,Hy))),128))],4)),(v(),dt(ci,{to:"body"},[f.value?(v(),E("div",{key:0,class:"rename-thread-overlay",onClick:rt(ft,["self"])},[h("div",mw,[$[17]||($[17]=h("h3",{class:"rename-thread-title"},"Rename thread",-1)),$[18]||($[18]=h("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Tr(h("input",{ref_key:"renameThreadInputRef",ref:L,"onUpdate:modelValue":$[8]||($[8]=D=>S.value=D),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[vn(rt(Ct,["prevent"]),["enter"]),vn(rt(ft,["prevent"]),["esc"])]},null,40,gw),[[Sr,S.value]]),h("div",{class:"rename-thread-actions"},[h("button",{class:"rename-thread-button",type:"button",onClick:ft},"Cancel"),h("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Ct},"Save")])])])):le("",!0)])),(v(),dt(ci,{to:"body"},[O.value?(v(),E("div",{key:0,class:"rename-thread-overlay",onClick:rt(pt,["self"])},[h("div",vw,[$[19]||($[19]=h("h3",{class:"rename-thread-title"},"Delete thread?",-1)),h("p",yw,' This will archive the thread "'+ae(R.value)+'". You can find it later in archived threads. ',1),h("div",{class:"rename-thread-actions"},[h("button",{class:"rename-thread-button",type:"button",onClick:pt},"Cancel"),h("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Pt},"Delete")])])])):le("",!0)]))]))}}),_w=lt(bw,[["__scopeId","data-v-6c669cbd"]]),kw={class:"content-header"},Tw={class:"content-leading"},Sw={class:"content-title"},Iw={class:"content-actions"},Ew=Wt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(v(),E("header",kw,[h("div",Tw,[rr(t.$slots,"leading",{},void 0)]),h("h1",Sw,ae(e.title),1),h("div",Iw,[rr(t.$slots,"actions",{},void 0)])]))}}),Cw=lt(Ew,[["__scopeId","data-v-66ee223c"]]),Aw={},xw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Rw(e,t){return v(),E("svg",xw,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ol=lt(Aw,[["render",Rw]]),Pw={},Mw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $w(e,t){return v(),E("svg",Mw,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Ow=lt(Pw,[["render",$w]]),Nw={},Dw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Lw(e,t){return v(),E("svg",Dw,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const jw=lt(Nw,[["render",Lw]]),Uw={class:"conversation-root"},Fw={key:0,class:"conversation-loading"},Bw={key:1,class:"conversation-empty"},Hw={class:"message-row"},Ww={class:"message-stack"},Vw={class:"request-card"},zw={class:"request-title"},Gw={class:"request-meta"},qw={key:0,class:"request-reason"},Kw={key:1,class:"request-actions"},Jw=["onClick"],Yw=["onClick"],Xw=["onClick"],Qw=["onClick"],Zw={key:2,class:"request-actions"},eb=["onClick"],tb=["onClick"],nb=["onClick"],rb=["onClick"],sb={key:3,class:"request-user-input"},ob={class:"request-question-title"},ib={key:0,class:"request-question-text"},ab=["value","onChange"],lb=["value"],cb=["value","onInput"],ub=["onClick"],db={key:4,class:"request-actions"},fb=["onClick"],hb=["onClick"],pb={key:5,class:"request-actions"},mb=["onClick"],gb=["onClick"],vb=["data-role","data-message-type"],yb={key:0,class:"message-row","data-role":"system"},wb={class:"message-stack","data-role":"system"},bb=["onClick"],_b={class:"cmd-status"},kb={class:"cmd-label"},Tb={class:"cmd-output-inner"},Sb={class:"cmd-output"},Ib=["data-role","data-message-type"],Eb=["data-role"],Cb=["data-role"],Ab=["data-role"],xb=["onClick"],Rb=["src"],Pb={key:1,class:"message-file-attachments"},Mb={class:"message-file-link-wrap"},$b=["href","title","onContextmenu"],Ob=["data-role"],Nb={key:0,class:"worked-separator-wrap","aria-live":"polite"},Db=["onClick"],Lb={class:"worked-separator-text"},jb={key:0,class:"worked-details"},Ub=["onClick"],Fb={class:"cmd-status"},Bb={class:"cmd-label"},Hb={class:"cmd-output-inner"},Wb={class:"cmd-output"},Vb={key:1,class:"message-text-flow"},zb={key:0,class:"message-text"},Gb={key:0},qb={key:1,class:"message-bold-text"},Kb={key:2,class:"message-file-link-wrap"},Jb=["href","title","onContextmenu"],Yb=["href","title","onContextmenu"],Xb={key:4,class:"message-inline-code"},Qb={key:1,class:"message-text"},Zb=["onClick"],e_=["src","alt","onError"],t_={key:0,class:"message-actions"},n_=["onClick"],r_=["onClick"],s_={key:0,class:"conversation-item conversation-item-overlay"},o_={class:"message-row"},i_={class:"message-stack"},a_={class:"live-overlay-inline","aria-live":"polite"},l_={class:"live-overlay-label"},c_={key:1,class:"live-overlay-error"},u_=["src"],d_=16,f_=Wt({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=N(new Set),r=N(new Set),s=N(new Set),o=N({});function i(w){return w.messageType==="commandExecution"&&!!w.commandExecution}function a(w){var I;return((I=w.commandExecution)==null?void 0:I.status)==="inProgress"||r.value.has(w.id)?!0:n.value.has(w.id)}function l(w){return r.value.has(w.id)}function u(w){var A;if(((A=w.commandExecution)==null?void 0:A.status)==="inProgress")return;const I=new Set(n.value);I.has(w.id)?I.delete(w.id):I.add(w.id),n.value=I}function c(w){const I=new Set(s.value);I.has(w.id)?I.delete(w.id):I.add(w.id),s.value=I}function f(w){return s.value.has(w.id)}function m(w){const I=w.commandExecution;if(!I)return"";switch(I.status){case"inProgress":return"⟳ Running";case"completed":return I.exitCode===0?"✓ Completed":`✗ Exit ${I.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function S(w){var A,J;const I=(A=w.commandExecution)==null?void 0:A.status;return I==="inProgress"?"cmd-status-running":I==="completed"&&((J=w.commandExecution)==null?void 0:J.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function L(w){const I=new Set(r.value);I.add(w),r.value=I,setTimeout(()=>{const A=new Set(r.value);A.delete(w),r.value=A},1e3)}function O(w,I){const A=[];for(let J=I-1;J>=0;J--){const y=w[J];if(y.messageType==="commandExecution")A.unshift(y);else if(y.role==="user"||y.messageType==="worked")break}return A}const V=e,R=t,P=N(null),B=N(null),F=N(null),ne=N(""),oe=N(null),we=N({}),Se=N({}),ue=N(null);let ce=0,be=0,K=0,ke=!0;const Ne=new WeakSet,Ue=N(new Set),Ce=N(!1),$e=N(0),De=N(0),ze=N(""),tt=N("");function Oe(w){if(!w||w.endsWith("/")||w.endsWith("\\"))return!1;if(w.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(w))return!1;const I=w.startsWith("/"),A=/^[A-Za-z]:[\\/]/u.test(w),J=w.startsWith("./")||w.startsWith("../")||w.startsWith("~/"),y=w.includes("/")||w.includes("\\");return I||A||J||y}function Qe(w){return w.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||w}function wt(w){return w.replace(/\\/gu,"/")}function ct(w){if(!w.startsWith("file://"))return w;let I=w.replace(/^file:\/\//u,"");try{I=decodeURIComponent(I)}catch{}return/^\/[A-Za-z]:\//u.test(I)&&(I=I.slice(1)),I}function Ze(w){const I=wt(w),A=I.match(/^\/Users\/([^/]+)/u);if(A)return`/Users/${A[1]}`;const J=I.match(/^\/home\/([^/]+)/u);return J?`/home/${J[1]}`:""}function Je(w){const I=wt(w);if(!I)return I;let A="",J=I;const y=J.match(/^([A-Za-z]:)(\/.*)?$/u);y?(A=`${y[1]}/`,J=(y[2]??"").replace(/^\/+/u,"")):J.startsWith("/")&&(A="/",J=J.slice(1));const C=J.split("/").filter(Boolean),j=[];for(const Ae of C)if(Ae!=="."){if(Ae===".."){j.length>0&&j.pop();continue}j.push(Ae)}const te=j.join("/");return A?`${A}${te}`.replace(/\/+$/u,"")||A:te||I}function X(w,I){const A=wt(ct(w.trim()));if(!A)return"";if(A.startsWith("/")||/^[A-Za-z]:\//u.test(A))return Je(A);if(A.startsWith("~/")){const C=Ze(I);if(C)return Je(`${C}/${A.slice(2)}`)}const y=wt(I.trim());return Je(y?`${y.replace(/\/+$/u,"")}/${A}`:A)}function de(w){if(!w)return null;let I=w.trim();I=fe(I).core.trim();let J=null;const y=I.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(y)I=y[1],J=Number(y[2]);else{const C=I.match(/^(.*):(\d+)(?::\d+)?$/u);C&&(I=C[1],J=Number(C[2]))}return I=ct(I),Oe(I)?{path:I,line:J}:null}function fe(w){let I=w,A="",J="";for(;/^['"`“‘]/u.test(I);)A+=I[0],I=I.slice(1);for(;/['"`”’]$/u.test(I);)J=I.slice(-1)+J,I=I.slice(0,-1);return{core:I,leading:A,trailing:J}}function Ie(w){const I=w.trim(),A=Te(I,0);if(!A||A.end!==I.length)return null;const J=A.label.trim(),y=A.target.trim(),C=fe(J).core.trim()||J,j=fe(y).core.trim();return j?{label:C,target:j}:null}function Te(w,I){if(w[I]!=="[")return null;const A=w.indexOf("](",I+1);if(A<0)return null;const J=w.slice(I+1,A);if(!J||J.includes(`
26
- `))return null;let y=A+2,C=1;for(;y<w.length;){const j=w[y];if(j===`
27
- `)return null;if(j==="(")C+=1;else if(j===")"&&(C-=1,C===0)){const te=w.slice(A+2,y);return te.trim()?{label:J,target:te,end:y+1}:null}y+=1}return null}function b(w){const I=[],A=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let J=0;for(const y of w.matchAll(A)){if(typeof y.index!="number")continue;const C=y.index,j=C+y[0].length;C>J&&I.push({kind:"text",value:w.slice(J,C)});let te=y[0],Ae="";for(;/[.,;:]$/u.test(te);)Ae=te.slice(-1)+Ae,te=te.slice(0,-1);const Xe=fe(te);te=Xe.core;const ut=Xe.leading,Rt=Xe.trailing+Ae;if(ut&&I.push({kind:"text",value:ut}),te.startsWith("**")&&te.endsWith("**")&&te.length>4)I.push({kind:"bold",value:te.slice(2,-2)}),Rt&&I.push({kind:"text",value:Rt});else if(/^https?:\/\//u.test(te))I.push({kind:"url",value:te,href:te}),Rt&&I.push({kind:"text",value:Rt});else{const k=de(te);k?(I.push({kind:"file",value:te,path:k.path,displayPath:te,downloadName:Qe(k.path)}),Rt&&I.push({kind:"text",value:Rt})):I.push({kind:"text",value:y[0]})}J=j}return J<w.length&&I.push({kind:"text",value:w.slice(J)}),T(I)}function T(w){const I=[];let A=!1,J="";const y=C=>{C&&I.push({kind:"text",value:C})};for(const C of w){if(C.kind!=="text"){A&&(y(`**${J}`),A=!1,J=""),I.push(C);continue}let j=C.value;for(;j.length>0;){const te=j.indexOf("**");if(te<0){A?J+=j:y(j);break}const Ae=j.slice(0,te);A?J+=Ae:y(Ae),j=j.slice(te+2),A?(J.length>0?I.push({kind:"bold",value:J}):y("****"),J="",A=!1):A=!0}}return A&&y(`**${J}`),I}function M(w){const I=[];let A=0;for(;A<w.length;){const J=w.indexOf("[",A);if(J<0)break;const y=Te(w,J);if(!y){A=J+1;continue}J>A&&I.push(...b(w.slice(A,J)));const C=fe(y.label.trim()).core.trim()||y.label.trim(),j=fe(y.target.trim()).core.trim();if(/^https?:\/\//u.test(j))I.push({kind:"url",value:C||j,href:j});else{const te=de(j);te?I.push({kind:"file",value:j,path:te.path,displayPath:C||j,downloadName:Qe(te.path)}):I.push({kind:"text",value:w.slice(J,y.end)})}A=y.end}return A<w.length&&I.push(...b(w.slice(A))),I}function Y(w){if(!w.includes("`"))return M(w);const I=[];let A=0,J=0;for(;A<w.length;){if(w[A]!=="`"){A+=1;continue}let y=1;for(;A+y<w.length&&w[A+y]==="`";)y+=1;const C="`".repeat(y);let j=A+y,te=-1;for(;j<w.length;){const Xe=w.indexOf(C,j);if(Xe<0)break;const ut=Xe>0&&w[Xe-1]==="`",Rt=Xe+y<w.length&&w[Xe+y]==="`",k=w.slice(A+y,Xe).includes(`
28
- `);if(!ut&&!Rt&&!k){te=Xe;break}j=Xe+1}if(te<0){A+=y;continue}A>J&&I.push(...M(w.slice(J,A)));const Ae=w.slice(A+y,te);if(Ae.length>0){const Xe=Ie(Ae);if(Xe)if(/^https?:\/\//u.test(Xe.target))I.push({kind:"url",value:Xe.label||Xe.target,href:Xe.target});else{const ut=de(Xe.target);ut?I.push({kind:"file",value:Xe.target,path:ut.path,displayPath:Xe.label||Xe.target,downloadName:Qe(ut.path)}):I.push({kind:"code",value:Ae})}else{const ut=de(Ae);if(ut){const Rt=ut.line?`${ut.path}:${String(ut.line)}`:ut.path;I.push({kind:"file",value:Ae,path:ut.path,displayPath:Rt,downloadName:Qe(ut.path)})}else I.push({kind:"code",value:Ae})}}else I.push({kind:"text",value:`${C}${C}`});A=te+y,J=A}return J<w.length&&I.push(...M(w.slice(J))),I}function ee(w){const I=w.trim();if(!I)return"";if(I.startsWith("data:")||I.startsWith("blob:")||I.startsWith("http://")||I.startsWith("https://")||I.startsWith("/codex-local-image?"))return I;if(I.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(I)}`;const A=I.startsWith("/"),J=/^[A-Za-z]:[\\/]/u.test(I);return A||J?`/codex-local-image?path=${encodeURIComponent(I)}`:I}function H(w){const I=w.trim();if(!I)return"#";const A=j=>j.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(j),J=de(I),y=(J==null?void 0:J.path)??I,C=X(y,V.cwd);if(A(C)){const j=C.startsWith("/")?C:`/${C}`;return`/codex-local-browse${encodeURI(j)}`}return"#"}function G(w){const I=w.trim();if(!I)return"#";const A=de(I),J=(A==null?void 0:A.path)??I,y=X(J,V.cwd);if(!(te=>te.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(te))(y))return"#";const j=y.startsWith("/")?y:`/${y}`;return`/codex-local-edit${encodeURI(j)}`}const W=ie(()=>({left:`${String($e.value)}px`,top:`${String(De.value)}px`}));function q(w,I){const A=H(I);if(A==="#")return;ze.value=A;const J=G(I);tt.value=J==="#"?"":J,$e.value=w.clientX,De.value=w.clientY,Ce.value=!0}function z(w,I){const A=I.trim();A&&(ze.value=A,tt.value="",$e.value=w.clientX,De.value=w.clientY,Ce.value=!0)}function me(){Ce.value&&(Ce.value=!1)}function ve(){const w=ze.value;me(),!(!w||w==="#")&&window.open(w,"_blank","noopener,noreferrer")}function ye(){const w=tt.value;me(),!(!w||w==="#")&&window.open(w,"_blank","noopener,noreferrer")}async function Re(){const w=ze.value;if(me(),!(!w||w==="#"))try{await navigator.clipboard.writeText(w)}catch{const I=document.createElement("textarea");I.value=w,I.setAttribute("readonly","true"),I.style.position="fixed",I.style.opacity="0",document.body.appendChild(I),I.select(),document.execCommand("copy"),document.body.removeChild(I)}}function We(w){if(!Ce.value)return;const I=oe.value;if(!I){me();return}const A=w.target;A instanceof Node&&I.contains(A)||me()}function Fe(){me()}function Me(w){w.key==="Escape"&&me()}function Ye(w){if(!w.includes("![")||!w.includes("]("))return[{kind:"text",value:w}];const I=[],A=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let J=0;for(const y of w.matchAll(A)){const[C,j,te]=y;if(typeof y.index!="number")continue;const Ae=y.index,Xe=Ae+C.length,ut=ee(te.trim());ut&&(Ae>J&&I.push({kind:"text",value:w.slice(J,Ae)}),I.push({kind:"image",url:ut,alt:j.trim(),markdown:C}),J=Xe)}return J<w.length&&I.push({kind:"text",value:w.slice(J)}),I.length>0?I:[{kind:"text",value:w}]}function et(w){return w!==null&&typeof w=="object"&&!Array.isArray(w)?w:null}function xt(w){const I=new Date(w);return Number.isNaN(I.getTime())?w:I.toLocaleTimeString()}function ft(w){const I=et(w.params),A=I==null?void 0:I.reason;return typeof A=="string"?A.trim():""}function Ct(w,I){return`${String(w)}:${I}`}function Lt(w){const I=et(w.params),A=Array.isArray(I==null?void 0:I.questions)?I.questions:[],J=[];for(const y of A){const C=et(y);if(!C)continue;const j=typeof C.id=="string"?C.id:"";if(!j)continue;const te=Array.isArray(C.options)?C.options.map(Ae=>et(Ae)).map(Ae=>Ae==null?void 0:Ae.label).filter(Ae=>typeof Ae=="string"&&Ae.length>0):[];J.push({id:j,header:typeof C.header=="string"?C.header:"",question:typeof C.question=="string"?C.question:"",isOther:C.isOther===!0,options:te})}return J}function pt(w,I,A){const J=Ct(w,I),y=we.value[J];return typeof y=="string"&&y.length>0?y:A}function Pt(w,I){const A=Ct(w,I);return Se.value[A]??""}function mt(w,I,A){const J=A.target;if(!(J instanceof HTMLSelectElement))return;const y=Ct(w,I);we.value={...we.value,[y]:J.value}}function Vt(w,I,A){const J=A.target;if(!(J instanceof HTMLInputElement))return;const y=Ct(w,I);Se.value={...Se.value,[y]:J.value}}function nt(w,I){R("respondServerRequest",{id:w,result:{decision:I}})}function bn(w){const I=Lt(w),A={};for(const J of I){const y=pt(w.id,J.id,J.options[0]||""),C=Pt(w.id,J.id).trim(),j=[y,C].map(te=>te.trim()).filter(te=>te.length>0);A[J.id]={answers:j}}R("respondServerRequest",{id:w.id,result:{answers:A}})}function zt(w){R("respondServerRequest",{id:w,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function Mt(w){R("respondServerRequest",{id:w,result:{success:!0,contentItems:[]}})}function un(w){R("respondServerRequest",{id:w,result:{}})}function kt(w){R("respondServerRequest",{id:w,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function It(w){return!(w.role!=="user"&&w.role!=="assistant"||typeof w.turnIndex!="number"||V.isTurnInProgress||V.isRollingBack)}function en(w){return w.role!=="user"&&w.role!=="assistant"?!1:w.text.trim().length>0}function jt(w){return en(w)||It(w)}async function At(w){if(!en(w))return;const I=w.text.trim();try{await navigator.clipboard.writeText(I)}catch{const A=document.createElement("textarea");A.value=I,A.setAttribute("readonly","true"),A.style.position="fixed",A.style.opacity="0",document.body.appendChild(A),A.select(),document.execCommand("copy"),document.body.removeChild(A)}}function Gt(w){if(!It(w))return;const I=w.role==="user"?w.text.trim():"";R("rollback",{turnIndex:w.turnIndex,prependText:I.length>0?I:void 0})}function In(){const w=P.value,I=B.value;!w||!I||(w.scrollTop=w.scrollHeight,I.scrollIntoView({block:"end"}))}function $t(w){return w.scrollHeight-(w.scrollTop+w.clientHeight)<=d_}function En(w){const I=Math.max(w.scrollHeight-w.clientHeight,0),A=I>0?Math.min(Math.max(w.scrollTop/I,0),1):1;return{scrollTop:w.scrollTop,isAtBottom:$t(w),scrollRatio:A}}function Yt(){return ue.value??V.scrollState}function He(w){const I=En(w);ue.value=I,V.activeThreadId&&R("updateScrollState",{threadId:V.activeThreadId,state:I})}function Le(){const w=P.value;if(!w)return;const I=Yt();if(!I||I.isAtBottom){qt();return}const A=Math.max(w.scrollHeight-w.clientHeight,0),J=I.scrollTop;w.scrollTop=Math.min(Math.max(J,0),A),He(w)}function qt(){const w=P.value;w&&(In(),He(w))}function dn(){const w=Yt();return!w||w.isAtBottom===!0}function Pn(){if(!dn()){K=0,be=0;return}if(qt(),K-=1,K<=0){be=0;return}be=requestAnimationFrame(Pn)}function _n(w=6){dn()&&(be&&(cancelAnimationFrame(be),be=0),K=Math.max(w,1),be=requestAnimationFrame(Pn))}function Kt(){_n(3)}function Ut(){if(!dn())return;const w=P.value;if(!w)return;const I=w.querySelectorAll("img.message-image-preview");for(const A of I)A.complete||Ne.has(A)||(Ne.add(A),A.addEventListener("load",Kt,{once:!0}),A.addEventListener("error",Kt,{once:!0}))}async function tn(w={}){const I=w.restoreSavedState??ke;await Xt(),ce&&cancelAnimationFrame(ce),ce=requestAnimationFrame(()=>{ce=0;const A=P.value;I?(Le(),ke=!1):dn()?qt():A&&He(A),Ut(),_n()})}at(()=>V.messages,async w=>{if(!V.isLoading){for(const I of w){if(I.messageType!=="commandExecution"||!I.commandExecution)continue;const A=o.value[I.id],J=I.commandExecution.status;A==="inProgress"&&J!=="inProgress"&&L(I.id),o.value[I.id]=J}await tn()}}),at(()=>V.liveOverlay,async w=>{if(!w){await tn();return}await tn()},{deep:!0}),at(()=>V.isLoading,async w=>{w||await tn({restoreSavedState:!0})}),at(()=>V.activeThreadId,async()=>{ke=!0,ue.value=null,ne.value="",me(),Ue.value=new Set,await tn({restoreSavedState:!0})},{flush:"post"}),at(Ce,w=>{if(w){window.addEventListener("pointerdown",We,{capture:!0}),window.addEventListener("blur",Fe),window.addEventListener("keydown",Me);return}window.removeEventListener("pointerdown",We,{capture:!0}),window.removeEventListener("blur",Fe),window.removeEventListener("keydown",Me)});function fn(){const w=P.value;!w||V.isLoading||He(w)}function Un(w){ne.value=ee(w)}function Mn(w,I){return`${w}:${String(I)}`}function $n(w,I){const A=new Set(Ue.value);A.add(Mn(w,I)),Ue.value=A}function kn(w,I){return Ue.value.has(Mn(w,I))}function Cn(){ne.value=""}function On(){const w=F.value;w&&(w.scrollTop=w.scrollHeight)}return at(()=>{var w;return(w=V.liveOverlay)==null?void 0:w.reasoningText},async w=>{w&&(await Xt(),On())}),Ar(()=>{ce&&cancelAnimationFrame(ce),be&&cancelAnimationFrame(be),window.removeEventListener("pointerdown",We,{capture:!0}),window.removeEventListener("blur",Fe),window.removeEventListener("keydown",Me)}),(w,I)=>(v(),E("section",Uw,[e.isLoading?(v(),E("p",Fw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(v(),E("p",Bw," No messages in this thread yet. ")):(v(),E("ul",{key:2,ref_key:"conversationListRef",ref:P,class:"conversation-list",onScroll:fn},[(v(!0),E(Ve,null,_t(e.pendingRequests,A=>(v(),E("li",{key:`server-request:${A.id}`,class:"conversation-item conversation-item-request"},[h("div",Hw,[h("div",Ww,[h("article",Vw,[h("p",zw,ae(A.method),1),h("p",Gw,"Request #"+ae(A.id)+" · "+ae(xt(A.receivedAtIso)),1),ft(A)?(v(),E("p",qw,ae(ft(A)),1)):le("",!0),A.method==="item/commandExecution/requestApproval"?(v(),E("section",Kw,[h("button",{type:"button",class:"request-button request-button-primary",onClick:J=>nt(A.id,"accept")},"Accept",8,Jw),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"acceptForSession")},"Accept for Session",8,Yw),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"decline")},"Decline",8,Xw),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"cancel")},"Cancel",8,Qw)])):A.method==="item/fileChange/requestApproval"?(v(),E("section",Zw,[h("button",{type:"button",class:"request-button request-button-primary",onClick:J=>nt(A.id,"accept")},"Accept",8,eb),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"acceptForSession")},"Accept for Session",8,tb),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"decline")},"Decline",8,nb),h("button",{type:"button",class:"request-button",onClick:J=>nt(A.id,"cancel")},"Cancel",8,rb)])):A.method==="item/tool/requestUserInput"?(v(),E("section",sb,[(v(!0),E(Ve,null,_t(Lt(A),J=>(v(),E("div",{key:`${A.id}:${J.id}`,class:"request-question"},[h("p",ob,ae(J.header||J.question),1),J.header&&J.question?(v(),E("p",ib,ae(J.question),1)):le("",!0),h("select",{class:"request-select",value:pt(A.id,J.id,J.options[0]||""),onChange:y=>mt(A.id,J.id,y)},[(v(!0),E(Ve,null,_t(J.options,y=>(v(),E("option",{key:`${A.id}:${J.id}:${y}`,value:y},ae(y),9,lb))),128))],40,ab),J.isOther?(v(),E("input",{key:1,class:"request-input",type:"text",value:Pt(A.id,J.id),placeholder:"Other answer",onInput:y=>Vt(A.id,J.id,y)},null,40,cb)):le("",!0)]))),128)),h("button",{type:"button",class:"request-button request-button-primary",onClick:J=>bn(A)}," Submit Answers ",8,ub)])):A.method==="item/tool/call"?(v(),E("section",db,[h("button",{type:"button",class:"request-button request-button-primary",onClick:J=>zt(A.id)},"Fail Tool Call",8,fb),h("button",{type:"button",class:"request-button",onClick:J=>Mt(A.id)},"Success (Empty)",8,hb)])):(v(),E("section",pb,[h("button",{type:"button",class:"request-button request-button-primary",onClick:J=>un(A.id)},"Return Empty Result",8,mb),h("button",{type:"button",class:"request-button",onClick:J=>kt(A.id)},"Reject Request",8,gb)]))])])])]))),128)),(v(!0),E(Ve,null,_t(e.messages,A=>{var J,y;return v(),E("li",{key:A.id,class:st(["conversation-item",{"conversation-item-actionable":jt(A)}]),"data-role":A.role,"data-message-type":A.messageType||""},[i(A)?(v(),E("div",yb,[h("div",wb,[h("button",{type:"button",class:st(["cmd-row",[S(A),{"cmd-expanded":a(A)}]]),onClick:C=>u(A)},[h("span",{class:st(["cmd-chevron",{"cmd-chevron-open":a(A)}])},"▶",2),h("span",_b,ae(m(A)),1),h("code",kb,ae(((J=A.commandExecution)==null?void 0:J.command)||"(command)"),1)],10,bb),h("div",{class:st(["cmd-output-wrap",{"cmd-output-visible":a(A),"cmd-output-collapsing":l(A)}])},[h("div",Tb,[h("pre",Sb,ae(((y=A.commandExecution)==null?void 0:y.aggregatedOutput)||"(no output)"),1)])],2)])])):(v(),E("div",{key:1,class:"message-row","data-role":A.role,"data-message-type":A.messageType||""},[h("div",{class:"message-stack","data-role":A.role},[h("article",{class:"message-body","data-role":A.role},[A.images&&A.images.length>0?(v(),E("ul",{key:0,class:"message-image-list","data-role":A.role},[(v(!0),E(Ve,null,_t(A.images,C=>(v(),E("li",{key:C,class:"message-image-item"},[h("button",{class:"message-image-button",type:"button",onClick:j=>Un(C)},[h("img",{class:"message-image-preview",src:ee(C),alt:"Message image preview",loading:"lazy"},null,8,Rb)],8,xb)]))),128))],8,Ab)):le("",!0),A.fileAttachments&&A.fileAttachments.length>0?(v(),E("div",Pb,[(v(!0),E(Ve,null,_t(A.fileAttachments,C=>(v(),E("span",{key:C.path,class:"message-file-chip"},[I[2]||(I[2]=h("span",{class:"message-file-chip-icon"},"📄",-1)),h("span",Mb,[h("a",{class:"message-file-link message-file-chip-name",href:H(C.path),target:"_blank",rel:"noopener noreferrer",title:C.path,onContextmenu:rt(j=>q(j,C.path),["prevent"])},ae(C.path),41,$b)])]))),128))])):le("",!0),A.text.length>0?(v(),E("article",{key:2,class:"message-card","data-role":A.role},[A.messageType==="worked"?(v(),E("div",Nb,[h("button",{type:"button",class:"worked-separator",onClick:C=>c(A)},[I[3]||(I[3]=h("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),h("span",{class:st(["worked-chevron",{"worked-chevron-open":f(A)}])},"▶",2),h("p",Lb,ae(A.text),1),I[4]||(I[4]=h("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Db),f(A)?(v(),E("div",jb,[(v(!0),E(Ve,null,_t(O(e.messages,e.messages.indexOf(A)),C=>{var j,te;return v(),E("div",{key:`worked-cmd-${C.id}`,class:"worked-cmd-item"},[h("button",{type:"button",class:st(["cmd-row",[S(C),{"cmd-expanded":a(C)}]]),onClick:Ae=>u(C)},[h("span",{class:st(["cmd-chevron",{"cmd-chevron-open":a(C)}])},"▶",2),h("span",Fb,ae(m(C)),1),h("code",Bb,ae(((j=C.commandExecution)==null?void 0:j.command)||"(command)"),1)],10,Ub),h("div",{class:st(["cmd-output-wrap",{"cmd-output-visible":a(C),"cmd-output-collapsing":l(C)}])},[h("div",Hb,[h("pre",Wb,ae(((te=C.commandExecution)==null?void 0:te.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):le("",!0)])):(v(),E("div",Vb,[(v(!0),E(Ve,null,_t(Ye(A.text),(C,j)=>(v(),E(Ve,{key:`block-${j}`},[C.kind==="text"?(v(),E("p",zb,[(v(!0),E(Ve,null,_t(Y(C.value),(te,Ae)=>(v(),E(Ve,{key:`seg-${j}-${Ae}`},[te.kind==="text"?(v(),E("span",Gb,ae(te.value),1)):te.kind==="bold"?(v(),E("strong",qb,ae(te.value),1)):te.kind==="file"?(v(),E("span",Kb,[h("a",{class:"message-file-link",href:H(te.path),target:"_blank",rel:"noopener noreferrer",title:te.path,onContextmenu:rt(Xe=>q(Xe,te.path),["prevent"])},ae(te.displayPath),41,Jb)])):te.kind==="url"?(v(),E("a",{key:3,class:"message-file-link",href:te.href,target:"_blank",rel:"noopener noreferrer",title:te.href,onContextmenu:rt(Xe=>z(Xe,te.href),["prevent"])},ae(te.value),41,Yb)):(v(),E("code",Xb,ae(te.value),1))],64))),128))])):kn(A.id,j)?(v(),E("p",Qb,ae(C.markdown),1)):(v(),E("button",{key:2,class:"message-image-button",type:"button",onClick:te=>Un(C.url)},[h("img",{class:"message-image-preview message-markdown-image",src:C.url,alt:C.alt||"Embedded message image",loading:"lazy",onError:te=>$n(A.id,j)},null,40,e_)],8,Zb))],64))),128))]))],8,Ob)):le("",!0)],8,Cb),jt(A)?(v(),E("div",t_,[en(A)?(v(),E("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:C=>At(A)},[Pe(jw,{class:"message-action-icon"}),I[5]||(I[5]=h("span",{class:"message-action-label"},"Copy",-1))],8,n_)):le("",!0),It(A)?(v(),E("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:C=>Gt(A)},[Pe(Ow,{class:"message-action-icon"}),I[6]||(I[6]=h("span",{class:"message-action-label"},"Rollback",-1))],8,r_)):le("",!0)])):le("",!0)],8,Eb)],8,Ib))],10,vb)}),128)),e.liveOverlay?(v(),E("li",s_,[h("div",o_,[h("div",i_,[h("article",a_,[h("p",l_,ae(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(v(),E("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:F},ae(e.liveOverlay.reasoningText),513)):le("",!0),e.liveOverlay.errorText?(v(),E("p",c_,ae(e.liveOverlay.errorText),1)):le("",!0)])])])])):le("",!0),h("li",{ref_key:"bottomAnchorRef",ref:B,class:"conversation-bottom-anchor"},null,512)],544)),ne.value.length>0?(v(),E("div",{key:3,class:"image-modal-backdrop",onClick:Cn},[h("div",{class:"image-modal-content",onClick:I[0]||(I[0]=rt(()=>{},["stop"]))},[h("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Cn},[Pe(Ol,{class:"icon-svg"})]),h("img",{class:"image-modal-image",src:ne.value,alt:"Expanded message image"},null,8,u_)])])):le("",!0),Ce.value?(v(),E("div",{key:4,ref_key:"fileLinkContextMenuRef",ref:oe,class:"file-link-context-menu",style:Fr(W.value),onClick:I[1]||(I[1]=rt(()=>{},["stop"]))},[h("button",{type:"button",class:"file-link-context-menu-item",onClick:ve}," Open link "),h("button",{type:"button",class:"file-link-context-menu-item",onClick:Re}," Copy link "),tt.value?(v(),E("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:ye}," Edit file ")):le("",!0)],4)):le("",!0)]))}}),h_=lt(f_,[["__scopeId","data-v-323c3b9d"]]),iu=.0025,va=3,au=2,p_=256;function m_(e){var be;const t=N("idle"),n=N(typeof navigator<"u"&&!!((be=navigator.mediaDevices)!=null&&be.getUserMedia)),r=N(0),s=N(null);let o=null,i=null,a=[],l=null,u=null,c=null,f=null,m=[],S=!1,L=!1,O=null;function V(){O&&(O.abort(),O=null),t.value==="transcribing"&&(t.value="idle")}function R(){const K=s.value;if(!K||typeof window>"u")return;const ke=K.getContext("2d");if(!ke)return;const Ne=Math.max(1,Math.floor(K.clientWidth)),Ue=Math.max(1,Math.floor(K.clientHeight||36)),Ce=window.devicePixelRatio||1,$e=Math.max(1,Math.floor(Ne*Ce)),De=Math.max(1,Math.floor(Ue*Ce));(K.width!==$e||K.height!==De)&&(K.width=$e,K.height=De),ke.setTransform(Ce,0,0,Ce,0,0),ke.clearRect(0,0,Ne,Ue);const ze=Math.max(12,Math.floor(Ne/(va+au))),tt=m.slice(-ze),Oe=Math.max(0,ze-tt.length),Qe=Ue/2,wt=getComputedStyle(K).color||"#000000";for(let ct=0;ct<ze;ct+=1){const Ze=tt[ct-Oe]??0,X=Math.max(.08,Math.min(1,Ze*18))*Qe,de=ct*(va+au);ke.globalAlpha=Ze<=iu?.35:1,ke.fillStyle=wt,ke.fillRect(de,Qe-X,va,X*2)}ke.globalAlpha=1}function P(){m=[],r.value=0,R()}function B(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),u&&(u.disconnect(),u=null),l&&(l.close(),l=null),f=null}function F(K){if(typeof window>"u")return;const ke=window.webkitAudioContext,Ne=window.AudioContext??ke;Ne&&(B(),P(),l=new Ne,u=l.createMediaStreamSource(K),c=l.createScriptProcessor(2048,1,1),f=performance.now(),c.onaudioprocess=Ue=>{const Ce=Ue.inputBuffer.getChannelData(0);let $e=0;for(let De=0;De<Ce.length;De+=1){const ze=Math.abs(Ce[De]??0);$e+=ze<iu?0:ze}m.push($e/Ce.length),m.length>p_&&m.shift(),f!==null&&(r.value=Math.max(0,performance.now()-f)),R()},u.connect(c),c.connect(l.destination),R())}async function ne(){var K;if(t.value==="transcribing"&&V(),!(t.value!=="idle"||!n.value||S)){S=!0,L=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=ke=>{ke.data.size>0&&a.push(ke.data)},o.onstop=()=>{var Ue;const ke=a,Ne=(o==null?void 0:o.mimeType)||((Ue=ke[0])==null?void 0:Ue.type)||"audio/webm";ue(),Se(ke,Ne)},F(i),o.start(250),t.value="recording",L&&oe()}catch(ke){ue(),t.value="idle",(K=e.onError)==null||K.call(e,ke)}finally{S=!1}}}function oe(){if(S&&t.value==="idle"){L=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function we(){L=!1,V(),ue(),t.value="idle"}async function Se(K,ke){var Ce,$e,De,ze,tt;if(K.length===0){(Ce=e.onEmpty)==null||Ce.call(e),t.value="idle";return}const Ne=new Blob(K,{type:ke});t.value="transcribing";let Ue=null;try{const Oe=ke.split(/[/;]/)[1]??"webm",Qe=new FormData;Qe.append("file",Ne,`codex.${Oe}`);const wt=(($e=e.getLanguage)==null?void 0:$e.call(e).trim())??"";wt&&wt.toLowerCase()!=="auto"&&Qe.append("language",wt),Ue=new AbortController,O=Ue;const ct=await fetch("/codex-api/transcribe",{method:"POST",body:Qe,signal:Ue.signal}),Ze=await ct.text();let Je=null;try{Je=Ze.trim()?JSON.parse(Ze):null}catch{Je=null}if(!ct.ok){const de=(De=Je==null?void 0:Je.error)==null?void 0:De.trim(),fe=Ze.trim();throw new Error(de||fe||`Transcription failed: ${ct.status}`)}const X=((Je==null?void 0:Je.text)??"").trim();X.length>0?e.onTranscript(X):(ze=e.onEmpty)==null||ze.call(e)}catch(Oe){if(Oe instanceof DOMException&&Oe.name==="AbortError")return;(tt=e.onError)==null||tt.call(e,Oe)}finally{Ue&&O===Ue&&(O=null),t.value==="transcribing"&&(t.value="idle")}}function ue(){B(),P(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(K=>K.stop()),i=null),a=[]}Ar(()=>{we()});function ce(){if(t.value==="recording"){oe();return}(t.value==="idle"||t.value==="transcribing")&&ne()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ne,stopRecording:oe,toggleRecording:ce,cancel:we}}function lu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class wr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Nl(e,t){const n=lu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=lu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function us(e,t,n){return e instanceof wr?e:e instanceof Error?new wr(e.message||t,{code:"unknown_error",method:n}):new wr(t,{code:"unknown_error",method:n})}function Uf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function g_(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new wr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let s=null;try{s=await r.json()}catch{s=null}if(!r.ok)throw new wr(Nl(s,`RPC ${e} failed with HTTP ${r.status}`),{code:"http_error",method:e,status:r.status});const o=s;if(!o||typeof o!="object"||!("result"in o))throw new wr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function cu(e){const t=Uf(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function v_(e){if(typeof window>"u")return()=>{};let t=null,n=!1;const r=()=>{if(typeof EventSource>"u"||n)return;const s=new EventSource("/codex-api/events");s.onmessage=o=>{try{const i=JSON.parse(o.data),a=cu(i);a&&e(a)}catch{}},t=()=>s.close()};if(typeof WebSocket<"u"){const s=window.location.protocol==="https:"?"wss:":"ws:",o=new WebSocket(`${s}//${window.location.host}/codex-api/ws`);let i=!1,a=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,a!==null&&(window.clearTimeout(a),a=null)},o.onmessage=l=>{try{const u=JSON.parse(String(l.data)),c=cu(u);c&&e(c)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{a!==null&&(window.clearTimeout(a),a=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function y_(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new wr(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new wr(Nl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function w_(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new wr(Nl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Uf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function b_(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Rn(e){return b_(e)}function __(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function k_(e){const t=Rn(e).replace(/[\\/]+/gu,"/");return __(t)?t.toLowerCase():t}function ws(e){const t=Rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function uu(e){const t=Rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Eo(e){return ws(e)||Rn(e)||"unknown-project"}function du(e){return new Date(e*1e3).toISOString()}function T_(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const S_=/^##\s+(.+?):\s+(.+?)\s*$/,I_=/^#\s*files mentioned by the user\s*:?\s*$/i;function E_(e){var s,o;const t=e.split(`
29
- `).findIndex(i=>I_.test(i.trim()));if(t<0)return[];const n=e.split(`
30
- `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(S_);if(!l)break;const u=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&c&&r.push({label:u,path:c})}return r}function C_(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const s=r.index+r[0].length;return e.slice(s).trim()}function A_(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:T_(l),isUnhandled:!0});const o=n.join(`
31
- `),i=E_(o);return{text:C_(o),images:r,fileAttachments:i,rawBlocks:s}}function x_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=A_(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="reasoning")return[];if(e.type==="commandExecution"){const t=e,n=R_(t.status),r=typeof t.command=="string"?t.command:"",s=typeof t.cwd=="string"?t.cwd:null,o=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",i=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:s,status:n,aggregatedOutput:o,exitCode:i}}]}return[]}function R_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function P_(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function M_(e){const t=P_(e);return t.length>0?t:"Untitled thread"}function Ff(e){return(e==null?void 0:e.status)==="inProgress"}function $_(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Ff(r)}function O_(e){const t=e,n=Rn(typeof t.cwd=="string"?t.cwd:e.cwd),r=k_(n),s=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:M_(e),projectName:Eo(n),cwd:n,hasWorktree:s,createdAtIso:du(e.createdAt),updatedAtIso:du(e.updatedAt),preview:e.preview,unread:!1,inProgress:$_(e)}}function N_(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,a;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((a=r.threads[0])==null?void 0:a.updatedAtIso)??0).getTime()-s})}function D_(e){const t=e.data.map(O_);return N_(t)}function Bf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=Array.isArray(s.items)?s.items:[];for(const i of o)for(const a of x_(i))n.push({...a,turnIndex:r})}return n}function L_(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Ff(t.at(-1))}function fu(e,t){const n=t.trim();if(!n)return"";const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),[s="",o=""]=e.split("/",2),i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=s&&o?`${i}\\s*/\\s*${a}`:r;return n.replace(/^[★☆*\s:|\-]+/u,"").replace(/^(sponsor|star)\s+/i,"").replace(new RegExp(`^${r}\\s*[-:|]*\\s*`,"i"),"").replace(new RegExp(`^${l}\\s*[-:|]*\\s*`,"i"),"").replace(/^(sponsor|star)\s+/i,"").trim()}async function Zt(e,t){try{return await g_(e,t)}catch(n){throw us(n,`RPC ${e} failed`,e)}}function j_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function U_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function F_(){const e=await Zt("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return D_(e)}async function B_(e){const t=await Zt("thread/read",{threadId:e,includeTurns:!0});return{messages:Bf(t),inProgress:L_(t)}}async function H_(){try{return await F_()}catch(e){throw us(e,"Failed to load thread groups","thread/list")}}async function W_(e){try{return await B_(e)}catch(t){throw us(t,`Failed to load thread ${e}`,"thread/read")}}function V_(e){return v_(e)}async function z_(e,t){await y_({id:e,...t})}async function G_(){return w_()}async function ya(e){await Zt("thread/resume",{threadId:e})}async function q_(e){await Zt("thread/archive",{threadId:e})}async function K_(e,t){await Zt("thread/name/set",{threadId:e,name:t})}async function hu(e,t){const n=await Zt("thread/rollback",{threadId:e,numTurns:t});return Bf(n)}function Hf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}async function pu(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await Zt("thread/start",n),s=Hf(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw us(n,"Failed to start a new thread","thread/start")}}async function J_(e,t,n){try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const s={threadId:r};typeof t=="string"&&t.trim().length>0&&(s.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(s.model=n.trim());const o=await Zt("thread/fork",s),i=Hf(o);if(!i)throw new Error("thread/fork did not return a thread id");return i}catch(r){throw us(r,`Failed to fork thread ${e}`,"thread/fork")}}function Y_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
32
- `;for(const r of t)n+=`
33
- ## ${r.label}: ${r.path}
34
- `;return`${n}
35
- ## My request for Codex:
36
-
37
- ${e}
38
- `}async function wa(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:Y_(t,i)}];for(const f of n){const m=f.trim();m&&l.push({type:"image",url:m,image_url:m})}if(o)for(const f of o)l.push({type:"skill",name:f.name,path:f.path});const u=i.map(f=>({label:f.label,path:f.path,fsPath:f.fsPath})),c={threadId:e,input:l};u.length>0&&(c.attachments=u),typeof r=="string"&&r.length>0&&(c.model=r),typeof s=="string"&&s.length>0&&(c.effort=s),await Zt("turn/start",c)}catch(a){throw us(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function X_(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await Zt("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw us(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function Q_(e){await Zt("setDefaultModel",{model:e})}async function Z_(e){const t=e==="fast"?"fast":"standard";await Zt("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function ek(){const e=await Zt("model/list",{}),t=[];for(const n of e.data){const r=n.id||n.model;!r||t.includes(r)||t.push(r)}return t}async function tk(){const e=await Zt("config/read",{}),t=e.config.model??"",n=j_(e.config.model_reasoning_effort),r=U_(e.config.service_tier);return{model:t,reasoningEffort:n,speedMode:r}}async function nk(){return await Zt("account/rateLimits/read")}function rk(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const a of o)typeof a=="string"&&a.length>0&&!i.includes(a)&&i.push(a);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r)){const a=typeof o=="string"?Rn(o):"";a.length>0&&typeof i=="string"&&(s[a]=i)}return{order:n(t.order).map(o=>Rn(o)),labels:s,active:n(t.active).map(o=>Rn(o))}}async function Qa(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return rk(n.data)}async function sk(e){const t=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e})}),n=await t.json();if(!t.ok||!n.data)throw new Error(n.error||"Failed to create worktree");return{...n.data,cwd:Rn(n.data.cwd),gitRoot:Rn(n.data.gitRoot)}}async function ok(e,t){const n=await fetch("/codex-api/worktree/auto-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to auto-commit rollback changes");return r.data}async function ik(e,t){const n=await fetch("/codex-api/worktree/rollback-to-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to rollback project to message commit");return r.data}async function mu(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function ak(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state")}async function gu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const a=Ns(r,"Failed to open project root");throw new Error(a)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?Rn(o.path):""}async function lk(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const i=Ns(r,"Failed to suggest project name");throw new Error(i)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?Rn(o.path):""}}async function ck(e,t,n=20){const r=e.trim();if(!r)return[];const s=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await s.json();if(!s.ok){const u=Ns(o,"Failed to search files");throw new Error(u)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const u of a){if(!u||typeof u!="object"||Array.isArray(u))continue;const f=u.path,m=typeof f=="string"?f.trim():"";m&&l.push({path:m})}return l}async function uk(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}async function dk(e){const t=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e})}),n=await t.json();if(!t.ok){const r=Ns(n,"Failed to connect Telegram bot");throw new Error(r)}}async function fk(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const s=Ns(t,"Failed to load Telegram status");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,lastError:typeof r.lastError=="string"?r.lastError:""}}function hk(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}async function pk(e,t=6){const n=Math.min(10,Math.max(1,Math.floor(t)));if(e.startsWith("search-")){const c=new Date;e==="search-daily"?c.setUTCDate(c.getUTCDate()-1):e==="search-weekly"?c.setUTCDate(c.getUTCDate()-7):c.setUTCDate(c.getUTCDate()-30);const f=new URLSearchParams({q:`created:>=${hk(c)}`,sort:"stars",order:"desc",per_page:String(n)}),m=await fetch(`https://api.github.com/search/repositories?${f.toString()}`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});if(!m.ok)throw new Error(`Failed to fetch GitHub search projects (${m.status})`);const S=await m.json(),L=S&&typeof S=="object"&&!Array.isArray(S)?S:{},O=Array.isArray(L.items)?L.items:[],V=[];for(const R of O){if(!R||typeof R!="object"||Array.isArray(R))continue;const P=R,B=typeof P.id=="number"?P.id:0,F=typeof P.full_name=="string"?P.full_name.trim():"",ne=typeof P.html_url=="string"?P.html_url.trim():"";if(!B||!F||!ne)continue;const[oe="",we=""]=F.split("/",2);V.push({id:B,fullName:F,owner:oe,repo:we,url:ne,description:fu(F,typeof P.description=="string"?P.description:""),language:typeof P.language=="string"?P.language.trim():"",stars:typeof P.stargazers_count=="number"?P.stargazers_count:0})}return V}const r=e==="trending-daily"?"daily":e==="trending-weekly"?"weekly":"monthly",s=new URLSearchParams({since:r,limit:String(n)}),o=await fetch(`/codex-api/github-trending?${s.toString()}`),i=await o.json();if(!o.ok){const c=Ns(i,"Failed to fetch GitHub trending projects");throw new Error(c)}const a=i&&typeof i=="object"&&!Array.isArray(i)?i:{},l=Array.isArray(a.data)?a.data:[],u=[];for(const c of l){if(!c||typeof c!="object"||Array.isArray(c))continue;const f=c,m=typeof f.id=="number"?f.id:0,S=typeof f.fullName=="string"?f.fullName.trim():"",L=typeof f.url=="string"?f.url.trim():"";if(!m||!S||!L)continue;const[O="",V=""]=S.split("/",2);u.push({id:m,fullName:S,owner:O,repo:V,url:L,description:fu(S,typeof f.description=="string"?f.description:""),language:typeof f.language=="string"?f.language.trim():"",stars:typeof f.stars=="number"?f.stars:0})}return u}function Ns(e,t){const r=(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).error;return typeof r=="string"&&r.trim().length>0?r:t}async function mk(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function ba(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function gk(e,t){var n;try{return((n=(await Zt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function vk(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await Zt("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function vu(e){try{const t=new FormData;t.append("file",e);const n=await fetch("/codex-api/upload-file",{method:"POST",body:t});return n.ok?(await n.json()).path??null:null}catch{return null}}const yk={},wk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bk(e,t){return v(),E("svg",wk,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const _k=lt(yk,[["render",bk]]),kk={},Tk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Sk(e,t){return v(),E("svg",Tk,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Ik=lt(kk,[["render",Sk]]),Ek={},Ck={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ak(e,t){return v(),E("svg",Ck,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const xk=lt(Ek,[["render",Ak]]),Rk={},Pk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Mk(e,t){return v(),E("svg",Pk,[...t[0]||(t[0]=[h("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),h("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const yu=lt(Rk,[["render",Mk]]),$k=["disabled"],Ok={class:"composer-dropdown-value"},Nk={class:"composer-dropdown-menu"},Dk={key:0,class:"composer-dropdown-search-wrap"},Lk=["placeholder","onKeydown"],jk={class:"composer-dropdown-options",role:"listbox"},Uk=["onClick"],Fk={key:0,class:"composer-dropdown-empty"},Bk={key:1,class:"composer-dropdown-add-wrap"},Hk=["placeholder","onKeydown"],Wk=Wt({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=N(null),o=N(null),i=N(null),a=N(!1),l=N(""),u=N(!1),c=N(""),f=ie(()=>{var be;const ce=n.options.find(K=>K.value===n.modelValue);return ce?ce.label:((be=n.placeholder)==null?void 0:be.trim())||""}),m=ie(()=>n.openDirection??"down"),S=ie(()=>n.enableSearch===!0),L=ie(()=>n.showAddAction===!0),O=ie(()=>{var ce;return((ce=n.searchPlaceholder)==null?void 0:ce.trim())||"Quick search projects"}),V=ie(()=>{var ce;return((ce=n.addActionLabel)==null?void 0:ce.trim())||"Add new project"}),R=ie(()=>{var ce;return((ce=n.addPlaceholder)==null?void 0:ce.trim())||"Project name or absolute path"}),P=ie(()=>{const ce=l.value.trim().toLowerCase();return ce?n.options.filter(be=>be.label.toLowerCase().includes(ce)||be.value.toLowerCase().includes(ce)):n.options});function B(){n.disabled||(a.value=!a.value)}function F(ce){r("update:modelValue",ce),a.value=!1,l.value=""}function ne(){var ce;u.value=!0,c.value=((ce=n.defaultAddValue)==null?void 0:ce.trim())||"",Xt(()=>{var be;return(be=i.value)==null?void 0:be.focus()})}function oe(){if(l.value.length>0){l.value="";return}a.value=!1}function we(){const ce=c.value.trim();ce&&(r("add",ce),u.value=!1,c.value="",a.value=!1,l.value="")}function Se(){u.value=!1,c.value="",a.value=!1,l.value=""}function ue(ce){if(!a.value)return;const be=s.value;if(!be)return;const K=ce.target;K instanceof Node&&(be.contains(K)||(a.value=!1,l.value="",u.value=!1,c.value=""))}return at(a,ce=>{if(!ce){u.value=!1,c.value="";return}S.value&&Xt(()=>{var be;return(be=o.value)==null?void 0:be.focus()})}),ar(()=>{window.addEventListener("pointerdown",ue)}),Ar(()=>{window.removeEventListener("pointerdown",ue)}),(ce,be)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[h("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:B},[e.selectedPrefixIcon?(v(),dt(di(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):le("",!0),h("span",Ok,ae(f.value),1),Pe(ji,{class:"composer-dropdown-chevron"})],8,$k),a.value?(v(),E("div",{key:0,class:st(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":m.value==="up","composer-dropdown-menu-wrap-down":m.value==="down"}])},[h("div",Nk,[S.value?(v(),E("div",Dk,[Tr(h("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":be[0]||(be[0]=K=>l.value=K),class:"composer-dropdown-search-input",type:"text",placeholder:O.value,onKeydown:vn(rt(oe,["prevent"]),["esc"])},null,40,Lk),[[Sr,l.value]])])):le("",!0),h("ul",jk,[(v(!0),E(Ve,null,_t(P.value,K=>(v(),E("li",{key:K.value},[h("button",{class:st(["composer-dropdown-option",{"is-selected":K.value===e.modelValue}]),type:"button",onClick:ke=>F(K.value)},ae(K.label),11,Uk)]))),128)),P.value.length===0?(v(),E("li",Fk," No matching projects ")):le("",!0)]),L.value?(v(),E("div",Bk,[u.value?(v(),E(Ve,{key:0},[Tr(h("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":be[1]||(be[1]=K=>c.value=K),class:"composer-dropdown-add-input",type:"text",placeholder:R.value,onKeydown:[vn(rt(we,["prevent"]),["enter"]),vn(rt(Se,["prevent"]),["esc"])]},null,40,Hk),[[Sr,c.value]]),h("div",{class:"composer-dropdown-add-actions"},[h("button",{type:"button",class:"composer-dropdown-add-btn",onClick:we},"Open"),h("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Se},"Cancel")])],64)):(v(),E("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ne},ae(V.value),1))])):le("",!0)])],2)):le("",!0)],512))}}),oo=lt(Wk,[["__scopeId","data-v-47426238"]]),Vk=["disabled"],zk={class:"search-dropdown-value"},Gk={class:"search-dropdown-search-wrap"},qk=["placeholder","onKeydown"],Kk={key:0,class:"search-dropdown-list",role:"listbox"},Jk=["onClick","onPointerenter"],Yk={class:"search-dropdown-option-check"},Xk={class:"search-dropdown-option-label"},Qk={key:0,class:"search-dropdown-option-desc"},Zk={key:1,class:"search-dropdown-empty"},e0=Wt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=N(null),o=N(null),i=N(null),a=N(!1),l=N(""),u=N(0),c=ie(()=>n.openDirection??"down"),f=ie(()=>new Set(n.selectedValues)),m=ie(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const F=n.options.find(ne=>ne.value===n.selectedValues[0]);return(F==null?void 0:F.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),S=ie(()=>{const F=l.value.toLowerCase().trim();return F?n.options.filter(ne=>{var oe;return ne.label.toLowerCase().includes(F)||(((oe=ne.description)==null?void 0:oe.toLowerCase().includes(F))??!1)}):n.options});function L(){const F=o.value,ne=s.value;if(!F||!ne||window.innerWidth>=640)return;const oe=ne.getBoundingClientRect();c.value==="up"?(F.style.setProperty("bottom",`${window.innerHeight-oe.top+8}px`,"important"),F.style.setProperty("top","auto","important")):(F.style.setProperty("top",`${oe.bottom+8}px`,"important"),F.style.setProperty("bottom","auto","important"))}function O(){n.disabled||(a.value=!a.value,a.value&&(l.value="",u.value=0,Xt(()=>{var F;Xt(()=>{L()}),(F=i.value)==null||F.focus()})))}function V(F){r("toggle",F.value,!f.value.has(F.value))}function R(F){S.value.length!==0&&(u.value=(u.value+F+S.value.length)%S.value.length)}function P(){const F=S.value[u.value];F&&V(F)}function B(F){if(!a.value)return;const ne=s.value;if(!ne)return;const oe=F.target;oe instanceof Node&&(ne.contains(oe)||(a.value=!1))}return at(l,()=>{u.value=0}),ar(()=>window.addEventListener("pointerdown",B)),Ar(()=>window.removeEventListener("pointerdown",B)),(F,ne)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[h("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:O},[h("span",zk,ae(m.value),1),Pe(ji,{class:"search-dropdown-chevron"})],8,Vk),a.value?(v(),E("div",{key:0,ref_key:"menuRef",ref:o,class:st(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":c.value==="up","search-dropdown-menu-wrap-down":c.value==="down"}])},[h("div",Gk,[Tr(h("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":ne[0]||(ne[0]=oe=>l.value=oe),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ne[1]||(ne[1]=vn(rt(oe=>a.value=!1,["prevent"]),["escape"])),vn(rt(P,["prevent"]),["enter"]),ne[2]||(ne[2]=vn(rt(oe=>R(1),["prevent"]),["arrow-down"])),ne[3]||(ne[3]=vn(rt(oe=>R(-1),["prevent"]),["arrow-up"]))]},null,40,qk),[[Sr,l.value]])]),S.value.length>0?(v(),E("ul",Kk,[(v(!0),E(Ve,null,_t(S.value,(oe,we)=>(v(),E("li",{key:oe.value},[h("button",{class:st(["search-dropdown-option",{"is-selected":f.value.has(oe.value),"is-highlighted":we===u.value}]),type:"button",onClick:Se=>V(oe),onPointerenter:Se=>u.value=we},[h("span",Yk,ae(f.value.has(oe.value)?"✓":""),1),h("span",Xk,ae(oe.label),1),oe.description?(v(),E("span",Qk,ae(oe.description),1)):le("",!0)],42,Jk)]))),128))])):(v(),E("div",Zk,"No results"))],2)):le("",!0)],512))}}),t0=lt(e0,[["__scopeId","data-v-22b6d035"]]),n0={class:"skill-picker-header"},r0=["onKeydown"],s0={key:0,class:"skill-picker-list",role:"listbox"},o0=["onClick","onPointerenter"],i0={class:"skill-picker-name"},a0={key:0,class:"skill-picker-desc"},l0={key:1,class:"skill-picker-empty"},c0=Wt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=N(null),o=N(null),i=N(""),a=N(0),l=ie(()=>{const m=i.value.toLowerCase().trim();return m?n.skills.filter(S=>S.name.toLowerCase().includes(m)||S.description.toLowerCase().includes(m)):n.skills}),u=ie(()=>{const m={};return n.anchorBottom!=null&&(m.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(m.left=`${n.anchorLeft}px`),m});function c(m){l.value.length!==0&&(a.value=(a.value+m+l.value.length)%l.value.length)}function f(){const m=l.value[a.value];m&&r("select",m)}return at(()=>n.visible,m=>{m&&(i.value="",a.value=0,Xt(()=>{var S;return(S=o.value)==null?void 0:S.focus()}))}),at(i,()=>{a.value=0}),(m,S)=>e.visible?(v(),E("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Fr(u.value)},[h("div",n0,[Tr(h("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":S[0]||(S[0]=L=>i.value=L),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[S[1]||(S[1]=vn(rt(L=>m.$emit("close"),["prevent"]),["escape"])),vn(rt(f,["prevent"]),["enter"]),S[2]||(S[2]=vn(rt(L=>c(1),["prevent"]),["arrow-down"])),S[3]||(S[3]=vn(rt(L=>c(-1),["prevent"]),["arrow-up"]))]},null,40,r0),[[Sr,i.value]])]),l.value.length>0?(v(),E("ul",s0,[(v(!0),E(Ve,null,_t(l.value,(L,O)=>(v(),E("li",{key:L.path},[h("button",{class:st(["skill-picker-item",{"is-highlighted":O===a.value}]),type:"button",onClick:V=>m.$emit("select",L),onPointerenter:V=>a.value=O},[h("span",i0,ae(L.name),1),L.description?(v(),E("span",a0,ae(L.description),1)):le("",!0)],42,o0)]))),128))])):(v(),E("div",l0,"No skills found"))],4)):le("",!0)}}),u0=lt(c0,[["__scopeId","data-v-ff3fb7dc"]]),d0={key:0,class:"thread-composer-dictation-error"},f0={key:0,class:"thread-composer-attachments"},h0=["src","alt"],p0=["aria-label","disabled","onClick"],m0={key:1,class:"thread-composer-folder-chips"},g0=["title"],v0={class:"thread-composer-folder-chip-meta"},y0=["aria-label","disabled","onClick"],w0={key:2,class:"thread-composer-file-chips"},b0=["title"],_0=["aria-label","disabled","onClick"],k0={key:3,class:"thread-composer-skill-chips"},T0={class:"thread-composer-skill-chip-name"},S0=["aria-label","onClick"],I0={class:"thread-composer-input-wrap"},E0={key:0,class:"thread-composer-file-mentions"},C0=["onMousedown"],A0={key:1,class:"thread-composer-file-mention-icon-markdown"},x0={class:"thread-composer-file-mention-text"},R0={class:"thread-composer-file-mention-name"},P0={key:0,class:"thread-composer-file-mention-dir"},M0={key:1,class:"thread-composer-file-mention-empty"},$0=["placeholder","disabled"],O0=["disabled"],N0={key:0,class:"thread-composer-attach-menu"},D0=["disabled"],L0=["disabled"],j0=["disabled"],U0={class:"thread-composer-attach-mode"},F0={class:"thread-composer-attach-mode-buttons"},B0=["disabled"],H0=["disabled"],W0=["aria-checked","aria-label","disabled"],V0={class:"thread-composer-attach-setting-copy"},z0={class:"thread-composer-attach-setting-description"},G0={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},q0={key:1,class:"thread-composer-dictation-timer"},K0=["aria-label","title","disabled"],J0=["disabled"],Y0=["aria-label","title","disabled"],X0=["disabled"],Q0=["disabled"],Z0=["disabled"],eT="codex-web-local.thread-draft.v1.",tT=Wt({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},prependDraftRequest:{},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=N(""),i=N([]),a=N([]),l=N([]),u=N([]),c=N(""),{state:f,isSupported:m,recordingDurationMs:S,waveformCanvasRef:L,startRecording:O,stopRecording:V,toggleRecording:R,cancel:P}=m_({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:y=>{if(o.value=o.value?`${o.value}
39
- ${y}`:y,c.value="",r.dictationAutoSend!==!1){const C=r.isTurnInProgress?H.value:"steer";ye(C,{rollbackLatestUserTurn:C==="steer"&&ze}),ze=!1;return}Xt(()=>{var C;return(C=we.value)==null?void 0:C.focus()})},onEmpty:()=>{c.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:y=>{if(y instanceof DOMException&&y.name==="NotAllowedError"){c.value="Microphone access was denied.";return}c.value=y instanceof Error?y.message:"Dictation failed."}}),B=N(null),F=N(null),ne=N(null),oe=N(null),we=N(null),Se=N(!1),ue=N(!1),ce=N(null),be=N(""),K=N([]),ke=N(!1),Ne=N(0),Ue=N(0);let Ce=0,$e=null,De=!1,ze=!1;const tt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Oe="";const Qe=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function wt(y){return y.trim().replace(/^gpt/i,"GPT")}const ct=ie(()=>r.models.map(y=>({value:y,label:wt(y)}))),Ze=ie(()=>r.skills??[]),Je=ie(()=>a.value.map(y=>y.path)),X=ie(()=>(r.skills??[]).map(y=>({value:y.path,label:y.name,description:y.description}))),de=ie(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId?!1:o.value.trim().length>0||i.value.length>0||l.value.length>0),fe=ie(()=>o.value.trim().length>0||i.value.length>0||a.value.length>0||l.value.length>0||u.value.length>0),Ie=ie(()=>{const y=new Set;for(const C of u.value)for(const j of C.filePaths)y.add(j);return l.value.filter(C=>!y.has(C.fsPath))}),Te=ie(()=>r.disabled||!r.activeThreadId),b=ie(()=>r.selectedModel.trim()==="gpt-5.4"),T=ie(()=>r.selectedSpeedMode==="fast"&&b.value),M=ie(()=>Te.value||r.isUpdatingSpeedMode===!0),Y=ie(()=>r.isUpdatingSpeedMode?"Saving speed setting...":r.selectedSpeedMode==="fast"?"About 1.5x faster, with credits used at 2x":"Default speed with normal credit usage"),ee=ie(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),H=N(ee.value),G=ie(()=>f.value==="recording"),W=ie(()=>f.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),q=ie(()=>f.value==="idle"?c.value.trim():""),z=ie(()=>{const y=Math.max(0,Math.floor(S.value/1e3)),C=Math.floor(y/60),j=y%60;return`${C}:${String(j).padStart(2,"0")}`}),me=ie(()=>r.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),ve=ie(()=>o.value.trim().length>0||i.value.length>0||l.value.length>0);function ye(y="steer",C){var te;const j=o.value.trim();if(de.value){if(s("submit",{text:j,imageUrls:i.value.map(Ae=>Ae.url),fileAttachments:[...l.value],skills:a.value.map(Ae=>({name:Ae.name,path:Ae.path})),mode:y,rollbackLatestUserTurn:(C==null?void 0:C.rollbackLatestUserTurn)===!0}),xt(r.activeThreadId),Fe(),tt){(te=we.value)==null||te.blur();return}Xt(()=>{var Ae;return(Ae=we.value)==null?void 0:Ae.focus()})}}function Re(y){H.value=y}function We(y){Ue.value+=1,o.value=y.text,i.value=y.imageUrls.map((C,j)=>({id:`queued-${Date.now()}-${j}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${j+1}`,url:C})),a.value=y.skills.map(C=>(r.skills??[]).find(j=>j.path===C.path)??{name:C.name,description:"",path:C.path}),l.value=y.fileAttachments.map(C=>({...C})),u.value=[],c.value="",Se.value=!1,ue.value=!1,Kt()}function Fe(){We({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Me(y){return`${eT}${y}`}function Ye(y){if(typeof window>"u")return null;const C=y.trim();if(!C)return null;try{const j=window.localStorage.getItem(Me(C));if(!j)return null;const te=JSON.parse(j);return typeof te=="string"?{text:te,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof te.text=="string"?te.text:"",imageUrls:Array.isArray(te.imageUrls)?te.imageUrls.filter(Ae=>typeof Ae=="string"):[],fileAttachments:Array.isArray(te.fileAttachments)?te.fileAttachments.filter(Ae=>!!Ae&&typeof Ae.label=="string"&&typeof Ae.path=="string"&&typeof Ae.fsPath=="string"):[],skills:Array.isArray(te.skills)?te.skills.filter(Ae=>!!Ae&&typeof Ae.name=="string"&&typeof Ae.path=="string"):[]}}catch{return null}}function et(y,C){if(typeof window>"u")return;const j=y.trim();if(j)try{if(C.text.trim().length>0||C.imageUrls.length>0||C.fileAttachments.length>0||C.skills.length>0){window.localStorage.setItem(Me(j),JSON.stringify(C));return}window.localStorage.removeItem(Me(j))}catch{}}function xt(y){et(y,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function ft(){return{text:o.value,imageUrls:i.value.map(y=>y.url),fileAttachments:l.value.map(y=>({...y})),skills:a.value.map(y=>({name:y.name,path:y.path}))}}function Ct(){s("interrupt")}function Lt(y){s("update:selected-model",y)}function pt(y){s("update:selected-reasoning-effort",y)}function Pt(){M.value||s("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function mt(){r.dictationClickToToggle&&(c.value&&(c.value=""),f.value==="idle"&&(ze=r.isTurnInProgress===!0&&H.value==="steer"),R())}function Vt(y){if(r.dictationClickToToggle||(y.preventDefault(),De))return;De=!0;const C=y.currentTarget;if(C)try{C.setPointerCapture(y.pointerId)}catch{}c.value&&(c.value=""),ze=r.isTurnInProgress===!0&&H.value==="steer",window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt),window.addEventListener("blur",nt),O()}function nt(){r.dictationClickToToggle||De&&(De=!1,window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),window.removeEventListener("blur",nt),V())}function bn(){Te.value||(Se.value=!Se.value)}function zt(){var y;(y=F.value)==null||y.click()}function Mt(){var y;(y=ne.value)==null||y.click()}function un(){var y;(y=oe.value)==null||y.click()}function kt(y){i.value=i.value.filter(C=>C.id!==y)}function It(y){a.value=a.value.filter(C=>C.path!==y)}function en(y){l.value=l.value.filter(C=>C.fsPath!==y)}function jt(y){const C=u.value.find(te=>te.id===y);if(!C)return;const j=new Set(C.filePaths);l.value=l.value.filter(te=>!j.has(te.fsPath)),u.value=u.value.filter(te=>te.id!==y)}function At(y){return y.total<=0?0:Math.round(y.processed/y.total*100)}function Gt(y,C){const j=y.replace(/\\/g,"/");if(l.value.some(Xe=>Xe.fsPath===j))return;const te=j.split("/").filter(Boolean),Ae=(C==null?void 0:C.trim())||te[te.length-1]||j;l.value=[...l.value,{label:Ae,path:j,fsPath:j}]}function In(y){return y.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(y.name)}function $t(y){if(!y||y.length===0)return;const C=Ue.value;for(const j of Array.from(y))if(In(j)){const te=new FileReader;te.onload=()=>{C===Ue.value&&typeof te.result=="string"&&i.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:j.name,url:te.result})},te.readAsDataURL(j)}else vu(j).then(te=>{C===Ue.value&&te&&Gt(te)}).catch(()=>{})}async function En(y){if(!y||y.length===0)return;const C=Ue.value,j=Array.from(y),Ae=(j[0].webkitRelativePath||j[0].name).split("/").filter(Boolean)[0]||"Folder",Xe=`${Date.now()}-${Math.random().toString(36).slice(2)}`;u.value=[...u.value,{id:Xe,name:Ae,total:j.length,processed:0,filePaths:[],isUploading:!0}];const ut=Rt=>{C===Ue.value&&(u.value=u.value.map(k=>k.id===Xe?Rt(k):k))};for(const Rt of j)try{const k=await vu(Rt);if(C!==Ue.value)return;if(k){const $=Rt.webkitRelativePath||Rt.name;Gt(k,$),ut(D=>({...D,processed:D.processed+1,filePaths:[...D.filePaths,k]}));continue}ut($=>({...$,processed:$.processed+1}))}catch{ut(k=>({...k,processed:k.processed+1}))}ut(Rt=>({...Rt,isUploading:!1}))}function Yt(y){y&&(y.value="")}function He(y){const C=y.target;$t((C==null?void 0:C.files)??null),Yt(C),Se.value=!1}function Le(y){const C=y.target;$t((C==null?void 0:C.files)??null),Yt(C),Se.value=!1}function qt(y){const C=y.target;En((C==null?void 0:C.files)??null),Yt(C),Se.value=!1}function dn(){c.value&&(c.value="");const C=o.value.startsWith("/");C!==ue.value&&(ue.value=C),Ut()}function Pn(y){if(ke.value){if(y.key==="Escape"){y.preventDefault(),Kt();return}if(y.key==="ArrowDown"){y.preventDefault(),K.value.length>0&&(Ne.value=(Ne.value+1)%K.value.length);return}if(y.key==="ArrowUp"){if(y.preventDefault(),K.value.length>0){const j=K.value.length;Ne.value=(Ne.value+j-1)%j}return}if(y.key==="Enter"||y.key==="Tab"){y.preventDefault();const j=K.value[Ne.value];j?fn(j):Kt();return}}if(r.sendWithEnter!==!1?y.key==="Enter"&&!y.shiftKey:y.key==="Enter"&&(y.metaKey||y.ctrlKey)){y.preventDefault(),ye(r.isTurnInProgress?H.value:"steer");return}if(ue.value){if(y.key==="Escape"){y.preventDefault(),_n();return}if(y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();return}}}function _n(){var y;ue.value=!1,(y=we.value)==null||y.focus()}function Kt(){ke.value=!1,ce.value=null,be.value="",K.value=[],Ne.value=0}function Ut(){const y=we.value;if(!y){Kt();return}const C=y.selectionStart??o.value.length,te=o.value.slice(0,C).match(/(^|\s)(@[^\s@]*)$/);if(!te){Kt();return}const Ae=te[2]??"",Xe=Ae.length,ut=C-Xe;ce.value=ut,be.value=Ae.slice(1),ke.value=!0,tn()}async function tn(){if(!ke.value)return;const y=(r.cwd??"").trim();if(!y){K.value=[];return}$e&&clearTimeout($e);const C=++Ce;$e=setTimeout(async()=>{try{const j=await ck(y,be.value,20);if(!ke.value||C!==Ce)return;K.value=j,Ne.value=0}catch{if(!ke.value||C!==Ce)return;K.value=[]}},120)}function fn(y){const C=we.value,j=ce.value;if(j!==null&&C){const te=C.selectionStart??o.value.length;o.value=`${o.value.slice(0,j)}${o.value.slice(te)}`.trimEnd()}Gt(y.path),Kt(),Xt(()=>C==null?void 0:C.focus())}function Un(y){P(),We(y),Xt(()=>{var C;return(C=we.value)==null?void 0:C.focus()})}function Mn(y){const C=y.lastIndexOf("/");return C<0?y:y.slice(C+1)}function $n(y){const C=y.lastIndexOf("/");return C<=0?"":y.slice(0,C)}function kn(y){const C=Mn(y),j=C.lastIndexOf(".");return j<=0?"":C.slice(j+1).toLowerCase()}function Cn(y){const C=kn(y);return C==="ts"?"TS":C==="tsx"?"TSX":C==="js"?"JS":C==="jsx"?"JSX":C==="json"?"{}":""}function On(y){const C=kn(y);return C.startsWith("ts")?"ts":C.startsWith("js")?"js":C==="json"?"json":"default"}function w(y){const C=kn(y);return C==="md"||C==="mdx"}function I(y){var C;a.value.some(j=>j.path===y.path)||(a.value=[...a.value,y]),o.value=o.value.startsWith("/")?"":o.value,ue.value=!1,(C=we.value)==null||C.focus()}function A(y,C){if(C){const j=(r.skills??[]).find(te=>te.path===y);j&&!a.value.some(te=>te.path===y)&&(a.value=[...a.value,j])}else a.value=a.value.filter(j=>j.path!==y)}function J(y){if(!Se.value)return;const C=B.value;if(!C)return;const j=y.target;!j||C.contains(j)||(Se.value=!1)}return ar(()=>{document.addEventListener("click",J)}),t({hydrateDraft:Un,hasUnsavedDraft:()=>fe.value}),Ar(()=>{document.removeEventListener("click",J),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),window.removeEventListener("blur",nt),$e&&clearTimeout($e)}),at(()=>r.activeThreadId,y=>{P(),Oe&&et(Oe,ft()),Fe();const C=Ye(y);C&&(We(C),dn()),Oe=y.trim()},{immediate:!0}),at([o,i,l,a],()=>{Oe&&et(Oe,ft())},{deep:!0}),at(()=>r.cwd,()=>{ke.value&&tn()}),at(ee,y=>{H.value=y}),at(()=>{var y;return(y=r.prependDraftRequest)==null?void 0:y.id},()=>{var C,j;const y=((j=(C=r.prependDraftRequest)==null?void 0:C.text)==null?void 0:j.trim())??"";y&&(o.value=o.value?`${y}
40
- ${o.value}`:y,dn(),Xt(()=>{var te;return(te=we.value)==null?void 0:te.focus()}))}),(y,C)=>(v(),E("form",{class:"thread-composer",onSubmit:C[4]||(C[4]=rt(j=>ye(e.isTurnInProgress?H.value:"steer"),["prevent"]))},[q.value?(v(),E("p",d0,ae(q.value),1)):le("",!0),h("div",{class:st(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[i.value.length>0?(v(),E("div",f0,[(v(!0),E(Ve,null,_t(i.value,j=>(v(),E("div",{key:j.id,class:"thread-composer-attachment"},[h("img",{class:"thread-composer-attachment-image",src:j.url,alt:j.name||"Selected image"},null,8,h0),h("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${j.name||"image"}`,disabled:Te.value,onClick:te=>kt(j.id)}," x ",8,p0)]))),128))])):le("",!0),u.value.length>0?(v(),E("div",m0,[(v(!0),E(Ve,null,_t(u.value,j=>(v(),E("span",{key:j.id,class:"thread-composer-folder-chip"},[Pe(Ui,{class:"thread-composer-folder-chip-icon"}),h("span",{class:"thread-composer-folder-chip-name",title:j.name},ae(j.name),9,g0),h("span",v0,[j.isUploading?(v(),E(Ve,{key:0},[po(ae(At(j))+"% uploading ("+ae(j.processed)+"/"+ae(j.total)+") ",1)],64)):(v(),E(Ve,{key:1},[po(ae(j.filePaths.length)+" file"+ae(j.filePaths.length===1?"":"s"),1)],64))]),h("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${j.name}`,disabled:Te.value,onClick:te=>jt(j.id)},"×",8,y0)]))),128))])):le("",!0),Ie.value.length>0?(v(),E("div",w0,[(v(!0),E(Ve,null,_t(Ie.value,j=>(v(),E("span",{key:j.fsPath,class:"thread-composer-file-chip"},[Pe(mi,{class:"thread-composer-file-chip-icon"}),h("span",{class:"thread-composer-file-chip-name",title:j.fsPath},ae(j.label),9,b0),h("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${j.label}`,disabled:Te.value,onClick:te=>en(j.fsPath)},"×",8,_0)]))),128))])):le("",!0),a.value.length>0?(v(),E("div",k0,[(v(!0),E(Ve,null,_t(a.value,j=>(v(),E("span",{key:j.path,class:"thread-composer-skill-chip"},[h("span",T0,ae(j.name),1),h("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${j.name}`,onClick:te=>It(j.path)},"×",8,S0)]))),128))])):le("",!0),h("div",I0,[ke.value?(v(),E("div",E0,[K.value.length>0?(v(!0),E(Ve,{key:0},_t(K.value,(j,te)=>(v(),E("button",{key:j.path,class:st(["thread-composer-file-mention-row",{"is-active":te===Ne.value}]),type:"button",onMousedown:rt(Ae=>fn(j),["prevent"])},[Cn(j.path)?(v(),E("span",{key:0,class:st(["thread-composer-file-mention-icon-badge",`is-${On(j.path)}`])},ae(Cn(j.path)),3)):w(j.path)?(v(),E("span",A0,"↓")):(v(),dt(mi,{key:2,class:"thread-composer-file-mention-icon-file"})),h("span",x0,[h("span",R0,ae(Mn(j.path)),1),$n(j.path)?(v(),E("span",P0,ae($n(j.path)),1)):le("",!0)])],42,C0))),128)):(v(),E("div",M0,"No matching files"))])):le("",!0),Tr(h("textarea",{ref_key:"inputRef",ref:we,"onUpdate:modelValue":C[0]||(C[0]=j=>o.value=j),class:"thread-composer-input",placeholder:me.value,disabled:Te.value,onInput:dn,onKeydown:Pn},null,40,$0),[[Sr,o.value]]),Pe(u0,{skills:Ze.value,visible:ue.value,"anchor-bottom":44,"anchor-left":0,onSelect:I,onClose:_n},null,8,["skills","visible"])]),h("div",{class:st(["thread-composer-controls",{"thread-composer-controls--recording":G.value}])},[h("div",{ref_key:"attachMenuRootRef",ref:B,class:"thread-composer-attach"},[h("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Te.value,onClick:bn}," + ",8,O0),Se.value?(v(),E("div",N0,[h("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:zt}," Add photos & files ",8,D0),h("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:un}," Add folder ",8,L0),h("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:Mt}," Take photo ",8,j0),C[7]||(C[7]=h("div",{class:"thread-composer-attach-separator"},null,-1)),h("div",U0,[C[5]||(C[5]=h("span",{class:"thread-composer-attach-mode-label"},"In-progress send",-1)),h("div",F0,[h("button",{class:st(["thread-composer-attach-mode-button",{"is-active":H.value==="steer"}]),type:"button",disabled:Te.value,onClick:C[1]||(C[1]=j=>Re("steer"))}," Steer ",10,B0),h("button",{class:st(["thread-composer-attach-mode-button",{"is-active":H.value==="queue"}]),type:"button",disabled:Te.value,onClick:C[2]||(C[2]=j=>Re("queue"))}," Queue ",10,H0)])]),C[8]||(C[8]=h("div",{class:"thread-composer-attach-separator"},null,-1)),b.value?(v(),E("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`Fast mode ${e.selectedSpeedMode==="fast"?"enabled":"disabled"}`,disabled:M.value,onClick:Pt},[h("span",V0,[C[6]||(C[6]=h("span",{class:"thread-composer-attach-setting-label"},"Fast mode",-1)),h("span",z0,ae(Y.value),1)]),h("span",{class:st(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":M.value}])},null,2)],8,W0)):le("",!0)])):le("",!0)],512),G.value?le("",!0):(v(),E(Ve,{key:0},[Pe(oo,{class:"thread-composer-control","model-value":e.selectedModel,options:ct.value,"selected-prefix-icon":T.value?Ik:null,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":Lt},null,8,["model-value","options","selected-prefix-icon","disabled"]),Pe(t0,{class:"thread-composer-control",options:X.value,"selected-values":Je.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:A},null,8,["options","selected-values","disabled"]),Pe(oo,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Qe,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])],64)),h("div",{class:st(["thread-composer-actions",{"thread-composer-actions--recording":G.value}])},[_e(f)==="recording"?(v(),E("div",G0,[h("canvas",{ref_key:"dictationWaveformCanvasRef",ref:L,class:"thread-composer-dictation-waveform"},null,512)])):le("",!0),_e(f)==="recording"?(v(),E("span",q0,ae(z.value),1)):le("",!0),_e(m)?(v(),E("button",{key:2,class:st(["thread-composer-mic",{"thread-composer-mic--active":_e(f)==="recording"}]),type:"button","aria-label":W.value,title:W.value,disabled:Te.value,onClick:mt,onPointerdown:Vt,onPointerup:nt,onPointercancel:nt},[_e(f)==="recording"?(v(),dt(yu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(v(),dt(xk,{key:1,class:"thread-composer-mic-icon"}))],42,K0)):le("",!0),e.isTurnInProgress&&!ve.value?(v(),E("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Ct},[Pe(yu,{class:"thread-composer-stop-icon"})],8,J0)):(v(),E("button",{key:4,class:st(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&H.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&H.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${H.value}`:"Send",disabled:!de.value,onClick:C[3]||(C[3]=j=>ye(e.isTurnInProgress?H.value:"steer"))},[Pe(_k,{class:"thread-composer-submit-icon"})],10,Y0))],2)],2)],2),h("input",{ref_key:"photoLibraryInputRef",ref:F,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Te.value,onChange:He},null,40,X0),h("input",{ref_key:"cameraCaptureInputRef",ref:ne,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Te.value,onChange:Le},null,40,Q0),h("input",{ref_key:"folderPickerInputRef",ref:oe,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Te.value,onChange:qt},null,40,Z0)],32))}}),wu=lt(tT,[["__scopeId","data-v-616f2541"]]),nT={key:0,class:"queued-messages"},rT={class:"queued-messages-inner"},sT={class:"queued-row-text"},oT={class:"queued-row-actions"},iT=["onClick"],aT=["onClick"],lT=["onClick"],cT=Wt({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var l,u,c;const r=n.text.trim();if(r)return r;const s=[],o=((l=n.imageUrls)==null?void 0:l.length)??0,i=((u=n.fileAttachments)==null?void 0:u.length)??0,a=((c=n.skills)==null?void 0:c.length)??0;return o>0&&s.push(`${o} image${o===1?"":"s"}`),i>0&&s.push(`${i} file${i===1?"":"s"}`),a>0&&s.push(`${a} skill${a===1?"":"s"}`),s.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(v(),E("div",nT,[h("div",rT,[(v(!0),E(Ve,null,_t(e.messages,s=>(v(),E("div",{key:s.id,class:"queued-row"},[r[1]||(r[1]=h("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),h("span",sT,ae(t(s)),1),h("div",oT,[h("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:o=>n.$emit("edit",s.id)},"Edit",8,iT),h("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:o=>n.$emit("steer",s.id)},"Steer",8,aT),h("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:o=>n.$emit("delete",s.id)},[...r[0]||(r[0]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})],-1)])],8,lT)])]))),128))])])):le("",!0)}}),uT=lt(cT,[["__scopeId","data-v-1394d0f8"]]),dT={key:0,class:"rate-limit-status","aria-live":"polite"},fT=["title"],hT={class:"rate-limit-card-header"},pT={class:"rate-limit-card-title"},mT={key:0,class:"rate-limit-card-plan"},gT={class:"rate-limit-card-metrics"},vT={key:0,class:"rate-limit-card-footer"},yT=Wt({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(R){var P,B;return((P=R.limitId)==null?void 0:P.trim())||((B=R.limitName)==null?void 0:B.trim())||"__default__"}function n(R){var P,B;return((P=R.limitName)==null?void 0:P.trim())||((B=R.limitId)==null?void 0:B.trim())||"Rate limits"}function r(R){const P=R.trim();return P?P.replace(/[_-]+/g," ").replace(/\b\w/g,B=>B.toUpperCase()):""}function s(R){return!R||R<=0?"Window":R%1440===0?`${R/1440}d`:R%60===0?`${R/60}h`:R<60?`${R}m`:`${Math.round(R/60*10)/10}h`}function o(R){const P=Math.max(0,Math.min(100,100-R));return`${Math.round(P)}% left`}function i(R){return`${Math.round(R)}%`}function a(R,P){return{key:P,label:`${s(R.windowDurationMins)} ${o(R.usedPercent)}`}}function l(R){const P=[];return R.primary&&P.push(a(R.primary,"primary")),R.secondary&&P.push(a(R.secondary,"secondary")),P}function u(R){if(!R)return"";const P=new Date(R*1e3),B=P.getMonth()+1,F=String(P.getDate()).padStart(2,"0"),ne=String(P.getHours()).padStart(2,"0"),oe=String(P.getMinutes()).padStart(2,"0");return`${B}.${F} ${ne}:${oe}`}function c(R){if(!(R!=null&&R.resetsAt))return"";const P=R.resetsAt*1e3-Date.now();if(P<=0)return"Resetting now";const B=Math.round(P/6e4);if(B<60)return`Resets in ${B}m`;const F=Math.round(B/60);return F<24?`Resets in ${F}h`:`Resets in ${Math.round(F/24)}d`}function f(R){return[R.primary,R.secondary].filter(P=>P!==null)}function m(R){const P=f(R);return P.length===0?null:[...P].sort((B,F)=>{const ne=B.windowDurationMins??Number.MAX_SAFE_INTEGER,oe=F.windowDurationMins??Number.MAX_SAFE_INTEGER;return ne!==oe?ne-oe:(B.resetsAt??Number.MAX_SAFE_INTEGER)-(F.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function S(R){const P=f(R);if(P.length===0)return"";const B=[...P].sort((ne,oe)=>{const we=ne.windowDurationMins??-1,Se=oe.windowDurationMins??-1;return we!==Se?Se-we:(oe.resetsAt??-1)-(ne.resetsAt??-1)})[0],F=u(B.resetsAt);return F||""}function L(R){const P=R.credits;return P?P.unlimited?"Unlimited credits":P.balance?`Credits ${P.balance}`:P.hasCredits?"Credits available":"":""}function O(R){return[c(m(R)),S(R),L(R)].filter(P=>P.length>0)}function V(R){const P=[n(R)];for(const B of l(R))P.push(B.label);for(const B of f(R))P.push(`${s(B.windowDurationMins)} used ${i(B.usedPercent)}`);for(const B of O(R))P.push(B);return P.join(`
41
- `)}return(R,P)=>e.snapshots.length>0?(v(),E("aside",dT,[(v(!0),E(Ve,null,_t(e.snapshots,B=>(v(),E("div",{key:t(B),class:"rate-limit-card",title:V(B)},[h("div",hT,[h("span",pT,ae(n(B)),1),B.planType?(v(),E("span",mT,ae(r(B.planType)),1)):le("",!0)]),h("div",gT,[(v(!0),E(Ve,null,_t(l(B),F=>(v(),E("span",{key:F.key,class:"rate-limit-card-metric"},ae(F.label),1))),128))]),O(B).length>0?(v(),E("div",vT,ae(O(B).join(" | ")),1)):le("",!0)],8,fT))),128))])):le("",!0)}}),wT=lt(yT,[["__scopeId","data-v-df88906b"]]),bT={class:"runtime-dropdown-trigger-label"},_T={key:0,class:"runtime-dropdown-menu-wrap"},kT={class:"runtime-dropdown-menu"},TT=["onClick"],ST={class:"runtime-dropdown-option-label"},IT={key:0,class:"runtime-dropdown-option-check"},ET=Wt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=N(null),o=N(!1),i=[{value:"local",label:"Local project",icon:Ui},{value:"worktree",label:"New worktree",icon:ti}],a=ie(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function u(c){if(!o.value)return;const f=s.value;if(!f)return;const m=c.target;m instanceof Node&&(f.contains(m)||(o.value=!1))}return ar(()=>{window.addEventListener("pointerdown",u)}),Ar(()=>{window.removeEventListener("pointerdown",u)}),(c,f)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[h("button",{class:"runtime-dropdown-trigger",type:"button",onClick:f[0]||(f[0]=m=>o.value=!o.value)},[(v(),dt(di(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),h("span",bT,ae(a.value.label),1),Pe(ji,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(v(),E("div",_T,[h("div",kT,[f[1]||(f[1]=h("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(v(),E(Ve,null,_t(i,m=>h("button",{key:m.value,class:st(["runtime-dropdown-option",{"is-selected":e.modelValue===m.value}]),type:"button",onClick:S=>l(m.value)},[(v(),dt(di(m.icon),{class:"runtime-dropdown-option-icon"})),h("span",ST,ae(m.label),1),e.modelValue===m.value?(v(),E("span",IT,"✓")):le("",!0)],10,TT)),64))])])):le("",!0)],512))}}),CT=lt(ET,[["__scopeId","data-v-9c9b71e5"]]),AT={},xT={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function RT(e,t){return v(),E("svg",xT,[...t[0]||(t[0]=[h("circle",{cx:"11",cy:"11",r:"8"},null,-1),h("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Za=lt(AT,[["render",RT]]),PT={class:"skill-card-top"},MT=["src","alt"],$T={key:1,class:"skill-card-avatar-fallback"},OT={class:"skill-card-info"},NT={class:"skill-card-header"},DT={class:"skill-card-name"},LT={key:0,class:"skill-card-badge-disabled"},jT={key:1,class:"skill-card-badge"},UT={class:"skill-card-owner"},FT={key:0,class:"skill-card-desc"},BT={key:1,class:"skill-card-date"},HT=Wt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=ie(()=>{const i=t.skill.path;return i?i.endsWith("/SKILL.md")?i.slice(0,-9):i:""});function r(){const i=n.value;i&&window.open(`/codex-local-browse${encodeURI(i)}`,"_blank","noopener,noreferrer")}const s=ie(()=>{const i=t.skill.publishedAt;if(!i)return"";const a=new Date(i),u=Date.now()-i;return u<36e5?`${Math.floor(u/6e4)}m ago`:u<864e5?`${Math.floor(u/36e5)}h ago`:u<2592e6?`${Math.floor(u/864e5)}d ago`:a.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function o(i){const a=i.target;a.style.display="none"}return(i,a)=>(v(),E("button",{class:st(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:a[0]||(a[0]=l=>i.$emit("select",e.skill))},[h("div",PT,[e.skill.avatarUrl?(v(),E("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:o},null,40,MT)):(v(),E("div",$T,ae(e.skill.owner.charAt(0)),1)),h("div",OT,[h("div",NT,[h("span",DT,ae(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(v(),E("span",LT,"Disabled")):e.skill.installed?(v(),E("span",jT,"Installed")):le("",!0)]),h("span",UT,ae(e.skill.owner),1)]),e.skill.installed&&n.value?(v(),E("button",{key:2,class:"skill-card-browse",type:"button",title:"Browse files",onClick:rt(r,["stop"])},[Pe(Ui,{class:"skill-card-browse-icon"})])):le("",!0)]),e.skill.description?(v(),E("p",FT,ae(e.skill.description),1)):le("",!0),s.value?(v(),E("span",BT,ae(s.value),1)):le("",!0)],2))}}),bu=lt(HT,[["__scopeId","data-v-49ed14e0"]]),WT={class:"sdm-panel"},VT={class:"sdm-header"},zT={class:"sdm-title-area"},GT=["src","alt"],qT={class:"sdm-title-col"},KT={class:"sdm-title-row"},JT={class:"sdm-title"},YT={key:0,class:"sdm-badge-disabled"},XT={class:"sdm-owner"},QT={class:"sdm-body"},ZT={key:0,class:"sdm-desc"},eS={key:1,class:"sdm-readme-loading"},tS=["innerHTML"],nS=["href"],rS={class:"sdm-footer"},sS={class:"sdm-footer-actions"},oS=["disabled"],iS=["disabled"],aS=["disabled"],lS=Wt({__name:"SkillDetailModal",props:{skill:{},visible:{type:Boolean},isInstalling:{type:Boolean},isUninstalling:{type:Boolean}},emits:["close","install","uninstall","toggle-enabled"],setup(e,{emit:t}){const n=e,r=t,s=N(null),o=N(""),i=N(""),a=N(!1),l=ie(()=>s.value??n.skill.enabled??!0),u=ie(()=>n.isInstalling===!0||n.isUninstalling===!0),c=ie(()=>o.value||n.skill.description),f=ie(()=>{const B=n.skill.path;return B?B.endsWith("/SKILL.md")?B.slice(0,-9):B:""}),m=ie(()=>{const B=i.value;if(!B)return"";const F=B.replace(/^---[\s\S]*?---\s*/,"");return S(F)});function S(B){return B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>").replace(/\n{2,}/g,"<br/><br/>").replace(/\n/g,"<br/>")}async function L(){if(!(!n.skill.owner||!n.skill.name)){a.value=!0,o.value="",i.value="";try{const B=new URLSearchParams({owner:n.skill.owner,name:n.skill.name});n.skill.installed&&B.set("installed","true"),n.skill.path&&B.set("path",n.skill.path);const F=await fetch(`/codex-api/skills-hub/readme?${B}`);if(!F.ok)return;const ne=await F.json();i.value=ne.content??"",o.value=ne.description??""}catch{}finally{a.value=!1}}}at(()=>n.visible,B=>{B&&(s.value=null,o.value="",i.value="",L())});function O(){r("install",n.skill)}function V(){r("uninstall",n.skill)}function R(){const B=!l.value;s.value=B,r("toggle-enabled",n.skill,B)}function P(){const B=f.value;B&&window.open(`/codex-local-browse${encodeURI(B)}`,"_blank","noopener,noreferrer")}return(B,F)=>(v(),dt(ci,{to:"body"},[e.visible?(v(),E("div",{key:0,class:"sdm-overlay",onClick:F[1]||(F[1]=rt(ne=>B.$emit("close"),["self"]))},[h("div",WT,[h("div",VT,[h("div",zT,[e.skill.avatarUrl?(v(),E("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,GT)):le("",!0),h("div",qT,[h("div",KT,[h("h3",JT,ae(e.skill.displayName||e.skill.name),1),e.skill.installed&&!l.value?(v(),E("span",YT,"Disabled")):le("",!0)]),h("span",XT,ae(e.skill.owner),1)])]),h("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:F[0]||(F[0]=ne=>B.$emit("close"))},[Pe(Ol,{class:"sdm-close-icon"})])]),h("div",QT,[c.value?(v(),E("p",ZT,ae(c.value),1)):le("",!0),a.value?(v(),E("div",eS,"Loading skill contents...")):i.value?(v(),E("div",{key:2,class:"sdm-readme",innerHTML:m.value},null,8,tS)):le("",!0),h("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,nS)]),h("div",rS,[h("div",sS,[e.skill.installed?(v(),E("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:u.value,onClick:V},ae(n.isUninstalling?"Uninstalling...":"Uninstall"),9,oS)):(v(),E("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:u.value,onClick:O},ae(n.isInstalling?"Installing...":"Install"),9,iS)),e.skill.installed?(v(),E("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:u.value,onClick:R},ae(l.value?"Disable":"Enable"),9,aS)):le("",!0),e.skill.installed&&f.value?(v(),E("button",{key:3,class:"sdm-btn sdm-btn-secondary",type:"button",onClick:P}," Browse files ")):le("",!0)])])])])):le("",!0)]))}}),cS=lt(lS,[["__scopeId","data-v-c758a719"]]),uS=()=>{};var _u={};/**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- *
45
- * Licensed under the Apache License, Version 2.0 (the "License");
46
- * you may not use this file except in compliance with the License.
47
- * You may obtain a copy of the License at
48
- *
49
- * http://www.apache.org/licenses/LICENSE-2.0
50
- *
51
- * Unless required by applicable law or agreed to in writing, software
52
- * distributed under the License is distributed on an "AS IS" BASIS,
53
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
- * See the License for the specific language governing permissions and
55
- * limitations under the License.
56
- */const Wf=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}return t},dS=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const o=e[n++];t[r++]=String.fromCharCode((s&31)<<6|o&63)}else if(s>239&&s<365){const o=e[n++],i=e[n++],a=e[n++],l=((s&7)<<18|(o&63)<<12|(i&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},Vf={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<e.length;s+=3){const o=e[s],i=s+1<e.length,a=i?e[s+1]:0,l=s+2<e.length,u=l?e[s+2]:0,c=o>>2,f=(o&3)<<4|a>>4;let m=(a&15)<<2|u>>6,S=u&63;l||(S=64,i||(m=64)),r.push(n[c],n[f],n[m],n[S])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Wf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):dS(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<e.length;){const o=n[e.charAt(s++)],a=s<e.length?n[e.charAt(s)]:0;++s;const u=s<e.length?n[e.charAt(s)]:64;++s;const f=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||u==null||f==null)throw new fS;const m=o<<2|a>>4;if(r.push(m),u!==64){const S=a<<4&240|u>>2;if(r.push(S),f!==64){const L=u<<6&192|f;r.push(L)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class fS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const hS=function(e){const t=Wf(e);return Vf.encodeByteArray(t,!0)},zf=function(e){return hS(e).replace(/\./g,"")},Gf=function(e){try{return Vf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
57
- * @license
58
- * Copyright 2022 Google LLC
59
- *
60
- * Licensed under the Apache License, Version 2.0 (the "License");
61
- * you may not use this file except in compliance with the License.
62
- * You may obtain a copy of the License at
63
- *
64
- * http://www.apache.org/licenses/LICENSE-2.0
65
- *
66
- * Unless required by applicable law or agreed to in writing, software
67
- * distributed under the License is distributed on an "AS IS" BASIS,
68
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69
- * See the License for the specific language governing permissions and
70
- * limitations under the License.
71
- */function pS(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
72
- * @license
73
- * Copyright 2022 Google LLC
74
- *
75
- * Licensed under the Apache License, Version 2.0 (the "License");
76
- * you may not use this file except in compliance with the License.
77
- * You may obtain a copy of the License at
78
- *
79
- * http://www.apache.org/licenses/LICENSE-2.0
80
- *
81
- * Unless required by applicable law or agreed to in writing, software
82
- * distributed under the License is distributed on an "AS IS" BASIS,
83
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84
- * See the License for the specific language governing permissions and
85
- * limitations under the License.
86
- */const mS=()=>pS().__FIREBASE_DEFAULTS__,gS=()=>{if(typeof process>"u"||typeof _u>"u")return;const e=_u.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},vS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Gf(e[1]);return t&&JSON.parse(t)},Dl=()=>{try{return uS()||mS()||gS()||vS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},yS=e=>{var t,n;return(n=(t=Dl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},qf=()=>{var e;return(e=Dl())==null?void 0:e.config},Kf=e=>{var t;return(t=Dl())==null?void 0:t[`_${e}`]};/**
87
- * @license
88
- * Copyright 2017 Google LLC
89
- *
90
- * Licensed under the Apache License, Version 2.0 (the "License");
91
- * you may not use this file except in compliance with the License.
92
- * You may obtain a copy of the License at
93
- *
94
- * http://www.apache.org/licenses/LICENSE-2.0
95
- *
96
- * Unless required by applicable law or agreed to in writing, software
97
- * distributed under the License is distributed on an "AS IS" BASIS,
98
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
- * See the License for the specific language governing permissions and
100
- * limitations under the License.
101
- */class wS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/**
102
- * @license
103
- * Copyright 2017 Google LLC
104
- *
105
- * Licensed under the Apache License, Version 2.0 (the "License");
106
- * you may not use this file except in compliance with the License.
107
- * You may obtain a copy of the License at
108
- *
109
- * http://www.apache.org/licenses/LICENSE-2.0
110
- *
111
- * Unless required by applicable law or agreed to in writing, software
112
- * distributed under the License is distributed on an "AS IS" BASIS,
113
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
- * See the License for the specific language governing permissions and
115
- * limitations under the License.
116
- */function wn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function bS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(wn())}function _S(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function kS(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function TS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function SS(){const e=wn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function IS(){try{return typeof indexedDB=="object"}catch{return!1}}function ES(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var o;t(((o=s.error)==null?void 0:o.message)||"")}}catch(n){t(n)}})}/**
117
- * @license
118
- * Copyright 2017 Google LLC
119
- *
120
- * Licensed under the Apache License, Version 2.0 (the "License");
121
- * you may not use this file except in compliance with the License.
122
- * You may obtain a copy of the License at
123
- *
124
- * http://www.apache.org/licenses/LICENSE-2.0
125
- *
126
- * Unless required by applicable law or agreed to in writing, software
127
- * distributed under the License is distributed on an "AS IS" BASIS,
128
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129
- * See the License for the specific language governing permissions and
130
- * limitations under the License.
131
- */const CS="FirebaseError";class Wr extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=CS,Object.setPrototypeOf(this,Wr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Co.prototype.create)}}class Co{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},s=`${this.service}/${t}`,o=this.errors[t],i=o?AS(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Wr(s,a,r)}}function AS(e,t){return e.replace(xS,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const xS=/\{\$([^}]+)}/g;function RS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Ms(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const o=e[s],i=t[s];if(ku(o)&&ku(i)){if(!Ms(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function ku(e){return e!==null&&typeof e=="object"}/**
132
- * @license
133
- * Copyright 2017 Google LLC
134
- *
135
- * Licensed under the Apache License, Version 2.0 (the "License");
136
- * you may not use this file except in compliance with the License.
137
- * You may obtain a copy of the License at
138
- *
139
- * http://www.apache.org/licenses/LICENSE-2.0
140
- *
141
- * Unless required by applicable law or agreed to in writing, software
142
- * distributed under the License is distributed on an "AS IS" BASIS,
143
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144
- * See the License for the specific language governing permissions and
145
- * limitations under the License.
146
- */function Ao(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(s=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function PS(e,t){const n=new MS(e,t);return n.subscribe.bind(n)}class MS{constructor(t,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{t(this)}).catch(r=>{this.error(r)})}next(t){this.forEachObserver(n=>{n.next(t)})}error(t){this.forEachObserver(n=>{n.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,n,r){let s;if(t===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");$S(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=_a),s.error===void 0&&(s.error=_a),s.complete===void 0&&(s.complete=_a);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),o}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,t)}sendOne(t,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{n(this.observers[t])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function $S(e,t){if(typeof e!="object"||e===null)return!1;for(const n of t)if(n in e&&typeof e[n]=="function")return!0;return!1}function _a(){}/**
147
- * @license
148
- * Copyright 2021 Google LLC
149
- *
150
- * Licensed under the Apache License, Version 2.0 (the "License");
151
- * you may not use this file except in compliance with the License.
152
- * You may obtain a copy of the License at
153
- *
154
- * http://www.apache.org/licenses/LICENSE-2.0
155
- *
156
- * Unless required by applicable law or agreed to in writing, software
157
- * distributed under the License is distributed on an "AS IS" BASIS,
158
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159
- * See the License for the specific language governing permissions and
160
- * limitations under the License.
161
- */function Ds(e){return e&&e._delegate?e._delegate:e}/**
162
- * @license
163
- * Copyright 2025 Google LLC
164
- *
165
- * Licensed under the Apache License, Version 2.0 (the "License");
166
- * you may not use this file except in compliance with the License.
167
- * You may obtain a copy of the License at
168
- *
169
- * http://www.apache.org/licenses/LICENSE-2.0
170
- *
171
- * Unless required by applicable law or agreed to in writing, software
172
- * distributed under the License is distributed on an "AS IS" BASIS,
173
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
174
- * See the License for the specific language governing permissions and
175
- * limitations under the License.
176
- */function Ll(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function OS(e){return(await fetch(e,{credentials:"include"})).ok}class $s{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
177
- * @license
178
- * Copyright 2019 Google LLC
179
- *
180
- * Licensed under the Apache License, Version 2.0 (the "License");
181
- * you may not use this file except in compliance with the License.
182
- * You may obtain a copy of the License at
183
- *
184
- * http://www.apache.org/licenses/LICENSE-2.0
185
- *
186
- * Unless required by applicable law or agreed to in writing, software
187
- * distributed under the License is distributed on an "AS IS" BASIS,
188
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
- * See the License for the specific language governing permissions and
190
- * limitations under the License.
191
- */const ts="[DEFAULT]";/**
192
- * @license
193
- * Copyright 2019 Google LLC
194
- *
195
- * Licensed under the Apache License, Version 2.0 (the "License");
196
- * you may not use this file except in compliance with the License.
197
- * You may obtain a copy of the License at
198
- *
199
- * http://www.apache.org/licenses/LICENSE-2.0
200
- *
201
- * Unless required by applicable law or agreed to in writing, software
202
- * distributed under the License is distributed on an "AS IS" BASIS,
203
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
- * See the License for the specific language governing permissions and
205
- * limitations under the License.
206
- */class NS{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const r=new wS;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),r=(t==null?void 0:t.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(LS(t))try{this.getOrInitializeService({instanceIdentifier:ts})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const o=this.getOrInitializeService({instanceIdentifier:s});r.resolve(o)}catch{}}}}clearInstance(t=ts){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=ts){return this.instances.has(t)}getOptions(t=ts){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[o,i]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(o);r===a&&i.resolve(s)}return s}onInit(t,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:DS(t),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch{}return r||null}normalizeInstanceIdentifier(t=ts){return this.component?this.component.multipleInstances?t:ts:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function DS(e){return e===ts?void 0:e}function LS(e){return e.instantiationMode==="EAGER"}/**
207
- * @license
208
- * Copyright 2019 Google LLC
209
- *
210
- * Licensed under the Apache License, Version 2.0 (the "License");
211
- * you may not use this file except in compliance with the License.
212
- * You may obtain a copy of the License at
213
- *
214
- * http://www.apache.org/licenses/LICENSE-2.0
215
- *
216
- * Unless required by applicable law or agreed to in writing, software
217
- * distributed under the License is distributed on an "AS IS" BASIS,
218
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
- * See the License for the specific language governing permissions and
220
- * limitations under the License.
221
- */class jS{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new NS(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
222
- * @license
223
- * Copyright 2017 Google LLC
224
- *
225
- * Licensed under the Apache License, Version 2.0 (the "License");
226
- * you may not use this file except in compliance with the License.
227
- * You may obtain a copy of the License at
228
- *
229
- * http://www.apache.org/licenses/LICENSE-2.0
230
- *
231
- * Unless required by applicable law or agreed to in writing, software
232
- * distributed under the License is distributed on an "AS IS" BASIS,
233
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
234
- * See the License for the specific language governing permissions and
235
- * limitations under the License.
236
- */var Tt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(Tt||(Tt={}));const US={debug:Tt.DEBUG,verbose:Tt.VERBOSE,info:Tt.INFO,warn:Tt.WARN,error:Tt.ERROR,silent:Tt.SILENT},FS=Tt.INFO,BS={[Tt.DEBUG]:"log",[Tt.VERBOSE]:"log",[Tt.INFO]:"info",[Tt.WARN]:"warn",[Tt.ERROR]:"error"},HS=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=BS[t];if(s)console[s](`[${r}] ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class Jf{constructor(t){this.name=t,this._logLevel=FS,this._logHandler=HS,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Tt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?US[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,Tt.DEBUG,...t),this._logHandler(this,Tt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Tt.VERBOSE,...t),this._logHandler(this,Tt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Tt.INFO,...t),this._logHandler(this,Tt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Tt.WARN,...t),this._logHandler(this,Tt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Tt.ERROR,...t),this._logHandler(this,Tt.ERROR,...t)}}const WS=(e,t)=>t.some(n=>e instanceof n);let Tu,Su;function VS(){return Tu||(Tu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function zS(){return Su||(Su=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Yf=new WeakMap,el=new WeakMap,Xf=new WeakMap,ka=new WeakMap,jl=new WeakMap;function GS(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(jr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Yf.set(n,e)}).catch(()=>{}),jl.set(t,e),t}function qS(e){if(el.has(e))return;const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{n(),s()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)});el.set(e,t)}let tl={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return el.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Xf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return jr(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function KS(e){tl=e(tl)}function JS(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ta(this),t,...n);return Xf.set(r,t.sort?t.sort():[t]),jr(r)}:zS().includes(e)?function(...t){return e.apply(Ta(this),t),jr(Yf.get(this))}:function(...t){return jr(e.apply(Ta(this),t))}}function YS(e){return typeof e=="function"?JS(e):(e instanceof IDBTransaction&&qS(e),WS(e,VS())?new Proxy(e,tl):e)}function jr(e){if(e instanceof IDBRequest)return GS(e);if(ka.has(e))return ka.get(e);const t=YS(e);return t!==e&&(ka.set(e,t),jl.set(t,e)),t}const Ta=e=>jl.get(e);function XS(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=jr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(jr(i.result),l.oldVersion,l.newVersion,jr(i.transaction),l)}),n&&i.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),s&&l.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const QS=["get","getKey","getAll","getAllKeys","count"],ZS=["put","add","delete","clear"],Sa=new Map;function Iu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Sa.get(t))return Sa.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=ZS.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||QS.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let u=l.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),s&&l.done]))[0]};return Sa.set(t,o),o}KS(e=>({...e,get:(t,n,r)=>Iu(t,n)||e.get(t,n,r),has:(t,n)=>!!Iu(t,n)||e.has(t,n)}));/**
237
- * @license
238
- * Copyright 2019 Google LLC
239
- *
240
- * Licensed under the Apache License, Version 2.0 (the "License");
241
- * you may not use this file except in compliance with the License.
242
- * You may obtain a copy of the License at
243
- *
244
- * http://www.apache.org/licenses/LICENSE-2.0
245
- *
246
- * Unless required by applicable law or agreed to in writing, software
247
- * distributed under the License is distributed on an "AS IS" BASIS,
248
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
249
- * See the License for the specific language governing permissions and
250
- * limitations under the License.
251
- */class eI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(tI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function tI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const nl="@firebase/app",Eu="0.14.10";/**
252
- * @license
253
- * Copyright 2019 Google LLC
254
- *
255
- * Licensed under the Apache License, Version 2.0 (the "License");
256
- * you may not use this file except in compliance with the License.
257
- * You may obtain a copy of the License at
258
- *
259
- * http://www.apache.org/licenses/LICENSE-2.0
260
- *
261
- * Unless required by applicable law or agreed to in writing, software
262
- * distributed under the License is distributed on an "AS IS" BASIS,
263
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
264
- * See the License for the specific language governing permissions and
265
- * limitations under the License.
266
- */const Ir=new Jf("@firebase/app"),nI="@firebase/app-compat",rI="@firebase/analytics-compat",sI="@firebase/analytics",oI="@firebase/app-check-compat",iI="@firebase/app-check",aI="@firebase/auth",lI="@firebase/auth-compat",cI="@firebase/database",uI="@firebase/data-connect",dI="@firebase/database-compat",fI="@firebase/functions",hI="@firebase/functions-compat",pI="@firebase/installations",mI="@firebase/installations-compat",gI="@firebase/messaging",vI="@firebase/messaging-compat",yI="@firebase/performance",wI="@firebase/performance-compat",bI="@firebase/remote-config",_I="@firebase/remote-config-compat",kI="@firebase/storage",TI="@firebase/storage-compat",SI="@firebase/firestore",II="@firebase/ai",EI="@firebase/firestore-compat",CI="firebase",AI="12.11.0";/**
267
- * @license
268
- * Copyright 2019 Google LLC
269
- *
270
- * Licensed under the Apache License, Version 2.0 (the "License");
271
- * you may not use this file except in compliance with the License.
272
- * You may obtain a copy of the License at
273
- *
274
- * http://www.apache.org/licenses/LICENSE-2.0
275
- *
276
- * Unless required by applicable law or agreed to in writing, software
277
- * distributed under the License is distributed on an "AS IS" BASIS,
278
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
279
- * See the License for the specific language governing permissions and
280
- * limitations under the License.
281
- */const rl="[DEFAULT]",xI={[nl]:"fire-core",[nI]:"fire-core-compat",[sI]:"fire-analytics",[rI]:"fire-analytics-compat",[iI]:"fire-app-check",[oI]:"fire-app-check-compat",[aI]:"fire-auth",[lI]:"fire-auth-compat",[cI]:"fire-rtdb",[uI]:"fire-data-connect",[dI]:"fire-rtdb-compat",[fI]:"fire-fn",[hI]:"fire-fn-compat",[pI]:"fire-iid",[mI]:"fire-iid-compat",[gI]:"fire-fcm",[vI]:"fire-fcm-compat",[yI]:"fire-perf",[wI]:"fire-perf-compat",[bI]:"fire-rc",[_I]:"fire-rc-compat",[kI]:"fire-gcs",[TI]:"fire-gcs-compat",[SI]:"fire-fst",[EI]:"fire-fst-compat",[II]:"fire-vertex","fire-js":"fire-js",[CI]:"fire-js-all"};/**
282
- * @license
283
- * Copyright 2019 Google LLC
284
- *
285
- * Licensed under the Apache License, Version 2.0 (the "License");
286
- * you may not use this file except in compliance with the License.
287
- * You may obtain a copy of the License at
288
- *
289
- * http://www.apache.org/licenses/LICENSE-2.0
290
- *
291
- * Unless required by applicable law or agreed to in writing, software
292
- * distributed under the License is distributed on an "AS IS" BASIS,
293
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
294
- * See the License for the specific language governing permissions and
295
- * limitations under the License.
296
- */const yo=new Map,RI=new Map,sl=new Map;function Cu(e,t){try{e.container.addComponent(t)}catch(n){Ir.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function wo(e){const t=e.name;if(sl.has(t))return Ir.debug(`There were multiple attempts to register component ${t}.`),!1;sl.set(t,e);for(const n of yo.values())Cu(n,e);for(const n of RI.values())Cu(n,e);return!0}function Qf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function tr(e){return e==null?!1:e.settings!==void 0}/**
297
- * @license
298
- * Copyright 2019 Google LLC
299
- *
300
- * Licensed under the Apache License, Version 2.0 (the "License");
301
- * you may not use this file except in compliance with the License.
302
- * You may obtain a copy of the License at
303
- *
304
- * http://www.apache.org/licenses/LICENSE-2.0
305
- *
306
- * Unless required by applicable law or agreed to in writing, software
307
- * distributed under the License is distributed on an "AS IS" BASIS,
308
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
309
- * See the License for the specific language governing permissions and
310
- * limitations under the License.
311
- */const PI={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Ur=new Co("app","Firebase",PI);/**
312
- * @license
313
- * Copyright 2019 Google LLC
314
- *
315
- * Licensed under the Apache License, Version 2.0 (the "License");
316
- * you may not use this file except in compliance with the License.
317
- * You may obtain a copy of the License at
318
- *
319
- * http://www.apache.org/licenses/LICENSE-2.0
320
- *
321
- * Unless required by applicable law or agreed to in writing, software
322
- * distributed under the License is distributed on an "AS IS" BASIS,
323
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
324
- * See the License for the specific language governing permissions and
325
- * limitations under the License.
326
- */class MI{constructor(t,n,r){this._isDeleted=!1,this._options={...t},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new $s("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Ur.create("app-deleted",{appName:this._name})}}/**
327
- * @license
328
- * Copyright 2019 Google LLC
329
- *
330
- * Licensed under the Apache License, Version 2.0 (the "License");
331
- * you may not use this file except in compliance with the License.
332
- * You may obtain a copy of the License at
333
- *
334
- * http://www.apache.org/licenses/LICENSE-2.0
335
- *
336
- * Unless required by applicable law or agreed to in writing, software
337
- * distributed under the License is distributed on an "AS IS" BASIS,
338
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
339
- * See the License for the specific language governing permissions and
340
- * limitations under the License.
341
- */const xo=AI;function Zf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:rl,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw Ur.create("bad-app-name",{appName:String(s)});if(n||(n=qf()),!n)throw Ur.create("no-options");const o=yo.get(s);if(o){if(Ms(n,o.options)&&Ms(r,o.config))return o;throw Ur.create("duplicate-app",{appName:s})}const i=new jS(s);for(const l of sl.values())i.addComponent(l);const a=new MI(n,r,i);return yo.set(s,a),a}function eh(e=rl){const t=yo.get(e);if(!t&&e===rl&&qf())return Zf();if(!t)throw Ur.create("no-app",{appName:e});return t}function $I(){return Array.from(yo.values())}function Is(e,t,n){let r=xI[e]??e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const i=[`Unable to register library "${r}" with version "${t}":`];s&&i.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&i.push("and"),o&&i.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Ir.warn(i.join(" "));return}wo(new $s(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
342
- * @license
343
- * Copyright 2021 Google LLC
344
- *
345
- * Licensed under the Apache License, Version 2.0 (the "License");
346
- * you may not use this file except in compliance with the License.
347
- * You may obtain a copy of the License at
348
- *
349
- * http://www.apache.org/licenses/LICENSE-2.0
350
- *
351
- * Unless required by applicable law or agreed to in writing, software
352
- * distributed under the License is distributed on an "AS IS" BASIS,
353
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
354
- * See the License for the specific language governing permissions and
355
- * limitations under the License.
356
- */const OI="firebase-heartbeat-database",NI=1,bo="firebase-heartbeat-store";let Ia=null;function th(){return Ia||(Ia=XS(OI,NI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(bo)}catch(n){console.warn(n)}}}}).catch(e=>{throw Ur.create("idb-open",{originalErrorMessage:e.message})})),Ia}async function DI(e){try{const n=(await th()).transaction(bo),r=await n.objectStore(bo).get(nh(e));return await n.done,r}catch(t){if(t instanceof Wr)Ir.warn(t.message);else{const n=Ur.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Ir.warn(n.message)}}}async function Au(e,t){try{const r=(await th()).transaction(bo,"readwrite");await r.objectStore(bo).put(t,nh(e)),await r.done}catch(n){if(n instanceof Wr)Ir.warn(n.message);else{const r=Ur.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Ir.warn(r.message)}}}function nh(e){return`${e.name}!${e.options.appId}`}/**
357
- * @license
358
- * Copyright 2021 Google LLC
359
- *
360
- * Licensed under the Apache License, Version 2.0 (the "License");
361
- * you may not use this file except in compliance with the License.
362
- * You may obtain a copy of the License at
363
- *
364
- * http://www.apache.org/licenses/LICENSE-2.0
365
- *
366
- * Unless required by applicable law or agreed to in writing, software
367
- * distributed under the License is distributed on an "AS IS" BASIS,
368
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
369
- * See the License for the specific language governing permissions and
370
- * limitations under the License.
371
- */const LI=1024,jI=30;class UI{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new BI(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var t,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=xu();if(((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(i=>i.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:s}),this._heartbeatsCache.heartbeats.length>jI){const i=HI(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Ir.warn(r)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=xu(),{heartbeatsToSend:r,unsentEntries:s}=FI(this._heartbeatsCache.heartbeats),o=zf(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Ir.warn(n),""}}}function xu(){return new Date().toISOString().substring(0,10)}function FI(e,t=LI){const n=[];let r=e.slice();for(const s of e){const o=n.find(i=>i.agent===s.agent);if(o){if(o.dates.push(s.date),Ru(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Ru(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class BI{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return IS()?ES().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await DI(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Au(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Au(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Ru(e){return zf(JSON.stringify({version:2,heartbeats:e})).length}function HI(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}/**
372
- * @license
373
- * Copyright 2019 Google LLC
374
- *
375
- * Licensed under the Apache License, Version 2.0 (the "License");
376
- * you may not use this file except in compliance with the License.
377
- * You may obtain a copy of the License at
378
- *
379
- * http://www.apache.org/licenses/LICENSE-2.0
380
- *
381
- * Unless required by applicable law or agreed to in writing, software
382
- * distributed under the License is distributed on an "AS IS" BASIS,
383
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
384
- * See the License for the specific language governing permissions and
385
- * limitations under the License.
386
- */function WI(e){wo(new $s("platform-logger",t=>new eI(t),"PRIVATE")),wo(new $s("heartbeat",t=>new UI(t),"PRIVATE")),Is(nl,Eu,e),Is(nl,Eu,"esm2020"),Is("fire-js","")}WI("");var VI="firebase",zI="12.11.0";/**
387
- * @license
388
- * Copyright 2020 Google LLC
389
- *
390
- * Licensed under the Apache License, Version 2.0 (the "License");
391
- * you may not use this file except in compliance with the License.
392
- * You may obtain a copy of the License at
393
- *
394
- * http://www.apache.org/licenses/LICENSE-2.0
395
- *
396
- * Unless required by applicable law or agreed to in writing, software
397
- * distributed under the License is distributed on an "AS IS" BASIS,
398
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
399
- * See the License for the specific language governing permissions and
400
- * limitations under the License.
401
- */Is(VI,zI,"app");function rh(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const GI=rh,sh=new Co("auth","Firebase",rh());/**
402
- * @license
403
- * Copyright 2020 Google LLC
404
- *
405
- * Licensed under the Apache License, Version 2.0 (the "License");
406
- * you may not use this file except in compliance with the License.
407
- * You may obtain a copy of the License at
408
- *
409
- * http://www.apache.org/licenses/LICENSE-2.0
410
- *
411
- * Unless required by applicable law or agreed to in writing, software
412
- * distributed under the License is distributed on an "AS IS" BASIS,
413
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
414
- * See the License for the specific language governing permissions and
415
- * limitations under the License.
416
- */const gi=new Jf("@firebase/auth");function qI(e,...t){gi.logLevel<=Tt.WARN&&gi.warn(`Auth (${xo}): ${e}`,...t)}function ni(e,...t){gi.logLevel<=Tt.ERROR&&gi.error(`Auth (${xo}): ${e}`,...t)}/**
417
- * @license
418
- * Copyright 2020 Google LLC
419
- *
420
- * Licensed under the Apache License, Version 2.0 (the "License");
421
- * you may not use this file except in compliance with the License.
422
- * You may obtain a copy of the License at
423
- *
424
- * http://www.apache.org/licenses/LICENSE-2.0
425
- *
426
- * Unless required by applicable law or agreed to in writing, software
427
- * distributed under the License is distributed on an "AS IS" BASIS,
428
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
429
- * See the License for the specific language governing permissions and
430
- * limitations under the License.
431
- */function ir(e,...t){throw Fl(e,...t)}function Wn(e,...t){return Fl(e,...t)}function Ul(e,t,n){const r={...GI(),[t]:n};return new Co("auth","Firebase",r).create(t,{appName:e.name})}function ls(e){return Ul(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function KI(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&ir(e,"argument-error"),Ul(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Fl(e,...t){if(typeof e!="string"){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return sh.create(e,...t)}function qe(e,t,...n){if(!e)throw Fl(t,...n)}function vr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ni(t),new Error(t)}function Er(e,t){e||vr(t)}/**
432
- * @license
433
- * Copyright 2020 Google LLC
434
- *
435
- * Licensed under the Apache License, Version 2.0 (the "License");
436
- * you may not use this file except in compliance with the License.
437
- * You may obtain a copy of the License at
438
- *
439
- * http://www.apache.org/licenses/LICENSE-2.0
440
- *
441
- * Unless required by applicable law or agreed to in writing, software
442
- * distributed under the License is distributed on an "AS IS" BASIS,
443
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
444
- * See the License for the specific language governing permissions and
445
- * limitations under the License.
446
- */function ol(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function JI(){return Pu()==="http:"||Pu()==="https:"}function Pu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
447
- * @license
448
- * Copyright 2020 Google LLC
449
- *
450
- * Licensed under the Apache License, Version 2.0 (the "License");
451
- * you may not use this file except in compliance with the License.
452
- * You may obtain a copy of the License at
453
- *
454
- * http://www.apache.org/licenses/LICENSE-2.0
455
- *
456
- * Unless required by applicable law or agreed to in writing, software
457
- * distributed under the License is distributed on an "AS IS" BASIS,
458
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
459
- * See the License for the specific language governing permissions and
460
- * limitations under the License.
461
- */function YI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(JI()||kS()||"connection"in navigator)?navigator.onLine:!0}function XI(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
462
- * @license
463
- * Copyright 2020 Google LLC
464
- *
465
- * Licensed under the Apache License, Version 2.0 (the "License");
466
- * you may not use this file except in compliance with the License.
467
- * You may obtain a copy of the License at
468
- *
469
- * http://www.apache.org/licenses/LICENSE-2.0
470
- *
471
- * Unless required by applicable law or agreed to in writing, software
472
- * distributed under the License is distributed on an "AS IS" BASIS,
473
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
474
- * See the License for the specific language governing permissions and
475
- * limitations under the License.
476
- */class Ro{constructor(t,n){this.shortDelay=t,this.longDelay=n,Er(n>t,"Short delay should be less than long delay!"),this.isMobile=bS()||TS()}get(){return YI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
477
- * @license
478
- * Copyright 2020 Google LLC
479
- *
480
- * Licensed under the Apache License, Version 2.0 (the "License");
481
- * you may not use this file except in compliance with the License.
482
- * You may obtain a copy of the License at
483
- *
484
- * http://www.apache.org/licenses/LICENSE-2.0
485
- *
486
- * Unless required by applicable law or agreed to in writing, software
487
- * distributed under the License is distributed on an "AS IS" BASIS,
488
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
489
- * See the License for the specific language governing permissions and
490
- * limitations under the License.
491
- */function Bl(e,t){Er(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
492
- * @license
493
- * Copyright 2020 Google LLC
494
- *
495
- * Licensed under the Apache License, Version 2.0 (the "License");
496
- * you may not use this file except in compliance with the License.
497
- * You may obtain a copy of the License at
498
- *
499
- * http://www.apache.org/licenses/LICENSE-2.0
500
- *
501
- * Unless required by applicable law or agreed to in writing, software
502
- * distributed under the License is distributed on an "AS IS" BASIS,
503
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
504
- * See the License for the specific language governing permissions and
505
- * limitations under the License.
506
- */class oh{static initialize(t,n,r){this.fetchImpl=t,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;vr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;vr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;vr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
507
- * @license
508
- * Copyright 2020 Google LLC
509
- *
510
- * Licensed under the Apache License, Version 2.0 (the "License");
511
- * you may not use this file except in compliance with the License.
512
- * You may obtain a copy of the License at
513
- *
514
- * http://www.apache.org/licenses/LICENSE-2.0
515
- *
516
- * Unless required by applicable law or agreed to in writing, software
517
- * distributed under the License is distributed on an "AS IS" BASIS,
518
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
519
- * See the License for the specific language governing permissions and
520
- * limitations under the License.
521
- */const QI={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
522
- * @license
523
- * Copyright 2020 Google LLC
524
- *
525
- * Licensed under the Apache License, Version 2.0 (the "License");
526
- * you may not use this file except in compliance with the License.
527
- * You may obtain a copy of the License at
528
- *
529
- * http://www.apache.org/licenses/LICENSE-2.0
530
- *
531
- * Unless required by applicable law or agreed to in writing, software
532
- * distributed under the License is distributed on an "AS IS" BASIS,
533
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
534
- * See the License for the specific language governing permissions and
535
- * limitations under the License.
536
- */const ZI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],eE=new Ro(3e4,6e4);function Hl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Ls(e,t,n,r,s={}){return ih(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ao({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const u={method:t,headers:l,...o};return _S()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&Ll(e.emulatorConfig.host)&&(u.credentials="include"),oh.fetch()(await ah(e,e.config.apiHost,n,a),u)})}async function ih(e,t,n){e._canInitEmulator=!1;const r={...QI,...t};try{const s=new nE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw zo(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const a=o.ok?i.errorMessage:i.error.message,[l,u]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw zo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw zo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw zo(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Ul(e,c,u);ir(e,c)}}catch(s){if(s instanceof Wr)throw s;ir(e,"network-request-failed",{message:String(s)})}}async function tE(e,t,n,r,s={}){const o=await Ls(e,t,n,r,s);return"mfaPendingCredential"in o&&ir(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function ah(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Bl(e.config,s):`${e.config.apiScheme}://${s}`;return ZI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class nE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Wn(this.auth,"network-request-failed")),eE.get())})}}function zo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Wn(e,t,r);return s.customData._tokenResponse=n,s}/**
537
- * @license
538
- * Copyright 2020 Google LLC
539
- *
540
- * Licensed under the Apache License, Version 2.0 (the "License");
541
- * you may not use this file except in compliance with the License.
542
- * You may obtain a copy of the License at
543
- *
544
- * http://www.apache.org/licenses/LICENSE-2.0
545
- *
546
- * Unless required by applicable law or agreed to in writing, software
547
- * distributed under the License is distributed on an "AS IS" BASIS,
548
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
549
- * See the License for the specific language governing permissions and
550
- * limitations under the License.
551
- */async function rE(e,t){return Ls(e,"POST","/v1/accounts:delete",t)}async function vi(e,t){return Ls(e,"POST","/v1/accounts:lookup",t)}/**
552
- * @license
553
- * Copyright 2020 Google LLC
554
- *
555
- * Licensed under the Apache License, Version 2.0 (the "License");
556
- * you may not use this file except in compliance with the License.
557
- * You may obtain a copy of the License at
558
- *
559
- * http://www.apache.org/licenses/LICENSE-2.0
560
- *
561
- * Unless required by applicable law or agreed to in writing, software
562
- * distributed under the License is distributed on an "AS IS" BASIS,
563
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
564
- * See the License for the specific language governing permissions and
565
- * limitations under the License.
566
- */function io(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function sE(e,t=!1){const n=Ds(e),r=await n.getIdToken(t),s=Wl(r);qe(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o=typeof s.firebase=="object"?s.firebase:void 0,i=o==null?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:io(Ea(s.auth_time)),issuedAtTime:io(Ea(s.iat)),expirationTime:io(Ea(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Ea(e){return Number(e)*1e3}function Wl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return ni("JWT malformed, contained fewer than 3 sections"),null;try{const s=Gf(n);return s?JSON.parse(s):(ni("Failed to decode base64 JWT payload"),null)}catch(s){return ni("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Mu(e){const t=Wl(e);return qe(t,"internal-error"),qe(typeof t.exp<"u","internal-error"),qe(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
567
- * @license
568
- * Copyright 2020 Google LLC
569
- *
570
- * Licensed under the Apache License, Version 2.0 (the "License");
571
- * you may not use this file except in compliance with the License.
572
- * You may obtain a copy of the License at
573
- *
574
- * http://www.apache.org/licenses/LICENSE-2.0
575
- *
576
- * Unless required by applicable law or agreed to in writing, software
577
- * distributed under the License is distributed on an "AS IS" BASIS,
578
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
579
- * See the License for the specific language governing permissions and
580
- * limitations under the License.
581
- */async function _o(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Wr&&oE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function oE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
582
- * @license
583
- * Copyright 2020 Google LLC
584
- *
585
- * Licensed under the Apache License, Version 2.0 (the "License");
586
- * you may not use this file except in compliance with the License.
587
- * You may obtain a copy of the License at
588
- *
589
- * http://www.apache.org/licenses/LICENSE-2.0
590
- *
591
- * Unless required by applicable law or agreed to in writing, software
592
- * distributed under the License is distributed on an "AS IS" BASIS,
593
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
594
- * See the License for the specific language governing permissions and
595
- * limitations under the License.
596
- */class iE{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;const n=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
597
- * @license
598
- * Copyright 2020 Google LLC
599
- *
600
- * Licensed under the Apache License, Version 2.0 (the "License");
601
- * you may not use this file except in compliance with the License.
602
- * You may obtain a copy of the License at
603
- *
604
- * http://www.apache.org/licenses/LICENSE-2.0
605
- *
606
- * Unless required by applicable law or agreed to in writing, software
607
- * distributed under the License is distributed on an "AS IS" BASIS,
608
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
609
- * See the License for the specific language governing permissions and
610
- * limitations under the License.
611
- */class il{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=io(this.lastLoginAt),this.creationTime=io(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
612
- * @license
613
- * Copyright 2019 Google LLC
614
- *
615
- * Licensed under the Apache License, Version 2.0 (the "License");
616
- * you may not use this file except in compliance with the License.
617
- * You may obtain a copy of the License at
618
- *
619
- * http://www.apache.org/licenses/LICENSE-2.0
620
- *
621
- * Unless required by applicable law or agreed to in writing, software
622
- * distributed under the License is distributed on an "AS IS" BASIS,
623
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
624
- * See the License for the specific language governing permissions and
625
- * limitations under the License.
626
- */async function yi(e){var f;const t=e.auth,n=await e.getIdToken(),r=await _o(e,vi(t,{idToken:n}));qe(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(f=s.providerUserInfo)!=null&&f.length?lh(s.providerUserInfo):[],i=lE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),u=a?l:!1,c={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new il(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,c)}async function aE(e){const t=Ds(e);await yi(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function lE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function lh(e){return e.map(({providerId:t,...n})=>({providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
627
- * @license
628
- * Copyright 2020 Google LLC
629
- *
630
- * Licensed under the Apache License, Version 2.0 (the "License");
631
- * you may not use this file except in compliance with the License.
632
- * You may obtain a copy of the License at
633
- *
634
- * http://www.apache.org/licenses/LICENSE-2.0
635
- *
636
- * Unless required by applicable law or agreed to in writing, software
637
- * distributed under the License is distributed on an "AS IS" BASIS,
638
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
639
- * See the License for the specific language governing permissions and
640
- * limitations under the License.
641
- */async function cE(e,t){const n=await ih(e,{},async()=>{const r=Ao({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await ah(e,s,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return e.emulatorConfig&&Ll(e.emulatorConfig.host)&&(l.credentials="include"),oh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function uE(e,t){return Ls(e,"POST","/v2/accounts:revokeToken",Hl(e,t))}/**
642
- * @license
643
- * Copyright 2020 Google LLC
644
- *
645
- * Licensed under the Apache License, Version 2.0 (the "License");
646
- * you may not use this file except in compliance with the License.
647
- * You may obtain a copy of the License at
648
- *
649
- * http://www.apache.org/licenses/LICENSE-2.0
650
- *
651
- * Unless required by applicable law or agreed to in writing, software
652
- * distributed under the License is distributed on an "AS IS" BASIS,
653
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
654
- * See the License for the specific language governing permissions and
655
- * limitations under the License.
656
- */class Es{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){qe(t.idToken,"internal-error"),qe(typeof t.idToken<"u","internal-error"),qe(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Mu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){qe(t.length!==0,"internal-error");const n=Mu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(qe(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,n){const{accessToken:r,refreshToken:s,expiresIn:o}=await cE(t,n);this.updateTokensAndExpiration(r,s,Number(o))}updateTokensAndExpiration(t,n,r){this.refreshToken=n||null,this.accessToken=t||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(t,n){const{refreshToken:r,accessToken:s,expirationTime:o}=n,i=new Es;return r&&(qe(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(qe(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(qe(typeof o=="number","internal-error",{appName:t}),i.expirationTime=o),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Es,this.toJSON())}_performRefresh(){return vr("not implemented")}}/**
657
- * @license
658
- * Copyright 2020 Google LLC
659
- *
660
- * Licensed under the Apache License, Version 2.0 (the "License");
661
- * you may not use this file except in compliance with the License.
662
- * You may obtain a copy of the License at
663
- *
664
- * http://www.apache.org/licenses/LICENSE-2.0
665
- *
666
- * Unless required by applicable law or agreed to in writing, software
667
- * distributed under the License is distributed on an "AS IS" BASIS,
668
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
669
- * See the License for the specific language governing permissions and
670
- * limitations under the License.
671
- */function Pr(e,t){qe(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class Fn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new iE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new il(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await _o(this,this.stsTokenManager.getToken(this.auth,t));return qe(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return sE(this,t)}reload(){return aE(this)}_assign(t){this!==t&&(qe(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(n=>({...n})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const n=new Fn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){qe(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,n=!1){let r=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),n&&await yi(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(tr(this.auth.app))return Promise.reject(ls(this.auth));const t=await this.getIdToken();return await _o(this,rE(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,n){const r=n.displayName??void 0,s=n.email??void 0,o=n.phoneNumber??void 0,i=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,u=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:S,providerData:L,stsTokenManager:O}=n;qe(f&&O,t,"internal-error");const V=Es.fromJSON(this.name,O);qe(typeof f=="string",t,"internal-error"),Pr(r,t.name),Pr(s,t.name),qe(typeof m=="boolean",t,"internal-error"),qe(typeof S=="boolean",t,"internal-error"),Pr(o,t.name),Pr(i,t.name),Pr(a,t.name),Pr(l,t.name),Pr(u,t.name),Pr(c,t.name);const R=new Fn({uid:f,auth:t,email:s,emailVerified:m,displayName:r,isAnonymous:S,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:V,createdAt:u,lastLoginAt:c});return L&&Array.isArray(L)&&(R.providerData=L.map(P=>({...P}))),l&&(R._redirectEventId=l),R}static async _fromIdTokenResponse(t,n,r=!1){const s=new Es;s.updateFromServerResponse(n);const o=new Fn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await yi(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];qe(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?lh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Es;a.updateFromIdToken(r);const l=new Fn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new il(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,u),l}}/**
672
- * @license
673
- * Copyright 2020 Google LLC
674
- *
675
- * Licensed under the Apache License, Version 2.0 (the "License");
676
- * you may not use this file except in compliance with the License.
677
- * You may obtain a copy of the License at
678
- *
679
- * http://www.apache.org/licenses/LICENSE-2.0
680
- *
681
- * Unless required by applicable law or agreed to in writing, software
682
- * distributed under the License is distributed on an "AS IS" BASIS,
683
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
- * See the License for the specific language governing permissions and
685
- * limitations under the License.
686
- */const $u=new Map;function yr(e){Er(e instanceof Function,"Expected a class definition");let t=$u.get(e);return t?(Er(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,$u.set(e,t),t)}/**
687
- * @license
688
- * Copyright 2019 Google LLC
689
- *
690
- * Licensed under the Apache License, Version 2.0 (the "License");
691
- * you may not use this file except in compliance with the License.
692
- * You may obtain a copy of the License at
693
- *
694
- * http://www.apache.org/licenses/LICENSE-2.0
695
- *
696
- * Unless required by applicable law or agreed to in writing, software
697
- * distributed under the License is distributed on an "AS IS" BASIS,
698
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
699
- * See the License for the specific language governing permissions and
700
- * limitations under the License.
701
- */class ch{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,n){this.storage[t]=n}async _get(t){const n=this.storage[t];return n===void 0?null:n}async _remove(t){delete this.storage[t]}_addListener(t,n){}_removeListener(t,n){}}ch.type="NONE";const Ou=ch;/**
702
- * @license
703
- * Copyright 2019 Google LLC
704
- *
705
- * Licensed under the Apache License, Version 2.0 (the "License");
706
- * you may not use this file except in compliance with the License.
707
- * You may obtain a copy of the License at
708
- *
709
- * http://www.apache.org/licenses/LICENSE-2.0
710
- *
711
- * Unless required by applicable law or agreed to in writing, software
712
- * distributed under the License is distributed on an "AS IS" BASIS,
713
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
714
- * See the License for the specific language governing permissions and
715
- * limitations under the License.
716
- */function ri(e,t,n){return`firebase:${e}:${t}:${n}`}class Cs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=ri(this.userKey,s.apiKey,o),this.fullPersistenceKey=ri("persistence",s.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const n=await vi(this.auth,{idToken:t}).catch(()=>{});return n?Fn._fromGetAccountInfoResponse(this.auth,n,t):null}return Fn._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=t,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r="authUser"){if(!n.length)return new Cs(yr(Ou),t,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let o=s[0]||yr(Ou);const i=ri(r,t.config.apiKey,t.name);let a=null;for(const u of n)try{const c=await u._get(i);if(c){let f;if(typeof c=="string"){const m=await vi(t,{idToken:c}).catch(()=>{});if(!m)break;f=await Fn._fromGetAccountInfoResponse(t,m,c)}else f=Fn._fromJSON(t,c);u!==o&&(a=f),o=u;break}}catch{}const l=s.filter(u=>u._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new Cs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==o)try{await u._remove(i)}catch{}})),new Cs(o,t,r))}}/**
717
- * @license
718
- * Copyright 2020 Google LLC
719
- *
720
- * Licensed under the Apache License, Version 2.0 (the "License");
721
- * you may not use this file except in compliance with the License.
722
- * You may obtain a copy of the License at
723
- *
724
- * http://www.apache.org/licenses/LICENSE-2.0
725
- *
726
- * Unless required by applicable law or agreed to in writing, software
727
- * distributed under the License is distributed on an "AS IS" BASIS,
728
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
729
- * See the License for the specific language governing permissions and
730
- * limitations under the License.
731
- */function Nu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(hh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(uh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(mh(t))return"Blackberry";if(gh(t))return"Webos";if(dh(t))return"Safari";if((t.includes("chrome/")||fh(t))&&!t.includes("edge/"))return"Chrome";if(ph(t))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function uh(e=wn()){return/firefox\//i.test(e)}function dh(e=wn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function fh(e=wn()){return/crios\//i.test(e)}function hh(e=wn()){return/iemobile/i.test(e)}function ph(e=wn()){return/android/i.test(e)}function mh(e=wn()){return/blackberry/i.test(e)}function gh(e=wn()){return/webos/i.test(e)}function Vl(e=wn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function dE(e=wn()){var t;return Vl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function fE(){return SS()&&document.documentMode===10}function vh(e=wn()){return Vl(e)||ph(e)||gh(e)||mh(e)||/windows phone/i.test(e)||hh(e)}/**
732
- * @license
733
- * Copyright 2020 Google LLC
734
- *
735
- * Licensed under the Apache License, Version 2.0 (the "License");
736
- * you may not use this file except in compliance with the License.
737
- * You may obtain a copy of the License at
738
- *
739
- * http://www.apache.org/licenses/LICENSE-2.0
740
- *
741
- * Unless required by applicable law or agreed to in writing, software
742
- * distributed under the License is distributed on an "AS IS" BASIS,
743
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
744
- * See the License for the specific language governing permissions and
745
- * limitations under the License.
746
- */function yh(e,t=[]){let n;switch(e){case"Browser":n=Nu(wn());break;case"Worker":n=`${Nu(wn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${xo}/${r}`}/**
747
- * @license
748
- * Copyright 2022 Google LLC
749
- *
750
- * Licensed under the Apache License, Version 2.0 (the "License");
751
- * you may not use this file except in compliance with the License.
752
- * You may obtain a copy of the License at
753
- *
754
- * http://www.apache.org/licenses/LICENSE-2.0
755
- *
756
- * Unless required by applicable law or agreed to in writing, software
757
- * distributed under the License is distributed on an "AS IS" BASIS,
758
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
759
- * See the License for the specific language governing permissions and
760
- * limitations under the License.
761
- */class hE{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,a)=>{try{const l=t(o);i(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const n=[];try{for(const r of this.queue)await r(t),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
762
- * @license
763
- * Copyright 2023 Google LLC
764
- *
765
- * Licensed under the Apache License, Version 2.0 (the "License");
766
- * you may not use this file except in compliance with the License.
767
- * You may obtain a copy of the License at
768
- *
769
- * http://www.apache.org/licenses/LICENSE-2.0
770
- *
771
- * Unless required by applicable law or agreed to in writing, software
772
- * distributed under the License is distributed on an "AS IS" BASIS,
773
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
774
- * See the License for the specific language governing permissions and
775
- * limitations under the License.
776
- */async function pE(e,t={}){return Ls(e,"GET","/v2/passwordPolicy",Hl(e,t))}/**
777
- * @license
778
- * Copyright 2023 Google LLC
779
- *
780
- * Licensed under the Apache License, Version 2.0 (the "License");
781
- * you may not use this file except in compliance with the License.
782
- * You may obtain a copy of the License at
783
- *
784
- * http://www.apache.org/licenses/LICENSE-2.0
785
- *
786
- * Unless required by applicable law or agreed to in writing, software
787
- * distributed under the License is distributed on an "AS IS" BASIS,
788
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
789
- * See the License for the specific language governing permissions and
790
- * limitations under the License.
791
- */const mE=6;class gE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??mE,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=t.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,n),this.validatePasswordCharacterOptions(t,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(t,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=t.length>=r),s&&(n.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<t.length;s++)r=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(t,n,r,s,o){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=o))}}/**
792
- * @license
793
- * Copyright 2020 Google LLC
794
- *
795
- * Licensed under the Apache License, Version 2.0 (the "License");
796
- * you may not use this file except in compliance with the License.
797
- * You may obtain a copy of the License at
798
- *
799
- * http://www.apache.org/licenses/LICENSE-2.0
800
- *
801
- * Unless required by applicable law or agreed to in writing, software
802
- * distributed under the License is distributed on an "AS IS" BASIS,
803
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
804
- * See the License for the specific language governing permissions and
805
- * limitations under the License.
806
- */class vE{constructor(t,n,r,s){this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Du(this),this.idTokenSubscription=new Du(this),this.beforeStateQueue=new hE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=sh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=yr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await Cs.create(this,t),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((o=this.currentUser)==null?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),await this.currentUser.getIdToken();return}await this._updateCurrentUser(t,!0)}}async initializeCurrentUserFromIdToken(t){try{const n=await vi(this,{idToken:t}),r=await Fn._fromGetAccountInfoResponse(this,n,t);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var o;if(tr(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=(o=this.redirectUser)==null?void 0:o._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(t);(!i||i===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return qe(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(t){try{await yi(t)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=XI()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(tr(this.app))return Promise.reject(ls(this));const n=t?Ds(t):null;return n&&qe(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(t,n=!1){if(!this._deleted)return t&&qe(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return tr(this.app)?Promise.reject(ls(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return tr(this.app)?Promise.reject(ls(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(yr(t))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(t)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await pE(this),n=new gE(t);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Co("auth","Firebase",t())}onAuthStateChanged(t,n,r){return this.registerStateListener(this.authStateSubscription,t,n,r)}beforeAuthStateChanged(t,n){return this.beforeStateQueue.pushCallback(t,n)}onIdTokenChanged(t,n,r){return this.registerStateListener(this.idTokenSubscription,t,n,r)}authStateReady(){return new Promise((t,n)=>{if(this.currentUser)t();else{const r=this.onAuthStateChanged(()=>{r(),t()},n)}})}async revokeAccessToken(t){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await uE(this,r)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)==null?void 0:t.toJSON()}}async _setRedirectUser(t,n){const r=await this.getOrInitRedirectPersistenceManager(n);return t===null?r.removeCurrentUser():r.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const n=t&&yr(t)||this._popupRedirectResolver;qe(n,this,"argument-error"),this.redirectPersistenceManager=await Cs.create(this,[yr(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===t?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,n,r,s){if(this._deleted)return()=>{};const o=typeof n=="function"?n:n.next.bind(n);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(qe(a,this,"internal-error"),a.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const l=t.addObserver(n,r,s);return()=>{i=!0,l()}}else{const l=t.addObserver(n);return()=>{i=!0,l()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return qe(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=yh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var n;if(tr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return t!=null&&t.error&&qI(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Fi(e){return Ds(e)}class Du{constructor(t){this.auth=t,this.observer=null,this.addObserver=PS(n=>this.observer=n)}get next(){return qe(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
807
- * @license
808
- * Copyright 2020 Google LLC
809
- *
810
- * Licensed under the Apache License, Version 2.0 (the "License");
811
- * you may not use this file except in compliance with the License.
812
- * You may obtain a copy of the License at
813
- *
814
- * http://www.apache.org/licenses/LICENSE-2.0
815
- *
816
- * Unless required by applicable law or agreed to in writing, software
817
- * distributed under the License is distributed on an "AS IS" BASIS,
818
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
819
- * See the License for the specific language governing permissions and
820
- * limitations under the License.
821
- */let zl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function yE(e){zl=e}function wE(e){return zl.loadJS(e)}function bE(){return zl.gapiScript}function _E(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
822
- * @license
823
- * Copyright 2020 Google LLC
824
- *
825
- * Licensed under the Apache License, Version 2.0 (the "License");
826
- * you may not use this file except in compliance with the License.
827
- * You may obtain a copy of the License at
828
- *
829
- * http://www.apache.org/licenses/LICENSE-2.0
830
- *
831
- * Unless required by applicable law or agreed to in writing, software
832
- * distributed under the License is distributed on an "AS IS" BASIS,
833
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
834
- * See the License for the specific language governing permissions and
835
- * limitations under the License.
836
- */function kE(e,t){const n=Qf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(Ms(o,t??{}))return s;ir(s,"already-initialized")}return n.initialize({options:t})}function TE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(yr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function SE(e,t,n){const r=Fi(e);qe(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=wh(t),{host:i,port:a}=IE(t),l=a===null?"":`:${a}`,u={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){qe(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),qe(Ms(u,r.config.emulator)&&Ms(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Ll(i)?OS(`${o}//${i}${l}`):EE()}function wh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function IE(e){const t=wh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const o=s[1];return{host:o,port:Lu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Lu(i)}}}function Lu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function EE(){function e(){const t=document.createElement("p"),n=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/**
837
- * @license
838
- * Copyright 2020 Google LLC
839
- *
840
- * Licensed under the Apache License, Version 2.0 (the "License");
841
- * you may not use this file except in compliance with the License.
842
- * You may obtain a copy of the License at
843
- *
844
- * http://www.apache.org/licenses/LICENSE-2.0
845
- *
846
- * Unless required by applicable law or agreed to in writing, software
847
- * distributed under the License is distributed on an "AS IS" BASIS,
848
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
849
- * See the License for the specific language governing permissions and
850
- * limitations under the License.
851
- */class bh{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return vr("not implemented")}_getIdTokenResponse(t){return vr("not implemented")}_linkToIdToken(t,n){return vr("not implemented")}_getReauthenticationResolver(t){return vr("not implemented")}}/**
852
- * @license
853
- * Copyright 2020 Google LLC
854
- *
855
- * Licensed under the Apache License, Version 2.0 (the "License");
856
- * you may not use this file except in compliance with the License.
857
- * You may obtain a copy of the License at
858
- *
859
- * http://www.apache.org/licenses/LICENSE-2.0
860
- *
861
- * Unless required by applicable law or agreed to in writing, software
862
- * distributed under the License is distributed on an "AS IS" BASIS,
863
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
864
- * See the License for the specific language governing permissions and
865
- * limitations under the License.
866
- */async function As(e,t){return tE(e,"POST","/v1/accounts:signInWithIdp",Hl(e,t))}/**
867
- * @license
868
- * Copyright 2020 Google LLC
869
- *
870
- * Licensed under the Apache License, Version 2.0 (the "License");
871
- * you may not use this file except in compliance with the License.
872
- * You may obtain a copy of the License at
873
- *
874
- * http://www.apache.org/licenses/LICENSE-2.0
875
- *
876
- * Unless required by applicable law or agreed to in writing, software
877
- * distributed under the License is distributed on an "AS IS" BASIS,
878
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
879
- * See the License for the specific language governing permissions and
880
- * limitations under the License.
881
- */const CE="http://localhost";class cs extends bh{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new cs(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):ir("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const n=typeof t=="string"?JSON.parse(t):t,{providerId:r,signInMethod:s,...o}=n;if(!r||!s)return null;const i=new cs(r,s);return i.idToken=o.idToken||void 0,i.accessToken=o.accessToken||void 0,i.secret=o.secret,i.nonce=o.nonce,i.pendingToken=o.pendingToken||null,i}_getIdTokenResponse(t){const n=this.buildRequest();return As(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,As(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,As(t,n)}buildRequest(){const t={requestUri:CE,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),t.postBody=Ao(n)}return t}}/**
882
- * @license
883
- * Copyright 2020 Google LLC
884
- *
885
- * Licensed under the Apache License, Version 2.0 (the "License");
886
- * you may not use this file except in compliance with the License.
887
- * You may obtain a copy of the License at
888
- *
889
- * http://www.apache.org/licenses/LICENSE-2.0
890
- *
891
- * Unless required by applicable law or agreed to in writing, software
892
- * distributed under the License is distributed on an "AS IS" BASIS,
893
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
894
- * See the License for the specific language governing permissions and
895
- * limitations under the License.
896
- */class Gl{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/**
897
- * @license
898
- * Copyright 2019 Google LLC
899
- *
900
- * Licensed under the Apache License, Version 2.0 (the "License");
901
- * you may not use this file except in compliance with the License.
902
- * You may obtain a copy of the License at
903
- *
904
- * http://www.apache.org/licenses/LICENSE-2.0
905
- *
906
- * Unless required by applicable law or agreed to in writing, software
907
- * distributed under the License is distributed on an "AS IS" BASIS,
908
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
909
- * See the License for the specific language governing permissions and
910
- * limitations under the License.
911
- */class Po extends Gl{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
912
- * @license
913
- * Copyright 2020 Google LLC
914
- *
915
- * Licensed under the Apache License, Version 2.0 (the "License");
916
- * you may not use this file except in compliance with the License.
917
- * You may obtain a copy of the License at
918
- *
919
- * http://www.apache.org/licenses/LICENSE-2.0
920
- *
921
- * Unless required by applicable law or agreed to in writing, software
922
- * distributed under the License is distributed on an "AS IS" BASIS,
923
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
924
- * See the License for the specific language governing permissions and
925
- * limitations under the License.
926
- */class Nr extends Po{constructor(){super("facebook.com")}static credential(t){return cs._fromParams({providerId:Nr.PROVIDER_ID,signInMethod:Nr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Nr.credentialFromTaggedObject(t)}static credentialFromError(t){return Nr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Nr.credential(t.oauthAccessToken)}catch{return null}}}Nr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Nr.PROVIDER_ID="facebook.com";/**
927
- * @license
928
- * Copyright 2020 Google LLC
929
- *
930
- * Licensed under the Apache License, Version 2.0 (the "License");
931
- * you may not use this file except in compliance with the License.
932
- * You may obtain a copy of the License at
933
- *
934
- * http://www.apache.org/licenses/LICENSE-2.0
935
- *
936
- * Unless required by applicable law or agreed to in writing, software
937
- * distributed under the License is distributed on an "AS IS" BASIS,
938
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
939
- * See the License for the specific language governing permissions and
940
- * limitations under the License.
941
- */class Dr extends Po{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return cs._fromParams({providerId:Dr.PROVIDER_ID,signInMethod:Dr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return Dr.credentialFromTaggedObject(t)}static credentialFromError(t){return Dr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return Dr.credential(n,r)}catch{return null}}}Dr.GOOGLE_SIGN_IN_METHOD="google.com";Dr.PROVIDER_ID="google.com";/**
942
- * @license
943
- * Copyright 2020 Google LLC
944
- *
945
- * Licensed under the Apache License, Version 2.0 (the "License");
946
- * you may not use this file except in compliance with the License.
947
- * You may obtain a copy of the License at
948
- *
949
- * http://www.apache.org/licenses/LICENSE-2.0
950
- *
951
- * Unless required by applicable law or agreed to in writing, software
952
- * distributed under the License is distributed on an "AS IS" BASIS,
953
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
954
- * See the License for the specific language governing permissions and
955
- * limitations under the License.
956
- */class nr extends Po{constructor(){super("github.com")}static credential(t){return cs._fromParams({providerId:nr.PROVIDER_ID,signInMethod:nr.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return nr.credentialFromTaggedObject(t)}static credentialFromError(t){return nr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return nr.credential(t.oauthAccessToken)}catch{return null}}}nr.GITHUB_SIGN_IN_METHOD="github.com";nr.PROVIDER_ID="github.com";/**
957
- * @license
958
- * Copyright 2020 Google LLC
959
- *
960
- * Licensed under the Apache License, Version 2.0 (the "License");
961
- * you may not use this file except in compliance with the License.
962
- * You may obtain a copy of the License at
963
- *
964
- * http://www.apache.org/licenses/LICENSE-2.0
965
- *
966
- * Unless required by applicable law or agreed to in writing, software
967
- * distributed under the License is distributed on an "AS IS" BASIS,
968
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
969
- * See the License for the specific language governing permissions and
970
- * limitations under the License.
971
- */class Lr extends Po{constructor(){super("twitter.com")}static credential(t,n){return cs._fromParams({providerId:Lr.PROVIDER_ID,signInMethod:Lr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Lr.credentialFromTaggedObject(t)}static credentialFromError(t){return Lr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Lr.credential(n,r)}catch{return null}}}Lr.TWITTER_SIGN_IN_METHOD="twitter.com";Lr.PROVIDER_ID="twitter.com";/**
972
- * @license
973
- * Copyright 2020 Google LLC
974
- *
975
- * Licensed under the Apache License, Version 2.0 (the "License");
976
- * you may not use this file except in compliance with the License.
977
- * You may obtain a copy of the License at
978
- *
979
- * http://www.apache.org/licenses/LICENSE-2.0
980
- *
981
- * Unless required by applicable law or agreed to in writing, software
982
- * distributed under the License is distributed on an "AS IS" BASIS,
983
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
984
- * See the License for the specific language governing permissions and
985
- * limitations under the License.
986
- */class Os{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,n,r,s=!1){const o=await Fn._fromIdTokenResponse(t,r,s),i=ju(r);return new Os({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=ju(r);return new Os({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function ju(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
987
- * @license
988
- * Copyright 2020 Google LLC
989
- *
990
- * Licensed under the Apache License, Version 2.0 (the "License");
991
- * you may not use this file except in compliance with the License.
992
- * You may obtain a copy of the License at
993
- *
994
- * http://www.apache.org/licenses/LICENSE-2.0
995
- *
996
- * Unless required by applicable law or agreed to in writing, software
997
- * distributed under the License is distributed on an "AS IS" BASIS,
998
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
999
- * See the License for the specific language governing permissions and
1000
- * limitations under the License.
1001
- */class wi extends Wr{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,wi.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,s){return new wi(t,n,r,s)}}function _h(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?wi._fromErrorAndOperation(e,o,t,r):o})}async function AE(e,t,n=!1){const r=await _o(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Os._forOperation(e,"link",r)}/**
1002
- * @license
1003
- * Copyright 2019 Google LLC
1004
- *
1005
- * Licensed under the Apache License, Version 2.0 (the "License");
1006
- * you may not use this file except in compliance with the License.
1007
- * You may obtain a copy of the License at
1008
- *
1009
- * http://www.apache.org/licenses/LICENSE-2.0
1010
- *
1011
- * Unless required by applicable law or agreed to in writing, software
1012
- * distributed under the License is distributed on an "AS IS" BASIS,
1013
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1014
- * See the License for the specific language governing permissions and
1015
- * limitations under the License.
1016
- */async function xE(e,t,n=!1){const{auth:r}=e;if(tr(r.app))return Promise.reject(ls(r));const s="reauthenticate";try{const o=await _o(e,_h(r,s,t,e),n);qe(o.idToken,r,"internal-error");const i=Wl(o.idToken);qe(i,r,"internal-error");const{sub:a}=i;return qe(e.uid===a,r,"user-mismatch"),Os._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&ir(r,"user-mismatch"),o}}/**
1017
- * @license
1018
- * Copyright 2020 Google LLC
1019
- *
1020
- * Licensed under the Apache License, Version 2.0 (the "License");
1021
- * you may not use this file except in compliance with the License.
1022
- * You may obtain a copy of the License at
1023
- *
1024
- * http://www.apache.org/licenses/LICENSE-2.0
1025
- *
1026
- * Unless required by applicable law or agreed to in writing, software
1027
- * distributed under the License is distributed on an "AS IS" BASIS,
1028
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1029
- * See the License for the specific language governing permissions and
1030
- * limitations under the License.
1031
- */async function RE(e,t,n=!1){if(tr(e.app))return Promise.reject(ls(e));const r="signIn",s=await _h(e,r,t),o=await Os._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function PE(e,t,n,r){return Ds(e).onIdTokenChanged(t,n,r)}function ME(e,t,n){return Ds(e).beforeAuthStateChanged(t,n)}const bi="__sak";/**
1032
- * @license
1033
- * Copyright 2019 Google LLC
1034
- *
1035
- * Licensed under the Apache License, Version 2.0 (the "License");
1036
- * you may not use this file except in compliance with the License.
1037
- * You may obtain a copy of the License at
1038
- *
1039
- * http://www.apache.org/licenses/LICENSE-2.0
1040
- *
1041
- * Unless required by applicable law or agreed to in writing, software
1042
- * distributed under the License is distributed on an "AS IS" BASIS,
1043
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1044
- * See the License for the specific language governing permissions and
1045
- * limitations under the License.
1046
- */class kh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(bi,"1"),this.storage.removeItem(bi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,n){return this.storage.setItem(t,JSON.stringify(n)),Promise.resolve()}_get(t){const n=this.storage.getItem(t);return Promise.resolve(n?JSON.parse(n):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
1047
- * @license
1048
- * Copyright 2020 Google LLC
1049
- *
1050
- * Licensed under the Apache License, Version 2.0 (the "License");
1051
- * you may not use this file except in compliance with the License.
1052
- * You may obtain a copy of the License at
1053
- *
1054
- * http://www.apache.org/licenses/LICENSE-2.0
1055
- *
1056
- * Unless required by applicable law or agreed to in writing, software
1057
- * distributed under the License is distributed on an "AS IS" BASIS,
1058
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1059
- * See the License for the specific language governing permissions and
1060
- * limitations under the License.
1061
- */const $E=1e3,OE=10;class Th extends kh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=vh(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&t(n,s,r)}}onStorageEvent(t,n=!1){if(!t.key){this.forAllChangedKeys((i,a,l)=>{this.notifyListeners(i,l)});return}const r=t.key;n?this.detachListener():this.stopPolling();const s=()=>{const i=this.storage.getItem(r);!n&&this.localCache[r]===i||this.notifyListeners(r,i)},o=this.storage.getItem(r);fE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,OE):s()}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},$E)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(t,n){await super._set(t,n),this.localCache[t]=JSON.stringify(n)}async _get(t){const n=await super._get(t);return this.localCache[t]=JSON.stringify(n),n}async _remove(t){await super._remove(t),delete this.localCache[t]}}Th.type="LOCAL";const NE=Th;/**
1062
- * @license
1063
- * Copyright 2020 Google LLC
1064
- *
1065
- * Licensed under the Apache License, Version 2.0 (the "License");
1066
- * you may not use this file except in compliance with the License.
1067
- * You may obtain a copy of the License at
1068
- *
1069
- * http://www.apache.org/licenses/LICENSE-2.0
1070
- *
1071
- * Unless required by applicable law or agreed to in writing, software
1072
- * distributed under the License is distributed on an "AS IS" BASIS,
1073
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1074
- * See the License for the specific language governing permissions and
1075
- * limitations under the License.
1076
- */class Sh extends kh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Sh.type="SESSION";const Ih=Sh;/**
1077
- * @license
1078
- * Copyright 2019 Google LLC
1079
- *
1080
- * Licensed under the Apache License, Version 2.0 (the "License");
1081
- * you may not use this file except in compliance with the License.
1082
- * You may obtain a copy of the License at
1083
- *
1084
- * http://www.apache.org/licenses/LICENSE-2.0
1085
- *
1086
- * Unless required by applicable law or agreed to in writing, software
1087
- * distributed under the License is distributed on an "AS IS" BASIS,
1088
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1089
- * See the License for the specific language governing permissions and
1090
- * limitations under the License.
1091
- */function DE(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1092
- * @license
1093
- * Copyright 2019 Google LLC
1094
- *
1095
- * Licensed under the Apache License, Version 2.0 (the "License");
1096
- * you may not use this file except in compliance with the License.
1097
- * You may obtain a copy of the License at
1098
- *
1099
- * http://www.apache.org/licenses/LICENSE-2.0
1100
- *
1101
- * Unless required by applicable law or agreed to in writing, software
1102
- * distributed under the License is distributed on an "AS IS" BASIS,
1103
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1104
- * See the License for the specific language governing permissions and
1105
- * limitations under the License.
1106
- */class Bi{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const n=this.receivers.find(s=>s.isListeningto(t));if(n)return n;const r=new Bi(t);return this.receivers.push(r),r}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const n=t,{eventId:r,eventType:s,data:o}=n.data,i=this.handlersMap[s];if(!(i!=null&&i.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(i).map(async u=>u(n.origin,o)),l=await DE(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(t,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(n)}_unsubscribe(t,n){this.handlersMap[t]&&n&&this.handlersMap[t].delete(n),(!n||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Bi.receivers=[];/**
1107
- * @license
1108
- * Copyright 2020 Google LLC
1109
- *
1110
- * Licensed under the Apache License, Version 2.0 (the "License");
1111
- * you may not use this file except in compliance with the License.
1112
- * You may obtain a copy of the License at
1113
- *
1114
- * http://www.apache.org/licenses/LICENSE-2.0
1115
- *
1116
- * Unless required by applicable law or agreed to in writing, software
1117
- * distributed under the License is distributed on an "AS IS" BASIS,
1118
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1119
- * See the License for the specific language governing permissions and
1120
- * limitations under the License.
1121
- */function ql(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1122
- * @license
1123
- * Copyright 2019 Google LLC
1124
- *
1125
- * Licensed under the Apache License, Version 2.0 (the "License");
1126
- * you may not use this file except in compliance with the License.
1127
- * You may obtain a copy of the License at
1128
- *
1129
- * http://www.apache.org/licenses/LICENSE-2.0
1130
- *
1131
- * Unless required by applicable law or agreed to in writing, software
1132
- * distributed under the License is distributed on an "AS IS" BASIS,
1133
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1134
- * See the License for the specific language governing permissions and
1135
- * limitations under the License.
1136
- */class LE{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let o,i;return new Promise((a,l)=>{const u=ql("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(f){const m=f;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(m.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:u,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1137
- * @license
1138
- * Copyright 2020 Google LLC
1139
- *
1140
- * Licensed under the Apache License, Version 2.0 (the "License");
1141
- * you may not use this file except in compliance with the License.
1142
- * You may obtain a copy of the License at
1143
- *
1144
- * http://www.apache.org/licenses/LICENSE-2.0
1145
- *
1146
- * Unless required by applicable law or agreed to in writing, software
1147
- * distributed under the License is distributed on an "AS IS" BASIS,
1148
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1149
- * See the License for the specific language governing permissions and
1150
- * limitations under the License.
1151
- */function or(){return window}function jE(e){or().location.href=e}/**
1152
- * @license
1153
- * Copyright 2020 Google LLC.
1154
- *
1155
- * Licensed under the Apache License, Version 2.0 (the "License");
1156
- * you may not use this file except in compliance with the License.
1157
- * You may obtain a copy of the License at
1158
- *
1159
- * http://www.apache.org/licenses/LICENSE-2.0
1160
- *
1161
- * Unless required by applicable law or agreed to in writing, software
1162
- * distributed under the License is distributed on an "AS IS" BASIS,
1163
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1164
- * See the License for the specific language governing permissions and
1165
- * limitations under the License.
1166
- */function Eh(){return typeof or().WorkerGlobalScope<"u"&&typeof or().importScripts=="function"}async function UE(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function FE(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function BE(){return Eh()?self:null}/**
1167
- * @license
1168
- * Copyright 2019 Google LLC
1169
- *
1170
- * Licensed under the Apache License, Version 2.0 (the "License");
1171
- * you may not use this file except in compliance with the License.
1172
- * You may obtain a copy of the License at
1173
- *
1174
- * http://www.apache.org/licenses/LICENSE-2.0
1175
- *
1176
- * Unless required by applicable law or agreed to in writing, software
1177
- * distributed under the License is distributed on an "AS IS" BASIS,
1178
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1179
- * See the License for the specific language governing permissions and
1180
- * limitations under the License.
1181
- */const Ch="firebaseLocalStorageDb",HE=1,_i="firebaseLocalStorage",Ah="fbase_key";class Mo{constructor(t){this.request=t}toPromise(){return new Promise((t,n)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Hi(e,t){return e.transaction([_i],t?"readwrite":"readonly").objectStore(_i)}function WE(){const e=indexedDB.deleteDatabase(Ch);return new Mo(e).toPromise()}function al(){const e=indexedDB.open(Ch,HE);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(_i,{keyPath:Ah})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(_i)?t(r):(r.close(),await WE(),t(await al()))})})}async function Uu(e,t,n){const r=Hi(e,!0).put({[Ah]:t,value:n});return new Mo(r).toPromise()}async function VE(e,t){const n=Hi(e,!1).get(t),r=await new Mo(n).toPromise();return r===void 0?null:r.value}function Fu(e,t){const n=Hi(e,!0).delete(t);return new Mo(n).toPromise()}const zE=800,GE=3;class xh{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await al(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>GE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Eh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Bi._getInstance(BE()),this.receiver._subscribe("keyChanged",async(t,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(t,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await UE(),!this.activeServiceWorker)return;this.sender=new LE(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&(n=t[0])!=null&&n.fulfilled&&(r=t[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(!(!this.sender||!this.activeServiceWorker||FE()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await al();return await Uu(t,bi,"1"),await Fu(t,bi),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Uu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>VE(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Hi(s,!1).getAll();return new Mo(o).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(t.length!==0)for(const{fbase_key:s,value:o}of t)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(o)&&(this.notifyListeners(s,o),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),zE)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&this.stopPolling()}}xh.type="LOCAL";const qE=xh;new Ro(3e4,6e4);/**
1182
- * @license
1183
- * Copyright 2021 Google LLC
1184
- *
1185
- * Licensed under the Apache License, Version 2.0 (the "License");
1186
- * you may not use this file except in compliance with the License.
1187
- * You may obtain a copy of the License at
1188
- *
1189
- * http://www.apache.org/licenses/LICENSE-2.0
1190
- *
1191
- * Unless required by applicable law or agreed to in writing, software
1192
- * distributed under the License is distributed on an "AS IS" BASIS,
1193
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1194
- * See the License for the specific language governing permissions and
1195
- * limitations under the License.
1196
- */function Rh(e,t){return t?yr(t):(qe(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1197
- * @license
1198
- * Copyright 2019 Google LLC
1199
- *
1200
- * Licensed under the Apache License, Version 2.0 (the "License");
1201
- * you may not use this file except in compliance with the License.
1202
- * You may obtain a copy of the License at
1203
- *
1204
- * http://www.apache.org/licenses/LICENSE-2.0
1205
- *
1206
- * Unless required by applicable law or agreed to in writing, software
1207
- * distributed under the License is distributed on an "AS IS" BASIS,
1208
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1209
- * See the License for the specific language governing permissions and
1210
- * limitations under the License.
1211
- */class Kl extends bh{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return As(t,this._buildIdpRequest())}_linkToIdToken(t,n){return As(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return As(t,this._buildIdpRequest())}_buildIdpRequest(t){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(n.idToken=t),n}}function KE(e){return RE(e.auth,new Kl(e),e.bypassAuthState)}function JE(e){const{auth:t,user:n}=e;return qe(n,t,"internal-error"),xE(n,new Kl(e),e.bypassAuthState)}async function YE(e){const{auth:t,user:n}=e;return qe(n,t,"internal-error"),AE(n,new Kl(e),e.bypassAuthState)}/**
1212
- * @license
1213
- * Copyright 2020 Google LLC
1214
- *
1215
- * Licensed under the Apache License, Version 2.0 (the "License");
1216
- * you may not use this file except in compliance with the License.
1217
- * You may obtain a copy of the License at
1218
- *
1219
- * http://www.apache.org/licenses/LICENSE-2.0
1220
- *
1221
- * Unless required by applicable law or agreed to in writing, software
1222
- * distributed under the License is distributed on an "AS IS" BASIS,
1223
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1224
- * See the License for the specific language governing permissions and
1225
- * limitations under the License.
1226
- */class Ph{constructor(t,n,r,s,o=!1){this.auth=t,this.resolver=r,this.user=s,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(t,n)=>{this.pendingPromise={resolve:t,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(t){const{urlResponse:n,sessionId:r,postBody:s,tenantId:o,error:i,type:a}=t;if(i){this.reject(i);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(u){this.reject(u)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return KE;case"linkViaPopup":case"linkViaRedirect":return YE;case"reauthViaPopup":case"reauthViaRedirect":return JE;default:ir(this.auth,"internal-error")}}resolve(t){Er(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Er(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
1227
- * @license
1228
- * Copyright 2020 Google LLC
1229
- *
1230
- * Licensed under the Apache License, Version 2.0 (the "License");
1231
- * you may not use this file except in compliance with the License.
1232
- * You may obtain a copy of the License at
1233
- *
1234
- * http://www.apache.org/licenses/LICENSE-2.0
1235
- *
1236
- * Unless required by applicable law or agreed to in writing, software
1237
- * distributed under the License is distributed on an "AS IS" BASIS,
1238
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1239
- * See the License for the specific language governing permissions and
1240
- * limitations under the License.
1241
- */const XE=new Ro(2e3,1e4);async function QE(e,t,n){if(tr(e.app))return Promise.reject(Wn(e,"operation-not-supported-in-this-environment"));const r=Fi(e);KI(e,t,Gl);const s=Rh(r,n);return new os(r,"signInViaPopup",t,s).executeNotNull()}class os extends Ph{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,os.currentPopupAction&&os.currentPopupAction.cancel(),os.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return qe(t,this.auth,"internal-error"),t}async onExecution(){Er(this.filter.length===1,"Popup operations only handle one event");const t=ql();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(Wn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Wn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,os.currentPopupAction=null}pollUserCancellation(){const t=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Wn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,XE.get())};t()}}os.currentPopupAction=null;/**
1242
- * @license
1243
- * Copyright 2020 Google LLC
1244
- *
1245
- * Licensed under the Apache License, Version 2.0 (the "License");
1246
- * you may not use this file except in compliance with the License.
1247
- * You may obtain a copy of the License at
1248
- *
1249
- * http://www.apache.org/licenses/LICENSE-2.0
1250
- *
1251
- * Unless required by applicable law or agreed to in writing, software
1252
- * distributed under the License is distributed on an "AS IS" BASIS,
1253
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
- * See the License for the specific language governing permissions and
1255
- * limitations under the License.
1256
- */const ZE="pendingRedirect",si=new Map;class eC extends Ph{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=si.get(this.auth._key());if(!t){try{const r=await tC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}si.set(this.auth._key(),t)}return this.bypassAuthState||si.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if(t.type==="signInViaRedirect")return super.onAuthEvent(t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){const n=await this.auth._redirectUserForId(t.eventId);if(n)return this.user=n,super.onAuthEvent(t);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function tC(e,t){const n=sC(t),r=rC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function nC(e,t){si.set(e._key(),t)}function rC(e){return yr(e._redirectPersistence)}function sC(e){return ri(ZE,e.config.apiKey,e.name)}async function oC(e,t,n=!1){if(tr(e.app))return Promise.reject(ls(e));const r=Fi(e),s=Rh(r,t),i=await new eC(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1257
- * @license
1258
- * Copyright 2020 Google LLC
1259
- *
1260
- * Licensed under the Apache License, Version 2.0 (the "License");
1261
- * you may not use this file except in compliance with the License.
1262
- * You may obtain a copy of the License at
1263
- *
1264
- * http://www.apache.org/licenses/LICENSE-2.0
1265
- *
1266
- * Unless required by applicable law or agreed to in writing, software
1267
- * distributed under the License is distributed on an "AS IS" BASIS,
1268
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1269
- * See the License for the specific language governing permissions and
1270
- * limitations under the License.
1271
- */const iC=600*1e3;class aC{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(t,r)&&(n=!0,this.sendToConsumer(t,r),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!lC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Mh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Wn(this.auth,s))}else n.onAuthEvent(t)}isEventForConsumer(t,n){const r=n.eventId===null||!!t.eventId&&t.eventId===n.eventId;return n.filter.includes(t.type)&&r}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=iC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Bu(t))}saveEventToCache(t){this.cachedEventUids.add(Bu(t)),this.lastProcessedEventTime=Date.now()}}function Bu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Mh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function lC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Mh(e);default:return!1}}/**
1272
- * @license
1273
- * Copyright 2020 Google LLC
1274
- *
1275
- * Licensed under the Apache License, Version 2.0 (the "License");
1276
- * you may not use this file except in compliance with the License.
1277
- * You may obtain a copy of the License at
1278
- *
1279
- * http://www.apache.org/licenses/LICENSE-2.0
1280
- *
1281
- * Unless required by applicable law or agreed to in writing, software
1282
- * distributed under the License is distributed on an "AS IS" BASIS,
1283
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1284
- * See the License for the specific language governing permissions and
1285
- * limitations under the License.
1286
- */async function cC(e,t={}){return Ls(e,"GET","/v1/projects",t)}/**
1287
- * @license
1288
- * Copyright 2020 Google LLC
1289
- *
1290
- * Licensed under the Apache License, Version 2.0 (the "License");
1291
- * you may not use this file except in compliance with the License.
1292
- * You may obtain a copy of the License at
1293
- *
1294
- * http://www.apache.org/licenses/LICENSE-2.0
1295
- *
1296
- * Unless required by applicable law or agreed to in writing, software
1297
- * distributed under the License is distributed on an "AS IS" BASIS,
1298
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1299
- * See the License for the specific language governing permissions and
1300
- * limitations under the License.
1301
- */const uC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,dC=/^https?/;async function fC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await cC(e);for(const n of t)try{if(hC(n))return}catch{}ir(e,"unauthorized-domain")}function hC(e){const t=ol(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return i.hostname===""&&r===""?n==="chrome-extension:"&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):n==="chrome-extension:"&&i.hostname===r}if(!dC.test(n))return!1;if(uC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1302
- * @license
1303
- * Copyright 2020 Google LLC.
1304
- *
1305
- * Licensed under the Apache License, Version 2.0 (the "License");
1306
- * you may not use this file except in compliance with the License.
1307
- * You may obtain a copy of the License at
1308
- *
1309
- * http://www.apache.org/licenses/LICENSE-2.0
1310
- *
1311
- * Unless required by applicable law or agreed to in writing, software
1312
- * distributed under the License is distributed on an "AS IS" BASIS,
1313
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314
- * See the License for the specific language governing permissions and
1315
- * limitations under the License.
1316
- */const pC=new Ro(3e4,6e4);function Hu(){const e=or().___jsl;if(e!=null&&e.H){for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n<e.CP.length;n++)e.CP[n]=null}}function mC(e){return new Promise((t,n)=>{var s,o,i;function r(){Hu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Hu(),n(Wn(e,"network-request-failed"))},timeout:pC.get()})}if((o=(s=or().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=or().gapi)!=null&&i.load)r();else{const a=_E("iframefcb");return or()[a]=()=>{gapi.load?r():n(Wn(e,"network-request-failed"))},wE(`${bE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw oi=null,t})}let oi=null;function gC(e){return oi=oi||mC(e),oi}/**
1317
- * @license
1318
- * Copyright 2020 Google LLC.
1319
- *
1320
- * Licensed under the Apache License, Version 2.0 (the "License");
1321
- * you may not use this file except in compliance with the License.
1322
- * You may obtain a copy of the License at
1323
- *
1324
- * http://www.apache.org/licenses/LICENSE-2.0
1325
- *
1326
- * Unless required by applicable law or agreed to in writing, software
1327
- * distributed under the License is distributed on an "AS IS" BASIS,
1328
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1329
- * See the License for the specific language governing permissions and
1330
- * limitations under the License.
1331
- */const vC=new Ro(5e3,15e3),yC="__/auth/iframe",wC="emulator/auth/iframe",bC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},_C=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function kC(e){const t=e.config;qe(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Bl(t,wC):`https://${e.config.authDomain}/${yC}`,r={apiKey:t.apiKey,appName:e.name,v:xo},s=_C.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ao(r).slice(1)}`}async function TC(e){const t=await gC(e),n=or().gapi;return qe(n,e,"internal-error"),t.open({where:document.body,url:kC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:bC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Wn(e,"network-request-failed"),a=or().setTimeout(()=>{o(i)},vC.get());function l(){or().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1332
- * @license
1333
- * Copyright 2020 Google LLC.
1334
- *
1335
- * Licensed under the Apache License, Version 2.0 (the "License");
1336
- * you may not use this file except in compliance with the License.
1337
- * You may obtain a copy of the License at
1338
- *
1339
- * http://www.apache.org/licenses/LICENSE-2.0
1340
- *
1341
- * Unless required by applicable law or agreed to in writing, software
1342
- * distributed under the License is distributed on an "AS IS" BASIS,
1343
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1344
- * See the License for the specific language governing permissions and
1345
- * limitations under the License.
1346
- */const SC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},IC=500,EC=600,CC="_blank",AC="http://localhost";class Wu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function xC(e,t,n,r=IC,s=EC){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...SC,width:r.toString(),height:s.toString(),top:o,left:i},u=wn().toLowerCase();n&&(a=fh(u)?CC:n),uh(u)&&(t=t||AC,l.scrollbars="yes");const c=Object.entries(l).reduce((m,[S,L])=>`${m}${S}=${L},`,"");if(dE(u)&&a!=="_self")return RC(t||"",a),new Wu(null);const f=window.open(t||"",a,c);qe(f,e,"popup-blocked");try{f.focus()}catch{}return new Wu(f)}function RC(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
1347
- * @license
1348
- * Copyright 2021 Google LLC
1349
- *
1350
- * Licensed under the Apache License, Version 2.0 (the "License");
1351
- * you may not use this file except in compliance with the License.
1352
- * You may obtain a copy of the License at
1353
- *
1354
- * http://www.apache.org/licenses/LICENSE-2.0
1355
- *
1356
- * Unless required by applicable law or agreed to in writing, software
1357
- * distributed under the License is distributed on an "AS IS" BASIS,
1358
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1359
- * See the License for the specific language governing permissions and
1360
- * limitations under the License.
1361
- */const PC="__/auth/handler",MC="emulator/auth/handler",$C=encodeURIComponent("fac");async function Vu(e,t,n,r,s,o){qe(e.config.authDomain,e,"auth-domain-config-required"),qe(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:xo,eventId:s};if(t instanceof Gl){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",RS(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,f]of Object.entries({}))i[c]=f}if(t instanceof Po){const c=t.getScopes().filter(f=>f!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),u=l?`#${$C}=${encodeURIComponent(l)}`:"";return`${OC(e)}?${Ao(a).slice(1)}${u}`}function OC({config:e}){return e.emulator?Bl(e,MC):`https://${e.authDomain}/${PC}`}/**
1362
- * @license
1363
- * Copyright 2020 Google LLC
1364
- *
1365
- * Licensed under the Apache License, Version 2.0 (the "License");
1366
- * you may not use this file except in compliance with the License.
1367
- * You may obtain a copy of the License at
1368
- *
1369
- * http://www.apache.org/licenses/LICENSE-2.0
1370
- *
1371
- * Unless required by applicable law or agreed to in writing, software
1372
- * distributed under the License is distributed on an "AS IS" BASIS,
1373
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1374
- * See the License for the specific language governing permissions and
1375
- * limitations under the License.
1376
- */const Ca="webStorageSupport";class NC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ih,this._completeRedirectFn=oC,this._overrideRedirectResult=nC}async _openPopup(t,n,r,s){var i;Er((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Vu(t,n,r,ol(),s);return xC(t,o,ql())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Vu(t,n,r,ol(),s);return jE(o),new Promise(()=>{})}_initialize(t){const n=t._key();if(this.eventManagers[n]){const{manager:s,promise:o}=this.eventManagers[n];return s?Promise.resolve(s):(Er(o,"If manager is not set, promise should be"),o)}const r=this.initAndGetManager(t);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(t){const n=await TC(t),r=new aC(t);return n.register("authEvent",s=>(qe(s==null?void 0:s.authEvent,t,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,r}_isIframeWebStorageSupported(t,n){this.iframes[t._key()].send(Ca,{type:Ca},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[Ca];o!==void 0&&n(!!o),ir(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=fC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return vh()||dh()||Vl()}}const DC=NC;var zu="@firebase/auth",Gu="1.12.2";/**
1377
- * @license
1378
- * Copyright 2020 Google LLC
1379
- *
1380
- * Licensed under the Apache License, Version 2.0 (the "License");
1381
- * you may not use this file except in compliance with the License.
1382
- * You may obtain a copy of the License at
1383
- *
1384
- * http://www.apache.org/licenses/LICENSE-2.0
1385
- *
1386
- * Unless required by applicable law or agreed to in writing, software
1387
- * distributed under the License is distributed on an "AS IS" BASIS,
1388
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389
- * See the License for the specific language governing permissions and
1390
- * limitations under the License.
1391
- */class LC{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)==null?void 0:t.uid)||null}async getToken(t){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(t)}:null}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const n=this.auth.onIdTokenChanged(r=>{t((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(t,n),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const n=this.internalListeners.get(t);n&&(this.internalListeners.delete(t),n(),this.updateProactiveRefresh())}assertAuthConfigured(){qe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1392
- * @license
1393
- * Copyright 2020 Google LLC
1394
- *
1395
- * Licensed under the Apache License, Version 2.0 (the "License");
1396
- * you may not use this file except in compliance with the License.
1397
- * You may obtain a copy of the License at
1398
- *
1399
- * http://www.apache.org/licenses/LICENSE-2.0
1400
- *
1401
- * Unless required by applicable law or agreed to in writing, software
1402
- * distributed under the License is distributed on an "AS IS" BASIS,
1403
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1404
- * See the License for the specific language governing permissions and
1405
- * limitations under the License.
1406
- */function jC(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function UC(e){wo(new $s("auth",(t,{options:n})=>{const r=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=r.options;qe(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:i,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:yh(e)},u=new vE(r,s,o,l);return TE(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),wo(new $s("auth-internal",t=>{const n=Fi(t.getProvider("auth").getImmediate());return(r=>new LC(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Is(zu,Gu,jC(e)),Is(zu,Gu,"esm2020")}/**
1407
- * @license
1408
- * Copyright 2021 Google LLC
1409
- *
1410
- * Licensed under the Apache License, Version 2.0 (the "License");
1411
- * you may not use this file except in compliance with the License.
1412
- * You may obtain a copy of the License at
1413
- *
1414
- * http://www.apache.org/licenses/LICENSE-2.0
1415
- *
1416
- * Unless required by applicable law or agreed to in writing, software
1417
- * distributed under the License is distributed on an "AS IS" BASIS,
1418
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1419
- * See the License for the specific language governing permissions and
1420
- * limitations under the License.
1421
- */const FC=300,BC=Kf("authIdTokenMaxAge")||FC;let qu=null;const HC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>BC)return;const s=n==null?void 0:n.token;qu!==s&&(qu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function WC(e=eh()){const t=Qf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=kE(e,{popupRedirectResolver:DC,persistence:[qE,NE,Ih]}),r=Kf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=HC(o.toString());ME(n,i,()=>i(n.currentUser)),PE(n,a=>i(a))}}const s=yS("auth");return s&&SE(n,`http://${s}`),n}function VC(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}yE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=Wn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",VC().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});UC("Browser");const zC={apiKey:"AIzaSyAf0CIHBZ-wEQJ8CCUUWo1Wl9P7typ_ZPI",authDomain:"gptcall-416910.firebaseapp.com",projectId:"gptcall-416910",storageBucket:"gptcall-416910.appspot.com",messagingSenderId:"99275526699",appId:"1:99275526699:web:3b623e1e2996108b52106e"};function GC(e){const t=N(null),n=N(""),r=N(""),s=N(""),o=N({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=ie(()=>s.value==="pull"),a=ie(()=>s.value==="push"),l=ie(()=>s.value!=="");async function u(){try{const O=await fetch("/codex-api/skills-sync/status");if(!O.ok)return;const V=await O.json();V.data&&(o.value=V.data)}catch{}}async function c(){try{const O=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),V=await O.json();if(!O.ok||!V.data)throw new Error("Failed to start GitHub login");t.value=V.data;const R=30,P=Math.max((V.data.interval??5)*1e3,3e3);let B=!1;for(let F=0;F<R;F++){await new Promise(we=>setTimeout(we,P));const ne=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:V.data.device_code})}),oe=await ne.json();if(!ne.ok)throw new Error(oe.error||"Failed to complete GitHub login");if(oe.ok){B=!0;break}if(!oe.pending)throw new Error(oe.error||"Failed to complete GitHub login")}if(!B)throw new Error("GitHub login timed out. Please retry.");t.value=null,await u(),e.showToast("GitHub login successful")}catch(O){e.showToast(O instanceof Error?O.message:"Failed GitHub login","error")}}async function f(){try{const O=$I().length>0?eh():Zf(zC),V=WC(O),R=new nr;R.addScope("repo");const P=await QE(V,R),B=nr.credentialFromResult(P),F=(B==null?void 0:B.accessToken)??"";if(!F)throw new Error("GitHub access token missing from Firebase login");const ne=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:F})}),oe=await ne.json();if(!ne.ok||!oe.ok)throw new Error(oe.error||"Failed to login with GitHub token");await u(),e.showToast("GitHub login successful")}catch(O){const V=O instanceof Error?O.message:"Failed Firebase GitHub login";e.showToast(V,"error")}}async function m(){r.value="",n.value="pull-started",s.value="pull";try{const O=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),V=await O.json();if(!O.ok||!V.ok)throw new Error(V.error||"Failed to pull synced skills");await e.onPulled(),n.value="pull-success",e.showToast(o.value.loggedIn?"Pulled skills from private sync repo":"Pulled skills from upstream repo")}catch(O){const V=O instanceof Error?O.message:"Failed to pull sync";r.value=V,n.value="pull-failed",e.showToast(V,"error")}finally{s.value=""}}async function S(){r.value="",n.value="push-started",s.value="push";try{const O=await fetch("/codex-api/skills-sync/push",{method:"POST"}),V=await O.json();if(!O.ok||!V.ok)throw new Error(V.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(O){const V=O instanceof Error?O.message:"Failed to push sync";r.value=V,n.value="push-failed",e.showToast(V,"error")}finally{s.value=""}}async function L(){try{const O=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),V=await O.json();if(!O.ok||!V.ok)throw new Error(V.error||"Failed to logout GitHub");await u(),e.showToast("Logged out from GitHub")}catch(O){e.showToast(O instanceof Error?O.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:u,logoutGithub:L,pullSkillsSync:m,pushSkillsSync:S,startGithubFirebaseLogin:f,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const qC={class:"skills-hub"},KC={class:"skills-sync-panel"},JC={class:"skills-sync-header"},YC=["href"],XC={key:1,class:"skills-sync-badge"},QC={key:2,class:"skills-sync-badge"},ZC={class:"skills-sync-meta"},eA={key:0,class:"skills-sync-error"},tA={key:1,class:"skills-sync-meta"},nA={key:2,class:"skills-sync-error"},rA={key:3,class:"skills-sync-device"},sA=["href"],oA={class:"skills-sync-actions"},iA=["disabled"],aA=["disabled"],lA=["disabled"],cA={key:1,class:"skills-hub-section"},uA={class:"skills-hub-section-title"},dA={key:0,class:"skills-hub-grid"},fA={class:"skills-hub-toolbar"},hA={class:"skills-hub-search-wrap"},pA={key:0,class:"skills-hub-count"},mA={class:"skills-hub-section"},gA={key:0,class:"skills-hub-loading"},vA={key:1,class:"skills-hub-error"},yA={key:0,class:"skills-hub-grid"},wA={key:1,class:"skills-hub-empty"},Go="codex-web-local.skills-hub.cache.v1",bA=Wt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=N(null),s=N(""),o=N("date"),i=N([]),a=N([]),l=N(0),u=N(!1),c=N(""),f=N(!0),m=N(!1),S=N(n),L=N(null),O=N(""),V=N(!1),R=N(!1);let P=null,B=null;const F=t,ne=ie(()=>o.value==="date"?"Newest":"A-Z"),oe=ie(()=>{var G;return((G=L.value)==null?void 0:G.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),we=ie(()=>`${S.value.owner}/${S.value.name}`),Se=ie(()=>V.value&&O.value===we.value),ue=ie(()=>R.value&&O.value===we.value),ce=ie(()=>{if(!H.value.configured)return"";const G=H.value.repoOwner.trim(),W=H.value.repoName.trim();return!G||!W?"":`https://github.com/${encodeURIComponent(G)}/${encodeURIComponent(W)}`}),be=ie(()=>{const G=s.value.toLowerCase().trim();return G?a.value.filter(W=>W.name.toLowerCase().includes(G)||W.owner.toLowerCase().includes(G)||(W.displayName??"").toLowerCase().includes(G)):a.value});function K(G,W="success"){L.value={text:G,type:W},B&&clearTimeout(B),B=setTimeout(()=>{L.value=null},3e3)}function ke(){o.value=o.value==="date"?"name":"date",ze(s.value)}function Ne(G){return`${o.value}::${G.trim().toLowerCase()}`}function Ue(G){var W;if(typeof window>"u")return null;try{const q=window.localStorage.getItem(Go);return q?((W=JSON.parse(q).byKey)==null?void 0:W[G])??null:null}catch{return null}}function Ce(G,W){if(!(typeof window>"u"))try{const q=window.localStorage.getItem(Go),me=(q?JSON.parse(q):{}).byKey??{};me[G]=W,window.localStorage.setItem(Go,JSON.stringify({byKey:me}))}catch{}}function $e(){if(!(typeof window>"u"))try{window.localStorage.removeItem(Go)}catch{}}function De(G){const W=G.installed??[];a.value=W;const q=new Set(W.map(z=>z.name));i.value=G.data.map(z=>{if(z.installed||q.has(z.name)){const me=W.find(ve=>ve.name===z.name);return{...z,installed:!0,path:(me==null?void 0:me.path)??z.path,enabled:(me==null?void 0:me.enabled)??z.enabled}}return z}).filter(z=>!z.installed),l.value=G.total}async function ze(G){const W=Ne(G),q=Ue(W);q&&De(q),u.value=!q,c.value="";try{const z=new URLSearchParams;G.trim()&&z.set("q",G.trim()),z.set("limit","100"),z.set("sort",o.value);const me=await fetch(`/codex-api/skills-hub?${z}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();De(ve),Ce(W,ve)}catch(z){c.value=z instanceof Error?z.message:"Failed to load skills"}finally{u.value=!1}}function tt(){P&&clearTimeout(P),P=setTimeout(()=>ze(s.value),300)}function Oe(G){S.value=G,m.value=!0}async function Qe(G){O.value=`${G.owner}/${G.name}`,V.value=!0;try{const q=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:G.owner,name:G.name})})).json();if(!q.ok)throw new Error(q.error||"Install failed");const z={...G,installed:!0,path:q.path,enabled:!0};a.value=[...a.value,z],i.value=i.value.filter(me=>me.name!==G.name),S.value=z,K(`${G.displayName||G.name} skill installed`),m.value=!1,$e(),F("skills-changed")}catch(W){K(W instanceof Error?W.message:"Failed to install skill","error")}finally{V.value=!1}}async function wt(G){O.value=`${G.owner}/${G.name}`,R.value=!0;try{const q=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G.name,path:G.path})})).json();if(!q.ok)throw new Error(q.error||"Uninstall failed");a.value=a.value.filter(z=>z.name!==G.name),G.owner!=="local"&&(i.value=[...i.value,{...G,installed:!1,path:void 0,enabled:void 0}]),K(`${G.displayName||G.name} skill uninstalled`),m.value=!1,$e(),F("skills-changed")}catch(W){K(W instanceof Error?W.message:"Failed to uninstall skill","error")}finally{R.value=!1}}async function ct(G,W){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:G.path,enabled:W}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),K(`${G.displayName||G.name} skill ${W?"enabled":"disabled"}`),await ze(s.value)}catch(q){K(q instanceof Error?q.message:"Failed to update skill","error")}}const{deviceLogin:Ze,isPullInFlight:Je,isPushInFlight:X,isSyncActionInFlight:de,loadSyncStatus:fe,logoutGithub:Ie,pullSkillsSync:Te,pushSkillsSync:b,startGithubFirebaseLogin:T,startGithubLogin:M,syncActionError:Y,syncActionStatus:ee,syncStatus:H}=GC({showToast:K,onPulled:async()=>{await ze(s.value),F("skills-changed")}});return ar(()=>{ze(""),fe()}),(G,W)=>(v(),E("div",qC,[W[11]||(W[11]=h("div",{class:"skills-hub-header"},[h("h2",{class:"skills-hub-title"},"Skills Hub"),h("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),h("div",KC,[h("div",JC,[W[8]||(W[8]=h("strong",null,"Skills Sync (GitHub)",-1)),_e(H).configured&&ce.value?(v(),E("a",{key:0,class:"skills-sync-badge skills-sync-badge-link",href:ce.value,target:"_blank",rel:"noopener noreferrer"}," Connected: "+ae(_e(H).repoOwner)+"/"+ae(_e(H).repoName),9,YC)):_e(H).loggedIn?(v(),E("span",XC,"Logged in as "+ae(_e(H).githubUsername),1)):(v(),E("span",QC,"Not connected"))]),h("div",ZC,[h("span",null,"Startup: "+ae(_e(H).startup.mode),1),h("span",null,"Branch: "+ae(_e(H).startup.branch),1),h("span",null,"Action: "+ae(_e(H).startup.lastAction),1)]),_e(H).startup.lastError?(v(),E("div",eA,ae(_e(H).startup.lastError),1)):le("",!0),_e(ee)?(v(),E("div",tA,[h("span",null,"Manual sync: "+ae(_e(ee)),1)])):le("",!0),_e(Y)?(v(),E("div",nA,ae(_e(Y)),1)):le("",!0),_e(Ze)?(v(),E("div",rA,[h("span",null,[W[9]||(W[9]=po("Open ",-1)),h("a",{href:_e(Ze).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,sA),W[10]||(W[10]=po(" and enter code:",-1))]),h("code",null,ae(_e(Ze).user_code),1)])):le("",!0),h("div",oA,[_e(H).loggedIn?le("",!0):(v(),E("button",{key:0,class:"skills-hub-sort",type:"button",onClick:W[0]||(W[0]=(...q)=>_e(T)&&_e(T)(...q))},"Login with GitHub")),_e(H).loggedIn?le("",!0):(v(),E("button",{key:1,class:"skills-hub-sort",type:"button",onClick:W[1]||(W[1]=(...q)=>_e(M)&&_e(M)(...q))},"Device Login")),_e(H).loggedIn?(v(),E("button",{key:2,class:"skills-hub-sort",type:"button",onClick:W[2]||(W[2]=(...q)=>_e(Ie)&&_e(Ie)(...q)),disabled:_e(de)},"Logout GitHub",8,iA)):le("",!0),h("button",{class:"skills-hub-sort",type:"button",onClick:W[3]||(W[3]=(...q)=>_e(Te)&&_e(Te)(...q)),disabled:_e(de)},ae(_e(Je)?"Pulling...":"Pull"),9,aA),_e(H).loggedIn?(v(),E("button",{key:3,class:"skills-hub-sort",type:"button",onClick:W[4]||(W[4]=(...q)=>_e(b)&&_e(b)(...q)),disabled:!_e(H).configured||_e(de)},ae(_e(X)?"Pushing...":"Push"),9,lA)):le("",!0)])]),L.value?(v(),E("div",{key:0,class:st(["skills-hub-toast",oe.value])},ae(L.value.text),3)):le("",!0),be.value.length>0?(v(),E("div",cA,[h("button",{class:"skills-hub-section-toggle",type:"button",onClick:W[5]||(W[5]=q=>f.value=!f.value)},[h("span",uA,"Installed ("+ae(be.value.length)+")",1),Pe(jf,{class:st(["skills-hub-section-chevron",{"is-open":f.value}])},null,8,["class"])]),f.value?(v(),E("div",dA,[(v(!0),E(Ve,null,_t(be.value,q=>(v(),dt(bu,{key:q.name,skill:q,onSelect:z=>Oe(z)},null,8,["skill","onSelect"]))),128))])):le("",!0)])):le("",!0),h("div",fA,[h("div",hA,[Pe(Za,{class:"skills-hub-search-icon"}),Tr(h("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":W[6]||(W[6]=q=>s.value=q),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:tt},null,544),[[Sr,s.value]]),l.value>0?(v(),E("span",pA,ae(l.value)+" skills",1)):le("",!0)]),h("button",{class:"skills-hub-sort",type:"button",onClick:ke},ae(ne.value),1)]),h("div",mA,[u.value?(v(),E("div",gA,"Loading skills...")):c.value?(v(),E("div",vA,ae(c.value),1)):(v(),E(Ve,{key:2},[i.value.length>0?(v(),E("div",yA,[(v(!0),E(Ve,null,_t(i.value,q=>(v(),dt(bu,{key:q.url,skill:q,onSelect:z=>Oe(z)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(v(),E("div",wA,'No skills found for "'+ae(s.value)+'"',1)):le("",!0)],64))]),Pe(cS,{skill:S.value,visible:m.value,"is-installing":Se.value,"is-uninstalling":ue.value,onClose:W[7]||(W[7]=q=>m.value=!1),onInstall:Qe,onUninstall:wt,onToggleEnabled:ct},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),_A=lt(bA,[["__scopeId","data-v-4eceb63b"]]),kA={},TA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function SA(e,t){return v(),E("svg",TA,[...t[0]||(t[0]=[h("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),h("path",{d:"M9 4l0 16"},null,-1)])])}const IA=lt(kA,[["render",SA]]),EA={},CA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function AA(e,t){return v(),E("svg",CA,[...t[0]||(t[0]=[h("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const xA=lt(EA,[["render",AA]]),RA={class:"sidebar-thread-controls"},PA=["aria-label","title"],MA=Wt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(v(),E("div",RA,[h("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",title:e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",onClick:n[0]||(n[0]=r=>t.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(v(),dt(xA,{key:0,class:"sidebar-thread-controls-icon"})):(v(),dt(IA,{key:1,class:"sidebar-thread-controls-icon"}))],8,PA),rr(t.$slots,"default",{},void 0),e.showNewThreadButton?(v(),E("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":"Start new thread",title:"Start new thread",onClick:n[1]||(n[1]=r=>t.$emit("start-new-thread"))},[Pe(mi,{class:"sidebar-thread-controls-icon"})])):le("",!0)]))}}),Ku=lt(MA,[["__scopeId","data-v-46a10052"]]),$A={},OA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function NA(e,t){return v(),E("svg",OA,[...t[0]||(t[0]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),h("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const DA=lt($A,[["render",NA]]);function hr(e){return e.flatMap(t=>t.threads)}const $h="codex-web-local.thread-read-state.v1",Oh="codex-web-local.thread-scroll-state.v1",ll="codex-web-local.selected-thread-id.v1",cl="codex-web-local.selected-model-id.v1",Nh="codex-web-local.project-order.v1",Dh="codex-web-local.project-display-name.v1",Aa=220,LA=500,Ju=["none","minimal","low","medium","high","xhigh"],Js="__global__",Ln="gpt-5.2-codex",jA="Auto-commit from Codex rollback chat turn";function UA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($h);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Yu(e){typeof window>"u"||window.localStorage.setItem($h,JSON.stringify(e))}function ul(e,t,n){return Math.min(Math.max(e,t),n)}function FA(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.scrollTop!="number"||!Number.isFinite(t.scrollTop)||typeof t.isAtBottom!="boolean")return null;const n={scrollTop:Math.max(0,t.scrollTop),isAtBottom:t.isAtBottom};return typeof t.scrollRatio=="number"&&Number.isFinite(t.scrollRatio)&&(n.scrollRatio=ul(t.scrollRatio,0,1)),n}function BA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Oh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=FA(s);o&&(n[r]=o)}return n}catch{return{}}}function Xu(e){typeof window>"u"||window.localStorage.setItem(Oh,JSON.stringify(e))}function HA(){return typeof window>"u"?"":window.localStorage.getItem(ll)??""}function WA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(ll);return}window.localStorage.setItem(ll,e)}}function VA(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(cl))==null?void 0:e.trim())??""}function xa(e){if(typeof window>"u")return;const t=e.trim();if(!t){window.localStorage.removeItem(cl);return}window.localStorage.setItem(cl,t)}function zA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Nh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const s=Eo(r);s.length>0&&!n.includes(s)&&n.push(s)}return n}catch{return[]}}function ms(e){typeof window>"u"||window.localStorage.setItem(Nh,JSON.stringify(e))}function GA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){const o=typeof r=="string"?Eo(r):"";o.length>0&&typeof s=="string"&&(n[o]=s)}return n}catch{return{}}}function Ra(e){typeof window>"u"||window.localStorage.setItem(Dh,JSON.stringify(e))}function qo(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return rs(e,n)?e:n}function Pa(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function rs(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function qA(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function KA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function Ko(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("not supported when using codex with a chatgpt account")||t.includes("model is not supported")}function dl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&rs(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&KA(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function ki(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function JA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const f=r.get(c.id);return f&&dl(f,c)?f:c});if(n.preserveMissing!==!0)return ki(e,o)?e:o;const i=e.map(c=>{const f=s.get(c.id);return!f||dl(c,f)?c:f}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),u=[...i,...l];return ki(e,u)?e:u}function fl(e){return e.replace(/\s+/gu," ").trim()}function YA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>fl(s.text)).filter(s=>s.length>0));if(n.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;const o=fl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Qu(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(dl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Lh="worked";function Mr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function XA(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function QA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function ZA(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function e1(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${XA(e.durationMs)}`,messageType:Lh}}function t1(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function n1(e,t){const n=e1(t),r=e.filter(i=>i.messageType!==Lh),s=t1(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Jt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function r1(e,t){return e.id===t.id&&e.title===t.title&&e.projectName===t.projectName&&e.cwd===t.cwd&&e.createdAtIso===t.createdAtIso&&e.updatedAtIso===t.updatedAtIso&&e.preview===t.preview&&e.unread===t.unread&&e.inProgress===t.inProgress}function s1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function o1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function rn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Jo(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(l=>[l.id,l]))??[]),a=s.threads.map(l=>{const u=i.get(l.id);return u&&r1(u,l)?u:l});return o&&o.projectName===s.projectName&&s1(o.threads,a)?o:{projectName:s.projectName,threads:a}});return o1(e,r)?e:r}function i1(e,t,n){const r=new Set(hr(t).map(a=>a.id)),s=hr(e).filter(a=>n[a.id]===!0&&!r.has(a.id));if(s.length===0)return t;const o=new Map(t.map(a=>[a.projectName,a])),i=t.map(a=>({projectName:a.projectName,threads:[...a.threads]}));for(const a of s){if(o.get(a.projectName)){const u=i.findIndex(c=>c.projectName===a.projectName);u>=0&&(i[u]={projectName:i[u].projectName,threads:[a,...i[u].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function Ma(e){return Eo(e)}function a1(e){const t=e.split(`
1422
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function l1(){const e=N([]),t=N([]),n=N(HA()),r=N({}),s=N({}),o=N({}),i=N({}),a=N({}),l=N({}),u=N({}),c=N({}),f=N([]),m=N(VA()),S=N("medium"),L=N("standard"),O=N(UA()),V=N(BA()),R=N(zA()),P=N(GA()),B=N({}),F=N({}),ne=N({}),oe=N({}),we=N({}),Se=N({}),ue=N({}),ce=N({}),be=N({}),K=N({}),ke=N([]),Ne=N([]),Ue=N(!1),Ce=N(!1),$e=N(!1),De=N(!1),ze=N(!1),tt=N(!1),Oe=N(""),Qe=N(!1),wt=N(!1);let ct=null,Ze=null,Je=null,X=null,de=!1;const fe=new Set;let Ie=!1,Te=!1;const b=new Map,T=new Set,M=N(!0),Y=ie(()=>hr(e.value)),ee=ie(()=>Y.value.find(d=>d.id===n.value)??null),H=ie(()=>V.value[n.value]??null),G=ie(()=>{const d=[],p=n.value;return p&&Array.isArray(ce.value[p])&&d.push(...ce.value[p]),Array.isArray(ce.value[Js])&&d.push(...ce.value[Js]),d.sort((g,x)=>g.receivedAtIso.localeCompare(x.receivedAtIso))}),W=ie(()=>{var Z;const d=n.value;if(!d)return null;const p=we.value[d],g=(o.value[d]??"").trim(),x=(((Z=Se.value[d])==null?void 0:Z.message)??"").trim();return!p&&!g&&!x?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:g,errorText:x}}),q=ie(()=>{const d=n.value;if(!d)return[];const p=r.value[d]??[],g=s.value[d]??[],x=i.value[d]??[],Z=[...p,...x,...g],re=oe.value[d];return re?n1(Z,re):Z});function z(d){n.value!==d&&(n.value=d,WA(d),Te=!1)}function me(d){m.value=d.trim(),xa(m.value)}function ve(d){M.value=d}async function ye(){m.value=Ln,xa(m.value),f.value.includes(Ln)||(f.value=[...f.value,Ln]);try{await Q_(Ln)}catch{}}function Re(d,p){be.value={...be.value,[d]:p}}function We(d){be.value[d]&&(be.value=Jt(be.value,d))}async function Fe(d,p){if(!M.value)return;const g=p.trim();if(!g)return;const x=Y.value.find(re=>re.id===d);if(!x)return;const Z=x.cwd.trim();Z&&(await ok(Z,g),de=!0)}async function Me(d,p){var Ee;if(!M.value)return;const g=Y.value.find(ge=>ge.id===d);if(!g)return;const x=g.cwd.trim();if(!x)return;const re=(r.value[d]??[]).find(ge=>ge.role==="user"&&ge.turnIndex===p),he=((Ee=re==null?void 0:re.text)==null?void 0:Ee.trim())??"";if(he){try{await ik(x,he)}catch(ge){if((ge instanceof Error?ge.message:"").includes("No matching commit found"))return;throw ge}de=!0}}async function Ye(d){if(T.has(d))return;const p=be.value[d];if(!(!p||p.fallbackRetried)){T.add(d),Re(d,{...p,fallbackRetried:!0});try{await ye();try{const g=await hu(d,1);At(d,g),Gt(d,[]),Yt(d),i.value[d]&&(i.value=Jt(i.value,d))}catch{}It(d,null),Oe.value="",zt(d,null),kt(d,{label:"Thinking",details:ft(Ln,p.effort)}),Mt(d,!0),ne.value[d]!==!0&&await ya(d),await wa(d,p.text,p.imageUrls,Ln,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments),ne.value={...ne.value,[d]:!0},pt(),fe.add(d),de=!0,await lr()}catch(g){const x=g instanceof Error?g.message:"Unknown application error";It(d,x),Oe.value=x,Mt(d,!1),kt(d,null)}finally{T.delete(d)}}}function et(d){d&&!Ju.includes(d)||(S.value=d)}async function xt(d){const p=d==="fast"?"fast":"standard";if(ze.value||L.value===p)return;const g=L.value;L.value=p,ze.value=!0,Oe.value="";try{await Z_(p)}catch(x){L.value=g,Oe.value=x instanceof Error?x.message:"Failed to update Fast mode"}finally{ze.value=!1}}function ft(d,p){const g=d.trim()||"default",x=p||"default",Z=L.value==="fast"?"Fast":"Standard";return[`Model: ${g}`,`Thinking: ${x}`,`Speed: ${Z}`]}async function Ct(){try{const[d,p]=await Promise.all([ek(),tk()]);f.value=d,m.value.length>0&&d.includes(m.value)||(p.model&&d.includes(p.model)?m.value=p.model:d.length>0?m.value=d[0]:m.value="",xa(m.value)),p.reasoningEffort&&Ju.includes(p.reasoningEffort)&&(S.value=p.reasoningEffort),L.value=p.speedMode}catch{}}async function Lt(){if(X){await X;return}X=(async()=>{try{Ne.value=Kt(await nk())}catch{}finally{X=null}})(),await X}function pt(){if(typeof window>"u"){Lt();return}Je!==null&&window.clearTimeout(Je),Je=window.setTimeout(()=>{Je=null,Lt()},LA)}function Pt(d){const p=K.value;return Object.keys(p).length===0?d:d.map(g=>({projectName:g.projectName,threads:g.threads.map(x=>{const Z=p[x.id];return Z?{...x,title:Z}:x})}))}function mt(){const p=Pt(t.value).map(g=>({projectName:g.projectName,threads:g.threads.map(x=>{const Z=a.value[x.id]===!0,re=n.value===x.id,he=O.value[x.id],Ee=c.value[x.id]===!0,ge=!re&&!Z&&(Ee||he!==x.updatedAtIso);return{...x,inProgress:Z,unread:ge}})}));e.value=Jo(e.value,p)}function Vt(d,p,g){const x=new Date().toISOString(),Z=Rn(p),re=Eo(Z),he={id:d,title:a1(g),projectName:re,cwd:Z,hasWorktree:Z.includes("/.codex/worktrees/")||Z.includes("/.git/worktrees/"),createdAtIso:x,updatedAtIso:x,preview:g,unread:!1,inProgress:!1},Ee=t.value.findIndex(ot=>ot.projectName===re);if(Ee>=0){const it=t.value[Ee].threads.filter(Kn=>Kn.id!==d),nn={projectName:re,threads:[he,...it]},An=[...t.value];An.splice(Ee,1,nn),t.value=An}else t.value=[{projectName:re,threads:[he]},...t.value];const ge=qo(R.value,t.value);rs(R.value,ge)||(R.value=ge,ms(R.value)),mt()}function nt(d){const p=new Set(d.map(re=>re.id)),g=rn(O.value,p);g!==O.value&&(O.value=g,Yu(g));const x=rn(V.value,p);x!==V.value&&(V.value=x,Xu(x)),F.value=rn(F.value,p),B.value=rn(B.value,p),ne.value=rn(ne.value,p),r.value=rn(r.value,p),s.value=rn(s.value,p),o.value=rn(o.value,p),i.value=rn(i.value,p),oe.value=rn(oe.value,p),we.value=rn(we.value,p),Se.value=rn(Se.value,p),ue.value=rn(ue.value,p),c.value=rn(c.value,p),a.value=rn(a.value,p);const Z={};for(const[re,he]of Object.entries(ce.value))(re===Js||p.has(re))&&(Z[re]=he);ce.value=Z}function bn(d){const p=hr(t.value).find(g=>g.id===d);p&&(O.value={...O.value,[d]:p.updatedAtIso},Yu(O.value),c.value[d]&&(c.value=Jt(c.value,d)),mt())}function zt(d,p){if(!d)return;const g=oe.value[d];if(p){if(QA(g,p))return;oe.value={...oe.value,[d]:p}}else g&&(oe.value=Jt(oe.value,d))}function Mt(d,p){!d||a.value[d]===!0===p||(p?a.value={...a.value,[d]:!0}:a.value=Jt(a.value,d),mt())}function un(d){d&&d!==n.value&&c.value[d]!==!0&&(c.value={...c.value,[d]:!0},mt())}function kt(d,p){if(!d)return;const g=we.value[d];if(!p){g&&(we.value=Jt(we.value,d));return}const x=Cn(p.label)||"Thinking",Z=p.details.map(Ee=>Cn(Ee)).filter(Ee=>Ee.length>0&&Ee!==x),re=Array.from(new Set([...(g==null?void 0:g.details)??[],...Z])).slice(-3),he={label:x,details:re};ZA(g,he)||(we.value={...we.value,[d]:he})}function It(d,p){if(!d)return;const g=Se.value[d],x=p?fl(p):"";if(!x){g&&(Se.value=Jt(Se.value,d));return}(g==null?void 0:g.message)!==x&&(Se.value={...Se.value,[d]:{message:x}})}function en(d){const p=hr(t.value).find(g=>g.id===d);return(p==null?void 0:p.updatedAtIso)??""}function jt(d,p){if(!d)return;const g={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(g.scrollRatio=ul(p.scrollRatio,0,1));const x=V.value[d];x&&x.scrollTop===g.scrollTop&&x.isAtBottom===g.isAtBottom&&x.scrollRatio===g.scrollRatio||(V.value={...V.value,[d]:g},Xu(V.value))}function At(d,p){const g=r.value[d]??[];ki(g,p)||(r.value={...r.value,[d]:p})}function Gt(d,p){const g=s.value[d]??[];ki(g,p)||(s.value={...s.value,[d]:p})}function In(d,p){const g=s.value[d]??[],x=Qu(g,p);Gt(d,x)}function $t(d,p){if(!d)return;const g=p.trim(),x=o.value[d]??"";if(g.length===0){if(!x)return;o.value=Jt(o.value,d);return}x!==g&&(o.value={...o.value,[d]:g})}function En(d,p){if(!d)return;const g=o.value[d]??"";$t(d,`${g}${p}`)}function Yt(d){d&&d in o.value&&(o.value=Jt(o.value,d))}function He(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function Le(d){return typeof d=="string"?d:""}function qt(d){return typeof d=="number"&&Number.isFinite(d)?d:null}function dn(d){var p,g;return((p=d.limitId)==null?void 0:p.trim())||((g=d.limitName)==null?void 0:g.trim())||"__default__"}function Pn(d){const p=He(d);return p?{usedPercent:ul(qt(p.usedPercent)??0,0,100),windowDurationMins:qt(p.windowDurationMins),resetsAt:qt(p.resetsAt)}:null}function _n(d){const p=He(d);if(!p)return null;const g=He(p.credits);return{limitId:Le(p.limitId)||null,limitName:Le(p.limitName)||null,primary:Pn(p.primary),secondary:Pn(p.secondary),credits:g?{hasCredits:g.hasCredits===!0,unlimited:g.unlimited===!0,balance:Le(g.balance)||null}:null,planType:Le(p.planType)||null}}function Kt(d){const p=He(d);if(!p)return[];const g=[],x=new Set,Z=he=>{if(!he)return;const Ee=dn(he);x.has(Ee)||(x.add(Ee),g.push(he))};Z(_n(p.rateLimits));const re=He(p.rateLimitsByLimitId);if(re)for(const he of Object.values(re))Z(_n(he));return g}function Ut(d){const p=He(d.params);if(!p)return"";const g=Le(p.threadId);if(g)return g;const x=Le(p.thread_id);if(x)return x;const Z=Le(p.conversationId);if(Z)return Z;const re=Le(p.conversation_id);if(re)return re;const he=He(p.thread),Ee=Le(he==null?void 0:he.id);if(Ee)return Ee;const ge=He(p.turn),ot=Le(ge==null?void 0:ge.threadId);if(ot)return ot;const it=Le(ge==null?void 0:ge.thread_id);return it||""}function tn(d){if(d.method!=="turn/completed")return"";const p=He(d.params),g=He(p==null?void 0:p.turn);if(!g||g.status!=="failed")return"";const x=He(g.error);return Le(x==null?void 0:x.message)}function fn(d){var g;if(d.method!=="error")return"";const p=He(d.params);return Le(p==null?void 0:p.message)||Le((g=He(p==null?void 0:p.error))==null?void 0:g.message)}function Un(d){const p=He(d);if(!p)return null;const g=p.id,x=Le(p.method),Z=p.params;if(typeof g!="number"||!Number.isInteger(g)||!x)return null;const re=He(Z),he=Le(re==null?void 0:re.threadId)||Js,Ee=Le(re==null?void 0:re.turnId),ge=Le(re==null?void 0:re.itemId),ot=Le(p.receivedAtIso)||new Date().toISOString();return{id:g,method:x,threadId:he,turnId:Ee,itemId:ge,receivedAtIso:ot,params:Z??null}}function Mn(d){const p=d.threadId||Js,g=ce.value[p]??[],x=g.findIndex(re=>re.id===d.id),Z=[...g];x>=0?Z.splice(x,1,d):Z.push(d),ce.value={...ce.value,[p]:Z.sort((re,he)=>re.receivedAtIso.localeCompare(he.receivedAtIso))}}function $n(d){const p={};for(const[g,x]of Object.entries(ce.value)){const Z=x.filter(re=>re.id!==d);Z.length>0&&(p[g]=Z)}ce.value=p}function kn(d){if(d.method==="server/request"){const p=Un(d.params);return p&&Mn(p),!0}if(d.method==="server/request/resolved"){const p=He(d.params),g=p==null?void 0:p.id;return typeof g=="number"&&Number.isInteger(g)&&$n(g),!0}return!1}function Cn(d){return d.replace(/\s+/gu," ").trim()}function On(d){const p=Ut(d);if(!p)return null;if(d.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(d.method==="item/started"){const g=He(d.params),x=He(g==null?void 0:g.item),Z=Le(x==null?void 0:x.type).toLowerCase();if(Z==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(Z==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(Z==="commandexecution"){const re=Le(x==null?void 0:x.command);return{threadId:p,activity:{label:"Running command",details:re?[re]:[]}}}}return d.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:d.method==="item/reasoning/summaryTextDelta"||d.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:d.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function w(d){if(d.method!=="turn/started")return null;const p=He(d.params);if(!p)return null;const g=Ut(d);if(!g)return null;const x=He(p.turn),Z=Le(x==null?void 0:x.id)||Le(p.turnId)||`${g}:unknown`;if(!Z)return null;const re=Mr(Le(x==null?void 0:x.startedAt))??Mr(Le(p.startedAt))??Mr(d.atIso)??Date.now();return{threadId:g,turnId:Z,startedAtMs:re}}function I(d){if(d.method!=="turn/completed")return null;const p=He(d.params);if(!p)return null;const g=Ut(d);if(!g)return null;const x=He(p.turn),Z=Le(x==null?void 0:x.id)||Le(p.turnId)||`${g}:unknown`;if(!Z)return null;const re=Mr(Le(x==null?void 0:x.completedAt))??Mr(Le(p.completedAt))??Mr(d.atIso)??Date.now(),he=Mr(Le(x==null?void 0:x.startedAt))??Mr(Le(p.startedAt))??void 0;return{threadId:g,turnId:Z,completedAtMs:re,startedAtMs:he}}function A(d){return`${d}:live-reasoning`}function J(d){const p=He(d.params);if(!p)return"";if(d.method==="item/started"){const g=He(p.item);return!g||g.type!=="reasoning"?"":Le(g.id)}return""}function y(d){const p=He(d.params);if(!p)return null;if(d.method==="item/reasoning/summaryTextDelta"){const g=Le(p.itemId),x=Le(p.delta);return!g||!x?null:{messageId:A(g),delta:x}}return null}function C(d){const p=He(d.params);if(!p)return"";if(d.method==="item/reasoning/summaryPartAdded"){const g=Le(p.itemId);return g?A(g):""}return""}function j(d){const p=He(d.params);if(!p)return"";if(d.method==="item/completed"){const g=He(p.item);return!g||g.type!=="reasoning"?"":A(Le(g.id))}return""}function te(d){const p=He(d.params);if(!p)return"";if(d.method==="item/started"){const g=He(p.item);return!g||g.type!=="agentMessage"?"":Le(g.id)}return""}function Ae(d){const p=He(d.params);if(!p)return null;if(d.method==="item/agentMessage/delta"){const g=Le(p.itemId),x=Le(p.delta);return!g||!x?null:{messageId:g,delta:x}}return null}function Xe(d){const p=He(d.params);if(!p)return null;if(d.method==="item/completed"){const g=He(p.item);if(!g||g.type!=="agentMessage")return null;const x=Le(g.id),Z=Le(g.text);return!x||!Z?null:{id:x,role:"assistant",text:Z,messageType:"agentMessage.live"}}return null}function ut(d){if(d.method!=="item/started")return null;const p=He(d.params),g=He(p==null?void 0:p.item);if(!g||g.type!=="commandExecution")return null;const x=Le(g.id),Z=Le(g.command);if(!x)return null;const re=typeof g.cwd=="string"?g.cwd:null;return{id:x,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:re,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Rt(d){if(d.method!=="item/commandExecution/outputDelta")return null;const p=He(d.params);if(!p)return null;const g=Le(p.itemId),x=Le(p.delta);return!g||!x?null:{itemId:g,delta:x}}function k(d){if(d.method!=="item/completed")return null;const p=He(d.params),g=He(p==null?void 0:p.item);if(!g||g.type!=="commandExecution")return null;const x=Le(g.id),Z=Le(g.command);if(!x)return null;const re=typeof g.cwd=="string"?g.cwd:null,he=Le(g.status),Ee=he==="failed"?"failed":he==="declined"?"declined":he==="interrupted"?"interrupted":"completed",ge=typeof g.aggregatedOutput=="string"?g.aggregatedOutput:"",ot=typeof g.exitCode=="number"?g.exitCode:null;return{id:x,role:"system",text:Z,messageType:"commandExecution",commandExecution:{command:Z,cwd:re,status:Ee,aggregatedOutput:ge,exitCode:ot}}}function $(d,p){const g=i.value[d]??[],x=Qu(g,p);x!==g&&(i.value={...i.value,[d]:x})}function D(d,p){const g=i.value[d];if(!g||g.length===0)return;const x=new Set(p.map(re=>re.id)),Z=g.filter(re=>!x.has(re.id));Z.length!==g.length&&(Z.length===0?i.value=Jt(i.value,d):i.value={...i.value,[d]:Z})}function Q(d){if(d.method==="item/agentMessage/delta")return!0;const p=He(d.params);if(!p)return!1;if(d.method==="item/completed"){const g=He(p.item);return(g==null?void 0:g.type)==="agentMessage"}return!1}function je(d){var Ws,Fo,_,U,se;if(kn(d))return;if(d.method==="account/rateLimits/updated"&&pt(),d.method==="thread/name/updated"){const pe=He(d.params),Be=Le(pe==null?void 0:pe.threadId),xe=Le(pe==null?void 0:pe.threadName);Be&&xe&&(K.value={...K.value,[Be]:xe},mt(),ba(Be,xe))}const p=On(d);p&&kt(p.threadId,p.activity);const g=w(d);g&&(b.set(g.turnId,g),ue.value={...ue.value,[g.threadId]:g.turnId},zt(g.threadId,null),It(g.threadId,null),Mt(g.threadId,!0),c.value[g.threadId]&&(c.value=Jt(c.value,g.threadId)));const x=I(d),Z=tn(d),he=!!((x==null?void 0:x.threadId)??Ut(d))&&!!Z&&m.value!==Ln&&Ko(new Error(Z));if(x){const pe=be.value[x.threadId],Be=b.get(x.turnId);Be&&b.delete(x.turnId);const xe=qt((Ws=He(d.params))==null?void 0:Ws.durationMs)??qt((_=He((Fo=He(d.params))==null?void 0:Fo.turn))==null?void 0:_.durationMs)??(typeof x.startedAtMs=="number"?x.completedAtMs-x.startedAtMs:null)??(Be?x.completedAtMs-Be.startedAtMs:null),Nt=typeof xe=="number"?Math.max(0,xe):0;if(zt(x.threadId,{turnId:x.turnId,durationMs:Nt}),ue.value[x.threadId]&&(ue.value=Jt(ue.value,x.threadId)),Mt(x.threadId,!1),kt(x.threadId,null),un(x.threadId),he||(We(x.threadId),Oo(x.threadId)),!Z&&!he){const qr=((U=pe==null?void 0:pe.text)==null?void 0:U.trim())||jA;Fe(x.threadId,qr).catch(()=>{})}}if(Z){const pe=(x==null?void 0:x.threadId)||Ut(d);pe&&It(pe,Z),Oe.value=Z,pe&&he&&Ye(pe)}else x&&It(x.threadId,null);const Ee=fn(d);if(Ee){const pe=Ut(d);pe&&It(pe,Ee),Oe.value=Ee,m.value!==Ln&&Ko(new Error(Ee))&&(pe?Ye(pe):ye())}const ge=Ut(d);if(!ge||ge!==n.value)return;te(d);const ot=Ae(d);if(ot){const pe=(s.value[ge]??[]).find(xe=>xe.id===ot.messageId),Be=`${(pe==null?void 0:pe.text)??""}${ot.delta}`;In(ge,{id:ot.messageId,role:"assistant",text:Be,messageType:"agentMessage.live"})}const it=Xe(d);it&&In(ge,it),J(d);const nn=y(d);if(nn&&En(ge,nn.delta),C(d)){const pe=o.value[ge]??"";pe.trim().length>0&&!pe.endsWith(`
1423
-
1424
- `)&&$t(ge,`${pe}
1425
-
1426
- `)}j(d);const Kn=ut(d);Kn&&($(ge,Kn),kt(ge,{label:"Running command",details:[((se=Kn.commandExecution)==null?void 0:se.command)??""]}));const Hs=Rt(d);if(Hs){const pe=(i.value[ge]??[]).find(Be=>Be.id===Hs.itemId);pe!=null&&pe.commandExecution&&$(ge,{...pe,commandExecution:{...pe.commandExecution,aggregatedOutput:`${pe.commandExecution.aggregatedOutput}${Hs.delta}`}})}const Uo=k(d);if(Uo&&$(ge,Uo),Q(d)&&(Te&&n.value&&jt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Yt(ge)),d.method==="turn/completed"){Te=!1,Yt(ge),i.value[ge]&&(i.value=Jt(i.value,ge));const pe=Ut(d);pe&&(Mt(pe,!1),kt(pe,null),un(pe),he||(We(pe),Oo(pe)))}}function Ft(d){const p=Ut(d);p&&fe.add(p);const g=d.method;(g.startsWith("thread/")||g.startsWith("turn/")||g.startsWith("item/"))&&(de=!0),!(Ze!==null||typeof window>"u")&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa))}async function Tn(d){if(!Ie){Ie=!0;try{const p=await Qa(),g=[];for(const x of p.order){const Z=Ma(x);g.includes(Z)||g.push(Z)}if(g.length>0){const x=qo(g,d);rs(R.value,x)||(R.value=x,ms(R.value))}if(Object.keys(p.labels).length>0){const x={...P.value};let Z=!1;for(const[re,he]of Object.entries(p.labels)){const Ee=Ma(re);x[Ee]!==he&&(x[Ee]=he,Z=!0)}Z&&(P.value=x,Ra(x))}}catch{}}}async function ds(){if(!(Object.keys(K.value).length>0))try{const d=await mk();Object.keys(d.titles).length>0&&(K.value=d.titles)}catch{}}async function fs(d,p,g){if(K.value[d])return;const x=p.trim();if(!x)return;const Z=x.length>300?x.slice(0,300):x;try{const re=await gk(Z,g);if(!re||K.value[d])return;K.value={...K.value,[d]:re},mt(),ba(d,re)}catch{}}async function hn(){var d;wt.value||(Ue.value=!0);try{const[p]=await Promise.all([H_(),ds()]);await Tn(p);const g=qo(R.value,p);rs(R.value,g)||(R.value=g,ms(R.value));const x=Pa(p,R.value),Z=i1(t.value,x,a.value);t.value=Jo(t.value,Z),a.value=rn(a.value,new Set(hr(t.value).map(Ee=>Ee.id))),mt(),wt.value=!0;const re=hr(e.value);nt(re),re.some(Ee=>Ee.id===n.value)||z(((d=re[0])==null?void 0:d.id)??"")}finally{Ue.value=!1}}async function Nn(d,p={}){if(!d)return;const g=F.value[d]===!0,x=p.silent!==!0&&!g;x&&(Ce.value=!0);try{ne.value[d]!==!0&&(await ya(d),ne.value={...ne.value,[d]:!0});const{messages:Z,inProgress:re}=await W_(d),he=r.value[d]??[],Ee=JA(he,Z,{preserveMissing:p.silent===!0});At(d,Ee);const ge=s.value[d]??[],ot=YA(ge,Z);Gt(d,ot),D(d,Z),F.value={...F.value,[d]:!0};const it=en(d);it&&(B.value={...B.value,[d]:it}),Mt(d,re),bn(d)}finally{x&&(Ce.value=!1)}}async function Vr(){try{const d=t.value.flatMap(p=>p.threads.map(g=>g.cwd)).filter(Boolean);ke.value=await vk(d.length>0?[...new Set(d)]:void 0)}catch{}}async function js(){Oe.value="";try{await hn(),await Promise.all([Ct(),Lt(),Vr()]),await Nn(n.value)}catch(d){Oe.value=d instanceof Error?d.message:"Unknown application error"}}async function Wi(d){z(d);try{await Nn(d)}catch(p){Oe.value=p instanceof Error?p.message:"Unknown application error"}}async function Vi(d){try{await q_(d),await hn(),n.value===d&&await Nn(n.value)}catch(p){Oe.value=p instanceof Error?p.message:"Unknown application error"}}async function zi(d,p){const g=p.trim();if(!(!d||!g))try{await K_(d,g),K.value={...K.value,[d]:g},mt(),ba(d,g)}catch(x){Oe.value=x instanceof Error?x.message:"Unknown application error"}}async function Gi(d){var he,Ee;const p=d.trim();if(!p)return"";const g=hr(t.value).find(ge=>ge.id===p),x=((he=g==null?void 0:g.cwd)==null?void 0:he.trim())??"",Z=((Ee=g==null?void 0:g.title)==null?void 0:Ee.trim())??"Forked chat",re=m.value.trim();Oe.value="";try{const ge=await J_(p,x||void 0,re||void 0);return ge?(Vt(ge,x,Z),ne.value={...ne.value,[ge]:!0},z(ge),await hn(),await Nn(ge),ge):""}catch(ge){return Oe.value=ge instanceof Error?ge.message:"Unknown application error",""}}async function $o(d,p=[],g=[],x="steer",Z=[],re){if(ze.value)return;const he=n.value,Ee=d.trim();if(!he||!Ee&&p.length===0&&Z.length===0)return;const ge=a.value[he]===!0;if(ge&&x==="queue"){const ot=l.value[he]??[],it=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,nn=[...ot],An=typeof re=="number"?Math.max(0,Math.min(re,nn.length)):nn.length;nn.splice(An,0,{id:it,text:Ee,imageUrls:p,skills:g,fileAttachments:Z}),l.value={...l.value,[he]:nn};return}if(ge){Te=!0,zr(he,Ee,p,g,Z).catch(ot=>{const it=ot instanceof Error?ot.message:"Unknown application error";It(he,it),Oe.value=it});return}Oe.value="",Te=!0,zt(he,null),kt(he,{label:"Thinking",details:ft(m.value,S.value)}),It(he,null),Mt(he,!0);try{await zr(he,Ee,p,g,Z)}catch(ot){Te=!1,Mt(he,!1),kt(he,null);const it=ot instanceof Error?ot.message:"Unknown application error";throw It(he,it),Oe.value=it,ot}}async function hs(d,p,g=[],x=[],Z=[]){if(ze.value)return"";const re=d.trim(),he=p.trim(),Ee=m.value.trim();if(!re&&g.length===0&&Z.length===0)return"";$e.value=!0,Oe.value="";let ge="";try{try{ge=await pu(he||void 0,Ee||void 0)}catch(An){if(Ee&&Ee!==Ln&&Ko(An))await ye(),ge=await pu(he||void 0,Ln);else throw An}if(!ge)return"";Vt(ge,he,re||"[Image]"),ne.value={...ne.value,[ge]:!0},z(ge),Te=!0,zt(ge,null),kt(ge,{label:"Thinking",details:ft(m.value,S.value)}),It(ge,null),Mt(ge,!0);const ot=ge,it=he||null,nn=re;return zr(ge,re,g,x,Z).catch(An=>{Te=!1,Mt(ge,!1),kt(ge,null);const Kn=An instanceof Error?An.message:"Unknown application error";It(ge,Kn),Oe.value=Kn}).finally(()=>{$e.value=!1}),fs(ot,nn,it),ge}catch(ot){Te=!1,ge&&(Mt(ge,!1),kt(ge,null));const it=ot instanceof Error?ot.message:"Unknown application error";throw ge&&It(ge,it),Oe.value=it,$e.value=!1,ot}}async function zr(d,p,g=[],x=[],Z=[]){const re=m.value.trim(),he=S.value,Ee=p.trim(),ge=x.map(it=>({name:it.name,path:it.path})),ot=Z.map(it=>({...it}));Re(d,{text:Ee,imageUrls:[...g],skills:ge,fileAttachments:ot,effort:he,fallbackRetried:!1});try{ne.value[d]!==!0&&await ya(d);try{await wa(d,p,g,re||void 0,he||void 0,x.length>0?x:void 0,Z)}catch(it){if(re&&re!==Ln&&Ko(it))await ye(),Re(d,{text:Ee,imageUrls:[...g],skills:ge,fileAttachments:ot,effort:he,fallbackRetried:!0}),await wa(d,p,g,Ln,he||void 0,x.length>0?x:void 0,Z);else throw it}ne.value={...ne.value,[d]:!0},fe.add(d),de=!0,await lr()}catch(it){throw it}}async function Oo(d){if(u.value[d]===!0)return;const p=l.value[d];if(!p||p.length===0)return;u.value={...u.value,[d]:!0};const[g,...x]=p;l.value=x.length>0?{...l.value,[d]:x}:Jt(l.value,d),$e.value=!0,Oe.value="",Te=!0,zt(d,null),kt(d,{label:"Thinking",details:ft(m.value,S.value)}),It(d,null),Mt(d,!0);try{await zr(d,g.text,g.imageUrls,g.skills,g.fileAttachments)}catch{Mt(d,!1),kt(d,null)}finally{u.value=Jt(u.value,d),$e.value=!1}}async function Us(){const d=n.value;if(!d||a.value[d]!==!0)return;const p=ue.value[d];De.value=!0,Oe.value="";try{await X_(d,p),Mt(d,!1),kt(d,null),It(d,null),ue.value[d]&&(ue.value=Jt(ue.value,d)),fe.add(d),de=!0,await lr()}catch(g){const x=g instanceof Error?g.message:"Failed to interrupt active turn";It(d,x),Oe.value=x}finally{De.value=!1}}async function Fs(d){const p=n.value;if(!p||tt.value)return;const x=(r.value[p]??[]).reduce((re,he)=>typeof he.turnIndex=="number"&&he.turnIndex>re?he.turnIndex:re,-1);if(x<0||d>x)return;const Z=x-d+1;if(!(Z<1)){tt.value=!0,Oe.value="";try{await Me(p,d);const re=await hu(p,Z);At(p,re),Gt(p,[]),Yt(p),i.value[p]&&(i.value=Jt(i.value,p)),zt(p,null),kt(p,null),It(p,null),de=!0,await lr()}catch(re){Oe.value=re instanceof Error?re.message:"Failed to rollback thread"}finally{tt.value=!1}}}function qi(d,p){d.length===0||(P.value[d]??"")===p||(P.value={...P.value,[d]:p},Ra(P.value))}function No(d){var Z;if(d.length===0)return;const p=R.value.filter(re=>re!==d);if(rs(R.value,p)||(R.value=p,ms(R.value)),t.value=t.value.filter(re=>re.projectName!==d),P.value[d]!==void 0){const re={...P.value};delete re[d],P.value=re,Ra(re)}mt();const g=hr(e.value);nt(g),g.some(re=>re.id===n.value)||z(((Z=g[0])==null?void 0:Z.id)??""),Bs()}function Do(d,p){if(d.length===0||t.value.length===0)return;const g=t.value.map(ge=>ge.projectName),x=g.indexOf(d);if(x===-1)return;const Z=Math.max(0,Math.min(p,g.length-1)),re=qA(g,x,Z);if(re===g)return;const he=qo(re,t.value);R.value=he,ms(R.value);const Ee=Pa(t.value,R.value);t.value=Jo(t.value,Ee),mt(),Bs()}function Lo(d){const p=d.trim();if(!p)return;const g=[p,...R.value.filter(Z=>Z!==p)];if(rs(R.value,g))return;R.value=g,ms(R.value);const x=Pa(t.value,R.value);t.value=Jo(t.value,x),mt(),Bs()}async function Bs(){var d,p;try{const g=await Qa(),x=new Map;for(const he of g.order){const Ee=Ma(he);x.has(Ee)||x.set(Ee,he)}for(const he of t.value){const Ee=((p=(d=he.threads[0])==null?void 0:d.cwd)==null?void 0:p.trim())??"";Ee&&x.set(he.projectName,Ee)}const Z=[];for(const he of R.value){const Ee=x.get(he);Ee&&!Z.includes(Ee)&&Z.push(Ee)}for(const he of g.order)Z.includes(he)||Z.push(he);const re=g.active.filter(he=>Z.includes(he));re.length===0&&Z.length>0&&re.push(Z[0]),await ak({order:Z,labels:g.labels,active:re})}catch{}}async function lr(){if(Qe.value){typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa));return}Qe.value=!0;const d=de,p=new Set(fe);de=!1,fe.clear();try{d&&await hn();const g=n.value;if(!g)return;const x=p.has(g),Z=a.value[g]===!0,re=en(g),he=B.value[g]??"",Ee=re.length>0&&re!==he;(x||Z||Ee||d)&&await Nn(g,{silent:!0})}catch{}finally{Qe.value=!1,(de||fe.size>0)&&typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa))}}function Ki(){typeof window>"u"||ct||(Ji(),ct=V_(d=>{je(d),Ft(d)}))}async function Ji(){try{const d=await G_();for(const p of d){const g=Un(p);g&&Mn(g)}}catch{}}async function Yi(d){try{await z_(d.id,{result:d.result,error:d.error}),$n(d.id)}catch(p){Oe.value=p instanceof Error?p.message:"Failed to reply to server request"}}function Xi(){ct&&(ct(),ct=null),de=!1,fe.clear(),b.clear(),Ze!==null&&typeof window<"u"&&(window.clearTimeout(Ze),Ze=null),Je!==null&&typeof window<"u"&&(window.clearTimeout(Je),Je=null),Te=!1,r.value={},s.value={},o.value={},i.value={},we.value={},oe.value={},Se.value={},ue.value={},l.value={},u.value={}}const Gr=ie(()=>{const d=n.value;return d?l.value[d]??[]:[]});function jo(d){const p=n.value;if(!p)return;const g=l.value[p];if(!g)return;const x=g.filter(Z=>Z.id!==d);l.value=x.length>0?{...l.value,[p]:x}:Jt(l.value,p)}function Qi(d){const p=n.value;if(!p)return;const g=l.value[p];if(!g)return;const x=g.find(Z=>Z.id===d);x&&(jo(d),$o(x.text,x.imageUrls,x.skills,"steer",x.fileAttachments))}return{projectGroups:e,projectDisplayNameById:P,selectedThread:ee,selectedThreadScrollState:H,selectedThreadServerRequests:G,selectedLiveOverlay:W,selectedThreadId:n,availableModelIds:f,selectedModelId:m,selectedReasoningEffort:S,selectedSpeedMode:L,installedSkills:ke,accountRateLimitSnapshots:Ne,messages:q,isLoadingThreads:Ue,isLoadingMessages:Ce,isSendingMessage:$e,isInterruptingTurn:De,isUpdatingSpeedMode:ze,error:Oe,refreshAll:js,refreshSkills:Vr,selectThread:Wi,setThreadScrollState:jt,archiveThreadById:Vi,renameThreadById:zi,forkThreadById:Gi,sendMessageToSelectedThread:$o,sendMessageToNewThread:hs,interruptSelectedThreadTurn:Us,rollbackSelectedThread:Fs,isRollingBack:tt,selectedThreadQueuedMessages:Gr,removeQueuedMessage:jo,steerQueuedMessage:Qi,setSelectedModelId:me,setWorktreeGitAutomationEnabled:ve,setSelectedReasoningEffort:et,updateSelectedSpeedMode:xt,respondToPendingServerRequest:Yi,renameProject:qi,removeProject:No,reorderProject:Do,pinProjectToTop:Lo,startPolling:Ki,stopPolling:Xi}}const c1={class:"sidebar-root"},u1={class:"sidebar-scrollable"},d1=["aria-pressed"],f1={key:1,class:"sidebar-search-bar"},h1={key:0,class:"sidebar-settings-area"},p1={key:0,class:"sidebar-settings-panel"},m1=["title"],g1=["title"],v1={class:"sidebar-settings-value"},y1=["title"],w1={class:"sidebar-settings-value"},b1=["title"],_1=["title"],k1=["title"],T1=["title"],S1=["title"],I1={class:"sidebar-settings-value"},E1={class:"sidebar-settings-rate-limits"},C1={class:"sidebar-settings-build-label","aria-label":"Worktree name and version"},A1={class:"content-root"},x1={class:"content-body"},R1={key:1,class:"content-grid"},P1={class:"new-thread-empty"},M1={class:"worktree-init-status-title"},$1={class:"worktree-init-status-message"},O1={key:1,class:"new-thread-trending"},N1={class:"new-thread-trending-header"},D1={key:0,class:"new-thread-trending-empty"},L1={key:1,class:"new-thread-trending-empty"},j1={key:2,class:"new-thread-trending-list"},U1=["onClick"],F1=["title"],B1={class:"new-thread-trending-tip-name-owner"},H1={class:"new-thread-trending-tip-name-repo"},W1={key:1,class:"new-thread-trending-tip-name-repo"},V1={class:"new-thread-trending-tip-meta"},z1={class:"new-thread-trending-tip-description"},G1={key:2,class:"content-grid"},q1={class:"content-thread"},K1={class:"composer-with-queue"},Zu="codex-web-local.sidebar-collapsed.v1",ed="codex-web-local.send-with-enter.v1",td="codex-web-local.in-progress-send-mode.v1",nd="codex-web-local.dark-mode.v1",rd="codex-web-local.dictation-click-to-toggle.v1",sd="codex-web-local.dictation-auto-send.v1",od="codex-web-local.dictation-language.v1",id="codex-web-local.worktree-git-automation.v1",ad="codex-web-local.github-trending-projects.v1",J1=Wt({__name:"App",setup(e){const t="2a6c",n="0.1.56",r={sendWithEnter:"When enabled, press Enter to send. When disabled, use Command+Enter to send.",inProgressSendMode:"If a turn is still running, choose whether a new prompt should steer the current turn or be queued.",appearance:"Switch between system theme, light mode, and dark mode.",dictationClickToToggle:"Use click-to-start and click-to-stop dictation instead of hold-to-talk.",dictationAutoSend:"Automatically send transcribed dictation when recording stops.",rollbackCommits:"When enabled, each message creates a rollback Git commit. On rollback, it resets to the commit before that message.",githubTrendingProjects:"Show or hide GitHub trending project cards on the new thread screen.",dictationLanguage:"Choose transcription language or keep auto-detect."},s={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:o,projectDisplayNameById:i,selectedThread:a,selectedThreadScrollState:l,selectedThreadServerRequests:u,selectedLiveOverlay:c,selectedThreadId:f,availableModelIds:m,selectedModelId:S,selectedReasoningEffort:L,selectedSpeedMode:O,installedSkills:V,accountRateLimitSnapshots:R,messages:P,isLoadingThreads:B,isLoadingMessages:F,isInterruptingTurn:ne,isUpdatingSpeedMode:oe,refreshAll:we,refreshSkills:Se,selectThread:ue,setThreadScrollState:ce,archiveThreadById:be,forkThreadById:K,renameThreadById:ke,sendMessageToSelectedThread:Ne,sendMessageToNewThread:Ue,interruptSelectedThreadTurn:Ce,rollbackSelectedThread:$e,isRollingBack:De,selectedThreadQueuedMessages:ze,removeQueuedMessage:tt,steerQueuedMessage:Oe,setSelectedModelId:Qe,setWorktreeGitAutomationEnabled:wt,setSelectedReasoningEffort:ct,updateSelectedSpeedMode:Ze,respondToPendingServerRequest:Je,renameProject:X,removeProject:de,reorderProject:fe,pinProjectToTop:Ie,startPolling:Te,stopPolling:b}=l1(),T=_v(),M=bv(),{isMobile:Y}=Lf(),ee=N(null),H=N(null),G=N([]),W=N(!1),q=N("trending-daily"),z=N(null),me=N(!1),ve=N(!1),ye=N(""),Re=N("local"),We=N({order:[],labels:{}}),Fe=N({phase:"idle",title:"",message:""}),Me=N(An()),Ye=N(""),et=N(!1),xt=N(null),ft=N(null);let Ct=null;const Lt=N("New Project (1)"),pt=N(""),Pt=N(!1),mt=N(Gr(ed,!0)),Vt=N(Qi()),nt=N(jo()),bn=N(Gr(rd,!1)),zt=N(null);let Mt=0;const un=N(Gr(sd,!0)),kt=N(ge()),It=ie(()=>ot()),en=N(Gr(id,!0)),jt=N(Gr(ad,!0)),At=N({configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:""}),Gt=ie(()=>{const _=T.params.threadId;return typeof _=="string"?_:""}),In=ie(()=>{const _=new Set;for(const U of o.value)for(const se of U.threads)_.add(se.id);return _}),$t=ie(()=>T.name==="home"),En=ie(()=>T.name==="skills"),Yt=ie(()=>{var _;return En.value?"Skills":$t.value?"New thread":((_=a.value)==null?void 0:_.title)??"Choose a thread"}),He=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Le=ie(()=>{var U,se;return(((se=(U=a.value)==null?void 0:U.title)==null?void 0:se.trim())??"")||He}),qt=ie(()=>P.value.filter(_=>{const U=Hs(_.messageType,_.role);return U==="worked"?!0:!(U==="turnActivity.live"||U==="turnError.live"||U==="agentReasoning.live")})),dn=ie(()=>{let _=-1;for(const U of P.value)U.role==="user"&&typeof U.turnIndex=="number"&&U.turnIndex>_&&(_=U.turnIndex);return _}),Pn=ie(()=>c.value),_n=ie(()=>$t.value?"__new-thread__":f.value),Kt=ie(()=>{var _,U;return $t.value?ye.value.trim():((U=(_=a.value)==null?void 0:_.cwd)==null?void 0:U.trim())??""}),Ut=ie(()=>{var _;return!$t.value&&((_=a.value)==null?void 0:_.inProgress)===!0}),tn=ie(()=>{var pe,Be;const _=[],U=new Set;for(const xe of We.value.order){const Nt=xe.trim();!Nt||U.has(Nt)||(U.add(Nt),_.push({value:Nt,label:We.value.labels[Nt]||ws(Nt)}))}for(const xe of o.value){const Nt=((Be=(pe=xe.threads[0])==null?void 0:pe.cwd)==null?void 0:Be.trim())??"";!Nt||U.has(Nt)||(U.add(Nt),_.push({value:Nt,label:i.value[xe.projectName]??xe.projectName}))}const se=ye.value.trim();return se&&!U.has(se)&&_.unshift({value:se,label:ws(se)}),_}),fn=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Un=ie(()=>[{value:"search-daily",label:"Search daily"},{value:"search-weekly",label:"Search weekly"},{value:"search-monthly",label:"Search monthly"},{value:"trending-daily",label:"Trending daily"},{value:"trending-weekly",label:"Trending weekly"},{value:"trending-monthly",label:"Trending monthly"}]),Mn=ie(()=>{if(!At.value.configured)return"Not configured";const _=At.value.active?"Online":"Configured (offline)",U=`${At.value.mappedChats} chat(s), ${At.value.mappedThreads} thread(s)`,se=At.value.lastError?`, error: ${At.value.lastError}`:"";return`${_}, ${U}${se}`});ar(()=>{window.addEventListener("keydown",Ft),nn(),fn==null||fn.addEventListener("change",nn),Uo(),zi(),Oo(),Us(),hs(),kn(),jt.value&&Fs()}),So(()=>{window.removeEventListener("keydown",Ft),fn==null||fn.removeEventListener("change",nn),Ct&&(clearTimeout(Ct),Ct=null),b()}),at(Ye,_=>{const U=_.trim();if(Ct&&(clearTimeout(Ct),Ct=null),!U){ft.value=null;return}Ct=setTimeout(()=>{uk(U,1e3).then(se=>{Ye.value.trim()===U&&(ft.value=se.threadIds)}).catch(()=>{Ye.value.trim()===U&&(ft.value=null)})},220)});function $n(){Se()}async function kn(){try{At.value=await fk()}catch(_){const U=_ instanceof Error?_.message:"Failed to load Telegram status";At.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:U}}}function Cn(){et.value=!et.value,et.value?Xt(()=>{var _;return(_=xt.value)==null?void 0:_.focus()}):Ye.value=""}function On(){var _;Ye.value="",(_=xt.value)==null||_.focus()}function w(_){_.key==="Escape"&&(et.value=!1,Ye.value="")}function I(_){_&&(T.name==="thread"&&Gt.value===_||(M.push({name:"thread",params:{threadId:_}}),Y.value&&je(!0)))}async function A(_){_&&(f.value!==_&&(await ue(_),await M.push({name:"thread",params:{threadId:_}})),await Xt(),Ki())}function J(_){be(_)}async function y(_){const U=await K(_);U&&($t.value?await M.replace({name:"thread",params:{threadId:U}}):await M.push({name:"thread",params:{threadId:U}}),Y.value&&je(!0))}function C(_){const U=_.trim().replace(/\\/gu,"/");return U?U.includes("/.codex/worktrees/")||U.includes("/.git/worktrees/"):!1}function j(_,U=""){var xe,Nt,qr;const se=o.value.find(Kr=>Kr.projectName===_);if(!se)return U.trim();const pe=se.threads.find(Kr=>!C(Kr.cwd));return(((xe=pe==null?void 0:pe.cwd)==null?void 0:xe.trim())??((qr=(Nt=se.threads[0])==null?void 0:Nt.cwd)==null?void 0:qr.trim())??"")||U.trim()}function te(_){var pe,Be;const U=o.value.find(xe=>xe.projectName===_),se=j(_,((Be=(pe=U==null?void 0:U.threads[0])==null?void 0:pe.cwd)==null?void 0:Be.trim())??"");se&&(ye.value=se),Y.value&&je(!0),!$t.value&&M.push({name:"home"})}function Ae(_){var se;let U="";for(const pe of o.value){const Be=pe.threads.find(xe=>xe.id===_);if((se=Be==null?void 0:Be.cwd)!=null&&se.trim()){U=Be.cwd.trim();break}}!U||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(U)}`,"_blank","noopener,noreferrer")}function Xe(){var se;const _=a.value,U=_?j(_.projectName,((se=_.cwd)==null?void 0:se.trim())??""):"";U&&(ye.value=U),Y.value&&je(!0),!$t.value&&M.push({name:"home"})}function ut(_){X(_.projectName,_.displayName)}function Rt(_){ke(_.threadId,_.title)}function k(_){de(_)}function $(_){fe(_.projectName,_.toIndex)}function D(_){ce(_.threadId,_.state)}function Q(_){Je(_)}function je(_){Me.value!==_&&(Me.value=_,Kn(_))}function Ft(_){_.defaultPrevented||!_.ctrlKey&&!_.metaKey||_.shiftKey||_.altKey||_.key.toLowerCase()==="b"&&(_.preventDefault(),je(!Me.value))}function Tn(_){const U=_.text,se=z.value,pe=_.mode==="queue"&&se&&se.threadId===f.value?se.queueIndex:void 0;if(z.value=null,$t.value){Fo(U,_.imageUrls,_.skills,_.fileAttachments);return}if(_.rollbackLatestUserTurn===!0){js(_);return}Ne(U,_.imageUrls,_.skills,_.mode,_.fileAttachments,pe)}function ds(_){const U=new Intl.NumberFormat().format(_.stars);return _.language?`${_.language} · ★ ${U}`:`★ ${U}`}function fs(_){const se=new Set(["search-daily","search-weekly","search-monthly","trending-daily","trending-weekly","trending-monthly"]).has(_)?_:"trending-daily";q.value!==se&&(q.value=se)}function hn(){if(typeof window>"u")return;const _=window.prompt("Telegram bot token");!_||!_.trim()||dk(_.trim()).then(()=>{window.alert("Telegram bot configured. Open the bot DM and send /start."),kn()}).catch(U=>{const se=U instanceof Error?U.message:"Failed to connect Telegram bot";window.alert(se),kn()})}function Nn(_){const U=ee.value;U&&U.hydrateDraft({text:`Clone this GitHub project and run it: ${_.url}
1427
- Then explain what this project does in very simple words a 5th grader can understand.`,imageUrls:[],fileAttachments:[],skills:[]})}function Vr(_){const U=ze.value.findIndex(xe=>xe.id===_),se=U>=0?ze.value[U]:void 0,pe=H.value;if(!se||!pe||pe.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;z.value=f.value?{threadId:f.value,queueIndex:U}:null;const Be={text:se.text,imageUrls:[...se.imageUrls],fileAttachments:se.fileAttachments.map(xe=>({...xe})),skills:se.skills.map(xe=>({...xe}))};pe.hydrateDraft(Be),tt(_)}async function js(_){Ut.value&&await Ce();const U=dn.value;U>=0&&await $e(U),await Ne(_.text,_.imageUrls,_.skills,"steer",_.fileAttachments)}function Wi(_){ye.value=_.trim()}async function Vi(_){const U=_.trim();if(!U)return;const se=$o(U),pe=await Gi(),Be=se?U:qi(pe,U);if(Be)try{const xe=await gu(Be,{createIfMissing:!se,label:se?"":U});xe&&(ye.value=xe,Ie(ws(xe)),Us(),hs())}catch{}}async function zi(){var U;if(typeof window>"u")return;const _=((U=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:U.trim())??"";if(_)try{const se=await gu(_,{createIfMissing:!1,label:""});if(!se)return;ye.value=se,Ie(ws(se)),await M.replace({name:"home"}),await Us();const pe=new URL(window.location.href);pe.searchParams.delete("openProjectPath"),window.history.replaceState({},"",pe.toString())}catch{}}async function Gi(){const _=zr();if(_)return _;try{const U=await mu();if(U)return pt.value=U,U}catch{}return""}function $o(_){return _?_.startsWith("~/")||_.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(_):!1}async function hs(){const _=zr();if(!_){Lt.value="New Project (1)";return}try{const U=await lk(_);Lt.value=U.name||"New Project (1)"}catch{Lt.value="New Project (1)"}}function zr(){var se,pe;const _=ye.value.trim();if(_)return uu(_);const U=((pe=(se=tn.value[0])==null?void 0:se.value)==null?void 0:pe.trim())??"";return U?uu(U):pt.value.trim()}async function Oo(){try{pt.value=await mu()}catch{pt.value=""}}async function Us(){try{const _=await Qa();We.value={order:[..._.order],labels:{..._.labels}}}catch{We.value={order:[],labels:{}}}}async function Fs(){W.value=!0;try{G.value=await pk(q.value,6)}catch{G.value=[]}finally{W.value=!1}}function qi(_,U){const se=_.trim().replace(/\/+$/,""),pe=U.trim().replace(/^\/+/,"");return!se||!pe?"":`${se}/${pe}`}function No(_){Qe(_)}function Do(_){ct(_)}function Lo(_){Ze(_)}function Bs(){Ce()}function lr(_){var se;const U=((se=_.prependText)==null?void 0:se.trim())??"";U.length>0&&(Mt+=1,zt.value={id:Mt,text:U}),$e(_.turnIndex)}function Ki(){if($t.value||En.value||typeof document>"u"||!a.value||qt.value.length===0)return;const _=Ji(),U=Yi(),se=new Blob([_],{type:"text/markdown;charset=utf-8"}),pe=URL.createObjectURL(se),Be=document.createElement("a");Be.href=pe,Be.download=U,document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),window.setTimeout(()=>URL.revokeObjectURL(pe),0)}function Ji(){var se,pe,Be;const _=[],U=((pe=(se=a.value)==null?void 0:se.title)==null?void 0:pe.trim())||"Untitled thread";_.push(`# ${Xi(U)}`),_.push(""),_.push(`- Exported: ${new Date().toISOString()}`),_.push(`- Thread ID: ${((Be=a.value)==null?void 0:Be.id)??""}`),_.push(""),_.push("---"),_.push("");for(const xe of qt.value){const Nt=xe.role?xe.role.toUpperCase():"MESSAGE";_.push(`## ${Nt}`),_.push("");const qr=xe.text.trim();if(qr&&(_.push(qr),_.push("")),xe.commandExecution&&(_.push("```text"),_.push(`command: ${xe.commandExecution.command}`),_.push(`status: ${xe.commandExecution.status}`),xe.commandExecution.cwd&&_.push(`cwd: ${xe.commandExecution.cwd}`),xe.commandExecution.exitCode!==null&&_.push(`exitCode: ${xe.commandExecution.exitCode}`),_.push(xe.commandExecution.aggregatedOutput||"(no output)"),_.push("```"),_.push("")),xe.fileAttachments&&xe.fileAttachments.length>0){_.push("Attachments:");for(const Kr of xe.fileAttachments)_.push(`- ${Kr.path}`);_.push("")}if(xe.images&&xe.images.length>0){_.push("Images:");for(const Kr of xe.images)_.push(`- ${Kr}`);_.push("")}}return`${_.join(`
1428
- `).trimEnd()}
1429
- `}function Yi(){var Be,xe;const se=(((xe=(Be=a.value)==null?void 0:Be.title)==null?void 0:xe.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",pe=new Date().toISOString().replace(/[:.]/g,"-");return`${se}-${pe}.md`}function Xi(_){return _.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Gr(_,U){if(typeof window>"u")return U;const se=window.localStorage.getItem(_);return se===null?U:se==="1"}function jo(){if(typeof window>"u")return"system";const _=window.localStorage.getItem(nd);return _==="light"||_==="dark"?_:"system"}function Qi(){return typeof window>"u"?"steer":window.localStorage.getItem(td)==="queue"?"queue":"steer"}function d(){mt.value=!mt.value,window.localStorage.setItem(ed,mt.value?"1":"0")}function p(){Vt.value=Vt.value==="steer"?"queue":"steer",window.localStorage.setItem(td,Vt.value)}function g(){const _=["system","light","dark"],U=_.indexOf(nt.value);nt.value=_[(U+1)%_.length],window.localStorage.setItem(nd,nt.value),nn()}function x(){bn.value=!bn.value,window.localStorage.setItem(rd,bn.value?"1":"0")}function Z(){un.value=!un.value,window.localStorage.setItem(sd,un.value?"1":"0")}function re(){en.value=!en.value,window.localStorage.setItem(id,en.value?"1":"0")}function he(){jt.value=!jt.value,window.localStorage.setItem(ad,jt.value?"1":"0")}function Ee(_){const se=it(_.trim())||"auto";kt.value=se,window.localStorage.setItem(od,se)}function ge(){var se;if(typeof window>"u")return"auto";const _=((se=window.localStorage.getItem(od))==null?void 0:se.trim())||"auto";return it(_)||"auto"}function ot(){const _=[{value:"auto",label:"Auto-detect"}],U=new Set(["auto"]);function se(Be){const xe=s[Be]||Be;return`${xe.charAt(0).toUpperCase()+xe.slice(1)} (${Be})`}for(const Be of typeof navigator<"u"?navigator.languages??[]:[]){const xe=it(Be);!xe||U.has(xe)||(U.add(xe),_.push({value:xe,label:`Preferred: ${se(xe)}`}))}for(const Be of Object.keys(s))U.has(Be)||(U.add(Be),_.push({value:Be,label:se(Be)}));const pe=kt.value.trim();return pe&&!U.has(pe)&&_.push({value:pe,label:se(pe)}),_}function it(_){const U=_.trim().toLowerCase();if(!U||U==="auto")return"";if(U in s)return U;const se=U.split("-")[0]??U;return se in s?se:""}function nn(){const _=document.documentElement;if(nt.value==="dark")_.classList.add("dark");else if(nt.value==="light")_.classList.remove("dark");else{const U=window.matchMedia("(prefers-color-scheme: dark)").matches;_.classList.toggle("dark",U)}}function An(){return typeof window>"u"?!1:window.localStorage.getItem(Zu)==="1"}function Kn(_){typeof window>"u"||window.localStorage.setItem(Zu,_?"1":"0")}function Hs(_,U){const se=(_??"").trim();return se.length>0?se:U.trim()||"message"}async function Uo(){await we(),ve.value=!0,await Ws(),Te()}async function Ws(){if(!me.value){me.value=!0;try{if(T.name==="home"||T.name==="skills"){f.value!==""&&await ue("");return}if(T.name==="thread"){const _=Gt.value;if(!_)return;if(!In.value.has(_)){await M.replace({name:"home"});return}f.value!==_&&await ue(_);return}}finally{me.value=!1}}}at(()=>[T.name,Gt.value,B.value,In.value.has(Gt.value),f.value],async()=>{ve.value&&await Ws()}),at(()=>f.value,async _=>{if(ve.value&&!me.value&&!($t.value||En.value)){if(!_){T.name!=="home"&&await M.replace({name:"home"});return}T.name==="thread"&&Gt.value===_||await M.replace({name:"thread",params:{threadId:_}})}}),at(()=>q.value,()=>{jt.value&&Fs()}),at(()=>jt.value,_=>{if(!_){G.value=[];return}Fs()}),at(()=>tn.value,_=>{if(_.length===0){ye.value="";return}_.some(se=>se.value===ye.value)||(ye.value=_[0].value),hs()},{immediate:!0}),at(()=>ye.value,()=>{Fe.value={phase:"idle",title:"",message:""},hs()}),at(()=>Re.value,_=>{var U;if(_==="local"){Fe.value={phase:"idle",title:"",message:""};const se=ye.value.trim();if(se&&C(se)){const pe=((U=a.value)==null?void 0:U.projectName)??ws(se),Be=j(pe,"");Be&&(ye.value=Be)}}}),at(()=>T.name,_=>{_!=="home"&&(Fe.value={phase:"idle",title:"",message:""})}),at(()=>f.value,()=>{Fe.value={phase:"idle",title:"",message:""}}),at(Le,_=>{typeof document>"u"||(document.title=_)},{immediate:!0}),at(()=>en.value,_=>{wt(_)},{immediate:!0}),at(Y,_=>{_&&!Me.value&&je(!0)});async function Fo(_,U=[],se=[],pe=[]){try{Fe.value={phase:"idle",title:"",message:""};let Be=ye.value;if(Re.value==="worktree"){Fe.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Nt=await sk(ye.value);Be=Nt.cwd,ye.value=Nt.cwd,Fe.value={phase:"idle",title:"",message:""}}catch{Fe.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const xe=await Ue(_,Be,U,se,pe);if(!xe)return;await M.replace({name:"thread",params:{threadId:xe}})}catch{}}return(_,U)=>(v(),dt(Cv,{"is-sidebar-collapsed":Me.value,onCloseSidebar:U[6]||(U[6]=se=>je(!0))},{sidebar:bt(()=>[h("section",c1,[h("div",u1,[Me.value?le("",!0):(v(),dt(Ku,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Me.value,"show-new-thread-button":!0,onToggleSidebar:U[0]||(U[0]=se=>je(!Me.value)),onStartNewThread:Xe},{default:bt(()=>[h("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":et.value,"aria-label":"Search threads",title:"Search threads",onClick:Cn},[Pe(Za,{class:"sidebar-search-toggle-icon"})],8,d1)]),_:1},8,["is-sidebar-collapsed"])),!Me.value&&et.value?(v(),E("div",f1,[Pe(Za,{class:"sidebar-search-bar-icon"}),Tr(h("input",{ref_key:"sidebarSearchInputRef",ref:xt,"onUpdate:modelValue":U[1]||(U[1]=se=>Ye.value=se),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:w},null,544),[[Sr,Ye.value]]),Ye.value.length>0?(v(),E("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:On},[Pe(Ol,{class:"sidebar-search-clear-icon"})])):le("",!0)])):le("",!0),Me.value?le("",!0):(v(),E("button",{key:2,class:st(["sidebar-skills-link",{"is-active":En.value}]),type:"button",onClick:U[2]||(U[2]=se=>{_e(M).push({name:"skills"}),_e(Y)&&je(!0)})}," Skills Hub ",2)),Me.value?le("",!0):(v(),dt(_w,{key:3,groups:_e(o),"project-display-name-by-id":_e(i),"selected-thread-id":_e(f),"is-loading":_e(B),"search-query":Ye.value,"search-matched-thread-ids":ft.value,onSelect:I,onArchive:J,onStartNewThread:te,onRenameProject:ut,onBrowseThreadFiles:Ae,onRenameThread:Rt,onForkThread:y,onRemoveProject:k,onReorderProject:$,onExportThread:A},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),Me.value?le("",!0):(v(),E("div",h1,[Pe(Sf,{name:"settings-panel"},{default:bt(()=>[Pt.value?(v(),E("div",p1,[h("button",{class:"sidebar-settings-row",type:"button",title:r.sendWithEnter,onClick:d},[U[7]||(U[7]=h("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":!mt.value}])},null,2)],8,m1),h("button",{class:"sidebar-settings-row",type:"button",title:r.inProgressSendMode,onClick:p},[U[8]||(U[8]=h("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),h("span",v1,ae(Vt.value==="steer"?"Steer":"Queue"),1)],8,g1),h("button",{class:"sidebar-settings-row",type:"button",title:r.appearance,onClick:g},[U[9]||(U[9]=h("span",{class:"sidebar-settings-label"},"Appearance",-1)),h("span",w1,ae(nt.value==="system"?"System":nt.value==="dark"?"Dark":"Light"),1)],8,y1),h("button",{class:"sidebar-settings-row",type:"button",title:r.dictationClickToToggle,onClick:x},[U[10]||(U[10]=h("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":bn.value}])},null,2)],8,b1),h("button",{class:"sidebar-settings-row",type:"button",title:r.dictationAutoSend,onClick:Z},[U[11]||(U[11]=h("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":un.value}])},null,2)],8,_1),h("button",{class:"sidebar-settings-row",type:"button",title:r.rollbackCommits,onClick:re},[U[12]||(U[12]=h("span",{class:"sidebar-settings-label"},"Rollback commits",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":en.value}])},null,2)],8,k1),h("button",{class:"sidebar-settings-row",type:"button",title:r.githubTrendingProjects,onClick:he},[U[13]||(U[13]=h("span",{class:"sidebar-settings-label"},"GitHub trending projects",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":jt.value}])},null,2)],8,T1),h("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:r.dictationLanguage},[U[14]||(U[14]=h("span",{class:"sidebar-settings-label"},"Dictation language",-1)),Pe(oo,{class:"sidebar-settings-language-dropdown","model-value":kt.value,options:It.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":Ee},null,8,["model-value","options"])],8,S1),h("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:hn},[U[15]||(U[15]=h("span",{class:"sidebar-settings-label"},"Telegram",-1)),h("span",I1,ae(Mn.value),1)]),h("div",E1,[Pe(wT,{snapshots:_e(R)},null,8,["snapshots"])]),h("div",C1," WT "+ae(_e(t))+" · v"+ae(_e(n)),1)])):le("",!0)]),_:1}),h("button",{class:"sidebar-settings-button",type:"button",onClick:U[3]||(U[3]=se=>Pt.value=!Pt.value)},[Pe(DA,{class:"sidebar-settings-icon"}),U[16]||(U[16]=h("span",null,"Settings",-1))])]))])]),content:bt(()=>[h("section",A1,[Pe(Cw,{title:Yt.value},{leading:bt(()=>[Me.value||_e(Y)?(v(),dt(Ku,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Me.value,"show-new-thread-button":!0,onToggleSidebar:U[4]||(U[4]=se=>je(!Me.value)),onStartNewThread:Xe},null,8,["is-sidebar-collapsed"])):le("",!0)]),_:1},8,["title"]),h("section",x1,[En.value?(v(),dt(_A,{key:0,onSkillsChanged:$n})):$t.value?(v(),E("div",R1,[h("div",P1,[U[19]||(U[19]=h("p",{class:"new-thread-hero"},"Let's build",-1)),Pe(oo,{class:"new-thread-folder-dropdown","model-value":ye.value,options:tn.value,placeholder:"Choose folder","enable-search":!0,"search-placeholder":"Quick search project","show-add-action":!0,"add-action-label":"+ Add new project","default-add-value":Lt.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Wi,onAdd:Vi},null,8,["model-value","options","default-add-value"]),Pe(CT,{class:"new-thread-runtime-dropdown",modelValue:Re.value,"onUpdate:modelValue":U[5]||(U[5]=se=>Re.value=se)},null,8,["modelValue"]),Fe.value.phase!=="idle"?(v(),E("div",{key:0,class:st(["worktree-init-status",{"is-running":Fe.value.phase==="running","is-error":Fe.value.phase==="error"}])},[h("strong",M1,ae(Fe.value.title),1),h("span",$1,ae(Fe.value.message),1)],2)):le("",!0),jt.value?(v(),E("div",O1,[h("div",N1,[U[17]||(U[17]=h("p",{class:"new-thread-trending-title"},"Trending GitHub projects",-1)),Pe(oo,{class:"new-thread-trending-scope-dropdown","model-value":q.value,options:Un.value,"onUpdate:modelValue":fs},null,8,["model-value","options"])]),W.value?(v(),E("p",D1,"Loading trending projects...")):G.value.length===0?(v(),E("p",L1," Trending repos are unavailable right now. ")):(v(),E("div",j1,[(v(!0),E(Ve,null,_t(G.value,se=>(v(),E("button",{key:se.id,type:"button",class:"new-thread-trending-tip",onClick:pe=>Nn(se)},[h("span",{class:"new-thread-trending-tip-name",title:se.fullName},[se.owner&&se.repo?(v(),E(Ve,{key:0},[h("span",B1,ae(se.owner),1),U[18]||(U[18]=h("span",{class:"new-thread-trending-tip-name-slash"},"/",-1)),h("span",H1,ae(se.repo),1)],64)):(v(),E("span",W1,ae(se.fullName),1))],8,F1),h("span",V1,ae(ds(se)),1),h("span",z1,ae(se.description||"No description available."),1)],8,U1))),128))]))])):le("",!0)]),Pe(wu,{ref_key:"homeThreadComposerRef",ref:ee,"active-thread-id":_n.value,cwd:Kt.value,models:_e(m),"selected-model":_e(S),"selected-reasoning-effort":_e(L),"selected-speed-mode":_e(O),"is-updating-speed-mode":_e(oe),skills:_e(V),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":mt.value,"in-progress-submit-mode":Vt.value,"dictation-click-to-toggle":bn.value,"dictation-auto-send":un.value,"prepend-draft-request":zt.value,"dictation-language":kt.value,onSubmit:Tn,"onUpdate:selectedModel":No,"onUpdate:selectedReasoningEffort":Do,"onUpdate:selectedSpeedMode":Lo},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])):(v(),E("div",G1,[h("div",q1,[Pe(h_,{messages:qt.value,"is-loading":_e(F),"active-thread-id":_n.value,cwd:Kt.value,"scroll-state":_e(l),"live-overlay":Pn.value,"pending-requests":_e(u),"is-turn-in-progress":Ut.value,"is-rolling-back":_e(De),onUpdateScrollState:D,onRespondServerRequest:Q,onRollback:lr},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),h("div",K1,[Pe(uT,{messages:_e(ze),onEdit:Vr,onSteer:_e(Oe),onDelete:_e(tt)},null,8,["messages","onSteer","onDelete"]),Pe(wu,{ref_key:"threadComposerRef",ref:H,"active-thread-id":_n.value,cwd:Kt.value,models:_e(m),"selected-model":_e(S),"selected-reasoning-effort":_e(L),"selected-speed-mode":_e(O),"is-updating-speed-mode":_e(oe),skills:_e(V),"is-turn-in-progress":Ut.value,"is-interrupting-turn":_e(ne),"has-queue-above":_e(ze).length>0,"send-with-enter":mt.value,"in-progress-submit-mode":Vt.value,"dictation-click-to-toggle":bn.value,"dictation-auto-send":un.value,"prepend-draft-request":zt.value,"dictation-language":kt.value,onSubmit:Tn,"onUpdate:selectedModel":No,"onUpdate:selectedReasoningEffort":Do,"onUpdate:selectedSpeedMode":Lo,onInterrupt:Bs},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]))}}),Y1=lt(J1,[["__scopeId","data-v-88ff0cc2"]]),$a={render:()=>null},X1=wv({history:Xg(),routes:[{path:"/",name:"home",component:$a},{path:"/thread/:threadId",name:"thread",component:$a},{path:"/skills",name:"skills",component:$a},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");ug(Y1).use(X1).mount("#app");