@nervmor/codexui 1.0.4 → 1.0.5

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,1443 +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.30
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/function yl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Nt={},Bs=[],Sr=()=>{},dd=()=>!1,Ri=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),wl=e=>e.startsWith("onUpdate:"),rn=Object.assign,bl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Jh=Object.prototype.hasOwnProperty,Pt=(e,t)=>Jh.call(e,t),Xe=Array.isArray,Us=e=>jo(e)==="[object Map]",fd=e=>jo(e)==="[object Set]",rc=e=>jo(e)==="[object Date]",rt=e=>typeof e=="function",Vt=e=>typeof e=="string",lr=e=>typeof e=="symbol",Mt=e=>e!==null&&typeof e=="object",hd=e=>(Mt(e)||rt(e))&&rt(e.then)&&rt(e.catch),pd=Object.prototype.toString,jo=e=>pd.call(e),Yh=e=>jo(e).slice(8,-1),md=e=>jo(e)==="[object Object]",_l=e=>Vt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ho=yl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Pi=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Qh=/-\w/g,Mn=Pi(e=>e.replace(Qh,t=>t.slice(1).toUpperCase())),Xh=/\B([A-Z])/g,us=Pi(e=>e.replace(Xh,"-$1").toLowerCase()),Mi=Pi(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zi=Pi(e=>e?`on${Mi(e)}`:""),br=(e,t)=>!Object.is(e,t),oi=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},gd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},kl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Zh=e=>{const t=Vt(e)?Number(e):NaN;return isNaN(t)?e:t};let sc;const $i=()=>sc||(sc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function is(e){if(Xe(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Vt(r)?rp(r):is(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Vt(e)||Mt(e))return e}const ep=/;(?![^(]*\))/g,tp=/:([^]+)/,np=/\/\*[^]*?\*\//g;function rp(e){const t={};return e.replace(np,"").split(ep).forEach(n=>{if(n){const r=n.split(tp);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function nt(e){let t="";if(Vt(e))t=e;else if(Xe(e))for(let n=0;n<e.length;n++){const r=nt(e[n]);r&&(t+=r+" ")}else if(Mt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const sp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",op=yl(sp);function vd(e){return!!e||e===""}function ip(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Tl(e[r],t[r]);return n}function Tl(e,t){if(e===t)return!0;let n=rc(e),r=rc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=lr(e),r=lr(t),n||r)return e===t;if(n=Xe(e),r=Xe(t),n||r)return n&&r?ip(e,t):!1;if(n=Mt(e),r=Mt(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||!Tl(e[i],t[i]))return!1}}return String(e)===String(t)}const yd=e=>!!(e&&e.__v_isRef===!0),K=e=>Vt(e)?e:e==null?"":Xe(e)||Mt(e)&&(e.toString===pd||!rt(e.toString))?yd(e)?K(e.value):JSON.stringify(e,wd,2):String(e),wd=(e,t)=>yd(t)?wd(e,t.value):Us(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ea(r,o)+" =>"]=s,n),{})}:fd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ea(n))}:lr(t)?ea(t):Mt(t)&&!Xe(t)&&!md(t)?String(t):t,ea=(e,t="")=>{var n;return lr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
6
- * @vue/reactivity v3.5.30
7
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
- * @license MIT
9
- **/let Fn;class ap{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=Fn,!t&&Fn&&(this.index=(Fn.scopes||(Fn.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=Fn;try{return Fn=this,t()}finally{Fn=n}}}on(){++this._on===1&&(this.prevScope=Fn,Fn=this)}off(){this._on>0&&--this._on===0&&(Fn=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 lp(){return Fn}let Ft;const ta=new WeakSet;class bd{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,Fn&&Fn.active&&Fn.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||kd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,oc(this),Td(this);const t=Ft,n=or;Ft=this,or=!0;try{return this.fn()}finally{Sd(this),Ft=t,or=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)El(t);this.deps=this.depsTail=void 0,oc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ta.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Da(this)&&this.run()}get dirty(){return Da(this)}}let _d=0,po,mo;function kd(e,t=!1){if(e.flags|=8,t){e.next=mo,mo=e;return}e.next=po,po=e}function Sl(){_d++}function Il(){if(--_d>0)return;if(mo){let t=mo;for(mo=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;po;){let t=po;for(po=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 Td(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Sd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),El(r),cp(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Da(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Id(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Id(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===So)||(e.globalVersion=So,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Da(e))))return;e.flags|=2;const t=e.dep,n=Ft,r=or;Ft=e,or=!0;try{Td(e);const s=e.fn(e._value);(t.version===0||br(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ft=n,or=r,Sd(e),e.flags&=-3}}function El(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)El(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function cp(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let or=!0;const Ed=[];function Fr(){Ed.push(or),or=!1}function Br(){const e=Ed.pop();or=e===void 0?!0:e}function oc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ft;Ft=void 0;try{t()}finally{Ft=n}}}let So=0;class up{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 Cl{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(!Ft||!or||Ft===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ft)n=this.activeLink=new up(Ft,this),Ft.deps?(n.prevDep=Ft.depsTail,Ft.depsTail.nextDep=n,Ft.depsTail=n):Ft.deps=Ft.depsTail=n,Cd(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=Ft.depsTail,n.nextDep=void 0,Ft.depsTail.nextDep=n,Ft.depsTail=n,Ft.deps===n&&(Ft.deps=r)}return n}trigger(t){this.version++,So++,this.notify(t)}notify(t){Sl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Il()}}}function Cd(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)Cd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ja=new WeakMap,Cs=Symbol(""),Fa=Symbol(""),Io=Symbol("");function gn(e,t,n){if(or&&Ft){let r=ja.get(e);r||ja.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Cl),s.map=r,s.key=n),s.track()}}function Or(e,t,n,r,s,o){const i=ja.get(e);if(!i){So++;return}const a=l=>{l&&l.trigger()};if(Sl(),t==="clear")i.forEach(a);else{const l=Xe(e),d=l&&_l(n);if(l&&n==="length"){const c=Number(r);i.forEach((m,b)=>{(b==="length"||b===Io||!lr(b)&&b>=c)&&a(m)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),d&&a(i.get(Io)),t){case"add":l?d&&a(i.get("length")):(a(i.get(Cs)),Us(e)&&a(i.get(Fa)));break;case"delete":l||(a(i.get(Cs)),Us(e)&&a(i.get(Fa)));break;case"set":Us(e)&&a(i.get(Cs));break}}Il()}function $s(e){const t=It(e);return t===e?t:(gn(t,"iterate",Io),Qn(e)?t:t.map(cr))}function Oi(e){return gn(e=It(e),"iterate",Io),e}function yr(e,t){return Ur(e)?Js(As(e)?cr(t):t):cr(t)}const dp={__proto__:null,[Symbol.iterator](){return na(this,Symbol.iterator,e=>yr(this,e))},concat(...e){return $s(this).concat(...e.map(t=>Xe(t)?$s(t):t))},entries(){return na(this,"entries",e=>(e[1]=yr(this,e[1]),e))},every(e,t){return xr(this,"every",e,t,void 0,arguments)},filter(e,t){return xr(this,"filter",e,t,n=>n.map(r=>yr(this,r)),arguments)},find(e,t){return xr(this,"find",e,t,n=>yr(this,n),arguments)},findIndex(e,t){return xr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return xr(this,"findLast",e,t,n=>yr(this,n),arguments)},findLastIndex(e,t){return xr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return xr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ra(this,"includes",e)},indexOf(...e){return ra(this,"indexOf",e)},join(e){return $s(this).join(e)},lastIndexOf(...e){return ra(this,"lastIndexOf",e)},map(e,t){return xr(this,"map",e,t,void 0,arguments)},pop(){return oo(this,"pop")},push(...e){return oo(this,"push",e)},reduce(e,...t){return ic(this,"reduce",e,t)},reduceRight(e,...t){return ic(this,"reduceRight",e,t)},shift(){return oo(this,"shift")},some(e,t){return xr(this,"some",e,t,void 0,arguments)},splice(...e){return oo(this,"splice",e)},toReversed(){return $s(this).toReversed()},toSorted(e){return $s(this).toSorted(e)},toSpliced(...e){return $s(this).toSpliced(...e)},unshift(...e){return oo(this,"unshift",e)},values(){return na(this,"values",e=>yr(this,e))}};function na(e,t,n){const r=Oi(e),s=r[t]();return r!==e&&!Qn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const fp=Array.prototype;function xr(e,t,n,r,s,o){const i=Oi(e),a=i!==e&&!Qn(e),l=i[t];if(l!==fp[t]){const m=l.apply(e,o);return a?cr(m):m}let d=n;i!==e&&(a?d=function(m,b){return n.call(this,yr(e,m),b,e)}:n.length>2&&(d=function(m,b){return n.call(this,m,b,e)}));const c=l.call(i,d,r);return a&&s?s(c):c}function ic(e,t,n,r){const s=Oi(e),o=s!==e&&!Qn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(d,c,m){return a&&(a=!1,d=yr(e,d)),n.call(this,d,yr(e,c),m,e)}):n.length>3&&(i=function(d,c,m){return n.call(this,d,c,m,e)}));const l=s[t](i,...r);return a?yr(e,l):l}function ra(e,t,n){const r=It(e);gn(r,"iterate",Io);const s=r[t](...n);return(s===-1||s===!1)&&Rl(n[0])?(n[0]=It(n[0]),r[t](...n)):s}function oo(e,t,n=[]){Fr(),Sl();const r=It(e)[t].apply(e,n);return Il(),Br(),r}const hp=yl("__proto__,__v_isRef,__isVue"),Ad=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(lr));function pp(e){lr(e)||(e=String(e));const t=It(this);return gn(t,"has",e),t.hasOwnProperty(e)}class xd{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?Sp:$d:o?Md:Pd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Xe(t);if(!s){let l;if(i&&(l=dp[n]))return l;if(n==="hasOwnProperty")return pp}const a=Reflect.get(t,n,wn(t)?t:r);if((lr(n)?Ad.has(n):hp(n))||(s||gn(t,"get",n),o))return a;if(wn(a)){const l=i&&_l(n)?a:a.value;return s&&Mt(l)?Ua(l):l}return Mt(a)?s?Ua(a):Ni(a):a}}class Rd extends xd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Xe(t)&&_l(n);if(!this._isShallow){const d=Ur(o);if(!Qn(r)&&!Ur(r)&&(o=It(o),r=It(r)),!i&&wn(o)&&!wn(r))return d||(o.value=r),!0}const a=i?Number(n)<t.length:Pt(t,n),l=Reflect.set(t,n,r,wn(t)?t:s);return t===It(s)&&(a?br(r,o)&&Or(t,"set",n,r):Or(t,"add",n,r)),l}deleteProperty(t,n){const r=Pt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Or(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!lr(n)||!Ad.has(n))&&gn(t,"has",n),r}ownKeys(t){return gn(t,"iterate",Xe(t)?"length":Cs),Reflect.ownKeys(t)}}class mp extends xd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const gp=new Rd,vp=new mp,yp=new Rd(!0);const Ba=e=>e,Yo=e=>Reflect.getPrototypeOf(e);function wp(e,t,n){return function(...r){const s=this.__v_raw,o=It(s),i=Us(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,d=s[e](...r),c=n?Ba:t?Js:cr;return!t&&gn(o,"iterate",l?Fa:Cs),rn(Object.create(d),{next(){const{value:m,done:b}=d.next();return b?{value:m,done:b}:{value:a?[c(m[0]),c(m[1])]:c(m),done:b}}})}}function Qo(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function bp(e,t){const n={get(s){const o=this.__v_raw,i=It(o),a=It(s);e||(br(s,a)&&gn(i,"get",s),gn(i,"get",a));const{has:l}=Yo(i),d=t?Ba:e?Js:cr;if(l.call(i,s))return d(o.get(s));if(l.call(i,a))return d(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&gn(It(s),"iterate",Cs),s.size},has(s){const o=this.__v_raw,i=It(o),a=It(s);return e||(br(s,a)&&gn(i,"has",s),gn(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=It(a),d=t?Ba:e?Js:cr;return!e&&gn(l,"iterate",Cs),a.forEach((c,m)=>s.call(o,d(c),d(m),i))}};return rn(n,e?{add:Qo("add"),set:Qo("set"),delete:Qo("delete"),clear:Qo("clear")}:{add(s){const o=It(this),i=Yo(o),a=It(s),l=!t&&!Qn(s)&&!Ur(s)?a:s;return i.has.call(o,l)||br(s,l)&&i.has.call(o,s)||br(a,l)&&i.has.call(o,a)||(o.add(l),Or(o,"add",l,l)),this},set(s,o){!t&&!Qn(o)&&!Ur(o)&&(o=It(o));const i=It(this),{has:a,get:l}=Yo(i);let d=a.call(i,s);d||(s=It(s),d=a.call(i,s));const c=l.call(i,s);return i.set(s,o),d?br(o,c)&&Or(i,"set",s,o):Or(i,"add",s,o),this},delete(s){const o=It(this),{has:i,get:a}=Yo(o);let l=i.call(o,s);l||(s=It(s),l=i.call(o,s)),a&&a.call(o,s);const d=o.delete(s);return l&&Or(o,"delete",s,void 0),d},clear(){const s=It(this),o=s.size!==0,i=s.clear();return o&&Or(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=wp(s,e,t)}),n}function Al(e,t){const n=bp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(Pt(n,s)&&s in r?n:r,s,o)}const _p={get:Al(!1,!1)},kp={get:Al(!1,!0)},Tp={get:Al(!0,!1)};const Pd=new WeakMap,Md=new WeakMap,$d=new WeakMap,Sp=new WeakMap;function Ip(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ep(e){return e.__v_skip||!Object.isExtensible(e)?0:Ip(Yh(e))}function Ni(e){return Ur(e)?e:xl(e,!1,gp,_p,Pd)}function Od(e){return xl(e,!1,yp,kp,Md)}function Ua(e){return xl(e,!0,vp,Tp,$d)}function xl(e,t,n,r,s){if(!Mt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Ep(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 Ur(e)?As(e.__v_raw):!!(e&&e.__v_isReactive)}function Ur(e){return!!(e&&e.__v_isReadonly)}function Qn(e){return!!(e&&e.__v_isShallow)}function Rl(e){return e?!!e.__v_raw:!1}function It(e){const t=e&&e.__v_raw;return t?It(t):e}function Cp(e){return!Pt(e,"__v_skip")&&Object.isExtensible(e)&&gd(e,"__v_skip",!0),e}const cr=e=>Mt(e)?Ni(e):e,Js=e=>Mt(e)?Ua(e):e;function wn(e){return e?e.__v_isRef===!0:!1}function D(e){return Nd(e,!1)}function Ap(e){return Nd(e,!0)}function Nd(e,t){return wn(e)?e:new xp(e,t)}class xp{constructor(t,n){this.dep=new Cl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:It(t),this._value=n?t:cr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Qn(t)||Ur(t);t=r?t:It(t),br(t,n)&&(this._rawValue=t,this._value=r?t:cr(t),this.dep.trigger())}}function _e(e){return wn(e)?e.value:e}const Rp={get:(e,t,n)=>t==="__v_raw"?e:_e(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return wn(s)&&!wn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Ld(e){return As(e)?e:new Proxy(e,Rp)}class Pp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Cl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=So-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ft!==this)return kd(this,!0),!0}get value(){const t=this.dep.track();return Id(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Mp(e,t,n=!1){let r,s;return rt(e)?r=e:(r=e.get,s=e.set),new Pp(r,s,n)}const Xo={},mi=new WeakMap;let _s;function $p(e,t=!1,n=_s){if(n){let r=mi.get(n);r||mi.set(n,r=[]),r.push(e)}}function Op(e,t,n=Nt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,d=ne=>s?ne:Qn(ne)||s===!1||s===0?Nr(ne,1):Nr(ne);let c,m,b,I,j=!1,$=!1;if(wn(e)?(m=()=>e.value,j=Qn(e)):As(e)?(m=()=>d(e),j=!0):Xe(e)?($=!0,j=e.some(ne=>As(ne)||Qn(ne)),m=()=>e.map(ne=>{if(wn(ne))return ne.value;if(As(ne))return d(ne);if(rt(ne))return l?l(ne,2):ne()})):rt(e)?t?m=l?()=>l(e,2):e:m=()=>{if(b){Fr();try{b()}finally{Br()}}const ne=_s;_s=c;try{return l?l(e,3,[I]):e(I)}finally{_s=ne}}:m=Sr,t&&s){const ne=m,ke=s===!0?1/0:s;m=()=>Nr(ne(),ke)}const X=lp(),ae=()=>{c.stop(),X&&X.active&&bl(X.effects,c)};if(o&&t){const ne=t;t=(...ke)=>{ne(...ke),ae()}}let z=$?new Array(e.length).fill(Xo):Xo;const J=ne=>{if(!(!(c.flags&1)||!c.dirty&&!ne))if(t){const ke=c.run();if(s||j||($?ke.some((me,ge)=>br(me,z[ge])):br(ke,z))){b&&b();const me=_s;_s=c;try{const ge=[ke,z===Xo?void 0:$&&z[0]===Xo?[]:z,I];z=ke,l?l(t,3,ge):t(...ge)}finally{_s=me}}}else c.run()};return a&&a(J),c=new bd(m),c.scheduler=i?()=>i(J,!1):J,I=ne=>$p(ne,!1,c),b=c.onStop=()=>{const ne=mi.get(c);if(ne){if(l)l(ne,4);else for(const ke of ne)ke();mi.delete(c)}},t?r?J(!0):z=c.run():i?i(J.bind(null,!0),!0):c.run(),ae.pause=c.pause.bind(c),ae.resume=c.resume.bind(c),ae.stop=ae,ae}function Nr(e,t=1/0,n){if(t<=0||!Mt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,wn(e))Nr(e.value,t,n);else if(Xe(e))for(let r=0;r<e.length;r++)Nr(e[r],t,n);else if(fd(e)||Us(e))e.forEach(r=>{Nr(r,t,n)});else if(md(e)){for(const r in e)Nr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Nr(e[r],t,n)}return e}/**
10
- * @vue/runtime-core v3.5.30
11
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
- * @license MIT
13
- **/function Fo(e,t,n,r){try{return r?e(...r):e()}catch(s){Li(s,t,n)}}function ur(e,t,n,r){if(rt(e)){const s=Fo(e,t,n,r);return s&&hd(s)&&s.catch(o=>{Li(o,t,n)}),s}if(Xe(e)){const s=[];for(let o=0;o<e.length;o++)s.push(ur(e[o],t,n,r));return s}}function Li(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Nt;if(t){let a=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let m=0;m<c.length;m++)if(c[m](e,l,d)===!1)return}a=a.parent}if(o){Fr(),Fo(o,null,10,[e,l,d]),Br();return}}Np(e,n,s,r,i)}function Np(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const Rn=[];let gr=-1;const Hs=[];let es=null,Ds=0;const Dd=Promise.resolve();let gi=null;function nn(e){const t=gi||Dd;return e?t.then(this?e.bind(this):e):t}function Lp(e){let t=gr+1,n=Rn.length;for(;t<n;){const r=t+n>>>1,s=Rn[r],o=Eo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Pl(e){if(!(e.flags&1)){const t=Eo(e),n=Rn[Rn.length-1];!n||!(e.flags&2)&&t>=Eo(n)?Rn.push(e):Rn.splice(Lp(t),0,e),e.flags|=1,jd()}}function jd(){gi||(gi=Dd.then(Bd))}function Dp(e){Xe(e)?Hs.push(...e):es&&e.id===-1?es.splice(Ds+1,0,e):e.flags&1||(Hs.push(e),e.flags|=1),jd()}function ac(e,t,n=gr+1){for(;n<Rn.length;n++){const r=Rn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Rn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Fd(e){if(Hs.length){const t=[...new Set(Hs)].sort((n,r)=>Eo(n)-Eo(r));if(Hs.length=0,es){es.push(...t);return}for(es=t,Ds=0;Ds<es.length;Ds++){const n=es[Ds];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}es=null,Ds=0}}const Eo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Bd(e){try{for(gr=0;gr<Rn.length;gr++){const t=Rn[gr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Fo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;gr<Rn.length;gr++){const t=Rn[gr];t&&(t.flags&=-2)}gr=-1,Rn.length=0,Fd(),gi=null,(Rn.length||Hs.length)&&Bd()}}let cn=null,Ud=null;function vi(e){const t=cn;return cn=e,Ud=e&&e.type.__scopeId||null,t}function xt(e,t=cn,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&_i(-1);const o=vi(t);let i;try{i=e(...s)}finally{vi(o),r._d&&_i(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Hr(e,t){if(cn===null)return e;const n=Hi(cn),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Nt]=t[s];o&&(rt(o)&&(o={mounted:o,updated:o}),o.deep&&Nr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function gs(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&&(Fr(),ur(l,n,8,[e.el,a,e,t]),Br())}}function ii(e,t){if(yn){let n=yn.provides;const r=yn.parent&&yn.parent.provides;r===n&&(n=yn.provides=Object.create(r)),n[e]=t}}function ir(e,t,n=!1){const r=Ll();if(r||Vs){let s=Vs?Vs._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&&rt(t)?t.call(r&&r.proxy):t}}const jp=Symbol.for("v-scx"),Fp=()=>ir(jp);function ht(e,t,n){return Hd(e,t,n)}function Hd(e,t,n=Nt){const{immediate:r,deep:s,flush:o,once:i}=n,a=rn({},n),l=t&&r||!t&&o!=="post";let d;if(Po){if(o==="sync"){const I=Fp();d=I.__watcherHandles||(I.__watcherHandles=[])}else if(!l){const I=()=>{};return I.stop=Sr,I.resume=Sr,I.pause=Sr,I}}const c=yn;a.call=(I,j,$)=>ur(I,c,j,$);let m=!1;o==="post"?a.scheduler=I=>{mn(I,c&&c.suspense)}:o!=="sync"&&(m=!0,a.scheduler=(I,j)=>{j?I():Pl(I)}),a.augmentJob=I=>{t&&(I.flags|=4),m&&(I.flags|=2,c&&(I.id=c.uid,I.i=c))};const b=Op(e,t,a);return Po&&(d?d.push(b):l&&b()),b}function Bp(e,t,n){const r=this.proxy,s=Vt(e)?e.includes(".")?Wd(r,e):()=>r[e]:e.bind(r,r);let o;rt(t)?o=t:(o=t.handler,n=t);const i=Bo(this),a=Hd(s,o.bind(r),n);return i(),a}function Wd(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 Vd=Symbol("_vte"),zd=e=>e.__isTeleport,go=e=>e&&(e.disabled||e.disabled===""),lc=e=>e&&(e.defer||e.defer===""),cc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,uc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ha=(e,t)=>{const n=e&&e.to;return Vt(n)?t?t(n):null:n},qd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,d){const{mc:c,pc:m,pbc:b,o:{insert:I,querySelector:j,createText:$,createComment:X}}=d,ae=go(t.props);let{shapeFlag:z,children:J,dynamicChildren:ne}=t;if(e==null){const ke=t.el=$(""),me=t.anchor=$("");I(ke,n,r),I(me,n,r);const ge=(le,re)=>{z&16&&c(J,le,re,s,o,i,a,l)},je=()=>{const le=t.target=Ha(t.props,j),re=Wa(le,t,$,I);le&&(i!=="svg"&&cc(le)?i="svg":i!=="mathml"&&uc(le)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(le),ae||(ge(le,re),ai(t,!1)))};ae&&(ge(n,me),ai(t,!0)),lc(t.props)?(t.el.__isMounted=!1,mn(()=>{je(),delete t.el.__isMounted},o)):je()}else{if(lc(t.props)&&e.el.__isMounted===!1){mn(()=>{qd.process(e,t,n,r,s,o,i,a,l,d)},o);return}t.el=e.el,t.targetStart=e.targetStart;const ke=t.anchor=e.anchor,me=t.target=e.target,ge=t.targetAnchor=e.targetAnchor,je=go(e.props),le=je?n:me,re=je?ke:ge;if(i==="svg"||cc(me)?i="svg":(i==="mathml"||uc(me))&&(i="mathml"),ne?(b(e.dynamicChildren,ne,le,s,o,i,a),Ol(e,t,!0)):l||m(e,t,le,re,s,o,i,a,!1),ae)je?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Zo(t,n,ke,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const de=t.target=Ha(t.props,j);de&&Zo(t,de,null,d,0)}else je&&Zo(t,me,ge,d,1);ai(t,ae)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:d,targetAnchor:c,target:m,props:b}=e;if(m&&(s(d),s(c)),o&&s(l),i&16){const I=o||!go(b);for(let j=0;j<a.length;j++){const $=a[j];r($,t,n,I,!!$.dynamicChildren)}}},move:Zo,hydrate:Up};function Zo(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:d,props:c}=e,m=o===2;if(m&&r(i,t,n),(!m||go(c))&&l&16)for(let b=0;b<d.length;b++)s(d[b],t,n,2);m&&r(a,t,n)}function Up(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:d,createText:c}},m){function b(X,ae){let z=ae;for(;z;){if(z&&z.nodeType===8){if(z.data==="teleport start anchor")t.targetStart=z;else if(z.data==="teleport anchor"){t.targetAnchor=z,X._lpa=t.targetAnchor&&i(t.targetAnchor);break}}z=i(z)}}function I(X,ae){ae.anchor=m(i(X),ae,a(X),n,r,s,o)}const j=t.target=Ha(t.props,l),$=go(t.props);if(j){const X=j._lpa||j.firstChild;t.shapeFlag&16&&($?(I(e,t),b(j,X),t.targetAnchor||Wa(j,t,c,d,a(e)===j?e:null)):(t.anchor=i(e),b(j,X),t.targetAnchor||Wa(j,t,c,d),m(X&&i(X),t,j,n,r,s,o))),ai(t,$)}else $&&t.shapeFlag&16&&(I(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const vo=qd;function ai(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 Wa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Vd]=i,e&&(r(o,e,s),r(i,e,s)),i}const vr=Symbol("_leaveCb"),io=Symbol("_enterCb");function Hp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Gr(()=>{e.isMounted=!0}),Kr(()=>{e.isUnmounting=!0}),e}const Jn=[Function,Array],Gd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Jn,onEnter:Jn,onAfterEnter:Jn,onEnterCancelled:Jn,onBeforeLeave:Jn,onLeave:Jn,onAfterLeave:Jn,onLeaveCancelled:Jn,onBeforeAppear:Jn,onAppear:Jn,onAfterAppear:Jn,onAppearCancelled:Jn},Kd=e=>{const t=e.subTree;return t.component?Kd(t.component):t},Wp={name:"BaseTransition",props:Gd,setup(e,{slots:t}){const n=Ll(),r=Hp();return()=>{const s=t.default&&Qd(t.default(),!0);if(!s||!s.length)return;const o=Jd(s),i=It(e),{mode:a}=i;if(r.isLeaving)return sa(o);const l=dc(o);if(!l)return sa(o);let d=Va(l,i,r,n,m=>d=m);l.type!==vn&&Co(l,d);let c=n.subTree&&dc(n.subTree);if(c&&c.type!==vn&&!Ts(c,l)&&Kd(n).type!==vn){let m=Va(c,i,r,n);if(Co(c,m),a==="out-in"&&l.type!==vn)return r.isLeaving=!0,m.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete m.afterLeave,c=void 0},sa(o);a==="in-out"&&l.type!==vn?m.delayLeave=(b,I,j)=>{const $=Yd(r,c);$[String(c.key)]=c,b[vr]=()=>{I(),b[vr]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{j(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Jd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==vn){t=n;break}}return t}const Vp=Wp;function Yd(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 Va(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:m,onBeforeLeave:b,onLeave:I,onAfterLeave:j,onLeaveCancelled:$,onBeforeAppear:X,onAppear:ae,onAfterAppear:z,onAppearCancelled:J}=t,ne=String(e.key),ke=Yd(n,e),me=(le,re)=>{le&&ur(le,r,9,re)},ge=(le,re)=>{const de=re[1];me(le,re),Xe(le)?le.every(te=>te.length<=1)&&de():le.length<=1&&de()},je={mode:i,persisted:a,beforeEnter(le){let re=l;if(!n.isMounted)if(o)re=X||l;else return;le[vr]&&le[vr](!0);const de=ke[ne];de&&Ts(e,de)&&de.el[vr]&&de.el[vr](),me(re,[le])},enter(le){if(ke[ne]===e)return;let re=d,de=c,te=m;if(!n.isMounted)if(o)re=ae||d,de=z||c,te=J||m;else return;let Pe=!1;le[io]=He=>{Pe||(Pe=!0,He?me(te,[le]):me(de,[le]),je.delayedLeave&&je.delayedLeave(),le[io]=void 0)};const Je=le[io].bind(null,!1);re?ge(re,[le,Je]):Je()},leave(le,re){const de=String(e.key);if(le[io]&&le[io](!0),n.isUnmounting)return re();me(b,[le]);let te=!1;le[vr]=Je=>{te||(te=!0,re(),Je?me($,[le]):me(j,[le]),le[vr]=void 0,ke[de]===e&&delete ke[de])};const Pe=le[vr].bind(null,!1);ke[de]=e,I?ge(I,[le,Pe]):Pe()},clone(le){const re=Va(le,t,n,r,s);return s&&s(re),re}};return je}function sa(e){if(Di(e))return e=cs(e),e.children=null,e}function dc(e){if(!Di(e))return zd(e.type)&&e.children?Jd(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&&rt(n.default))return n.default()}}function Co(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Co(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 Qd(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===Oe?(i.patchFlag&128&&s++,r=r.concat(Qd(i.children,t,a))):(t||i.type!==vn)&&r.push(a!=null?cs(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function on(e,t){return rt(e)?rn({name:e.name},t,{setup:e}):e}function Xd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function fc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const yi=new WeakMap;function yo(e,t,n,r,s=!1){if(Xe(e)){e.forEach(($,X)=>yo($,t&&(Xe(t)?t[X]:t),n,r,s));return}if(Ws(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&yo(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Hi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,d=t&&t.r,c=a.refs===Nt?a.refs={}:a.refs,m=a.setupState,b=It(m),I=m===Nt?dd:$=>fc(c,$)?!1:Pt(b,$),j=($,X)=>!(X&&fc(c,X));if(d!=null&&d!==l){if(hc(t),Vt(d))c[d]=null,I(d)&&(m[d]=null);else if(wn(d)){const $=t;j(d,$.k)&&(d.value=null),$.k&&(c[$.k]=null)}}if(rt(l))Fo(l,a,12,[i,c]);else{const $=Vt(l),X=wn(l);if($||X){const ae=()=>{if(e.f){const z=$?I(l)?m[l]:c[l]:j()||!e.k?l.value:c[e.k];if(s)Xe(z)&&bl(z,o);else if(Xe(z))z.includes(o)||z.push(o);else if($)c[l]=[o],I(l)&&(m[l]=c[l]);else{const J=[o];j(l,e.k)&&(l.value=J),e.k&&(c[e.k]=J)}}else $?(c[l]=i,I(l)&&(m[l]=i)):X&&(j(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const z=()=>{ae(),yi.delete(e)};z.id=-1,yi.set(e,z),mn(z,n)}else hc(e),ae()}}}function hc(e){const t=yi.get(e);t&&(t.flags|=8,yi.delete(e))}$i().requestIdleCallback;$i().cancelIdleCallback;const Ws=e=>!!e.type.__asyncLoader,Di=e=>e.type.__isKeepAlive;function zp(e,t){Zd(e,"a",t)}function qp(e,t){Zd(e,"da",t)}function Zd(e,t,n=yn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(ji(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Di(s.parent.vnode)&&Gp(r,t,n,s),s=s.parent}}function Gp(e,t,n,r){const s=ji(t,e,r,!0);Fi(()=>{bl(r[t],s)},n)}function ji(e,t,n=yn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Fr();const a=Bo(n),l=ur(t,n,e,i);return a(),Br(),l});return r?s.unshift(o):s.push(o),o}}const qr=e=>(t,n=yn)=>{(!Po||e==="sp")&&ji(e,(...r)=>t(...r),n)},Kp=qr("bm"),Gr=qr("m"),Jp=qr("bu"),Yp=qr("u"),Kr=qr("bum"),Fi=qr("um"),Qp=qr("sp"),Xp=qr("rtg"),Zp=qr("rtc");function em(e,t=yn){ji("ec",e,t)}const tm="components",ef=Symbol.for("v-ndc");function wi(e){return Vt(e)?nm(tm,e,!1)||e:e||ef}function nm(e,t,n=!0,r=!1){const s=cn||yn;if(s){const o=s.type;{const a=Bm(o,!1);if(a&&(a===t||a===Mn(t)||a===Mi(Mn(t))))return o}const i=pc(s[e]||o[e],t)||pc(s.appContext[e],t);return!i&&r?o:i}}function pc(e,t){return e&&(e[t]||e[Mn(t)]||e[Mi(Mn(t))])}function yt(e,t,n,r){let s;const o=n,i=Xe(e);if(i||Vt(e)){const a=i&&As(e);let l=!1,d=!1;a&&(l=!Qn(e),d=Ur(e),e=Oi(e)),s=new Array(e.length);for(let c=0,m=e.length;c<m;c++)s[c]=t(l?d?Js(cr(e[c])):cr(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(Mt(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,d=a.length;l<d;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function Tr(e,t,n={},r,s){if(cn.ce||cn.parent&&Ws(cn.parent)&&cn.parent.ce){const d=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),_t(Oe,null,[De("slot",n,r)],d?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),y();const i=o&&tf(o(n)),a=n.key||i&&i.key,l=_t(Oe,{key:(a&&!lr(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function tf(e){return e.some(t=>xo(t)?!(t.type===vn||t.type===Oe&&!tf(t.children)):!0)?e:null}const za=e=>e?kf(e)?Hi(e):za(e.parent):null,wo=rn(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=>za(e.parent),$root:e=>za(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>rf(e),$forceUpdate:e=>e.f||(e.f=()=>{Pl(e.update)}),$nextTick:e=>e.n||(e.n=nn.bind(e.proxy)),$watch:e=>Bp.bind(e)}),oa=(e,t)=>e!==Nt&&!e.__isScriptSetup&&Pt(e,t),rm={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 b=i[t];if(b!==void 0)switch(b){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!==Nt&&Pt(s,t))return i[t]=2,s[t];if(Pt(o,t))return i[t]=3,o[t];if(n!==Nt&&Pt(n,t))return i[t]=4,n[t];qa&&(i[t]=0)}}const d=wo[t];let c,m;if(d)return t==="$attrs"&&gn(e.attrs,"get",""),d(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==Nt&&Pt(n,t))return i[t]=4,n[t];if(m=l.config.globalProperties,Pt(m,t))return m[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return oa(s,t)?(s[t]=n,!0):r!==Nt&&Pt(r,t)?(r[t]=n,!0):Pt(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!==Nt&&a[0]!=="$"&&Pt(e,a)||oa(t,a)||Pt(o,a)||Pt(r,a)||Pt(wo,a)||Pt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Pt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function sm(){return om().slots}function om(e){const t=Ll();return t.setupContext||(t.setupContext=Sf(t))}function mc(e){return Xe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let qa=!0;function im(e){const t=rf(e),n=e.proxy,r=e.ctx;qa=!1,t.beforeCreate&&gc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:d,created:c,beforeMount:m,mounted:b,beforeUpdate:I,updated:j,activated:$,deactivated:X,beforeDestroy:ae,beforeUnmount:z,destroyed:J,unmounted:ne,render:ke,renderTracked:me,renderTriggered:ge,errorCaptured:je,serverPrefetch:le,expose:re,inheritAttrs:de,components:te,directives:Pe,filters:Je}=t;if(d&&am(d,r,null),i)for(const We in i){const Me=i[We];rt(Me)&&(r[We]=Me.bind(n))}if(s){const We=s.call(n,n);Mt(We)&&(e.data=Ni(We))}if(qa=!0,o)for(const We in o){const Me=o[We],Ae=rt(Me)?Me.bind(n,n):rt(Me.get)?Me.get.bind(n,n):Sr,qe=!rt(Me)&&rt(Me.set)?Me.set.bind(n):Sr,Fe=fe({get:Ae,set:qe});Object.defineProperty(r,We,{enumerable:!0,configurable:!0,get:()=>Fe.value,set:gt=>Fe.value=gt})}if(a)for(const We in a)nf(a[We],r,n,We);if(l){const We=rt(l)?l.call(n):l;Reflect.ownKeys(We).forEach(Me=>{ii(Me,We[Me])})}c&&gc(c,e,"c");function ze(We,Me){Xe(Me)?Me.forEach(Ae=>We(Ae.bind(n))):Me&&We(Me.bind(n))}if(ze(Kp,m),ze(Gr,b),ze(Jp,I),ze(Yp,j),ze(zp,$),ze(qp,X),ze(em,je),ze(Zp,me),ze(Xp,ge),ze(Kr,z),ze(Fi,ne),ze(Qp,le),Xe(re))if(re.length){const We=e.exposed||(e.exposed={});re.forEach(Me=>{Object.defineProperty(We,Me,{get:()=>n[Me],set:Ae=>n[Me]=Ae,enumerable:!0})})}else e.exposed||(e.exposed={});ke&&e.render===Sr&&(e.render=ke),de!=null&&(e.inheritAttrs=de),te&&(e.components=te),Pe&&(e.directives=Pe),le&&Xd(e)}function am(e,t,n=Sr){Xe(e)&&(e=Ga(e));for(const r in e){const s=e[r];let o;Mt(s)?"default"in s?o=ir(s.from||r,s.default,!0):o=ir(s.from||r):o=ir(s),wn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function gc(e,t,n){ur(Xe(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function nf(e,t,n,r){let s=r.includes(".")?Wd(n,r):()=>n[r];if(Vt(e)){const o=t[e];rt(o)&&ht(s,o)}else if(rt(e))ht(s,e.bind(n));else if(Mt(e))if(Xe(e))e.forEach(o=>nf(o,t,n,r));else{const o=rt(e.handler)?e.handler.bind(n):t[e.handler];rt(o)&&ht(s,o,e)}}function rf(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(d=>bi(l,d,i,!0)),bi(l,t,i)),Mt(t)&&o.set(t,l),l}function bi(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&bi(e,o,n,!0),s&&s.forEach(i=>bi(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=lm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const lm={data:vc,props:yc,emits:yc,methods:uo,computed:uo,beforeCreate:An,created:An,beforeMount:An,mounted:An,beforeUpdate:An,updated:An,beforeDestroy:An,beforeUnmount:An,destroyed:An,unmounted:An,activated:An,deactivated:An,errorCaptured:An,serverPrefetch:An,components:uo,directives:uo,watch:um,provide:vc,inject:cm};function vc(e,t){return t?e?function(){return rn(rt(e)?e.call(this,this):e,rt(t)?t.call(this,this):t)}:t:e}function cm(e,t){return uo(Ga(e),Ga(t))}function Ga(e){if(Xe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function An(e,t){return e?[...new Set([].concat(e,t))]:t}function uo(e,t){return e?rn(Object.create(null),e,t):t}function yc(e,t){return e?Xe(e)&&Xe(t)?[...new Set([...e,...t])]:rn(Object.create(null),mc(e),mc(t??{})):t}function um(e,t){if(!e)return t;if(!t)return e;const n=rn(Object.create(null),e);for(const r in t)n[r]=An(e[r],t[r]);return n}function sf(){return{app:null,config:{isNativeTag:dd,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 dm=0;function fm(e,t){return function(r,s=null){rt(r)||(r=rn({},r)),s!=null&&!Mt(s)&&(s=null);const o=sf(),i=new WeakSet,a=[];let l=!1;const d=o.app={_uid:dm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Hm,get config(){return o.config},set config(c){},use(c,...m){return i.has(c)||(c&&rt(c.install)?(i.add(c),c.install(d,...m)):rt(c)&&(i.add(c),c(d,...m))),d},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),d},component(c,m){return m?(o.components[c]=m,d):o.components[c]},directive(c,m){return m?(o.directives[c]=m,d):o.directives[c]},mount(c,m,b){if(!l){const I=d._ceVNode||De(r,s);return I.appContext=o,b===!0?b="svg":b===!1&&(b=void 0),e(I,c,b),l=!0,d._container=c,c.__vue_app__=d,Hi(I.component)}},onUnmount(c){a.push(c)},unmount(){l&&(ur(a,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,m){return o.provides[c]=m,d},runWithContext(c){const m=Vs;Vs=d;try{return c()}finally{Vs=m}}};return d}}let Vs=null;const hm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Mn(t)}Modifiers`]||e[`${us(t)}Modifiers`];function pm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Nt;let s=n;const o=t.startsWith("update:"),i=o&&hm(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Vt(c)?c.trim():c)),i.number&&(s=n.map(kl)));let a,l=r[a=Zi(t)]||r[a=Zi(Mn(t))];!l&&o&&(l=r[a=Zi(us(t))]),l&&ur(l,e,6,s);const d=r[a+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,ur(d,e,6,s)}}const mm=new WeakMap;function of(e,t,n=!1){const r=n?mm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!rt(e)){const l=d=>{const c=of(d,t,!0);c&&(a=!0,rn(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(Mt(e)&&r.set(e,null),null):(Xe(o)?o.forEach(l=>i[l]=null):rn(i,o),Mt(e)&&r.set(e,i),i)}function Bi(e,t){return!e||!Ri(t)?!1:(t=t.slice(2).replace(/Once$/,""),Pt(e,t[0].toLowerCase()+t.slice(1))||Pt(e,us(t))||Pt(e,t))}function wc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:d,renderCache:c,props:m,data:b,setupState:I,ctx:j,inheritAttrs:$}=e,X=vi(e);let ae,z;try{if(n.shapeFlag&4){const ne=s||r,ke=ne;ae=wr(d.call(ke,ne,c,m,I,b,j)),z=a}else{const ne=t;ae=wr(ne.length>1?ne(m,{attrs:a,slots:i,emit:l}):ne(m,null)),z=t.props?a:gm(a)}}catch(ne){bo.length=0,Li(ne,e,1),ae=De(vn)}let J=ae;if(z&&$!==!1){const ne=Object.keys(z),{shapeFlag:ke}=J;ne.length&&ke&7&&(o&&ne.some(wl)&&(z=vm(z,o)),J=cs(J,z,!1,!0))}return n.dirs&&(J=cs(J,null,!1,!0),J.dirs=J.dirs?J.dirs.concat(n.dirs):n.dirs),n.transition&&Co(J,n.transition),ae=J,vi(X),ae}const gm=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ri(n))&&((t||(t={}))[n]=e[n]);return t},vm=(e,t)=>{const n={};for(const r in e)(!wl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function ym(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,d=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?bc(r,i,d):!!i;if(l&8){const c=t.dynamicProps;for(let m=0;m<c.length;m++){const b=c[m];if(af(i,r,b)&&!Bi(d,b))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?bc(r,i,d):!0:!!i;return!1}function bc(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(af(t,e,o)&&!Bi(n,o))return!0}return!1}function af(e,t,n){const r=e[n],s=t[n];return n==="style"&&Mt(r)&&Mt(s)?!Tl(r,s):r!==s}function wm({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}const lf={},cf=()=>Object.create(lf),uf=e=>Object.getPrototypeOf(e)===lf;function bm(e,t,n,r=!1){const s={},o=cf();e.propsDefaults=Object.create(null),df(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Od(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function _m(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=It(s),[l]=e.propsOptions;let d=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let m=0;m<c.length;m++){let b=c[m];if(Bi(e.emitsOptions,b))continue;const I=t[b];if(l)if(Pt(o,b))I!==o[b]&&(o[b]=I,d=!0);else{const j=Mn(b);s[j]=Ka(l,a,j,I,e,!1)}else I!==o[b]&&(o[b]=I,d=!0)}}}else{df(e,t,s,o)&&(d=!0);let c;for(const m in a)(!t||!Pt(t,m)&&((c=us(m))===m||!Pt(t,c)))&&(l?n&&(n[m]!==void 0||n[c]!==void 0)&&(s[m]=Ka(l,a,m,void 0,e,!0)):delete s[m]);if(o!==a)for(const m in o)(!t||!Pt(t,m))&&(delete o[m],d=!0)}d&&Or(e.attrs,"set","")}function df(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(ho(l))continue;const d=t[l];let c;s&&Pt(s,c=Mn(l))?!o||!o.includes(c)?n[c]=d:(a||(a={}))[c]=d:Bi(e.emitsOptions,l)||(!(l in r)||d!==r[l])&&(r[l]=d,i=!0)}if(o){const l=It(n),d=a||Nt;for(let c=0;c<o.length;c++){const m=o[c];n[m]=Ka(s,l,m,d[m],e,!Pt(d,m))}}return i}function Ka(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=Pt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&rt(l)){const{propsDefaults:d}=s;if(n in d)r=d[n];else{const c=Bo(s);r=d[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===us(n))&&(r=!0))}return r}const km=new WeakMap;function ff(e,t,n=!1){const r=n?km:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!rt(e)){const c=m=>{l=!0;const[b,I]=ff(m,t,!0);rn(i,b),I&&a.push(...I)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return Mt(e)&&r.set(e,Bs),Bs;if(Xe(o))for(let c=0;c<o.length;c++){const m=Mn(o[c]);_c(m)&&(i[m]=Nt)}else if(o)for(const c in o){const m=Mn(c);if(_c(m)){const b=o[c],I=i[m]=Xe(b)||rt(b)?{type:b}:rn({},b),j=I.type;let $=!1,X=!0;if(Xe(j))for(let ae=0;ae<j.length;++ae){const z=j[ae],J=rt(z)&&z.name;if(J==="Boolean"){$=!0;break}else J==="String"&&(X=!1)}else $=rt(j)&&j.name==="Boolean";I[0]=$,I[1]=X,($||Pt(I,"default"))&&a.push(m)}}const d=[i,a];return Mt(e)&&r.set(e,d),d}function _c(e){return e[0]!=="$"&&!ho(e)}const Ml=e=>e==="_"||e==="_ctx"||e==="$stable",$l=e=>Xe(e)?e.map(wr):[wr(e)],Tm=(e,t,n)=>{if(t._n)return t;const r=xt((...s)=>$l(t(...s)),n);return r._c=!1,r},hf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ml(s))continue;const o=e[s];if(rt(o))t[s]=Tm(s,o,r);else if(o!=null){const i=$l(o);t[s]=()=>i}}},pf=(e,t)=>{const n=$l(t);e.slots.default=()=>n},mf=(e,t,n)=>{for(const r in t)(n||!Ml(r))&&(e[r]=t[r])},Sm=(e,t,n)=>{const r=e.slots=cf();if(e.vnode.shapeFlag&32){const s=t._;s?(mf(r,t,n),n&&gd(r,"_",s,!0)):hf(t,r)}else t&&pf(e,t)},Im=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Nt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:mf(s,t,n):(o=!t.$stable,hf(t,s)),i=t}else t&&(pf(e,t),i={default:1});if(o)for(const a in s)!Ml(a)&&i[a]==null&&delete s[a]},mn=Rm;function Em(e){return Cm(e)}function Cm(e,t){const n=$i();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:d,setElementText:c,parentNode:m,nextSibling:b,setScopeId:I=Sr,insertStaticContent:j}=e,$=(T,E,O,V=null,G=null,N=null,F=void 0,B=null,ee=!!E.dynamicChildren)=>{if(T===E)return;T&&!Ts(T,E)&&(V=W(T),gt(T,G,N,!0),T=null),E.patchFlag===-2&&(ee=!1,E.dynamicChildren=null);const{type:Q,ref:Ee,shapeFlag:be}=E;switch(Q){case Ui:X(T,E,O,V);break;case vn:ae(T,E,O,V);break;case aa:T==null&&z(E,O,V,F);break;case Oe:te(T,E,O,V,G,N,F,B,ee);break;default:be&1?ke(T,E,O,V,G,N,F,B,ee):be&6?Pe(T,E,O,V,G,N,F,B,ee):(be&64||be&128)&&Q.process(T,E,O,V,G,N,F,B,ee,ve)}Ee!=null&&G?yo(Ee,T&&T.ref,N,E||T,!E):Ee==null&&T&&T.ref!=null&&yo(T.ref,null,N,T,!0)},X=(T,E,O,V)=>{if(T==null)r(E.el=a(E.children),O,V);else{const G=E.el=T.el;E.children!==T.children&&d(G,E.children)}},ae=(T,E,O,V)=>{T==null?r(E.el=l(E.children||""),O,V):E.el=T.el},z=(T,E,O,V)=>{[T.el,T.anchor]=j(T.children,E,O,V,T.el,T.anchor)},J=({el:T,anchor:E},O,V)=>{let G;for(;T&&T!==E;)G=b(T),r(T,O,V),T=G;r(E,O,V)},ne=({el:T,anchor:E})=>{let O;for(;T&&T!==E;)O=b(T),s(T),T=O;s(E)},ke=(T,E,O,V,G,N,F,B,ee)=>{if(E.type==="svg"?F="svg":E.type==="math"&&(F="mathml"),T==null)me(E,O,V,G,N,F,B,ee);else{const Q=T.el&&T.el._isVueCE?T.el:null;try{Q&&Q._beginPatch(),le(T,E,G,N,F,B,ee)}finally{Q&&Q._endPatch()}}},me=(T,E,O,V,G,N,F,B)=>{let ee,Q;const{props:Ee,shapeFlag:be,transition:Te,dirs:Ce}=T;if(ee=T.el=i(T.type,N,Ee&&Ee.is,Ee),be&8?c(ee,T.children):be&16&&je(T.children,ee,null,V,G,ia(T,N),F,B),Ce&&gs(T,null,V,"created"),ge(ee,T,T.scopeId,F,V),Ee){for(const ot in Ee)ot!=="value"&&!ho(ot)&&o(ee,ot,null,Ee[ot],N,V);"value"in Ee&&o(ee,"value",null,Ee.value,N),(Q=Ee.onVnodeBeforeMount)&&mr(Q,V,T)}Ce&&gs(T,null,V,"beforeMount");const Ge=Am(G,Te);Ge&&Te.beforeEnter(ee),r(ee,E,O),((Q=Ee&&Ee.onVnodeMounted)||Ge||Ce)&&mn(()=>{Q&&mr(Q,V,T),Ge&&Te.enter(ee),Ce&&gs(T,null,V,"mounted")},G)},ge=(T,E,O,V,G)=>{if(O&&I(T,O),V)for(let N=0;N<V.length;N++)I(T,V[N]);if(G){let N=G.subTree;if(E===N||yf(N.type)&&(N.ssContent===E||N.ssFallback===E)){const F=G.vnode;ge(T,F,F.scopeId,F.slotScopeIds,G.parent)}}},je=(T,E,O,V,G,N,F,B,ee=0)=>{for(let Q=ee;Q<T.length;Q++){const Ee=T[Q]=B?$r(T[Q]):wr(T[Q]);$(null,Ee,E,O,V,G,N,F,B)}},le=(T,E,O,V,G,N,F)=>{const B=E.el=T.el;let{patchFlag:ee,dynamicChildren:Q,dirs:Ee}=E;ee|=T.patchFlag&16;const be=T.props||Nt,Te=E.props||Nt;let Ce;if(O&&vs(O,!1),(Ce=Te.onVnodeBeforeUpdate)&&mr(Ce,O,E,T),Ee&&gs(E,T,O,"beforeUpdate"),O&&vs(O,!0),(be.innerHTML&&Te.innerHTML==null||be.textContent&&Te.textContent==null)&&c(B,""),Q?re(T.dynamicChildren,Q,B,O,V,ia(E,G),N):F||Me(T,E,B,null,O,V,ia(E,G),N,!1),ee>0){if(ee&16)de(B,be,Te,O,G);else if(ee&2&&be.class!==Te.class&&o(B,"class",null,Te.class,G),ee&4&&o(B,"style",be.style,Te.style,G),ee&8){const Ge=E.dynamicProps;for(let ot=0;ot<Ge.length;ot++){const Ve=Ge[ot],dt=be[Ve],pt=Te[Ve];(pt!==dt||Ve==="value")&&o(B,Ve,dt,pt,G,O)}}ee&1&&T.children!==E.children&&c(B,E.children)}else!F&&Q==null&&de(B,be,Te,O,G);((Ce=Te.onVnodeUpdated)||Ee)&&mn(()=>{Ce&&mr(Ce,O,E,T),Ee&&gs(E,T,O,"updated")},V)},re=(T,E,O,V,G,N,F)=>{for(let B=0;B<E.length;B++){const ee=T[B],Q=E[B],Ee=ee.el&&(ee.type===Oe||!Ts(ee,Q)||ee.shapeFlag&198)?m(ee.el):O;$(ee,Q,Ee,null,V,G,N,F,!0)}},de=(T,E,O,V,G)=>{if(E!==O){if(E!==Nt)for(const N in E)!ho(N)&&!(N in O)&&o(T,N,E[N],null,G,V);for(const N in O){if(ho(N))continue;const F=O[N],B=E[N];F!==B&&N!=="value"&&o(T,N,B,F,G,V)}"value"in O&&o(T,"value",E.value,O.value,G)}},te=(T,E,O,V,G,N,F,B,ee)=>{const Q=E.el=T?T.el:a(""),Ee=E.anchor=T?T.anchor:a("");let{patchFlag:be,dynamicChildren:Te,slotScopeIds:Ce}=E;Ce&&(B=B?B.concat(Ce):Ce),T==null?(r(Q,O,V),r(Ee,O,V),je(E.children||[],O,Ee,G,N,F,B,ee)):be>0&&be&64&&Te&&T.dynamicChildren&&T.dynamicChildren.length===Te.length?(re(T.dynamicChildren,Te,O,G,N,F,B),(E.key!=null||G&&E===G.subTree)&&Ol(T,E,!0)):Me(T,E,O,Ee,G,N,F,B,ee)},Pe=(T,E,O,V,G,N,F,B,ee)=>{E.slotScopeIds=B,T==null?E.shapeFlag&512?G.ctx.activate(E,O,V,F,ee):Je(E,O,V,G,N,F,ee):He(T,E,ee)},Je=(T,E,O,V,G,N,F)=>{const B=T.component=Lm(T,V,G);if(Di(T)&&(B.ctx.renderer=ve),Dm(B,!1,F),B.asyncDep){if(G&&G.registerDep(B,ze,F),!T.el){const ee=B.subTree=De(vn);ae(null,ee,E,O),T.placeholder=ee.el}}else ze(B,T,E,O,G,N,F)},He=(T,E,O)=>{const V=E.component=T.component;if(ym(T,E,O))if(V.asyncDep&&!V.asyncResolved){We(V,E,O);return}else V.next=E,V.update();else E.el=T.el,V.vnode=E},ze=(T,E,O,V,G,N,F)=>{const B=()=>{if(T.isMounted){let{next:be,bu:Te,u:Ce,parent:Ge,vnode:ot}=T;{const Be=gf(T);if(Be){be&&(be.el=ot.el,We(T,be,F)),Be.asyncDep.then(()=>{mn(()=>{T.isUnmounted||Q()},G)});return}}let Ve=be,dt;vs(T,!1),be?(be.el=ot.el,We(T,be,F)):be=ot,Te&&oi(Te),(dt=be.props&&be.props.onVnodeBeforeUpdate)&&mr(dt,Ge,be,ot),vs(T,!0);const pt=wc(T),Et=T.subTree;T.subTree=pt,$(Et,pt,m(Et.el),W(Et),T,G,N),be.el=pt.el,Ve===null&&wm(T,pt.el),Ce&&mn(Ce,G),(dt=be.props&&be.props.onVnodeUpdated)&&mn(()=>mr(dt,Ge,be,ot),G)}else{let be;const{el:Te,props:Ce}=E,{bm:Ge,m:ot,parent:Ve,root:dt,type:pt}=T,Et=Ws(E);vs(T,!1),Ge&&oi(Ge),!Et&&(be=Ce&&Ce.onVnodeBeforeMount)&&mr(be,Ve,E),vs(T,!0);{dt.ce&&dt.ce._hasShadowRoot()&&dt.ce._injectChildStyle(pt,T.parent?T.parent.type:void 0);const Be=T.subTree=wc(T);$(null,Be,O,V,T,G,N),E.el=Be.el}if(ot&&mn(ot,G),!Et&&(be=Ce&&Ce.onVnodeMounted)){const Be=E;mn(()=>mr(be,Ve,Be),G)}(E.shapeFlag&256||Ve&&Ws(Ve.vnode)&&Ve.vnode.shapeFlag&256)&&T.a&&mn(T.a,G),T.isMounted=!0,E=O=V=null}};T.scope.on();const ee=T.effect=new bd(B);T.scope.off();const Q=T.update=ee.run.bind(ee),Ee=T.job=ee.runIfDirty.bind(ee);Ee.i=T,Ee.id=T.uid,ee.scheduler=()=>Pl(Ee),vs(T,!0),Q()},We=(T,E,O)=>{E.component=T;const V=T.vnode.props;T.vnode=E,T.next=null,_m(T,E.props,V,O),Im(T,E.children,O),Fr(),ac(T),Br()},Me=(T,E,O,V,G,N,F,B,ee=!1)=>{const Q=T&&T.children,Ee=T?T.shapeFlag:0,be=E.children,{patchFlag:Te,shapeFlag:Ce}=E;if(Te>0){if(Te&128){qe(Q,be,O,V,G,N,F,B,ee);return}else if(Te&256){Ae(Q,be,O,V,G,N,F,B,ee);return}}Ce&8?(Ee&16&&Qe(Q,G,N),be!==Q&&c(O,be)):Ee&16?Ce&16?qe(Q,be,O,V,G,N,F,B,ee):Qe(Q,G,N,!0):(Ee&8&&c(O,""),Ce&16&&je(be,O,V,G,N,F,B,ee))},Ae=(T,E,O,V,G,N,F,B,ee)=>{T=T||Bs,E=E||Bs;const Q=T.length,Ee=E.length,be=Math.min(Q,Ee);let Te;for(Te=0;Te<be;Te++){const Ce=E[Te]=ee?$r(E[Te]):wr(E[Te]);$(T[Te],Ce,O,null,G,N,F,B,ee)}Q>Ee?Qe(T,G,N,!0,!1,be):je(E,O,V,G,N,F,B,ee,be)},qe=(T,E,O,V,G,N,F,B,ee)=>{let Q=0;const Ee=E.length;let be=T.length-1,Te=Ee-1;for(;Q<=be&&Q<=Te;){const Ce=T[Q],Ge=E[Q]=ee?$r(E[Q]):wr(E[Q]);if(Ts(Ce,Ge))$(Ce,Ge,O,null,G,N,F,B,ee);else break;Q++}for(;Q<=be&&Q<=Te;){const Ce=T[be],Ge=E[Te]=ee?$r(E[Te]):wr(E[Te]);if(Ts(Ce,Ge))$(Ce,Ge,O,null,G,N,F,B,ee);else break;be--,Te--}if(Q>be){if(Q<=Te){const Ce=Te+1,Ge=Ce<Ee?E[Ce].el:V;for(;Q<=Te;)$(null,E[Q]=ee?$r(E[Q]):wr(E[Q]),O,Ge,G,N,F,B,ee),Q++}}else if(Q>Te)for(;Q<=be;)gt(T[Q],G,N,!0),Q++;else{const Ce=Q,Ge=Q,ot=new Map;for(Q=Ge;Q<=Te;Q++){const ft=E[Q]=ee?$r(E[Q]):wr(E[Q]);ft.key!=null&&ot.set(ft.key,Q)}let Ve,dt=0;const pt=Te-Ge+1;let Et=!1,Be=0;const Lt=new Array(pt);for(Q=0;Q<pt;Q++)Lt[Q]=0;for(Q=Ce;Q<=be;Q++){const ft=T[Q];if(dt>=pt){gt(ft,G,N,!0);continue}let ct;if(ft.key!=null)ct=ot.get(ft.key);else for(Ve=Ge;Ve<=Te;Ve++)if(Lt[Ve-Ge]===0&&Ts(ft,E[Ve])){ct=Ve;break}ct===void 0?gt(ft,G,N,!0):(Lt[ct-Ge]=Q+1,ct>=Be?Be=ct:Et=!0,$(ft,E[ct],O,null,G,N,F,B,ee),dt++)}const Tt=Et?xm(Lt):Bs;for(Ve=Tt.length-1,Q=pt-1;Q>=0;Q--){const ft=Ge+Q,ct=E[ft],vt=E[ft+1],Gt=ft+1<Ee?vt.el||vf(vt):V;Lt[Q]===0?$(null,ct,O,Gt,G,N,F,B,ee):Et&&(Ve<0||Q!==Tt[Ve]?Fe(ct,O,Gt,2):Ve--)}}},Fe=(T,E,O,V,G=null)=>{const{el:N,type:F,transition:B,children:ee,shapeFlag:Q}=T;if(Q&6){Fe(T.component.subTree,E,O,V);return}if(Q&128){T.suspense.move(E,O,V);return}if(Q&64){F.move(T,E,O,ve);return}if(F===Oe){r(N,E,O);for(let be=0;be<ee.length;be++)Fe(ee[be],E,O,V);r(T.anchor,E,O);return}if(F===aa){J(T,E,O);return}if(V!==2&&Q&1&&B)if(V===0)B.beforeEnter(N),r(N,E,O),mn(()=>B.enter(N),G);else{const{leave:be,delayLeave:Te,afterLeave:Ce}=B,Ge=()=>{T.ctx.isUnmounted?s(N):r(N,E,O)},ot=()=>{N._isLeaving&&N[vr](!0),be(N,()=>{Ge(),Ce&&Ce()})};Te?Te(N,Ge,ot):ot()}else r(N,E,O)},gt=(T,E,O,V=!1,G=!1)=>{const{type:N,props:F,ref:B,children:ee,dynamicChildren:Q,shapeFlag:Ee,patchFlag:be,dirs:Te,cacheIndex:Ce}=T;if(be===-2&&(G=!1),B!=null&&(Fr(),yo(B,null,O,T,!0),Br()),Ce!=null&&(E.renderCache[Ce]=void 0),Ee&256){E.ctx.deactivate(T);return}const Ge=Ee&1&&Te,ot=!Ws(T);let Ve;if(ot&&(Ve=F&&F.onVnodeBeforeUnmount)&&mr(Ve,E,T),Ee&6)lt(T.component,O,V);else{if(Ee&128){T.suspense.unmount(O,V);return}Ge&&gs(T,null,E,"beforeUnmount"),Ee&64?T.type.remove(T,E,O,ve,V):Q&&!Q.hasOnce&&(N!==Oe||be>0&&be&64)?Qe(Q,E,O,!1,!0):(N===Oe&&be&384||!G&&Ee&16)&&Qe(ee,E,O),V&&Ht(T)}(ot&&(Ve=F&&F.onVnodeUnmounted)||Ge)&&mn(()=>{Ve&&mr(Ve,E,T),Ge&&gs(T,null,E,"unmounted")},O)},Ht=T=>{const{type:E,el:O,anchor:V,transition:G}=T;if(E===Oe){ut(O,V);return}if(E===aa){ne(T);return}const N=()=>{s(O),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(T.shapeFlag&1&&G&&!G.persisted){const{leave:F,delayLeave:B}=G,ee=()=>F(O,N);B?B(T.el,N,ee):ee()}else N()},ut=(T,E)=>{let O;for(;T!==E;)O=b(T),s(T),T=O;s(E)},lt=(T,E,O)=>{const{bum:V,scope:G,job:N,subTree:F,um:B,m:ee,a:Q}=T;kc(ee),kc(Q),V&&oi(V),G.stop(),N&&(N.flags|=8,gt(F,T,E,O)),B&&mn(B,E),mn(()=>{T.isUnmounted=!0},E)},Qe=(T,E,O,V=!1,G=!1,N=0)=>{for(let F=N;F<T.length;F++)gt(T[F],E,O,V,G)},W=T=>{if(T.shapeFlag&6)return W(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const E=b(T.anchor||T.el),O=E&&E[Vd];return O?b(O):E};let we=!1;const ue=(T,E,O)=>{let V;T==null?E._vnode&&(gt(E._vnode,null,null,!0),V=E._vnode.component):$(E._vnode||null,T,E,null,null,null,O),E._vnode=T,we||(we=!0,ac(V),Fd(),we=!1)},ve={p:$,um:gt,m:Fe,r:Ht,mt:Je,mc:je,pc:Me,pbc:re,n:W,o:e};return{render:ue,hydrate:void 0,createApp:fm(ue)}}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 vs({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Am(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ol(e,t,n=!1){const r=e.children,s=t.children;if(Xe(r)&&Xe(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]=$r(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Ol(i,a)),a.type===Ui&&(a.patchFlag===-1&&(a=s[o]=$r(a)),a.el=i.el),a.type===vn&&!a.el&&(a.el=i.el)}}function xm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const d=e[r];if(d!==0){if(s=n[n.length-1],e[s]<d){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<d?o=a+1:i=a;d<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 gf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:gf(t)}function kc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function vf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?vf(t.subTree):null}const yf=e=>e.__isSuspense;function Rm(e,t){t&&t.pendingBranch?Xe(e)?t.effects.push(...e):t.effects.push(e):Dp(e)}const Oe=Symbol.for("v-fgt"),Ui=Symbol.for("v-txt"),vn=Symbol.for("v-cmt"),aa=Symbol.for("v-stc"),bo=[];let zn=null;function y(e=!1){bo.push(zn=e?null:[])}function Pm(){bo.pop(),zn=bo[bo.length-1]||null}let Ao=1;function _i(e,t=!1){Ao+=e,e<0&&zn&&t&&(zn.hasOnce=!0)}function wf(e){return e.dynamicChildren=Ao>0?zn||Bs:null,Pm(),Ao>0&&zn&&zn.push(e),e}function k(e,t,n,r,s,o){return wf(v(e,t,n,r,s,o,!0))}function _t(e,t,n,r,s){return wf(De(e,t,n,r,s,!0))}function xo(e){return e?e.__v_isVNode===!0:!1}function Ts(e,t){return e.type===t.type&&e.key===t.key}const bf=({key:e})=>e??null,li=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Vt(e)||wn(e)||rt(e)?{i:cn,r:e,k:t,f:!!n}:e:null);function v(e,t=null,n=null,r=0,s=null,o=e===Oe?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&bf(t),ref:t&&li(t),scopeId:Ud,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:cn};return a?(Nl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Vt(n)?8:16),Ao>0&&!i&&zn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&zn.push(l),l}const De=Mm;function Mm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===ef)&&(e=vn),xo(e)){const a=cs(e,t,!0);return n&&Nl(a,n),Ao>0&&!o&&zn&&(a.shapeFlag&6?zn[zn.indexOf(e)]=a:zn.push(a)),a.patchFlag=-2,a}if(Um(e)&&(e=e.__vccOpts),t){t=$m(t);let{class:a,style:l}=t;a&&!Vt(a)&&(t.class=nt(a)),Mt(l)&&(Rl(l)&&!Xe(l)&&(l=rn({},l)),t.style=is(l))}const i=Vt(e)?1:yf(e)?128:zd(e)?64:Mt(e)?4:rt(e)?2:0;return v(e,t,n,r,s,i,o,!0)}function $m(e){return e?Rl(e)||uf(e)?rn({},e):e:null}function cs(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,d=t?_f(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&bf(d),ref:t&&t.ref?n&&o?Xe(o)?o.concat(li(t)):[o,li(t)]:li(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!==Oe?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&&cs(e.ssContent),ssFallback:e.ssFallback&&cs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Co(c,l.clone(c)),c}function Ro(e=" ",t=0){return De(Ui,null,e,t)}function he(e="",t=!1){return t?(y(),_t(vn,null,e)):De(vn,null,e)}function wr(e){return e==null||typeof e=="boolean"?De(vn):Xe(e)?De(Oe,null,e.slice()):xo(e)?$r(e):De(Ui,null,String(e))}function $r(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:cs(e)}function Nl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Xe(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Nl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!uf(t)?t._ctx=cn:s===3&&cn&&(cn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else rt(t)?(t={default:t,_ctx:cn},n=32):(t=String(t),r&64?(n=16,t=[Ro(t)]):n=8);e.children=t,e.shapeFlag|=n}function _f(...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=nt([t.class,r.class]));else if(s==="style")t.style=is([t.style,r.style]);else if(Ri(s)){const o=t[s],i=r[s];i&&o!==i&&!(Xe(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function mr(e,t,n,r=null){ur(e,t,7,[n,r])}const Om=sf();let Nm=0;function Lm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Om,o={uid:Nm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ap(!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:ff(r,s),emitsOptions:of(r,s),emit:null,emitted:null,propsDefaults:Nt,inheritAttrs:r.inheritAttrs,ctx:Nt,data:Nt,props:Nt,attrs:Nt,slots:Nt,refs:Nt,setupState:Nt,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=pm.bind(null,o),e.ce&&e.ce(o),o}let yn=null;const Ll=()=>yn||cn;let ki,Ja;{const e=$i(),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)}};ki=t("__VUE_INSTANCE_SETTERS__",n=>yn=n),Ja=t("__VUE_SSR_SETTERS__",n=>Po=n)}const Bo=e=>{const t=yn;return ki(e),e.scope.on(),()=>{e.scope.off(),ki(t)}},Tc=()=>{yn&&yn.scope.off(),ki(null)};function kf(e){return e.vnode.shapeFlag&4}let Po=!1;function Dm(e,t=!1,n=!1){t&&Ja(t);const{props:r,children:s}=e.vnode,o=kf(e);bm(e,r,o,t),Sm(e,s,n||t);const i=o?jm(e,t):void 0;return t&&Ja(!1),i}function jm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,rm);const{setup:r}=n;if(r){Fr();const s=e.setupContext=r.length>1?Sf(e):null,o=Bo(e),i=Fo(r,e,0,[e.props,s]),a=hd(i);if(Br(),o(),(a||e.sp)&&!Ws(e)&&Xd(e),a){if(i.then(Tc,Tc),t)return i.then(l=>{Sc(e,l)}).catch(l=>{Li(l,e,0)});e.asyncDep=i}else Sc(e,i)}else Tf(e)}function Sc(e,t,n){rt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Mt(t)&&(e.setupState=Ld(t)),Tf(e)}function Tf(e,t,n){const r=e.type;e.render||(e.render=r.render||Sr);{const s=Bo(e);Fr();try{im(e)}finally{Br(),s()}}}const Fm={get(e,t){return gn(e,"get",""),e[t]}};function Sf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Fm),slots:e.slots,emit:e.emit,expose:t}}function Hi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ld(Cp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wo)return wo[n](e)},has(t,n){return n in t||n in wo}})):e.proxy}function Bm(e,t=!0){return rt(e)?e.displayName||e.name:e.name||t&&e.__name}function Um(e){return rt(e)&&"__vccOpts"in e}const fe=(e,t)=>Mp(e,t,Po);function Dl(e,t,n){try{_i(-1);const r=arguments.length;return r===2?Mt(t)&&!Xe(t)?xo(t)?De(e,null,[t]):De(e,t):De(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&xo(n)&&(n=[n]),De(e,t,n))}finally{_i(1)}}const Hm="3.5.30";/**
14
- * @vue/runtime-dom v3.5.30
15
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
- * @license MIT
17
- **/let Ya;const Ic=typeof window<"u"&&window.trustedTypes;if(Ic)try{Ya=Ic.createPolicy("vue",{createHTML:e=>e})}catch{}const If=Ya?e=>Ya.createHTML(e):e=>e,Wm="http://www.w3.org/2000/svg",Vm="http://www.w3.org/1998/Math/MathML",Mr=typeof document<"u"?document:null,Ec=Mr&&Mr.createElement("template"),zm={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"?Mr.createElementNS(Wm,e):t==="mathml"?Mr.createElementNS(Vm,e):n?Mr.createElement(e,{is:n}):Mr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Mr.createTextNode(e),createComment:e=>Mr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Mr.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{Ec.innerHTML=If(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Ec.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]}},Yr="transition",ao="animation",Mo=Symbol("_vtc"),Ef={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},qm=rn({},Gd,Ef),Gm=e=>(e.displayName="Transition",e.props=qm,e),Cf=Gm((e,{slots:t})=>Dl(Vp,Km(e),t)),ys=(e,t=[])=>{Xe(e)?e.forEach(n=>n(...t)):e&&e(...t)},Cc=e=>e?Xe(e)?e.some(t=>t.length>1):e.length>1:!1;function Km(e){const t={};for(const te in e)te in Ef||(t[te]=e[te]);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:d=i,appearToClass:c=a,leaveFromClass:m=`${n}-leave-from`,leaveActiveClass:b=`${n}-leave-active`,leaveToClass:I=`${n}-leave-to`}=e,j=Jm(s),$=j&&j[0],X=j&&j[1],{onBeforeEnter:ae,onEnter:z,onEnterCancelled:J,onLeave:ne,onLeaveCancelled:ke,onBeforeAppear:me=ae,onAppear:ge=z,onAppearCancelled:je=J}=t,le=(te,Pe,Je,He)=>{te._enterCancelled=He,ws(te,Pe?c:a),ws(te,Pe?d:i),Je&&Je()},re=(te,Pe)=>{te._isLeaving=!1,ws(te,m),ws(te,I),ws(te,b),Pe&&Pe()},de=te=>(Pe,Je)=>{const He=te?ge:z,ze=()=>le(Pe,te,Je);ys(He,[Pe,ze]),Ac(()=>{ws(Pe,te?l:o),Rr(Pe,te?c:a),Cc(He)||xc(Pe,r,$,ze)})};return rn(t,{onBeforeEnter(te){ys(ae,[te]),Rr(te,o),Rr(te,i)},onBeforeAppear(te){ys(me,[te]),Rr(te,l),Rr(te,d)},onEnter:de(!1),onAppear:de(!0),onLeave(te,Pe){te._isLeaving=!0;const Je=()=>re(te,Pe);Rr(te,m),te._enterCancelled?(Rr(te,b),Mc(te)):(Mc(te),Rr(te,b)),Ac(()=>{te._isLeaving&&(ws(te,m),Rr(te,I),Cc(ne)||xc(te,r,X,Je))}),ys(ne,[te,Je])},onEnterCancelled(te){le(te,!1,void 0,!0),ys(J,[te])},onAppearCancelled(te){le(te,!0,void 0,!0),ys(je,[te])},onLeaveCancelled(te){re(te),ys(ke,[te])}})}function Jm(e){if(e==null)return null;if(Mt(e))return[la(e.enter),la(e.leave)];{const t=la(e);return[t,t]}}function la(e){return Zh(e)}function Rr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Mo]||(e[Mo]=new Set)).add(t)}function ws(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Mo];n&&(n.delete(t),n.size||(e[Mo]=void 0))}function Ac(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Ym=0;function xc(e,t,n,r){const s=e._endId=++Ym,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Qm(e,t);if(!i)return r();const d=i+"end";let c=0;const m=()=>{e.removeEventListener(d,b),o()},b=I=>{I.target===e&&++c>=l&&m()};setTimeout(()=>{c<l&&m()},a+1),e.addEventListener(d,b)}function Qm(e,t){const n=window.getComputedStyle(e),r=j=>(n[j]||"").split(", "),s=r(`${Yr}Delay`),o=r(`${Yr}Duration`),i=Rc(s,o),a=r(`${ao}Delay`),l=r(`${ao}Duration`),d=Rc(a,l);let c=null,m=0,b=0;t===Yr?i>0&&(c=Yr,m=i,b=o.length):t===ao?d>0&&(c=ao,m=d,b=l.length):(m=Math.max(i,d),c=m>0?i>d?Yr:ao:null,b=c?c===Yr?o.length:l.length:0);const I=c===Yr&&/\b(?:transform|all)(?:,|$)/.test(r(`${Yr}Property`).toString());return{type:c,timeout:m,propCount:b,hasTransform:I}}function Rc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Pc(n)+Pc(e[r])))}function Pc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Mc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Xm(e,t,n){const r=e[Mo];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const $c=Symbol("_vod"),Zm=Symbol("_vsh"),eg=Symbol(""),tg=/(?:^|;)\s*display\s*:/;function ng(e,t,n){const r=e.style,s=Vt(n);let o=!1;if(n&&!s){if(t)if(Vt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&ci(r,a,"")}else for(const i in t)n[i]==null&&ci(r,i,"");for(const i in n)i==="display"&&(o=!0),ci(r,i,n[i])}else if(s){if(t!==n){const i=r[eg];i&&(n+=";"+i),r.cssText=n,o=tg.test(n)}}else t&&e.removeAttribute("style");$c in e&&(e[$c]=o?r.display:"",e[Zm]&&(r.display="none"))}const Oc=/\s*!important$/;function ci(e,t,n){if(Xe(n))n.forEach(r=>ci(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=rg(e,t);Oc.test(n)?e.setProperty(us(r),n.replace(Oc,""),"important"):e[r]=n}}const Nc=["Webkit","Moz","ms"],ca={};function rg(e,t){const n=ca[t];if(n)return n;let r=Mn(t);if(r!=="filter"&&r in e)return ca[t]=r;r=Mi(r);for(let s=0;s<Nc.length;s++){const o=Nc[s]+r;if(o in e)return ca[t]=o}return t}const Lc="http://www.w3.org/1999/xlink";function Dc(e,t,n,r,s,o=op(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Lc,t.slice(6,t.length)):e.setAttributeNS(Lc,t,n):n==null||o&&!vd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":lr(n)?String(n):n)}function jc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?If(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=vd(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 js(e,t,n,r){e.addEventListener(t,n,r)}function sg(e,t,n,r){e.removeEventListener(t,n,r)}const Fc=Symbol("_vei");function og(e,t,n,r,s=null){const o=e[Fc]||(e[Fc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=ig(t);if(r){const d=o[t]=cg(r,s);js(e,a,d,l)}else i&&(sg(e,a,i,l),o[t]=void 0)}}const Bc=/(?:Once|Passive|Capture)$/;function ig(e){let t;if(Bc.test(e)){t={};let r;for(;r=e.match(Bc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):us(e.slice(2)),t]}let ua=0;const ag=Promise.resolve(),lg=()=>ua||(ag.then(()=>ua=0),ua=Date.now());function cg(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ur(ug(r,n.value),t,5,[r])};return n.value=e,n.attached=lg(),n}function ug(e,t){if(Xe(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 Uc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,dg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Xm(e,r,i):t==="style"?ng(e,n,r):Ri(t)?wl(t)||og(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):fg(e,t,r,i))?(jc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Dc(e,t,r,i,o,t!=="value")):e._isVueCE&&(hg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Vt(r)))?jc(e,Mn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Dc(e,t,r,i))};function fg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Uc(t)&&rt(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 Uc(t)&&Vt(n)?!1:t in e}function hg(e,t){const n=e._def.props;if(!n)return!1;const r=Mn(t);return Array.isArray(n)?n.some(s=>Mn(s)===r):Object.keys(n).some(s=>Mn(s)===r)}const Hc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Xe(t)?n=>oi(t,n):t};function pg(e){e.target.composing=!0}function Wc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function Vc(e,t,n){return t&&(e=e.trim()),n&&(e=kl(e)),e}const Wr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[da]=Hc(s);const o=r||s.props&&s.props.type==="number";js(e,t?"change":"input",i=>{i.target.composing||e[da](Vc(e.value,n,o))}),(n||o)&&js(e,"change",()=>{e.value=Vc(e.value,n,o)}),t||(js(e,"compositionstart",pg),js(e,"compositionend",Wc),js(e,"change",Wc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[da]=Hc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?kl(e.value):e.value,l=t??"";a!==l&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l))}},mg=["ctrl","shift","alt","meta"],gg={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)=>mg.some(n=>e[`${n}Key`]&&!t.includes(n))},St=(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=gg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},vg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Pn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=us(s.key);if(t.some(i=>i===o||vg[i]===o))return e(s)}))},yg=rn({patchProp:dg},zm);let zc;function wg(){return zc||(zc=Em(yg))}const bg=((...e)=>{const t=wg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=kg(r);if(!s)return;const o=t._component;!rt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,_g(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function _g(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function kg(e){return Vt(e)?document.querySelector(e):e}/*!
18
- * vue-router v4.6.4
19
- * (c) 2025 Eduardo San Martin Morote
20
- * @license MIT
21
- */const Fs=typeof document<"u";function Af(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Tg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Af(e.default)}const Rt=Object.assign;function fa(e,t){const n={};for(const r in t){const s=t[r];n[r]=dr(s)?s.map(e):e(s)}return n}const _o=()=>{},dr=Array.isArray;function qc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const xf=/#/g,Sg=/&/g,Ig=/\//g,Eg=/=/g,Cg=/\?/g,Rf=/\+/g,Ag=/%5B/g,xg=/%5D/g,Pf=/%5E/g,Rg=/%60/g,Mf=/%7B/g,Pg=/%7C/g,$f=/%7D/g,Mg=/%20/g;function jl(e){return e==null?"":encodeURI(""+e).replace(Pg,"|").replace(Ag,"[").replace(xg,"]")}function $g(e){return jl(e).replace(Mf,"{").replace($f,"}").replace(Pf,"^")}function Qa(e){return jl(e).replace(Rf,"%2B").replace(Mg,"+").replace(xf,"%23").replace(Sg,"%26").replace(Rg,"`").replace(Mf,"{").replace($f,"}").replace(Pf,"^")}function Og(e){return Qa(e).replace(Eg,"%3D")}function Ng(e){return jl(e).replace(xf,"%23").replace(Cg,"%3F")}function Lg(e){return Ng(e).replace(Ig,"%2F")}function $o(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Dg=/\/$/,jg=e=>e.replace(Dg,"");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=Hg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:$o(i)}}function Fg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Gc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Bg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Ys(t.matched[r],n.matched[s])&&Of(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ys(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Of(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Ug(e[n],t[n]))return!1;return!0}function Ug(e,t){return dr(e)?Kc(e,t):dr(t)?Kc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Kc(e,t){return dr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Hg(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 Qr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Xa=(function(e){return e.pop="pop",e.push="push",e})({}),pa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Wg(e){if(!e)if(Fs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),jg(e)}const Vg=/^[^#]+#/;function zg(e,t){return e.replace(Vg,"#")+t}function qg(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 Wi=()=>({left:window.scrollX,top:window.scrollY});function Gg(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=qg(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 Jc(e,t){return(history.state?history.state.position-t:-1)+e}const Za=new Map;function Kg(e,t){Za.set(e,t)}function Jg(e){const t=Za.get(e);return Za.delete(e),t}function Yg(e){return typeof e=="string"||e&&typeof e=="object"}function Nf(e){return typeof e=="string"||typeof e=="symbol"}let qt=(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 Lf=Symbol("");qt.MATCHER_NOT_FOUND+"",qt.NAVIGATION_GUARD_REDIRECT+"",qt.NAVIGATION_ABORTED+"",qt.NAVIGATION_CANCELLED+"",qt.NAVIGATION_DUPLICATED+"";function Qs(e,t){return Rt(new Error,{type:e,[Lf]:!0},t)}function Pr(e,t){return e instanceof Error&&Lf in e&&(t==null||!!(e.type&t))}const Qg=["params","query","hash"];function Xg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Qg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Zg(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(Rf," "),o=s.indexOf("="),i=$o(o<0?s:s.slice(0,o)),a=o<0?null:$o(s.slice(o+1));if(i in t){let l=t[i];dr(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Yc(e){let t="";for(let n in e){const r=e[n];if(n=Og(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(dr(r)?r.map(s=>s&&Qa(s)):[r&&Qa(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function ev(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=dr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const tv=Symbol(""),Qc=Symbol(""),Vi=Symbol(""),Fl=Symbol(""),el=Symbol("");function lo(){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 ts(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const d=b=>{b===!1?l(Qs(qt.NAVIGATION_ABORTED,{from:n,to:t})):b instanceof Error?l(b):Yg(b)?l(Qs(qt.NAVIGATION_GUARD_REDIRECT,{from:t,to:b})):(i&&r.enterCallbacks[s]===i&&typeof b=="function"&&i.push(b),a())},c=o(()=>e.call(r&&r.instances[s],t,n,d));let m=Promise.resolve(c);e.length<3&&(m=m.then(d)),m.catch(b=>l(b))})}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(Af(l)){const d=(l.__vccOpts||l)[t];d&&o.push(ts(d,n,r,i,a,s))}else{let d=l();o.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const m=Tg(c)?c.default:c;i.mods[a]=c,i.components[a]=m;const b=(m.__vccOpts||m)[t];return b&&ts(b,n,r,i,a,s)()}))}}return o}function nv(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(d=>Ys(d,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(d=>Ys(d,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 rv=()=>location.protocol+"//"+location.host;function Df(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),Gc(a,"")}return Gc(n,e)+r+s}function sv(e,t,n,r){let s=[],o=[],i=null;const a=({state:b})=>{const I=Df(e,location),j=n.value,$=t.value;let X=0;if(b){if(n.value=I,t.value=b,i&&i===j){i=null;return}X=$?b.position-$.position:0}else r(I);s.forEach(ae=>{ae(n.value,j,{delta:X,type:Xa.pop,direction:X?X>0?pa.forward:pa.back:pa.unknown})})};function l(){i=n.value}function d(b){s.push(b);const I=()=>{const j=s.indexOf(b);j>-1&&s.splice(j,1)};return o.push(I),I}function c(){if(document.visibilityState==="hidden"){const{history:b}=window;if(!b.state)return;b.replaceState(Rt({},b.state,{scroll:Wi()}),"")}}function m(){for(const b of o)b();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:d,destroy:m}}function Xc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Wi():null}}function ov(e){const{history:t,location:n}=window,r={value:Df(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,d,c){const m=e.indexOf("#"),b=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+l:rv()+e+l;try{t[c?"replaceState":"pushState"](d,"",b),s.value=d}catch(I){console.error(I),n[c?"replace":"assign"](b)}}function i(l,d){o(l,Rt({},t.state,Xc(s.value.back,l,s.value.forward,!0),d,{position:s.value.position}),!0),r.value=l}function a(l,d){const c=Rt({},s.value,t.state,{forward:l,scroll:Wi()});o(c.current,c,!0),o(l,Rt({},Xc(r.value,l,null),{position:c.position+1},d),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function iv(e){e=Wg(e);const t=ov(e),n=sv(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=Rt({location:"",base:e,go:r,createHref:zg.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 av(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),iv(e)}let Is=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var tn=(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})(tn||{});const lv={type:Is.Static,value:""},cv=/[a-zA-Z0-9_]/;function uv(e){if(!e)return[[]];if(e==="/")return[[lv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(I){throw new Error(`ERR (${n})/"${d}": ${I}`)}let n=tn.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,d="",c="";function m(){d&&(n===tn.Static?o.push({type:Is.Static,value:d}):n===tn.Param||n===tn.ParamRegExp||n===tn.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Is.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function b(){d+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==tn.ParamRegExp){r=n,n=tn.EscapeNext;continue}switch(n){case tn.Static:l==="/"?(d&&m(),i()):l===":"?(m(),n=tn.Param):b();break;case tn.EscapeNext:b(),n=r;break;case tn.Param:l==="("?n=tn.ParamRegExp:cv.test(l)?b():(m(),n=tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case tn.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=tn.ParamRegExpEnd:c+=l;break;case tn.ParamRegExpEnd:m(),n=tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===tn.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),m(),i(),s}const Zc="[^/]+?",dv={sensitive:!1,strict:!1,start:!0,end:!0};var xn=(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})(xn||{});const fv=/[.+*?^${}()[\]/\\]/g;function hv(e,t){const n=Rt({},dv,t),r=[];let s=n.start?"^":"";const o=[];for(const d of e){const c=d.length?[]:[xn.Root];n.strict&&!d.length&&(s+="/");for(let m=0;m<d.length;m++){const b=d[m];let I=xn.Segment+(n.sensitive?xn.BonusCaseSensitive:0);if(b.type===Is.Static)m||(s+="/"),s+=b.value.replace(fv,"\\$&"),I+=xn.Static;else if(b.type===Is.Param){const{value:j,repeatable:$,optional:X,regexp:ae}=b;o.push({name:j,repeatable:$,optional:X});const z=ae||Zc;if(z!==Zc){I+=xn.BonusCustomRegExp;try{`${z}`}catch(ne){throw new Error(`Invalid custom RegExp for param "${j}" (${z}): `+ne.message)}}let J=$?`((?:${z})(?:/(?:${z}))*)`:`(${z})`;m||(J=X&&d.length<2?`(?:/${J})`:"/"+J),X&&(J+="?"),s+=J,I+=xn.Dynamic,X&&(I+=xn.BonusOptional),$&&(I+=xn.BonusRepeatable),z===".*"&&(I+=xn.BonusWildcard)}c.push(I)}r.push(c)}if(n.strict&&n.end){const d=r.length-1;r[d][r[d].length-1]+=xn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(d){const c=d.match(i),m={};if(!c)return null;for(let b=1;b<c.length;b++){const I=c[b]||"",j=o[b-1];m[j.name]=I&&j.repeatable?I.split("/"):I}return m}function l(d){let c="",m=!1;for(const b of e){(!m||!c.endsWith("/"))&&(c+="/"),m=!1;for(const I of b)if(I.type===Is.Static)c+=I.value;else if(I.type===Is.Param){const{value:j,repeatable:$,optional:X}=I,ae=j in d?d[j]:"";if(dr(ae)&&!$)throw new Error(`Provided param "${j}" is an array but it is not repeatable (* or + modifiers)`);const z=dr(ae)?ae.join("/"):ae;if(!z)if(X)b.length<2&&(c.endsWith("/")?c=c.slice(0,-1):m=!0);else throw new Error(`Missing required param "${j}"`);c+=z}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function pv(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]===xn.Static+xn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===xn.Static+xn.Segment?1:-1:0}function jf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=pv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(eu(r))return 1;if(eu(s))return-1}return s.length-r.length}function eu(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const mv={strict:!1,end:!0,sensitive:!1};function gv(e,t,n){const r=hv(uv(e.path),n),s=Rt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function vv(e,t){const n=[],r=new Map;t=qc(mv,t);function s(m){return r.get(m)}function o(m,b,I){const j=!I,$=nu(m);$.aliasOf=I&&I.record;const X=qc(t,m),ae=[$];if("alias"in m){const ne=typeof m.alias=="string"?[m.alias]:m.alias;for(const ke of ne)ae.push(nu(Rt({},$,{components:I?I.record.components:$.components,path:ke,aliasOf:I?I.record:$})))}let z,J;for(const ne of ae){const{path:ke}=ne;if(b&&ke[0]!=="/"){const me=b.record.path,ge=me[me.length-1]==="/"?"":"/";ne.path=b.record.path+(ke&&ge+ke)}if(z=gv(ne,b,X),I?I.alias.push(z):(J=J||z,J!==z&&J.alias.push(z),j&&m.name&&!ru(z)&&i(m.name)),Ff(z)&&l(z),$.children){const me=$.children;for(let ge=0;ge<me.length;ge++)o(me[ge],z,I&&I.children[ge])}I=I||z}return J?()=>{i(J)}:_o}function i(m){if(Nf(m)){const b=r.get(m);b&&(r.delete(m),n.splice(n.indexOf(b),1),b.children.forEach(i),b.alias.forEach(i))}else{const b=n.indexOf(m);b>-1&&(n.splice(b,1),m.record.name&&r.delete(m.record.name),m.children.forEach(i),m.alias.forEach(i))}}function a(){return n}function l(m){const b=bv(m,n);n.splice(b,0,m),m.record.name&&!ru(m)&&r.set(m.record.name,m)}function d(m,b){let I,j={},$,X;if("name"in m&&m.name){if(I=r.get(m.name),!I)throw Qs(qt.MATCHER_NOT_FOUND,{location:m});X=I.record.name,j=Rt(tu(b.params,I.keys.filter(J=>!J.optional).concat(I.parent?I.parent.keys.filter(J=>J.optional):[]).map(J=>J.name)),m.params&&tu(m.params,I.keys.map(J=>J.name))),$=I.stringify(j)}else if(m.path!=null)$=m.path,I=n.find(J=>J.re.test($)),I&&(j=I.parse($),X=I.record.name);else{if(I=b.name?r.get(b.name):n.find(J=>J.re.test(b.path)),!I)throw Qs(qt.MATCHER_NOT_FOUND,{location:m,currentLocation:b});X=I.record.name,j=Rt({},b.params,m.params),$=I.stringify(j)}const ae=[];let z=I;for(;z;)ae.unshift(z.record),z=z.parent;return{name:X,path:$,params:j,matched:ae,meta:wv(ae)}}e.forEach(m=>o(m));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:d,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function tu(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function nu(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:yv(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 yv(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 ru(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function wv(e){return e.reduce((t,n)=>Rt(t,n.meta),{})}function bv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;jf(e,t[o])<0?r=o:n=o+1}const s=_v(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function _v(e){let t=e;for(;t=t.parent;)if(Ff(t)&&jf(e,t)===0)return t}function Ff({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function su(e){const t=ir(Vi),n=ir(Fl),r=fe(()=>{const l=_e(e.to);return t.resolve(l)}),s=fe(()=>{const{matched:l}=r.value,{length:d}=l,c=l[d-1],m=n.matched;if(!c||!m.length)return-1;const b=m.findIndex(Ys.bind(null,c));if(b>-1)return b;const I=ou(l[d-2]);return d>1&&ou(c)===I&&m[m.length-1].path!==I?m.findIndex(Ys.bind(null,l[d-2])):b}),o=fe(()=>s.value>-1&&Ev(n.params,r.value.params)),i=fe(()=>s.value>-1&&s.value===n.matched.length-1&&Of(n.params,r.value.params));function a(l={}){if(Iv(l)){const d=t[_e(e.replace)?"replace":"push"](_e(e.to)).catch(_o);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:fe(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function kv(e){return e.length===1?e[0]:e}const Tv=on({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:su,setup(e,{slots:t}){const n=Ni(su(e)),{options:r}=ir(Vi),s=fe(()=>({[iu(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[iu(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&kv(t.default(n));return e.custom?o:Dl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Sv=Tv;function Iv(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 Ev(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(!dr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function ou(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const iu=(e,t,n)=>e??t??n,Cv=on({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=ir(el),s=fe(()=>e.route||r.value),o=ir(Qc,0),i=fe(()=>{let d=_e(o);const{matched:c}=s.value;let m;for(;(m=c[d])&&!m.components;)d++;return d}),a=fe(()=>s.value.matched[i.value]);ii(Qc,fe(()=>i.value+1)),ii(tv,a),ii(el,s);const l=D();return ht(()=>[l.value,a.value,e.name],([d,c,m],[b,I,j])=>{c&&(c.instances[m]=d,I&&I!==c&&d&&d===b&&(c.leaveGuards.size||(c.leaveGuards=I.leaveGuards),c.updateGuards.size||(c.updateGuards=I.updateGuards))),d&&c&&(!I||!Ys(c,I)||!b)&&(c.enterCallbacks[m]||[]).forEach($=>$(d))},{flush:"post"}),()=>{const d=s.value,c=e.name,m=a.value,b=m&&m.components[c];if(!b)return au(n.default,{Component:b,route:d});const I=m.props[c],j=I?I===!0?d.params:typeof I=="function"?I(d):I:null,X=Dl(b,Rt({},j,t,{onVnodeUnmounted:ae=>{ae.component.isUnmounted&&(m.instances[c]=null)},ref:l}));return au(n.default,{Component:X,route:d})||X}}});function au(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Av=Cv;function xv(e){const t=vv(e.routes,e),n=e.parseQuery||Zg,r=e.stringifyQuery||Yc,s=e.history,o=lo(),i=lo(),a=lo(),l=Ap(Qr);let d=Qr;Fs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fa.bind(null,W=>""+W),m=fa.bind(null,Lg),b=fa.bind(null,$o);function I(W,we){let ue,ve;return Nf(W)?(ue=t.getRecordMatcher(W),ve=we):ve=W,t.addRoute(ve,ue)}function j(W){const we=t.getRecordMatcher(W);we&&t.removeRoute(we)}function $(){return t.getRoutes().map(W=>W.record)}function X(W){return!!t.getRecordMatcher(W)}function ae(W,we){if(we=Rt({},we||l.value),typeof W=="string"){const O=ha(n,W,we.path),V=t.resolve({path:O.path},we),G=s.createHref(O.fullPath);return Rt(O,V,{params:b(V.params),hash:$o(O.hash),redirectedFrom:void 0,href:G})}let ue;if(W.path!=null)ue=Rt({},W,{path:ha(n,W.path,we.path).path});else{const O=Rt({},W.params);for(const V in O)O[V]==null&&delete O[V];ue=Rt({},W,{params:m(O)}),we.params=m(we.params)}const ve=t.resolve(ue,we),xe=W.hash||"";ve.params=c(b(ve.params));const T=Fg(r,Rt({},W,{hash:$g(xe),path:ve.path})),E=s.createHref(T);return Rt({fullPath:T,hash:xe,query:r===Yc?ev(W.query):W.query||{}},ve,{redirectedFrom:void 0,href:E})}function z(W){return typeof W=="string"?ha(n,W,l.value.path):Rt({},W)}function J(W,we){if(d!==W)return Qs(qt.NAVIGATION_CANCELLED,{from:we,to:W})}function ne(W){return ge(W)}function ke(W){return ne(Rt(z(W),{replace:!0}))}function me(W,we){const ue=W.matched[W.matched.length-1];if(ue&&ue.redirect){const{redirect:ve}=ue;let xe=typeof ve=="function"?ve(W,we):ve;return typeof xe=="string"&&(xe=xe.includes("?")||xe.includes("#")?xe=z(xe):{path:xe},xe.params={}),Rt({query:W.query,hash:W.hash,params:xe.path!=null?{}:W.params},xe)}}function ge(W,we){const ue=d=ae(W),ve=l.value,xe=W.state,T=W.force,E=W.replace===!0,O=me(ue,ve);if(O)return ge(Rt(z(O),{state:typeof O=="object"?Rt({},xe,O.state):xe,force:T,replace:E}),we||ue);const V=ue;V.redirectedFrom=we;let G;return!T&&Bg(r,ve,ue)&&(G=Qs(qt.NAVIGATION_DUPLICATED,{to:V,from:ve}),Fe(ve,ve,!0,!1)),(G?Promise.resolve(G):re(V,ve)).catch(N=>Pr(N)?Pr(N,qt.NAVIGATION_GUARD_REDIRECT)?N:qe(N):Me(N,V,ve)).then(N=>{if(N){if(Pr(N,qt.NAVIGATION_GUARD_REDIRECT))return ge(Rt({replace:E},z(N.to),{state:typeof N.to=="object"?Rt({},xe,N.to.state):xe,force:T}),we||V)}else N=te(V,ve,!0,E,xe);return de(V,ve,N),N})}function je(W,we){const ue=J(W,we);return ue?Promise.reject(ue):Promise.resolve()}function le(W){const we=ut.values().next().value;return we&&typeof we.runWithContext=="function"?we.runWithContext(W):W()}function re(W,we){let ue;const[ve,xe,T]=nv(W,we);ue=ma(ve.reverse(),"beforeRouteLeave",W,we);for(const O of ve)O.leaveGuards.forEach(V=>{ue.push(ts(V,W,we))});const E=je.bind(null,W,we);return ue.push(E),Qe(ue).then(()=>{ue=[];for(const O of o.list())ue.push(ts(O,W,we));return ue.push(E),Qe(ue)}).then(()=>{ue=ma(xe,"beforeRouteUpdate",W,we);for(const O of xe)O.updateGuards.forEach(V=>{ue.push(ts(V,W,we))});return ue.push(E),Qe(ue)}).then(()=>{ue=[];for(const O of T)if(O.beforeEnter)if(dr(O.beforeEnter))for(const V of O.beforeEnter)ue.push(ts(V,W,we));else ue.push(ts(O.beforeEnter,W,we));return ue.push(E),Qe(ue)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),ue=ma(T,"beforeRouteEnter",W,we,le),ue.push(E),Qe(ue))).then(()=>{ue=[];for(const O of i.list())ue.push(ts(O,W,we));return ue.push(E),Qe(ue)}).catch(O=>Pr(O,qt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function de(W,we,ue){a.list().forEach(ve=>le(()=>ve(W,we,ue)))}function te(W,we,ue,ve,xe){const T=J(W,we);if(T)return T;const E=we===Qr,O=Fs?history.state:{};ue&&(ve||E?s.replace(W.fullPath,Rt({scroll:E&&O&&O.scroll},xe)):s.push(W.fullPath,xe)),l.value=W,Fe(W,we,ue,E),qe()}let Pe;function Je(){Pe||(Pe=s.listen((W,we,ue)=>{if(!lt.listening)return;const ve=ae(W),xe=me(ve,lt.currentRoute.value);if(xe){ge(Rt(xe,{replace:!0,force:!0}),ve).catch(_o);return}d=ve;const T=l.value;Fs&&Kg(Jc(T.fullPath,ue.delta),Wi()),re(ve,T).catch(E=>Pr(E,qt.NAVIGATION_ABORTED|qt.NAVIGATION_CANCELLED)?E:Pr(E,qt.NAVIGATION_GUARD_REDIRECT)?(ge(Rt(z(E.to),{force:!0}),ve).then(O=>{Pr(O,qt.NAVIGATION_ABORTED|qt.NAVIGATION_DUPLICATED)&&!ue.delta&&ue.type===Xa.pop&&s.go(-1,!1)}).catch(_o),Promise.reject()):(ue.delta&&s.go(-ue.delta,!1),Me(E,ve,T))).then(E=>{E=E||te(ve,T,!1),E&&(ue.delta&&!Pr(E,qt.NAVIGATION_CANCELLED)?s.go(-ue.delta,!1):ue.type===Xa.pop&&Pr(E,qt.NAVIGATION_ABORTED|qt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),de(ve,T,E)}).catch(_o)}))}let He=lo(),ze=lo(),We;function Me(W,we,ue){qe(W);const ve=ze.list();return ve.length?ve.forEach(xe=>xe(W,we,ue)):console.error(W),Promise.reject(W)}function Ae(){return We&&l.value!==Qr?Promise.resolve():new Promise((W,we)=>{He.add([W,we])})}function qe(W){return We||(We=!W,Je(),He.list().forEach(([we,ue])=>W?ue(W):we()),He.reset()),W}function Fe(W,we,ue,ve){const{scrollBehavior:xe}=e;if(!Fs||!xe)return Promise.resolve();const T=!ue&&Jg(Jc(W.fullPath,0))||(ve||!ue)&&history.state&&history.state.scroll||null;return nn().then(()=>xe(W,we,T)).then(E=>E&&Gg(E)).catch(E=>Me(E,W,we))}const gt=W=>s.go(W);let Ht;const ut=new Set,lt={currentRoute:l,listening:!0,addRoute:I,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:X,getRoutes:$,resolve:ae,options:e,push:ne,replace:ke,go:gt,back:()=>gt(-1),forward:()=>gt(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:ze.add,isReady:Ae,install(W){W.component("RouterLink",Sv),W.component("RouterView",Av),W.config.globalProperties.$router=lt,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),Fs&&!Ht&&l.value===Qr&&(Ht=!0,ne(s.location).catch(ve=>{}));const we={};for(const ve in Qr)Object.defineProperty(we,ve,{get:()=>l.value[ve],enumerable:!0});W.provide(Vi,lt),W.provide(Fl,Od(we)),W.provide(el,l);const ue=W.unmount;ut.add(W),W.unmount=function(){ut.delete(W),ut.size<1&&(d=Qr,Pe&&Pe(),Pe=null,l.value=Qr,Ht=!1,We=!1),ue()}}};function Qe(W){return W.reduce((we,ue)=>we.then(()=>le(ue)),Promise.resolve())}return lt}function Rv(){return ir(Vi)}function Pv(e){return ir(Fl)}const lu=768;function Bf(){const e=D(typeof window<"u"?window.innerWidth<lu:!1);let t=null;function n(r){e.value=r.matches}return Gr(()=>{t=window.matchMedia(`(max-width: ${lu-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Fi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Mv={key:0,class:"desktop-sidebar"},$v={class:"desktop-main"},cu="codex-web-local.sidebar-width.v1",Ov=260,Nv=620,uu=320,Lv=on({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Bf();function r(d){return Math.min(Nv,Math.max(Ov,d))}function s(){if(typeof window>"u")return uu;const d=window.localStorage.getItem(cu),c=Number(d);return Number.isFinite(c)?r(c):uu}const o=D(s()),i=fe(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function a(d){typeof window>"u"||window.localStorage.setItem(cu,String(d))}function l(d){d.preventDefault();const c=d.clientX,m=o.value,b=j=>{const $=j.clientX-c;o.value=r(m+$)},I=()=>{a(o.value),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",I)}return(d,c)=>(y(),k("div",{class:nt(["desktop-layout",{"is-mobile":_e(n)}]),style:is(i.value)},[_e(n)?(y(),_t(vo,{key:0,to:"body"},[De(Cf,{name:"drawer"},{default:xt(()=>[e.isSidebarCollapsed?he("",!0):(y(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=m=>d.$emit("close-sidebar"))},[v("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=St(()=>{},["stop"]))},[Tr(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):he("",!0),_e(n)?he("",!0):(y(),k(Oe,{key:1},[e.isSidebarCollapsed?he("",!0):(y(),k("aside",Mv,[Tr(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?he("",!0):(y(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),v("section",$v,[Tr(d.$slots,"content",{},void 0)])],6))}}),kt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Dv=kt(Lv,[["__scopeId","data-v-068d06c5"]]),jv={},Fv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bv(e,t){return y(),k("svg",Fv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const zi=kt(jv,[["render",Bv]]),Uv={},Hv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Wv(e,t){return y(),k("svg",Hv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Uf=kt(Uv,[["render",Wv]]),Vv={},zv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qv(e,t){return y(),k("svg",zv,[...t[0]||(t[0]=[v("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 co=kt(Vv,[["render",qv]]),Gv={},Kv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Jv(e,t){return y(),k("svg",Kv,[...t[0]||(t[0]=[v("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 Ti=kt(Gv,[["render",Jv]]),Yv={},Qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Xv(e,t){return y(),k("svg",Qv,[...t[0]||(t[0]=[v("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 Bl=kt(Yv,[["render",Xv]]),Zv={},ey={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ty(e,t){return y(),k("svg",ey,[...t[0]||(t[0]=[v("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 ny=kt(Zv,[["render",ty]]),ry={},sy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function oy(e,t){return y(),k("svg",sy,[...t[0]||(t[0]=[v("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 ui=kt(ry,[["render",oy]]),iy={},ay={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ly(e,t){return y(),k("svg",ay,[...t[0]||(t[0]=[v("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=kt(iy,[["render",ly]]),cy={key:0,class:"sidebar-menu-row-left"},uy={class:"sidebar-menu-row-main"},dy={key:1,class:"sidebar-menu-row-right"},fy={key:0,class:"sidebar-menu-row-right-default"},hy={key:1,class:"sidebar-menu-row-right-hover"},py=on({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=sm(),r=fe(()=>!!n.left),s=fe(()=>!!n.right),o=fe(()=>!!n["right-hover"]),i=fe(()=>s.value||o.value);return(a,l)=>(y(),_t(wi(t.as),_f({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:xt(()=>[r.value?(y(),k("span",cy,[Tr(a.$slots,"left",{},void 0,!0)])):he("",!0),v("span",uy,[Tr(a.$slots,"default",{},void 0,!0)]),i.value?(y(),k("span",dy,[s.value?(y(),k("span",fy,[Tr(a.$slots,"right",{},void 0,!0)])):he("",!0),o.value?(y(),k("span",hy,[Tr(a.$slots,"right-hover",{},void 0,!0)])):he("",!0)])):he("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),bs=kt(py,[["__scopeId","data-v-36239f39"]]),my={class:"thread-tree-root"},gy={key:0,class:"pinned-section"},vy={class:"thread-list"},yy=["data-menu-open"],wy={class:"thread-left-stack"},by=["data-state"],_y=["onClick"],ky=["onClick"],Ty={class:"thread-row-title-wrap"},Sy={class:"thread-row-title"},Iy={class:"thread-row-time"},Ey=["onClick"],Cy=["aria-expanded"],Ay=["data-active"],xy={key:0},Ry=["data-active"],Py={key:0},My={key:1,class:"thread-tree-no-results"},$y={key:2,class:"thread-tree-loading"},Oy={key:3,class:"thread-list thread-list-global"},Ny=["data-menu-open"],Ly={class:"thread-left-stack"},Dy=["data-state"],jy=["onClick"],Fy=["onClick"],By={class:"thread-row-title-wrap"},Uy={class:"thread-row-title"},Hy={class:"thread-row-time"},Wy=["onClick"],Vy=["data-project-name","data-expanded","data-dragging"],zy={class:"project-icon-stack"},qy={class:"project-icon-folder"},Gy={class:"project-icon-chevron"},Ky=["data-dragging-handle","onMousedown"],Jy={class:"project-title"},Yy={class:"project-hover-controls"},Qy=["onClick"],Xy=["data-open-direction"],Zy=["onClick"],ew=["onClick"],tw=["onClick"],nw=["onInput"],rw=["aria-label","title","onClick"],sw={key:0,class:"thread-list"},ow=["data-menu-open"],iw={class:"thread-left-stack"},aw=["data-state"],lw=["onClick"],cw=["onClick"],uw={class:"thread-row-title-wrap"},dw={class:"thread-row-title"},fw={class:"thread-row-time"},hw=["onClick"],pw=["onClick"],mw=["data-open-direction"],gw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},vw=["onKeydown"],yw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},ww={class:"rename-thread-subtitle"},bw=4,du=6,fu="codex-web-local.thread-view-mode.v1",hu="codex-web-local.collapsed-projects.v1",_w=on({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-project-files","rename-project","rename-thread","remove-project","reorder-project","export-thread"],setup(e,{emit:t}){const n=e,r=t,s=D({}),o=D({}),i=D([]),a=D(""),l=D(""),d=D({}),c=D({}),m=D({}),b=D("actions"),I=D(""),j=D(!1),$=D(""),X=D(""),ae=D(null),z=D(!1),J=D(""),ne=D(""),ke=D(null),me=D(null),ge=D(null);let je=null,le=null;const re=D(""),de=D({}),te=new Map,Pe=new Map,Je=new Map,He=new WeakMap,ze=D(null),We=D(null),Me=D(!1),Ae=D(gt()),qe=typeof window<"u"?new ResizeObserver(S=>{for(const R of S){const P=R.target,Z=He.get(P);Z&&hn(Z,P)}}):null;function Fe(){if(typeof window>"u")return{};try{const S=window.localStorage.getItem(hu);if(!S)return{};const R=JSON.parse(S);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function gt(){return typeof window>"u"?"project":window.localStorage.getItem(fu)==="chronological"?"chronological":"project"}o.value=Fe(),ht(o,S=>{typeof window>"u"||window.localStorage.setItem(hu,JSON.stringify(S))},{deep:!0}),ht(Ae,S=>{typeof window>"u"||window.localStorage.setItem(fu,S)});const Ht=fe(()=>n.searchQuery.trim().toLowerCase()),ut=fe(()=>Ht.value.length>0),lt=fe(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Qe(S){if(!ut.value)return!0;if(lt.value)return lt.value.has(S.id);const R=Ht.value;return S.title.toLowerCase().includes(R)||S.preview.toLowerCase().includes(R)}const W=fe(()=>ut.value?n.groups.map(S=>({...S,threads:S.threads.filter(Qe)})).filter(S=>S.threads.length>0):n.groups),we=fe(()=>Ae.value==="chronological"),ue=fe(()=>{const S=W.value,R=[];for(const P of S)for(const Z of P.threads)F(Z.id)||R.push(Z);return R.sort((P,Z)=>{const Ue=new Date(P.updatedAtIso||P.createdAtIso).getTime();return new Date(Z.updatedAtIso||Z.createdAtIso).getTime()-Ue})}),ve=fe(()=>{const S=new Map;for(const R of n.groups)for(const P of R.threads)S.set(P.id,P);return S}),xe=fe(()=>{const S=l.value;return S?ve.value.get(S)??null:null}),T=fe(()=>i.value.map(S=>ve.value.get(S)??null).filter(S=>S!==null).filter(Qe)),E=fe(()=>{const S=ge.value;if(!S||S.dropTargetIndexFull===null||n.groups.length===0)return null;const R=Math.max(0,Math.min(S.dropTargetIndexFull,n.groups.length)),P=R>S.fromIndex?R-1:R,Z=Math.max(0,Math.min(P,n.groups.length-1));return Z===S.fromIndex?null:Z}),O=fe(()=>{const R=(ut.value?W.value:n.groups).map(Xt=>Xt.projectName),P=ge.value,Z=E.value;if(!P||Z===null)return R;const Ue=[...R],[Ct]=Ue.splice(P.fromIndex,1);return Ct?(Ue.splice(Z,0,Ct),Ue):R}),V=fe(()=>{const S={};let R=0;for(const P of O.value)S[P]=R,R+=Bn(P);return S}),G=fe(()=>{let S=0;for(const R of O.value)S+=Bn(R);return{height:`${Math.max(0,S)}px`}});function N(S){const R=new Date(S).getTime();if(Number.isNaN(R))return"n/a";const P=Math.abs(Date.now()-R);if(P<6e4)return"now";const Z=Math.floor(P/6e4);if(Z<60)return`${Z}m`;const Ue=Math.floor(Z/60);return Ue<24?`${Ue}h`:`${Math.floor(Ue/24)}d`}function F(S){return i.value.includes(S)}function B(S){if(F(S)){i.value=i.value.filter(R=>R!==S);return}i.value=[S,...i.value]}function ee(S){r("select",S)}function Q(S){r("export-thread",S),Ce()}function Ee(S){return`start new thread ${Lt(S)}`}function be(S){r("start-new-thread",S)}function Te(S){return l.value===S}function Ce(){l.value="",m.value={}}function Ge(S){if(l.value===S){Ce();return}ft(),Me.value=!1,l.value=S,nn(()=>{Re(S)})}function ot(S,R){$.value=S,X.value=R,j.value=!0,Ce(),nn(()=>{var P,Z;(P=ae.value)==null||P.focus(),(Z=ae.value)==null||Z.select()})}function Ve(){j.value=!1,$.value="",X.value=""}function dt(){const S=$.value,R=X.value.trim();!S||!R||(r("rename-thread",{threadId:S,title:R}),Ve())}function pt(S,R){J.value=S,ne.value=R,z.value=!0,Ce()}function Et(){z.value=!1,J.value="",ne.value=""}function Be(){const S=J.value;S&&(i.value=i.value.filter(R=>R!==S),r("archive",S),Et())}function Lt(S){return n.projectDisplayNameById[S]??S}function Tt(S){return a.value===S}function ft(){a.value="",b.value="actions",I.value=""}function ct(){const S=!Me.value;S&&(ft(),Ce()),Me.value=S}function vt(S){Ae.value=S,Me.value=!1}function Gt(S){if(a.value===S){ft();return}Ce(),Me.value=!1,a.value=S,b.value="actions",I.value=Lt(S),nn(()=>{an(S)})}function $t(S){Ce(),a.value=S,b.value="rename",I.value=Lt(S),nn(()=>{an(S)})}function Bt(S){r("rename-project",{projectName:S,displayName:I.value})}function On(S){r("remove-project",S),ft()}function Yt(S){r("browse-project-files",S),ft()}function _n(S,R){if(!S.altKey||S.key!=="ArrowUp"&&S.key!=="ArrowDown")return;const P=n.groups.findIndex(Ct=>Ct.projectName===R);if(P<0)return;const Z=S.key==="ArrowUp"?-1:1,Ue=Math.max(0,Math.min(P+Z,n.groups.length-1));Ue!==P&&(S.preventDefault(),r("reorder-project",{projectName:R,toIndex:Ue}))}function Qt(S){return s.value[S]===!0}function Kt(S){return o.value[S]===!0}function en(S){s.value={...s.value,[S]:!Qt(S)}}function un(S){if(re.value===S){re.value="";return}o.value={...o.value,[S]:!Kt(S)}}function Bn(S){const R=de.value[S]??0,P=ge.value,Ue=((P==null?void 0:P.projectName)===S?P.groupHeight:null)??R,Ct=Kt(S)?0:du;return Math.max(0,Ue+Ct)}function kn(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Pe.set(S,P);return}Pe.delete(S)}function dn(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Je.set(S,P);return}Je.delete(S)}function fn(S){let R=S.parentElement;for(;R;){const P=window.getComputedStyle(R),Z=P.overflowY||P.overflow;if(Z==="auto"||Z==="scroll"||Z==="hidden"||Z==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function qn(S,R){const P=S.getBoundingClientRect(),Z=fn(S),Ue=6,Ct=Z.bottom-P.bottom,Xt=P.top-Z.top;return Ct>=R+Ue?"down":Xt>Ct?"up":"down"}function Zn(S,R){const P=Je.get(S);if(!P)return"down";const Z=qn(P,R);return c.value={...c.value,[S]:Z},Z}function Ut(S){return c.value[S]??"down"}function an(S){const R=Pe.get(S);R&&(d.value={...d.value,[S]:qn(R,112)})}function $e(S,R,P){return Math.min(Math.max(S,R),P)}function Re(S){const R=Je.get(S);if(!R)return;const P=We.value,Z=P==null?void 0:P.getBoundingClientRect(),Ue=(Z==null?void 0:Z.height)||(P==null?void 0:P.offsetHeight)||112,Ct=(Z==null?void 0:Z.width)||(P==null?void 0:P.offsetWidth)||160,Xt=Zn(S,Ue),En=R.getBoundingClientRect(),f=8,g=4,h=Math.max(f,window.innerWidth-Ct-f),x=$e(En.right-Ct,f,h),M=$e(Xt==="up"?En.top-Ue-g:En.bottom+g,f,Math.max(f,window.innerHeight-Ue-f));m.value={left:`${Math.round(x)}px`,top:`${Math.round(M)}px`}}function Tn(){const S=l.value;S&&Re(S)}function zt(){window.addEventListener("resize",Tn),document.addEventListener("scroll",Tn,!0)}function Nn(){window.removeEventListener("resize",Tn),document.removeEventListener("scroll",Tn,!0)}function er(S){const R=a.value;if(!R)return!1;const P=Pe.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Ue=S.target;return Ue instanceof Node?P.contains(Ue):!1}function Ln(S){const R=l.value;if(!R)return!1;const P=Je.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Ue=S.target;return Ue instanceof Node?P.contains(Ue):!1}function Sn(S){if(Me.value){const R=ze.value,P=typeof S.composedPath=="function"?S.composedPath():[];!!R&&(P.includes(R)||S.target instanceof Node&&R.contains(S.target))||(Me.value=!1)}a.value&&(er(S)||ft(),l.value&&(Ln(S)||Ce()))}function Gn(S){a.value&&!er(S)&&ft(),l.value&&!Ln(S)&&Ce()}function Dn(){Me.value&&(Me.value=!1),a.value&&ft(),l.value&&Ce()}function Un(){window.addEventListener("pointerdown",Sn,{capture:!0}),window.addEventListener("focusin",Gn,{capture:!0}),window.addEventListener("blur",Dn)}function Kn(){window.removeEventListener("pointerdown",Sn,{capture:!0}),window.removeEventListener("focusin",Gn,{capture:!0}),window.removeEventListener("blur",Dn)}function hn(S,R){const P=R.getBoundingClientRect().height;if(!Number.isFinite(P)||P<=0)return;const Z=de.value[S];Z!==void 0&&Math.abs(Z-P)<.5||(de.value={...de.value,[S]:P})}function A(S,R){const P=te.get(S);P&&P!==R&&qe&&qe.unobserve(P);const Z=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(Z){te.set(S,Z),He.set(Z,S),hn(S,Z),qe==null||qe.observe(Z);return}P&&(qe==null||qe.unobserve(P)),te.delete(S)}function U(S,R){if(S.button!==0||me.value||ge.value)return;const P=n.groups.findIndex(Xt=>Xt.projectName===R),Z=te.get(R);if(P<0||!Z)return;const Ue=Z.getBoundingClientRect(),Ct=Kt(R)?0:du;me.value={projectName:R,fromIndex:P,startClientX:S.clientX,startClientY:S.clientY,pointerOffsetY:S.clientY-Ue.top,groupLeft:Ue.left,groupWidth:Ue.width,groupHeight:Ue.height,groupOuterHeight:Ue.height+Ct},S.preventDefault(),se()}function se(){window.addEventListener("mousemove",it),window.addEventListener("mouseup",wt),window.addEventListener("keydown",mt)}function Ne(){window.removeEventListener("mousemove",it),window.removeEventListener("mouseup",wt),window.removeEventListener("keydown",mt)}function it(S){je={clientX:S.clientX,clientY:S.clientY},In()}function wt(S){Hn({clientX:S.clientX,clientY:S.clientY});const R=ge.value;if(R&&E.value!==null){const P=n.groups.findIndex(Z=>Z.projectName===R.projectName);if(P>=0){const Z=E.value;Z!==P&&r("reorder-project",{projectName:R.projectName,toIndex:Z})}}Wt()}function mt(S){S.key==="Escape"&&(!me.value&&!ge.value||(S.preventDefault(),Wt()))}function Wt(){le!==null&&(window.cancelAnimationFrame(le),le=null),je=null,me.value=null,ge.value=null,re.value="",Ne()}function In(){le===null&&(le=window.requestAnimationFrame(()=>{if(le=null,!je)return;const S=je;je=null,Hn(S)}))}function Hn(S){const R=me.value;if(!ge.value&&R){const P=S.clientX-R.startClientX,Z=S.clientY-R.startClientY;if(Math.hypot(P,Z)<bw)return;ft(),re.value=R.projectName,ge.value={projectName:R.projectName,fromIndex:R.fromIndex,pointerOffsetY:R.pointerOffsetY,groupLeft:R.groupLeft,groupWidth:R.groupWidth,groupHeight:R.groupHeight,groupOuterHeight:R.groupOuterHeight,ghostTop:S.clientY-R.pointerOffsetY,dropTargetIndexFull:null}}ge.value&&fr(S)}function fr(S){const R=ge.value;if(!R)return;if(R.ghostTop=S.clientY-R.pointerOffsetY,!fs(S)){R.dropTargetIndexFull=null;return}const P=S.clientY,Z=ke.value;if(!Z){R.dropTargetIndexFull=null;return}const Ue=Z.getBoundingClientRect(),Ct=new Map(n.groups.map((g,h)=>[g.projectName,h])),Xt=n.groups.map(g=>g.projectName).filter(g=>g!==R.projectName);let En=0,f=n.groups.length;for(const g of Xt){const h=Ct.get(g);if(h===void 0)continue;const x=Bn(g),M=Ue.top+En+x/2;if(P<M){f=h;break}En+=x}R.dropTargetIndexFull=f}function fs(S){const R=ke.value;if(!R)return!1;const P=R.getBoundingClientRect(),Z=S.clientX>=P.left&&S.clientX<=P.right,Ue=S.clientY>=P.top-32&&S.clientY<=P.bottom+32;return Z&&Ue}function tr(S){var R;return((R=ge.value)==null?void 0:R.projectName)===S}function hr(S){const R=ge.value,P=V.value[S]??0,Z=a.value===S;return!R||R.projectName!==S?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Z?"40":"1",transform:`translate3d(0, ${P}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${R.groupLeft}px`,width:`${R.groupWidth}px`,height:`${R.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${R.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Wn(S){return S.threads.filter(R=>!F(R.id))}function nr(S){if(ut.value)return Wn(S);if(Kt(S.projectName))return[];const R=Wn(S);return Qt(S.projectName)?R:R.slice(0,10)}function Jr(S){return ut.value?!1:!Kt(S.projectName)&&Wn(S).length>10}function hs(S){return Wn(S).length>0}function Cr(S){return S.inProgress?"working":S.unread?"unread":"idle"}ht(()=>n.groups.map(S=>S.projectName),S=>{var Ue,Ct;const R=((Ue=ge.value)==null?void 0:Ue.projectName)??((Ct=me.value)==null?void 0:Ct.projectName)??"";R&&!n.groups.some(Xt=>Xt.projectName===R)&&Wt();const P=new Set(S),Z=Object.fromEntries(Object.entries(de.value).filter(([Xt])=>P.has(Xt)));Object.keys(Z).length!==Object.keys(de.value).length&&(de.value=Z)});const Ar=fe(()=>Me.value||a.value!==""||l.value!=="");return ht(Ar,S=>{if(S){Un();return}Kn()}),ht(l,S=>{if(!S){Nn();return}zt(),nn(()=>{Re(S)})}),Kr(()=>{for(const S of te.values())qe==null||qe.unobserve(S);te.clear(),Pe.clear(),Nn(),Kn(),Wt()}),(S,R)=>(y(),k("section",my,[T.value.length>0?(y(),k("section",gy,[v("ul",vy,[(y(!0),k(Oe,null,yt(T.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":Te(P.id)?"true":"false"},[De(bs,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":F(P.id),"data-menu-open":Te(P.id)?"true":"false","force-right-hover":Te(P.id)},{left:xt(()=>[v("span",wy,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(P)},null,8,by)):he("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Z=>B(P.id)},[De(ga,{class:"thread-icon"})],8,_y)])]),right:xt(()=>[v("span",Iy,K(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":xt(()=>[v("div",{ref_for:!0,ref:Z=>dn(P.id,Z),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:St(Z=>Ge(P.id),["stop"])},[De(co,{class:"thread-icon"})],8,Ey)],512)]),default:xt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Z=>ee(P.id)},[v("span",Ty,[v("span",Sy,K(P.title),1),P.hasWorktree?(y(),_t(ui,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):he("",!0)])],8,ky)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,yy))),128))])])):he("",!0),De(bs,{as:"header",class:"thread-tree-header-row"},{right:xt(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:ze,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Me.value,"aria-label":"Organize threads",title:"Organize threads",onClick:ct},[De(co,{class:"thread-icon"})],8,Cy),Me.value?(y(),k("div",{key:0,class:"organize-menu-panel",onClick:R[2]||(R[2]=St(()=>{},["stop"]))},[R[12]||(R[12]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":Ae.value==="project",type:"button",onClick:R[0]||(R[0]=P=>vt("project"))},[R[10]||(R[10]=v("span",null,"By project",-1)),Ae.value==="project"?(y(),k("span",xy,"✓")):he("",!0)],8,Ay),v("button",{class:"organize-menu-item","data-active":Ae.value==="chronological",type:"button",onClick:R[1]||(R[1]=P=>vt("chronological"))},[R[11]||(R[11]=v("span",null,"Chronological list",-1)),Ae.value==="chronological"?(y(),k("span",Py,"✓")):he("",!0)],8,Ry)])):he("",!0)],512)]),default:xt(()=>[R[13]||(R[13]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),ut.value&&W.value.length===0?(y(),k("p",My,"No matching threads")):e.isLoading&&e.groups.length===0?(y(),k("p",$y,"Loading threads...")):we.value?(y(),k("ul",Oy,[(y(!0),k(Oe,null,yt(ue.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":Te(P.id)?"true":"false"},[De(bs,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":F(P.id),"data-menu-open":Te(P.id)?"true":"false","force-right-hover":Te(P.id)},{left:xt(()=>[v("span",Ly,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(P)},null,8,Dy)):he("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Z=>B(P.id)},[De(ga,{class:"thread-icon"})],8,jy)])]),right:xt(()=>[v("span",Hy,K(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":xt(()=>[v("div",{ref_for:!0,ref:Z=>dn(P.id,Z),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:St(Z=>Ge(P.id),["stop"])},[De(co,{class:"thread-icon"})],8,Wy)],512)]),default:xt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Z=>ee(P.id)},[v("span",By,[v("span",Uy,K(P.title),1),P.hasWorktree?(y(),_t(ui,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):he("",!0)])],8,Fy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Ny))),128))])):(y(),k("div",{key:4,ref_key:"groupsContainerRef",ref:ke,class:"thread-tree-groups",style:is(G.value)},[(y(!0),k(Oe,null,yt(W.value,P=>(y(),k("article",{key:P.projectName,ref_for:!0,ref:Z=>A(P.projectName,Z),class:"project-group","data-project-name":P.projectName,"data-expanded":!Kt(P.projectName),"data-dragging":tr(P.projectName),style:is(hr(P.projectName))},[De(bs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Z=>un(P.projectName),onKeydown:[Z=>_n(Z,P.projectName),Pn(St(Z=>un(P.projectName),["prevent"]),["enter"]),Pn(St(Z=>un(P.projectName),["prevent"]),["space"])]},{left:xt(()=>[v("span",zy,[v("span",qy,[Kt(P.projectName)?(y(),_t(Bl,{key:0,class:"thread-icon"})):(y(),_t(ny,{key:1,class:"thread-icon"}))]),v("span",Gy,[Kt(P.projectName)?(y(),_t(Uf,{key:0,class:"thread-icon"})):(y(),_t(zi,{key:1,class:"thread-icon"}))])])]),right:xt(()=>[v("div",Yy,[v("div",{ref_for:!0,ref:Z=>kn(P.projectName,Z),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:St(Z=>Gt(P.projectName),["stop"])},[De(co,{class:"thread-icon"})],8,Qy),Tt(P.projectName)?(y(),k("div",{key:0,class:"project-menu-panel","data-open-direction":d.value[P.projectName]??"down",onClick:R[4]||(R[4]=St(()=>{},["stop"]))},[b.value==="actions"?(y(),k(Oe,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:Z=>Yt(P.projectName)}," Browse files ",8,Zy),v("button",{class:"project-menu-item",type:"button",onClick:Z=>$t(P.projectName)}," Edit name ",8,ew),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Z=>On(P.projectName)}," Remove ",8,tw)],64)):(y(),k(Oe,{key:1},[R[14]||(R[14]=v("label",{class:"project-menu-label"},"Project name",-1)),Hr(v("input",{"onUpdate:modelValue":R[3]||(R[3]=Z=>I.value=Z),class:"project-menu-input",type:"text",onInput:Z=>Bt(P.projectName)},null,40,nw),[[Wr,I.value]])],64))],8,Xy)):he("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Ee(P.projectName),title:Ee(P.projectName),onClick:St(Z=>be(P.projectName),["stop"])},[De(Ti,{class:"thread-icon"})],8,rw)])]),default:xt(()=>[v("span",{class:"project-main-button","data-dragging-handle":tr(P.projectName),onMousedown:St(Z=>U(Z,P.projectName),["left"])},[v("span",Jy,K(Lt(P.projectName)),1)],40,Ky)]),_:2},1032,["onClick","onKeydown"]),hs(P)?(y(),k("ul",sw,[(y(!0),k(Oe,null,yt(nr(P),Z=>(y(),k("li",{key:Z.id,class:"thread-row-item","data-menu-open":Te(Z.id)?"true":"false"},[De(bs,{class:"thread-row","data-active":Z.id===e.selectedThreadId,"data-pinned":F(Z.id),"data-menu-open":Te(Z.id)?"true":"false","force-right-hover":Te(Z.id)},{left:xt(()=>[v("span",iw,[Z.inProgress||Z.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Cr(Z)},null,8,aw)):he("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Ue=>B(Z.id)},[De(ga,{class:"thread-icon"})],8,lw)])]),right:xt(()=>[v("span",fw,K(N(Z.createdAtIso||Z.updatedAtIso)),1)]),"right-hover":xt(()=>[v("div",{ref_for:!0,ref:Ue=>dn(Z.id,Ue),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:St(Ue=>Ge(Z.id),["stop"])},[De(co,{class:"thread-icon"})],8,hw)],512)]),default:xt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Ue=>ee(Z.id)},[v("span",uw,[v("span",dw,K(Z.title),1),Z.hasWorktree?(y(),_t(ui,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):he("",!0)])],8,cw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,ow))),128))])):(y(),_t(bs,{key:1,as:"p",class:"project-empty-row"},{left:xt(()=>[...R[15]||(R[15]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:xt(()=>[R[16]||(R[16]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),Jr(P)?(y(),_t(bs,{key:2,class:"thread-show-more-row"},{left:xt(()=>[...R[17]||(R[17]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:xt(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:Z=>en(P.projectName)},K(Qt(P.projectName)?"Show less":"Show more"),9,pw)]),_:2},1024)):he("",!0)],12,Vy))),128))],4)),(y(),_t(vo,{to:"body"},[xe.value?(y(),k("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:We,class:"thread-menu-panel thread-menu-panel-fixed",style:is(m.value),"data-open-direction":Ut(xe.value.id),onClick:R[8]||(R[8]=St(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:R[5]||(R[5]=P=>Q(xe.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:R[6]||(R[6]=P=>ot(xe.value.id,xe.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[7]||(R[7]=P=>pt(xe.value.id,xe.value.title))}," Delete thread ")],12,mw)):he("",!0)])),(y(),_t(vo,{to:"body"},[j.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:St(Ve,["self"])},[v("div",gw,[R[18]||(R[18]=v("h3",{class:"rename-thread-title"},"Rename thread",-1)),R[19]||(R[19]=v("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Hr(v("input",{ref_key:"renameThreadInputRef",ref:ae,"onUpdate:modelValue":R[9]||(R[9]=P=>X.value=P),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[Pn(St(dt,["prevent"]),["enter"]),Pn(St(Ve,["prevent"]),["esc"])]},null,40,vw),[[Wr,X.value]]),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Ve},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:dt},"Save")])])])):he("",!0)])),(y(),_t(vo,{to:"body"},[z.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:St(Et,["self"])},[v("div",yw,[R[20]||(R[20]=v("h3",{class:"rename-thread-title"},"Delete thread?",-1)),v("p",ww,' This will archive the thread "'+K(ne.value)+'". You can find it later in archived threads. ',1),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Et},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Be},"Delete")])])])):he("",!0)]))]))}}),kw=kt(_w,[["__scopeId","data-v-2e1439c4"]]),Tw={class:"content-header"},Sw={class:"content-leading"},Iw={class:"content-title"},Ew={class:"content-actions"},Cw=on({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(y(),k("header",Tw,[v("div",Sw,[Tr(t.$slots,"leading",{},void 0)]),v("h1",Iw,K(e.title),1),v("div",Ew,[Tr(t.$slots,"actions",{},void 0)])]))}}),Aw=kt(Cw,[["__scopeId","data-v-66ee223c"]]),xw={},Rw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Pw(e,t){return y(),k("svg",Rw,[...t[0]||(t[0]=[v("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 Hf=kt(xw,[["render",Pw]]),Mw={},$w={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ow(e,t){return y(),k("svg",$w,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ul=kt(Mw,[["render",Ow]]),Nw={class:"conversation-root"},Lw={key:0,class:"conversation-loading"},Dw={key:1,class:"conversation-empty"},jw=["data-role","data-message-type"],Fw={key:0,class:"message-row","data-role":"system"},Bw={class:"message-stack","data-role":"system"},Uw=["onClick"],Hw={class:"cmd-group-label"},Ww={class:"cmd-status"},Vw={class:"cmd-group-inner"},zw=["onClick"],qw={class:"cmd-label"},Gw={class:"cmd-status"},Kw={class:"cmd-output-inner"},Jw=["textContent"],Yw=["onClick"],Qw={class:"cmd-label"},Xw={class:"cmd-status"},Zw={class:"cmd-output-inner"},eb=["textContent"],tb=["data-role","data-message-type"],nb=["data-role"],rb=["data-role"],sb=["data-role"],ob=["onClick"],ib=["src"],ab={key:1,class:"message-file-attachments"},lb=["href","title"],cb=["data-role"],ub={key:0,class:"worked-separator-wrap","aria-live":"polite"},db=["onClick"],fb={class:"worked-separator-text"},hb={key:0,class:"worked-details"},pb=["onClick"],mb={class:"cmd-label"},gb={class:"cmd-status"},vb={class:"cmd-output-inner"},yb=["textContent"],wb=["data-streaming"],bb={class:"plan-card-header"},_b={key:0,class:"plan-card-badge"},kb=["innerHTML"],Tb={key:1,class:"plan-step-list"},Sb=["data-status"],Ib=["data-status"],Eb=["innerHTML"],Cb=["innerHTML"],Ab={key:2,class:"message-text-flow"},xb={key:0,class:"message-text"},Rb={key:0},Pb={key:1,class:"message-bold-text"},Mb={key:2,class:"message-italic-text"},$b={key:3,class:"message-strikethrough-text"},Ob=["href","title"],Nb=["href","title"],Lb={key:6,class:"message-inline-code"},Db={key:0},jb={key:1,class:"message-bold-text"},Fb={key:2,class:"message-italic-text"},Bb={key:3,class:"message-strikethrough-text"},Ub=["href","title"],Hb=["href","title"],Wb={key:6,class:"message-inline-code"},Vb={key:2,class:"message-blockquote"},zb={key:0},qb={key:1,class:"message-bold-text"},Gb={key:2,class:"message-italic-text"},Kb={key:3,class:"message-strikethrough-text"},Jb=["href","title"],Yb=["href","title"],Qb={key:6,class:"message-inline-code"},Xb={key:3,class:"message-list message-list-unordered"},Zb=["innerHTML"],e_={key:4,class:"message-list message-task-list"},t_=["data-checked"],n_={class:"message-list-item-text"},r_={key:0},s_={key:1,class:"message-bold-text"},o_={key:2,class:"message-italic-text"},i_={key:3,class:"message-strikethrough-text"},a_=["href","title"],l_=["href","title"],c_={key:6,class:"message-inline-code"},u_={key:5,class:"message-list message-list-ordered"},d_=["innerHTML"],f_={key:6,class:"message-code-block"},h_={key:0,class:"message-code-language"},p_={class:"message-code-pre"},m_={key:7,class:"message-divider"},g_={key:8,class:"message-text"},v_=["onClick"],y_=["src","alt","onError"],w_={key:0,class:"conversation-item conversation-item-overlay"},b_={class:"message-row"},__={class:"message-stack"},k_={class:"live-overlay-inline","aria-live":"polite"},T_={class:"live-overlay-label"},S_={key:1,class:"live-overlay-error"},I_={class:"message-row"},E_={class:"message-stack"},C_={class:"request-card"},A_={class:"request-title"},x_={class:"request-meta"},R_={key:0,class:"request-reason"},P_={key:1,class:"request-actions"},M_=["onClick"],$_=["onClick"],O_=["onClick"],N_=["onClick"],L_={key:2,class:"request-actions"},D_=["onClick"],j_=["onClick"],F_=["onClick"],B_=["onClick"],U_={key:3,class:"request-user-input"},H_={class:"request-question-title"},W_={key:0,class:"request-question-text"},V_=["value","onChange"],z_=["value"],q_={key:2,class:"request-question-option-description"},G_=["type","value","placeholder","onInput"],K_=["type","value","onInput"],J_=["onClick"],Y_={key:4,class:"request-actions"},Q_=["onClick"],X_=["onClick"],Z_={key:5,class:"request-actions"},ek=["onClick"],tk=["onClick"],nk=["src"],rk=16,sk=on({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","respondServerRequest"],setup(e,{emit:t}){var En;const n=D(new Set),r=D(new Set),s=D(new Set),o=D(new Set);function i(f){var M;const g=f.replace(/\r\n/g,`
26
- `).trim();if(!g)return null;const h=[],x=[];for(const H of g.split(`
27
- `)){const ye=H.trim();if(!ye){h.length===0&&x.push("");continue}const q=ye.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(q){const Se=(q[1]??" ").toLowerCase();let Le="pending";Se==="x"&&(Le="completed"),(Se==="~"||Se===">"||Se==="-")&&(Le="inProgress"),h.push({step:((M=q[2])==null?void 0:M.trim())??"",status:Le});continue}x.push(ye)}return h.length===0?null:{explanation:x.join(`
28
- `).trim(),steps:h.filter(H=>H.step.length>0)}}function a(f){var g;return f.plan&&f.plan.steps.length>0?{explanation:((g=f.plan.explanation)==null?void 0:g.trim())??"",steps:f.plan.steps}:i(f.text)}function l(f){return f.messageType==="commandExecution"&&!!f.commandExecution}function d(f){return f.messageType==="plan"||f.messageType==="plan.live"}const c=fe(()=>{var f;for(let g=Ae.messages.length-1;g>=0;g-=1){const h=Ae.messages[g];if(h.messageType==="commandExecution"&&((f=h.commandExecution)==null?void 0:f.status)==="inProgress")return h.id}return""}),m=fe(()=>Ae.messages.some(f=>f.role==="assistant"&&f.messageType==="agentMessage.live"&&f.text.trim().length>0)),b=fe(()=>!!Ae.liveOverlay||c.value.length>0||m.value),I=fe(()=>{const f={};for(let g=0;g<Ae.messages.length;){const h=Ae.messages[g];if(!l(h)){g+=1;continue}const x=[];for(;g<Ae.messages.length&&l(Ae.messages[g]);)x.push(Ae.messages[g]),g+=1;if(x.length<=1)continue;const M=x[x.length-1];f[M.id]=x.slice(0,-1)}return f}),j=fe(()=>{const f=new Set;for(const g of Object.values(I.value))for(const h of g)f.add(h.id);return f});function $(f){var g;return((g=a(f))==null?void 0:g.explanation)??""}function X(f){var g;return((g=a(f))==null?void 0:g.steps)??[]}function ae(f){switch(f){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function z(f){return!m.value&&f.id===c.value}function J(f){return l(f)?n.value.has(f.id)||!r.value.has(f.id)&&z(f):!1}function ne(f){return l(f)&&b.value}function ke(f){var g;return l(f)&&(b.value||((g=f.commandExecution)==null?void 0:g.status)==="inProgress")}function me(f){if(!l(f))return;const g=new Set(n.value),h=new Set(r.value),x=z(f);g.has(f.id)?(g.delete(f.id),x&&h.add(f.id)):x&&!h.has(f.id)?h.add(f.id):(g.add(f.id),h.delete(f.id)),n.value=g,r.value=h}function ge(f){return I.value[f.id]??[]}function je(f){return l(f)?[...ge(f),f]:[]}function le(f){if(ge(f).length===0)return;const h=new Set(s.value);h.has(f.id)?h.delete(f.id):h.add(f.id),s.value=h}function re(f){return s.value.has(f.id)}function de(f){var H,ye;const h=je(f).length,x=((ye=(H=f.commandExecution)==null?void 0:H.command)==null?void 0:ye.trim())||"(command)";return`${h===1?"1 command":`${h} commands`} · latest: ${x}`}function te(f){return He(f)}function Pe(f){const g=new Set(o.value);g.has(f.id)?g.delete(f.id):g.add(f.id),o.value=g}function Je(f){return o.value.has(f.id)}function He(f){const g=f.commandExecution;if(!g)return"";const h=ne(f);switch(g.status){case"inProgress":return h?"Running":"⟳ Running";case"completed":return g.exitCode===0?h?"Done":"✓ Completed":`Exit ${g.exitCode??"?"}`;case"failed":return h?"Failed":"✗ Failed";case"declined":return h?"Declined":"⊘ Declined";case"interrupted":return h?"Stopped":"⊘ Interrupted";default:return""}}function ze(f){var h,x;const g=(h=f.commandExecution)==null?void 0:h.status;return g==="inProgress"?"cmd-status-running":g==="completed"&&((x=f.commandExecution)==null?void 0:x.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function We(f,g){if(f.size===0)return f;const h=new Set;for(const x of f)g.has(x)&&h.add(x);return h.size===f.size?f:h}function Me(f,g){const h=[];for(let x=g-1;x>=0;x--){const M=f[x];if(M.messageType==="commandExecution")h.unshift(M);else if(M.role==="user"||M.messageType==="worked")break}return h}const Ae=e,qe=t,Fe=D(null),gt=D(null),Ht=D(null),ut=D(""),lt=D({}),Qe=D({}),W=D(((En=Ae.scrollState)==null?void 0:En.isAtBottom)!==!1);let we=0,ue=0,ve=0;const xe=new WeakSet,T=D(new Set),E=fe(()=>!W.value&&(Ae.messages.length>0||Ae.pendingRequests.length>0||!!Ae.liveOverlay));function O(f){if(!f||/\s/u.test(f)||f.endsWith("/")||f.endsWith("\\"))return!1;if(f.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(f))return!1;const g=f.startsWith("/"),h=/^[A-Za-z]:[\\/]/u.test(f),x=f.startsWith("./")||f.startsWith("../")||f.startsWith("~/"),M=f.includes("/")||f.includes("\\");return g||h||x||M}function V(f){return f.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||f}function G(f){return f.replace(/\\/gu,"/")}function N(f){if(!f.startsWith("file://"))return f;let g=f.replace(/^file:\/\//u,"");try{g=decodeURIComponent(g)}catch{}return/^\/[A-Za-z]:\//u.test(g)&&(g=g.slice(1)),g}function F(f){const g=G(f),h=g.match(/^\/Users\/([^/]+)/u);if(h)return`/Users/${h[1]}`;const x=g.match(/^\/home\/([^/]+)/u);return x?`/home/${x[1]}`:""}function B(f){const g=G(f);if(!g)return g;let h="",x=g;const M=x.match(/^([A-Za-z]:)(\/.*)?$/u);M?(h=`${M[1]}/`,x=(M[2]??"").replace(/^\/+/u,"")):x.startsWith("/")&&(h="/",x=x.slice(1));const H=x.split("/").filter(Boolean),ye=[];for(const Se of H)if(Se!=="."){if(Se===".."){ye.length>0&&ye.pop();continue}ye.push(Se)}const q=ye.join("/");return h?`${h}${q}`.replace(/\/+$/u,"")||h:q||g}function ee(f,g){const h=G(N(f.trim()));if(!h)return"";if(h.startsWith("/")||/^[A-Za-z]:\//u.test(h))return B(h);if(h.startsWith("~/")){const H=F(g);if(H)return B(`${H}/${h.slice(2)}`)}const M=G(g.trim());return B(M?`${M.replace(/\/+$/u,"")}/${h}`:h)}function Q(f){if(!f)return null;let g=f.trim();g=Ee(g).core.trim();let x=null;const M=g.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(M)g=M[1],x=Number(M[2]);else{const H=g.match(/^(.*):(\d+)(?::\d+)?$/u);H&&(g=H[1],x=Number(H[2]))}return g=N(g),O(g)?{path:g,line:x}:null}function Ee(f){let g=f,h="",x="";for(;/^[('"`[{<“‘]/u.test(g);)h+=g[0],g=g.slice(1);for(;/[)"'`\]}>”’]$/u.test(g);)x=g.slice(-1)+x,g=g.slice(0,-1);return{core:g,leading:h,trailing:x}}function be(f){const h=f.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!h)return null;const x=(h[1]??"").trim(),M=(h[2]??"").trim(),H=Ee(x).core.trim()||x,ye=Ee(M).core.trim();return ye?{label:H,target:ye}:null}function Te(f){const g=Math.min(6,Math.max(1,Math.trunc(f)));return`h${String(g)}`}function Ce(f){switch(Math.min(6,Math.max(1,Math.trunc(f)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function Ge(f){const g=[],h=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let x=0;for(const M of f.matchAll(h)){if(typeof M.index!="number")continue;const H=M.index,ye=H+M[0].length;H>x&&g.push({kind:"text",value:f.slice(x,H)});let q=M[0],Se="";for(;/[.,;:]$/u.test(q);)Se=q.slice(-1)+Se,q=q.slice(0,-1);const Le=Ee(q);q=Le.core;const Ze=Le.leading,Dt=Le.trailing+Se;if(Ze&&g.push({kind:"text",value:Ze}),q.startsWith("**")&&q.endsWith("**")&&q.length>4)g.push({kind:"bold",value:q.slice(2,-2)}),Dt&&g.push({kind:"text",value:Dt});else if(/^https?:\/\//u.test(q))g.push({kind:"url",value:q,href:q}),Dt&&g.push({kind:"text",value:Dt});else{const bt=Q(q);bt?(g.push({kind:"file",value:q,path:bt.path,displayPath:q,downloadName:V(bt.path)}),Dt&&g.push({kind:"text",value:Dt})):g.push({kind:"text",value:M[0]})}x=ye}return x<f.length&&g.push({kind:"text",value:f.slice(x)}),Ve(g)}function ot(f,g){const h=[];let x=!1,M="";const H=ye=>{ye&&h.push({kind:"text",value:ye})};for(const ye of f){if(ye.kind!=="text"){x&&(H(`${g.marker}${M}`),x=!1,M=""),h.push(ye);continue}let q=ye.value;for(;q.length>0;){const Se=q.indexOf(g.marker);if(Se<0){x?M+=q:H(q);break}const Le=q.slice(0,Se);if(x?M+=Le:H(Le),q=q.slice(Se+g.marker.length),x){const Ze=M;Ze.length>0&&(!g.isValidContent||g.isValidContent(Ze))?h.push({kind:g.kind,value:Ze}):H(`${g.marker}${Ze}${g.marker}`),M="",x=!1}else x=!0}}return x&&H(`${g.marker}${M}`),h}function Ve(f){const g=x=>x.trim().length>0&&!/^\s/u.test(x)&&!/\s$/u.test(x);let h=ot(f,{marker:"**",kind:"bold",isValidContent:g});return h=ot(h,{marker:"~~",kind:"strikethrough",isValidContent:g}),h=ot(h,{marker:"*",kind:"italic",isValidContent:g}),h}function dt(f){const g=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,h=[];let x=0;for(const M of f.matchAll(g)){if(typeof M.index!="number")continue;const[H,ye,q]=M,Se=M.index,Le=Se+H.length;Se>x&&h.push(...Ge(f.slice(x,Se)));const Ze=be(`[${ye??""}](${q??""})`),Dt=(Ze==null?void 0:Ze.label)??(ye??"").trim(),bt=(Ze==null?void 0:Ze.target)??(q??"").trim();if(/^https?:\/\//u.test(bt))h.push({kind:"url",value:Dt||bt,href:bt});else{const Cn=Q(bt);Cn?h.push({kind:"file",value:bt,path:Cn.path,displayPath:Dt||bt,downloadName:V(Cn.path)}):h.push({kind:"text",value:H})}x=Le}return x<f.length&&h.push(...Ge(f.slice(x))),h}function pt(f){if(!f.includes("`"))return dt(f);const g=[];let h=0,x=0;for(;h<f.length;){if(f[h]!=="`"){h+=1;continue}let M=1;for(;h+M<f.length&&f[h+M]==="`";)M+=1;const H="`".repeat(M);let ye=h+M,q=-1;for(;ye<f.length;){const Le=f.indexOf(H,ye);if(Le<0)break;const Ze=Le>0&&f[Le-1]==="`",Dt=Le+M<f.length&&f[Le+M]==="`",bt=f.slice(h+M,Le).includes(`
29
- `);if(!Ze&&!Dt&&!bt){q=Le;break}ye=Le+1}if(q<0){h+=M;continue}h>x&&g.push(...dt(f.slice(x,h)));const Se=f.slice(h+M,q);if(Se.length>0){const Le=be(Se);if(Le)if(/^https?:\/\//u.test(Le.target))g.push({kind:"url",value:Le.label||Le.target,href:Le.target});else{const Ze=Q(Le.target);Ze?g.push({kind:"file",value:Le.target,path:Ze.path,displayPath:Le.label||Le.target,downloadName:V(Ze.path)}):g.push({kind:"code",value:Se})}else{const Ze=Q(Se);if(Ze){const Dt=Ze.line?`${Ze.path}:${String(Ze.line)}`:Ze.path;g.push({kind:"file",value:Se,path:Ze.path,displayPath:Dt,downloadName:V(Ze.path)})}else g.push({kind:"code",value:Se})}}else g.push({kind:"text",value:`${H}${H}`});h=q+M,x=h}return x<f.length&&g.push(...dt(f.slice(x))),g}function Et(f){const g=f.trim();if(!g)return"";if(g.startsWith("data:")||g.startsWith("blob:")||g.startsWith("http://")||g.startsWith("https://")||g.startsWith("/codex-local-image?"))return g;if(g.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(g)}`;const h=g.startsWith("/"),x=/^[A-Za-z]:[\\/]/u.test(g);return h||x?`/codex-local-image?path=${encodeURIComponent(g)}`:g}function Be(f){const g=f.trim();if(!g)return"#";const h=ye=>ye.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(ye),x=Q(g),M=(x==null?void 0:x.path)??g,H=ee(M,Ae.cwd);if(h(H)){const ye=H.startsWith("/")?H:`/${H}`;return`/codex-local-browse${encodeURI(ye)}`}return"#"}function Lt(f){return f.replace(/\r\n/gu,`
30
- `)}function Tt(f){var h;return(((h=f.match(/^\s*/u))==null?void 0:h[0])??"").replace(/\t/gu," ").length}function ft(f,g){if(g<=0)return f.trimStart();let h=0,x=0;for(;h<f.length&&x<g;){const M=f[h];x+=M===" "?4:1,h+=1}return f.slice(h)}function ct(f){return f.trim().length===0}function vt(f){const g=f.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return g?{level:g[1].length,value:g[2].trim()}:null}function Gt(f){const g=f.match(/^\s{0,3}>\s?(.*)$/u);return g?g[1]??"":null}function $t(f){var h;const g=f.match(/^\s*[-*+]\s+(.+)$/u);return((h=g==null?void 0:g[1])==null?void 0:h.trim())??null}function Bt(f){var h;const g=f.match(/^(\s*)[-*+]\s+(.+)$/u);return g?{indent:Tt(g[1]??""),text:((h=g[2])==null?void 0:h.trim())??""}:null}function On(f){var h;const g=f.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return g?{checked:(g[1]??" ").toLowerCase()==="x",text:((h=g[2])==null?void 0:h.trim())??""}:null}function Yt(f){var h;const g=f.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return g?{indent:Tt(g[1]??""),item:{checked:(g[2]??" ").toLowerCase()==="x",text:((h=g[3])==null?void 0:h.trim())??""}}:null}function _n(f){var h;const g=f.match(/^\s*\d+[.)]\s+(.+)$/u);return((h=g==null?void 0:g[1])==null?void 0:h.trim())??null}function Qt(f){var h;const g=f.match(/^(\s*)\d+[.)]\s+(.+)$/u);return g?{indent:Tt(g[1]??""),text:((h=g[2])==null?void 0:h.trim())??""}:null}function Kt(f){return ct(f)||dn(f)!==null||kn(f)||vt(f)!==null||Gt(f)!==null||On(f)!==null||$t(f)!==null||_n(f)!==null}function en(f,g,h=-1){const x=[];let M=g;for(;M<f.length&&!(Kt(f[M])||h>=0&&Tt(f[M])<=h);)x.push(h>=0?ft(f[M],h+1):f[M]),M+=1;const H=x.join(`
31
- `).trim();return H?{value:H,nextIndex:M}:null}function un(f,g,h){const x=[];let M=g;for(;M<f.length;){const H=f[M];if(ct(H)){const ye=f.findIndex((q,Se)=>Se>=M+1&&!ct(q));if(ye===-1){x.push(""),M=f.length;break}if(Tt(f[ye])<=h)break;x.push(""),M+=1;continue}if(Tt(H)<=h)break;x.push(ft(H,h+1)),M+=1}for(;x.length>0&&ct(x[0]);)x.shift();for(;x.length>0&&ct(x[x.length-1]);)x.pop();return x.length===0?null:{blocks:fn(x.join(`
32
- `)),nextIndex:M}}function Bn(f,g,h){const x=[];let M=g;const H=h(f[g]);if(!H)return null;const ye=H.indent;for(;M<f.length;){const q=h(f[M]);if(q===null||q.indent!==ye)break;const Se=[q.text],Le=[];for(M+=1;M<f.length;){if(ct(f[M])){const bt=f.findIndex((At,rr)=>rr>=M+1&&!ct(At));if(bt===-1){M=f.length;break}const Cn=h(f[bt]);if(Cn&&Cn.indent===ye){M=bt;break}if(Tt(f[bt])<=ye){M=bt;break}M+=1;continue}const Ze=h(f[M]);if(Ze&&Ze.indent===ye)break;if(Tt(f[M])>ye){const bt=un(f,M,ye);if(bt){Le.push(...bt.blocks),M=bt.nextIndex;continue}}if(Tt(f[M])<=ye)break;const Dt=en(f,M,ye);if(!Dt)break;Se.push(Dt.value),M=Dt.nextIndex}x.push(Le.length>0?{paragraphs:Se,children:Le}:{paragraphs:Se})}return x.length>0?{items:x,nextIndex:M}:null}function kn(f){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(f.trim())}function dn(f){const g=f.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return g?{marker:g[1],language:(g[2]??"").trim()}:null}function fn(f){var H;const h=Lt(f).split(`
33
- `),x=[];let M=0;for(;M<h.length;){if(ct(h[M])){M+=1;continue}const ye=dn(h[M]);if(ye){M+=1;const At=[];for(;M<h.length;){if(h[M].trim()===ye.marker){M+=1;break}At.push(h[M]),M+=1}x.push({kind:"codeBlock",language:ye.language,value:At.join(`
34
- `)});continue}if(kn(h[M])){x.push({kind:"thematicBreak"}),M+=1;continue}const q=vt(h[M]);if(q){x.push({kind:"heading",level:q.level,value:q.value}),M+=1;continue}if(Gt(h[M])!==null){const At=[];for(;M<h.length;){const rr=Gt(h[M]);if(rr===null)break;At.push(rr),M+=1}x.push({kind:"blockquote",value:At.join(`
35
- `).trim()});continue}if(On(h[M])!==null){const At=[],rr=((H=Yt(h[M]))==null?void 0:H.indent)??0;for(;M<h.length;){const ps=Yt(h[M]);if(ps===null||ps.indent!==rr)break;At.push(ps.item),M+=1}if(At.length>0){x.push({kind:"taskList",items:At});continue}}const Ze=$t(h[M]);if(Ze!==null){const At=Bn(h,M,Bt);if(At){x.push({kind:"unorderedList",items:At.items}),M=At.nextIndex;continue}if(Ze.length>0){x.push({kind:"unorderedList",items:[{paragraphs:[Ze]}]}),M+=1;continue}}const Dt=_n(h[M]);if(Dt!==null){const At=Bn(h,M,Qt);if(At){x.push({kind:"orderedList",items:At.items}),M=At.nextIndex;continue}if(Dt.length>0){x.push({kind:"orderedList",items:[{paragraphs:[Dt]}]}),M+=1;continue}}const bt=[];for(;M<h.length&&!(ct(h[M])||dn(h[M])||kn(h[M])||vt(h[M])||Gt(h[M])!==null||On(h[M])!==null||$t(h[M])!==null||_n(h[M])!==null);)bt.push(h[M]),M+=1;const Cn=bt.join(`
36
- `).trim();Cn&&x.push({kind:"paragraph",value:Cn})}return x}function qn(f){if(!f.includes("![")||!f.includes("]("))return fn(f);const g=[],h=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let x=0;for(const M of f.matchAll(h)){const[H,ye,q]=M;if(typeof M.index!="number")continue;const Se=M.index,Le=Se+H.length,Ze=Et(q.trim());Ze&&(Se>x&&g.push(...fn(f.slice(x,Se))),g.push({kind:"image",url:Ze,alt:ye.trim(),markdown:H}),x=Le)}return x<f.length&&g.push(...fn(f.slice(x))),g}function Zn(f){const h=Lt(f).split(`
37
- `),x=[];let M=0,H=0;const ye=q=>{if(q<=H)return;const Se=h.slice(H,q).join(`
38
- `);x.push(...qn(Se))};for(;M<h.length;){const q=dn(h[M]);if(!q){M+=1;continue}ye(M),M+=1;const Se=[];for(;M<h.length;){if(h[M].trim()===q.marker){M+=1;break}Se.push(h[M]),M+=1}x.push({kind:"codeBlock",language:q.language,value:Se.join(`
39
- `)}),H=M}return ye(h.length),x.length>0?x:[{kind:"paragraph",value:f}]}function Ut(f){return f.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function an(f){return pt(f).map(g=>g.kind==="text"?Ut(g.value):g.kind==="bold"?`<strong class="message-bold-text">${Ut(g.value)}</strong>`:g.kind==="italic"?`<em class="message-italic-text">${Ut(g.value)}</em>`:g.kind==="strikethrough"?`<s class="message-strikethrough-text">${Ut(g.value)}</s>`:g.kind==="file"?`<a class="message-file-link" href="${Ut(Be(g.path))}" target="_blank" rel="noopener noreferrer" title="${Ut(g.path)}">${Ut(g.displayPath)}</a>`:g.kind==="url"?`<a class="message-file-link" href="${Ut(g.href)}" target="_blank" rel="noopener noreferrer" title="${Ut(g.href)}">${Ut(g.value)}</a>`:`<code class="message-inline-code">${Ut(g.value)}</code>`).join("")}function $e(f){return f.paragraphs.map(g=>`<div class="message-list-item-text message-list-item-paragraph">${an(g)}</div>`).join("")}function Re(f){var x;const g=$e(f),h=((x=f.children)==null?void 0:x.map(M=>Tn(M)).join(""))??"";return g+h}function Tn(f){if(f.kind==="paragraph")return`<p class="message-text">${an(f.value)}</p>`;if(f.kind==="heading"){const g=Math.min(6,Math.max(1,Math.trunc(f.level))),h=Te(g),x=`message-heading ${Ce(g)}`;return`<${h} class="${x}">${an(f.value)}</${h}>`}return f.kind==="blockquote"?`<blockquote class="message-blockquote">${an(f.value)}</blockquote>`:f.kind==="unorderedList"?`<ul class="message-list message-list-unordered">${f.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${Re(h)}</div></li>`).join("")}</ul>`:f.kind==="taskList"?`<ul class="message-list message-task-list">${f.items.map(h=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${h.checked?"true":"false"}">${h.checked?"☑":"☐"}</span><div class="message-list-item-text">${an(h.text)}</div></li>`).join("")}</ul>`:f.kind==="orderedList"?`<ol class="message-list message-list-ordered">${f.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${Re(h)}</div></li>`).join("")}</ol>`:f.kind==="codeBlock"?`<div class="message-code-block">${f.language?`<div class="message-code-language">${Ut(f.language)}</div>`:""}<pre class="message-code-pre"><code>${Ut(f.value)}</code></pre></div>`:f.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${Ut(f.url)}" alt="${Ut(f.alt||"Embedded message image")}" loading="lazy">`}function zt(f){return Zn(f).map(g=>Tn(g)).join("")}function Nn(f){return f!==null&&typeof f=="object"&&!Array.isArray(f)?f:null}function er(f){const g=new Date(f);return Number.isNaN(g.getTime())?f:g.toLocaleTimeString()}function Ln(f){const g=Nn(f.params),h=g==null?void 0:g.reason;return typeof h=="string"?h.trim():""}function Sn(f,g){return`${String(f)}:${g}`}function Gn(f){const g=Nn(f.params),h=Array.isArray(g==null?void 0:g.questions)?g.questions:[],x=[];for(const M of h){const H=Nn(M);if(!H)continue;const ye=typeof H.id=="string"?H.id:"";if(!ye)continue;const q=Array.isArray(H.options)?H.options.map(Se=>Nn(Se)).map(Se=>({label:typeof(Se==null?void 0:Se.label)=="string"?Se.label:"",description:typeof(Se==null?void 0:Se.description)=="string"?Se.description:""})).filter(Se=>Se.label.length>0):[];x.push({id:ye,header:typeof H.header=="string"?H.header:"",question:typeof H.question=="string"?H.question:"",isSecret:H.isSecret===!0,isOther:H.isOther===!0,options:q})}return x}function Dn(f,g,h){const x=Sn(f,g),M=lt.value[x];return typeof M=="string"&&M.length>0?M:h}function Un(f,g,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const M=Sn(f,g);lt.value={...lt.value,[M]:x.value}}function Kn(f,g){var M;const h=Dn(f,g.id,((M=g.options[0])==null?void 0:M.label)||""),x=g.options.find(H=>H.label===h);return(x==null?void 0:x.description)??""}function hn(f,g){const h=Sn(f,g);return Qe.value[h]??""}function A(f,g,h){const x=h.target;if(!(x instanceof HTMLSelectElement))return;const M=Sn(f,g);lt.value={...lt.value,[M]:x.value}}function U(f,g,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const M=Sn(f,g);Qe.value={...Qe.value,[M]:x.value}}function se(f,g){qe("respondServerRequest",{id:f,result:{decision:g}})}function Ne(f){var x;const g=Gn(f),h={};for(const M of g){const H=Dn(f.id,M.id,((x=M.options[0])==null?void 0:x.label)||""),ye=hn(f.id,M.id).trim(),q=[H,ye].map(Se=>Se.trim()).filter(Se=>Se.length>0);h[M.id]={answers:q}}qe("respondServerRequest",{id:f.id,result:{answers:h}})}function it(f){qe("respondServerRequest",{id:f,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function wt(f){qe("respondServerRequest",{id:f,result:{success:!0,contentItems:[]}})}function mt(f){qe("respondServerRequest",{id:f,result:{}})}function Wt(f){qe("respondServerRequest",{id:f,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function In(){const f=Fe.value,g=gt.value;!f||!g||(f.scrollTop=f.scrollHeight,g.scrollIntoView({block:"end"}))}function Hn(f){return f.scrollHeight-(f.scrollTop+f.clientHeight)<=rk}function fr(f){if(!Ae.activeThreadId)return;const g=Math.max(f.scrollHeight-f.clientHeight,0),h=g>0?Math.min(Math.max(f.scrollTop/g,0),1):1;qe("updateScrollState",{threadId:Ae.activeThreadId,state:{scrollTop:f.scrollTop,isAtBottom:Hn(f),scrollRatio:h}})}function fs(){const f=Fe.value;if(!f)return;const g=Ae.scrollState;if(W.value){tr();return}if(!g||g.isAtBottom){fr(f);return}const h=Math.max(f.scrollHeight-f.clientHeight,0),x=typeof g.scrollRatio=="number"?g.scrollRatio*h:g.scrollTop;f.scrollTop=Math.min(Math.max(x,0),h),fr(f)}function tr(){const f=Fe.value;f&&(In(),fr(f))}function hr(){return W.value}function Wn(){if(!hr()){ve=0,ue=0;return}if(tr(),ve-=1,ve<=0){ue=0;return}ue=requestAnimationFrame(Wn)}function nr(f=6){hr()&&(ue&&(cancelAnimationFrame(ue),ue=0),ve=Math.max(f,1),ue=requestAnimationFrame(Wn))}function Jr(){nr(3)}function hs(){W.value=!0,tr(),nr(4)}function Cr(){if(!hr())return;const f=Fe.value;if(!f)return;const g=f.querySelectorAll("img.message-image-preview");for(const h of g)h.complete||xe.has(h)||(xe.add(h),h.addEventListener("load",Jr,{once:!0}),h.addEventListener("error",Jr,{once:!0}))}async function Ar(){await nn(),we&&cancelAnimationFrame(we),we=requestAnimationFrame(()=>{we=0,fs(),Cr(),nr()})}ht(()=>Ae.messages,async f=>{if(Ae.isLoading)return;const g=new Set(f.filter(h=>h.messageType==="commandExecution"&&h.commandExecution).map(h=>h.id));n.value=We(n.value,g),r.value=We(r.value,g),s.value=We(s.value,new Set(Object.keys(I.value))),await Ar()}),ht(c,(f,g)=>{if(!g||g===f||!r.value.has(g))return;const h=new Set(r.value);h.delete(g),r.value=h}),ht(()=>Ae.pendingRequests,async()=>{Ae.isLoading||await Ar()},{deep:!0}),ht(()=>Ae.liveOverlay,async f=>{f&&(await nn(),hr()&&(tr(),nr(8)))},{deep:!0}),ht(()=>Ae.isLoading,async f=>{f||await Ar()}),ht(()=>Ae.activeThreadId,()=>{var f;W.value=((f=Ae.scrollState)==null?void 0:f.isAtBottom)!==!1,ut.value="",T.value=new Set},{flush:"post"}),ht(()=>{var f;return(f=Ae.scrollState)==null?void 0:f.isAtBottom},f=>{W.value=f!==!1});function S(){const f=Fe.value;!f||Ae.isLoading||(W.value=Hn(f),fr(f))}function R(f){ut.value=Et(f)}function P(f,g){return`${f}:${String(g)}`}function Z(f,g){const h=new Set(T.value);h.add(P(f,g)),T.value=h}function Ue(f,g){return T.value.has(P(f,g))}function Ct(){ut.value=""}function Xt(){const f=Ht.value;f&&(f.scrollTop=f.scrollHeight)}return ht(()=>{var f;return(f=Ae.liveOverlay)==null?void 0:f.reasoningText},async f=>{f&&(await nn(),Xt())}),Kr(()=>{we&&cancelAnimationFrame(we),ue&&cancelAnimationFrame(ue)}),(f,g)=>(y(),k("section",Nw,[e.isLoading?(y(),k("p",Lw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(y(),k("p",Dw," No messages in this thread yet. ")):(y(),k("ul",{key:2,ref_key:"conversationListRef",ref:Fe,class:"conversation-list",onScroll:S},[(y(!0),k(Oe,null,yt(e.messages,h=>{var x,M;return y(),k(Oe,{key:h.id},[j.value.has(h.id)?he("",!0):(y(),k("li",{key:0,class:"conversation-item","data-role":h.role,"data-message-type":h.messageType||""},[l(h)?(y(),k("div",Fw,[v("div",Bw,[ge(h).length>0?(y(),k("button",{key:0,type:"button",class:nt(["cmd-row cmd-row-group cmd-compact",[ze(h),{"cmd-expanded":re(h)}]]),onClick:H=>le(h)},[v("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":re(h)}])},"▶",2),v("span",Hw,K(de(h)),1),v("span",Ww,K(te(h)),1)],10,Uw)):he("",!0),ge(h).length>0?(y(),k("div",{key:1,class:nt(["cmd-group-wrap",{"cmd-group-visible":re(h)}])},[v("div",Vw,[(y(!0),k(Oe,null,yt(je(h),H=>{var ye,q;return y(),k("div",{key:`grouped-cmd-${H.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:nt(["cmd-row",[ze(H),{"cmd-expanded":J(H),"cmd-compact":!0}]]),onClick:Se=>me(H)},[v("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":J(H)}])},"▶",2),v("code",qw,K(((ye=H.commandExecution)==null?void 0:ye.command)||"(command)"),1),v("span",Gw,K(He(H)),1)],10,zw),v("div",{class:nt(["cmd-output-wrap",{"cmd-output-visible":J(H)}])},[v("div",Kw,[v("pre",{class:nt(["cmd-output",{"cmd-output-condensed":ke(H)}]),textContent:K(((q=H.commandExecution)==null?void 0:q.aggregatedOutput)||"(no output)")},null,10,Jw)])],2)])}),128))])],2)):(y(),k(Oe,{key:2},[v("button",{type:"button",class:nt(["cmd-row",[ze(h),{"cmd-expanded":J(h),"cmd-compact":ne(h)}]]),onClick:H=>me(h)},[v("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":J(h)}])},"▶",2),v("code",Qw,K(((x=h.commandExecution)==null?void 0:x.command)||"(command)"),1),v("span",Xw,K(He(h)),1)],10,Yw),v("div",{class:nt(["cmd-output-wrap",{"cmd-output-visible":J(h)}])},[v("div",Zw,[v("pre",{class:nt(["cmd-output",{"cmd-output-condensed":ke(h)}]),textContent:K(((M=h.commandExecution)==null?void 0:M.aggregatedOutput)||"(no output)")},null,10,eb)])],2)],64))])])):(y(),k("div",{key:1,class:"message-row","data-role":h.role,"data-message-type":h.messageType||""},[v("div",{class:"message-stack","data-role":h.role},[v("article",{class:"message-body","data-role":h.role},[h.images&&h.images.length>0?(y(),k("ul",{key:0,class:"message-image-list","data-role":h.role},[(y(!0),k(Oe,null,yt(h.images,H=>(y(),k("li",{key:H,class:"message-image-item"},[v("button",{class:"message-image-button",type:"button",onClick:ye=>R(H)},[v("img",{class:"message-image-preview",src:Et(H),alt:"Message image preview",loading:"lazy"},null,8,ib)],8,ob)]))),128))],8,sb)):he("",!0),h.fileAttachments&&h.fileAttachments.length>0?(y(),k("div",ab,[(y(!0),k(Oe,null,yt(h.fileAttachments,H=>(y(),k("span",{key:H.path,class:"message-file-chip"},[g[1]||(g[1]=v("span",{class:"message-file-chip-icon"},"📄",-1)),v("a",{class:"message-file-link message-file-chip-name",href:Be(H.path),target:"_blank",rel:"noopener noreferrer",title:H.path},K(H.path),9,lb)]))),128))])):he("",!0),h.text.length>0?(y(),k("article",{key:2,class:"message-card","data-role":h.role},[h.messageType==="worked"?(y(),k("div",ub,[v("button",{type:"button",class:"worked-separator",onClick:H=>Pe(h)},[g[2]||(g[2]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),v("span",{class:nt(["worked-chevron",{"worked-chevron-open":Je(h)}])},"▶",2),v("p",fb,K(h.text),1),g[3]||(g[3]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,db),Je(h)?(y(),k("div",hb,[(y(!0),k(Oe,null,yt(Me(e.messages,e.messages.indexOf(h)),H=>{var ye,q;return y(),k("div",{key:`worked-cmd-${H.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:nt(["cmd-row",[ze(H),{"cmd-expanded":J(H),"cmd-compact":ne(H)}]]),onClick:Se=>me(H)},[v("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":J(H)}])},"▶",2),v("code",mb,K(((ye=H.commandExecution)==null?void 0:ye.command)||"(command)"),1),v("span",gb,K(He(H)),1)],10,pb),v("div",{class:nt(["cmd-output-wrap",{"cmd-output-visible":J(H)}])},[v("div",vb,[v("pre",{class:nt(["cmd-output",{"cmd-output-condensed":ke(H)}]),textContent:K(((q=H.commandExecution)==null?void 0:q.aggregatedOutput)||"(no output)")},null,10,yb)])],2)])}),128))])):he("",!0)])):d(h)?(y(),k("div",{key:1,class:"plan-card","data-streaming":h.messageType==="plan.live"},[v("div",bb,[g[4]||(g[4]=v("p",{class:"plan-card-title"},"Plan",-1)),h.messageType==="plan.live"?(y(),k("span",_b,"Updating")):he("",!0)]),$(h)?(y(),k("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:zt($(h))},null,8,kb)):he("",!0),X(h).length>0?(y(),k("ol",Tb,[(y(!0),k(Oe,null,yt(X(h),(H,ye)=>(y(),k("li",{key:`${h.id}:plan-step:${ye}`,class:"plan-step-item","data-status":H.status},[v("span",{class:"plan-step-status","data-status":H.status},K(ae(H.status)),9,Ib),v("div",{class:"plan-step-text plan-card-markdown",innerHTML:zt(H.step)},null,8,Eb)],8,Sb))),128))])):(y(),k("div",{key:2,class:"plan-card-markdown",innerHTML:zt(h.text)},null,8,Cb))],8,wb)):(y(),k("div",Ab,[(y(!0),k(Oe,null,yt(Zn(h.text),(H,ye)=>(y(),k(Oe,{key:`block-${ye}`},[H.kind==="paragraph"?(y(),k("p",xb,[(y(!0),k(Oe,null,yt(pt(H.value),(q,Se)=>(y(),k(Oe,{key:`seg-${ye}-${Se}`},[q.kind==="text"?(y(),k("span",Rb,K(q.value),1)):q.kind==="bold"?(y(),k("strong",Pb,K(q.value),1)):q.kind==="italic"?(y(),k("em",Mb,K(q.value),1)):q.kind==="strikethrough"?(y(),k("s",$b,K(q.value),1)):q.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Be(q.path),target:"_blank",rel:"noopener noreferrer",title:q.path},K(q.displayPath),9,Ob)):q.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:q.href,target:"_blank",rel:"noopener noreferrer",title:q.href},K(q.value),9,Nb)):(y(),k("code",Lb,K(q.value),1))],64))),128))])):H.kind==="heading"?(y(),_t(wi(Te(H.level)),{key:1,class:nt(["message-heading",Ce(H.level)])},{default:xt(()=>[(y(!0),k(Oe,null,yt(pt(H.value),(q,Se)=>(y(),k(Oe,{key:`heading-seg-${ye}-${Se}`},[q.kind==="text"?(y(),k("span",Db,K(q.value),1)):q.kind==="bold"?(y(),k("strong",jb,K(q.value),1)):q.kind==="italic"?(y(),k("em",Fb,K(q.value),1)):q.kind==="strikethrough"?(y(),k("s",Bb,K(q.value),1)):q.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Be(q.path),target:"_blank",rel:"noopener noreferrer",title:q.path},K(q.displayPath),9,Ub)):q.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:q.href,target:"_blank",rel:"noopener noreferrer",title:q.href},K(q.value),9,Hb)):(y(),k("code",Wb,K(q.value),1))],64))),128))]),_:2},1032,["class"])):H.kind==="blockquote"?(y(),k("blockquote",Vb,[(y(!0),k(Oe,null,yt(pt(H.value),(q,Se)=>(y(),k(Oe,{key:`quote-seg-${ye}-${Se}`},[q.kind==="text"?(y(),k("span",zb,K(q.value),1)):q.kind==="bold"?(y(),k("strong",qb,K(q.value),1)):q.kind==="italic"?(y(),k("em",Gb,K(q.value),1)):q.kind==="strikethrough"?(y(),k("s",Kb,K(q.value),1)):q.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Be(q.path),target:"_blank",rel:"noopener noreferrer",title:q.path},K(q.displayPath),9,Jb)):q.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:q.href,target:"_blank",rel:"noopener noreferrer",title:q.href},K(q.value),9,Yb)):(y(),k("code",Qb,K(q.value),1))],64))),128))])):H.kind==="unorderedList"?(y(),k("ul",Xb,[(y(!0),k(Oe,null,yt(H.items,(q,Se)=>(y(),k("li",{key:`ul-${ye}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:Re(q)},null,8,Zb)]))),128))])):H.kind==="taskList"?(y(),k("ul",e_,[(y(!0),k(Oe,null,yt(H.items,(q,Se)=>(y(),k("li",{key:`task-${ye}-${Se}`,class:"message-task-item"},[v("span",{class:"message-task-checkbox","data-checked":q.checked},K(q.checked?"☑":"☐"),9,t_),v("div",n_,[(y(!0),k(Oe,null,yt(pt(q.text),(Le,Ze)=>(y(),k(Oe,{key:`task-seg-${ye}-${Se}-${Ze}`},[Le.kind==="text"?(y(),k("span",r_,K(Le.value),1)):Le.kind==="bold"?(y(),k("strong",s_,K(Le.value),1)):Le.kind==="italic"?(y(),k("em",o_,K(Le.value),1)):Le.kind==="strikethrough"?(y(),k("s",i_,K(Le.value),1)):Le.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Be(Le.path),target:"_blank",rel:"noopener noreferrer",title:Le.path},K(Le.displayPath),9,a_)):Le.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:Le.href,target:"_blank",rel:"noopener noreferrer",title:Le.href},K(Le.value),9,l_)):(y(),k("code",c_,K(Le.value),1))],64))),128))])]))),128))])):H.kind==="orderedList"?(y(),k("ol",u_,[(y(!0),k(Oe,null,yt(H.items,(q,Se)=>(y(),k("li",{key:`ol-${ye}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:Re(q)},null,8,d_)]))),128))])):H.kind==="codeBlock"?(y(),k("div",f_,[H.language?(y(),k("div",h_,K(H.language),1)):he("",!0),v("pre",p_,[v("code",null,K(H.value),1)])])):H.kind==="thematicBreak"?(y(),k("hr",m_)):Ue(h.id,ye)?(y(),k("p",g_,K(H.markdown),1)):(y(),k("button",{key:9,class:"message-image-button",type:"button",onClick:q=>R(H.url)},[v("img",{class:"message-image-preview message-markdown-image",src:H.url,alt:H.alt||"Embedded message image",loading:"lazy",onError:q=>Z(h.id,ye)},null,40,y_)],8,v_))],64))),128))]))],8,cb)):he("",!0)],8,rb)],8,nb)],8,tb))],8,jw))],64)}),128)),e.liveOverlay?(y(),k("li",w_,[v("div",b_,[v("div",__,[v("article",k_,[v("p",T_,K(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(y(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:Ht},K(e.liveOverlay.reasoningText),513)):he("",!0),e.liveOverlay.errorText?(y(),k("p",S_,K(e.liveOverlay.errorText),1)):he("",!0)])])])])):he("",!0),(y(!0),k(Oe,null,yt(e.pendingRequests,h=>(y(),k("li",{key:`server-request:${h.id}`,class:"conversation-item conversation-item-request"},[v("div",I_,[v("div",E_,[v("article",C_,[v("p",A_,K(h.method),1),v("p",x_,"Request #"+K(h.id)+" · "+K(er(h.receivedAtIso)),1),Ln(h)?(y(),k("p",R_,K(Ln(h)),1)):he("",!0),h.method==="item/commandExecution/requestApproval"?(y(),k("section",P_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>se(h.id,"accept")},"Accept",8,M_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"acceptForSession")},"Accept for Session",8,$_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"decline")},"Decline",8,O_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"cancel")},"Cancel",8,N_)])):h.method==="item/fileChange/requestApproval"?(y(),k("section",L_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>se(h.id,"accept")},"Accept",8,D_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"acceptForSession")},"Accept for Session",8,j_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"decline")},"Decline",8,F_),v("button",{type:"button",class:"request-button",onClick:x=>se(h.id,"cancel")},"Cancel",8,B_)])):h.method==="item/tool/requestUserInput"?(y(),k("section",U_,[(y(!0),k(Oe,null,yt(Gn(h),x=>{var M;return y(),k("div",{key:`${h.id}:${x.id}`,class:"request-question"},[v("p",H_,K(x.header||x.question),1),x.header&&x.question?(y(),k("p",W_,K(x.question),1)):he("",!0),x.options.length>0?(y(),k("select",{key:1,class:"request-select",value:Dn(h.id,x.id,((M=x.options[0])==null?void 0:M.label)||""),onChange:H=>A(h.id,x.id,H)},[(y(!0),k(Oe,null,yt(x.options,H=>(y(),k("option",{key:`${h.id}:${x.id}:${H.label}`,value:H.label},K(H.label),9,z_))),128))],40,V_)):he("",!0),x.options.length>0&&Kn(h.id,x)?(y(),k("p",q_,K(Kn(h.id,x)),1)):(y(),k("input",{key:3,class:"request-input",type:x.isSecret?"password":"text",value:Dn(h.id,x.id,""),placeholder:x.isSecret?"Enter secret answer":"Enter answer",onInput:H=>Un(h.id,x.id,H)},null,40,G_)),x.isOther?(y(),k("input",{key:4,class:"request-input",type:x.isSecret?"password":"text",value:hn(h.id,x.id),placeholder:"Other answer",onInput:H=>U(h.id,x.id,H)},null,40,K_)):he("",!0)])}),128)),v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Ne(h)}," Submit Answers ",8,J_)])):h.method==="item/tool/call"?(y(),k("section",Y_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>it(h.id)},"Fail Tool Call",8,Q_),v("button",{type:"button",class:"request-button",onClick:x=>wt(h.id)},"Success (Empty)",8,X_)])):(y(),k("section",Z_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>mt(h.id)},"Return Empty Result",8,ek),v("button",{type:"button",class:"request-button",onClick:x=>Wt(h.id)},"Reject Request",8,tk)]))])])])]))),128)),v("li",{ref_key:"bottomAnchorRef",ref:gt,class:"conversation-bottom-anchor"},null,512)],544)),E.value?(y(),k("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:hs},[De(Hf,{class:"icon-svg jump-to-latest-icon"})])):he("",!0),ut.value.length>0?(y(),k("div",{key:4,class:"image-modal-backdrop",onClick:Ct},[v("div",{class:"image-modal-content",onClick:g[0]||(g[0]=St(()=>{},["stop"]))},[v("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Ct},[De(Ul,{class:"icon-svg"})]),v("img",{class:"image-modal-image",src:ut.value,alt:"Expanded message image"},null,8,nk)])])):he("",!0)]))}}),ok=kt(sk,[["__scopeId","data-v-b0daa8e9"]]),pu=.0025,va=3,mu=2,ik=256;function ak(e){var je;const t=D("idle"),n=D(typeof navigator<"u"&&!!((je=navigator.mediaDevices)!=null&&je.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,d=null,c=null,m=null,b=[],I=!1,j=!1;function $(){const le=s.value;if(!le||typeof window>"u")return;const re=le.getContext("2d");if(!re)return;const de=Math.max(1,Math.floor(le.clientWidth)),te=Math.max(1,Math.floor(le.clientHeight||36)),Pe=window.devicePixelRatio||1,Je=Math.max(1,Math.floor(de*Pe)),He=Math.max(1,Math.floor(te*Pe));(le.width!==Je||le.height!==He)&&(le.width=Je,le.height=He),re.setTransform(Pe,0,0,Pe,0,0),re.clearRect(0,0,de,te);const ze=Math.max(12,Math.floor(de/(va+mu))),We=b.slice(-ze),Me=Math.max(0,ze-We.length),Ae=te/2,qe=getComputedStyle(le).color||"#000000";for(let Fe=0;Fe<ze;Fe+=1){const gt=We[Fe-Me]??0,ut=Math.max(.08,Math.min(1,gt*18))*Ae,lt=Fe*(va+mu);re.globalAlpha=gt<=pu?.35:1,re.fillStyle=qe,re.fillRect(lt,Ae-ut,va,ut*2)}re.globalAlpha=1}function X(){b=[],r.value=0,$()}function ae(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),m=null}function z(le){if(typeof window>"u")return;const re=window.webkitAudioContext,de=window.AudioContext??re;de&&(ae(),X(),l=new de,d=l.createMediaStreamSource(le),c=l.createScriptProcessor(2048,1,1),m=performance.now(),c.onaudioprocess=te=>{const Pe=te.inputBuffer.getChannelData(0);let Je=0;for(let He=0;He<Pe.length;He+=1){const ze=Math.abs(Pe[He]??0);Je+=ze<pu?0:ze}b.push(Je/Pe.length),b.length>ik&&b.shift(),m!==null&&(r.value=Math.max(0,performance.now()-m)),$()},d.connect(c),c.connect(l.destination),$())}async function J(){var le;if(!(t.value!=="idle"||!n.value||I)){I=!0,j=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=re=>{re.data.size>0&&a.push(re.data)},o.onstop=()=>{var te;const re=a,de=(o==null?void 0:o.mimeType)||((te=re[0])==null?void 0:te.type)||"audio/webm";me(),ke(re,de)},z(i),o.start(250),t.value="recording",j&&ne()}catch(re){me(),t.value="idle",(le=e.onError)==null||le.call(e,re)}finally{I=!1}}}function ne(){if(I&&t.value==="idle"){j=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function ke(le,re){var te,Pe,Je,He;if(le.length===0){(te=e.onEmpty)==null||te.call(e),t.value="idle";return}const de=new Blob(le,{type:re});t.value="transcribing";try{const ze=re.split(/[/;]/)[1]??"webm",We=new FormData;We.append("file",de,`codex.${ze}`);const Me=await fetch("/codex-api/transcribe",{method:"POST",body:We}),Ae=await Me.text();let qe=null;try{qe=Ae.trim()?JSON.parse(Ae):null}catch{qe=null}if(!Me.ok){const gt=(Pe=qe==null?void 0:qe.error)==null?void 0:Pe.trim(),Ht=Ae.trim();throw new Error(gt||Ht||`Transcription failed: ${Me.status}`)}const Fe=((qe==null?void 0:qe.text)??"").trim();Fe.length>0?e.onTranscript(Fe):(Je=e.onEmpty)==null||Je.call(e)}catch(ze){(He=e.onError)==null||He.call(e,ze)}finally{t.value="idle"}}function me(){ae(),X(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(le=>le.stop()),i=null),a=[]}Kr(me);function ge(){if(t.value==="recording"){ne();return}t.value==="idle"&&J()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:J,stopRecording:ne,toggleRecording:ge}}function gu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class jr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Hl(e,t){const n=gu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=gu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function Ps(e,t,n){return e instanceof jr?e:e instanceof Error?new jr(e.message||t,{code:"unknown_error",method:n}):new jr(t,{code:"unknown_error",method:n})}function Wf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function lk(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 jr(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 jr(Hl(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 jr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function ck(e){const t=Wf(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 vu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function uk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(d,c)=>{if(n||r!==null)return;const m=Math.min(1e3*2**c,1e4);r=window.setTimeout(()=>{r=null,!n&&d()},m)},i=d=>{const c=ck(d);c&&e(c)},a=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let m=!1;c.onmessage=b=>{try{i(JSON.parse(b.data))}catch{}},c.addEventListener("ready",b=>{try{const I=b.data?JSON.parse(b.data):{ok:!0};vu(e,I)}catch{vu(e)}}),c.onerror=()=>{n||m||c.readyState===EventSource.CLOSED&&(m=!0,c.close(),o(()=>a(d+1),d))},t=()=>{m=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let b=!1,I=!1,j=window.setTimeout(()=>{b||n||I||(I=!0,m.close(),a())},2500);m.onopen=()=>{b=!0,s(),j!==null&&(window.clearTimeout(j),j=null)},m.onmessage=$=>{try{i(JSON.parse(String($.data)))}catch{}},m.onerror=()=>{},m.onclose=()=>{if(j!==null&&(window.clearTimeout(j),j=null),!(n||I)){if(!b){a();return}o(()=>l(d+1),d)}},t=()=>{I=!0,j!==null&&(window.clearTimeout(j),j=null),m.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function dk(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 jr(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 jr(Hl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function fk(){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 jr(Hl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Wf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function yu(e){return new Date(e*1e3).toISOString()}function hk(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function pk(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const mk=/^##\s+(.+?):\s+(.+?)\s*$/,gk=/^#\s*files mentioned by the user\s*:?\s*$/i;function vk(e){var s,o;const t=e.split(`
40
- `).findIndex(i=>gk.test(i.trim()));if(t<0)return[];const n=e.split(`
41
- `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(mk);if(!l)break;const d=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&r.push({label:d,path:c})}return r}function yk(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 wk(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:pk(l),isUnhandled:!0});const o=n.join(`
42
- `),i=vk(o);return{text:yk(o),images:r,fileAttachments:i,rawBlocks:s}}function bk(e){var o;const t=e.replace(/\r\n/g,`
43
- `).trim();if(!t)return null;const n=t.split(`
44
- `),r=[],s=[];for(const i of n){const a=i.trim();if(!a){r.length===0&&s.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const d=(l[1]??" ").toLowerCase(),c=(o=l[2])==null?void 0:o.trim();if(!c)continue;let m="pending";d==="x"&&(m="completed"),(d==="~"||d===">"||d==="-")&&(m="inProgress"),r.push({step:c,status:m});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
45
- `).trim()||void 0,steps:r}}function _k(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=wk(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==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:bk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=kk(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 kk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Tk(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Sk(e){const t=Tk(e);return t.length>0?t:"Untitled thread"}function Vf(e){return(e==null?void 0:e.status)==="inProgress"}function Ik(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 Vf(r)}function Ek(e){const t=e,n=typeof t.cwd=="string"?t.cwd:e.cwd,r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||n.includes("/.codex/worktrees/")||n.includes("/.git/worktrees/");return{id:e.id,title:Sk(e),projectName:hk(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:yu(e.createdAt),updatedAtIso:yu(e.updatedAt),preview:e.preview,unread:!1,inProgress:Ik(e)}}function Ck(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 Ak(e){const t=e.data.map(Ek);return Ck(t)}function zf(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 _k(i))n.push({...a,turnIndex:r})}return n}function xk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Vf(t.at(-1))}function ya(e){return e&&e.length>0?e:null}const wu=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Xn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ln(e){return typeof e=="string"&&e.length>0?e:null}function wa(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function tl(e){return typeof e=="boolean"?e:null}function Rk(e){return e==="payment_required"?e:null}function Pk(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function bu(e){const t=Xn(e);if(!t)return null;const n=wa(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:wa(t.windowDurationMins??t.window_minutes),resetsAt:wa(t.resetsAt??t.resets_at)}}function Mk(e){const t=Xn(e);if(!t)return null;const n=tl(t.hasCredits??t.has_credits),r=tl(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:ln(t.balance)}}function nl(e){const t=Xn(e);if(!t)return null;const n=bu(t.primary),r=bu(t.secondary),s=Mk(t.credits);return!n&&!r&&!s?null:{limitId:ln(t.limitId??t.limit_id),limitName:ln(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:ln(t.planType??t.plan_type)}}function qf(e,t=null){const n=Xn(e);if(!n)return null;const r=ln(n.accountId),s=ln(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:ln(n.authMode),email:ln(n.email),planType:ln(n.planType),lastRefreshedAtIso:ln(n.lastRefreshedAtIso)??"",lastActivatedAtIso:ln(n.lastActivatedAtIso),quotaSnapshot:nl(n.quotaSnapshot),quotaUpdatedAtIso:ln(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:ln(n.quotaError),unavailableReason:Rk(n.unavailableReason)??(Pk(ln(n.quotaError))?"payment_required":null),isActive:tl(n.isActive)??r===t}:null}function Gf(e){const t=Xn(e);if(!t)return null;const n=Xn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=nl(n==null?void 0:n.codex);return r||nl(t.rateLimits??t.rate_limits)}async function bn(e,t){try{return await lk(e,t)}catch(n){throw Ps(n,`RPC ${e} failed`,e)}}function $k(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Ok(){const e=await bn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Ak(e)}async function Nk(e){const t=await bn("thread/read",{threadId:e,includeTurns:!0});return{messages:zf(t),inProgress:xk(t)}}async function Lk(){try{return await Ok()}catch(e){throw Ps(e,"Failed to load thread groups","thread/list")}}async function Dk(e){try{return await Nk(e)}catch(t){throw Ps(t,`Failed to load thread ${e}`,"thread/read")}}function jk(e){return uk(e)}async function Fk(e,t){await dk({id:e,...t})}async function Bk(){return fk()}async function Uk(){try{const e=await bn("account/rateLimits/read");return Gf(e)}catch(e){throw Ps(e,"Failed to load account rate limits","account/rateLimits/read")}}function Wl(e){const t=Xn(e),n=ln(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:ln(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>qf(s,n)).filter(s=>s!==null)}}async function Hk(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Ms(t,"Failed to load accounts"));const n=Xn(t);return Wl(n==null?void 0:n.data)}async function Wk(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Ms(t,"Failed to refresh accounts"));const n=Xn(t);return Wl(n==null?void 0:n.data)}async function Vk(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ms(n,"Failed to switch account"));const r=Xn(n),s=Xn(r==null?void 0:r.data),o=qf(s==null?void 0:s.account,ln(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function zk(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ms(n,"Failed to remove account"));const r=Xn(n);return Wl(r==null?void 0:r.data)}async function ba(e){await bn("thread/resume",{threadId:e})}async function qk(e){await bn("thread/archive",{threadId:e})}async function Gk(e,t){await bn("thread/name/set",{threadId:e,name:t})}async function Kk(e,t){const n=await bn("thread/rollback",{threadId:e,numTurns:t});return zf(n)}function Jk(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 _u(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 bn("thread/start",n),s=Jk(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw Ps(n,"Failed to start a new thread","thread/start")}}function Yk(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
46
- `;for(const r of t)n+=`
47
- ## ${r.label}: ${r.path}
48
- `;return`${n}
49
- ## My request for Codex:
50
-
51
- ${e}
52
- `}async function Qk(e,t){var a;const n=(e==null?void 0:e.trim())??"";if(n)return{model:n,reasoningEffort:ya(t)};let r=null;try{r=await Jf()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:ya(t??(r==null?void 0:r.reasoningEffort))};let o=[];try{o=await Kf()}catch{o=[]}const i=((a=o.find(l=>l.trim().length>0))==null?void 0:a.trim())??"";if(i)return{model:i,reasoningEffort:ya(t??(r==null?void 0:r.reasoningEffort))};throw new Error("Plan mode requires an available model. Wait for models to load and try again.")}async function _a(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",c=[{type:"text",text:Yk(t,i)}];for(const I of n){const j=I.trim();j&&c.push({type:"image",url:j,image_url:j})}if(o)for(const I of o)c.push({type:"skill",name:I.name,path:I.path});const m=i.map(I=>({label:I.label,path:I.path,fsPath:I.fsPath})),b={threadId:e,input:c};if(m.length>0&&(b.attachments=m),l&&(b.model=l),typeof s=="string"&&s.length>0&&(b.effort=s),a==="plan"){const I=await Qk(l,s);b.collaborationMode={mode:"plan",settings:{model:I.model,reasoning_effort:I.reasoningEffort,developer_instructions:null}}}await bn("turn/start",b)}catch(l){throw Ps(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function Xk(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 bn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw Ps(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function Zk(e){await bn("setDefaultModel",{model:e})}async function Kf(){const e=await bn("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 Jf(){const e=await bn("config/read",{}),t=e.config.model??"",n=$k(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function e0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function t0(){try{const e=await bn("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:e0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of wu)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return wu}function n0(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))typeof o=="string"&&o.length>0&&typeof i=="string"&&(s[o]=i);return{order:n(t.order),labels:s,active:n(t.active)}}async function fo(){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 n0(n.data)}async function r0(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}async function ku(){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 Tu(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 Su(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=Ms(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"?o.path.trim():""}async function s0(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=Ms(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"?o.path.trim():""}}async function o0(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 d=Ms(o,"Failed to search files");throw new Error(d)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const d of a){if(!d||typeof d!="object"||Array.isArray(d))continue;const m=d.path,b=typeof m=="string"?m.trim():"";b&&l.push({path:b})}return l}async function i0(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}}function Ms(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const s=n.error;return typeof s=="string"&&s.trim().length>0?s:t}async function a0(){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 ka(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 l0(e,t){var n;try{return((n=(await bn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function c0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await bn("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 Iu(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 u0={},d0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function f0(e,t){return y(),k("svg",d0,[...t[0]||(t[0]=[v("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 h0=kt(u0,[["render",f0]]),p0={},m0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function g0(e,t){return y(),k("svg",m0,[...t[0]||(t[0]=[v("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),v("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 Eu=kt(p0,[["render",g0]]),v0=["disabled"],y0={class:"composer-dropdown-value"},w0={class:"composer-dropdown-menu"},b0={key:0,class:"composer-dropdown-search-wrap"},_0=["placeholder","onKeydown"],k0={class:"composer-dropdown-options",role:"listbox"},T0=["onClick"],S0={key:0,class:"composer-dropdown-empty"},I0={key:1,class:"composer-dropdown-add-wrap"},E0=["placeholder","onKeydown"],C0=on({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},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=D(null),o=D(null),i=D(null),a=D(!1),l=D(""),d=D(!1),c=D(""),m=fe(()=>{var de;const re=n.options.find(te=>te.value===n.modelValue);return re?re.label:((de=n.placeholder)==null?void 0:de.trim())||""}),b=fe(()=>n.openDirection??"down"),I=fe(()=>n.enableSearch===!0),j=fe(()=>n.showAddAction===!0),$=fe(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),X=fe(()=>{var re;return((re=n.addActionLabel)==null?void 0:re.trim())||"Add new project"}),ae=fe(()=>{var re;return((re=n.addPlaceholder)==null?void 0:re.trim())||"Project name or absolute path"}),z=fe(()=>{const re=l.value.trim().toLowerCase();return re?n.options.filter(de=>de.label.toLowerCase().includes(re)||de.value.toLowerCase().includes(re)):n.options});function J(){n.disabled||(a.value=!a.value)}function ne(re){r("update:modelValue",re),a.value=!1,l.value=""}function ke(){var re;d.value=!0,c.value=((re=n.defaultAddValue)==null?void 0:re.trim())||"",nn(()=>{var de;return(de=i.value)==null?void 0:de.focus()})}function me(){if(l.value.length>0){l.value="";return}a.value=!1}function ge(){const re=c.value.trim();re&&(r("add",re),d.value=!1,c.value="",a.value=!1,l.value="")}function je(){d.value=!1,c.value="",a.value=!1,l.value=""}function le(re){if(!a.value)return;const de=s.value;if(!de)return;const te=re.target;te instanceof Node&&(de.contains(te)||(a.value=!1,l.value="",d.value=!1,c.value=""))}return ht(a,re=>{if(!re){d.value=!1,c.value="";return}I.value&&nn(()=>{var de;return(de=o.value)==null?void 0:de.focus()})}),Gr(()=>{window.addEventListener("pointerdown",le)}),Kr(()=>{window.removeEventListener("pointerdown",le)}),(re,de)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:J},[v("span",y0,K(m.value),1),De(zi,{class:"composer-dropdown-chevron"})],8,v0),a.value?(y(),k("div",{key:0,class:nt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":b.value==="up","composer-dropdown-menu-wrap-down":b.value==="down"}])},[v("div",w0,[I.value?(y(),k("div",b0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":de[0]||(de[0]=te=>l.value=te),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:Pn(St(me,["prevent"]),["esc"])},null,40,_0),[[Wr,l.value]])])):he("",!0),v("ul",k0,[(y(!0),k(Oe,null,yt(z.value,te=>(y(),k("li",{key:te.value},[v("button",{class:nt(["composer-dropdown-option",{"is-selected":te.value===e.modelValue}]),type:"button",onClick:Pe=>ne(te.value)},K(te.label),11,T0)]))),128)),z.value.length===0?(y(),k("li",S0," No matching projects ")):he("",!0)]),j.value?(y(),k("div",I0,[d.value?(y(),k(Oe,{key:0},[Hr(v("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":de[1]||(de[1]=te=>c.value=te),class:"composer-dropdown-add-input",type:"text",placeholder:ae.value,onKeydown:[Pn(St(ge,["prevent"]),["enter"]),Pn(St(je,["prevent"]),["esc"])]},null,40,E0),[[Wr,c.value]]),v("div",{class:"composer-dropdown-add-actions"},[v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ge},"Open"),v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:je},"Cancel")])],64)):(y(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ke},K(X.value),1))])):he("",!0)])],2)):he("",!0)],512))}}),rl=kt(C0,[["__scopeId","data-v-7cfa2012"]]),A0=["disabled"],x0={class:"search-dropdown-value"},R0={class:"search-dropdown-search-wrap"},P0=["placeholder","onKeydown"],M0={key:0,class:"search-dropdown-list",role:"listbox"},$0=["onClick","onPointerenter"],O0={class:"search-dropdown-option-check"},N0={class:"search-dropdown-option-label"},L0={key:0,class:"search-dropdown-option-desc"},D0={key:1,class:"search-dropdown-empty"},j0=on({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(!1),a=D(""),l=D(0),d=fe(()=>n.openDirection??"down"),c=fe(()=>new Set(n.selectedValues)),m=fe(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const z=n.options.find(J=>J.value===n.selectedValues[0]);return(z==null?void 0:z.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),b=fe(()=>{const z=a.value.toLowerCase().trim();return z?n.options.filter(J=>{var ne;return J.label.toLowerCase().includes(z)||(((ne=J.description)==null?void 0:ne.toLowerCase().includes(z))??!1)}):n.options});function I(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,nn(()=>{var z;return(z=o.value)==null?void 0:z.focus()})))}function j(z){r("toggle",z.value,!c.value.has(z.value))}function $(z){b.value.length!==0&&(l.value=(l.value+z+b.value.length)%b.value.length)}function X(){const z=b.value[l.value];z&&j(z)}function ae(z){if(!i.value)return;const J=s.value;if(!J)return;const ne=z.target;ne instanceof Node&&(J.contains(ne)||(i.value=!1))}return ht(a,()=>{l.value=0}),Gr(()=>window.addEventListener("pointerdown",ae)),Kr(()=>window.removeEventListener("pointerdown",ae)),(z,J)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[v("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:I},[v("span",x0,K(m.value),1),De(zi,{class:"search-dropdown-chevron"})],8,A0),i.value?(y(),k("div",{key:0,class:nt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":d.value==="up","search-dropdown-menu-wrap-down":d.value==="down"}])},[v("div",R0,[Hr(v("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":J[0]||(J[0]=ne=>a.value=ne),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[J[1]||(J[1]=Pn(St(ne=>i.value=!1,["prevent"]),["escape"])),Pn(St(X,["prevent"]),["enter"]),J[2]||(J[2]=Pn(St(ne=>$(1),["prevent"]),["arrow-down"])),J[3]||(J[3]=Pn(St(ne=>$(-1),["prevent"]),["arrow-up"]))]},null,40,P0),[[Wr,a.value]])]),b.value.length>0?(y(),k("ul",M0,[(y(!0),k(Oe,null,yt(b.value,(ne,ke)=>(y(),k("li",{key:ne.value},[v("button",{class:nt(["search-dropdown-option",{"is-selected":c.value.has(ne.value),"is-highlighted":ke===l.value}]),type:"button",onClick:me=>j(ne),onPointerenter:me=>l.value=ke},[v("span",O0,K(c.value.has(ne.value)?"✓":""),1),v("span",N0,K(ne.label),1),ne.description?(y(),k("span",L0,K(ne.description),1)):he("",!0)],42,$0)]))),128))])):(y(),k("div",D0,"No results"))],2)):he("",!0)],512))}}),F0=kt(j0,[["__scopeId","data-v-a0f2edd4"]]),B0={class:"skill-picker-header"},U0=["onKeydown"],H0={key:0,class:"skill-picker-list",role:"listbox"},W0=["onClick","onPointerenter"],V0={class:"skill-picker-name"},z0={key:0,class:"skill-picker-desc"},q0={key:1,class:"skill-picker-empty"},G0=on({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(""),a=D(0),l=fe(()=>{const b=i.value.toLowerCase().trim();return b?n.skills.filter(I=>I.name.toLowerCase().includes(b)||I.description.toLowerCase().includes(b)):n.skills}),d=fe(()=>{const b={};return n.anchorBottom!=null&&(b.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(b.left=`${n.anchorLeft}px`),b});function c(b){l.value.length!==0&&(a.value=(a.value+b+l.value.length)%l.value.length)}function m(){const b=l.value[a.value];b&&r("select",b)}return ht(()=>n.visible,b=>{b&&(i.value="",a.value=0,nn(()=>{var I;return(I=o.value)==null?void 0:I.focus()}))}),ht(i,()=>{a.value=0}),(b,I)=>e.visible?(y(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:is(d.value)},[v("div",B0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":I[0]||(I[0]=j=>i.value=j),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[I[1]||(I[1]=Pn(St(j=>b.$emit("close"),["prevent"]),["escape"])),Pn(St(m,["prevent"]),["enter"]),I[2]||(I[2]=Pn(St(j=>c(1),["prevent"]),["arrow-down"])),I[3]||(I[3]=Pn(St(j=>c(-1),["prevent"]),["arrow-up"]))]},null,40,U0),[[Wr,i.value]])]),l.value.length>0?(y(),k("ul",H0,[(y(!0),k(Oe,null,yt(l.value,(j,$)=>(y(),k("li",{key:j.path},[v("button",{class:nt(["skill-picker-item",{"is-highlighted":$===a.value}]),type:"button",onClick:X=>b.$emit("select",j),onPointerenter:X=>a.value=$},[v("span",V0,K(j.name),1),j.description?(y(),k("span",z0,K(j.description),1)):he("",!0)],42,W0)]))),128))])):(y(),k("div",q0,"No skills found"))],4)):he("",!0)}}),K0=kt(G0,[["__scopeId","data-v-ff3fb7dc"]]),J0={key:0,class:"thread-composer-dictation-error"},Y0={key:0,class:"thread-composer-attachments"},Q0=["src","alt"],X0=["aria-label","disabled","onClick"],Z0={key:1,class:"thread-composer-folder-chips"},eT=["title"],tT={class:"thread-composer-folder-chip-meta"},nT=["aria-label","disabled","onClick"],rT={key:2,class:"thread-composer-file-chips"},sT=["title"],oT=["aria-label","disabled","onClick"],iT={key:3,class:"thread-composer-skill-chips"},aT={class:"thread-composer-skill-chip-name"},lT=["aria-label","onClick"],cT=["title"],uT={class:"thread-composer-rate-limit-row"},dT={class:"thread-composer-rate-limit-value"},fT={key:0,class:"thread-composer-rate-limit-refresh"},hT={class:"thread-composer-input-wrap"},pT={key:0,class:"thread-composer-file-mentions"},mT=["onMousedown"],gT={key:1,class:"thread-composer-file-mention-icon-markdown"},vT={class:"thread-composer-file-mention-text"},yT={class:"thread-composer-file-mention-name"},wT={key:0,class:"thread-composer-file-mention-dir"},bT={key:1,class:"thread-composer-file-mention-empty"},_T=["placeholder","disabled"],kT=["disabled"],TT={key:0,class:"thread-composer-attach-menu"},ST=["disabled"],IT=["disabled"],ET=["disabled"],CT=["aria-label","aria-pressed","disabled"],AT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},xT={key:1,class:"thread-composer-dictation-timer"},RT=["aria-label","title","disabled"],PT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},MT=["disabled"],$T=["aria-label","title","disabled"],OT=["disabled"],NT=["disabled"],LT=["disabled"],DT=on({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},codexQuota:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=D(""),o=D([]),i=D([]),a=D([]),l=D([]),d=D(""),{state:c,isSupported:m,recordingDurationMs:b,waveformCanvasRef:I,startRecording:j,stopRecording:$,toggleRecording:X}=ak({onTranscript:A=>{s.value=s.value?`${s.value}
53
- ${A}`:A,d.value="",nn(()=>{var U;return(U=ke.value)==null?void 0:U.focus()})},onEmpty:()=>{d.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:A=>{if(A instanceof DOMException&&A.name==="NotAllowedError"){d.value="Microphone access was denied.";return}d.value=A instanceof Error?A.message:"Dictation failed."}}),ae=D(null),z=D(null),J=D(null),ne=D(null),ke=D(null),me=D(!1),ge=D(!1),je=D(null),le=D(""),re=D([]),de=D(!1),te=D(0);let Pe=0,Je=null,He=!1;const ze=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),We=[{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"}],Me=fe(()=>n.models.map(A=>({value:A,label:A}))),Ae=fe(()=>n.selectedCollaborationMode==="plan"),qe=fe(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),Fe=fe(()=>n.skills??[]),gt=fe(()=>i.value.map(A=>A.path)),Ht=fe(()=>(n.skills??[]).map(A=>({value:A.path,label:A.name,description:A.description}))),ut=fe(()=>n.disabled||!n.activeThreadId||qe.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),lt=fe(()=>{const A=new Set;for(const U of l.value)for(const se of U.filePaths)A.add(se);return a.value.filter(U=>!A.has(U.fsPath))}),Qe=fe(()=>n.disabled||!n.activeThreadId),W=fe(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),we=fe(()=>c.value==="recording"),ue=fe(()=>c.value==="recording"?"Stop dictation":c.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),ve=fe(()=>c.value==="idle"?d.value.trim():""),xe=fe(()=>{const A=Math.max(0,Math.floor(b.value/1e3)),U=Math.floor(A/60),se=A%60;return`${U}:${String(se).padStart(2,"0")}`}),T=fe(()=>n.activeThreadId?qe.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),E=fe(()=>be(n.codexQuota??null)),O=fe(()=>""),V=fe(()=>Te(n.codexQuota??null));function G(A){return!A||A==="unknown"?"":A==="edu"?"Education":`${A.slice(0,1).toUpperCase()}${A.slice(1)}`}function N(A){return typeof A!="number"||!Number.isFinite(A)||A<=0?"":A%1440===0?`${A/1440}d`:A%60===0?`${A/60}h`:`${A}m`}function F(A){if(typeof A!="number"||!Number.isFinite(A))return"";const se=A*1e3-Date.now();if(se<=0)return"resetting now";const Ne=Math.round(se/6e4);if(Ne<60)return`resets in ${Math.max(1,Ne)}m`;const it=Math.round(Ne/60);if(it<48)return`resets in ${Math.max(1,it)}h`;const wt=Math.round(it/24);return`resets in ${Math.max(1,wt)}d`}function B(A){return typeof A!="number"||!Number.isFinite(A)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(A*1e3))}function ee(A){if(typeof A!="number"||!Number.isFinite(A))return"";const U=new Date(A*1e3);return`${U.getMonth()+1}月${U.getDate()}日`}function Q(A){const U=[A.primary,A.secondary].filter(it=>it!==null),se=U.find(it=>it.windowMinutes===10080);if(se)return se;const Ne=U.filter(it=>typeof it.windowMinutes=="number"&&it.windowMinutes>=10080).sort((it,wt)=>(it.windowMinutes??0)-(wt.windowMinutes??0));return Ne[0]?Ne[0]:A.secondary??null}function Ee(A){const U=Math.max(0,Math.min(100,100-Math.round(A.usedPercent))),se=N(A.windowMinutes);return se?`${U}% / ${se}`:`${U}%`}function be(A){var wt,mt;if(!A)return"";const U=[],se=G(A.planType);se&&U.push(se),A.primary&&U.push(Ee(A.primary)),A.secondary&&U.push(Ee(A.secondary));const Ne=Q(A),it=ee((Ne==null?void 0:Ne.resetsAt)??null);return it&&U.push(it),U.length===0&&((wt=A.credits)!=null&&wt.unlimited)?U.push("Unlimited credits"):U.length===0&&((mt=A.credits)!=null&&mt.hasCredits)&&A.credits.balance&&U.push(`${A.credits.balance} credits`),U.join(" · ")}function Te(A){var it,wt;if(!A)return"";const U=[],se=G(A.planType);if(se&&U.push(`Plan: ${se}`),A.primary){const mt=F(A.primary.resetsAt);U.push(`Primary window: ${Ee(A.primary)}${mt?`, ${mt}`:""}`)}if(A.secondary){const mt=F(A.secondary.resetsAt);U.push(`Secondary window: ${Ee(A.secondary)}${mt?`, ${mt}`:""}`)}(it=A.credits)!=null&&it.unlimited?U.push("Credits: unlimited"):(wt=A.credits)!=null&&wt.hasCredits&&A.credits.balance&&U.push(`Credits: ${A.credits.balance}`);const Ne=Q(A);if(Ne){const mt=B(Ne.resetsAt);mt&&U.push(`Weekly refresh: ${mt}`)}return U.join(`
54
- `)}function Ce(A="steer"){var se;const U=s.value.trim();if(ut.value){if(r("submit",{text:U,imageUrls:o.value.map(Ne=>Ne.url),fileAttachments:[...a.value],skills:i.value.map(Ne=>({name:Ne.name,path:Ne.path})),mode:A}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],me.value=!1,ge.value=!1,$e(),ze){(se=ke.value)==null||se.blur();return}nn(()=>{var Ne;return(Ne=ke.value)==null?void 0:Ne.focus()})}}function Ge(){r("interrupt")}function ot(A){r("update:selected-model",A)}function Ve(){r("update:selected-collaboration-mode",Ae.value?"default":"plan")}function dt(A){r("update:selected-reasoning-effort",A)}function pt(){n.dictationClickToToggle&&(d.value&&(d.value=""),X())}function Et(A){if(n.dictationClickToToggle||(A.preventDefault(),He))return;He=!0;const U=A.currentTarget;if(U)try{U.setPointerCapture(A.pointerId)}catch{}d.value&&(d.value=""),window.addEventListener("pointerup",Be),window.addEventListener("pointercancel",Be),window.addEventListener("blur",Be),j()}function Be(){n.dictationClickToToggle||He&&(He=!1,window.removeEventListener("pointerup",Be),window.removeEventListener("pointercancel",Be),window.removeEventListener("blur",Be),$())}function Lt(){Qe.value||(me.value=!me.value)}function Tt(){var A;(A=z.value)==null||A.click()}function ft(){var A;(A=J.value)==null||A.click()}function ct(){var A;(A=ne.value)==null||A.click()}function vt(A){o.value=o.value.filter(U=>U.id!==A)}function Gt(A){i.value=i.value.filter(U=>U.path!==A)}function $t(A){a.value=a.value.filter(U=>U.fsPath!==A)}function Bt(A){const U=l.value.find(Ne=>Ne.id===A);if(!U)return;const se=new Set(U.filePaths);a.value=a.value.filter(Ne=>!se.has(Ne.fsPath)),l.value=l.value.filter(Ne=>Ne.id!==A)}function On(A){return A.total<=0?0:Math.round(A.processed/A.total*100)}function Yt(A,U){const se=A.replace(/\\/g,"/");if(a.value.some(wt=>wt.fsPath===se))return;const Ne=se.split("/").filter(Boolean),it=(U==null?void 0:U.trim())||Ne[Ne.length-1]||se;a.value=[...a.value,{label:it,path:se,fsPath:se}]}function _n(A){return A.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(A.name)}function Qt(A){const U=new FileReader;U.onload=()=>{typeof U.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:A.name||`Pasted image ${o.value.length+1}`,url:U.result})},U.readAsDataURL(A)}function Kt(A){if(!(!A||A.length===0))for(const U of Array.from(A)){if(_n(U)){Qt(U);continue}Iu(U).then(se=>{se&&Yt(se)}).catch(()=>{})}}function en(A){var Ne,it;const U=(Ne=A.clipboardData)==null?void 0:Ne.items;if(U&&U.length>0){const wt=[];for(const mt of Array.from(U)){if(mt.kind!=="file"||!mt.type.startsWith("image/"))continue;const Wt=mt.getAsFile();Wt&&wt.push(Wt)}if(wt.length>0)return wt}const se=(it=A.clipboardData)==null?void 0:it.files;return!se||se.length===0?[]:Array.from(se).filter(wt=>_n(wt))}function un(A){if(Qe.value)return;const U=en(A);U.length!==0&&(A.preventDefault(),Kt(U),me.value=!1,d.value&&(d.value=""))}async function Bn(A){if(!A||A.length===0)return;const U=Array.from(A),Ne=(U[0].webkitRelativePath||U[0].name).split("/").filter(Boolean)[0]||"Folder",it=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:it,name:Ne,total:U.length,processed:0,filePaths:[],isUploading:!0}];const wt=mt=>{l.value=l.value.map(Wt=>Wt.id===it?mt(Wt):Wt)};for(const mt of U)try{const Wt=await Iu(mt);if(Wt){const In=mt.webkitRelativePath||mt.name;Yt(Wt,In),wt(Hn=>({...Hn,processed:Hn.processed+1,filePaths:[...Hn.filePaths,Wt]}));continue}wt(In=>({...In,processed:In.processed+1}))}catch{wt(Wt=>({...Wt,processed:Wt.processed+1}))}wt(mt=>({...mt,isUploading:!1}))}function kn(A){A&&(A.value="")}function dn(A){const U=A.target;Kt((U==null?void 0:U.files)??null),kn(U),me.value=!1}function fn(A){const U=A.target;Kt((U==null?void 0:U.files)??null),kn(U),me.value=!1}function qn(A){const U=A.target;Bn((U==null?void 0:U.files)??null),kn(U),me.value=!1}function Zn(){d.value&&(d.value="");const U=s.value.startsWith("/");U!==ge.value&&(ge.value=U),Re()}function Ut(A){if(de.value){if(A.key==="Escape"){A.preventDefault(),$e();return}if(A.key==="ArrowDown"){A.preventDefault(),re.value.length>0&&(te.value=(te.value+1)%re.value.length);return}if(A.key==="ArrowUp"){if(A.preventDefault(),re.value.length>0){const se=re.value.length;te.value=(te.value+se-1)%se}return}if(A.key==="Enter"||A.key==="Tab"){A.preventDefault();const se=re.value[te.value];se?zt(se):$e();return}}if(n.sendWithEnter!==!1?A.key==="Enter"&&!A.shiftKey:A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),Ce(n.isTurnInProgress?W.value:"steer");return}if(ge.value){if(A.key==="Escape"){A.preventDefault(),an();return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){A.preventDefault();return}}}function an(){var A;ge.value=!1,(A=ke.value)==null||A.focus()}function $e(){de.value=!1,je.value=null,le.value="",re.value=[],te.value=0}function Re(){const A=ke.value;if(!A){$e();return}const U=A.selectionStart??s.value.length,Ne=s.value.slice(0,U).match(/(^|\s)(@[^\s@]*)$/);if(!Ne){$e();return}const it=Ne[2]??"",wt=it.length,mt=U-wt;je.value=mt,le.value=it.slice(1),de.value=!0,Tn()}async function Tn(){if(!de.value)return;const A=(n.cwd??"").trim();if(!A){re.value=[];return}Je&&clearTimeout(Je);const U=++Pe;Je=setTimeout(async()=>{try{const se=await o0(A,le.value,20);if(!de.value||U!==Pe)return;re.value=se,te.value=0}catch{if(!de.value||U!==Pe)return;re.value=[]}},120)}function zt(A){const U=ke.value,se=je.value;if(se!==null&&U){const Ne=U.selectionStart??s.value.length;s.value=`${s.value.slice(0,se)}${s.value.slice(Ne)}`.trimEnd()}Yt(A.path),$e(),nn(()=>U==null?void 0:U.focus())}function Nn(A){const U=A.lastIndexOf("/");return U<0?A:A.slice(U+1)}function er(A){const U=A.lastIndexOf("/");return U<=0?"":A.slice(0,U)}function Ln(A){const U=Nn(A),se=U.lastIndexOf(".");return se<=0?"":U.slice(se+1).toLowerCase()}function Sn(A){const U=Ln(A);return U==="ts"?"TS":U==="tsx"?"TSX":U==="js"?"JS":U==="jsx"?"JSX":U==="json"?"{}":""}function Gn(A){const U=Ln(A);return U.startsWith("ts")?"ts":U.startsWith("js")?"js":U==="json"?"json":"default"}function Dn(A){const U=Ln(A);return U==="md"||U==="mdx"}function Un(A){var U;i.value.some(se=>se.path===A.path)||(i.value=[...i.value,A]),s.value=s.value.startsWith("/")?"":s.value,ge.value=!1,(U=ke.value)==null||U.focus()}function Kn(A,U){if(U){const se=(n.skills??[]).find(Ne=>Ne.path===A);se&&!i.value.some(Ne=>Ne.path===A)&&(i.value=[...i.value,se])}else i.value=i.value.filter(se=>se.path!==A)}function hn(A){if(!me.value)return;const U=ae.value;if(!U)return;const se=A.target;!se||U.contains(se)||(me.value=!1)}return Gr(()=>{document.addEventListener("click",hn)}),Kr(()=>{document.removeEventListener("click",hn),window.removeEventListener("pointerup",Be),window.removeEventListener("pointercancel",Be),window.removeEventListener("blur",Be),Je&&clearTimeout(Je)}),ht(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],d.value="",me.value=!1,ge.value=!1,$e()}),ht(()=>n.cwd,()=>{de.value&&Tn()}),(A,U)=>(y(),k("form",{class:"thread-composer",onSubmit:U[2]||(U[2]=St(se=>Ce("steer"),["prevent"]))},[ve.value?(y(),k("p",J0,K(ve.value),1)):he("",!0),v("div",{class:nt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(y(),k("div",Y0,[(y(!0),k(Oe,null,yt(o.value,se=>(y(),k("div",{key:se.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:se.url,alt:se.name||"Selected image"},null,8,Q0),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${se.name||"image"}`,disabled:Qe.value,onClick:Ne=>vt(se.id)}," x ",8,X0)]))),128))])):he("",!0),l.value.length>0?(y(),k("div",Z0,[(y(!0),k(Oe,null,yt(l.value,se=>(y(),k("span",{key:se.id,class:"thread-composer-folder-chip"},[De(Bl,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:se.name},K(se.name),9,eT),v("span",tT,[se.isUploading?(y(),k(Oe,{key:0},[Ro(K(On(se))+"% uploading ("+K(se.processed)+"/"+K(se.total)+") ",1)],64)):(y(),k(Oe,{key:1},[Ro(K(se.filePaths.length)+" file"+K(se.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${se.name}`,disabled:Qe.value,onClick:Ne=>Bt(se.id)},"×",8,nT)]))),128))])):he("",!0),lt.value.length>0?(y(),k("div",rT,[(y(!0),k(Oe,null,yt(lt.value,se=>(y(),k("span",{key:se.fsPath,class:"thread-composer-file-chip"},[De(Ti,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:se.fsPath},K(se.label),9,sT),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${se.label}`,disabled:Qe.value,onClick:Ne=>$t(se.fsPath)},"×",8,oT)]))),128))])):he("",!0),i.value.length>0?(y(),k("div",iT,[(y(!0),k(Oe,null,yt(i.value,se=>(y(),k("span",{key:se.path,class:"thread-composer-skill-chip"},[v("span",aT,K(se.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${se.name}`,onClick:Ne=>Gt(se.path)},"×",8,lT)]))),128))])):he("",!0),E.value?(y(),k("div",{key:4,class:"thread-composer-rate-limit",title:V.value,"aria-live":"polite"},[v("span",uT,[v("span",dT,K(E.value),1)]),O.value?(y(),k("span",fT,K(O.value),1)):he("",!0)],8,cT)):he("",!0),v("div",hT,[de.value?(y(),k("div",pT,[re.value.length>0?(y(!0),k(Oe,{key:0},yt(re.value,(se,Ne)=>(y(),k("button",{key:se.path,class:nt(["thread-composer-file-mention-row",{"is-active":Ne===te.value}]),type:"button",onMousedown:St(it=>zt(se),["prevent"])},[Sn(se.path)?(y(),k("span",{key:0,class:nt(["thread-composer-file-mention-icon-badge",`is-${Gn(se.path)}`])},K(Sn(se.path)),3)):Dn(se.path)?(y(),k("span",gT,"↓")):(y(),_t(Ti,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",vT,[v("span",yT,K(Nn(se.path)),1),er(se.path)?(y(),k("span",wT,K(er(se.path)),1)):he("",!0)])],42,mT))),128)):(y(),k("div",bT,"No matching files"))])):he("",!0),Hr(v("textarea",{ref_key:"inputRef",ref:ke,"onUpdate:modelValue":U[0]||(U[0]=se=>s.value=se),class:"thread-composer-input",placeholder:T.value,disabled:Qe.value,onInput:Zn,onKeydown:Ut,onPaste:un},null,40,_T),[[Wr,s.value]]),De(K0,{skills:Fe.value,visible:ge.value,"anchor-bottom":44,"anchor-left":0,onSelect:Un,onClose:an},null,8,["skills","visible"])]),v("div",{class:nt(["thread-composer-controls",{"thread-composer-controls--recording":we.value}])},[v("div",{ref_key:"attachMenuRootRef",ref:ae,class:"thread-composer-attach"},[v("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Qe.value,onClick:Lt}," + ",8,kT),me.value?(y(),k("div",TT,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:Qe.value,onClick:Tt}," Add photos & files ",8,ST),v("button",{class:"thread-composer-attach-item",type:"button",disabled:Qe.value,onClick:ct}," Add folder ",8,IT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:Qe.value,onClick:ft}," Take photo ",8,ET)])):he("",!0)],512),we.value?he("",!0):(y(),k(Oe,{key:0},[v("button",{class:nt(["thread-composer-plan-toggle",{"is-active":Ae.value}]),type:"button","aria-label":Ae.value?"Disable plan mode":"Enable plan mode","aria-pressed":Ae.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:Ve},[...U[3]||(U[3]=[v("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1),v("span",{class:"thread-composer-plan-toggle-switch","aria-hidden":"true"},[v("span",{class:"thread-composer-plan-toggle-switch-thumb"})],-1)])],10,CT),De(rl,{class:"thread-composer-control","model-value":e.selectedModel,options:Me.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":ot},null,8,["model-value","options","disabled"]),De(F0,{class:"thread-composer-control",options:Ht.value,"selected-values":gt.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:Kn},null,8,["options","selected-values","disabled"]),De(rl,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:We,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":dt},null,8,["model-value","disabled"])],64)),v("div",{class:nt(["thread-composer-actions",{"thread-composer-actions--recording":we.value}])},[_e(c)==="recording"?(y(),k("div",AT,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:I,class:"thread-composer-dictation-waveform"},null,512)])):he("",!0),_e(c)==="recording"?(y(),k("span",xT,K(xe.value),1)):he("",!0),_e(m)&&!e.isTurnInProgress?(y(),k("button",{key:2,class:nt(["thread-composer-mic",{"thread-composer-mic--active":_e(c)==="recording","thread-composer-mic--transcribing":_e(c)==="transcribing"}]),type:"button","aria-label":ue.value,title:ue.value,disabled:Qe.value||_e(c)==="transcribing",onClick:pt,onPointerdown:Et,onPointerup:Be,onPointercancel:Be},[_e(c)==="recording"?(y(),_t(Eu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):_e(c)==="transcribing"?(y(),k("span",PT)):(y(),_t(h0,{key:2,class:"thread-composer-mic-icon"}))],42,RT)):he("",!0),e.isTurnInProgress?(y(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Ge},[De(Eu,{class:"thread-composer-stop-icon"})],8,MT)):he("",!0),v("button",{class:nt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&W.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&W.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${W.value}`:"Send",disabled:!ut.value,onClick:U[1]||(U[1]=se=>Ce(e.isTurnInProgress?W.value:"steer"))},[De(Hf,{class:"thread-composer-submit-icon"})],10,$T)],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:z,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Qe.value,onChange:dn},null,40,OT),v("input",{ref_key:"cameraCaptureInputRef",ref:J,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Qe.value,onChange:fn},null,40,NT),v("input",{ref_key:"folderPickerInputRef",ref:ne,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Qe.value,onChange:qn},null,40,LT)],32))}}),Cu=kt(DT,[["__scopeId","data-v-dc703024"]]),jT={key:0,class:"queued-messages"},FT={class:"queued-messages-inner"},BT={class:"queued-row-text"},UT={class:"queued-row-actions"},HT=["onClick"],WT=["onClick"],VT=on({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(y(),k("div",jT,[v("div",FT,[(y(!0),k(Oe,null,yt(e.messages,r=>(y(),k("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=v("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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)),v("span",BT,K(r.text),1),v("div",UT,[v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,HT),v("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[v("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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,WT)])]))),128))])])):he("",!0)}}),zT=kt(VT,[["__scopeId","data-v-ea583733"]]),qT={class:"runtime-dropdown-trigger-label"},GT={key:0,class:"runtime-dropdown-menu-wrap"},KT={class:"runtime-dropdown-menu"},JT=["onClick"],YT={class:"runtime-dropdown-option-label"},QT={key:0,class:"runtime-dropdown-option-check"},XT=on({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(!1),i=[{value:"local",label:"Local project",icon:Bl},{value:"worktree",label:"New worktree",icon:ui}],a=fe(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function d(c){if(!o.value)return;const m=s.value;if(!m)return;const b=c.target;b instanceof Node&&(m.contains(b)||(o.value=!1))}return Gr(()=>{window.addEventListener("pointerdown",d)}),Kr(()=>{window.removeEventListener("pointerdown",d)}),(c,m)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[v("button",{class:"runtime-dropdown-trigger",type:"button",onClick:m[0]||(m[0]=b=>o.value=!o.value)},[(y(),_t(wi(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),v("span",qT,K(a.value.label),1),De(zi,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(y(),k("div",GT,[v("div",KT,[m[1]||(m[1]=v("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(y(),k(Oe,null,yt(i,b=>v("button",{key:b.value,class:nt(["runtime-dropdown-option",{"is-selected":e.modelValue===b.value}]),type:"button",onClick:I=>l(b.value)},[(y(),_t(wi(b.icon),{class:"runtime-dropdown-option-icon"})),v("span",YT,K(b.label),1),e.modelValue===b.value?(y(),k("span",QT,"✓")):he("",!0)],10,JT)),64))])])):he("",!0)],512))}}),ZT=kt(XT,[["__scopeId","data-v-9c9b71e5"]]),eS={},tS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function nS(e,t){return y(),k("svg",tS,[...t[0]||(t[0]=[v("circle",{cx:"11",cy:"11",r:"8"},null,-1),v("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const sl=kt(eS,[["render",nS]]),rS={class:"skill-card-top"},sS=["src","alt"],oS={key:1,class:"skill-card-avatar-fallback"},iS={class:"skill-card-info"},aS={class:"skill-card-header"},lS={class:"skill-card-name"},cS={key:0,class:"skill-card-badge-disabled"},uS={key:1,class:"skill-card-badge"},dS={class:"skill-card-owner"},fS={key:0,class:"skill-card-desc"},hS={key:1,class:"skill-card-date"},pS=on({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=fe(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(y(),k("button",{class:nt(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[v("div",rS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,sS)):(y(),k("div",oS,K(e.skill.owner.charAt(0)),1)),v("div",iS,[v("div",aS,[v("span",lS,K(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(y(),k("span",cS,"Disabled")):e.skill.installed?(y(),k("span",uS,"Installed")):he("",!0)]),v("span",dS,K(e.skill.owner),1)])]),e.skill.description?(y(),k("p",fS,K(e.skill.description),1)):he("",!0),n.value?(y(),k("span",hS,K(n.value),1)):he("",!0)],2))}}),Au=kt(pS,[["__scopeId","data-v-2a1e8196"]]),mS={class:"sdm-panel"},gS={class:"sdm-header"},vS={class:"sdm-title-area"},yS=["src","alt"],wS={class:"sdm-title-col"},bS={class:"sdm-title-row"},_S={class:"sdm-title"},kS={key:0,class:"sdm-badge-disabled"},TS={class:"sdm-owner"},SS={class:"sdm-body"},IS={key:0,class:"sdm-desc"},ES={key:1,class:"sdm-readme-loading"},CS=["innerHTML"],AS=["href"],xS={class:"sdm-footer"},RS={class:"sdm-footer-actions"},PS=["disabled"],MS=["disabled"],$S=["disabled"],OS=on({__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=D(null),o=D(""),i=D(!1),a=fe(()=>s.value??n.skill.enabled??!0),l=fe(()=>n.isInstalling===!0||n.isUninstalling===!0),d=fe(()=>{const $=o.value;if(!$)return"";const X=$.replace(/^---[\s\S]*?---\s*/,"");return c(X)});function c($){return $.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 m(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const $=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),X=await fetch(`/codex-api/skills-hub/readme?${$}`);if(!X.ok)return;const ae=await X.json();o.value=ae.content??""}catch{}finally{i.value=!1}}}ht(()=>n.visible,$=>{$&&(s.value=null,o.value="",m())});function b(){r("install",n.skill)}function I(){r("uninstall",n.skill)}function j(){const $=!a.value;s.value=$,r("toggle-enabled",n.skill,$)}return($,X)=>(y(),_t(vo,{to:"body"},[e.visible?(y(),k("div",{key:0,class:"sdm-overlay",onClick:X[1]||(X[1]=St(ae=>$.$emit("close"),["self"]))},[v("div",mS,[v("div",gS,[v("div",vS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,yS)):he("",!0),v("div",wS,[v("div",bS,[v("h3",_S,K(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(y(),k("span",kS,"Disabled")):he("",!0)]),v("span",TS,K(e.skill.owner),1)])]),v("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:X[0]||(X[0]=ae=>$.$emit("close"))},[De(Ul,{class:"sdm-close-icon"})])]),v("div",SS,[e.skill.description?(y(),k("p",IS,K(e.skill.description),1)):he("",!0),i.value?(y(),k("div",ES,"Loading skill contents...")):o.value?(y(),k("div",{key:2,class:"sdm-readme",innerHTML:d.value},null,8,CS)):he("",!0),v("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,AS)]),v("div",xS,[v("div",RS,[e.skill.installed?(y(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:I},K(n.isUninstalling?"Uninstalling...":"Uninstall"),9,PS)):(y(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:b},K(n.isInstalling?"Installing...":"Install"),9,MS)),e.skill.installed?(y(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:j},K(a.value?"Disable":"Enable"),9,$S)):he("",!0)])])])])):he("",!0)]))}}),NS=kt(OS,[["__scopeId","data-v-19a385ca"]]),LS=()=>{};var xu={};/**
55
- * @license
56
- * Copyright 2017 Google LLC
57
- *
58
- * Licensed under the Apache License, Version 2.0 (the "License");
59
- * you may not use this file except in compliance with the License.
60
- * You may obtain a copy of the License at
61
- *
62
- * http://www.apache.org/licenses/LICENSE-2.0
63
- *
64
- * Unless required by applicable law or agreed to in writing, software
65
- * distributed under the License is distributed on an "AS IS" BASIS,
66
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67
- * See the License for the specific language governing permissions and
68
- * limitations under the License.
69
- */const Yf=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("")},Qf={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,d=l?e[s+2]:0,c=o>>2,m=(o&3)<<4|a>>4;let b=(a&15)<<2|d>>6,I=d&63;l||(I=64,i||(b=64)),r.push(n[c],n[m],n[b],n[I])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Yf(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 d=s<e.length?n[e.charAt(s)]:64;++s;const m=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||d==null||m==null)throw new jS;const b=o<<2|a>>4;if(r.push(b),d!==64){const I=a<<4&240|d>>2;if(r.push(I),m!==64){const j=d<<6&192|m;r.push(j)}}}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 jS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const FS=function(e){const t=Yf(e);return Qf.encodeByteArray(t,!0)},Xf=function(e){return FS(e).replace(/\./g,"")},Zf=function(e){try{return Qf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
70
- * @license
71
- * Copyright 2022 Google LLC
72
- *
73
- * Licensed under the Apache License, Version 2.0 (the "License");
74
- * you may not use this file except in compliance with the License.
75
- * You may obtain a copy of the License at
76
- *
77
- * http://www.apache.org/licenses/LICENSE-2.0
78
- *
79
- * Unless required by applicable law or agreed to in writing, software
80
- * distributed under the License is distributed on an "AS IS" BASIS,
81
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
- * See the License for the specific language governing permissions and
83
- * limitations under the License.
84
- */function BS(){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.")}/**
85
- * @license
86
- * Copyright 2022 Google LLC
87
- *
88
- * Licensed under the Apache License, Version 2.0 (the "License");
89
- * you may not use this file except in compliance with the License.
90
- * You may obtain a copy of the License at
91
- *
92
- * http://www.apache.org/licenses/LICENSE-2.0
93
- *
94
- * Unless required by applicable law or agreed to in writing, software
95
- * distributed under the License is distributed on an "AS IS" BASIS,
96
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
97
- * See the License for the specific language governing permissions and
98
- * limitations under the License.
99
- */const US=()=>BS().__FIREBASE_DEFAULTS__,HS=()=>{if(typeof process>"u"||typeof xu>"u")return;const e=xu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},WS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Zf(e[1]);return t&&JSON.parse(t)},Vl=()=>{try{return LS()||US()||HS()||WS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},VS=e=>{var t,n;return(n=(t=Vl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},eh=()=>{var e;return(e=Vl())==null?void 0:e.config},th=e=>{var t;return(t=Vl())==null?void 0:t[`_${e}`]};/**
100
- * @license
101
- * Copyright 2017 Google LLC
102
- *
103
- * Licensed under the Apache License, Version 2.0 (the "License");
104
- * you may not use this file except in compliance with the License.
105
- * You may obtain a copy of the License at
106
- *
107
- * http://www.apache.org/licenses/LICENSE-2.0
108
- *
109
- * Unless required by applicable law or agreed to in writing, software
110
- * distributed under the License is distributed on an "AS IS" BASIS,
111
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
- * See the License for the specific language governing permissions and
113
- * limitations under the License.
114
- */class zS{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))}}}/**
115
- * @license
116
- * Copyright 2017 Google LLC
117
- *
118
- * Licensed under the Apache License, Version 2.0 (the "License");
119
- * you may not use this file except in compliance with the License.
120
- * You may obtain a copy of the License at
121
- *
122
- * http://www.apache.org/licenses/LICENSE-2.0
123
- *
124
- * Unless required by applicable law or agreed to in writing, software
125
- * distributed under the License is distributed on an "AS IS" BASIS,
126
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127
- * See the License for the specific language governing permissions and
128
- * limitations under the License.
129
- */function $n(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function qS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test($n())}function GS(){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 JS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function YS(){const e=$n();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function QS(){try{return typeof indexedDB=="object"}catch{return!1}}function XS(){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)}})}/**
130
- * @license
131
- * Copyright 2017 Google LLC
132
- *
133
- * Licensed under the Apache License, Version 2.0 (the "License");
134
- * you may not use this file except in compliance with the License.
135
- * You may obtain a copy of the License at
136
- *
137
- * http://www.apache.org/licenses/LICENSE-2.0
138
- *
139
- * Unless required by applicable law or agreed to in writing, software
140
- * distributed under the License is distributed on an "AS IS" BASIS,
141
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142
- * See the License for the specific language governing permissions and
143
- * limitations under the License.
144
- */const ZS="FirebaseError";class ds extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=ZS,Object.setPrototypeOf(this,ds.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Uo.prototype.create)}}class Uo{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?eI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new ds(s,a,r)}}function eI(e,t){return e.replace(tI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const tI=/\{\$([^}]+)}/g;function nI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Xs(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(Ru(o)&&Ru(i)){if(!Xs(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Ru(e){return e!==null&&typeof e=="object"}/**
145
- * @license
146
- * Copyright 2017 Google LLC
147
- *
148
- * Licensed under the Apache License, Version 2.0 (the "License");
149
- * you may not use this file except in compliance with the License.
150
- * You may obtain a copy of the License at
151
- *
152
- * http://www.apache.org/licenses/LICENSE-2.0
153
- *
154
- * Unless required by applicable law or agreed to in writing, software
155
- * distributed under the License is distributed on an "AS IS" BASIS,
156
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157
- * See the License for the specific language governing permissions and
158
- * limitations under the License.
159
- */function Ho(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 rI(e,t){const n=new sI(e,t);return n.subscribe.bind(n)}class sI{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.");oI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Ta),s.error===void 0&&(s.error=Ta),s.complete===void 0&&(s.complete=Ta);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 oI(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 Ta(){}/**
160
- * @license
161
- * Copyright 2021 Google LLC
162
- *
163
- * Licensed under the Apache License, Version 2.0 (the "License");
164
- * you may not use this file except in compliance with the License.
165
- * You may obtain a copy of the License at
166
- *
167
- * http://www.apache.org/licenses/LICENSE-2.0
168
- *
169
- * Unless required by applicable law or agreed to in writing, software
170
- * distributed under the License is distributed on an "AS IS" BASIS,
171
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
172
- * See the License for the specific language governing permissions and
173
- * limitations under the License.
174
- */function to(e){return e&&e._delegate?e._delegate:e}/**
175
- * @license
176
- * Copyright 2025 Google LLC
177
- *
178
- * Licensed under the Apache License, Version 2.0 (the "License");
179
- * you may not use this file except in compliance with the License.
180
- * You may obtain a copy of the License at
181
- *
182
- * http://www.apache.org/licenses/LICENSE-2.0
183
- *
184
- * Unless required by applicable law or agreed to in writing, software
185
- * distributed under the License is distributed on an "AS IS" BASIS,
186
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
- * See the License for the specific language governing permissions and
188
- * limitations under the License.
189
- */function zl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function iI(e){return(await fetch(e,{credentials:"include"})).ok}class Zs{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}}/**
190
- * @license
191
- * Copyright 2019 Google LLC
192
- *
193
- * Licensed under the Apache License, Version 2.0 (the "License");
194
- * you may not use this file except in compliance with the License.
195
- * You may obtain a copy of the License at
196
- *
197
- * http://www.apache.org/licenses/LICENSE-2.0
198
- *
199
- * Unless required by applicable law or agreed to in writing, software
200
- * distributed under the License is distributed on an "AS IS" BASIS,
201
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
- * See the License for the specific language governing permissions and
203
- * limitations under the License.
204
- */const ks="[DEFAULT]";/**
205
- * @license
206
- * Copyright 2019 Google LLC
207
- *
208
- * Licensed under the Apache License, Version 2.0 (the "License");
209
- * you may not use this file except in compliance with the License.
210
- * You may obtain a copy of the License at
211
- *
212
- * http://www.apache.org/licenses/LICENSE-2.0
213
- *
214
- * Unless required by applicable law or agreed to in writing, software
215
- * distributed under the License is distributed on an "AS IS" BASIS,
216
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
217
- * See the License for the specific language governing permissions and
218
- * limitations under the License.
219
- */class aI{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 zS;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(cI(t))try{this.getOrInitializeService({instanceIdentifier:ks})}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=ks){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=ks){return this.instances.has(t)}getOptions(t=ks){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:lI(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=ks){return this.component?this.component.multipleInstances?t:ks:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function lI(e){return e===ks?void 0:e}function cI(e){return e.instantiationMode==="EAGER"}/**
220
- * @license
221
- * Copyright 2019 Google LLC
222
- *
223
- * Licensed under the Apache License, Version 2.0 (the "License");
224
- * you may not use this file except in compliance with the License.
225
- * You may obtain a copy of the License at
226
- *
227
- * http://www.apache.org/licenses/LICENSE-2.0
228
- *
229
- * Unless required by applicable law or agreed to in writing, software
230
- * distributed under the License is distributed on an "AS IS" BASIS,
231
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
232
- * See the License for the specific language governing permissions and
233
- * limitations under the License.
234
- */class uI{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 aI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
235
- * @license
236
- * Copyright 2017 Google LLC
237
- *
238
- * Licensed under the Apache License, Version 2.0 (the "License");
239
- * you may not use this file except in compliance with the License.
240
- * You may obtain a copy of the License at
241
- *
242
- * http://www.apache.org/licenses/LICENSE-2.0
243
- *
244
- * Unless required by applicable law or agreed to in writing, software
245
- * distributed under the License is distributed on an "AS IS" BASIS,
246
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
247
- * See the License for the specific language governing permissions and
248
- * limitations under the License.
249
- */var Ot;(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"})(Ot||(Ot={}));const dI={debug:Ot.DEBUG,verbose:Ot.VERBOSE,info:Ot.INFO,warn:Ot.WARN,error:Ot.ERROR,silent:Ot.SILENT},fI=Ot.INFO,hI={[Ot.DEBUG]:"log",[Ot.VERBOSE]:"log",[Ot.INFO]:"info",[Ot.WARN]:"warn",[Ot.ERROR]:"error"},pI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=hI[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 nh{constructor(t){this.name=t,this._logLevel=fI,this._logHandler=pI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Ot))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?dI[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,Ot.DEBUG,...t),this._logHandler(this,Ot.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Ot.VERBOSE,...t),this._logHandler(this,Ot.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Ot.INFO,...t),this._logHandler(this,Ot.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Ot.WARN,...t),this._logHandler(this,Ot.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Ot.ERROR,...t),this._logHandler(this,Ot.ERROR,...t)}}const mI=(e,t)=>t.some(n=>e instanceof n);let Pu,Mu;function gI(){return Pu||(Pu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function vI(){return Mu||(Mu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const rh=new WeakMap,ol=new WeakMap,sh=new WeakMap,Sa=new WeakMap,ql=new WeakMap;function yI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(as(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&rh.set(n,e)}).catch(()=>{}),ql.set(t,e),t}function wI(e){if(ol.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)});ol.set(e,t)}let il={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return ol.get(e);if(t==="objectStoreNames")return e.objectStoreNames||sh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return as(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 bI(e){il=e(il)}function _I(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ia(this),t,...n);return sh.set(r,t.sort?t.sort():[t]),as(r)}:vI().includes(e)?function(...t){return e.apply(Ia(this),t),as(rh.get(this))}:function(...t){return as(e.apply(Ia(this),t))}}function kI(e){return typeof e=="function"?_I(e):(e instanceof IDBTransaction&&wI(e),mI(e,gI())?new Proxy(e,il):e)}function as(e){if(e instanceof IDBRequest)return yI(e);if(Sa.has(e))return Sa.get(e);const t=kI(e);return t!==e&&(Sa.set(e,t),ql.set(t,e)),t}const Ia=e=>ql.get(e);function TI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=as(i);return r&&i.addEventListener("upgradeneeded",l=>{r(as(i.result),l.oldVersion,l.newVersion,as(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",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const SI=["get","getKey","getAll","getAllKeys","count"],II=["put","add","delete","clear"],Ea=new Map;function $u(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ea.get(t))return Ea.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=II.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||SI.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),s&&l.done]))[0]};return Ea.set(t,o),o}bI(e=>({...e,get:(t,n,r)=>$u(t,n)||e.get(t,n,r),has:(t,n)=>!!$u(t,n)||e.has(t,n)}));/**
250
- * @license
251
- * Copyright 2019 Google LLC
252
- *
253
- * Licensed under the Apache License, Version 2.0 (the "License");
254
- * you may not use this file except in compliance with the License.
255
- * You may obtain a copy of the License at
256
- *
257
- * http://www.apache.org/licenses/LICENSE-2.0
258
- *
259
- * Unless required by applicable law or agreed to in writing, software
260
- * distributed under the License is distributed on an "AS IS" BASIS,
261
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
262
- * See the License for the specific language governing permissions and
263
- * limitations under the License.
264
- */class EI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(CI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function CI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const al="@firebase/app",Ou="0.14.10";/**
265
- * @license
266
- * Copyright 2019 Google LLC
267
- *
268
- * Licensed under the Apache License, Version 2.0 (the "License");
269
- * you may not use this file except in compliance with the License.
270
- * You may obtain a copy of the License at
271
- *
272
- * http://www.apache.org/licenses/LICENSE-2.0
273
- *
274
- * Unless required by applicable law or agreed to in writing, software
275
- * distributed under the License is distributed on an "AS IS" BASIS,
276
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
277
- * See the License for the specific language governing permissions and
278
- * limitations under the License.
279
- */const Vr=new nh("@firebase/app"),AI="@firebase/app-compat",xI="@firebase/analytics-compat",RI="@firebase/analytics",PI="@firebase/app-check-compat",MI="@firebase/app-check",$I="@firebase/auth",OI="@firebase/auth-compat",NI="@firebase/database",LI="@firebase/data-connect",DI="@firebase/database-compat",jI="@firebase/functions",FI="@firebase/functions-compat",BI="@firebase/installations",UI="@firebase/installations-compat",HI="@firebase/messaging",WI="@firebase/messaging-compat",VI="@firebase/performance",zI="@firebase/performance-compat",qI="@firebase/remote-config",GI="@firebase/remote-config-compat",KI="@firebase/storage",JI="@firebase/storage-compat",YI="@firebase/firestore",QI="@firebase/ai",XI="@firebase/firestore-compat",ZI="firebase",eE="12.11.0";/**
280
- * @license
281
- * Copyright 2019 Google LLC
282
- *
283
- * Licensed under the Apache License, Version 2.0 (the "License");
284
- * you may not use this file except in compliance with the License.
285
- * You may obtain a copy of the License at
286
- *
287
- * http://www.apache.org/licenses/LICENSE-2.0
288
- *
289
- * Unless required by applicable law or agreed to in writing, software
290
- * distributed under the License is distributed on an "AS IS" BASIS,
291
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
292
- * See the License for the specific language governing permissions and
293
- * limitations under the License.
294
- */const ll="[DEFAULT]",tE={[al]:"fire-core",[AI]:"fire-core-compat",[RI]:"fire-analytics",[xI]:"fire-analytics-compat",[MI]:"fire-app-check",[PI]:"fire-app-check-compat",[$I]:"fire-auth",[OI]:"fire-auth-compat",[NI]:"fire-rtdb",[LI]:"fire-data-connect",[DI]:"fire-rtdb-compat",[jI]:"fire-fn",[FI]:"fire-fn-compat",[BI]:"fire-iid",[UI]:"fire-iid-compat",[HI]:"fire-fcm",[WI]:"fire-fcm-compat",[VI]:"fire-perf",[zI]:"fire-perf-compat",[qI]:"fire-rc",[GI]:"fire-rc-compat",[KI]:"fire-gcs",[JI]:"fire-gcs-compat",[YI]:"fire-fst",[XI]:"fire-fst-compat",[QI]:"fire-vertex","fire-js":"fire-js",[ZI]:"fire-js-all"};/**
295
- * @license
296
- * Copyright 2019 Google LLC
297
- *
298
- * Licensed under the Apache License, Version 2.0 (the "License");
299
- * you may not use this file except in compliance with the License.
300
- * You may obtain a copy of the License at
301
- *
302
- * http://www.apache.org/licenses/LICENSE-2.0
303
- *
304
- * Unless required by applicable law or agreed to in writing, software
305
- * distributed under the License is distributed on an "AS IS" BASIS,
306
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
307
- * See the License for the specific language governing permissions and
308
- * limitations under the License.
309
- */const Oo=new Map,nE=new Map,cl=new Map;function Nu(e,t){try{e.container.addComponent(t)}catch(n){Vr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function No(e){const t=e.name;if(cl.has(t))return Vr.debug(`There were multiple attempts to register component ${t}.`),!1;cl.set(t,e);for(const n of Oo.values())Nu(n,e);for(const n of nE.values())Nu(n,e);return!0}function oh(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function _r(e){return e==null?!1:e.settings!==void 0}/**
310
- * @license
311
- * Copyright 2019 Google LLC
312
- *
313
- * Licensed under the Apache License, Version 2.0 (the "License");
314
- * you may not use this file except in compliance with the License.
315
- * You may obtain a copy of the License at
316
- *
317
- * http://www.apache.org/licenses/LICENSE-2.0
318
- *
319
- * Unless required by applicable law or agreed to in writing, software
320
- * distributed under the License is distributed on an "AS IS" BASIS,
321
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
322
- * See the License for the specific language governing permissions and
323
- * limitations under the License.
324
- */const rE={"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."},ls=new Uo("app","Firebase",rE);/**
325
- * @license
326
- * Copyright 2019 Google LLC
327
- *
328
- * Licensed under the Apache License, Version 2.0 (the "License");
329
- * you may not use this file except in compliance with the License.
330
- * You may obtain a copy of the License at
331
- *
332
- * http://www.apache.org/licenses/LICENSE-2.0
333
- *
334
- * Unless required by applicable law or agreed to in writing, software
335
- * distributed under the License is distributed on an "AS IS" BASIS,
336
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
337
- * See the License for the specific language governing permissions and
338
- * limitations under the License.
339
- */class sE{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 Zs("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 ls.create("app-deleted",{appName:this._name})}}/**
340
- * @license
341
- * Copyright 2019 Google LLC
342
- *
343
- * Licensed under the Apache License, Version 2.0 (the "License");
344
- * you may not use this file except in compliance with the License.
345
- * You may obtain a copy of the License at
346
- *
347
- * http://www.apache.org/licenses/LICENSE-2.0
348
- *
349
- * Unless required by applicable law or agreed to in writing, software
350
- * distributed under the License is distributed on an "AS IS" BASIS,
351
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
352
- * See the License for the specific language governing permissions and
353
- * limitations under the License.
354
- */const Wo=eE;function ih(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:ll,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw ls.create("bad-app-name",{appName:String(s)});if(n||(n=eh()),!n)throw ls.create("no-options");const o=Oo.get(s);if(o){if(Xs(n,o.options)&&Xs(r,o.config))return o;throw ls.create("duplicate-app",{appName:s})}const i=new uI(s);for(const l of cl.values())i.addComponent(l);const a=new sE(n,r,i);return Oo.set(s,a),a}function ah(e=ll){const t=Oo.get(e);if(!t&&e===ll&&eh())return ih();if(!t)throw ls.create("no-app",{appName:e});return t}function oE(){return Array.from(Oo.values())}function zs(e,t,n){let r=tE[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 "/")`),Vr.warn(i.join(" "));return}No(new Zs(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
355
- * @license
356
- * Copyright 2021 Google LLC
357
- *
358
- * Licensed under the Apache License, Version 2.0 (the "License");
359
- * you may not use this file except in compliance with the License.
360
- * You may obtain a copy of the License at
361
- *
362
- * http://www.apache.org/licenses/LICENSE-2.0
363
- *
364
- * Unless required by applicable law or agreed to in writing, software
365
- * distributed under the License is distributed on an "AS IS" BASIS,
366
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
367
- * See the License for the specific language governing permissions and
368
- * limitations under the License.
369
- */const iE="firebase-heartbeat-database",aE=1,Lo="firebase-heartbeat-store";let Ca=null;function lh(){return Ca||(Ca=TI(iE,aE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Lo)}catch(n){console.warn(n)}}}}).catch(e=>{throw ls.create("idb-open",{originalErrorMessage:e.message})})),Ca}async function lE(e){try{const n=(await lh()).transaction(Lo),r=await n.objectStore(Lo).get(ch(e));return await n.done,r}catch(t){if(t instanceof ds)Vr.warn(t.message);else{const n=ls.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Vr.warn(n.message)}}}async function Lu(e,t){try{const r=(await lh()).transaction(Lo,"readwrite");await r.objectStore(Lo).put(t,ch(e)),await r.done}catch(n){if(n instanceof ds)Vr.warn(n.message);else{const r=ls.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Vr.warn(r.message)}}}function ch(e){return`${e.name}!${e.options.appId}`}/**
370
- * @license
371
- * Copyright 2021 Google LLC
372
- *
373
- * Licensed under the Apache License, Version 2.0 (the "License");
374
- * you may not use this file except in compliance with the License.
375
- * You may obtain a copy of the License at
376
- *
377
- * http://www.apache.org/licenses/LICENSE-2.0
378
- *
379
- * Unless required by applicable law or agreed to in writing, software
380
- * distributed under the License is distributed on an "AS IS" BASIS,
381
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
382
- * See the License for the specific language governing permissions and
383
- * limitations under the License.
384
- */const cE=1024,uE=30;class dE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new hE(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=Du();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>uE){const i=pE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Vr.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=Du(),{heartbeatsToSend:r,unsentEntries:s}=fE(this._heartbeatsCache.heartbeats),o=Xf(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 Vr.warn(n),""}}}function Du(){return new Date().toISOString().substring(0,10)}function fE(e,t=cE){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),ju(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ju(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class hE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return QS()?XS().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await lE(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 Lu(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 Lu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function ju(e){return Xf(JSON.stringify({version:2,heartbeats:e})).length}function pE(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}/**
385
- * @license
386
- * Copyright 2019 Google LLC
387
- *
388
- * Licensed under the Apache License, Version 2.0 (the "License");
389
- * you may not use this file except in compliance with the License.
390
- * You may obtain a copy of the License at
391
- *
392
- * http://www.apache.org/licenses/LICENSE-2.0
393
- *
394
- * Unless required by applicable law or agreed to in writing, software
395
- * distributed under the License is distributed on an "AS IS" BASIS,
396
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
397
- * See the License for the specific language governing permissions and
398
- * limitations under the License.
399
- */function mE(e){No(new Zs("platform-logger",t=>new EI(t),"PRIVATE")),No(new Zs("heartbeat",t=>new dE(t),"PRIVATE")),zs(al,Ou,e),zs(al,Ou,"esm2020"),zs("fire-js","")}mE("");var gE="firebase",vE="12.11.0";/**
400
- * @license
401
- * Copyright 2020 Google LLC
402
- *
403
- * Licensed under the Apache License, Version 2.0 (the "License");
404
- * you may not use this file except in compliance with the License.
405
- * You may obtain a copy of the License at
406
- *
407
- * http://www.apache.org/licenses/LICENSE-2.0
408
- *
409
- * Unless required by applicable law or agreed to in writing, software
410
- * distributed under the License is distributed on an "AS IS" BASIS,
411
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
412
- * See the License for the specific language governing permissions and
413
- * limitations under the License.
414
- */zs(gE,vE,"app");function uh(){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 yE=uh,dh=new Uo("auth","Firebase",uh());/**
415
- * @license
416
- * Copyright 2020 Google LLC
417
- *
418
- * Licensed under the Apache License, Version 2.0 (the "License");
419
- * you may not use this file except in compliance with the License.
420
- * You may obtain a copy of the License at
421
- *
422
- * http://www.apache.org/licenses/LICENSE-2.0
423
- *
424
- * Unless required by applicable law or agreed to in writing, software
425
- * distributed under the License is distributed on an "AS IS" BASIS,
426
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
427
- * See the License for the specific language governing permissions and
428
- * limitations under the License.
429
- */const Si=new nh("@firebase/auth");function wE(e,...t){Si.logLevel<=Ot.WARN&&Si.warn(`Auth (${Wo}): ${e}`,...t)}function di(e,...t){Si.logLevel<=Ot.ERROR&&Si.error(`Auth (${Wo}): ${e}`,...t)}/**
430
- * @license
431
- * Copyright 2020 Google LLC
432
- *
433
- * Licensed under the Apache License, Version 2.0 (the "License");
434
- * you may not use this file except in compliance with the License.
435
- * You may obtain a copy of the License at
436
- *
437
- * http://www.apache.org/licenses/LICENSE-2.0
438
- *
439
- * Unless required by applicable law or agreed to in writing, software
440
- * distributed under the License is distributed on an "AS IS" BASIS,
441
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
- * See the License for the specific language governing permissions and
443
- * limitations under the License.
444
- */function Er(e,...t){throw Kl(e,...t)}function ar(e,...t){return Kl(e,...t)}function Gl(e,t,n){const r={...yE(),[t]:n};return new Uo("auth","Firebase",r).create(t,{appName:e.name})}function xs(e){return Gl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function bE(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Er(e,"argument-error"),Gl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Kl(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 dh.create(e,...t)}function tt(e,t,...n){if(!e)throw Kl(t,...n)}function Lr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw di(t),new Error(t)}function zr(e,t){e||Lr(t)}/**
445
- * @license
446
- * Copyright 2020 Google LLC
447
- *
448
- * Licensed under the Apache License, Version 2.0 (the "License");
449
- * you may not use this file except in compliance with the License.
450
- * You may obtain a copy of the License at
451
- *
452
- * http://www.apache.org/licenses/LICENSE-2.0
453
- *
454
- * Unless required by applicable law or agreed to in writing, software
455
- * distributed under the License is distributed on an "AS IS" BASIS,
456
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
457
- * See the License for the specific language governing permissions and
458
- * limitations under the License.
459
- */function ul(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function _E(){return Fu()==="http:"||Fu()==="https:"}function Fu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
460
- * @license
461
- * Copyright 2020 Google LLC
462
- *
463
- * Licensed under the Apache License, Version 2.0 (the "License");
464
- * you may not use this file except in compliance with the License.
465
- * You may obtain a copy of the License at
466
- *
467
- * http://www.apache.org/licenses/LICENSE-2.0
468
- *
469
- * Unless required by applicable law or agreed to in writing, software
470
- * distributed under the License is distributed on an "AS IS" BASIS,
471
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
472
- * See the License for the specific language governing permissions and
473
- * limitations under the License.
474
- */function kE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(_E()||KS()||"connection"in navigator)?navigator.onLine:!0}function TE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
475
- * @license
476
- * Copyright 2020 Google LLC
477
- *
478
- * Licensed under the Apache License, Version 2.0 (the "License");
479
- * you may not use this file except in compliance with the License.
480
- * You may obtain a copy of the License at
481
- *
482
- * http://www.apache.org/licenses/LICENSE-2.0
483
- *
484
- * Unless required by applicable law or agreed to in writing, software
485
- * distributed under the License is distributed on an "AS IS" BASIS,
486
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487
- * See the License for the specific language governing permissions and
488
- * limitations under the License.
489
- */class Vo{constructor(t,n){this.shortDelay=t,this.longDelay=n,zr(n>t,"Short delay should be less than long delay!"),this.isMobile=qS()||JS()}get(){return kE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
490
- * @license
491
- * Copyright 2020 Google LLC
492
- *
493
- * Licensed under the Apache License, Version 2.0 (the "License");
494
- * you may not use this file except in compliance with the License.
495
- * You may obtain a copy of the License at
496
- *
497
- * http://www.apache.org/licenses/LICENSE-2.0
498
- *
499
- * Unless required by applicable law or agreed to in writing, software
500
- * distributed under the License is distributed on an "AS IS" BASIS,
501
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
502
- * See the License for the specific language governing permissions and
503
- * limitations under the License.
504
- */function Jl(e,t){zr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
505
- * @license
506
- * Copyright 2020 Google LLC
507
- *
508
- * Licensed under the Apache License, Version 2.0 (the "License");
509
- * you may not use this file except in compliance with the License.
510
- * You may obtain a copy of the License at
511
- *
512
- * http://www.apache.org/licenses/LICENSE-2.0
513
- *
514
- * Unless required by applicable law or agreed to in writing, software
515
- * distributed under the License is distributed on an "AS IS" BASIS,
516
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
517
- * See the License for the specific language governing permissions and
518
- * limitations under the License.
519
- */class fh{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;Lr("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;Lr("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;Lr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
520
- * @license
521
- * Copyright 2020 Google LLC
522
- *
523
- * Licensed under the Apache License, Version 2.0 (the "License");
524
- * you may not use this file except in compliance with the License.
525
- * You may obtain a copy of the License at
526
- *
527
- * http://www.apache.org/licenses/LICENSE-2.0
528
- *
529
- * Unless required by applicable law or agreed to in writing, software
530
- * distributed under the License is distributed on an "AS IS" BASIS,
531
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
532
- * See the License for the specific language governing permissions and
533
- * limitations under the License.
534
- */const SE={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"};/**
535
- * @license
536
- * Copyright 2020 Google LLC
537
- *
538
- * Licensed under the Apache License, Version 2.0 (the "License");
539
- * you may not use this file except in compliance with the License.
540
- * You may obtain a copy of the License at
541
- *
542
- * http://www.apache.org/licenses/LICENSE-2.0
543
- *
544
- * Unless required by applicable law or agreed to in writing, software
545
- * distributed under the License is distributed on an "AS IS" BASIS,
546
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
547
- * See the License for the specific language governing permissions and
548
- * limitations under the License.
549
- */const IE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],EE=new Vo(3e4,6e4);function Yl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function no(e,t,n,r,s={}){return hh(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ho({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 d={method:t,headers:l,...o};return GS()||(d.referrerPolicy="no-referrer"),e.emulatorConfig&&zl(e.emulatorConfig.host)&&(d.credentials="include"),fh.fetch()(await ph(e,e.config.apiHost,n,a),d)})}async function hh(e,t,n){e._canInitEmulator=!1;const r={...SE,...t};try{const s=new AE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw ei(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,d]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw ei(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw ei(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw ei(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Gl(e,c,d);Er(e,c)}}catch(s){if(s instanceof ds)throw s;Er(e,"network-request-failed",{message:String(s)})}}async function CE(e,t,n,r,s={}){const o=await no(e,t,n,r,s);return"mfaPendingCredential"in o&&Er(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function ph(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Jl(e.config,s):`${e.config.apiScheme}://${s}`;return IE.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class AE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ar(this.auth,"network-request-failed")),EE.get())})}}function ei(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=ar(e,t,r);return s.customData._tokenResponse=n,s}/**
550
- * @license
551
- * Copyright 2020 Google LLC
552
- *
553
- * Licensed under the Apache License, Version 2.0 (the "License");
554
- * you may not use this file except in compliance with the License.
555
- * You may obtain a copy of the License at
556
- *
557
- * http://www.apache.org/licenses/LICENSE-2.0
558
- *
559
- * Unless required by applicable law or agreed to in writing, software
560
- * distributed under the License is distributed on an "AS IS" BASIS,
561
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
562
- * See the License for the specific language governing permissions and
563
- * limitations under the License.
564
- */async function xE(e,t){return no(e,"POST","/v1/accounts:delete",t)}async function Ii(e,t){return no(e,"POST","/v1/accounts:lookup",t)}/**
565
- * @license
566
- * Copyright 2020 Google LLC
567
- *
568
- * Licensed under the Apache License, Version 2.0 (the "License");
569
- * you may not use this file except in compliance with the License.
570
- * You may obtain a copy of the License at
571
- *
572
- * http://www.apache.org/licenses/LICENSE-2.0
573
- *
574
- * Unless required by applicable law or agreed to in writing, software
575
- * distributed under the License is distributed on an "AS IS" BASIS,
576
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
577
- * See the License for the specific language governing permissions and
578
- * limitations under the License.
579
- */function ko(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function RE(e,t=!1){const n=to(e),r=await n.getIdToken(t),s=Ql(r);tt(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:ko(Aa(s.auth_time)),issuedAtTime:ko(Aa(s.iat)),expirationTime:ko(Aa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Aa(e){return Number(e)*1e3}function Ql(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return di("JWT malformed, contained fewer than 3 sections"),null;try{const s=Zf(n);return s?JSON.parse(s):(di("Failed to decode base64 JWT payload"),null)}catch(s){return di("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Bu(e){const t=Ql(e);return tt(t,"internal-error"),tt(typeof t.exp<"u","internal-error"),tt(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
580
- * @license
581
- * Copyright 2020 Google LLC
582
- *
583
- * Licensed under the Apache License, Version 2.0 (the "License");
584
- * you may not use this file except in compliance with the License.
585
- * You may obtain a copy of the License at
586
- *
587
- * http://www.apache.org/licenses/LICENSE-2.0
588
- *
589
- * Unless required by applicable law or agreed to in writing, software
590
- * distributed under the License is distributed on an "AS IS" BASIS,
591
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
592
- * See the License for the specific language governing permissions and
593
- * limitations under the License.
594
- */async function Do(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof ds&&PE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function PE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
595
- * @license
596
- * Copyright 2020 Google LLC
597
- *
598
- * Licensed under the Apache License, Version 2.0 (the "License");
599
- * you may not use this file except in compliance with the License.
600
- * You may obtain a copy of the License at
601
- *
602
- * http://www.apache.org/licenses/LICENSE-2.0
603
- *
604
- * Unless required by applicable law or agreed to in writing, software
605
- * distributed under the License is distributed on an "AS IS" BASIS,
606
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
607
- * See the License for the specific language governing permissions and
608
- * limitations under the License.
609
- */class ME{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()}}/**
610
- * @license
611
- * Copyright 2020 Google LLC
612
- *
613
- * Licensed under the Apache License, Version 2.0 (the "License");
614
- * you may not use this file except in compliance with the License.
615
- * You may obtain a copy of the License at
616
- *
617
- * http://www.apache.org/licenses/LICENSE-2.0
618
- *
619
- * Unless required by applicable law or agreed to in writing, software
620
- * distributed under the License is distributed on an "AS IS" BASIS,
621
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
622
- * See the License for the specific language governing permissions and
623
- * limitations under the License.
624
- */class dl{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ko(this.lastLoginAt),this.creationTime=ko(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
625
- * @license
626
- * Copyright 2019 Google LLC
627
- *
628
- * Licensed under the Apache License, Version 2.0 (the "License");
629
- * you may not use this file except in compliance with the License.
630
- * You may obtain a copy of the License at
631
- *
632
- * http://www.apache.org/licenses/LICENSE-2.0
633
- *
634
- * Unless required by applicable law or agreed to in writing, software
635
- * distributed under the License is distributed on an "AS IS" BASIS,
636
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
637
- * See the License for the specific language governing permissions and
638
- * limitations under the License.
639
- */async function Ei(e){var m;const t=e.auth,n=await e.getIdToken(),r=await Do(e,Ii(t,{idToken:n}));tt(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(m=s.providerUserInfo)!=null&&m.length?mh(s.providerUserInfo):[],i=OE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),d=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 dl(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,c)}async function $E(e){const t=to(e);await Ei(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function OE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function mh(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}))}/**
640
- * @license
641
- * Copyright 2020 Google LLC
642
- *
643
- * Licensed under the Apache License, Version 2.0 (the "License");
644
- * you may not use this file except in compliance with the License.
645
- * You may obtain a copy of the License at
646
- *
647
- * http://www.apache.org/licenses/LICENSE-2.0
648
- *
649
- * Unless required by applicable law or agreed to in writing, software
650
- * distributed under the License is distributed on an "AS IS" BASIS,
651
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652
- * See the License for the specific language governing permissions and
653
- * limitations under the License.
654
- */async function NE(e,t){const n=await hh(e,{},async()=>{const r=Ho({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await ph(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&&zl(e.emulatorConfig.host)&&(l.credentials="include"),fh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function LE(e,t){return no(e,"POST","/v2/accounts:revokeToken",Yl(e,t))}/**
655
- * @license
656
- * Copyright 2020 Google LLC
657
- *
658
- * Licensed under the Apache License, Version 2.0 (the "License");
659
- * you may not use this file except in compliance with the License.
660
- * You may obtain a copy of the License at
661
- *
662
- * http://www.apache.org/licenses/LICENSE-2.0
663
- *
664
- * Unless required by applicable law or agreed to in writing, software
665
- * distributed under the License is distributed on an "AS IS" BASIS,
666
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
667
- * See the License for the specific language governing permissions and
668
- * limitations under the License.
669
- */class qs{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){tt(t.idToken,"internal-error"),tt(typeof t.idToken<"u","internal-error"),tt(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Bu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){tt(t.length!==0,"internal-error");const n=Bu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(tt(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 NE(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 qs;return r&&(tt(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(tt(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(tt(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 qs,this.toJSON())}_performRefresh(){return Lr("not implemented")}}/**
670
- * @license
671
- * Copyright 2020 Google LLC
672
- *
673
- * Licensed under the Apache License, Version 2.0 (the "License");
674
- * you may not use this file except in compliance with the License.
675
- * You may obtain a copy of the License at
676
- *
677
- * http://www.apache.org/licenses/LICENSE-2.0
678
- *
679
- * Unless required by applicable law or agreed to in writing, software
680
- * distributed under the License is distributed on an "AS IS" BASIS,
681
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
682
- * See the License for the specific language governing permissions and
683
- * limitations under the License.
684
- */function Xr(e,t){tt(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class sr{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new ME(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 dl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Do(this,this.stsTokenManager.getToken(this.auth,t));return tt(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return RE(this,t)}reload(){return $E(this)}_assign(t){this!==t&&(tt(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 sr({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){tt(!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 Ei(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(_r(this.auth.app))return Promise.reject(xs(this.auth));const t=await this.getIdToken();return await Do(this,xE(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,d=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:m,emailVerified:b,isAnonymous:I,providerData:j,stsTokenManager:$}=n;tt(m&&$,t,"internal-error");const X=qs.fromJSON(this.name,$);tt(typeof m=="string",t,"internal-error"),Xr(r,t.name),Xr(s,t.name),tt(typeof b=="boolean",t,"internal-error"),tt(typeof I=="boolean",t,"internal-error"),Xr(o,t.name),Xr(i,t.name),Xr(a,t.name),Xr(l,t.name),Xr(d,t.name),Xr(c,t.name);const ae=new sr({uid:m,auth:t,email:s,emailVerified:b,displayName:r,isAnonymous:I,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:X,createdAt:d,lastLoginAt:c});return j&&Array.isArray(j)&&(ae.providerData=j.map(z=>({...z}))),l&&(ae._redirectEventId=l),ae}static async _fromIdTokenResponse(t,n,r=!1){const s=new qs;s.updateFromServerResponse(n);const o=new sr({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Ei(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];tt(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?mh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new qs;a.updateFromIdToken(r);const l=new sr({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),d={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 dl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,d),l}}/**
685
- * @license
686
- * Copyright 2020 Google LLC
687
- *
688
- * Licensed under the Apache License, Version 2.0 (the "License");
689
- * you may not use this file except in compliance with the License.
690
- * You may obtain a copy of the License at
691
- *
692
- * http://www.apache.org/licenses/LICENSE-2.0
693
- *
694
- * Unless required by applicable law or agreed to in writing, software
695
- * distributed under the License is distributed on an "AS IS" BASIS,
696
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
697
- * See the License for the specific language governing permissions and
698
- * limitations under the License.
699
- */const Uu=new Map;function Dr(e){zr(e instanceof Function,"Expected a class definition");let t=Uu.get(e);return t?(zr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Uu.set(e,t),t)}/**
700
- * @license
701
- * Copyright 2019 Google LLC
702
- *
703
- * Licensed under the Apache License, Version 2.0 (the "License");
704
- * you may not use this file except in compliance with the License.
705
- * You may obtain a copy of the License at
706
- *
707
- * http://www.apache.org/licenses/LICENSE-2.0
708
- *
709
- * Unless required by applicable law or agreed to in writing, software
710
- * distributed under the License is distributed on an "AS IS" BASIS,
711
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
712
- * See the License for the specific language governing permissions and
713
- * limitations under the License.
714
- */class gh{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){}}gh.type="NONE";const Hu=gh;/**
715
- * @license
716
- * Copyright 2019 Google LLC
717
- *
718
- * Licensed under the Apache License, Version 2.0 (the "License");
719
- * you may not use this file except in compliance with the License.
720
- * You may obtain a copy of the License at
721
- *
722
- * http://www.apache.org/licenses/LICENSE-2.0
723
- *
724
- * Unless required by applicable law or agreed to in writing, software
725
- * distributed under the License is distributed on an "AS IS" BASIS,
726
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
727
- * See the License for the specific language governing permissions and
728
- * limitations under the License.
729
- */function fi(e,t,n){return`firebase:${e}:${t}:${n}`}class Gs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=fi(this.userKey,s.apiKey,o),this.fullPersistenceKey=fi("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 Ii(this.auth,{idToken:t}).catch(()=>{});return n?sr._fromGetAccountInfoResponse(this.auth,n,t):null}return sr._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 Gs(Dr(Hu),t,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=s[0]||Dr(Hu);const i=fi(r,t.config.apiKey,t.name);let a=null;for(const d of n)try{const c=await d._get(i);if(c){let m;if(typeof c=="string"){const b=await Ii(t,{idToken:c}).catch(()=>{});if(!b)break;m=await sr._fromGetAccountInfoResponse(t,b,c)}else m=sr._fromJSON(t,c);d!==o&&(a=m),o=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new Gs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async d=>{if(d!==o)try{await d._remove(i)}catch{}})),new Gs(o,t,r))}}/**
730
- * @license
731
- * Copyright 2020 Google LLC
732
- *
733
- * Licensed under the Apache License, Version 2.0 (the "License");
734
- * you may not use this file except in compliance with the License.
735
- * You may obtain a copy of the License at
736
- *
737
- * http://www.apache.org/licenses/LICENSE-2.0
738
- *
739
- * Unless required by applicable law or agreed to in writing, software
740
- * distributed under the License is distributed on an "AS IS" BASIS,
741
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742
- * See the License for the specific language governing permissions and
743
- * limitations under the License.
744
- */function Wu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(bh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(vh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(kh(t))return"Blackberry";if(Th(t))return"Webos";if(yh(t))return"Safari";if((t.includes("chrome/")||wh(t))&&!t.includes("edge/"))return"Chrome";if(_h(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 vh(e=$n()){return/firefox\//i.test(e)}function yh(e=$n()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function wh(e=$n()){return/crios\//i.test(e)}function bh(e=$n()){return/iemobile/i.test(e)}function _h(e=$n()){return/android/i.test(e)}function kh(e=$n()){return/blackberry/i.test(e)}function Th(e=$n()){return/webos/i.test(e)}function Xl(e=$n()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function DE(e=$n()){var t;return Xl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function jE(){return YS()&&document.documentMode===10}function Sh(e=$n()){return Xl(e)||_h(e)||Th(e)||kh(e)||/windows phone/i.test(e)||bh(e)}/**
745
- * @license
746
- * Copyright 2020 Google LLC
747
- *
748
- * Licensed under the Apache License, Version 2.0 (the "License");
749
- * you may not use this file except in compliance with the License.
750
- * You may obtain a copy of the License at
751
- *
752
- * http://www.apache.org/licenses/LICENSE-2.0
753
- *
754
- * Unless required by applicable law or agreed to in writing, software
755
- * distributed under the License is distributed on an "AS IS" BASIS,
756
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
757
- * See the License for the specific language governing permissions and
758
- * limitations under the License.
759
- */function Ih(e,t=[]){let n;switch(e){case"Browser":n=Wu($n());break;case"Worker":n=`${Wu($n())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Wo}/${r}`}/**
760
- * @license
761
- * Copyright 2022 Google LLC
762
- *
763
- * Licensed under the Apache License, Version 2.0 (the "License");
764
- * you may not use this file except in compliance with the License.
765
- * You may obtain a copy of the License at
766
- *
767
- * http://www.apache.org/licenses/LICENSE-2.0
768
- *
769
- * Unless required by applicable law or agreed to in writing, software
770
- * distributed under the License is distributed on an "AS IS" BASIS,
771
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
772
- * See the License for the specific language governing permissions and
773
- * limitations under the License.
774
- */class FE{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})}}}/**
775
- * @license
776
- * Copyright 2023 Google LLC
777
- *
778
- * Licensed under the Apache License, Version 2.0 (the "License");
779
- * you may not use this file except in compliance with the License.
780
- * You may obtain a copy of the License at
781
- *
782
- * http://www.apache.org/licenses/LICENSE-2.0
783
- *
784
- * Unless required by applicable law or agreed to in writing, software
785
- * distributed under the License is distributed on an "AS IS" BASIS,
786
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
787
- * See the License for the specific language governing permissions and
788
- * limitations under the License.
789
- */async function BE(e,t={}){return no(e,"GET","/v2/passwordPolicy",Yl(e,t))}/**
790
- * @license
791
- * Copyright 2023 Google LLC
792
- *
793
- * Licensed under the Apache License, Version 2.0 (the "License");
794
- * you may not use this file except in compliance with the License.
795
- * You may obtain a copy of the License at
796
- *
797
- * http://www.apache.org/licenses/LICENSE-2.0
798
- *
799
- * Unless required by applicable law or agreed to in writing, software
800
- * distributed under the License is distributed on an "AS IS" BASIS,
801
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
802
- * See the License for the specific language governing permissions and
803
- * limitations under the License.
804
- */const UE=6;class HE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??UE,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))}}/**
805
- * @license
806
- * Copyright 2020 Google LLC
807
- *
808
- * Licensed under the Apache License, Version 2.0 (the "License");
809
- * you may not use this file except in compliance with the License.
810
- * You may obtain a copy of the License at
811
- *
812
- * http://www.apache.org/licenses/LICENSE-2.0
813
- *
814
- * Unless required by applicable law or agreed to in writing, software
815
- * distributed under the License is distributed on an "AS IS" BASIS,
816
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
- * See the License for the specific language governing permissions and
818
- * limitations under the License.
819
- */class WE{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 Vu(this),this.idTokenSubscription=new Vu(this),this.beforeStateQueue=new FE(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=dh,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=Dr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await Gs.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 Ii(this,{idToken:t}),r=await sr._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(_r(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 tt(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 Ei(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=TE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(_r(this.app))return Promise.reject(xs(this));const n=t?to(t):null;return n&&tt(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&&tt(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 _r(this.app)?Promise.reject(xs(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return _r(this.app)?Promise.reject(xs(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Dr(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 BE(this),n=new HE(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 Uo("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 LE(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&&Dr(t)||this._popupRedirectResolver;tt(n,this,"argument-error"),this.redirectPersistenceManager=await Gs.create(this,[Dr(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(tt(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 tt(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Ih(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(_r(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&&wE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function qi(e){return to(e)}class Vu{constructor(t){this.auth=t,this.observer=null,this.addObserver=rI(n=>this.observer=n)}get next(){return tt(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
820
- * @license
821
- * Copyright 2020 Google LLC
822
- *
823
- * Licensed under the Apache License, Version 2.0 (the "License");
824
- * you may not use this file except in compliance with the License.
825
- * You may obtain a copy of the License at
826
- *
827
- * http://www.apache.org/licenses/LICENSE-2.0
828
- *
829
- * Unless required by applicable law or agreed to in writing, software
830
- * distributed under the License is distributed on an "AS IS" BASIS,
831
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
832
- * See the License for the specific language governing permissions and
833
- * limitations under the License.
834
- */let Zl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function VE(e){Zl=e}function zE(e){return Zl.loadJS(e)}function qE(){return Zl.gapiScript}function GE(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
835
- * @license
836
- * Copyright 2020 Google LLC
837
- *
838
- * Licensed under the Apache License, Version 2.0 (the "License");
839
- * you may not use this file except in compliance with the License.
840
- * You may obtain a copy of the License at
841
- *
842
- * http://www.apache.org/licenses/LICENSE-2.0
843
- *
844
- * Unless required by applicable law or agreed to in writing, software
845
- * distributed under the License is distributed on an "AS IS" BASIS,
846
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
847
- * See the License for the specific language governing permissions and
848
- * limitations under the License.
849
- */function KE(e,t){const n=oh(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(Xs(o,t??{}))return s;Er(s,"already-initialized")}return n.initialize({options:t})}function JE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Dr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function YE(e,t,n){const r=qi(e);tt(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Eh(t),{host:i,port:a}=QE(t),l=a===null?"":`:${a}`,d={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){tt(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),tt(Xs(d,r.config.emulator)&&Xs(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,zl(i)?iI(`${o}//${i}${l}`):XE()}function Eh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function QE(e){const t=Eh(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:zu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:zu(i)}}}function zu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function XE(){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())}/**
850
- * @license
851
- * Copyright 2020 Google LLC
852
- *
853
- * Licensed under the Apache License, Version 2.0 (the "License");
854
- * you may not use this file except in compliance with the License.
855
- * You may obtain a copy of the License at
856
- *
857
- * http://www.apache.org/licenses/LICENSE-2.0
858
- *
859
- * Unless required by applicable law or agreed to in writing, software
860
- * distributed under the License is distributed on an "AS IS" BASIS,
861
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862
- * See the License for the specific language governing permissions and
863
- * limitations under the License.
864
- */class Ch{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Lr("not implemented")}_getIdTokenResponse(t){return Lr("not implemented")}_linkToIdToken(t,n){return Lr("not implemented")}_getReauthenticationResolver(t){return Lr("not implemented")}}/**
865
- * @license
866
- * Copyright 2020 Google LLC
867
- *
868
- * Licensed under the Apache License, Version 2.0 (the "License");
869
- * you may not use this file except in compliance with the License.
870
- * You may obtain a copy of the License at
871
- *
872
- * http://www.apache.org/licenses/LICENSE-2.0
873
- *
874
- * Unless required by applicable law or agreed to in writing, software
875
- * distributed under the License is distributed on an "AS IS" BASIS,
876
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
- * See the License for the specific language governing permissions and
878
- * limitations under the License.
879
- */async function Ks(e,t){return CE(e,"POST","/v1/accounts:signInWithIdp",Yl(e,t))}/**
880
- * @license
881
- * Copyright 2020 Google LLC
882
- *
883
- * Licensed under the Apache License, Version 2.0 (the "License");
884
- * you may not use this file except in compliance with the License.
885
- * You may obtain a copy of the License at
886
- *
887
- * http://www.apache.org/licenses/LICENSE-2.0
888
- *
889
- * Unless required by applicable law or agreed to in writing, software
890
- * distributed under the License is distributed on an "AS IS" BASIS,
891
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
892
- * See the License for the specific language governing permissions and
893
- * limitations under the License.
894
- */const ZE="http://localhost";class Rs extends Ch{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Rs(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):Er("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 Rs(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 Ks(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,Ks(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,Ks(t,n)}buildRequest(){const t={requestUri:ZE,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=Ho(n)}return t}}/**
895
- * @license
896
- * Copyright 2020 Google LLC
897
- *
898
- * Licensed under the Apache License, Version 2.0 (the "License");
899
- * you may not use this file except in compliance with the License.
900
- * You may obtain a copy of the License at
901
- *
902
- * http://www.apache.org/licenses/LICENSE-2.0
903
- *
904
- * Unless required by applicable law or agreed to in writing, software
905
- * distributed under the License is distributed on an "AS IS" BASIS,
906
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
907
- * See the License for the specific language governing permissions and
908
- * limitations under the License.
909
- */class ec{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}}/**
910
- * @license
911
- * Copyright 2019 Google LLC
912
- *
913
- * Licensed under the Apache License, Version 2.0 (the "License");
914
- * you may not use this file except in compliance with the License.
915
- * You may obtain a copy of the License at
916
- *
917
- * http://www.apache.org/licenses/LICENSE-2.0
918
- *
919
- * Unless required by applicable law or agreed to in writing, software
920
- * distributed under the License is distributed on an "AS IS" BASIS,
921
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
922
- * See the License for the specific language governing permissions and
923
- * limitations under the License.
924
- */class zo extends ec{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
925
- * @license
926
- * Copyright 2020 Google LLC
927
- *
928
- * Licensed under the Apache License, Version 2.0 (the "License");
929
- * you may not use this file except in compliance with the License.
930
- * You may obtain a copy of the License at
931
- *
932
- * http://www.apache.org/licenses/LICENSE-2.0
933
- *
934
- * Unless required by applicable law or agreed to in writing, software
935
- * distributed under the License is distributed on an "AS IS" BASIS,
936
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
937
- * See the License for the specific language governing permissions and
938
- * limitations under the License.
939
- */class rs extends zo{constructor(){super("facebook.com")}static credential(t){return Rs._fromParams({providerId:rs.PROVIDER_ID,signInMethod:rs.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return rs.credentialFromTaggedObject(t)}static credentialFromError(t){return rs.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return rs.credential(t.oauthAccessToken)}catch{return null}}}rs.FACEBOOK_SIGN_IN_METHOD="facebook.com";rs.PROVIDER_ID="facebook.com";/**
940
- * @license
941
- * Copyright 2020 Google LLC
942
- *
943
- * Licensed under the Apache License, Version 2.0 (the "License");
944
- * you may not use this file except in compliance with the License.
945
- * You may obtain a copy of the License at
946
- *
947
- * http://www.apache.org/licenses/LICENSE-2.0
948
- *
949
- * Unless required by applicable law or agreed to in writing, software
950
- * distributed under the License is distributed on an "AS IS" BASIS,
951
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
952
- * See the License for the specific language governing permissions and
953
- * limitations under the License.
954
- */class ss extends zo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Rs._fromParams({providerId:ss.PROVIDER_ID,signInMethod:ss.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return ss.credentialFromTaggedObject(t)}static credentialFromError(t){return ss.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return ss.credential(n,r)}catch{return null}}}ss.GOOGLE_SIGN_IN_METHOD="google.com";ss.PROVIDER_ID="google.com";/**
955
- * @license
956
- * Copyright 2020 Google LLC
957
- *
958
- * Licensed under the Apache License, Version 2.0 (the "License");
959
- * you may not use this file except in compliance with the License.
960
- * You may obtain a copy of the License at
961
- *
962
- * http://www.apache.org/licenses/LICENSE-2.0
963
- *
964
- * Unless required by applicable law or agreed to in writing, software
965
- * distributed under the License is distributed on an "AS IS" BASIS,
966
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
967
- * See the License for the specific language governing permissions and
968
- * limitations under the License.
969
- */class kr extends zo{constructor(){super("github.com")}static credential(t){return Rs._fromParams({providerId:kr.PROVIDER_ID,signInMethod:kr.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return kr.credentialFromTaggedObject(t)}static credentialFromError(t){return kr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return kr.credential(t.oauthAccessToken)}catch{return null}}}kr.GITHUB_SIGN_IN_METHOD="github.com";kr.PROVIDER_ID="github.com";/**
970
- * @license
971
- * Copyright 2020 Google LLC
972
- *
973
- * Licensed under the Apache License, Version 2.0 (the "License");
974
- * you may not use this file except in compliance with the License.
975
- * You may obtain a copy of the License at
976
- *
977
- * http://www.apache.org/licenses/LICENSE-2.0
978
- *
979
- * Unless required by applicable law or agreed to in writing, software
980
- * distributed under the License is distributed on an "AS IS" BASIS,
981
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
982
- * See the License for the specific language governing permissions and
983
- * limitations under the License.
984
- */class os extends zo{constructor(){super("twitter.com")}static credential(t,n){return Rs._fromParams({providerId:os.PROVIDER_ID,signInMethod:os.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return os.credentialFromTaggedObject(t)}static credentialFromError(t){return os.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return os.credential(n,r)}catch{return null}}}os.TWITTER_SIGN_IN_METHOD="twitter.com";os.PROVIDER_ID="twitter.com";/**
985
- * @license
986
- * Copyright 2020 Google LLC
987
- *
988
- * Licensed under the Apache License, Version 2.0 (the "License");
989
- * you may not use this file except in compliance with the License.
990
- * You may obtain a copy of the License at
991
- *
992
- * http://www.apache.org/licenses/LICENSE-2.0
993
- *
994
- * Unless required by applicable law or agreed to in writing, software
995
- * distributed under the License is distributed on an "AS IS" BASIS,
996
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
997
- * See the License for the specific language governing permissions and
998
- * limitations under the License.
999
- */class eo{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 sr._fromIdTokenResponse(t,r,s),i=qu(r);return new eo({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=qu(r);return new eo({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function qu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
1000
- * @license
1001
- * Copyright 2020 Google LLC
1002
- *
1003
- * Licensed under the Apache License, Version 2.0 (the "License");
1004
- * you may not use this file except in compliance with the License.
1005
- * You may obtain a copy of the License at
1006
- *
1007
- * http://www.apache.org/licenses/LICENSE-2.0
1008
- *
1009
- * Unless required by applicable law or agreed to in writing, software
1010
- * distributed under the License is distributed on an "AS IS" BASIS,
1011
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1012
- * See the License for the specific language governing permissions and
1013
- * limitations under the License.
1014
- */class Ci extends ds{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Ci.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 Ci(t,n,r,s)}}function Ah(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Ci._fromErrorAndOperation(e,o,t,r):o})}async function eC(e,t,n=!1){const r=await Do(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return eo._forOperation(e,"link",r)}/**
1015
- * @license
1016
- * Copyright 2019 Google LLC
1017
- *
1018
- * Licensed under the Apache License, Version 2.0 (the "License");
1019
- * you may not use this file except in compliance with the License.
1020
- * You may obtain a copy of the License at
1021
- *
1022
- * http://www.apache.org/licenses/LICENSE-2.0
1023
- *
1024
- * Unless required by applicable law or agreed to in writing, software
1025
- * distributed under the License is distributed on an "AS IS" BASIS,
1026
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1027
- * See the License for the specific language governing permissions and
1028
- * limitations under the License.
1029
- */async function tC(e,t,n=!1){const{auth:r}=e;if(_r(r.app))return Promise.reject(xs(r));const s="reauthenticate";try{const o=await Do(e,Ah(r,s,t,e),n);tt(o.idToken,r,"internal-error");const i=Ql(o.idToken);tt(i,r,"internal-error");const{sub:a}=i;return tt(e.uid===a,r,"user-mismatch"),eo._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Er(r,"user-mismatch"),o}}/**
1030
- * @license
1031
- * Copyright 2020 Google LLC
1032
- *
1033
- * Licensed under the Apache License, Version 2.0 (the "License");
1034
- * you may not use this file except in compliance with the License.
1035
- * You may obtain a copy of the License at
1036
- *
1037
- * http://www.apache.org/licenses/LICENSE-2.0
1038
- *
1039
- * Unless required by applicable law or agreed to in writing, software
1040
- * distributed under the License is distributed on an "AS IS" BASIS,
1041
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1042
- * See the License for the specific language governing permissions and
1043
- * limitations under the License.
1044
- */async function nC(e,t,n=!1){if(_r(e.app))return Promise.reject(xs(e));const r="signIn",s=await Ah(e,r,t),o=await eo._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function rC(e,t,n,r){return to(e).onIdTokenChanged(t,n,r)}function sC(e,t,n){return to(e).beforeAuthStateChanged(t,n)}const Ai="__sak";/**
1045
- * @license
1046
- * Copyright 2019 Google LLC
1047
- *
1048
- * Licensed under the Apache License, Version 2.0 (the "License");
1049
- * you may not use this file except in compliance with the License.
1050
- * You may obtain a copy of the License at
1051
- *
1052
- * http://www.apache.org/licenses/LICENSE-2.0
1053
- *
1054
- * Unless required by applicable law or agreed to in writing, software
1055
- * distributed under the License is distributed on an "AS IS" BASIS,
1056
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1057
- * See the License for the specific language governing permissions and
1058
- * limitations under the License.
1059
- */class xh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ai,"1"),this.storage.removeItem(Ai),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()}}/**
1060
- * @license
1061
- * Copyright 2020 Google LLC
1062
- *
1063
- * Licensed under the Apache License, Version 2.0 (the "License");
1064
- * you may not use this file except in compliance with the License.
1065
- * You may obtain a copy of the License at
1066
- *
1067
- * http://www.apache.org/licenses/LICENSE-2.0
1068
- *
1069
- * Unless required by applicable law or agreed to in writing, software
1070
- * distributed under the License is distributed on an "AS IS" BASIS,
1071
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1072
- * See the License for the specific language governing permissions and
1073
- * limitations under the License.
1074
- */const oC=1e3,iC=10;class Rh extends xh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Sh(),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);jE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,iC):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)})},oC)}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]}}Rh.type="LOCAL";const aC=Rh;/**
1075
- * @license
1076
- * Copyright 2020 Google LLC
1077
- *
1078
- * Licensed under the Apache License, Version 2.0 (the "License");
1079
- * you may not use this file except in compliance with the License.
1080
- * You may obtain a copy of the License at
1081
- *
1082
- * http://www.apache.org/licenses/LICENSE-2.0
1083
- *
1084
- * Unless required by applicable law or agreed to in writing, software
1085
- * distributed under the License is distributed on an "AS IS" BASIS,
1086
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1087
- * See the License for the specific language governing permissions and
1088
- * limitations under the License.
1089
- */class Ph extends xh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Ph.type="SESSION";const Mh=Ph;/**
1090
- * @license
1091
- * Copyright 2019 Google LLC
1092
- *
1093
- * Licensed under the Apache License, Version 2.0 (the "License");
1094
- * you may not use this file except in compliance with the License.
1095
- * You may obtain a copy of the License at
1096
- *
1097
- * http://www.apache.org/licenses/LICENSE-2.0
1098
- *
1099
- * Unless required by applicable law or agreed to in writing, software
1100
- * distributed under the License is distributed on an "AS IS" BASIS,
1101
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1102
- * See the License for the specific language governing permissions and
1103
- * limitations under the License.
1104
- */function lC(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1105
- * @license
1106
- * Copyright 2019 Google LLC
1107
- *
1108
- * Licensed under the Apache License, Version 2.0 (the "License");
1109
- * you may not use this file except in compliance with the License.
1110
- * You may obtain a copy of the License at
1111
- *
1112
- * http://www.apache.org/licenses/LICENSE-2.0
1113
- *
1114
- * Unless required by applicable law or agreed to in writing, software
1115
- * distributed under the License is distributed on an "AS IS" BASIS,
1116
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1117
- * See the License for the specific language governing permissions and
1118
- * limitations under the License.
1119
- */class Gi{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 Gi(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 d=>d(n.origin,o)),l=await lC(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)}}Gi.receivers=[];/**
1120
- * @license
1121
- * Copyright 2020 Google LLC
1122
- *
1123
- * Licensed under the Apache License, Version 2.0 (the "License");
1124
- * you may not use this file except in compliance with the License.
1125
- * You may obtain a copy of the License at
1126
- *
1127
- * http://www.apache.org/licenses/LICENSE-2.0
1128
- *
1129
- * Unless required by applicable law or agreed to in writing, software
1130
- * distributed under the License is distributed on an "AS IS" BASIS,
1131
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1132
- * See the License for the specific language governing permissions and
1133
- * limitations under the License.
1134
- */function tc(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1135
- * @license
1136
- * Copyright 2019 Google LLC
1137
- *
1138
- * Licensed under the Apache License, Version 2.0 (the "License");
1139
- * you may not use this file except in compliance with the License.
1140
- * You may obtain a copy of the License at
1141
- *
1142
- * http://www.apache.org/licenses/LICENSE-2.0
1143
- *
1144
- * Unless required by applicable law or agreed to in writing, software
1145
- * distributed under the License is distributed on an "AS IS" BASIS,
1146
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1147
- * See the License for the specific language governing permissions and
1148
- * limitations under the License.
1149
- */class cC{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 d=tc("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(m){const b=m;if(b.data.eventId===d)switch(b.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(b.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:d,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1150
- * @license
1151
- * Copyright 2020 Google LLC
1152
- *
1153
- * Licensed under the Apache License, Version 2.0 (the "License");
1154
- * you may not use this file except in compliance with the License.
1155
- * You may obtain a copy of the License at
1156
- *
1157
- * http://www.apache.org/licenses/LICENSE-2.0
1158
- *
1159
- * Unless required by applicable law or agreed to in writing, software
1160
- * distributed under the License is distributed on an "AS IS" BASIS,
1161
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1162
- * See the License for the specific language governing permissions and
1163
- * limitations under the License.
1164
- */function Ir(){return window}function uC(e){Ir().location.href=e}/**
1165
- * @license
1166
- * Copyright 2020 Google LLC.
1167
- *
1168
- * Licensed under the Apache License, Version 2.0 (the "License");
1169
- * you may not use this file except in compliance with the License.
1170
- * You may obtain a copy of the License at
1171
- *
1172
- * http://www.apache.org/licenses/LICENSE-2.0
1173
- *
1174
- * Unless required by applicable law or agreed to in writing, software
1175
- * distributed under the License is distributed on an "AS IS" BASIS,
1176
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1177
- * See the License for the specific language governing permissions and
1178
- * limitations under the License.
1179
- */function $h(){return typeof Ir().WorkerGlobalScope<"u"&&typeof Ir().importScripts=="function"}async function dC(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function fC(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function hC(){return $h()?self:null}/**
1180
- * @license
1181
- * Copyright 2019 Google LLC
1182
- *
1183
- * Licensed under the Apache License, Version 2.0 (the "License");
1184
- * you may not use this file except in compliance with the License.
1185
- * You may obtain a copy of the License at
1186
- *
1187
- * http://www.apache.org/licenses/LICENSE-2.0
1188
- *
1189
- * Unless required by applicable law or agreed to in writing, software
1190
- * distributed under the License is distributed on an "AS IS" BASIS,
1191
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1192
- * See the License for the specific language governing permissions and
1193
- * limitations under the License.
1194
- */const Oh="firebaseLocalStorageDb",pC=1,xi="firebaseLocalStorage",Nh="fbase_key";class qo{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 Ki(e,t){return e.transaction([xi],t?"readwrite":"readonly").objectStore(xi)}function mC(){const e=indexedDB.deleteDatabase(Oh);return new qo(e).toPromise()}function fl(){const e=indexedDB.open(Oh,pC);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(xi,{keyPath:Nh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(xi)?t(r):(r.close(),await mC(),t(await fl()))})})}async function Gu(e,t,n){const r=Ki(e,!0).put({[Nh]:t,value:n});return new qo(r).toPromise()}async function gC(e,t){const n=Ki(e,!1).get(t),r=await new qo(n).toPromise();return r===void 0?null:r.value}function Ku(e,t){const n=Ki(e,!0).delete(t);return new qo(n).toPromise()}const vC=800,yC=3;class Lh{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 fl(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>yC)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return $h()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Gi._getInstance(hC()),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 dC(),!this.activeServiceWorker)return;this.sender=new cC(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||fC()!==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 fl();return await Gu(t,Ai,"1"),await Ku(t,Ai),!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=>Gu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>gC(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ku(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Ki(s,!1).getAll();return new qo(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(),vC)}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()}}Lh.type="LOCAL";const wC=Lh;new Vo(3e4,6e4);/**
1195
- * @license
1196
- * Copyright 2021 Google LLC
1197
- *
1198
- * Licensed under the Apache License, Version 2.0 (the "License");
1199
- * you may not use this file except in compliance with the License.
1200
- * You may obtain a copy of the License at
1201
- *
1202
- * http://www.apache.org/licenses/LICENSE-2.0
1203
- *
1204
- * Unless required by applicable law or agreed to in writing, software
1205
- * distributed under the License is distributed on an "AS IS" BASIS,
1206
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1207
- * See the License for the specific language governing permissions and
1208
- * limitations under the License.
1209
- */function Dh(e,t){return t?Dr(t):(tt(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1210
- * @license
1211
- * Copyright 2019 Google LLC
1212
- *
1213
- * Licensed under the Apache License, Version 2.0 (the "License");
1214
- * you may not use this file except in compliance with the License.
1215
- * You may obtain a copy of the License at
1216
- *
1217
- * http://www.apache.org/licenses/LICENSE-2.0
1218
- *
1219
- * Unless required by applicable law or agreed to in writing, software
1220
- * distributed under the License is distributed on an "AS IS" BASIS,
1221
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1222
- * See the License for the specific language governing permissions and
1223
- * limitations under the License.
1224
- */class nc extends Ch{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Ks(t,this._buildIdpRequest())}_linkToIdToken(t,n){return Ks(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return Ks(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 bC(e){return nC(e.auth,new nc(e),e.bypassAuthState)}function _C(e){const{auth:t,user:n}=e;return tt(n,t,"internal-error"),tC(n,new nc(e),e.bypassAuthState)}async function kC(e){const{auth:t,user:n}=e;return tt(n,t,"internal-error"),eC(n,new nc(e),e.bypassAuthState)}/**
1225
- * @license
1226
- * Copyright 2020 Google LLC
1227
- *
1228
- * Licensed under the Apache License, Version 2.0 (the "License");
1229
- * you may not use this file except in compliance with the License.
1230
- * You may obtain a copy of the License at
1231
- *
1232
- * http://www.apache.org/licenses/LICENSE-2.0
1233
- *
1234
- * Unless required by applicable law or agreed to in writing, software
1235
- * distributed under the License is distributed on an "AS IS" BASIS,
1236
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1237
- * See the License for the specific language governing permissions and
1238
- * limitations under the License.
1239
- */class jh{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(d){this.reject(d)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return bC;case"linkViaPopup":case"linkViaRedirect":return kC;case"reauthViaPopup":case"reauthViaRedirect":return _C;default:Er(this.auth,"internal-error")}}resolve(t){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){zr(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()}}/**
1240
- * @license
1241
- * Copyright 2020 Google LLC
1242
- *
1243
- * Licensed under the Apache License, Version 2.0 (the "License");
1244
- * you may not use this file except in compliance with the License.
1245
- * You may obtain a copy of the License at
1246
- *
1247
- * http://www.apache.org/licenses/LICENSE-2.0
1248
- *
1249
- * Unless required by applicable law or agreed to in writing, software
1250
- * distributed under the License is distributed on an "AS IS" BASIS,
1251
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1252
- * See the License for the specific language governing permissions and
1253
- * limitations under the License.
1254
- */const TC=new Vo(2e3,1e4);async function SC(e,t,n){if(_r(e.app))return Promise.reject(ar(e,"operation-not-supported-in-this-environment"));const r=qi(e);bE(e,t,ec);const s=Dh(r,n);return new Es(r,"signInViaPopup",t,s).executeNotNull()}class Es extends jh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Es.currentPopupAction&&Es.currentPopupAction.cancel(),Es.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return tt(t,this.auth,"internal-error"),t}async onExecution(){zr(this.filter.length===1,"Popup operations only handle one event");const t=tc();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(ar(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(ar(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Es.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(ar(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,TC.get())};t()}}Es.currentPopupAction=null;/**
1255
- * @license
1256
- * Copyright 2020 Google LLC
1257
- *
1258
- * Licensed under the Apache License, Version 2.0 (the "License");
1259
- * you may not use this file except in compliance with the License.
1260
- * You may obtain a copy of the License at
1261
- *
1262
- * http://www.apache.org/licenses/LICENSE-2.0
1263
- *
1264
- * Unless required by applicable law or agreed to in writing, software
1265
- * distributed under the License is distributed on an "AS IS" BASIS,
1266
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1267
- * See the License for the specific language governing permissions and
1268
- * limitations under the License.
1269
- */const IC="pendingRedirect",hi=new Map;class EC extends jh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=hi.get(this.auth._key());if(!t){try{const r=await CC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}hi.set(this.auth._key(),t)}return this.bypassAuthState||hi.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 CC(e,t){const n=RC(t),r=xC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function AC(e,t){hi.set(e._key(),t)}function xC(e){return Dr(e._redirectPersistence)}function RC(e){return fi(IC,e.config.apiKey,e.name)}async function PC(e,t,n=!1){if(_r(e.app))return Promise.reject(xs(e));const r=qi(e),s=Dh(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}/**
1270
- * @license
1271
- * Copyright 2020 Google LLC
1272
- *
1273
- * Licensed under the Apache License, Version 2.0 (the "License");
1274
- * you may not use this file except in compliance with the License.
1275
- * You may obtain a copy of the License at
1276
- *
1277
- * http://www.apache.org/licenses/LICENSE-2.0
1278
- *
1279
- * Unless required by applicable law or agreed to in writing, software
1280
- * distributed under the License is distributed on an "AS IS" BASIS,
1281
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1282
- * See the License for the specific language governing permissions and
1283
- * limitations under the License.
1284
- */const MC=600*1e3;class $C{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||!OC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Fh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(ar(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>=MC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ju(t))}saveEventToCache(t){this.cachedEventUids.add(Ju(t)),this.lastProcessedEventTime=Date.now()}}function Ju(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Fh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function OC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Fh(e);default:return!1}}/**
1285
- * @license
1286
- * Copyright 2020 Google LLC
1287
- *
1288
- * Licensed under the Apache License, Version 2.0 (the "License");
1289
- * you may not use this file except in compliance with the License.
1290
- * You may obtain a copy of the License at
1291
- *
1292
- * http://www.apache.org/licenses/LICENSE-2.0
1293
- *
1294
- * Unless required by applicable law or agreed to in writing, software
1295
- * distributed under the License is distributed on an "AS IS" BASIS,
1296
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1297
- * See the License for the specific language governing permissions and
1298
- * limitations under the License.
1299
- */async function NC(e,t={}){return no(e,"GET","/v1/projects",t)}/**
1300
- * @license
1301
- * Copyright 2020 Google LLC
1302
- *
1303
- * Licensed under the Apache License, Version 2.0 (the "License");
1304
- * you may not use this file except in compliance with the License.
1305
- * You may obtain a copy of the License at
1306
- *
1307
- * http://www.apache.org/licenses/LICENSE-2.0
1308
- *
1309
- * Unless required by applicable law or agreed to in writing, software
1310
- * distributed under the License is distributed on an "AS IS" BASIS,
1311
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
- * See the License for the specific language governing permissions and
1313
- * limitations under the License.
1314
- */const LC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,DC=/^https?/;async function jC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await NC(e);for(const n of t)try{if(FC(n))return}catch{}Er(e,"unauthorized-domain")}function FC(e){const t=ul(),{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(LC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1315
- * @license
1316
- * Copyright 2020 Google LLC.
1317
- *
1318
- * Licensed under the Apache License, Version 2.0 (the "License");
1319
- * you may not use this file except in compliance with the License.
1320
- * You may obtain a copy of the License at
1321
- *
1322
- * http://www.apache.org/licenses/LICENSE-2.0
1323
- *
1324
- * Unless required by applicable law or agreed to in writing, software
1325
- * distributed under the License is distributed on an "AS IS" BASIS,
1326
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1327
- * See the License for the specific language governing permissions and
1328
- * limitations under the License.
1329
- */const BC=new Vo(3e4,6e4);function Yu(){const e=Ir().___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 UC(e){return new Promise((t,n)=>{var s,o,i;function r(){Yu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Yu(),n(ar(e,"network-request-failed"))},timeout:BC.get()})}if((o=(s=Ir().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Ir().gapi)!=null&&i.load)r();else{const a=GE("iframefcb");return Ir()[a]=()=>{gapi.load?r():n(ar(e,"network-request-failed"))},zE(`${qE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw pi=null,t})}let pi=null;function HC(e){return pi=pi||UC(e),pi}/**
1330
- * @license
1331
- * Copyright 2020 Google LLC.
1332
- *
1333
- * Licensed under the Apache License, Version 2.0 (the "License");
1334
- * you may not use this file except in compliance with the License.
1335
- * You may obtain a copy of the License at
1336
- *
1337
- * http://www.apache.org/licenses/LICENSE-2.0
1338
- *
1339
- * Unless required by applicable law or agreed to in writing, software
1340
- * distributed under the License is distributed on an "AS IS" BASIS,
1341
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1342
- * See the License for the specific language governing permissions and
1343
- * limitations under the License.
1344
- */const WC=new Vo(5e3,15e3),VC="__/auth/iframe",zC="emulator/auth/iframe",qC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},GC=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;tt(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Jl(t,zC):`https://${e.config.authDomain}/${VC}`,r={apiKey:t.apiKey,appName:e.name,v:Wo},s=GC.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ho(r).slice(1)}`}async function JC(e){const t=await HC(e),n=Ir().gapi;return tt(n,e,"internal-error"),t.open({where:document.body,url:KC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:qC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=ar(e,"network-request-failed"),a=Ir().setTimeout(()=>{o(i)},WC.get());function l(){Ir().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1345
- * @license
1346
- * Copyright 2020 Google LLC.
1347
- *
1348
- * Licensed under the Apache License, Version 2.0 (the "License");
1349
- * you may not use this file except in compliance with the License.
1350
- * You may obtain a copy of the License at
1351
- *
1352
- * http://www.apache.org/licenses/LICENSE-2.0
1353
- *
1354
- * Unless required by applicable law or agreed to in writing, software
1355
- * distributed under the License is distributed on an "AS IS" BASIS,
1356
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1357
- * See the License for the specific language governing permissions and
1358
- * limitations under the License.
1359
- */const YC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},QC=500,XC=600,ZC="_blank",eA="http://localhost";class Qu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function tA(e,t,n,r=QC,s=XC){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={...YC,width:r.toString(),height:s.toString(),top:o,left:i},d=$n().toLowerCase();n&&(a=wh(d)?ZC:n),vh(d)&&(t=t||eA,l.scrollbars="yes");const c=Object.entries(l).reduce((b,[I,j])=>`${b}${I}=${j},`,"");if(DE(d)&&a!=="_self")return nA(t||"",a),new Qu(null);const m=window.open(t||"",a,c);tt(m,e,"popup-blocked");try{m.focus()}catch{}return new Qu(m)}function nA(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)}/**
1360
- * @license
1361
- * Copyright 2021 Google LLC
1362
- *
1363
- * Licensed under the Apache License, Version 2.0 (the "License");
1364
- * you may not use this file except in compliance with the License.
1365
- * You may obtain a copy of the License at
1366
- *
1367
- * http://www.apache.org/licenses/LICENSE-2.0
1368
- *
1369
- * Unless required by applicable law or agreed to in writing, software
1370
- * distributed under the License is distributed on an "AS IS" BASIS,
1371
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1372
- * See the License for the specific language governing permissions and
1373
- * limitations under the License.
1374
- */const rA="__/auth/handler",sA="emulator/auth/handler",oA=encodeURIComponent("fac");async function Xu(e,t,n,r,s,o){tt(e.config.authDomain,e,"auth-domain-config-required"),tt(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Wo,eventId:s};if(t instanceof ec){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",nI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,m]of Object.entries({}))i[c]=m}if(t instanceof zo){const c=t.getScopes().filter(m=>m!=="");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(),d=l?`#${oA}=${encodeURIComponent(l)}`:"";return`${iA(e)}?${Ho(a).slice(1)}${d}`}function iA({config:e}){return e.emulator?Jl(e,sA):`https://${e.authDomain}/${rA}`}/**
1375
- * @license
1376
- * Copyright 2020 Google LLC
1377
- *
1378
- * Licensed under the Apache License, Version 2.0 (the "License");
1379
- * you may not use this file except in compliance with the License.
1380
- * You may obtain a copy of the License at
1381
- *
1382
- * http://www.apache.org/licenses/LICENSE-2.0
1383
- *
1384
- * Unless required by applicable law or agreed to in writing, software
1385
- * distributed under the License is distributed on an "AS IS" BASIS,
1386
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1387
- * See the License for the specific language governing permissions and
1388
- * limitations under the License.
1389
- */const xa="webStorageSupport";class aA{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Mh,this._completeRedirectFn=PC,this._overrideRedirectResult=AC}async _openPopup(t,n,r,s){var i;zr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Xu(t,n,r,ul(),s);return tA(t,o,tc())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Xu(t,n,r,ul(),s);return uC(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):(zr(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 JC(t),r=new $C(t);return n.register("authEvent",s=>(tt(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(xa,{type:xa},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[xa];o!==void 0&&n(!!o),Er(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=jC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Sh()||yh()||Xl()}}const lA=aA;var Zu="@firebase/auth",ed="1.12.2";/**
1390
- * @license
1391
- * Copyright 2020 Google LLC
1392
- *
1393
- * Licensed under the Apache License, Version 2.0 (the "License");
1394
- * you may not use this file except in compliance with the License.
1395
- * You may obtain a copy of the License at
1396
- *
1397
- * http://www.apache.org/licenses/LICENSE-2.0
1398
- *
1399
- * Unless required by applicable law or agreed to in writing, software
1400
- * distributed under the License is distributed on an "AS IS" BASIS,
1401
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1402
- * See the License for the specific language governing permissions and
1403
- * limitations under the License.
1404
- */class cA{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(){tt(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1405
- * @license
1406
- * Copyright 2020 Google LLC
1407
- *
1408
- * Licensed under the Apache License, Version 2.0 (the "License");
1409
- * you may not use this file except in compliance with the License.
1410
- * You may obtain a copy of the License at
1411
- *
1412
- * http://www.apache.org/licenses/LICENSE-2.0
1413
- *
1414
- * Unless required by applicable law or agreed to in writing, software
1415
- * distributed under the License is distributed on an "AS IS" BASIS,
1416
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1417
- * See the License for the specific language governing permissions and
1418
- * limitations under the License.
1419
- */function uA(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 dA(e){No(new Zs("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;tt(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:Ih(e)},d=new WE(r,s,o,l);return JE(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),No(new Zs("auth-internal",t=>{const n=qi(t.getProvider("auth").getImmediate());return(r=>new cA(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),zs(Zu,ed,uA(e)),zs(Zu,ed,"esm2020")}/**
1420
- * @license
1421
- * Copyright 2021 Google LLC
1422
- *
1423
- * Licensed under the Apache License, Version 2.0 (the "License");
1424
- * you may not use this file except in compliance with the License.
1425
- * You may obtain a copy of the License at
1426
- *
1427
- * http://www.apache.org/licenses/LICENSE-2.0
1428
- *
1429
- * Unless required by applicable law or agreed to in writing, software
1430
- * distributed under the License is distributed on an "AS IS" BASIS,
1431
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1432
- * See the License for the specific language governing permissions and
1433
- * limitations under the License.
1434
- */const fA=300,hA=th("authIdTokenMaxAge")||fA;let td=null;const pA=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>hA)return;const s=n==null?void 0:n.token;td!==s&&(td=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function mA(e=ah()){const t=oh(e,"auth");if(t.isInitialized())return t.getImmediate();const n=KE(e,{popupRedirectResolver:lA,persistence:[wC,aC,Mh]}),r=th("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=pA(o.toString());sC(n,i,()=>i(n.currentUser)),rC(n,a=>i(a))}}const s=VS("auth");return s&&YE(n,`http://${s}`),n}function gA(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}VE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=ar("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",gA().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="});dA("Browser");const vA={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 yA(e){const t=D(null),n=D(""),r=D(""),s=D(""),o=D({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=fe(()=>s.value==="pull"),a=fe(()=>s.value==="push"),l=fe(()=>s.value!=="");async function d(){try{const $=await fetch("/codex-api/skills-sync/status");if(!$.ok)return;const X=await $.json();X.data&&(o.value=X.data)}catch{}}async function c(){try{const $=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),X=await $.json();if(!$.ok||!X.data)throw new Error("Failed to start GitHub login");t.value=X.data;const ae=30,z=Math.max((X.data.interval??5)*1e3,3e3);let J=!1;for(let ne=0;ne<ae;ne++){await new Promise(ge=>setTimeout(ge,z));const ke=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:X.data.device_code})}),me=await ke.json();if(!ke.ok)throw new Error(me.error||"Failed to complete GitHub login");if(me.ok){J=!0;break}if(!me.pending)throw new Error(me.error||"Failed to complete GitHub login")}if(!J)throw new Error("GitHub login timed out. Please retry.");t.value=null,await d(),e.showToast("GitHub login successful")}catch($){e.showToast($ instanceof Error?$.message:"Failed GitHub login","error")}}async function m(){try{const $=oE().length>0?ah():ih(vA),X=mA($),ae=new kr;ae.addScope("repo");const z=await SC(X,ae),J=kr.credentialFromResult(z),ne=(J==null?void 0:J.accessToken)??"";if(!ne)throw new Error("GitHub access token missing from Firebase login");const ke=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:ne})}),me=await ke.json();if(!ke.ok||!me.ok)throw new Error(me.error||"Failed to login with GitHub token");await d(),e.showToast("GitHub login successful")}catch($){const X=$ instanceof Error?$.message:"Failed Firebase GitHub login";e.showToast(X,"error")}}async function b(){r.value="",n.value="pull-started",s.value="pull";try{const $=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.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($){const X=$ instanceof Error?$.message:"Failed to pull sync";r.value=X,n.value="pull-failed",e.showToast(X,"error")}finally{s.value=""}}async function I(){r.value="",n.value="push-started",s.value="push";try{const $=await fetch("/codex-api/skills-sync/push",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch($){const X=$ instanceof Error?$.message:"Failed to push sync";r.value=X,n.value="push-failed",e.showToast(X,"error")}finally{s.value=""}}async function j(){try{const $=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.error||"Failed to logout GitHub");await d(),e.showToast("Logged out from GitHub")}catch($){e.showToast($ instanceof Error?$.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:d,logoutGithub:j,pullSkillsSync:b,pushSkillsSync:I,startGithubFirebaseLogin:m,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const wA={class:"skills-hub"},bA={class:"skills-sync-panel"},_A={class:"skills-sync-header"},kA={key:0,class:"skills-sync-badge"},TA={key:1,class:"skills-sync-badge"},SA={key:2,class:"skills-sync-badge"},IA={class:"skills-sync-meta"},EA={key:0,class:"skills-sync-error"},CA={key:1,class:"skills-sync-meta"},AA={key:2,class:"skills-sync-error"},xA={key:3,class:"skills-sync-device"},RA=["href"],PA={class:"skills-sync-actions"},MA=["disabled"],$A=["disabled"],OA=["disabled"],NA={key:1,class:"skills-hub-section"},LA={class:"skills-hub-section-title"},DA={key:0,class:"skills-hub-grid"},jA={class:"skills-hub-toolbar"},FA={class:"skills-hub-search-wrap"},BA={key:0,class:"skills-hub-count"},UA={class:"skills-hub-section"},HA={key:0,class:"skills-hub-loading"},WA={key:1,class:"skills-hub-error"},VA={key:0,class:"skills-hub-grid"},zA={key:1,class:"skills-hub-empty"},ti="codex-web-local.skills-hub.cache.v1",qA=on({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=D(null),s=D(""),o=D("date"),i=D([]),a=D([]),l=D(0),d=D(!1),c=D(""),m=D(!0),b=D(!1),I=D(n),j=D(null),$=D(""),X=D(!1),ae=D(!1);let z=null,J=null;const ne=t,ke=fe(()=>o.value==="date"?"Newest":"A-Z"),me=fe(()=>{var N;return((N=j.value)==null?void 0:N.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ge=fe(()=>`${I.value.owner}/${I.value.name}`),je=fe(()=>X.value&&$.value===ge.value),le=fe(()=>ae.value&&$.value===ge.value),re=fe(()=>{const N=s.value.toLowerCase().trim();return N?a.value.filter(F=>F.name.toLowerCase().includes(N)||F.owner.toLowerCase().includes(N)||(F.displayName??"").toLowerCase().includes(N)):a.value});function de(N,F="success"){j.value={text:N,type:F},J&&clearTimeout(J),J=setTimeout(()=>{j.value=null},3e3)}function te(){o.value=o.value==="date"?"name":"date",Me(s.value)}function Pe(N){return`${o.value}::${N.trim().toLowerCase()}`}function Je(N){var F;if(typeof window>"u")return null;try{const B=window.localStorage.getItem(ti);return B?((F=JSON.parse(B).byKey)==null?void 0:F[N])??null:null}catch{return null}}function He(N,F){if(!(typeof window>"u"))try{const B=window.localStorage.getItem(ti),Q=(B?JSON.parse(B):{}).byKey??{};Q[N]=F,window.localStorage.setItem(ti,JSON.stringify({byKey:Q}))}catch{}}function ze(){if(!(typeof window>"u"))try{window.localStorage.removeItem(ti)}catch{}}function We(N){const F=N.installed??[];a.value=F;const B=new Set(F.map(ee=>ee.name));i.value=N.data.map(ee=>{if(ee.installed||B.has(ee.name)){const Q=F.find(Ee=>Ee.name===ee.name);return{...ee,installed:!0,path:(Q==null?void 0:Q.path)??ee.path,enabled:(Q==null?void 0:Q.enabled)??ee.enabled}}return ee}).filter(ee=>!ee.installed),l.value=N.total}async function Me(N){const F=Pe(N),B=Je(F);B&&We(B),d.value=!B,c.value="";try{const ee=new URLSearchParams;N.trim()&&ee.set("q",N.trim()),ee.set("limit","100"),ee.set("sort",o.value);const Q=await fetch(`/codex-api/skills-hub?${ee}`);if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const Ee=await Q.json();We(Ee),He(F,Ee)}catch(ee){c.value=ee instanceof Error?ee.message:"Failed to load skills"}finally{d.value=!1}}function Ae(){z&&clearTimeout(z),z=setTimeout(()=>Me(s.value),300)}function qe(N){I.value=N,b.value=!0}async function Fe(N){$.value=`${N.owner}/${N.name}`,X.value=!0;try{const B=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:N.owner,name:N.name})})).json();if(!B.ok)throw new Error(B.error||"Install failed");const ee={...N,installed:!0,path:B.path,enabled:!0};a.value=[...a.value,ee],i.value=i.value.filter(Q=>Q.name!==N.name),I.value=ee,de(`${N.displayName||N.name} skill installed`),b.value=!1,ze(),ne("skills-changed")}catch(F){de(F instanceof Error?F.message:"Failed to install skill","error")}finally{X.value=!1}}async function gt(N){$.value=`${N.owner}/${N.name}`,ae.value=!0;try{const B=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:N.name,path:N.path})})).json();if(!B.ok)throw new Error(B.error||"Uninstall failed");a.value=a.value.filter(ee=>ee.name!==N.name),N.owner!=="local"&&(i.value=[...i.value,{...N,installed:!1,path:void 0,enabled:void 0}]),de(`${N.displayName||N.name} skill uninstalled`),b.value=!1,ze(),ne("skills-changed")}catch(F){de(F instanceof Error?F.message:"Failed to uninstall skill","error")}finally{ae.value=!1}}async function Ht(N,F){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:N.path,enabled:F}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),de(`${N.displayName||N.name} skill ${F?"enabled":"disabled"}`),await Me(s.value)}catch(B){de(B instanceof Error?B.message:"Failed to update skill","error")}}const{deviceLogin:ut,isPullInFlight:lt,isPushInFlight:Qe,isSyncActionInFlight:W,loadSyncStatus:we,logoutGithub:ue,pullSkillsSync:ve,pushSkillsSync:xe,startGithubFirebaseLogin:T,startGithubLogin:E,syncActionError:O,syncActionStatus:V,syncStatus:G}=yA({showToast:de,onPulled:async()=>{await Me(s.value),ne("skills-changed")}});return Gr(()=>{Me(""),we()}),(N,F)=>(y(),k("div",wA,[F[11]||(F[11]=v("div",{class:"skills-hub-header"},[v("h2",{class:"skills-hub-title"},"Skills Hub"),v("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),v("div",bA,[v("div",_A,[F[8]||(F[8]=v("strong",null,"Skills Sync (GitHub)",-1)),_e(G).configured?(y(),k("span",kA,"Connected: "+K(_e(G).repoOwner)+"/"+K(_e(G).repoName),1)):_e(G).loggedIn?(y(),k("span",TA,"Logged in as "+K(_e(G).githubUsername),1)):(y(),k("span",SA,"Not connected"))]),v("div",IA,[v("span",null,"Startup: "+K(_e(G).startup.mode),1),v("span",null,"Branch: "+K(_e(G).startup.branch),1),v("span",null,"Action: "+K(_e(G).startup.lastAction),1)]),_e(G).startup.lastError?(y(),k("div",EA,K(_e(G).startup.lastError),1)):he("",!0),_e(V)?(y(),k("div",CA,[v("span",null,"Manual sync: "+K(_e(V)),1)])):he("",!0),_e(O)?(y(),k("div",AA,K(_e(O)),1)):he("",!0),_e(ut)?(y(),k("div",xA,[v("span",null,[F[9]||(F[9]=Ro("Open ",-1)),v("a",{href:_e(ut).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,RA),F[10]||(F[10]=Ro(" and enter code:",-1))]),v("code",null,K(_e(ut).user_code),1)])):he("",!0),v("div",PA,[_e(G).loggedIn?he("",!0):(y(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:F[0]||(F[0]=(...B)=>_e(T)&&_e(T)(...B))},"Login with GitHub")),_e(G).loggedIn?he("",!0):(y(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:F[1]||(F[1]=(...B)=>_e(E)&&_e(E)(...B))},"Device Login")),_e(G).loggedIn?(y(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:F[2]||(F[2]=(...B)=>_e(ue)&&_e(ue)(...B)),disabled:_e(W)},"Logout GitHub",8,MA)):he("",!0),v("button",{class:"skills-hub-sort",type:"button",onClick:F[3]||(F[3]=(...B)=>_e(ve)&&_e(ve)(...B)),disabled:_e(W)},K(_e(lt)?"Pulling...":"Pull"),9,$A),_e(G).loggedIn?(y(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:F[4]||(F[4]=(...B)=>_e(xe)&&_e(xe)(...B)),disabled:!_e(G).configured||_e(W)},K(_e(Qe)?"Pushing...":"Push"),9,OA)):he("",!0)])]),j.value?(y(),k("div",{key:0,class:nt(["skills-hub-toast",me.value])},K(j.value.text),3)):he("",!0),re.value.length>0?(y(),k("div",NA,[v("button",{class:"skills-hub-section-toggle",type:"button",onClick:F[5]||(F[5]=B=>m.value=!m.value)},[v("span",LA,"Installed ("+K(re.value.length)+")",1),De(Uf,{class:nt(["skills-hub-section-chevron",{"is-open":m.value}])},null,8,["class"])]),m.value?(y(),k("div",DA,[(y(!0),k(Oe,null,yt(re.value,B=>(y(),_t(Au,{key:B.name,skill:B,onSelect:ee=>qe(ee)},null,8,["skill","onSelect"]))),128))])):he("",!0)])):he("",!0),v("div",jA,[v("div",FA,[De(sl,{class:"skills-hub-search-icon"}),Hr(v("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":F[6]||(F[6]=B=>s.value=B),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:Ae},null,544),[[Wr,s.value]]),l.value>0?(y(),k("span",BA,K(l.value)+" skills",1)):he("",!0)]),v("button",{class:"skills-hub-sort",type:"button",onClick:te},K(ke.value),1)]),v("div",UA,[d.value?(y(),k("div",HA,"Loading skills...")):c.value?(y(),k("div",WA,K(c.value),1)):(y(),k(Oe,{key:2},[i.value.length>0?(y(),k("div",VA,[(y(!0),k(Oe,null,yt(i.value,B=>(y(),_t(Au,{key:B.url,skill:B,onSelect:ee=>qe(ee)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(y(),k("div",zA,'No skills found for "'+K(s.value)+'"',1)):he("",!0)],64))]),De(NS,{skill:I.value,visible:b.value,"is-installing":je.value,"is-uninstalling":le.value,onClose:F[7]||(F[7]=B=>b.value=!1),onInstall:Fe,onUninstall:gt,onToggleEnabled:Ht},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),GA=kt(qA,[["__scopeId","data-v-2f6920be"]]),KA={},JA={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 YA(e,t){return y(),k("svg",JA,[...t[0]||(t[0]=[v("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),v("path",{d:"M9 4l0 16"},null,-1)])])}const QA=kt(KA,[["render",YA]]),XA={},ZA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function e1(e,t){return y(),k("svg",ZA,[...t[0]||(t[0]=[v("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 t1=kt(XA,[["render",e1]]),n1={class:"sidebar-thread-controls"},r1=["aria-label","title"],s1=on({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(y(),k("div",n1,[v("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?(y(),_t(t1,{key:0,class:"sidebar-thread-controls-icon"})):(y(),_t(QA,{key:1,class:"sidebar-thread-controls-icon"}))],8,r1),Tr(t.$slots,"default",{},void 0),e.showNewThreadButton?(y(),k("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"))},[De(Ti,{class:"sidebar-thread-controls-icon"})])):he("",!0)]))}}),nd=kt(s1,[["__scopeId","data-v-46a10052"]]),o1={},i1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function a1(e,t){return y(),k("svg",i1,[...t[0]||(t[0]=[v("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[v("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"}),v("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const l1=kt(o1,[["render",a1]]);function ns(e){return e.flatMap(t=>t.threads)}const Bh="codex-web-local.thread-read-state.v1",Uh="codex-web-local.thread-scroll-state.v1",hl="codex-web-local.selected-thread-id.v1",Hh="codex-web-local.project-order.v1",Wh="codex-web-local.project-display-name.v1",pl="codex-web-local.collaboration-mode-by-context.v1",Vh="codex-web-local.collaboration-mode.v1",zh="__new-thread__",Ra=220,rd=["none","minimal","low","medium","high","xhigh"],Os="__global__",Yn="gpt-5.2-codex";function c1(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Bh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function sd(e){typeof window>"u"||window.localStorage.setItem(Bh,JSON.stringify(e))}function ml(e){return e==="plan"?"plan":"default"}function qh(e){return e.trim()||zh}function u1(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(pl);if(t){const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const r={};for(const[s,o]of Object.entries(n)){if(typeof s!="string"||s.length===0)continue;const i=ml(o);i==="plan"&&(r[s]=i)}return r}}catch{}return ml(window.localStorage.getItem(Vh))==="plan"?{[zh]:"plan"}:{}}function Pa(e,t){const n=qh(t);return ml(e[n])}function d1(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(pl):window.localStorage.setItem(pl,JSON.stringify(e)),window.localStorage.removeItem(Vh))}function Gh(e,t,n){return Math.min(Math.max(e,t),n)}function f1(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=Gh(t.scrollRatio,0,1)),n}function h1(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uh);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=f1(s);o&&(n[r]=o)}return n}catch{return{}}}function od(e){typeof window>"u"||window.localStorage.setItem(Uh,JSON.stringify(e))}function p1(){return typeof window>"u"?"":window.localStorage.getItem(hl)??""}function m1(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(hl);return}window.localStorage.setItem(hl,e)}}function g1(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Hh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&!n.includes(r)&&n.push(r);return n}catch{return[]}}function Ns(e){typeof window>"u"||window.localStorage.setItem(Hh,JSON.stringify(e))}function v1(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Wh);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))typeof r=="string"&&r.length>0&&typeof s=="string"&&(n[r]=s);return n}catch{return{}}}function Ma(e){typeof window>"u"||window.localStorage.setItem(Wh,JSON.stringify(e))}function ni(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 Ss(e,n)?e:n}function $a(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Ss(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 y1(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 w1(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function b1(e=[],t=[]){var n,r,s,o;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(((n=e[i])==null?void 0:n.step)!==((r=t[i])==null?void 0:r.step)||((s=e[i])==null?void 0:s.status)!==((o=t[i])==null?void 0:o.status))return!1;return!0}function _1(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&b1(e.steps,t.steps)}function ri(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 gl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ss(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&w1(e.commandExecution,t.commandExecution)&&_1(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function To(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 k1(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 m=r.get(c.id);return m&&gl(m,c)?m:c});if(n.preserveMissing!==!0)return To(e,o)?e:o;const i=e.map(c=>{const m=s.get(c.id);return!m||gl(c,m)?c:m}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),d=[...i,...l];return To(e,d)?e:d}function vl(e){return e.replace(/\s+/gu," ").trim()}function T1(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>vl(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=vl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Oa(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(gl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Kh="worked";function Zr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function S1(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 I1(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function E1(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 C1(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${S1(e.durationMs)}`,messageType:Kh}}function A1(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function x1(e,t){const n=C1(t),r=e.filter(i=>i.messageType!==Kh),s=A1(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function sn(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function R1(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[s,o]of Object.entries(e)){if(t.has(s)){n=!0;continue}r[s]=o}return n?r:e}function P1(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 M1(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 $1(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 pn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function si(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 d=i.get(l.id);return d&&P1(d,l)?d:l});return o&&o.projectName===s.projectName&&M1(o.threads,a)?o:{projectName:s.projectName,threads:a}});return $1(e,r)?e:r}function O1(e,t,n){const r=new Set(ns(t).map(a=>a.id)),s=ns(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 d=i.findIndex(c=>c.projectName===a.projectName);d>=0&&(i[d]={projectName:i[d].projectName,threads:[a,...i[d].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function N1(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ls(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function L1(e){const t=e.split(`
1435
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function D1(){const e=D([]),t=D([]),n=D(p1()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),d=D({}),c=D({}),m=D([]),b=D([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),I=D(u1()),j=D(Pa(I.value,n.value)),$=D(""),X=D("medium"),ae=D(c1()),z=D(h1()),J=D(g1()),ne=D(v1()),ke=D({}),me=D({}),ge=D({}),je=D({}),le=D({}),re=D({}),de=D({}),te=D({}),Pe=D({}),Je=D(null),He=D({}),ze=D([]),We=D(!1),Me=D(!1),Ae=D(!1),qe=D(!1),Fe=D(""),gt=D(!1),Ht=D(!1);let ut=null,lt=null,Qe=!1;const W=new Set;let we=!1,ue=!1;const ve=new Map,xe=new Set,T=fe(()=>ns(e.value)),E=fe(()=>T.value.find(u=>u.id===n.value)??null),O=fe(()=>z.value[n.value]??null),V=fe(()=>{const u=[],p=n.value;return p&&Array.isArray(te.value[p])&&u.push(...te.value[p]),Array.isArray(te.value[Os])&&u.push(...te.value[Os]),u.sort((_,C)=>_.receivedAtIso.localeCompare(C.receivedAtIso))}),G=fe(()=>{var Y;const u=n.value;if(!u)return null;const p=le.value[u],_=(i.value[u]??"").trim(),C=(((Y=re.value[u])==null?void 0:Y.message)??"").trim();return!p&&!_&&!C?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:_,errorText:C}}),N=fe(()=>Je.value),F=fe(()=>{const u=n.value;if(!u)return[];const p=r.value[u]??[],_=s.value[u]??[],C=o.value[u]??[],Y=a.value[u]??[],oe=[...p,..._,...Y,...C],ce=je.value[u];return ce?x1(oe,ce):oe});function B(u){n.value!==u&&(n.value=u,m1(u),j.value=Pa(I.value,u),ue=!1)}function ee(u){$.value=u.trim()}function Q(u){const p=u==="plan"?"plan":"default",_=qh(n.value);Pa(I.value,n.value)===p&&j.value===p||(j.value=p,I.value=p==="plan"?{...I.value,[_]:p}:sn(I.value,_),d1(I.value))}function Ee(u){Je.value=u}async function be(){$.value=Yn,m.value.includes(Yn)||(m.value=[...m.value,Yn]);try{await Zk(Yn)}catch{}}function Te(u,p){Pe.value={...Pe.value,[u]:p}}function Ce(u){Pe.value[u]&&(Pe.value=sn(Pe.value,u))}async function Ge(u){if(xe.has(u))return;const p=Pe.value[u];if(!(!p||p.fallbackRetried)){xe.add(u),Te(u,{...p,fallbackRetried:!0});try{await be();try{const _=await Kk(u,1);_n(u,_),fn(u),Qt(u,[]),dn(u),a.value[u]&&(a.value=sn(a.value,u))}catch{}Bt(u,null),Fe.value="",ct(u,null),$t(u,{label:"Thinking",details:dt(Yn,p.effort,p.collaborationMode)}),vt(u,!0),ge.value[u]!==!0&&await ba(u),await _a(u,p.text,p.imageUrls,Yn,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments,p.collaborationMode),ge.value={...ge.value,[u]:!0},W.add(u),Qe=!0,await At()}catch(_){const C=_ instanceof Error?_.message:"Unknown application error";Bt(u,C),Fe.value=C,vt(u,!1),$t(u,null)}finally{xe.delete(u)}}}function ot(u){u&&!rd.includes(u)||(X.value=u)}async function Ve(){try{const u=await t0();b.value=u,u.some(p=>p.value===j.value)||Q("default")}catch{}}function dt(u,p,_=j.value){const C=u.trim()||"default",Y=p||"default";return[`Mode: ${_==="plan"?"Plan":"Default"}`,`Model: ${C}`,`Thinking: ${Y}`]}async function pt(){try{const[u,p]=await Promise.all([Kf(),Jf()]);m.value=u,$.value.length>0&&u.includes($.value)||(p.model&&u.includes(p.model)?$.value=p.model:u.length>0?$.value=u[0]:$.value=""),p.reasoningEffort&&rd.includes(p.reasoningEffort)&&(X.value=p.reasoningEffort)}catch{}}function Et(u){const p=He.value;return Object.keys(p).length===0?u:u.map(_=>({projectName:_.projectName,threads:_.threads.map(C=>{const Y=p[C.id];return Y?{...C,title:Y}:C})}))}function Be(){const p=Et(t.value).map(_=>({projectName:_.projectName,threads:_.threads.map(C=>{const Y=l.value[C.id]===!0,oe=n.value===C.id,ce=ae.value[C.id],Ie=c.value[C.id]===!0,pe=!oe&&!Y&&(Ie||ce!==C.updatedAtIso);return{...C,inProgress:Y,unread:pe}})}));e.value=si(e.value,p)}function Lt(u,p,_){const C=new Date().toISOString(),Y=p.trim(),oe=N1(Y),ce={id:u,title:L1(_),projectName:oe,cwd:Y,hasWorktree:Y.includes("/.codex/worktrees/")||Y.includes("/.git/worktrees/"),createdAtIso:C,updatedAtIso:C,preview:_,unread:!1,inProgress:!1},Ie=t.value.findIndex(st=>st.projectName===oe);if(Ie>=0){const jt=t.value[Ie].threads.filter(pr=>pr.id!==u),Zt={projectName:oe,threads:[ce,...jt]},Vn=[...t.value];Vn.splice(Ie,1,Zt),t.value=Vn}else t.value=[{projectName:oe,threads:[ce]},...t.value];const pe=ni(J.value,t.value);Ss(J.value,pe)||(J.value=pe,Ns(J.value)),Be()}function Tt(u){const p=new Set(u.map(oe=>oe.id)),_=pn(ae.value,p);_!==ae.value&&(ae.value=_,sd(_));const C=pn(z.value,p);C!==z.value&&(z.value=C,od(C)),me.value=pn(me.value,p),ke.value=pn(ke.value,p),ge.value=pn(ge.value,p),r.value=pn(r.value,p),o.value=pn(o.value,p),i.value=pn(i.value,p),a.value=pn(a.value,p),je.value=pn(je.value,p),le.value=pn(le.value,p),re.value=pn(re.value,p),de.value=pn(de.value,p),c.value=pn(c.value,p),l.value=pn(l.value,p);const Y={};for(const[oe,ce]of Object.entries(te.value))(oe===Os||p.has(oe))&&(Y[oe]=ce);te.value=Y}function ft(u){const p=ns(t.value).find(_=>_.id===u);p&&(ae.value={...ae.value,[u]:p.updatedAtIso},sd(ae.value),c.value[u]&&(c.value=sn(c.value,u)),Be())}function ct(u,p){if(!u)return;const _=je.value[u];if(p){if(I1(_,p))return;je.value={...je.value,[u]:p}}else _&&(je.value=sn(je.value,u))}function vt(u,p){!u||l.value[u]===!0===p||(p?l.value={...l.value,[u]:!0}:l.value=sn(l.value,u),Be())}function Gt(u){u&&u!==n.value&&c.value[u]!==!0&&(c.value={...c.value,[u]:!0},Be())}function $t(u,p){if(!u)return;const _=le.value[u];if(!p){_&&(le.value=sn(le.value,u));return}const C=hn(p.label)||"Thinking",Y=p.details.map(Ie=>hn(Ie)).filter(Ie=>Ie.length>0&&Ie!==C),oe=Array.from(new Set([...(_==null?void 0:_.details)??[],...Y])).slice(-3),ce={label:C,details:oe};E1(_,ce)||(le.value={...le.value,[u]:ce})}function Bt(u,p){if(!u)return;const _=re.value[u],C=p?vl(p):"";if(!C){_&&(re.value=sn(re.value,u));return}(_==null?void 0:_.message)!==C&&(re.value={...re.value,[u]:{message:C}})}function On(u){const p=ns(t.value).find(_=>_.id===u);return(p==null?void 0:p.updatedAtIso)??""}function Yt(u,p){if(!u)return;const _={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(_.scrollRatio=Gh(p.scrollRatio,0,1));const C=z.value[u];C&&C.scrollTop===_.scrollTop&&C.isAtBottom===_.isAtBottom&&C.scrollRatio===_.scrollRatio||(z.value={...z.value,[u]:_},od(z.value))}function _n(u,p){const _=r.value[u]??[];To(_,p)||(r.value={...r.value,[u]:p})}function Qt(u,p){const _=o.value[u]??[];To(_,p)||(o.value={...o.value,[u]:p})}function Kt(u,p){const _=s.value[u]??[];To(_,p)||(s.value={...s.value,[u]:p})}function en(u,p){const _=s.value[u]??[],C=Oa(_,p);Kt(u,C)}function un(u,p){const _=o.value[u]??[],C=Oa(_,p);Qt(u,C)}function Bn(u,p){if(!u)return;const _=p.trim(),C=i.value[u]??"";if(_.length===0){if(!C)return;i.value=sn(i.value,u);return}C!==_&&(i.value={...i.value,[u]:_})}function kn(u,p){if(!u)return;const _=i.value[u]??"";Bn(u,`${_}${p}`)}function dn(u){u&&u in i.value&&(i.value=sn(i.value,u))}function fn(u){u&&u in s.value&&(s.value=sn(s.value,u))}function qn(u){return u==="completed"?"completed":u==="inProgress"||u==="in_progress"?"inProgress":"pending"}function Zn(u){var _;const p=[];(_=u.explanation)!=null&&_.trim()&&p.push(u.explanation.trim());for(const C of u.steps){const Y=C.status==="completed"?"x":C.status==="inProgress"?"~":" ";p.push(`- [${Y}] ${C.step}`)}return p.join(`
1436
- `).trim()}function Ut(u){if(u.method!=="turn/plan/updated")return null;const p=$e(u.params),_=zt(u),C=Re(p==null?void 0:p.turnId)||Re(p==null?void 0:p.turn_id),oe=(Array.isArray(p==null?void 0:p.plan)?p==null?void 0:p.plan:[]).map(pe=>$e(pe)).map(pe=>({step:Re(pe==null?void 0:pe.step),status:qn(pe==null?void 0:pe.status)})).filter(pe=>pe.step.length>0);if(!_||!C)return null;const Ie={explanation:Re(p==null?void 0:p.explanation).trim()||void 0,steps:oe,isStreaming:!0};return{threadId:_,message:{id:`${C}:plan`,role:"assistant",text:Zn(Ie),messageType:"plan.live",plan:Ie}}}function an(u){if(u.method!=="item/plan/delta")return null;const p=$e(u.params),_=zt(u),C=Re(p==null?void 0:p.turnId)||Re(p==null?void 0:p.turn_id),Y=Re(p==null?void 0:p.delta);if(!_||!C||!Y)return null;const oe=`${C}:plan`,ce=(s.value[_]??[]).find(st=>st.id===oe),Ie=`${(ce==null?void 0:ce.text)??""}${Y}`,pe=ce!=null&&ce.plan?{...ce.plan,isStreaming:!0}:void 0;return{threadId:_,message:{id:oe,role:"assistant",text:Ie,messageType:"plan.live",plan:pe}}}function $e(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)?u:null}function Re(u){return typeof u=="string"?u:""}function Tn(u){return typeof u=="number"&&Number.isFinite(u)?u:null}function zt(u){const p=$e(u.params);if(!p)return"";const _=Re(p.threadId);if(_)return _;const C=Re(p.thread_id);if(C)return C;const Y=Re(p.conversationId);if(Y)return Y;const oe=Re(p.conversation_id);if(oe)return oe;const ce=$e(p.thread),Ie=Re(ce==null?void 0:ce.id);if(Ie)return Ie;const pe=$e(p.turn),st=Re(pe==null?void 0:pe.threadId);if(st)return st;const jt=Re(pe==null?void 0:pe.thread_id);return jt||""}function Nn(u){if(u.method!=="turn/completed")return"";const p=$e(u.params),_=$e(p==null?void 0:p.turn);if(!_||_.status!=="failed")return"";const C=$e(_.error);return Re(C==null?void 0:C.message)}function er(u){var _;if(u.method!=="error")return"";const p=$e(u.params);return Re(p==null?void 0:p.message)||Re((_=$e(p==null?void 0:p.error))==null?void 0:_.message)}function Ln(u){const p=$e(u);if(!p)return null;const _=p.id,C=Re(p.method),Y=p.params;if(typeof _!="number"||!Number.isInteger(_)||!C)return null;const oe=$e(Y),ce=Re(oe==null?void 0:oe.threadId)||Os,Ie=Re(oe==null?void 0:oe.turnId),pe=Re(oe==null?void 0:oe.itemId),st=Re(p.receivedAtIso)||new Date().toISOString();return{id:_,method:C,threadId:ce,turnId:Ie,itemId:pe,receivedAtIso:st,params:Y??null}}function Sn(u){if(u.method!=="item/tool/requestUserInput")return[];const p=$e(u.params),_=Array.isArray(p==null?void 0:p.questions)?p.questions:[],C=[];for(const Y of _){const oe=$e(Y),ce=Re(oe==null?void 0:oe.id).trim();ce&&C.push(ce)}return C}function Gn(u){const p=u.threadId||Os,_=te.value[p]??[],C=_.findIndex(oe=>oe.id===u.id),Y=[..._];C>=0?Y.splice(C,1,u):Y.push(u),te.value={...te.value,[p]:Y.sort((oe,ce)=>oe.receivedAtIso.localeCompare(ce.receivedAtIso))}}function Dn(u){const p={};for(const[_,C]of Object.entries(te.value)){const Y=C.filter(oe=>oe.id!==u);Y.length>0&&(p[_]=Y)}te.value=p}function Un(u){const p={};for(const _ of u){const C=_.threadId||Os,Y=p[C]??[];Y.push(_),p[C]=Y}for(const _ of Object.values(p))_.sort((C,Y)=>C.receivedAtIso.localeCompare(Y.receivedAtIso));te.value=p}function Kn(u){if(u.method==="server/request"){const p=Ln(u.params);return p&&Gn(p),!0}if(u.method==="server/request/resolved"){const p=$e(u.params),_=p==null?void 0:p.id;return typeof _=="number"&&Number.isInteger(_)&&Dn(_),!0}return!1}function hn(u){return u.replace(/\s+/gu," ").trim()}function A(u){const p=zt(u);if(!p)return null;if(u.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(u.method==="item/started"){const _=$e(u.params),C=$e(_==null?void 0:_.item),Y=Re(C==null?void 0:C.type).toLowerCase();if(Y==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(Y==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(Y==="commandexecution"){const oe=Re(C==null?void 0:C.command);return{threadId:p,activity:{label:"Running command",details:oe?[oe]:[]}}}}return u.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:u.method==="item/reasoning/summaryTextDelta"||u.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:u.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function U(u){if(u.method!=="turn/started")return null;const p=$e(u.params);if(!p)return null;const _=zt(u);if(!_)return null;const C=$e(p.turn),Y=Re(C==null?void 0:C.id)||Re(p.turnId)||`${_}:unknown`;if(!Y)return null;const oe=Zr(Re(C==null?void 0:C.startedAt))??Zr(Re(p.startedAt))??Zr(u.atIso)??Date.now();return{threadId:_,turnId:Y,startedAtMs:oe}}function se(u){if(u.method!=="turn/completed")return null;const p=$e(u.params);if(!p)return null;const _=zt(u);if(!_)return null;const C=$e(p.turn),Y=Re(C==null?void 0:C.id)||Re(p.turnId)||`${_}:unknown`;if(!Y)return null;const oe=Zr(Re(C==null?void 0:C.completedAt))??Zr(Re(p.completedAt))??Zr(u.atIso)??Date.now(),ce=Zr(Re(C==null?void 0:C.startedAt))??Zr(Re(p.startedAt))??void 0;return{threadId:_,turnId:Y,completedAtMs:oe,startedAtMs:ce}}function Ne(u){return`${u}:live-reasoning`}function it(u){const p=$e(u.params);if(!p)return"";if(u.method==="item/started"){const _=$e(p.item);return!_||_.type!=="reasoning"?"":Re(_.id)}return""}function wt(u){const p=$e(u.params);if(!p)return null;if(u.method==="item/reasoning/summaryTextDelta"){const _=Re(p.itemId),C=Re(p.delta);return!_||!C?null:{messageId:Ne(_),delta:C}}return null}function mt(u){const p=$e(u.params);if(!p)return"";if(u.method==="item/reasoning/summaryPartAdded"){const _=Re(p.itemId);return _?Ne(_):""}return""}function Wt(u){const p=$e(u.params);if(!p)return"";if(u.method==="item/completed"){const _=$e(p.item);return!_||_.type!=="reasoning"?"":Ne(Re(_.id))}return""}function In(u){const p=$e(u.params);if(!p)return"";if(u.method==="item/started"){const _=$e(p.item);return!_||_.type!=="agentMessage"?"":Re(_.id)}return""}function Hn(u){const p=$e(u.params);if(!p)return null;if(u.method==="item/agentMessage/delta"){const _=Re(p.itemId),C=Re(p.delta);return!_||!C?null:{messageId:_,delta:C}}return null}function fr(u){const p=$e(u.params);if(!p)return null;if(u.method==="item/completed"){const _=$e(p.item);if(!_||_.type!=="agentMessage")return null;const C=Re(_.id),Y=Re(_.text);return!C||!Y?null:{id:C,role:"assistant",text:Y,messageType:"agentMessage.live"}}return null}function fs(u){if(u.method!=="item/started")return null;const p=$e(u.params),_=$e(p==null?void 0:p.item);if(!_||_.type!=="commandExecution")return null;const C=Re(_.id),Y=Re(_.command);if(!C)return null;const oe=typeof _.cwd=="string"?_.cwd:null;return{id:C,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:oe,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function tr(u){if(u.method!=="item/commandExecution/outputDelta")return null;const p=$e(u.params);if(!p)return null;const _=Re(p.itemId),C=Re(p.delta);return!_||!C?null:{itemId:_,delta:C}}function hr(u){if(u.method!=="item/completed")return null;const p=$e(u.params),_=$e(p==null?void 0:p.item);if(!_||_.type!=="commandExecution")return null;const C=Re(_.id),Y=Re(_.command);if(!C)return null;const oe=typeof _.cwd=="string"?_.cwd:null,ce=Re(_.status),Ie=ce==="failed"?"failed":ce==="declined"?"declined":ce==="interrupted"?"interrupted":"completed",pe=typeof _.aggregatedOutput=="string"?_.aggregatedOutput:"",st=typeof _.exitCode=="number"?_.exitCode:null;return{id:C,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:oe,status:Ie,aggregatedOutput:pe,exitCode:st}}}function Wn(u,p){const _=a.value[u]??[],C=Oa(_,p);C!==_&&(a.value={...a.value,[u]:C})}function nr(u,p){const _=a.value[u];if(!_||_.length===0)return;const C=new Set(p.map(oe=>oe.id)),Y=_.filter(oe=>!C.has(oe.id));Y.length!==_.length&&(Y.length===0?a.value=sn(a.value,u):a.value={...a.value,[u]:Y})}function Jr(u){if(u.method==="item/agentMessage/delta")return!0;const p=$e(u.params);if(!p)return!1;if(u.method==="item/completed"){const _=$e(p.item);return(_==null?void 0:_.type)==="agentMessage"}return!1}function hs(u){var ie,Ke,at,Ye,Jt;if(Kn(u))return;if(u.method==="thread/name/updated"){const et=$e(u.params),jn=Re(et==null?void 0:et.threadId),ms=Re(et==null?void 0:et.threadName);jn&&ms&&(He.value={...He.value,[jn]:ms},Be(),ka(jn,ms))}if(u.method==="account/rateLimits/updated"){Ee(Gf(u.params));return}const p=A(u);p&&$t(p.threadId,p.activity);const _=U(u);_&&(ve.set(_.turnId,_),de.value={...de.value,[_.threadId]:_.turnId},fn(_.threadId),ct(_.threadId,null),Bt(_.threadId,null),vt(_.threadId,!0),c.value[_.threadId]&&(c.value=sn(c.value,_.threadId)));const C=se(u),Y=Nn(u),ce=!!((C==null?void 0:C.threadId)??zt(u))&&!!Y&&$.value!==Yn&&ri(new Error(Y));if(C){const et=ve.get(C.turnId);et&&ve.delete(C.turnId);const jn=Tn((ie=$e(u.params))==null?void 0:ie.durationMs)??Tn((at=$e((Ke=$e(u.params))==null?void 0:Ke.turn))==null?void 0:at.durationMs)??(typeof C.startedAtMs=="number"?C.completedAtMs-C.startedAtMs:null)??(et?C.completedAtMs-et.startedAtMs:null),ms=typeof jn=="number"?Math.max(0,jn):0;ct(C.threadId,{turnId:C.turnId,durationMs:ms}),de.value[C.threadId]&&(de.value=sn(de.value,C.threadId)),vt(C.threadId,!1),$t(C.threadId,null),Gt(C.threadId),ce||(Ce(C.threadId),q(C.threadId))}if(Y){const et=(C==null?void 0:C.threadId)||zt(u);et&&Bt(et,Y),Fe.value=Y,et&&ce&&Ge(et)}else C&&Bt(C.threadId,null);const Ie=er(u);if(Ie){const et=zt(u);et&&Bt(et,Ie),Fe.value=Ie,$.value!==Yn&&ri(new Error(Ie))&&(et?Ge(et):be())}const pe=zt(u),st=Ut(u);st&&(en(st.threadId,st.message),$t(st.threadId,{label:"Planning",details:((Ye=st.message.plan)==null?void 0:Ye.steps.map(et=>et.step).slice(0,2))??[]}));const jt=an(u);if(jt&&(en(jt.threadId,jt.message),$t(jt.threadId,{label:"Planning",details:[]})),!pe||pe!==n.value)return;In(u);const Zt=Hn(u);if(Zt){const et=(o.value[pe]??[]).find(ms=>ms.id===Zt.messageId),jn=`${(et==null?void 0:et.text)??""}${Zt.delta}`;un(pe,{id:Zt.messageId,role:"assistant",text:jn,messageType:"agentMessage.live"})}const Vn=fr(u);Vn&&un(pe,Vn),it(u);const pr=wt(u);if(pr&&kn(pe,pr.delta),mt(u)){const et=i.value[pe]??"";et.trim().length>0&&!et.endsWith(`
1437
-
1438
- `)&&Bn(pe,`${et}
1439
-
1440
- `)}Wt(u);const so=fs(u);so&&(Wn(pe,so),$t(pe,{label:"Running command",details:[((Jt=so.commandExecution)==null?void 0:Jt.command)??""]}));const w=tr(u);if(w){const et=(a.value[pe]??[]).find(jn=>jn.id===w.itemId);et!=null&&et.commandExecution&&Wn(pe,{...et,commandExecution:{...et.commandExecution,aggregatedOutput:`${et.commandExecution.aggregatedOutput}${w.delta}`}})}const L=hr(u);if(L&&Wn(pe,L),Jr(u)&&(ue&&n.value&&Yt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),dn(pe)),u.method==="turn/completed"){ue=!1,dn(pe),a.value[pe]&&(a.value=sn(a.value,pe));const et=zt(u);et&&(vt(et,!1),$t(et,null),Gt(et),ce||(Ce(et),q(et)))}}function Cr(u){const p=zt(u);p&&W.add(p);const _=u.method;(_.startsWith("thread/")||_.startsWith("turn/")||_.startsWith("item/"))&&(Qe=!0),!(lt!==null||typeof window>"u")&&(lt=window.setTimeout(()=>{lt=null,At()},Ra))}async function Ar(u){if(!we){we=!0;try{const p=await fo(),_=[];for(const C of p.order){const Y=Ls(C);_.includes(Y)||_.push(Y)}if(_.length>0){const C=ni(_,u);Ss(J.value,C)||(J.value=C,Ns(J.value))}if(Object.keys(p.labels).length>0){const C={...ne.value};let Y=!1;for(const[oe,ce]of Object.entries(p.labels)){const Ie=Ls(oe);C[Ie]!==ce&&(C[Ie]=ce,Y=!0)}Y&&(ne.value=C,Ma(C))}}catch{}}}async function S(){if(!(Object.keys(He.value).length>0))try{const u=await a0();Object.keys(u.titles).length>0&&(He.value=u.titles)}catch{}}async function R(u,p,_){if(He.value[u])return;const C=p.trim();if(!C)return;const Y=C.length>300?C.slice(0,300):C;try{const oe=await l0(Y,_);if(!oe||He.value[u])return;He.value={...He.value,[u]:oe},Be(),ka(u,oe)}catch{}}async function P(){var u;Ht.value||(We.value=!0);try{const[p]=await Promise.all([Lk(),S()]);await Ar(p);const _=ni(J.value,p);Ss(J.value,_)||(J.value=_,Ns(J.value));const C=$a(p,J.value),Y=O1(t.value,C,l.value);t.value=si(t.value,Y),l.value=pn(l.value,new Set(ns(t.value).map(Ie=>Ie.id))),Be(),Ht.value=!0;const oe=ns(e.value);Tt(oe),oe.some(Ie=>Ie.id===n.value)||B(((u=oe[0])==null?void 0:u.id)??"")}finally{We.value=!1}}async function Z(u,p={}){if(!u)return;const _=me.value[u]===!0,C=p.silent!==!0&&!_;C&&(Me.value=!0);try{ge.value[u]!==!0&&(await ba(u),ge.value={...ge.value,[u]:!0});const{messages:Y,inProgress:oe}=await Dk(u),ce=r.value[u]??[],Ie=k1(ce,Y,{preserveMissing:p.silent===!0});_n(u,Ie);const pe=o.value[u]??[],st=T1(pe,Y);Qt(u,st),nr(u,Y),me.value={...me.value,[u]:!0};const jt=On(u);jt&&(ke.value={...ke.value,[u]:jt}),vt(u,oe),oe||fn(u),ft(u)}finally{C&&(Me.value=!1)}}async function Ue(u,p={}){u&&me.value[u]!==!0&&await Z(u,p)}async function Ct(){try{const u=t.value.flatMap(p=>p.threads.map(_=>_.cwd)).filter(Boolean);ze.value=await c0(u.length>0?[...new Set(u)]:void 0)}catch{}}async function Xt(){try{Ee(await Uk())}catch{}}async function En(u={}){Fe.value="";const p=u.includeSelectedThreadMessages!==!1,_=u.awaitAncillaryRefreshes===!0;try{await P();const C=Promise.allSettled([pt(),Ve(),Ct(),Xt()]).then(()=>{});p&&await Z(n.value),_&&await C}catch(C){Fe.value=C instanceof Error?C.message:"Unknown application error"}}async function f(u){B(u);try{await Z(u)}catch(p){Fe.value=p instanceof Error?p.message:"Unknown application error"}}async function g(u){try{await qk(u),await P(),n.value===u&&await Z(n.value)}catch(p){Fe.value=p instanceof Error?p.message:"Unknown application error"}}async function h(u,p){const _=p.trim();if(!(!u||!_))try{await Gk(u,_),He.value={...He.value,[u]:_},Be(),ka(u,_)}catch(C){Fe.value=C instanceof Error?C.message:"Unknown application error"}}async function x(u,p,_=[],C=[],Y=[]){if(!u||!p.trim()||_.length>0||C.length>0||Y.length>0)return!1;const ce=(te.value[u]??[]).filter(st=>st.method==="item/tool/requestUserInput");if(ce.length!==1)return!1;const[Ie]=ce,pe=Sn(Ie);return pe.length!==1?!1:Ko({id:Ie.id,result:{answers:{[pe[0]]:{answers:[p.trim()]}}}})}async function M(u,p=[],_=[],C="steer",Y=[]){const oe=n.value,ce=u.trim();if(!oe||!ce&&p.length===0&&Y.length===0||await x(oe,ce,p,_,Y))return;const Ie=l.value[oe]===!0;if(Ie&&C==="queue"){const pe=d.value[oe]??[],st=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;d.value={...d.value,[oe]:[...pe,{id:st,text:ce,imageUrls:p,skills:_,fileAttachments:Y,collaborationMode:j.value}]};return}if(Ie){ue=!0,ye(oe,ce,p,_,Y).catch(pe=>{const st=pe instanceof Error?pe.message:"Unknown application error";Bt(oe,st),Fe.value=st});return}Fe.value="",ue=!0,ct(oe,null),$t(oe,{label:"Thinking",details:dt($.value,X.value,j.value)}),Bt(oe,null),vt(oe,!0);try{await ye(oe,ce,p,_,Y)}catch(pe){ue=!1,vt(oe,!1),$t(oe,null);const st=pe instanceof Error?pe.message:"Unknown application error";throw Bt(oe,st),Fe.value=st,pe}}async function H(u,p,_=[],C=[],Y=[]){const oe=u.trim(),ce=p.trim(),Ie=$.value.trim();if(!oe&&_.length===0&&Y.length===0)return"";Ae.value=!0,Fe.value="";let pe="";try{try{pe=await _u(ce||void 0,Ie||void 0)}catch(Vn){if(Ie&&Ie!==Yn&&ri(Vn))await be(),pe=await _u(ce||void 0,Yn);else throw Vn}if(!pe)return"";Lt(pe,ce,oe||"[Image]"),ge.value={...ge.value,[pe]:!0},B(pe),ue=!0,ct(pe,null),$t(pe,{label:"Thinking",details:dt($.value,X.value,j.value)}),Bt(pe,null),vt(pe,!0);const st=pe,jt=ce||null,Zt=oe;return ye(pe,oe,_,C,Y).catch(Vn=>{ue=!1,vt(pe,!1),$t(pe,null);const pr=Vn instanceof Error?Vn.message:"Unknown application error";Bt(pe,pr),Fe.value=pr}).finally(()=>{Ae.value=!1}),R(st,Zt,jt),pe}catch(st){ue=!1,pe&&(vt(pe,!1),$t(pe,null));const jt=st instanceof Error?st.message:"Unknown application error";throw pe&&Bt(pe,jt),Fe.value=jt,Ae.value=!1,st}}async function ye(u,p,_=[],C=[],Y=[]){const oe=$.value.trim(),ce=X.value,Ie=j.value,pe=p.trim(),st=C.map(Zt=>({name:Zt.name,path:Zt.path})),jt=Y.map(Zt=>({...Zt}));Te(u,{text:pe,imageUrls:[..._],skills:st,fileAttachments:jt,effort:ce,collaborationMode:Ie,fallbackRetried:!1});try{ge.value[u]!==!0&&await ba(u);try{await _a(u,p,_,oe||void 0,ce||void 0,C.length>0?C:void 0,Y,Ie)}catch(Zt){if(oe&&oe!==Yn&&ri(Zt))await be(),Te(u,{text:pe,imageUrls:[..._],skills:st,fileAttachments:jt,effort:ce,collaborationMode:Ie,fallbackRetried:!0}),await _a(u,p,_,Yn,ce||void 0,C.length>0?C:void 0,Y,Ie);else throw Zt}ge.value={...ge.value,[u]:!0},W.add(u),Qe=!0,await At()}catch(Zt){throw Zt}}async function q(u){const p=d.value[u];if(!p||p.length===0)return;const[_,...C]=p;d.value=C.length>0?{...d.value,[u]:C}:sn(d.value,u),Ae.value=!0,Fe.value="",ue=!0,ct(u,null),$t(u,{label:"Thinking",details:dt($.value,X.value,_.collaborationMode)}),Bt(u,null),vt(u,!0);try{Q(_.collaborationMode),await ye(u,_.text,_.imageUrls,_.skills,_.fileAttachments)}catch{vt(u,!1),$t(u,null)}finally{Ae.value=!1}}async function Se(){const u=n.value;if(!u||l.value[u]!==!0)return;const p=de.value[u];qe.value=!0,Fe.value="";try{await Xk(u,p),vt(u,!1),$t(u,null),Bt(u,null),de.value[u]&&(de.value=sn(de.value,u)),W.add(u),Qe=!0,await At()}catch(_){const C=_ instanceof Error?_.message:"Failed to interrupt active turn";Bt(u,C),Fe.value=C}finally{qe.value=!1}}function Le(u,p){u.length===0||(ne.value[u]??"")===p||(ne.value={...ne.value,[u]:p},Ma(ne.value))}async function Ze(u){var oe;if(u.length===0)return;const p=J.value.filter(ce=>ce!==u);if(Ss(J.value,p)||(J.value=p,Ns(J.value)),t.value=t.value.filter(ce=>ce.projectName!==u),ne.value[u]!==void 0){const ce={...ne.value};delete ce[u],ne.value=ce,Ma(ce)}Be();const _=ns(e.value);Tt(_),_.some(ce=>ce.id===n.value)||B(((oe=_[0])==null?void 0:oe.id)??"");const Y=new Set;try{const ce=await fo();for(const Ie of ce.order)Ls(Ie)===u&&Y.add(Ie);for(const Ie of ce.active)Ls(Ie)===u&&Y.add(Ie);for(const Ie of Object.keys(ce.labels))Ls(Ie)===u&&Y.add(Ie)}catch{}if(Y.size>0)try{const ce=await fo(),Ie=ce.order.filter(jt=>!Y.has(jt)),pe=ce.active.filter(jt=>!Y.has(jt)),st=pe.length===0&&Ie.length>0?[Ie[0]]:pe;await Tu({order:Ie,labels:R1(ce.labels,Y),active:st});return}catch{}await Cn()}function Dt(u,p){if(u.length===0||t.value.length===0)return;const _=t.value.map(pe=>pe.projectName),C=_.indexOf(u);if(C===-1)return;const Y=Math.max(0,Math.min(p,_.length-1)),oe=y1(_,C,Y);if(oe===_)return;const ce=ni(oe,t.value);J.value=ce,Ns(J.value);const Ie=$a(t.value,J.value);t.value=si(t.value,Ie),Be(),Cn()}function bt(u){const p=u.trim();if(!p)return;const _=[p,...J.value.filter(Y=>Y!==p)];if(Ss(J.value,_))return;J.value=_,Ns(J.value);const C=$a(t.value,J.value);t.value=si(t.value,C),Be(),Cn()}async function Cn(){var u,p;try{const _=await fo(),C=new Map;for(const ce of _.order){const Ie=Ls(ce);C.has(Ie)||C.set(Ie,ce)}for(const ce of t.value){const Ie=((p=(u=ce.threads[0])==null?void 0:u.cwd)==null?void 0:p.trim())??"";Ie&&C.set(ce.projectName,Ie)}const Y=[];for(const ce of J.value){const Ie=C.get(ce);Ie&&!Y.includes(Ie)&&Y.push(Ie)}for(const ce of _.order)Y.includes(ce)||Y.push(ce);const oe=_.active.filter(ce=>Y.includes(ce));oe.length===0&&Y.length>0&&oe.push(Y[0]),await Tu({order:Y,labels:_.labels,active:oe})}catch{}}async function At(){if(gt.value){typeof window<"u"&&lt===null&&(lt=window.setTimeout(()=>{lt=null,At()},Ra));return}gt.value=!0;const u=Qe,p=new Set(W);Qe=!1,W.clear();try{u&&await P();const _=n.value;if(!_)return;const C=p.has(_),Y=l.value[_]===!0,oe=On(_),ce=ke.value[_]??"",Ie=oe.length>0&&oe!==ce;(C||Y||Ie||u)&&await Z(_,{silent:!0})}catch{}finally{gt.value=!1,(Qe||W.size>0)&&typeof window<"u"&&lt===null&&(lt=window.setTimeout(()=>{lt=null,At()},Ra))}}async function rr(){await Go(),Qe=!0,n.value&&W.add(n.value),await At()}function ps(){typeof window>"u"||ut||(Go(),ut=jk(u=>{if(u.method==="ready"){rr();return}hs(u),Cr(u)}))}async function Go(){try{const p=(await Bk()).map(_=>Ln(_)).filter(_=>_!==null);Un(p)}catch{}}async function Ko(u){try{return await Fk(u.id,{result:u.result,error:u.error}),Dn(u.id),!0}catch(p){return Fe.value=p instanceof Error?p.message:"Failed to reply to server request",!1}}function Ji(){ut&&(ut(),ut=null),Qe=!1,W.clear(),ve.clear(),lt!==null&&typeof window<"u"&&(window.clearTimeout(lt),lt=null),ue=!1,r.value={},s.value={},o.value={},i.value={},a.value={},le.value={},je.value={},re.value={},de.value={},d.value={},Je.value=null}const Yi=fe(()=>{const u=n.value;return u?d.value[u]??[]:[]});function ro(u){const p=n.value;if(!p)return;const _=d.value[p];if(!_)return;const C=_.filter(Y=>Y.id!==u);d.value=C.length>0?{...d.value,[p]:C}:sn(d.value,p)}function Qi(u){const p=n.value;if(!p)return;const _=d.value[p];if(!_)return;const C=_.find(Y=>Y.id===u);C&&(ro(u),Q(C.collaborationMode),M(C.text,C.imageUrls,C.skills,"steer",C.fileAttachments))}function Xi(u){B(u)}return{projectGroups:e,projectDisplayNameById:ne,selectedThread:E,selectedThreadScrollState:O,selectedThreadServerRequests:V,selectedLiveOverlay:G,codexQuota:N,selectedThreadId:n,availableCollaborationModes:b,availableModelIds:m,selectedCollaborationMode:j,selectedModelId:$,selectedReasoningEffort:X,installedSkills:ze,messages:F,isLoadingThreads:We,isLoadingMessages:Me,isSendingMessage:Ae,isInterruptingTurn:qe,error:Fe,refreshAll:En,refreshSkills:Ct,selectThread:f,loadMessages:Z,ensureThreadMessagesLoaded:Ue,setThreadScrollState:Yt,archiveThreadById:g,renameThreadById:h,sendMessageToSelectedThread:M,sendMessageToNewThread:H,interruptSelectedThreadTurn:Se,selectedThreadQueuedMessages:Yi,removeQueuedMessage:ro,steerQueuedMessage:Qi,setSelectedCollaborationMode:Q,setSelectedModelId:ee,setSelectedReasoningEffort:ot,respondToPendingServerRequest:Ko,renameProject:Le,removeProject:Ze,reorderProject:Dt,pinProjectToTop:bt,startPolling:ps,stopPolling:Ji,primeSelectedThread:Xi}}const j1={class:"sidebar-root"},F1={class:"sidebar-scrollable"},B1=["aria-pressed"],U1={key:1,class:"sidebar-search-bar"},H1={key:0,class:"sidebar-settings-area"},W1={key:0,class:"sidebar-settings-panel"},V1={class:"sidebar-settings-account-section"},z1={class:"sidebar-settings-account-header"},q1={class:"sidebar-settings-account-header-main"},G1={class:"sidebar-settings-account-count"},K1=["disabled"],J1={key:0,class:"sidebar-settings-account-error"},Y1={key:1,class:"sidebar-settings-account-empty"},Q1={key:2,class:"sidebar-settings-account-list"},X1=["title","onMouseenter","onMouseleave"],Z1={class:"sidebar-settings-account-main"},ex={class:"sidebar-settings-account-email"},tx={class:"sidebar-settings-account-meta"},nx={class:"sidebar-settings-account-quota"},rx={class:"sidebar-settings-account-id"},sx={class:"sidebar-settings-account-actions"},ox=["disabled","onClick"],ix=["disabled","onClick"],ax={class:"sidebar-settings-value"},lx={class:"sidebar-settings-value"},cx={class:"content-root"},ux={class:"content-body"},dx={key:1,class:"content-grid"},fx={class:"new-thread-empty"},hx={class:"worktree-init-status-title"},px={class:"worktree-init-status-message"},mx={key:2,class:"content-grid"},gx={class:"content-thread"},vx={class:"composer-with-queue"},yx={class:"build-badge","aria-label":"Author name, worktree name, and version"},id="codex-web-local.sidebar-collapsed.v1",Na="codex-web-local.last-active-thread-route.v1",ad="codex-web-local.send-with-enter.v1",ld="codex-web-local.in-progress-send-mode.v1",cd="codex-web-local.dark-mode.v1",ud="codex-web-local.dictation-click-to-toggle.v1",wx=400,bx=on({__name:"App",setup(e){const t="codexui",n="1.0.4",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:d,selectedThreadId:c,availableCollaborationModes:m,availableModelIds:b,selectedCollaborationMode:I,selectedModelId:j,selectedReasoningEffort:$,installedSkills:X,messages:ae,isLoadingThreads:z,isLoadingMessages:J,isSendingMessage:ne,isInterruptingTurn:ke,refreshAll:me,refreshSkills:ge,selectThread:je,ensureThreadMessagesLoaded:le,setThreadScrollState:re,archiveThreadById:de,renameThreadById:te,sendMessageToSelectedThread:Pe,sendMessageToNewThread:Je,interruptSelectedThreadTurn:He,selectedThreadQueuedMessages:ze,removeQueuedMessage:We,steerQueuedMessage:Me,setSelectedCollaborationMode:Ae,setSelectedModelId:qe,setSelectedReasoningEffort:Fe,respondToPendingServerRequest:gt,renameProject:Ht,removeProject:ut,reorderProject:lt,pinProjectToTop:Qe,startPolling:W,stopPolling:we,primeSelectedThread:ue}=D1(),ve=Pv(),xe=Rv(),{isMobile:T}=Bf(),E=D(!1),O=D(!1),V=D(""),G=D("local"),N=D({order:[],labels:{}}),F=D({phase:"idle",title:"",message:""}),B=D(oe()),ee=D(""),Q=D(!1),Ee=D(null),be=D(null);let Te=null;const Ce=D("New Project (1)"),Ge=D(""),ot=D(!1),Ve=D([]),dt=D(!1),pt=D(!1),Et=D(""),Be=D(""),Lt=D(""),Tt=D(""),ft=D(ro(ad,!0)),ct=D(Xi()),vt=D(Qi()),Gt=D(ro(ud,!1)),$t=D(null),Bt=D(!1),On=D(!1);let Yt=null,_n=!1;const Qt=fe(()=>{const w=ve.params.threadId;return typeof w=="string"?w:""}),Kt=fe(()=>{const w=new Set;for(const L of r.value)for(const ie of L.threads)w.add(ie.id);return w}),en=fe(()=>ve.name==="home"),un=fe(()=>ve.name==="skills"),Bn=fe(()=>{var w;return un.value?"Skills":en.value?"New thread":((w=o.value)==null?void 0:w.title)??"Choose a thread"}),kn=fe(()=>ae.value.filter(w=>{const L=Ie(w.messageType,w.role);return L==="worked"?!0:!(L==="turnActivity.live"||L==="turnError.live"||L==="agentReasoning.live")})),dn=fe(()=>l.value),fn=fe(()=>en.value?"__new-thread__":c.value),qn=fe(()=>{var w,L;return en.value?V.value.trim():((L=(w=o.value)==null?void 0:w.cwd)==null?void 0:L.trim())??""}),Zn=fe(()=>{var w;return!en.value&&((w=o.value)==null?void 0:w.inProgress)===!0}),Ut=fe(()=>ne.value||ke.value||Zn.value||a.value.length>0),an=fe(()=>{var Ke,at;const w=[],L=new Set;for(const Ye of N.value.order){const Jt=Ye.trim();!Jt||L.has(Jt)||(L.add(Jt),w.push({value:Jt,label:N.value.labels[Jt]||bt(Jt)}))}for(const Ye of r.value){const Jt=((at=(Ke=Ye.threads[0])==null?void 0:Ke.cwd)==null?void 0:at.trim())??"";!Jt||L.has(Jt)||(L.add(Jt),w.push({value:Jt,label:s.value[Ye.projectName]??Ye.projectName}))}const ie=V.value.trim();return ie&&!L.has(ie)&&w.unshift({value:ie,label:bt(ie)}),w}),$e=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Gr(()=>{window.addEventListener("keydown",Z),document.addEventListener("visibilitychange",Ue),window.addEventListener("pageshow",Ct),window.addEventListener("focus",Xt),Y(),$e==null||$e.addEventListener("change",Y),st(),M(),Le(),Ze(),q()}),Fi(()=>{window.removeEventListener("keydown",Z),document.removeEventListener("visibilitychange",Ue),window.removeEventListener("pageshow",Ct),window.removeEventListener("focus",Xt),$e==null||$e.removeEventListener("change",Y),Yt!==null&&(window.clearInterval(Yt),Yt=null),Te&&(clearTimeout(Te),Te=null),we()}),ht(ee,w=>{const L=w.trim();if(Te&&(clearTimeout(Te),Te=null),!L){be.value=null;return}Te=setTimeout(()=>{i0(L,1e3).then(ie=>{ee.value.trim()===L&&(be.value=ie.threadIds)}).catch(()=>{ee.value.trim()===L&&(be.value=null)})},220)}),ht(Ve,()=>{if(typeof window>"u")return;if(!Ve.value.some(L=>L.quotaStatus==="loading")){Yt!==null&&(window.clearInterval(Yt),Yt=null);return}Yt===null&&(Yt=window.setInterval(()=>{_n||(_n=!0,In({silent:!0}).finally(()=>{_n=!1}))},1500))},{deep:!0});function Re(){ge()}function Tn(){Q.value=!Q.value,Q.value?nn(()=>{var w;return(w=Ee.value)==null?void 0:w.focus()}):ee.value=""}function zt(){var w;ee.value="",(w=Ee.value)==null||w.focus()}function Nn(w){w.key==="Escape"&&(Q.value=!1,ee.value="")}function er(w){w&&(ve.name==="thread"&&Qt.value===w||(xe.push({name:"thread",params:{threadId:w}}),T.value&&P(!0)))}async function Ln(w){w&&(c.value!==w&&(await je(w),await xe.push({name:"thread",params:{threadId:w}})),await nn(),Go())}function Sn(w){return w.length>8?w.slice(-8):w}function Gn(w){const L=[w.planType||"unknown"];return w.authMode&&L.unshift(w.authMode),L.join(" · ")}function Dn(w){if(!w)return!1;const L=w.toLowerCase();return L.includes("payment required")||/\b402\b/.test(L)}function Un(w){return w.unavailableReason==="payment_required"||Dn(w.quotaError)}function Kn(w){return dt.value||pt.value||Et.value.length>0||w.isActive&&Et.value!==w.accountId&&Ut.value}function hn(w){return Be.value===w.accountId}function A(w){return Lt.value===w.accountId||hn(w)}function U(w){return Un(w)?"Unavailable":w.isActive?"Active":pt.value?"Switching…":"Switch"}function se(w){return Et.value===w.accountId?"Removing…":hn(w)?"Click again to remove":"Remove"}function Ne(w){Lt.value=w}function it(w){Lt.value===w&&(Lt.value=""),Et.value!==w&&Be.value===w&&(Be.value="")}function wt(w){const L=w.quotaSnapshot;if(!L)return null;const ie=[L==null?void 0:L.primary,L==null?void 0:L.secondary].filter(Ye=>Ye!==null),Ke=ie.find(Ye=>Ye.windowMinutes===10080);if(Ke)return Ke;const at=ie.filter(Ye=>typeof Ye.windowMinutes=="number"&&Ye.windowMinutes>=10080).sort((Ye,Jt)=>(Ye.windowMinutes??0)-(Jt.windowMinutes??0))[0]??null;return at||(L.secondary??null)}function mt(w){var Ke,at;if(Un(w))return w.quotaError||"402 Payment Required";const L=w.quotaSnapshot,ie=wt(w);return ie?`${Math.max(0,Math.min(100,100-Math.round(ie.usedPercent)))}% weekly remaining`:(Ke=L==null?void 0:L.credits)!=null&&Ke.unlimited?"Unlimited credits":(at=L==null?void 0:L.credits)!=null&&at.hasCredits&&L.credits.balance?`${L.credits.balance} credits`:w.quotaStatus==="loading"?"Loading quota…":w.quotaStatus==="error"?w.quotaError||"Quota unavailable":"Fetching account details…"}function Wt(w){return[w.email||"Account",Gn(w),Un(w)?"Unavailable account":null,mt(w),`Workspace ${w.accountId}`].filter(Boolean).join(`
1441
- `)}async function In(w={}){try{const L=await Hk();Ve.value=L.accounts,L.accounts.some(ie=>ie.accountId===Lt.value)||(Lt.value=""),L.accounts.some(ie=>ie.accountId===Be.value)||(Be.value="")}catch(L){if(w.silent===!0)return;Tt.value=L instanceof Error?L.message:"Failed to load accounts"}}async function Hn(){if(!(dt.value||pt.value)){Tt.value="",Lt.value="",Be.value="",dt.value=!0;try{const w=await Wk();Ve.value=w.accounts,we(),W(),me({includeSelectedThreadMessages:!0})}catch(w){Tt.value=w instanceof Error?w.message:"Failed to refresh accounts"}finally{dt.value=!1}}}async function fr(w){if(!(pt.value||dt.value)){if(Ut.value){Tt.value="Finish the current turn and pending requests before switching accounts.";return}Tt.value="",Lt.value="",Be.value="",pt.value=!0;try{const L=await Vk(w);Ve.value=Ve.value.map(ie=>ie.accountId===w?L:{...ie,isActive:!1}),we(),W(),me({includeSelectedThreadMessages:!0}),In({silent:!0})}catch(L){Tt.value=L instanceof Error?L.message:"Failed to switch account"}finally{pt.value=!1}}}async function fs(w){if(dt.value||pt.value||Et.value.length>0)return;const L=Ve.value.find(Ke=>Ke.accountId===w)??null;if(!L)return;if(Be.value!==w){Be.value=w;return}if(L.isActive&&Ut.value){Tt.value="Finish the current turn and pending requests before removing the active account.";return}const ie=L.isActive;Tt.value="",Be.value="",Et.value=w;try{const Ke=await zk(w);Ve.value=Ke.accounts,we(),W(),ie&&me({includeSelectedThreadMessages:!0}),In({silent:!0})}catch(Ke){Tt.value=Ke instanceof Error?Ke.message:"Failed to remove account"}finally{Et.value=""}}function tr(w){de(w)}function hr(w){var Ke,at;const L=r.value.find(Ye=>Ye.projectName===w),ie=((at=(Ke=L==null?void 0:L.threads[0])==null?void 0:Ke.cwd)==null?void 0:at.trim())??"";ie&&(V.value=ie),T.value&&P(!0),!en.value&&xe.push({name:"home"})}function Wn(w){var Ke,at;const L=r.value.find(Ye=>Ye.projectName===w),ie=((at=(Ke=L==null?void 0:L.threads[0])==null?void 0:Ke.cwd)==null?void 0:at.trim())??"";!ie||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(ie)}`,"_blank","noopener,noreferrer")}function nr(){var L,ie;const w=((ie=(L=o.value)==null?void 0:L.cwd)==null?void 0:ie.trim())??"";w&&(V.value=w),T.value&&P(!0),!en.value&&xe.push({name:"home"})}function Jr(w){Ht(w.projectName,w.displayName)}function hs(w){te(w.threadId,w.title)}async function Cr(w){await ut(w),await Ze(),q()}function Ar(w){lt(w.projectName,w.toIndex)}function S(w){re(w.threadId,w.state)}function R(w){gt(w)}function P(w){B.value!==w&&(B.value=w,ce(w))}function Z(w){w.defaultPrevented||!w.ctrlKey&&!w.metaKey||w.shiftKey||w.altKey||w.key.toLowerCase()==="b"&&(w.preventDefault(),P(!B.value))}function Ue(){if(!(typeof document>"u")&&T.value){if(document.visibilityState==="hidden"){$t.value=Date.now(),Bt.value=!1;return}En()}}function Ct(w){w.persisted&&En()}function Xt(){En()}function En(){typeof window>"u"||typeof document>"u"||!T.value||document.visibilityState!=="visible"||Bt.value||$t.value===null||Date.now()-$t.value<wx||(Bt.value=!0,$t.value=null,f())}async function f(){if(!On.value){On.value=!0;try{await me({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await pr(),await Jo()}finally{On.value=!1}}}function g(w){const L=w.text;if(en.value){so(L,w.imageUrls,w.skills,w.fileAttachments);return}Pe(L,w.imageUrls,w.skills,w.mode,w.fileAttachments)}function h(w){V.value=w.trim()}async function x(w){const L=w.trim();if(!L)return;const ie=ye(L),Ke=await H(),at=ie?L:Cn(Ke,L);if(at)try{const Ye=await Su(at,{createIfMissing:!ie,label:ie?"":L});Ye&&(V.value=Ye,Qe(bt(Ye)),Ze(),q())}catch{}}async function M(){var L;if(typeof window>"u")return;const w=((L=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:L.trim())??"";if(w)try{const ie=await Su(w,{createIfMissing:!1,label:""});if(!ie)return;V.value=ie,Qe(bt(ie)),await xe.replace({name:"home"}),await Ze();const Ke=new URL(window.location.href);Ke.searchParams.delete("openProjectPath"),window.history.replaceState({},"",Ke.toString())}catch{}}async function H(){const w=Se();if(w)return w;try{const L=await ku();if(L)return Ge.value=L,L}catch{}return""}function ye(w){return w?w.startsWith("~/")||w.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(w):!1}async function q(){const w=Se();if(!w){Ce.value="New Project (1)";return}try{const L=await s0(w);Ce.value=L.name||"New Project (1)"}catch{Ce.value="New Project (1)"}}function Se(){var ie,Ke;const w=V.value.trim();if(w)return Dt(w);const L=((Ke=(ie=an.value[0])==null?void 0:ie.value)==null?void 0:Ke.trim())??"";return L?Dt(L):Ge.value.trim()}async function Le(){try{Ge.value=await ku()}catch{Ge.value=""}}async function Ze(){try{const w=await fo();N.value={order:[...w.order],labels:{...w.labels}}}catch{N.value={order:[],labels:{}}}}function Dt(w){const L=w.trim().replace(/\/+$/,"");if(!L)return"";const ie=L.lastIndexOf("/");return ie<=0?"":L.slice(0,ie)}function bt(w){const L=w.trim().replace(/\/+$/,"");if(!L)return"";const ie=L.lastIndexOf("/");return ie<0?L:L.slice(ie+1)}function Cn(w,L){const ie=w.trim().replace(/\/+$/,""),Ke=L.trim().replace(/^\/+/,"");return!ie||!Ke?"":`${ie}/${Ke}`}function At(w){qe(w)}function rr(w){Fe(w)}function ps(){He()}function Go(){if(en.value||un.value||typeof document>"u"||!o.value||kn.value.length===0)return;const w=Ko(),L=Ji(),ie=new Blob([w],{type:"text/markdown;charset=utf-8"}),Ke=URL.createObjectURL(ie),at=document.createElement("a");at.href=Ke,at.download=L,document.body.appendChild(at),at.click(),document.body.removeChild(at),window.setTimeout(()=>URL.revokeObjectURL(Ke),0)}function Ko(){var ie,Ke,at;const w=[],L=((Ke=(ie=o.value)==null?void 0:ie.title)==null?void 0:Ke.trim())||"Untitled thread";w.push(`# ${Yi(L)}`),w.push(""),w.push(`- Exported: ${new Date().toISOString()}`),w.push(`- Thread ID: ${((at=o.value)==null?void 0:at.id)??""}`),w.push(""),w.push("---"),w.push("");for(const Ye of kn.value){const Jt=Ye.role?Ye.role.toUpperCase():"MESSAGE";w.push(`## ${Jt}`),w.push("");const et=Ye.text.trim();if(et&&(w.push(et),w.push("")),Ye.commandExecution&&(w.push("```text"),w.push(`command: ${Ye.commandExecution.command}`),w.push(`status: ${Ye.commandExecution.status}`),Ye.commandExecution.cwd&&w.push(`cwd: ${Ye.commandExecution.cwd}`),Ye.commandExecution.exitCode!==null&&w.push(`exitCode: ${Ye.commandExecution.exitCode}`),w.push(Ye.commandExecution.aggregatedOutput||"(no output)"),w.push("```"),w.push("")),Ye.fileAttachments&&Ye.fileAttachments.length>0){w.push("Attachments:");for(const jn of Ye.fileAttachments)w.push(`- ${jn.path}`);w.push("")}if(Ye.images&&Ye.images.length>0){w.push("Images:");for(const jn of Ye.images)w.push(`- ${jn}`);w.push("")}}return`${w.join(`
1442
- `).trimEnd()}
1443
- `}function Ji(){var at,Ye;const ie=(((Ye=(at=o.value)==null?void 0:at.title)==null?void 0:Ye.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",Ke=new Date().toISOString().replace(/[:.]/g,"-");return`${ie}-${Ke}.md`}function Yi(w){return w.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function ro(w,L){if(typeof window>"u")return L;const ie=window.localStorage.getItem(w);return ie===null?L:ie==="1"}function Qi(){if(typeof window>"u")return"system";const w=window.localStorage.getItem(cd);return w==="light"||w==="dark"?w:"system"}function Xi(){return typeof window>"u"?"queue":window.localStorage.getItem(ld)==="steer"?"steer":"queue"}function u(){ft.value=!ft.value,window.localStorage.setItem(ad,ft.value?"1":"0")}function p(){ct.value=ct.value==="steer"?"queue":"steer",window.localStorage.setItem(ld,ct.value)}function _(){const w=["system","light","dark"],L=w.indexOf(vt.value);vt.value=w[(L+1)%w.length],window.localStorage.setItem(cd,vt.value),Y()}function C(){Gt.value=!Gt.value,window.localStorage.setItem(ud,Gt.value?"1":"0")}function Y(){const w=document.documentElement;if(vt.value==="dark")w.classList.add("dark");else if(vt.value==="light")w.classList.remove("dark");else{const L=window.matchMedia("(prefers-color-scheme: dark)").matches;w.classList.toggle("dark",L)}}function oe(){return typeof window>"u"?!1:window.localStorage.getItem(id)==="1"}function ce(w){typeof window>"u"||window.localStorage.setItem(id,w?"1":"0")}function Ie(w,L){const ie=(w??"").trim();return ie.length>0?ie:L.trim()||"message"}function pe(w){Ae(w)}async function st(){await xe.isReady(),ve.name==="thread"&&Qt.value&&ue(Qt.value),W(),await me({includeSelectedThreadMessages:!0}),In({silent:!0}),await pr(),O.value=!0,await Jo()}function jt(){if(typeof window>"u")return null;try{const w=window.localStorage.getItem(Na);if(!w)return null;const L=JSON.parse(w);return!L||L.routeName!=="thread"||typeof L.threadId!="string"||L.threadId.trim().length===0||typeof L.updatedAtIso!="string"||L.updatedAtIso.trim().length===0?null:{routeName:"thread",threadId:L.threadId.trim(),updatedAtIso:L.updatedAtIso}}catch{return null}}function Zt(w){if(typeof window>"u")return;const L=w.trim();if(!L)return;const ie={routeName:"thread",threadId:L,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(Na,JSON.stringify(ie))}function Vn(){typeof window>"u"||window.localStorage.removeItem(Na)}async function pr(){if(ve.name!=="home")return!1;const w=jt(),L=c.value.trim(),ie=(w==null?void 0:w.threadId)??L;return ie?Kt.value.has(ie)?(await xe.replace({name:"thread",params:{threadId:ie}}),!0):((w==null?void 0:w.threadId)===ie&&Vn(),!1):!1}async function Jo(){if(!E.value){E.value=!0;try{if(ve.name==="home"||ve.name==="skills"){c.value!==""&&await je("");return}if(ve.name==="thread"){const w=Qt.value;if(!w)return;if(!Kt.value.has(w)){await xe.replace({name:"home"});return}c.value!==w?await je(w):le(w,{silent:!0});return}}finally{E.value=!1}}}ht(()=>[ve.name,Qt.value,c.value,O.value],([w,L,ie,Ke])=>{if(!Ke||w!=="thread")return;const at=(L||ie).trim();at&&Kt.value.has(at)&&Zt(at)}),ht(()=>[ve.name,Qt.value,z.value,Kt.value.has(Qt.value),c.value],async()=>{O.value&&await Jo()}),ht(()=>c.value,async w=>{if(O.value&&!E.value&&!(en.value||un.value)){if(!w){ve.name!=="home"&&await xe.replace({name:"home"});return}ve.name==="thread"&&Qt.value===w||await xe.replace({name:"thread",params:{threadId:w}})}}),ht(()=>[O.value,ve.name,c.value],([w,L,ie])=>{w&&L==="thread"&&ie&&le(ie,{silent:!0})}),ht(()=>an.value,w=>{if(w.length===0){V.value="";return}w.some(ie=>ie.value===V.value)||(V.value=w[0].value),q()},{immediate:!0}),ht(()=>V.value,()=>{F.value={phase:"idle",title:"",message:""},q()}),ht(()=>G.value,w=>{w==="local"&&(F.value={phase:"idle",title:"",message:""})}),ht(()=>ve.name,w=>{w!=="home"&&(F.value={phase:"idle",title:"",message:""})}),ht(()=>c.value,()=>{F.value={phase:"idle",title:"",message:""}}),ht(T,w=>{w&&!B.value&&P(!0)});async function so(w,L=[],ie=[],Ke=[]){try{F.value={phase:"idle",title:"",message:""};let at=V.value;if(G.value==="worktree"){F.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Jt=await r0(V.value);at=Jt.cwd,V.value=Jt.cwd,F.value={phase:"idle",title:"",message:""}}catch{F.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Ye=await Je(w,at,L,ie,Ke);if(!Ye)return;await xe.replace({name:"thread",params:{threadId:Ye}})}catch{}}return(w,L)=>(y(),k(Oe,null,[De(Dv,{"is-sidebar-collapsed":B.value,onCloseSidebar:L[6]||(L[6]=ie=>P(!0))},{sidebar:xt(()=>[v("section",j1,[v("div",F1,[B.value?he("",!0):(y(),_t(nd,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":B.value,"show-new-thread-button":!0,onToggleSidebar:L[0]||(L[0]=ie=>P(!B.value)),onStartNewThread:nr},{default:xt(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Q.value,"aria-label":"Search threads",title:"Search threads",onClick:Tn},[De(sl,{class:"sidebar-search-toggle-icon"})],8,B1)]),_:1},8,["is-sidebar-collapsed"])),!B.value&&Q.value?(y(),k("div",U1,[De(sl,{class:"sidebar-search-bar-icon"}),Hr(v("input",{ref_key:"sidebarSearchInputRef",ref:Ee,"onUpdate:modelValue":L[1]||(L[1]=ie=>ee.value=ie),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:Nn},null,544),[[Wr,ee.value]]),ee.value.length>0?(y(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:zt},[De(Ul,{class:"sidebar-search-clear-icon"})])):he("",!0)])):he("",!0),B.value?he("",!0):(y(),k("button",{key:2,class:nt(["sidebar-skills-link",{"is-active":un.value}]),type:"button",onClick:L[2]||(L[2]=ie=>{_e(xe).push({name:"skills"}),_e(T)&&P(!0)})}," Skills Hub ",2)),B.value?he("",!0):(y(),_t(kw,{key:3,groups:_e(r),"project-display-name-by-id":_e(s),"selected-thread-id":_e(c),"is-loading":_e(z),"search-query":ee.value,"search-matched-thread-ids":be.value,onSelect:er,onArchive:tr,onStartNewThread:hr,onRenameProject:Jr,onBrowseProjectFiles:Wn,onRenameThread:hs,onRemoveProject:Cr,onReorderProject:Ar,onExportThread:Ln},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),B.value?he("",!0):(y(),k("div",H1,[De(Cf,{name:"settings-panel"},{default:xt(()=>[ot.value?(y(),k("div",W1,[v("div",V1,[v("div",z1,[v("div",q1,[L[7]||(L[7]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",G1,K(Ve.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:dt.value||pt.value,onClick:Hn},K(dt.value?"Reloading…":"Reload"),9,K1)]),Tt.value?(y(),k("p",J1,K(Tt.value),1)):he("",!0),Ve.value.length===0?(y(),k("p",Y1," Run `codex login`, then click reload. ")):(y(),k("div",Q1,[(y(!0),k(Oe,null,yt(Ve.value,ie=>(y(),k("article",{key:ie.accountId,class:nt(["sidebar-settings-account-item",{"is-active":ie.isActive,"is-unavailable":Un(ie),"is-confirming-remove":hn(ie),"is-remove-visible":A(ie)}]),title:Wt(ie),onMouseenter:Ke=>Ne(ie.accountId),onMouseleave:Ke=>it(ie.accountId)},[v("div",Z1,[v("p",ex,K(ie.email||"Account"),1),v("p",tx,K(Gn(ie)),1),v("p",nx,K(mt(ie)),1),v("p",rx," Workspace "+K(Sn(ie.accountId)),1)]),v("div",sx,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:Kn(ie)||ie.isActive||Un(ie),onClick:Ke=>fr(ie.accountId)},K(U(ie)),9,ox),v("button",{class:nt(["sidebar-settings-account-remove",{"is-visible":A(ie),"is-confirming":hn(ie)}]),type:"button",disabled:Kn(ie),onClick:Ke=>fs(ie.accountId)},K(se(ie)),11,ix)])],42,X1))),128))]))]),v("button",{class:"sidebar-settings-row",type:"button",onClick:u},[L[8]||(L[8]=v("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),v("span",{class:nt(["sidebar-settings-toggle",{"is-on":!ft.value}])},null,2)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:p},[L[9]||(L[9]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",ax,K(ct.value==="steer"?"Steer":"Queue"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:_},[L[10]||(L[10]=v("span",{class:"sidebar-settings-label"},"Appearance",-1)),v("span",lx,K(vt.value==="system"?"System":vt.value==="dark"?"Dark":"Light"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:C},[L[11]||(L[11]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:nt(["sidebar-settings-toggle",{"is-on":Gt.value}])},null,2)])])):he("",!0)]),_:1}),v("button",{class:"sidebar-settings-button",type:"button",onClick:L[3]||(L[3]=ie=>ot.value=!ot.value)},[De(l1,{class:"sidebar-settings-icon"}),L[12]||(L[12]=v("span",null,"Settings",-1))])]))])]),content:xt(()=>[v("section",cx,[De(Aw,{title:Bn.value},{leading:xt(()=>[B.value||_e(T)?(y(),_t(nd,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":B.value,"show-new-thread-button":!0,onToggleSidebar:L[4]||(L[4]=ie=>P(!B.value)),onStartNewThread:nr},null,8,["is-sidebar-collapsed"])):he("",!0)]),_:1},8,["title"]),v("section",ux,[un.value?(y(),_t(GA,{key:0,onSkillsChanged:Re})):en.value?(y(),k("div",dx,[v("div",fx,[L[13]||(L[13]=v("p",{class:"new-thread-hero"},"Let's build",-1)),De(rl,{class:"new-thread-folder-dropdown","model-value":V.value,options:an.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":Ce.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":h,onAdd:x},null,8,["model-value","options","default-add-value"]),De(ZT,{class:"new-thread-runtime-dropdown",modelValue:G.value,"onUpdate:modelValue":L[5]||(L[5]=ie=>G.value=ie)},null,8,["modelValue"]),F.value.phase!=="idle"?(y(),k("div",{key:0,class:nt(["worktree-init-status",{"is-running":F.value.phase==="running","is-error":F.value.phase==="error"}])},[v("strong",hx,K(F.value.title),1),v("span",px,K(F.value.message),1)],2)):he("",!0)]),De(Cu,{"active-thread-id":fn.value,cwd:qn.value,"collaboration-modes":_e(m),"selected-collaboration-mode":_e(I),models:_e(b),"selected-model":_e(j),"selected-reasoning-effort":_e($),skills:_e(X),"codex-quota":_e(d),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":ft.value,"in-progress-submit-mode":ct.value,"dictation-click-to-toggle":Gt.value,onSubmit:g,"onUpdate:selectedCollaborationMode":pe,"onUpdate:selectedModel":At,"onUpdate:selectedReasoningEffort":rr},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])):(y(),k("div",mx,[v("div",gx,[De(ok,{messages:kn.value,"is-loading":_e(J),"active-thread-id":fn.value,cwd:qn.value,"scroll-state":_e(i),"live-overlay":dn.value,"pending-requests":_e(a),onUpdateScrollState:S,onRespondServerRequest:R},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",vx,[De(zT,{messages:_e(ze),onSteer:_e(Me),onDelete:_e(We)},null,8,["messages","onSteer","onDelete"]),De(Cu,{"active-thread-id":fn.value,cwd:qn.value,"collaboration-modes":_e(m),"selected-collaboration-mode":_e(I),models:_e(b),"selected-model":_e(j),"selected-reasoning-effort":_e($),skills:_e(X),"codex-quota":_e(d),"is-turn-in-progress":Zn.value,"is-interrupting-turn":_e(ke),"has-queue-above":_e(ze).length>0,"send-with-enter":ft.value,"in-progress-submit-mode":ct.value,"dictation-click-to-toggle":Gt.value,"onUpdate:selectedCollaborationMode":pe,onSubmit:g,"onUpdate:selectedModel":At,"onUpdate:selectedReasoningEffort":rr,onInterrupt:ps},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),v("div",yx," nervmor "+K(_e(t))+" · v"+K(_e(n)),1)],64))}}),_x=kt(bx,[["__scopeId","data-v-53c48853"]]),La={render:()=>null},kx=xv({history:av(),routes:[{path:"/",name:"home",component:La},{path:"/thread/:threadId",name:"thread",component:La},{path:"/skills",name:"skills",component:La},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");bg(_x).use(kx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});