codexui-android 0.1.96 → 0.1.98

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,64 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BNvqi1ws.js","assets/ThreadConversation-3WaRKicR.css","assets/ThreadTerminalPanel-DjP4TSjB.js","assets/ThreadTerminalPanel-CGTJQ1BI.css","assets/ReviewPane-CUrlR8zS.js","assets/ReviewPane-DuPX5OZA.css","assets/SkillsHub-BxltnLjE.js","assets/SkillsHub-CTnWejwn.css"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();/**
3
- * @vue/shared v3.5.33
4
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
- * @license MIT
6
- **/function Du(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Mt={},_s=[],Gr=()=>{},kf=()=>!1,xi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Ci=e=>e.startsWith("onUpdate:"),fn=Object.assign,Lu=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},tm=Object.prototype.hasOwnProperty,_t=(e,t)=>tm.call(e,t),We=Array.isArray,Ss=e=>xa(e)==="[object Map]",Os=e=>xa(e)==="[object Set]",_c=e=>xa(e)==="[object Date]",et=e=>typeof e=="function",Lt=e=>typeof e=="string",Mr=e=>typeof e=="symbol",St=e=>e!==null&&typeof e=="object",xf=e=>(St(e)||et(e))&&et(e.then)&&et(e.catch),Cf=Object.prototype.toString,xa=e=>Cf.call(e),nm=e=>xa(e).slice(8,-1),Af=e=>xa(e)==="[object Object]",Nu=e=>Lt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,la=Du(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ai=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},rm=/-\w/g,Yn=Ai(e=>e.replace(rm,t=>t.slice(1).toUpperCase())),om=/\B([A-Z])/g,$o=Ai(e=>e.replace(om,"-$1").toLowerCase()),Ei=Ai(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ml=Ai(e=>e?`on${Ei(e)}`:""),Wr=(e,t)=>!Object.is(e,t),di=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Ef=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Ii=e=>{const t=parseFloat(e);return isNaN(t)?e:t},sm=e=>{const t=Lt(e)?Number(e):NaN;return isNaN(t)?e:t};let Sc;const Mi=()=>Sc||(Sc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function io(e){if(We(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Lt(r)?um(r):io(r);if(o)for(const s in o)t[s]=o[s]}return t}else if(Lt(e)||St(e))return e}const am=/;(?![^(]*\))/g,im=/:([^]+)/,lm=/\/\*[^]*?\*\//g;function um(e){const t={};return e.replace(lm,"").split(am).forEach(n=>{if(n){const r=n.split(im);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ot(e){let t="";if(Lt(e))t=e;else if(We(e))for(let n=0;n<e.length;n++){const r=ot(e[n]);r&&(t+=r+" ")}else if(St(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const cm="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",dm=Du(cm);function If(e){return!!e||e===""}function fm(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ds(e[r],t[r]);return n}function Ds(e,t){if(e===t)return!0;let n=_c(e),r=_c(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Mr(e),r=Mr(t),n||r)return e===t;if(n=We(e),r=We(t),n||r)return n&&r?fm(e,t):!1;if(n=St(e),r=St(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,s=Object.keys(t).length;if(o!==s)return!1;for(const i in e){const l=e.hasOwnProperty(i),c=t.hasOwnProperty(i);if(l&&!c||!l&&c||!Ds(e[i],t[i]))return!1}}return String(e)===String(t)}function ju(e,t){return e.findIndex(n=>Ds(n,t))}const Mf=e=>!!(e&&e.__v_isRef===!0),ae=e=>Lt(e)?e:e==null?"":We(e)||St(e)&&(e.toString===Cf||!et(e.toString))?Mf(e)?ae(e.value):JSON.stringify(e,Rf,2):String(e),Rf=(e,t)=>Mf(t)?Rf(e,t.value):Ss(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],s)=>(n[Rl(r,s)+" =>"]=o,n),{})}:Os(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Rl(n))}:Mr(t)?Rl(t):St(t)&&!We(t)&&!Af(t)?String(t):t,Rl=(e,t="")=>{var n;return Mr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
- * @vue/reactivity v3.5.33
8
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
- * @license MIT
10
- **/let On;class pm{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=On,!t&&On&&(this.index=(On.scopes||(On.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=On;try{return On=this,t()}finally{On=n}}}on(){++this._on===1&&(this.prevScope=On,On=this)}off(){if(this._on>0&&--this._on===0){if(On===this)On=this.prevScope;else{let t=On;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function hm(){return On}let $t;const Pl=new WeakSet;class Pf{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,On&&On.active&&On.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Pl.has(this)&&(Pl.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Of(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,kc(this),Df(this);const t=$t,n=Er;$t=this,Er=!0;try{return this.fn()}finally{Lf(this),$t=t,Er=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Uu(t);this.deps=this.depsTail=void 0,kc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Pl.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){uu(this)&&this.run()}get dirty(){return uu(this)}}let $f=0,ua,ca;function Of(e,t=!1){if(e.flags|=8,t){e.next=ca,ca=e;return}e.next=ua,ua=e}function Fu(){$f++}function Bu(){if(--$f>0)return;if(ca){let t=ca;for(ca=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;ua;){let t=ua;for(ua=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 Df(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Lf(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Uu(r),mm(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function uu(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Nf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Nf(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===va)||(e.globalVersion=va,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!uu(e))))return;e.flags|=2;const t=e.dep,n=$t,r=Er;$t=e,Er=!0;try{Df(e);const o=e.fn(e._value);(t.version===0||Wr(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{$t=n,Er=r,Lf(e),e.flags&=-3}}function Uu(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)Uu(s,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function mm(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Er=!0;const jf=[];function fo(){jf.push(Er),Er=!1}function po(){const e=jf.pop();Er=e===void 0?!0:e}function kc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=$t;$t=void 0;try{t()}finally{$t=n}}}let va=0;class vm{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 qu{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(!$t||!Er||$t===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==$t)n=this.activeLink=new vm($t,this),$t.deps?(n.prevDep=$t.depsTail,$t.depsTail.nextDep=n,$t.depsTail=n):$t.deps=$t.depsTail=n,Ff(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=$t.depsTail,n.nextDep=void 0,$t.depsTail.nextDep=n,$t.depsTail=n,$t.deps===n&&($t.deps=r)}return n}trigger(t){this.version++,va++,this.notify(t)}notify(t){Fu();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Bu()}}}function Ff(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)Ff(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const cu=new WeakMap,Xo=Symbol(""),du=Symbol(""),ga=Symbol("");function Dn(e,t,n){if(Er&&$t){let r=cu.get(e);r||cu.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new qu),o.map=r,o.key=n),o.track()}}function so(e,t,n,r,o,s){const i=cu.get(e);if(!i){va++;return}const l=c=>{c&&c.trigger()};if(Fu(),t==="clear")i.forEach(l);else{const c=We(e),p=c&&Nu(n);if(c&&n==="length"){const f=Number(r);i.forEach((g,T)=>{(T==="length"||T===ga||!Mr(T)&&T>=f)&&l(g)})}else switch((n!==void 0||i.has(void 0))&&l(i.get(n)),p&&l(i.get(ga)),t){case"add":c?p&&l(i.get("length")):(l(i.get(Xo)),Ss(e)&&l(i.get(du)));break;case"delete":c||(l(i.get(Xo)),Ss(e)&&l(i.get(du)));break;case"set":Ss(e)&&l(i.get(Xo));break}}Bu()}function fs(e){const t=wt(e);return t===e?t:(Dn(t,"iterate",ga),yr(e)?t:t.map(Rr))}function Ri(e){return Dn(e=wt(e),"iterate",ga),e}function Hr(e,t){return ho(e)?As(Zo(e)?Rr(t):t):Rr(t)}const gm={__proto__:null,[Symbol.iterator](){return $l(this,Symbol.iterator,e=>Hr(this,e))},concat(...e){return fs(this).concat(...e.map(t=>We(t)?fs(t):t))},entries(){return $l(this,"entries",e=>(e[1]=Hr(this,e[1]),e))},every(e,t){return eo(this,"every",e,t,void 0,arguments)},filter(e,t){return eo(this,"filter",e,t,n=>n.map(r=>Hr(this,r)),arguments)},find(e,t){return eo(this,"find",e,t,n=>Hr(this,n),arguments)},findIndex(e,t){return eo(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return eo(this,"findLast",e,t,n=>Hr(this,n),arguments)},findLastIndex(e,t){return eo(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return eo(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ol(this,"includes",e)},indexOf(...e){return Ol(this,"indexOf",e)},join(e){return fs(this).join(e)},lastIndexOf(...e){return Ol(this,"lastIndexOf",e)},map(e,t){return eo(this,"map",e,t,void 0,arguments)},pop(){return Zs(this,"pop")},push(...e){return Zs(this,"push",e)},reduce(e,...t){return xc(this,"reduce",e,t)},reduceRight(e,...t){return xc(this,"reduceRight",e,t)},shift(){return Zs(this,"shift")},some(e,t){return eo(this,"some",e,t,void 0,arguments)},splice(...e){return Zs(this,"splice",e)},toReversed(){return fs(this).toReversed()},toSorted(e){return fs(this).toSorted(e)},toSpliced(...e){return fs(this).toSpliced(...e)},unshift(...e){return Zs(this,"unshift",e)},values(){return $l(this,"values",e=>Hr(this,e))}};function $l(e,t,n){const r=Ri(e),o=r[t]();return r!==e&&!yr(e)&&(o._next=o.next,o.next=()=>{const s=o._next();return s.done||(s.value=n(s.value)),s}),o}const ym=Array.prototype;function eo(e,t,n,r,o,s){const i=Ri(e),l=i!==e&&!yr(e),c=i[t];if(c!==ym[t]){const g=c.apply(e,s);return l?Rr(g):g}let p=n;i!==e&&(l?p=function(g,T){return n.call(this,Hr(e,g),T,e)}:n.length>2&&(p=function(g,T){return n.call(this,g,T,e)}));const f=c.call(i,p,r);return l&&o?o(f):f}function xc(e,t,n,r){const o=Ri(e),s=o!==e&&!yr(e);let i=n,l=!1;o!==e&&(s?(l=r.length===0,i=function(p,f,g){return l&&(l=!1,p=Hr(e,p)),n.call(this,p,Hr(e,f),g,e)}):n.length>3&&(i=function(p,f,g){return n.call(this,p,f,g,e)}));const c=o[t](i,...r);return l?Hr(e,c):c}function Ol(e,t,n){const r=wt(e);Dn(r,"iterate",ga);const o=r[t](...n);return(o===-1||o===!1)&&Wu(n[0])?(n[0]=wt(n[0]),r[t](...n)):o}function Zs(e,t,n=[]){fo(),Fu();const r=wt(e)[t].apply(e,n);return Bu(),po(),r}const wm=Du("__proto__,__v_isRef,__isVue"),Bf=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Mr));function bm(e){Mr(e)||(e=String(e));const t=wt(this);return Dn(t,"has",e),t.hasOwnProperty(e)}class Uf{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(o?s?Mm:Wf:s?Vf:Hf).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=We(t);if(!o){let c;if(i&&(c=gm[n]))return c;if(n==="hasOwnProperty")return bm}const l=Reflect.get(t,n,Nn(t)?t:r);if((Mr(n)?Bf.has(n):wm(n))||(o||Dn(t,"get",n),s))return l;if(Nn(l)){const c=i&&Nu(n)?l:l.value;return o&&St(c)?pu(c):c}return St(l)?o?pu(l):Pi(l):l}}class qf extends Uf{constructor(t=!1){super(!1,t)}set(t,n,r,o){let s=t[n];const i=We(t)&&Nu(n);if(!this._isShallow){const p=ho(s);if(!yr(r)&&!ho(r)&&(s=wt(s),r=wt(r)),!i&&Nn(s)&&!Nn(r))return p||(s.value=r),!0}const l=i?Number(n)<t.length:_t(t,n),c=Reflect.set(t,n,r,Nn(t)?t:o);return t===wt(o)&&(l?Wr(r,s)&&so(t,"set",n,r):so(t,"add",n,r)),c}deleteProperty(t,n){const r=_t(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&so(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Mr(n)||!Bf.has(n))&&Dn(t,"has",n),r}ownKeys(t){return Dn(t,"iterate",We(t)?"length":Xo),Reflect.ownKeys(t)}}class Tm extends Uf{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const _m=new qf,Sm=new Tm,km=new qf(!0);const fu=e=>e,Qa=e=>Reflect.getPrototypeOf(e);function xm(e,t,n){return function(...r){const o=this.__v_raw,s=wt(o),i=Ss(s),l=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,p=o[e](...r),f=n?fu:t?As:Rr;return!t&&Dn(s,"iterate",c?du:Xo),fn(Object.create(p),{next(){const{value:g,done:T}=p.next();return T?{value:g,done:T}:{value:l?[f(g[0]),f(g[1])]:f(g),done:T}}})}}function Xa(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Cm(e,t){const n={get(o){const s=this.__v_raw,i=wt(s),l=wt(o);e||(Wr(o,l)&&Dn(i,"get",o),Dn(i,"get",l));const{has:c}=Qa(i),p=t?fu:e?As:Rr;if(c.call(i,o))return p(s.get(o));if(c.call(i,l))return p(s.get(l));s!==i&&s.get(o)},get size(){const o=this.__v_raw;return!e&&Dn(wt(o),"iterate",Xo),o.size},has(o){const s=this.__v_raw,i=wt(s),l=wt(o);return e||(Wr(o,l)&&Dn(i,"has",o),Dn(i,"has",l)),o===l?s.has(o):s.has(o)||s.has(l)},forEach(o,s){const i=this,l=i.__v_raw,c=wt(l),p=t?fu:e?As:Rr;return!e&&Dn(c,"iterate",Xo),l.forEach((f,g)=>o.call(s,p(f),p(g),i))}};return fn(n,e?{add:Xa("add"),set:Xa("set"),delete:Xa("delete"),clear:Xa("clear")}:{add(o){const s=wt(this),i=Qa(s),l=wt(o),c=!t&&!yr(o)&&!ho(o)?l:o;return i.has.call(s,c)||Wr(o,c)&&i.has.call(s,o)||Wr(l,c)&&i.has.call(s,l)||(s.add(c),so(s,"add",c,c)),this},set(o,s){!t&&!yr(s)&&!ho(s)&&(s=wt(s));const i=wt(this),{has:l,get:c}=Qa(i);let p=l.call(i,o);p||(o=wt(o),p=l.call(i,o));const f=c.call(i,o);return i.set(o,s),p?Wr(s,f)&&so(i,"set",o,s):so(i,"add",o,s),this},delete(o){const s=wt(this),{has:i,get:l}=Qa(s);let c=i.call(s,o);c||(o=wt(o),c=i.call(s,o)),l&&l.call(s,o);const p=s.delete(o);return c&&so(s,"delete",o,void 0),p},clear(){const o=wt(this),s=o.size!==0,i=o.clear();return s&&so(o,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=xm(o,e,t)}),n}function Hu(e,t){const n=Cm(e,t);return(r,o,s)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(_t(n,o)&&o in r?n:r,o,s)}const Am={get:Hu(!1,!1)},Em={get:Hu(!1,!0)},Im={get:Hu(!0,!1)};const Hf=new WeakMap,Vf=new WeakMap,Wf=new WeakMap,Mm=new WeakMap;function Rm(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Pm(e){return e.__v_skip||!Object.isExtensible(e)?0:Rm(nm(e))}function Pi(e){return ho(e)?e:Vu(e,!1,_m,Am,Hf)}function zf(e){return Vu(e,!1,km,Em,Vf)}function pu(e){return Vu(e,!0,Sm,Im,Wf)}function Vu(e,t,n,r,o){if(!St(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=Pm(e);if(s===0)return e;const i=o.get(e);if(i)return i;const l=new Proxy(e,s===2?r:n);return o.set(e,l),l}function Zo(e){return ho(e)?Zo(e.__v_raw):!!(e&&e.__v_isReactive)}function ho(e){return!!(e&&e.__v_isReadonly)}function yr(e){return!!(e&&e.__v_isShallow)}function Wu(e){return e?!!e.__v_raw:!1}function wt(e){const t=e&&e.__v_raw;return t?wt(t):e}function $m(e){return!_t(e,"__v_skip")&&Object.isExtensible(e)&&Ef(e,"__v_skip",!0),e}const Rr=e=>St(e)?Pi(e):e,As=e=>St(e)?pu(e):e;function Nn(e){return e?e.__v_isRef===!0:!1}function M(e){return Gf(e,!1)}function Om(e){return Gf(e,!0)}function Gf(e,t){return Nn(e)?e:new Dm(e,t)}class Dm{constructor(t,n){this.dep=new qu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:wt(t),this._value=n?t:Rr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||yr(t)||ho(t);t=r?t:wt(t),Wr(t,n)&&(this._rawValue=t,this._value=r?t:Rr(t),this.dep.trigger())}}function Me(e){return Nn(e)?e.value:e}const Lm={get:(e,t,n)=>t==="__v_raw"?e:Me(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Nn(o)&&!Nn(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Kf(e){return Zo(e)?e:new Proxy(e,Lm)}class Nm{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new qu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=va-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&$t!==this)return Of(this,!0),!0}get value(){const t=this.dep.track();return Nf(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function jm(e,t,n=!1){let r,o;return et(e)?r=e:(r=e.get,o=e.set),new Nm(r,o,n)}const Za={},mi=new WeakMap;let zo;function Fm(e,t=!1,n=zo){if(n){let r=mi.get(n);r||mi.set(n,r=[]),r.push(e)}}function Bm(e,t,n=Mt){const{immediate:r,deep:o,once:s,scheduler:i,augmentJob:l,call:c}=n,p=z=>o?z:yr(z)||o===!1||o===0?ao(z,1):ao(z);let f,g,T,k,U=!1,H=!1;if(Nn(e)?(g=()=>e.value,U=yr(e)):Zo(e)?(g=()=>p(e),U=!0):We(e)?(H=!0,U=e.some(z=>Zo(z)||yr(z)),g=()=>e.map(z=>{if(Nn(z))return z.value;if(Zo(z))return p(z);if(et(z))return c?c(z,2):z()})):et(e)?t?g=c?()=>c(e,2):e:g=()=>{if(T){fo();try{T()}finally{po()}}const z=zo;zo=f;try{return c?c(e,3,[k]):e(k)}finally{zo=z}}:g=Gr,t&&o){const z=g,de=o===!0?1/0:o;g=()=>ao(z(),de)}const Z=hm(),q=()=>{f.stop(),Z&&Z.active&&Lu(Z.effects,f)};if(s&&t){const z=t;t=(...de)=>{z(...de),q()}}let R=H?new Array(e.length).fill(Za):Za;const F=z=>{if(!(!(f.flags&1)||!f.dirty&&!z))if(t){const de=f.run();if(o||U||(H?de.some((ue,we)=>Wr(ue,R[we])):Wr(de,R))){T&&T();const ue=zo;zo=f;try{const we=[de,R===Za?void 0:H&&R[0]===Za?[]:R,k];R=de,c?c(t,3,we):t(...we)}finally{zo=ue}}}else f.run()};return l&&l(F),f=new Pf(g),f.scheduler=i?()=>i(F,!1):F,k=z=>Fm(z,!1,f),T=f.onStop=()=>{const z=mi.get(f);if(z){if(c)c(z,4);else for(const de of z)de();mi.delete(f)}},t?r?F(!0):R=f.run():i?i(F.bind(null,!0),!0):f.run(),q.pause=f.pause.bind(f),q.resume=f.resume.bind(f),q.stop=q,q}function ao(e,t=1/0,n){if(t<=0||!St(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Nn(e))ao(e.value,t,n);else if(We(e))for(let r=0;r<e.length;r++)ao(e[r],t,n);else if(Os(e)||Ss(e))e.forEach(r=>{ao(r,t,n)});else if(Af(e)){for(const r in e)ao(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ao(e[r],t,n)}return e}/**
11
- * @vue/runtime-core v3.5.33
12
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
- * @license MIT
14
- **/function Ca(e,t,n,r){try{return r?e(...r):e()}catch(o){Aa(o,t,n)}}function Pr(e,t,n,r){if(et(e)){const o=Ca(e,t,n,r);return o&&xf(o)&&o.catch(s=>{Aa(s,t,n)}),o}if(We(e)){const o=[];for(let s=0;s<e.length;s++)o.push(Pr(e[s],t,n,r));return o}}function Aa(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Mt;if(t){let l=t.parent;const c=t.proxy,p=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const f=l.ec;if(f){for(let g=0;g<f.length;g++)if(f[g](e,c,p)===!1)return}l=l.parent}if(s){fo(),Ca(s,null,10,[e,c,p]),po();return}}Um(e,n,o,r,i)}function Um(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const Kn=[];let Ur=-1;const ks=[];let Ao=null,vs=0;const Yf=Promise.resolve();let vi=null;function Gt(e){const t=vi||Yf;return e?t.then(this?e.bind(this):e):t}function qm(e){let t=Ur+1,n=Kn.length;for(;t<n;){const r=t+n>>>1,o=Kn[r],s=ya(o);s<e||s===e&&o.flags&2?t=r+1:n=r}return t}function zu(e){if(!(e.flags&1)){const t=ya(e),n=Kn[Kn.length-1];!n||!(e.flags&2)&&t>=ya(n)?Kn.push(e):Kn.splice(qm(t),0,e),e.flags|=1,Jf()}}function Jf(){vi||(vi=Yf.then(Xf))}function Hm(e){We(e)?ks.push(...e):Ao&&e.id===-1?Ao.splice(vs+1,0,e):e.flags&1||(ks.push(e),e.flags|=1),Jf()}function Cc(e,t,n=Ur+1){for(;n<Kn.length;n++){const r=Kn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Kn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Qf(e){if(ks.length){const t=[...new Set(ks)].sort((n,r)=>ya(n)-ya(r));if(ks.length=0,Ao){Ao.push(...t);return}for(Ao=t,vs=0;vs<Ao.length;vs++){const n=Ao[vs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ao=null,vs=0}}const ya=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Xf(e){try{for(Ur=0;Ur<Kn.length;Ur++){const t=Kn[Ur];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Ca(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ur<Kn.length;Ur++){const t=Kn[Ur];t&&(t.flags&=-2)}Ur=-1,Kn.length=0,Qf(),vi=null,(Kn.length||ks.length)&&Xf()}}let xn=null,Zf=null;function gi(e){const t=xn;return xn=e,Zf=e&&e.type.__scopeId||null,t}function bt(e,t=xn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&bi(-1);const s=gi(t);let i;try{i=e(...o)}finally{gi(s),r._d&&bi(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function rn(e,t){if(xn===null)return e;const n=Ni(xn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[s,i,l,c=Mt]=t[o];s&&(et(s)&&(s={mounted:s,updated:s}),s.deep&&ao(i),r.push({dir:s,instance:n,value:i,oldValue:void 0,arg:l,modifiers:c}))}return e}function Uo(e,t,n,r){const o=e.dirs,s=t&&t.dirs;for(let i=0;i<o.length;i++){const l=o[i];s&&(l.oldValue=s[i].value);let c=l.dir[r];c&&(fo(),Pr(c,n,8,[e.el,l,e,t]),po())}}function fi(e,t){if(kn){let n=kn.provides;const r=kn.parent&&kn.parent.provides;r===n&&(n=kn.provides=Object.create(r)),n[e]=t}}function Ir(e,t,n=!1){const r=Zu();if(r||Cs){let o=Cs?Cs._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&et(t)?t.call(r&&r.proxy):t}}const Vm=Symbol.for("v-scx"),Wm=()=>Ir(Vm);function it(e,t,n){return ep(e,t,n)}function ep(e,t,n=Mt){const{immediate:r,deep:o,flush:s,once:i}=n,l=fn({},n),c=t&&r||!t&&s!=="post";let p;if(Es){if(s==="sync"){const k=Wm();p=k.__watcherHandles||(k.__watcherHandles=[])}else if(!c){const k=()=>{};return k.stop=Gr,k.resume=Gr,k.pause=Gr,k}}const f=kn;l.call=(k,U,H)=>Pr(k,f,U,H);let g=!1;s==="post"?l.scheduler=k=>{zn(k,f&&f.suspense)}:s!=="sync"&&(g=!0,l.scheduler=(k,U)=>{U?k():zu(k)}),l.augmentJob=k=>{t&&(k.flags|=4),g&&(k.flags|=2,f&&(k.id=f.uid,k.i=f))};const T=Bm(e,t,l);return Es&&(p?p.push(T):c&&T()),T}function zm(e,t,n){const r=this.proxy,o=Lt(e)?e.includes(".")?tp(r,e):()=>r[e]:e.bind(r,r);let s;et(t)?s=t:(s=t.handler,n=t);const i=Ia(this),l=ep(o,s.bind(r),n);return i(),l}function tp(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const Co=new WeakMap,np=Symbol("_vte"),rp=e=>e.__isTeleport,Ko=e=>e&&(e.disabled||e.disabled===""),Gm=e=>e&&(e.defer||e.defer===""),Ac=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Ec=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,hu=(e,t)=>{const n=e&&e.to;return Lt(n)?t?t(n):null:n},Km={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,s,i,l,c,p){const{mc:f,pc:g,pbc:T,o:{insert:k,querySelector:U,createText:H,createComment:Z,parentNode:q}}=p,R=Ko(t.props);let{dynamicChildren:F}=t;const z=(we,ke,me)=>{we.shapeFlag&16&&f(we.children,ke,me,o,s,i,l,c)},de=(we=t)=>{const ke=Ko(we.props),me=we.target=hu(we.props,U),Ee=mu(me,we,H,k);me&&(i!=="svg"&&Ac(me)?i="svg":i!=="mathml"&&Ec(me)&&(i="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(me),ke||(z(we,me,Ee),sa(we,!1)))},ue=we=>{const ke=()=>{if(Co.get(we)===ke){if(Co.delete(we),Ko(we.props)){const me=q(we.el)||n;z(we,me,we.anchor),sa(we,!0)}de(we)}};Co.set(we,ke),zn(ke,s)};if(e==null){const we=t.el=H(""),ke=t.anchor=H("");if(k(we,n,r),k(ke,n,r),Gm(t.props)||s&&s.pendingBranch){ue(t);return}R&&(z(t,n,ke),sa(t,!0)),de()}else{t.el=e.el;const we=t.anchor=e.anchor,ke=Co.get(e);if(ke){ke.flags|=8,Co.delete(e),ue(t);return}t.targetStart=e.targetStart;const me=t.target=e.target,Ee=t.targetAnchor=e.targetAnchor,$e=Ko(e.props),Y=$e?n:me,ve=$e?we:Ee;if(i==="svg"||Ac(me)?i="svg":(i==="mathml"||Ec(me))&&(i="mathml"),F?(T(e.dynamicChildren,F,Y,o,s,i,l),Qu(e,t,!0)):c||g(e,t,Y,ve,o,s,i,l,!1),R)$e?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ei(t,n,we,p,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const Fe=t.target=hu(t.props,U);Fe&&ei(t,Fe,null,p,0)}else $e&&ei(t,me,Ee,p,1);sa(t,R)}},remove(e,t,n,{um:r,o:{remove:o}},s){const{shapeFlag:i,children:l,anchor:c,targetStart:p,targetAnchor:f,target:g,props:T}=e;let k=s||!Ko(T);const U=Co.get(e);if(U&&(U.flags|=8,Co.delete(e),k=!1),g&&(o(p),o(f)),s&&o(c),i&16)for(let H=0;H<l.length;H++){const Z=l[H];r(Z,t,n,k,!!Z.dynamicChildren)}},move:ei,hydrate:Ym};function ei(e,t,n,{o:{insert:r},m:o},s=2){s===0&&r(e.targetAnchor,t,n);const{el:i,anchor:l,shapeFlag:c,children:p,props:f}=e,g=s===2;if(g&&r(i,t,n),!Co.has(e)&&(!g||Ko(f))&&c&16)for(let T=0;T<p.length;T++)o(p[T],t,n,2);g&&r(l,t,n)}function Ym(e,t,n,r,o,s,{o:{nextSibling:i,parentNode:l,querySelector:c,insert:p,createText:f}},g){function T(Z,q){let R=q;for(;R;){if(R&&R.nodeType===8){if(R.data==="teleport start anchor")t.targetStart=R;else if(R.data==="teleport anchor"){t.targetAnchor=R,Z._lpa=t.targetAnchor&&i(t.targetAnchor);break}}R=i(R)}}function k(Z,q){q.anchor=g(i(Z),q,l(Z),n,r,o,s)}const U=t.target=hu(t.props,c),H=Ko(t.props);if(U){const Z=U._lpa||U.firstChild;t.shapeFlag&16&&(H?(k(e,t),T(U,Z),t.targetAnchor||mu(U,t,f,p,l(e)===U?e:null)):(t.anchor=i(e),T(U,Z),t.targetAnchor||mu(U,t,f,p),g(Z&&i(Z),t,U,n,r,o,s))),sa(t,H)}else H&&t.shapeFlag&16&&(k(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const bs=Km;function sa(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function mu(e,t,n,r,o=null){const s=t.targetStart=n(""),i=t.targetAnchor=n("");return s[np]=i,e&&(r(s,e,o),r(i,e,o)),i}const qr=Symbol("_leaveCb"),ea=Symbol("_enterCb");function Jm(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Oo(()=>{e.isMounted=!0}),es(()=>{e.isUnmounting=!0}),e}const gr=[Function,Array],op={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:gr,onEnter:gr,onAfterEnter:gr,onEnterCancelled:gr,onBeforeLeave:gr,onLeave:gr,onAfterLeave:gr,onLeaveCancelled:gr,onBeforeAppear:gr,onAppear:gr,onAfterAppear:gr,onAppearCancelled:gr},sp=e=>{const t=e.subTree;return t.component?sp(t.component):t},Qm={name:"BaseTransition",props:op,setup(e,{slots:t}){const n=Zu(),r=Jm();return()=>{const o=t.default&&lp(t.default(),!0),s=o&&o.length?ap(o):n.subTree?ie():void 0;if(!s)return;const i=wt(e),{mode:l}=i;if(r.isLeaving)return Dl(s);const c=Ic(s);if(!c)return Dl(s);let p=vu(c,i,r,n,g=>p=g);c.type!==Ln&&wa(c,p);let f=n.subTree&&Ic(n.subTree);if(f&&f.type!==Ln&&!Yo(f,c)&&sp(n).type!==Ln){let g=vu(f,i,r,n);if(wa(f,g),l==="out-in"&&c.type!==Ln)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,f=void 0},Dl(s);l==="in-out"&&c.type!==Ln?g.delayLeave=(T,k,U)=>{const H=ip(r,f);H[String(f.key)]=f,T[qr]=()=>{k(),T[qr]=void 0,delete p.delayedLeave,f=void 0},p.delayedLeave=()=>{U(),delete p.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return s}}};function ap(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ln){t=n;break}}return t}const Xm=Qm;function ip(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 vu(e,t,n,r,o){const{appear:s,mode:i,persisted:l=!1,onBeforeEnter:c,onEnter:p,onAfterEnter:f,onEnterCancelled:g,onBeforeLeave:T,onLeave:k,onAfterLeave:U,onLeaveCancelled:H,onBeforeAppear:Z,onAppear:q,onAfterAppear:R,onAppearCancelled:F}=t,z=String(e.key),de=ip(n,e),ue=(me,Ee)=>{me&&Pr(me,r,9,Ee)},we=(me,Ee)=>{const $e=Ee[1];ue(me,Ee),We(me)?me.every(Y=>Y.length<=1)&&$e():me.length<=1&&$e()},ke={mode:i,persisted:l,beforeEnter(me){let Ee=c;if(!n.isMounted)if(s)Ee=Z||c;else return;me[qr]&&me[qr](!0);const $e=de[z];$e&&Yo(e,$e)&&$e.el[qr]&&$e.el[qr](),ue(Ee,[me])},enter(me){if(de[z]===e)return;let Ee=p,$e=f,Y=g;if(!n.isMounted)if(s)Ee=q||p,$e=R||f,Y=F||g;else return;let ve=!1;me[ea]=Ne=>{ve||(ve=!0,Ne?ue(Y,[me]):ue($e,[me]),ke.delayedLeave&&ke.delayedLeave(),me[ea]=void 0)};const Fe=me[ea].bind(null,!1);Ee?we(Ee,[me,Fe]):Fe()},leave(me,Ee){const $e=String(e.key);if(me[ea]&&me[ea](!0),n.isUnmounting)return Ee();ue(T,[me]);let Y=!1;me[qr]=Fe=>{Y||(Y=!0,Ee(),Fe?ue(H,[me]):ue(U,[me]),me[qr]=void 0,de[$e]===e&&delete de[$e])};const ve=me[qr].bind(null,!1);de[$e]=e,k?we(k,[me,ve]):ve()},clone(me){const Ee=vu(me,t,n,r,o);return o&&o(Ee),Ee}};return ke}function Dl(e){if(Ea(e))return e=Po(e),e.children=null,e}function Ic(e){if(!Ea(e))return rp(e.type)&&e.children?ap(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&&et(n.default))return n.default()}}function wa(e,t){e.shapeFlag&6&&e.component?(e.transition=t,wa(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 lp(e,t=!1,n){let r=[],o=0;for(let s=0;s<e.length;s++){let i=e[s];const l=n==null?i.key:String(n)+String(i.key!=null?i.key:s);i.type===qe?(i.patchFlag&128&&o++,r=r.concat(lp(i.children,t,l))):(t||i.type!==Ln)&&r.push(l!=null?Po(i,{key:l}):i)}if(o>1)for(let s=0;s<r.length;s++)r[s].patchFlag=-2;return r}function Cn(e,t){return et(e)?fn({name:e.name},t,{setup:e}):e}function Gu(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Mc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const yi=new WeakMap;function da(e,t,n,r,o=!1){if(We(e)){e.forEach((H,Z)=>da(H,t&&(We(t)?t[Z]:t),n,r,o));return}if(xs(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&da(e,t,n,r.component.subTree);return}const s=r.shapeFlag&4?Ni(r.component):r.el,i=o?null:s,{i:l,r:c}=e,p=t&&t.r,f=l.refs===Mt?l.refs={}:l.refs,g=l.setupState,T=wt(g),k=g===Mt?kf:H=>Mc(f,H)?!1:_t(T,H),U=(H,Z)=>!(Z&&Mc(f,Z));if(p!=null&&p!==c){if(Rc(t),Lt(p))f[p]=null,k(p)&&(g[p]=null);else if(Nn(p)){const H=t;U(p,H.k)&&(p.value=null),H.k&&(f[H.k]=null)}}if(et(c))Ca(c,l,12,[i,f]);else{const H=Lt(c),Z=Nn(c);if(H||Z){const q=()=>{if(e.f){const R=H?k(c)?g[c]:f[c]:U()||!e.k?c.value:f[e.k];if(o)We(R)&&Lu(R,s);else if(We(R))R.includes(s)||R.push(s);else if(H)f[c]=[s],k(c)&&(g[c]=f[c]);else{const F=[s];U(c,e.k)&&(c.value=F),e.k&&(f[e.k]=F)}}else H?(f[c]=i,k(c)&&(g[c]=i)):Z&&(U(c,e.k)&&(c.value=i),e.k&&(f[e.k]=i))};if(i){const R=()=>{q(),yi.delete(e)};R.id=-1,yi.set(e,R),zn(R,n)}else Rc(e),q()}}}function Rc(e){const t=yi.get(e);t&&(t.flags|=8,yi.delete(e))}const Pc=e=>e.nodeType===8;Mi().requestIdleCallback;Mi().cancelIdleCallback;function Zm(e,t){if(Pc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Pc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const xs=e=>!!e.type.__asyncLoader;function ti(e){et(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:s,timeout:i,suspensible:l=!0,onError:c}=e;let p=null,f,g=0;const T=()=>(g++,p=null,k()),k=()=>{let U;return p||(U=p=t().catch(H=>{if(H=H instanceof Error?H:new Error(String(H)),c)return new Promise((Z,q)=>{c(H,()=>Z(T()),()=>q(H),g+1)});throw H}).then(H=>U!==p&&p?p:(H&&(H.__esModule||H[Symbol.toStringTag]==="Module")&&(H=H.default),f=H,H)))};return Cn({name:"AsyncComponentWrapper",__asyncLoader:k,__asyncHydrate(U,H,Z){let q=!1;(H.bu||(H.bu=[])).push(()=>q=!0);const R=()=>{q||Z()},F=s?()=>{const z=s(R,de=>Zm(U,de));z&&(H.bum||(H.bum=[])).push(z)}:R;f?F():k().then(()=>!H.isUnmounted&&F())},get __asyncResolved(){return f},setup(){const U=kn;if(Gu(U),f)return()=>ni(f,U);const H=F=>{p=null,Aa(F,U,13,!r)};if(l&&U.suspense||Es)return k().then(F=>()=>ni(F,U)).catch(F=>(H(F),()=>r?Be(r,{error:F}):null));const Z=M(!1),q=M(),R=M(!!o);return o&&setTimeout(()=>{R.value=!1},o),i!=null&&setTimeout(()=>{if(!Z.value&&!q.value){const F=new Error(`Async component timed out after ${i}ms.`);H(F),q.value=F}},i),k().then(()=>{Z.value=!0,U.parent&&Ea(U.parent.vnode)&&U.parent.update()}).catch(F=>{H(F),q.value=F}),()=>{if(Z.value&&f)return ni(f,U);if(q.value&&r)return Be(r,{error:q.value});if(n&&!R.value)return ni(n,U)}}})}function ni(e,t){const{ref:n,props:r,children:o,ce:s}=t.vnode,i=Be(e,r,o);return i.ref=n,i.ce=s,delete t.vnode.ce,i}const Ea=e=>e.type.__isKeepAlive;function ev(e,t){up(e,"a",t)}function tv(e,t){up(e,"da",t)}function up(e,t,n=kn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if($i(t,r,n),n){let o=n.parent;for(;o&&o.parent;)Ea(o.parent.vnode)&&nv(r,t,n,o),o=o.parent}}function nv(e,t,n,r){const o=$i(t,e,r,!0);Oi(()=>{Lu(r[t],o)},n)}function $i(e,t,n=kn,r=!1){if(n){const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{fo();const l=Ia(n),c=Pr(t,n,e,i);return l(),po(),c});return r?o.unshift(s):o.push(s),s}}const vo=e=>(t,n=kn)=>{(!Es||e==="sp")&&$i(e,(...r)=>t(...r),n)},rv=vo("bm"),Oo=vo("m"),ov=vo("bu"),sv=vo("u"),es=vo("bum"),Oi=vo("um"),av=vo("sp"),iv=vo("rtg"),lv=vo("rtc");function uv(e,t=kn){$i("ec",e,t)}const cv="components",cp=Symbol.for("v-ndc");function Ku(e){return Lt(e)?dv(cv,e,!1)||e:e||cp}function dv(e,t,n=!0,r=!1){const o=xn||kn;if(o){const s=o.type;{const l=Yv(s,!1);if(l&&(l===t||l===Yn(t)||l===Ei(Yn(t))))return s}const i=$c(o[e]||s[e],t)||$c(o.appContext[e],t);return!i&&r?s:i}}function $c(e,t){return e&&(e[t]||e[Yn(t)]||e[Ei(Yn(t))])}function Dt(e,t,n,r){let o;const s=n,i=We(e);if(i||Lt(e)){const l=i&&Zo(e);let c=!1,p=!1;l&&(c=!yr(e),p=ho(e),e=Ri(e)),o=new Array(e.length);for(let f=0,g=e.length;f<g;f++)o[f]=t(c?p?As(Rr(e[f])):Rr(e[f]):e[f],f,void 0,s)}else if(typeof e=="number"){o=new Array(e);for(let l=0;l<e;l++)o[l]=t(l+1,l,void 0,s)}else if(St(e))if(e[Symbol.iterator])o=Array.from(e,(l,c)=>t(l,c,void 0,s));else{const l=Object.keys(e);o=new Array(l.length);for(let c=0,p=l.length;c<p;c++){const f=l[c];o[c]=t(e[f],f,c,s)}}else o=[];return o}function zr(e,t,n={},r,o){if(xn.ce||xn.parent&&xs(xn.parent)&&xn.parent.ce){const p=Object.keys(n).length>0;return t!=="default"&&(n.name=t),S(),st(qe,null,[Be("slot",n,r)],p?-2:64)}let s=e[t];s&&s._c&&(s._d=!1),S();const i=s&&dp(s(n)),l=n.key||i&&i.key,c=st(qe,{key:(l&&!Mr(l)?l:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return s&&s._c&&(s._d=!0),c}function dp(e){return e.some(t=>Ta(t)?!(t.type===Ln||t.type===qe&&!dp(t.children)):!0)?e:null}const gu=e=>e?Rp(e)?Ni(e):gu(e.parent):null,fa=fn(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=>gu(e.parent),$root:e=>gu(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>pp(e),$forceUpdate:e=>e.f||(e.f=()=>{zu(e.update)}),$nextTick:e=>e.n||(e.n=Gt.bind(e.proxy)),$watch:e=>zm.bind(e)}),Ll=(e,t)=>e!==Mt&&!e.__isScriptSetup&&_t(e,t),fv={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:s,accessCache:i,type:l,appContext:c}=e;if(t[0]!=="$"){const T=i[t];if(T!==void 0)switch(T){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return s[t]}else{if(Ll(r,t))return i[t]=1,r[t];if(o!==Mt&&_t(o,t))return i[t]=2,o[t];if(_t(s,t))return i[t]=3,s[t];if(n!==Mt&&_t(n,t))return i[t]=4,n[t];yu&&(i[t]=0)}}const p=fa[t];let f,g;if(p)return t==="$attrs"&&Dn(e.attrs,"get",""),p(e);if((f=l.__cssModules)&&(f=f[t]))return f;if(n!==Mt&&_t(n,t))return i[t]=4,n[t];if(g=c.config.globalProperties,_t(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:s}=e;return Ll(o,t)?(o[t]=n,!0):r!==Mt&&_t(r,t)?(r[t]=n,!0):_t(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:s,type:i}},l){let c;return!!(n[l]||e!==Mt&&l[0]!=="$"&&_t(e,l)||Ll(t,l)||_t(s,l)||_t(r,l)||_t(fa,l)||_t(o.config.globalProperties,l)||(c=i.__cssModules)&&c[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:_t(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function pv(){return hv().slots}function hv(e){const t=Zu();return t.setupContext||(t.setupContext=$p(t))}function Oc(e){return We(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let yu=!0;function mv(e){const t=pp(e),n=e.proxy,r=e.ctx;yu=!1,t.beforeCreate&&Dc(t.beforeCreate,e,"bc");const{data:o,computed:s,methods:i,watch:l,provide:c,inject:p,created:f,beforeMount:g,mounted:T,beforeUpdate:k,updated:U,activated:H,deactivated:Z,beforeDestroy:q,beforeUnmount:R,destroyed:F,unmounted:z,render:de,renderTracked:ue,renderTriggered:we,errorCaptured:ke,serverPrefetch:me,expose:Ee,inheritAttrs:$e,components:Y,directives:ve,filters:Fe}=t;if(p&&vv(p,r,null),i)for(const Te in i){const _e=i[Te];et(_e)&&(r[Te]=_e.bind(n))}if(o){const Te=o.call(n,n);St(Te)&&(e.data=Pi(Te))}if(yu=!0,s)for(const Te in s){const _e=s[Te],He=et(_e)?_e.bind(n,n):et(_e.get)?_e.get.bind(n,n):Gr,Ke=!et(_e)&&et(_e.set)?_e.set.bind(n):Gr,Ve=re({get:He,set:Ke});Object.defineProperty(r,Te,{enumerable:!0,configurable:!0,get:()=>Ve.value,set:Je=>Ve.value=Je})}if(l)for(const Te in l)fp(l[Te],r,n,Te);if(c){const Te=et(c)?c.call(n):c;Reflect.ownKeys(Te).forEach(_e=>{fi(_e,Te[_e])})}f&&Dc(f,e,"c");function Ie(Te,_e){We(_e)?_e.forEach(He=>Te(He.bind(n))):_e&&Te(_e.bind(n))}if(Ie(rv,g),Ie(Oo,T),Ie(ov,k),Ie(sv,U),Ie(ev,H),Ie(tv,Z),Ie(uv,ke),Ie(lv,ue),Ie(iv,we),Ie(es,R),Ie(Oi,z),Ie(av,me),We(Ee))if(Ee.length){const Te=e.exposed||(e.exposed={});Ee.forEach(_e=>{Object.defineProperty(Te,_e,{get:()=>n[_e],set:He=>n[_e]=He,enumerable:!0})})}else e.exposed||(e.exposed={});de&&e.render===Gr&&(e.render=de),$e!=null&&(e.inheritAttrs=$e),Y&&(e.components=Y),ve&&(e.directives=ve),me&&Gu(e)}function vv(e,t,n=Gr){We(e)&&(e=wu(e));for(const r in e){const o=e[r];let s;St(o)?"default"in o?s=Ir(o.from||r,o.default,!0):s=Ir(o.from||r):s=Ir(o),Nn(s)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:i=>s.value=i}):t[r]=s}}function Dc(e,t,n){Pr(We(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function fp(e,t,n,r){let o=r.includes(".")?tp(n,r):()=>n[r];if(Lt(e)){const s=t[e];et(s)&&it(o,s)}else if(et(e))it(o,e.bind(n));else if(St(e))if(We(e))e.forEach(s=>fp(s,t,n,r));else{const s=et(e.handler)?e.handler.bind(n):t[e.handler];et(s)&&it(o,s,e)}}function pp(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:i}}=e.appContext,l=s.get(t);let c;return l?c=l:!o.length&&!n&&!r?c=t:(c={},o.length&&o.forEach(p=>wi(c,p,i,!0)),wi(c,t,i)),St(t)&&s.set(t,c),c}function wi(e,t,n,r=!1){const{mixins:o,extends:s}=t;s&&wi(e,s,n,!0),o&&o.forEach(i=>wi(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const l=gv[i]||n&&n[i];e[i]=l?l(e[i],t[i]):t[i]}return e}const gv={data:Lc,props:Nc,emits:Nc,methods:aa,computed:aa,beforeCreate:Wn,created:Wn,beforeMount:Wn,mounted:Wn,beforeUpdate:Wn,updated:Wn,beforeDestroy:Wn,beforeUnmount:Wn,destroyed:Wn,unmounted:Wn,activated:Wn,deactivated:Wn,errorCaptured:Wn,serverPrefetch:Wn,components:aa,directives:aa,watch:wv,provide:Lc,inject:yv};function Lc(e,t){return t?e?function(){return fn(et(e)?e.call(this,this):e,et(t)?t.call(this,this):t)}:t:e}function yv(e,t){return aa(wu(e),wu(t))}function wu(e){if(We(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Wn(e,t){return e?[...new Set([].concat(e,t))]:t}function aa(e,t){return e?fn(Object.create(null),e,t):t}function Nc(e,t){return e?We(e)&&We(t)?[...new Set([...e,...t])]:fn(Object.create(null),Oc(e),Oc(t??{})):t}function wv(e,t){if(!e)return t;if(!t)return e;const n=fn(Object.create(null),e);for(const r in t)n[r]=Wn(e[r],t[r]);return n}function hp(){return{app:null,config:{isNativeTag:kf,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 bv=0;function Tv(e,t){return function(r,o=null){et(r)||(r=fn({},r)),o!=null&&!St(o)&&(o=null);const s=hp(),i=new WeakSet,l=[];let c=!1;const p=s.app={_uid:bv++,_component:r,_props:o,_container:null,_context:s,_instance:null,version:Qv,get config(){return s.config},set config(f){},use(f,...g){return i.has(f)||(f&&et(f.install)?(i.add(f),f.install(p,...g)):et(f)&&(i.add(f),f(p,...g))),p},mixin(f){return s.mixins.includes(f)||s.mixins.push(f),p},component(f,g){return g?(s.components[f]=g,p):s.components[f]},directive(f,g){return g?(s.directives[f]=g,p):s.directives[f]},mount(f,g,T){if(!c){const k=p._ceVNode||Be(r,o);return k.appContext=s,T===!0?T="svg":T===!1&&(T=void 0),e(k,f,T),c=!0,p._container=f,f.__vue_app__=p,Ni(k.component)}},onUnmount(f){l.push(f)},unmount(){c&&(Pr(l,p._instance,16),e(null,p._container),delete p._container.__vue_app__)},provide(f,g){return s.provides[f]=g,p},runWithContext(f){const g=Cs;Cs=p;try{return f()}finally{Cs=g}}};return p}}let Cs=null;const _v=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Yn(t)}Modifiers`]||e[`${$o(t)}Modifiers`];function Sv(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Mt;let o=n;const s=t.startsWith("update:"),i=s&&_v(r,t.slice(7));i&&(i.trim&&(o=n.map(f=>Lt(f)?f.trim():f)),i.number&&(o=n.map(Ii)));let l,c=r[l=Ml(t)]||r[l=Ml(Yn(t))];!c&&s&&(c=r[l=Ml($o(t))]),c&&Pr(c,e,6,o);const p=r[l+"Once"];if(p){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Pr(p,e,6,o)}}const kv=new WeakMap;function mp(e,t,n=!1){const r=n?kv:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const s=e.emits;let i={},l=!1;if(!et(e)){const c=p=>{const f=mp(p,t,!0);f&&(l=!0,fn(i,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!s&&!l?(St(e)&&r.set(e,null),null):(We(s)?s.forEach(c=>i[c]=null):fn(i,s),St(e)&&r.set(e,i),i)}function Di(e,t){return!e||!xi(t)?!1:(t=t.slice(2).replace(/Once$/,""),_t(e,t[0].toLowerCase()+t.slice(1))||_t(e,$o(t))||_t(e,t))}function jc(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[s],slots:i,attrs:l,emit:c,render:p,renderCache:f,props:g,data:T,setupState:k,ctx:U,inheritAttrs:H}=e,Z=gi(e);let q,R;try{if(n.shapeFlag&4){const z=o||r,de=z;q=Vr(p.call(de,z,f,g,k,T,U)),R=l}else{const z=t;q=Vr(z.length>1?z(g,{attrs:l,slots:i,emit:c}):z(g,null)),R=t.props?l:xv(l)}}catch(z){pa.length=0,Aa(z,e,1),q=Be(Ln)}let F=q;if(R&&H!==!1){const z=Object.keys(R),{shapeFlag:de}=F;z.length&&de&7&&(s&&z.some(Ci)&&(R=Cv(R,s)),F=Po(F,R,!1,!0))}return n.dirs&&(F=Po(F,null,!1,!0),F.dirs=F.dirs?F.dirs.concat(n.dirs):n.dirs),n.transition&&wa(F,n.transition),q=F,gi(Z),q}const xv=e=>{let t;for(const n in e)(n==="class"||n==="style"||xi(n))&&((t||(t={}))[n]=e[n]);return t},Cv=(e,t)=>{const n={};for(const r in e)(!Ci(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Av(e,t,n){const{props:r,children:o,component:s}=e,{props:i,children:l,patchFlag:c}=t,p=s.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Fc(r,i,p):!!i;if(c&8){const f=t.dynamicProps;for(let g=0;g<f.length;g++){const T=f[g];if(vp(i,r,T)&&!Di(p,T))return!0}}}else return(o||l)&&(!l||!l.$stable)?!0:r===i?!1:r?i?Fc(r,i,p):!0:!!i;return!1}function Fc(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const s=r[o];if(vp(t,e,s)&&!Di(n,s))return!0}return!1}function vp(e,t,n){const r=e[n],o=t[n];return n==="style"&&St(r)&&St(o)?!Ds(r,o):r!==o}function Ev({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const gp={},yp=()=>Object.create(gp),wp=e=>Object.getPrototypeOf(e)===gp;function Iv(e,t,n,r=!1){const o={},s=yp();e.propsDefaults=Object.create(null),bp(e,t,o,s);for(const i in e.propsOptions[0])i in o||(o[i]=void 0);n?e.props=r?o:zf(o):e.type.props?e.props=o:e.props=s,e.attrs=s}function Mv(e,t,n,r){const{props:o,attrs:s,vnode:{patchFlag:i}}=e,l=wt(o),[c]=e.propsOptions;let p=!1;if((r||i>0)&&!(i&16)){if(i&8){const f=e.vnode.dynamicProps;for(let g=0;g<f.length;g++){let T=f[g];if(Di(e.emitsOptions,T))continue;const k=t[T];if(c)if(_t(s,T))k!==s[T]&&(s[T]=k,p=!0);else{const U=Yn(T);o[U]=bu(c,l,U,k,e,!1)}else k!==s[T]&&(s[T]=k,p=!0)}}}else{bp(e,t,o,s)&&(p=!0);let f;for(const g in l)(!t||!_t(t,g)&&((f=$o(g))===g||!_t(t,f)))&&(c?n&&(n[g]!==void 0||n[f]!==void 0)&&(o[g]=bu(c,l,g,void 0,e,!0)):delete o[g]);if(s!==l)for(const g in s)(!t||!_t(t,g))&&(delete s[g],p=!0)}p&&so(e.attrs,"set","")}function bp(e,t,n,r){const[o,s]=e.propsOptions;let i=!1,l;if(t)for(let c in t){if(la(c))continue;const p=t[c];let f;o&&_t(o,f=Yn(c))?!s||!s.includes(f)?n[f]=p:(l||(l={}))[f]=p:Di(e.emitsOptions,c)||(!(c in r)||p!==r[c])&&(r[c]=p,i=!0)}if(s){const c=wt(n),p=l||Mt;for(let f=0;f<s.length;f++){const g=s[f];n[g]=bu(o,c,g,p[g],e,!_t(p,g))}}return i}function bu(e,t,n,r,o,s){const i=e[n];if(i!=null){const l=_t(i,"default");if(l&&r===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&et(c)){const{propsDefaults:p}=o;if(n in p)r=p[n];else{const f=Ia(o);r=p[n]=c.call(null,t),f()}}else r=c;o.ce&&o.ce._setProp(n,r)}i[0]&&(s&&!l?r=!1:i[1]&&(r===""||r===$o(n))&&(r=!0))}return r}const Rv=new WeakMap;function Tp(e,t,n=!1){const r=n?Rv:t.propsCache,o=r.get(e);if(o)return o;const s=e.props,i={},l=[];let c=!1;if(!et(e)){const f=g=>{c=!0;const[T,k]=Tp(g,t,!0);fn(i,T),k&&l.push(...k)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!s&&!c)return St(e)&&r.set(e,_s),_s;if(We(s))for(let f=0;f<s.length;f++){const g=Yn(s[f]);Bc(g)&&(i[g]=Mt)}else if(s)for(const f in s){const g=Yn(f);if(Bc(g)){const T=s[f],k=i[g]=We(T)||et(T)?{type:T}:fn({},T),U=k.type;let H=!1,Z=!0;if(We(U))for(let q=0;q<U.length;++q){const R=U[q],F=et(R)&&R.name;if(F==="Boolean"){H=!0;break}else F==="String"&&(Z=!1)}else H=et(U)&&U.name==="Boolean";k[0]=H,k[1]=Z,(H||_t(k,"default"))&&l.push(g)}}const p=[i,l];return St(e)&&r.set(e,p),p}function Bc(e){return e[0]!=="$"&&!la(e)}const Yu=e=>e==="_"||e==="_ctx"||e==="$stable",Ju=e=>We(e)?e.map(Vr):[Vr(e)],Pv=(e,t,n)=>{if(t._n)return t;const r=bt((...o)=>Ju(t(...o)),n);return r._c=!1,r},_p=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Yu(o))continue;const s=e[o];if(et(s))t[o]=Pv(o,s,r);else if(s!=null){const i=Ju(s);t[o]=()=>i}}},Sp=(e,t)=>{const n=Ju(t);e.slots.default=()=>n},kp=(e,t,n)=>{for(const r in t)(n||!Yu(r))&&(e[r]=t[r])},$v=(e,t,n)=>{const r=e.slots=yp();if(e.vnode.shapeFlag&32){const o=t._;o?(kp(r,t,n),n&&Ef(r,"_",o,!0)):_p(t,r)}else t&&Sp(e,t)},Ov=(e,t,n)=>{const{vnode:r,slots:o}=e;let s=!0,i=Mt;if(r.shapeFlag&32){const l=t._;l?n&&l===1?s=!1:kp(o,t,n):(s=!t.$stable,_p(t,o)),i=t}else t&&(Sp(e,t),i={default:1});if(s)for(const l in o)!Yu(l)&&i[l]==null&&delete o[l]},zn=Fv;function Dv(e){return Lv(e)}function Lv(e,t){const n=Mi();n.__VUE__=!0;const{insert:r,remove:o,patchProp:s,createElement:i,createText:l,createComment:c,setText:p,setElementText:f,parentNode:g,nextSibling:T,setScopeId:k=Gr,insertStaticContent:U}=e,H=(_,A,B,G=null,ne=null,ee=null,le=void 0,fe=null,ce=!!A.dynamicChildren)=>{if(_===A)return;_&&!Yo(_,A)&&(G=Q(_),Je(_,ne,ee,!0),_=null),A.patchFlag===-2&&(ce=!1,A.dynamicChildren=null);const{type:oe,ref:Ae,shapeFlag:ye}=A;switch(oe){case Li:Z(_,A,B,G);break;case Ln:q(_,A,B,G);break;case jl:_==null&&R(A,B,G,le);break;case qe:Y(_,A,B,G,ne,ee,le,fe,ce);break;default:ye&1?de(_,A,B,G,ne,ee,le,fe,ce):ye&6?ve(_,A,B,G,ne,ee,le,fe,ce):(ye&64||ye&128)&&oe.process(_,A,B,G,ne,ee,le,fe,ce,Re)}Ae!=null&&ne?da(Ae,_&&_.ref,ee,A||_,!A):Ae==null&&_&&_.ref!=null&&da(_.ref,null,ee,_,!0)},Z=(_,A,B,G)=>{if(_==null)r(A.el=l(A.children),B,G);else{const ne=A.el=_.el;A.children!==_.children&&p(ne,A.children)}},q=(_,A,B,G)=>{_==null?r(A.el=c(A.children||""),B,G):A.el=_.el},R=(_,A,B,G)=>{[_.el,_.anchor]=U(_.children,A,B,G,_.el,_.anchor)},F=({el:_,anchor:A},B,G)=>{let ne;for(;_&&_!==A;)ne=T(_),r(_,B,G),_=ne;r(A,B,G)},z=({el:_,anchor:A})=>{let B;for(;_&&_!==A;)B=T(_),o(_),_=B;o(A)},de=(_,A,B,G,ne,ee,le,fe,ce)=>{if(A.type==="svg"?le="svg":A.type==="math"&&(le="mathml"),_==null)ue(A,B,G,ne,ee,le,fe,ce);else{const oe=_.el&&_.el._isVueCE?_.el:null;try{oe&&oe._beginPatch(),me(_,A,ne,ee,le,fe,ce)}finally{oe&&oe._endPatch()}}},ue=(_,A,B,G,ne,ee,le,fe)=>{let ce,oe;const{props:Ae,shapeFlag:ye,transition:he,dirs:Oe}=_;if(ce=_.el=i(_.type,ee,Ae&&Ae.is,Ae),ye&8?f(ce,_.children):ye&16&&ke(_.children,ce,null,G,ne,Nl(_,ee),le,fe),Oe&&Uo(_,null,G,"created"),we(ce,_,_.scopeId,le,G),Ae){for(const O in Ae)O!=="value"&&!la(O)&&s(ce,O,null,Ae[O],ee,G);"value"in Ae&&s(ce,"value",null,Ae.value,ee),(oe=Ae.onVnodeBeforeMount)&&Br(oe,G,_)}Oe&&Uo(_,null,G,"beforeMount");const P=Nv(ne,he);P&&he.beforeEnter(ce),r(ce,A,B),((oe=Ae&&Ae.onVnodeMounted)||P||Oe)&&zn(()=>{try{oe&&Br(oe,G,_),P&&he.enter(ce),Oe&&Uo(_,null,G,"mounted")}finally{}},ne)},we=(_,A,B,G,ne)=>{if(B&&k(_,B),G)for(let ee=0;ee<G.length;ee++)k(_,G[ee]);if(ne){let ee=ne.subTree;if(A===ee||Ap(ee.type)&&(ee.ssContent===A||ee.ssFallback===A)){const le=ne.vnode;we(_,le,le.scopeId,le.slotScopeIds,ne.parent)}}},ke=(_,A,B,G,ne,ee,le,fe,ce=0)=>{for(let oe=ce;oe<_.length;oe++){const Ae=_[oe]=fe?oo(_[oe]):Vr(_[oe]);H(null,Ae,A,B,G,ne,ee,le,fe)}},me=(_,A,B,G,ne,ee,le)=>{const fe=A.el=_.el;let{patchFlag:ce,dynamicChildren:oe,dirs:Ae}=A;ce|=_.patchFlag&16;const ye=_.props||Mt,he=A.props||Mt;let Oe;if(B&&qo(B,!1),(Oe=he.onVnodeBeforeUpdate)&&Br(Oe,B,A,_),Ae&&Uo(A,_,B,"beforeUpdate"),B&&qo(B,!0),(ye.innerHTML&&he.innerHTML==null||ye.textContent&&he.textContent==null)&&f(fe,""),oe?Ee(_.dynamicChildren,oe,fe,B,G,Nl(A,ne),ee):le||_e(_,A,fe,null,B,G,Nl(A,ne),ee,!1),ce>0){if(ce&16)$e(fe,ye,he,B,ne);else if(ce&2&&ye.class!==he.class&&s(fe,"class",null,he.class,ne),ce&4&&s(fe,"style",ye.style,he.style,ne),ce&8){const P=A.dynamicProps;for(let O=0;O<P.length;O++){const N=P[O],V=ye[N],te=he[N];(te!==V||N==="value")&&s(fe,N,V,te,ne,B)}}ce&1&&_.children!==A.children&&f(fe,A.children)}else!le&&oe==null&&$e(fe,ye,he,B,ne);((Oe=he.onVnodeUpdated)||Ae)&&zn(()=>{Oe&&Br(Oe,B,A,_),Ae&&Uo(A,_,B,"updated")},G)},Ee=(_,A,B,G,ne,ee,le)=>{for(let fe=0;fe<A.length;fe++){const ce=_[fe],oe=A[fe],Ae=ce.el&&(ce.type===qe||!Yo(ce,oe)||ce.shapeFlag&198)?g(ce.el):B;H(ce,oe,Ae,null,G,ne,ee,le,!0)}},$e=(_,A,B,G,ne)=>{if(A!==B){if(A!==Mt)for(const ee in A)!la(ee)&&!(ee in B)&&s(_,ee,A[ee],null,ne,G);for(const ee in B){if(la(ee))continue;const le=B[ee],fe=A[ee];le!==fe&&ee!=="value"&&s(_,ee,fe,le,ne,G)}"value"in B&&s(_,"value",A.value,B.value,ne)}},Y=(_,A,B,G,ne,ee,le,fe,ce)=>{const oe=A.el=_?_.el:l(""),Ae=A.anchor=_?_.anchor:l("");let{patchFlag:ye,dynamicChildren:he,slotScopeIds:Oe}=A;Oe&&(fe=fe?fe.concat(Oe):Oe),_==null?(r(oe,B,G),r(Ae,B,G),ke(A.children||[],B,Ae,ne,ee,le,fe,ce)):ye>0&&ye&64&&he&&_.dynamicChildren&&_.dynamicChildren.length===he.length?(Ee(_.dynamicChildren,he,B,ne,ee,le,fe),(A.key!=null||ne&&A===ne.subTree)&&Qu(_,A,!0)):_e(_,A,B,Ae,ne,ee,le,fe,ce)},ve=(_,A,B,G,ne,ee,le,fe,ce)=>{A.slotScopeIds=fe,_==null?A.shapeFlag&512?ne.ctx.activate(A,B,G,le,ce):Fe(A,B,G,ne,ee,le,ce):Ne(_,A,ce)},Fe=(_,A,B,G,ne,ee,le)=>{const fe=_.component=Wv(_,G,ne);if(Ea(_)&&(fe.ctx.renderer=Re),zv(fe,!1,le),fe.asyncDep){if(ne&&ne.registerDep(fe,Ie,le),!_.el){const ce=fe.subTree=Be(Ln);q(null,ce,A,B),_.placeholder=ce.el}}else Ie(fe,_,A,B,ne,ee,le)},Ne=(_,A,B)=>{const G=A.component=_.component;if(Av(_,A,B))if(G.asyncDep&&!G.asyncResolved){Te(G,A,B);return}else G.next=A,G.update();else A.el=_.el,G.vnode=A},Ie=(_,A,B,G,ne,ee,le)=>{const fe=()=>{if(_.isMounted){let{next:ye,bu:he,u:Oe,parent:P,vnode:O}=_;{const Pe=xp(_);if(Pe){ye&&(ye.el=O.el,Te(_,ye,le)),Pe.asyncDep.then(()=>{zn(()=>{_.isUnmounted||oe()},ne)});return}}let N=ye,V;qo(_,!1),ye?(ye.el=O.el,Te(_,ye,le)):ye=O,he&&di(he),(V=ye.props&&ye.props.onVnodeBeforeUpdate)&&Br(V,P,ye,O),qo(_,!0);const te=jc(_),be=_.subTree;_.subTree=te,H(be,te,g(be.el),Q(be),_,ne,ee),ye.el=te.el,N===null&&Ev(_,te.el),Oe&&zn(Oe,ne),(V=ye.props&&ye.props.onVnodeUpdated)&&zn(()=>Br(V,P,ye,O),ne)}else{let ye;const{el:he,props:Oe}=A,{bm:P,m:O,parent:N,root:V,type:te}=_,be=xs(A);qo(_,!1),P&&di(P),!be&&(ye=Oe&&Oe.onVnodeBeforeMount)&&Br(ye,N,A),qo(_,!0);{V.ce&&V.ce._hasShadowRoot()&&V.ce._injectChildStyle(te,_.parent?_.parent.type:void 0);const Pe=_.subTree=jc(_);H(null,Pe,B,G,_,ne,ee),A.el=Pe.el}if(O&&zn(O,ne),!be&&(ye=Oe&&Oe.onVnodeMounted)){const Pe=A;zn(()=>Br(ye,N,Pe),ne)}(A.shapeFlag&256||N&&xs(N.vnode)&&N.vnode.shapeFlag&256)&&_.a&&zn(_.a,ne),_.isMounted=!0,A=B=G=null}};_.scope.on();const ce=_.effect=new Pf(fe);_.scope.off();const oe=_.update=ce.run.bind(ce),Ae=_.job=ce.runIfDirty.bind(ce);Ae.i=_,Ae.id=_.uid,ce.scheduler=()=>zu(Ae),qo(_,!0),oe()},Te=(_,A,B)=>{A.component=_;const G=_.vnode.props;_.vnode=A,_.next=null,Mv(_,A.props,G,B),Ov(_,A.children,B),fo(),Cc(_),po()},_e=(_,A,B,G,ne,ee,le,fe,ce=!1)=>{const oe=_&&_.children,Ae=_?_.shapeFlag:0,ye=A.children,{patchFlag:he,shapeFlag:Oe}=A;if(he>0){if(he&128){Ke(oe,ye,B,G,ne,ee,le,fe,ce);return}else if(he&256){He(oe,ye,B,G,ne,ee,le,fe,ce);return}}Oe&8?(Ae&16&&je(oe,ne,ee),ye!==oe&&f(B,ye)):Ae&16?Oe&16?Ke(oe,ye,B,G,ne,ee,le,fe,ce):je(oe,ne,ee,!0):(Ae&8&&f(B,""),Oe&16&&ke(ye,B,G,ne,ee,le,fe,ce))},He=(_,A,B,G,ne,ee,le,fe,ce)=>{_=_||_s,A=A||_s;const oe=_.length,Ae=A.length,ye=Math.min(oe,Ae);let he;for(he=0;he<ye;he++){const Oe=A[he]=ce?oo(A[he]):Vr(A[he]);H(_[he],Oe,B,null,ne,ee,le,fe,ce)}oe>Ae?je(_,ne,ee,!0,!1,ye):ke(A,B,G,ne,ee,le,fe,ce,ye)},Ke=(_,A,B,G,ne,ee,le,fe,ce)=>{let oe=0;const Ae=A.length;let ye=_.length-1,he=Ae-1;for(;oe<=ye&&oe<=he;){const Oe=_[oe],P=A[oe]=ce?oo(A[oe]):Vr(A[oe]);if(Yo(Oe,P))H(Oe,P,B,null,ne,ee,le,fe,ce);else break;oe++}for(;oe<=ye&&oe<=he;){const Oe=_[ye],P=A[he]=ce?oo(A[he]):Vr(A[he]);if(Yo(Oe,P))H(Oe,P,B,null,ne,ee,le,fe,ce);else break;ye--,he--}if(oe>ye){if(oe<=he){const Oe=he+1,P=Oe<Ae?A[Oe].el:G;for(;oe<=he;)H(null,A[oe]=ce?oo(A[oe]):Vr(A[oe]),B,P,ne,ee,le,fe,ce),oe++}}else if(oe>he)for(;oe<=ye;)Je(_[oe],ne,ee,!0),oe++;else{const Oe=oe,P=oe,O=new Map;for(oe=P;oe<=he;oe++){const nt=A[oe]=ce?oo(A[oe]):Vr(A[oe]);nt.key!=null&&O.set(nt.key,oe)}let N,V=0;const te=he-P+1;let be=!1,Pe=0;const at=new Array(te);for(oe=0;oe<te;oe++)at[oe]=0;for(oe=Oe;oe<=ye;oe++){const nt=_[oe];if(V>=te){Je(nt,ne,ee,!0);continue}let Ot;if(nt.key!=null)Ot=O.get(nt.key);else for(N=P;N<=he;N++)if(at[N-P]===0&&Yo(nt,A[N])){Ot=N;break}Ot===void 0?Je(nt,ne,ee,!0):(at[Ot-P]=oe+1,Ot>=Pe?Pe=Ot:be=!0,H(nt,A[Ot],B,null,ne,ee,le,fe,ce),V++)}const ut=be?jv(at):_s;for(N=ut.length-1,oe=te-1;oe>=0;oe--){const nt=P+oe,Ot=A[nt],Rt=A[nt+1],Fn=nt+1<Ae?Rt.el||Cp(Rt):G;at[oe]===0?H(null,Ot,B,Fn,ne,ee,le,fe,ce):be&&(N<0||oe!==ut[N]?Ve(Ot,B,Fn,2):N--)}}},Ve=(_,A,B,G,ne=null)=>{const{el:ee,type:le,transition:fe,children:ce,shapeFlag:oe}=_;if(oe&6){Ve(_.component.subTree,A,B,G);return}if(oe&128){_.suspense.move(A,B,G);return}if(oe&64){le.move(_,A,B,Re);return}if(le===qe){r(ee,A,B);for(let ye=0;ye<ce.length;ye++)Ve(ce[ye],A,B,G);r(_.anchor,A,B);return}if(le===jl){F(_,A,B);return}if(G!==2&&oe&1&&fe)if(G===0)fe.beforeEnter(ee),r(ee,A,B),zn(()=>fe.enter(ee),ne);else{const{leave:ye,delayLeave:he,afterLeave:Oe}=fe,P=()=>{_.ctx.isUnmounted?o(ee):r(ee,A,B)},O=()=>{ee._isLeaving&&ee[qr](!0),ye(ee,()=>{P(),Oe&&Oe()})};he?he(ee,P,O):O()}else r(ee,A,B)},Je=(_,A,B,G=!1,ne=!1)=>{const{type:ee,props:le,ref:fe,children:ce,dynamicChildren:oe,shapeFlag:Ae,patchFlag:ye,dirs:he,cacheIndex:Oe,memo:P}=_;if(ye===-2&&(ne=!1),fe!=null&&(fo(),da(fe,null,B,_,!0),po()),Oe!=null&&(A.renderCache[Oe]=void 0),Ae&256){A.ctx.deactivate(_);return}const O=Ae&1&&he,N=!xs(_);let V;if(N&&(V=le&&le.onVnodeBeforeUnmount)&&Br(V,A,_),Ae&6)kt(_.component,B,G);else{if(Ae&128){_.suspense.unmount(B,G);return}O&&Uo(_,null,A,"beforeUnmount"),Ae&64?_.type.remove(_,A,B,Re,G):oe&&!oe.hasOnce&&(ee!==qe||ye>0&&ye&64)?je(oe,A,B,!1,!0):(ee===qe&&ye&384||!ne&&Ae&16)&&je(ce,A,B),G&&mt(_)}const te=P!=null&&Oe==null;(N&&(V=le&&le.onVnodeUnmounted)||O||te)&&zn(()=>{V&&Br(V,A,_),O&&Uo(_,null,A,"unmounted"),te&&(_.el=null)},B)},mt=_=>{const{type:A,el:B,anchor:G,transition:ne}=_;if(A===qe){Xe(B,G);return}if(A===jl){z(_);return}const ee=()=>{o(B),ne&&!ne.persisted&&ne.afterLeave&&ne.afterLeave()};if(_.shapeFlag&1&&ne&&!ne.persisted){const{leave:le,delayLeave:fe}=ne,ce=()=>le(B,ee);fe?fe(_.el,ee,ce):ce()}else ee()},Xe=(_,A)=>{let B;for(;_!==A;)B=T(_),o(_),_=B;o(A)},kt=(_,A,B)=>{const{bum:G,scope:ne,job:ee,subTree:le,um:fe,m:ce,a:oe}=_;Uc(ce),Uc(oe),G&&di(G),ne.stop(),ee&&(ee.flags|=8,Je(le,_,A,B)),fe&&zn(fe,A),zn(()=>{_.isUnmounted=!0},A)},je=(_,A,B,G=!1,ne=!1,ee=0)=>{for(let le=ee;le<_.length;le++)Je(_[le],A,B,G,ne)},Q=_=>{if(_.shapeFlag&6)return Q(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const A=T(_.anchor||_.el),B=A&&A[np];return B?T(B):A};let pe=!1;const ge=(_,A,B)=>{let G;_==null?A._vnode&&(Je(A._vnode,null,null,!0),G=A._vnode.component):H(A._vnode||null,_,A,null,null,null,B),A._vnode=_,pe||(pe=!0,Cc(G),Qf(),pe=!1)},Re={p:H,um:Je,m:Ve,r:mt,mt:Fe,mc:ke,pc:_e,pbc:Ee,n:Q,o:e};return{render:ge,hydrate:void 0,createApp:Tv(ge)}}function Nl({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 qo({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Nv(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Qu(e,t,n=!1){const r=e.children,o=t.children;if(We(r)&&We(o))for(let s=0;s<r.length;s++){const i=r[s];let l=o[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=o[s]=oo(o[s]),l.el=i.el),!n&&l.patchFlag!==-2&&Qu(i,l)),l.type===Li&&(l.patchFlag===-1&&(l=o[s]=oo(l)),l.el=i.el),l.type===Ln&&!l.el&&(l.el=i.el)}}function jv(e){const t=e.slice(),n=[0];let r,o,s,i,l;const c=e.length;for(r=0;r<c;r++){const p=e[r];if(p!==0){if(o=n[n.length-1],e[o]<p){t[r]=o,n.push(r);continue}for(s=0,i=n.length-1;s<i;)l=s+i>>1,e[n[l]]<p?s=l+1:i=l;p<e[n[s]]&&(s>0&&(t[r]=n[s-1]),n[s]=r)}}for(s=n.length,i=n[s-1];s-- >0;)n[s]=i,i=t[i];return n}function xp(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:xp(t)}function Uc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Cp(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Cp(t.subTree):null}const Ap=e=>e.__isSuspense;function Fv(e,t){t&&t.pendingBranch?We(e)?t.effects.push(...e):t.effects.push(e):Hm(e)}const qe=Symbol.for("v-fgt"),Li=Symbol.for("v-txt"),Ln=Symbol.for("v-cmt"),jl=Symbol.for("v-stc"),pa=[];let dr=null;function S(e=!1){pa.push(dr=e?null:[])}function Bv(){pa.pop(),dr=pa[pa.length-1]||null}let ba=1;function bi(e,t=!1){ba+=e,e<0&&dr&&t&&(dr.hasOnce=!0)}function Ep(e){return e.dynamicChildren=ba>0?dr||_s:null,Bv(),ba>0&&dr&&dr.push(e),e}function $(e,t,n,r,o,s){return Ep(v(e,t,n,r,o,s,!0))}function st(e,t,n,r,o){return Ep(Be(e,t,n,r,o,!0))}function Ta(e){return e?e.__v_isVNode===!0:!1}function Yo(e,t){return e.type===t.type&&e.key===t.key}const Ip=({key:e})=>e??null,pi=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Lt(e)||Nn(e)||et(e)?{i:xn,r:e,k:t,f:!!n}:e:null);function v(e,t=null,n=null,r=0,o=null,s=e===qe?0:1,i=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ip(t),ref:t&&pi(t),scopeId:Zf,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:s,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:xn};return l?(Xu(c,n),s&128&&e.normalize(c)):n&&(c.shapeFlag|=Lt(n)?8:16),ba>0&&!i&&dr&&(c.patchFlag>0||s&6)&&c.patchFlag!==32&&dr.push(c),c}const Be=Uv;function Uv(e,t=null,n=null,r=0,o=null,s=!1){if((!e||e===cp)&&(e=Ln),Ta(e)){const l=Po(e,t,!0);return n&&Xu(l,n),ba>0&&!s&&dr&&(l.shapeFlag&6?dr[dr.indexOf(e)]=l:dr.push(l)),l.patchFlag=-2,l}if(Jv(e)&&(e=e.__vccOpts),t){t=qv(t);let{class:l,style:c}=t;l&&!Lt(l)&&(t.class=ot(l)),St(c)&&(Wu(c)&&!We(c)&&(c=fn({},c)),t.style=io(c))}const i=Lt(e)?1:Ap(e)?128:rp(e)?64:St(e)?4:et(e)?2:0;return v(e,t,n,r,o,i,s,!0)}function qv(e){return e?Wu(e)||wp(e)?fn({},e):e:null}function Po(e,t,n=!1,r=!1){const{props:o,ref:s,patchFlag:i,children:l,transition:c}=e,p=t?Mp(o||{},t):o,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:p,key:p&&Ip(p),ref:t&&t.ref?n&&s?We(s)?s.concat(pi(t)):[s,pi(t)]:pi(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==qe?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Po(e.ssContent),ssFallback:e.ssFallback&&Po(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&wa(f,c.clone(f)),f}function lo(e=" ",t=0){return Be(Li,null,e,t)}function ie(e="",t=!1){return t?(S(),st(Ln,null,e)):Be(Ln,null,e)}function Vr(e){return e==null||typeof e=="boolean"?Be(Ln):We(e)?Be(qe,null,e.slice()):Ta(e)?oo(e):Be(Li,null,String(e))}function oo(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Po(e)}function Xu(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(We(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Xu(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!wp(t)?t._ctx=xn:o===3&&xn&&(xn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else et(t)?(t={default:t,_ctx:xn},n=32):(t=String(t),r&64?(n=16,t=[lo(t)]):n=8);e.children=t,e.shapeFlag|=n}function Mp(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=ot([t.class,r.class]));else if(o==="style")t.style=io([t.style,r.style]);else if(xi(o)){const s=t[o],i=r[o];i&&s!==i&&!(We(s)&&s.includes(i))?t[o]=s?[].concat(s,i):i:i==null&&s==null&&!Ci(o)&&(t[o]=i)}else o!==""&&(t[o]=r[o])}return t}function Br(e,t,n,r=null){Pr(e,t,7,[n,r])}const Hv=hp();let Vv=0;function Wv(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Hv,s={uid:Vv++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new pm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Tp(r,o),emitsOptions:mp(r,o),emit:null,emitted:null,propsDefaults:Mt,inheritAttrs:r.inheritAttrs,ctx:Mt,data:Mt,props:Mt,attrs:Mt,slots:Mt,refs:Mt,setupState:Mt,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 s.ctx={_:s},s.root=t?t.root:s,s.emit=Sv.bind(null,s),e.ce&&e.ce(s),s}let kn=null;const Zu=()=>kn||xn;let Ti,Tu;{const e=Mi(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),s=>{o.length>1?o.forEach(i=>i(s)):o[0](s)}};Ti=t("__VUE_INSTANCE_SETTERS__",n=>kn=n),Tu=t("__VUE_SSR_SETTERS__",n=>Es=n)}const Ia=e=>{const t=kn;return Ti(e),e.scope.on(),()=>{e.scope.off(),Ti(t)}},qc=()=>{kn&&kn.scope.off(),Ti(null)};function Rp(e){return e.vnode.shapeFlag&4}let Es=!1;function zv(e,t=!1,n=!1){t&&Tu(t);const{props:r,children:o}=e.vnode,s=Rp(e);Iv(e,r,s,t),$v(e,o,n||t);const i=s?Gv(e,t):void 0;return t&&Tu(!1),i}function Gv(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,fv);const{setup:r}=n;if(r){fo();const o=e.setupContext=r.length>1?$p(e):null,s=Ia(e),i=Ca(r,e,0,[e.props,o]),l=xf(i);if(po(),s(),(l||e.sp)&&!xs(e)&&Gu(e),l){if(i.then(qc,qc),t)return i.then(c=>{Hc(e,c)}).catch(c=>{Aa(c,e,0)});e.asyncDep=i}else Hc(e,i)}else Pp(e)}function Hc(e,t,n){et(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:St(t)&&(e.setupState=Kf(t)),Pp(e)}function Pp(e,t,n){const r=e.type;e.render||(e.render=r.render||Gr);{const o=Ia(e);fo();try{mv(e)}finally{po(),o()}}}const Kv={get(e,t){return Dn(e,"get",""),e[t]}};function $p(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Kv),slots:e.slots,emit:e.emit,expose:t}}function Ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Kf($m(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in fa)return fa[n](e)},has(t,n){return n in t||n in fa}})):e.proxy}function Yv(e,t=!0){return et(e)?e.displayName||e.name:e.name||t&&e.__name}function Jv(e){return et(e)&&"__vccOpts"in e}const re=(e,t)=>jm(e,t,Es);function ec(e,t,n){try{bi(-1);const r=arguments.length;return r===2?St(t)&&!We(t)?Ta(t)?Be(e,null,[t]):Be(e,t):Be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ta(n)&&(n=[n]),Be(e,t,n))}finally{bi(1)}}const Qv="3.5.33";/**
15
- * @vue/runtime-dom v3.5.33
16
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
- * @license MIT
18
- **/let _u;const Vc=typeof window<"u"&&window.trustedTypes;if(Vc)try{_u=Vc.createPolicy("vue",{createHTML:e=>e})}catch{}const Op=_u?e=>_u.createHTML(e):e=>e,Xv="http://www.w3.org/2000/svg",Zv="http://www.w3.org/1998/Math/MathML",ro=typeof document<"u"?document:null,Wc=ro&&ro.createElement("template"),eg={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 o=t==="svg"?ro.createElementNS(Xv,e):t==="mathml"?ro.createElementNS(Zv,e):n?ro.createElement(e,{is:n}):ro.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>ro.createTextNode(e),createComment:e=>ro.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ro.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,s){const i=n?n.previousSibling:t.lastChild;if(o&&(o===s||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===s||!(o=o.nextSibling)););else{Wc.innerHTML=Op(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=Wc.content;if(r==="svg"||r==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},_o="transition",ta="animation",_a=Symbol("_vtc"),Dp={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},tg=fn({},op,Dp),ng=e=>(e.displayName="Transition",e.props=tg,e),Lp=ng((e,{slots:t})=>ec(Xm,rg(e),t)),Ho=(e,t=[])=>{We(e)?e.forEach(n=>n(...t)):e&&e(...t)},zc=e=>e?We(e)?e.some(t=>t.length>1):e.length>1:!1;function rg(e){const t={};for(const Y in e)Y in Dp||(t[Y]=e[Y]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:s=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=s,appearActiveClass:p=i,appearToClass:f=l,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:T=`${n}-leave-active`,leaveToClass:k=`${n}-leave-to`}=e,U=og(o),H=U&&U[0],Z=U&&U[1],{onBeforeEnter:q,onEnter:R,onEnterCancelled:F,onLeave:z,onLeaveCancelled:de,onBeforeAppear:ue=q,onAppear:we=R,onAppearCancelled:ke=F}=t,me=(Y,ve,Fe,Ne)=>{Y._enterCancelled=Ne,Vo(Y,ve?f:l),Vo(Y,ve?p:i),Fe&&Fe()},Ee=(Y,ve)=>{Y._isLeaving=!1,Vo(Y,g),Vo(Y,k),Vo(Y,T),ve&&ve()},$e=Y=>(ve,Fe)=>{const Ne=Y?we:R,Ie=()=>me(ve,Y,Fe);Ho(Ne,[ve,Ie]),Gc(()=>{Vo(ve,Y?c:s),to(ve,Y?f:l),zc(Ne)||Kc(ve,r,H,Ie)})};return fn(t,{onBeforeEnter(Y){Ho(q,[Y]),to(Y,s),to(Y,i)},onBeforeAppear(Y){Ho(ue,[Y]),to(Y,c),to(Y,p)},onEnter:$e(!1),onAppear:$e(!0),onLeave(Y,ve){Y._isLeaving=!0;const Fe=()=>Ee(Y,ve);to(Y,g),Y._enterCancelled?(to(Y,T),Qc(Y)):(Qc(Y),to(Y,T)),Gc(()=>{Y._isLeaving&&(Vo(Y,g),to(Y,k),zc(z)||Kc(Y,r,Z,Fe))}),Ho(z,[Y,Fe])},onEnterCancelled(Y){me(Y,!1,void 0,!0),Ho(F,[Y])},onAppearCancelled(Y){me(Y,!0,void 0,!0),Ho(ke,[Y])},onLeaveCancelled(Y){Ee(Y),Ho(de,[Y])}})}function og(e){if(e==null)return null;if(St(e))return[Fl(e.enter),Fl(e.leave)];{const t=Fl(e);return[t,t]}}function Fl(e){return sm(e)}function to(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[_a]||(e[_a]=new Set)).add(t)}function Vo(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[_a];n&&(n.delete(t),n.size||(e[_a]=void 0))}function Gc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let sg=0;function Kc(e,t,n,r){const o=e._endId=++sg,s=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(s,n);const{type:i,timeout:l,propCount:c}=ag(e,t);if(!i)return r();const p=i+"end";let f=0;const g=()=>{e.removeEventListener(p,T),s()},T=k=>{k.target===e&&++f>=c&&g()};setTimeout(()=>{f<c&&g()},l+1),e.addEventListener(p,T)}function ag(e,t){const n=window.getComputedStyle(e),r=U=>(n[U]||"").split(", "),o=r(`${_o}Delay`),s=r(`${_o}Duration`),i=Yc(o,s),l=r(`${ta}Delay`),c=r(`${ta}Duration`),p=Yc(l,c);let f=null,g=0,T=0;t===_o?i>0&&(f=_o,g=i,T=s.length):t===ta?p>0&&(f=ta,g=p,T=c.length):(g=Math.max(i,p),f=g>0?i>p?_o:ta:null,T=f?f===_o?s.length:c.length:0);const k=f===_o&&/\b(?:transform|all)(?:,|$)/.test(r(`${_o}Property`).toString());return{type:f,timeout:g,propCount:T,hasTransform:k}}function Yc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Jc(n)+Jc(e[r])))}function Jc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Qc(e){return(e?e.ownerDocument:document).body.offsetHeight}function ig(e,t,n){const r=e[_a];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Xc=Symbol("_vod"),lg=Symbol("_vsh"),ug=Symbol(""),cg=/(?:^|;)\s*display\s*:/;function dg(e,t,n){const r=e.style,o=Lt(n);let s=!1;if(n&&!o){if(t)if(Lt(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&ia(r,l,"")}else for(const i in t)n[i]==null&&ia(r,i,"");for(const i in n){i==="display"&&(s=!0);const l=n[i];l!=null?pg(e,i,!Lt(t)&&t?t[i]:void 0,l)||ia(r,i,l):ia(r,i,"")}}else if(o){if(t!==n){const i=r[ug];i&&(n+=";"+i),r.cssText=n,s=cg.test(n)}}else t&&e.removeAttribute("style");Xc in e&&(e[Xc]=s?r.display:"",e[lg]&&(r.display="none"))}const Zc=/\s*!important$/;function ia(e,t,n){if(We(n))n.forEach(r=>ia(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=fg(e,t);Zc.test(n)?e.setProperty($o(r),n.replace(Zc,""),"important"):e[r]=n}}const ed=["Webkit","Moz","ms"],Bl={};function fg(e,t){const n=Bl[t];if(n)return n;let r=Yn(t);if(r!=="filter"&&r in e)return Bl[t]=r;r=Ei(r);for(let o=0;o<ed.length;o++){const s=ed[o]+r;if(s in e)return Bl[t]=s}return t}function pg(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Lt(r)&&n===r}const td="http://www.w3.org/1999/xlink";function nd(e,t,n,r,o,s=dm(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(td,t.slice(6,t.length)):e.setAttributeNS(td,t,n):n==null||s&&!If(n)?e.removeAttribute(t):e.setAttribute(t,s?"":Mr(n)?String(n):n)}function rd(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Op(n):n);return}const s=e.tagName;if(t==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=If(n):n==null&&l==="string"?(n="",i=!0):l==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(o||t)}function Mo(e,t,n,r){e.addEventListener(t,n,r)}function hg(e,t,n,r){e.removeEventListener(t,n,r)}const od=Symbol("_vei");function mg(e,t,n,r,o=null){const s=e[od]||(e[od]={}),i=s[t];if(r&&i)i.value=r;else{const[l,c]=vg(t);if(r){const p=s[t]=wg(r,o);Mo(e,l,p,c)}else i&&(hg(e,l,i,c),s[t]=void 0)}}const sd=/(?:Once|Passive|Capture)$/;function vg(e){let t;if(sd.test(e)){t={};let r;for(;r=e.match(sd);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):$o(e.slice(2)),t]}let Ul=0;const gg=Promise.resolve(),yg=()=>Ul||(gg.then(()=>Ul=0),Ul=Date.now());function wg(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Pr(bg(r,n.value),t,5,[r])};return n.value=e,n.attached=yg(),n}function bg(e,t){if(We(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}const ad=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Tg=(e,t,n,r,o,s)=>{const i=o==="svg";t==="class"?ig(e,r,i):t==="style"?dg(e,n,r):xi(t)?Ci(t)||mg(e,t,n,r,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):_g(e,t,r,i))?(rd(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&nd(e,t,r,i,s,t!=="value")):e._isVueCE&&(Sg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Lt(r)))?rd(e,Yn(t),r,s,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),nd(e,t,r,i))};function _g(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&ad(t)&&et(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 o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return ad(t)&&Lt(n)?!1:t in e}function Sg(e,t){const n=e._def.props;if(!n)return!1;const r=Yn(t);return Array.isArray(n)?n.some(o=>Yn(o)===r):Object.keys(n).some(o=>Yn(o)===r)}const Is=e=>{const t=e.props["onUpdate:modelValue"]||!1;return We(t)?n=>di(t,n):t};function kg(e){e.target.composing=!0}function id(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const uo=Symbol("_assign");function ld(e,t,n){return t&&(e=e.trim()),n&&(e=Ii(e)),e}const yn={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[uo]=Is(o);const s=r||o.props&&o.props.type==="number";Mo(e,t?"change":"input",i=>{i.target.composing||e[uo](ld(e.value,n,s))}),(n||s)&&Mo(e,"change",()=>{e.value=ld(e.value,n,s)}),t||(Mo(e,"compositionstart",kg),Mo(e,"compositionend",id),Mo(e,"change",id))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:s}},i){if(e[uo]=Is(i),e.composing)return;const l=(s||e.type==="number")&&!/^0\d/.test(e.value)?Ii(e.value):e.value,c=t??"";if(l===c)return;const p=e.getRootNode();(p instanceof Document||p instanceof ShadowRoot)&&p.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===c)||(e.value=c)}},xg={deep:!0,created(e,t,n){e[uo]=Is(n),Mo(e,"change",()=>{const r=e._modelValue,o=Sa(e),s=e.checked,i=e[uo];if(We(r)){const l=ju(r,o),c=l!==-1;if(s&&!c)i(r.concat(o));else if(!s&&c){const p=[...r];p.splice(l,1),i(p)}}else if(Os(r)){const l=new Set(r);s?l.add(o):l.delete(o),i(l)}else i(Np(e,s))})},mounted:ud,beforeUpdate(e,t,n){e[uo]=Is(n),ud(e,t,n)}};function ud(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(We(t))o=ju(t,r.props.value)>-1;else if(Os(t))o=t.has(r.props.value);else{if(t===n)return;o=Ds(t,Np(e,!0))}e.checked!==o&&(e.checked=o)}const Cg={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=Os(t);Mo(e,"change",()=>{const s=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Ii(Sa(i)):Sa(i));e[uo](e.multiple?o?new Set(s):s:s[0]),e._assigning=!0,Gt(()=>{e._assigning=!1})}),e[uo]=Is(r)},mounted(e,{value:t}){cd(e,t)},beforeUpdate(e,t,n){e[uo]=Is(n)},updated(e,{value:t}){e._assigning||cd(e,t)}};function cd(e,t){const n=e.multiple,r=We(t);if(!(n&&!r&&!Os(t))){for(let o=0,s=e.options.length;o<s;o++){const i=e.options[o],l=Sa(i);if(n)if(r){const c=typeof l;c==="string"||c==="number"?i.selected=t.some(p=>String(p)===String(l)):i.selected=ju(t,l)>-1}else i.selected=t.has(l);else if(Ds(Sa(i),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Sa(e){return"_value"in e?e._value:e.value}function Np(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Ag=["ctrl","shift","alt","meta"],Eg={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)=>Ag.some(n=>e[`${n}Key`]&&!t.includes(n))},lt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...s)=>{for(let i=0;i<t.length;i++){const l=Eg[t[i]];if(l&&l(o,t))return}return e(o,...s)}))},Ig={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},zt=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const s=$o(o.key);if(t.some(i=>i===s||Ig[i]===s))return e(o)}))},Mg=fn({patchProp:Tg},eg);let dd;function Rg(){return dd||(dd=Dv(Mg))}const Pg=((...e)=>{const t=Rg().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Og(r);if(!o)return;const s=t._component;!et(s)&&!s.render&&!s.template&&(s.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const i=n(o,!1,$g(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.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 Og(e){return Lt(e)?document.querySelector(e):e}const Dg="modulepreload",Lg=function(e){return"/"+e},fd={},ri=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let i=function(p){return Promise.all(p.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=i(n.map(p=>{if(p=Lg(p),p in fd)return;fd[p]=!0;const f=p.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const T=document.createElement("link");if(T.rel=f?"stylesheet":Dg,f||(T.as="script"),T.crossOrigin="",T.href=p,c&&T.setAttribute("nonce",c),document.head.appendChild(T),f)return new Promise((k,U)=>{T.addEventListener("load",k),T.addEventListener("error",()=>U(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return o.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};/*!
19
- * vue-router v4.6.4
20
- * (c) 2025 Eduardo San Martin Morote
21
- * @license MIT
22
- */const gs=typeof document<"u";function jp(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Ng(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&jp(e.default)}const Tt=Object.assign;function ql(e,t){const n={};for(const r in t){const o=t[r];n[r]=$r(o)?o.map(e):e(o)}return n}const ha=()=>{},$r=Array.isArray;function pd(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Fp=/#/g,jg=/&/g,Fg=/\//g,Bg=/=/g,Ug=/\?/g,Bp=/\+/g,qg=/%5B/g,Hg=/%5D/g,Up=/%5E/g,Vg=/%60/g,qp=/%7B/g,Wg=/%7C/g,Hp=/%7D/g,zg=/%20/g;function tc(e){return e==null?"":encodeURI(""+e).replace(Wg,"|").replace(qg,"[").replace(Hg,"]")}function Gg(e){return tc(e).replace(qp,"{").replace(Hp,"}").replace(Up,"^")}function Su(e){return tc(e).replace(Bp,"%2B").replace(zg,"+").replace(Fp,"%23").replace(jg,"%26").replace(Vg,"`").replace(qp,"{").replace(Hp,"}").replace(Up,"^")}function Kg(e){return Su(e).replace(Bg,"%3D")}function Yg(e){return tc(e).replace(Fp,"%23").replace(Ug,"%3F")}function Jg(e){return Yg(e).replace(Fg,"%2F")}function ka(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Qg=/\/$/,Xg=e=>e.replace(Qg,"");function Hl(e,t,n="/"){let r,o={},s="",i="";const l=t.indexOf("#");let c=t.indexOf("?");return c=l>=0&&c>l?-1:c,c>=0&&(r=t.slice(0,c),s=t.slice(c,l>0?l:t.length),o=e(s.slice(1))),l>=0&&(r=r||t.slice(0,l),i=t.slice(l,t.length)),r=ny(r??t,n),{fullPath:r+s+i,path:r,query:o,hash:ka(i)}}function Zg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function hd(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function ey(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&Ms(t.matched[r],n.matched[o])&&Vp(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ms(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Vp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!ty(e[n],t[n]))return!1;return!0}function ty(e,t){return $r(e)?md(e,t):$r(t)?md(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function md(e,t){return $r(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function ny(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let s=n.length-1,i,l;for(i=0;i<r.length;i++)if(l=r[i],l!==".")if(l==="..")s>1&&s--;else break;return n.slice(0,s).join("/")+"/"+r.slice(i).join("/")}const So={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let ku=(function(e){return e.pop="pop",e.push="push",e})({}),Vl=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function ry(e){if(!e)if(gs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Xg(e)}const oy=/^[^#]+#/;function sy(e,t){return e.replace(oy,"#")+t}function ay(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 ji=()=>({left:window.scrollX,top:window.scrollY});function iy(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=ay(o,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 vd(e,t){return(history.state?history.state.position-t:-1)+e}const xu=new Map;function ly(e,t){xu.set(e,t)}function uy(e){const t=xu.get(e);return xu.delete(e),t}function cy(e){return typeof e=="string"||e&&typeof e=="object"}function Wp(e){return typeof e=="string"||typeof e=="symbol"}let Wt=(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 zp=Symbol("");Wt.MATCHER_NOT_FOUND+"",Wt.NAVIGATION_GUARD_REDIRECT+"",Wt.NAVIGATION_ABORTED+"",Wt.NAVIGATION_CANCELLED+"",Wt.NAVIGATION_DUPLICATED+"";function Rs(e,t){return Tt(new Error,{type:e,[zp]:!0},t)}function no(e,t){return e instanceof Error&&zp in e&&(t==null||!!(e.type&t))}const dy=["params","query","hash"];function fy(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of dy)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function py(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 o=n[r].replace(Bp," "),s=o.indexOf("="),i=ka(s<0?o:o.slice(0,s)),l=s<0?null:ka(o.slice(s+1));if(i in t){let c=t[i];$r(c)||(c=t[i]=[c]),c.push(l)}else t[i]=l}return t}function gd(e){let t="";for(let n in e){const r=e[n];if(n=Kg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}($r(r)?r.map(o=>o&&Su(o)):[r&&Su(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function hy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=$r(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const my=Symbol(""),yd=Symbol(""),Fi=Symbol(""),nc=Symbol(""),Cu=Symbol("");function na(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Eo(e,t,n,r,o,s=i=>i()){const i=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((l,c)=>{const p=T=>{T===!1?c(Rs(Wt.NAVIGATION_ABORTED,{from:n,to:t})):T instanceof Error?c(T):cy(T)?c(Rs(Wt.NAVIGATION_GUARD_REDIRECT,{from:t,to:T})):(i&&r.enterCallbacks[o]===i&&typeof T=="function"&&i.push(T),l())},f=s(()=>e.call(r&&r.instances[o],t,n,p));let g=Promise.resolve(f);e.length<3&&(g=g.then(p)),g.catch(T=>c(T))})}function Wl(e,t,n,r,o=s=>s()){const s=[];for(const i of e)for(const l in i.components){let c=i.components[l];if(!(t!=="beforeRouteEnter"&&!i.instances[l]))if(jp(c)){const p=(c.__vccOpts||c)[t];p&&s.push(Eo(p,n,r,i,l,o))}else{let p=c();s.push(()=>p.then(f=>{if(!f)throw new Error(`Couldn't resolve component "${l}" at "${i.path}"`);const g=Ng(f)?f.default:f;i.mods[l]=f,i.components[l]=g;const T=(g.__vccOpts||g)[t];return T&&Eo(T,n,r,i,l,o)()}))}}return s}function vy(e,t){const n=[],r=[],o=[],s=Math.max(t.matched.length,e.matched.length);for(let i=0;i<s;i++){const l=t.matched[i];l&&(e.matched.find(p=>Ms(p,l))?r.push(l):n.push(l));const c=e.matched[i];c&&(t.matched.find(p=>Ms(p,c))||o.push(c))}return[n,r,o]}/*!
23
- * vue-router v4.6.4
24
- * (c) 2025 Eduardo San Martin Morote
25
- * @license MIT
26
- */let gy=()=>location.protocol+"//"+location.host;function Gp(e,t){const{pathname:n,search:r,hash:o}=t,s=e.indexOf("#");if(s>-1){let i=o.includes(e.slice(s))?e.slice(s).length:1,l=o.slice(i);return l[0]!=="/"&&(l="/"+l),hd(l,"")}return hd(n,e)+r+o}function yy(e,t,n,r){let o=[],s=[],i=null;const l=({state:T})=>{const k=Gp(e,location),U=n.value,H=t.value;let Z=0;if(T){if(n.value=k,t.value=T,i&&i===U){i=null;return}Z=H?T.position-H.position:0}else r(k);o.forEach(q=>{q(n.value,U,{delta:Z,type:ku.pop,direction:Z?Z>0?Vl.forward:Vl.back:Vl.unknown})})};function c(){i=n.value}function p(T){o.push(T);const k=()=>{const U=o.indexOf(T);U>-1&&o.splice(U,1)};return s.push(k),k}function f(){if(document.visibilityState==="hidden"){const{history:T}=window;if(!T.state)return;T.replaceState(Tt({},T.state,{scroll:ji()}),"")}}function g(){for(const T of s)T();s=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",f),document.addEventListener("visibilitychange",f),{pauseListeners:c,listen:p,destroy:g}}function wd(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?ji():null}}function wy(e){const{history:t,location:n}=window,r={value:Gp(e,n)},o={value:t.state};o.value||s(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function s(c,p,f){const g=e.indexOf("#"),T=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+c:gy()+e+c;try{t[f?"replaceState":"pushState"](p,"",T),o.value=p}catch(k){console.error(k),n[f?"replace":"assign"](T)}}function i(c,p){s(c,Tt({},t.state,wd(o.value.back,c,o.value.forward,!0),p,{position:o.value.position}),!0),r.value=c}function l(c,p){const f=Tt({},o.value,t.state,{forward:c,scroll:ji()});s(f.current,f,!0),s(c,Tt({},wd(r.value,c,null),{position:f.position+1},p),!1),r.value=c}return{location:r,state:o,push:l,replace:i}}function by(e){e=ry(e);const t=wy(e),n=yy(e,t.state,t.location,t.replace);function r(s,i=!0){i||n.pauseListeners(),history.go(s)}const o=Tt({location:"",base:e,go:r,createHref:sy.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function Ty(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),by(e)}let Qo=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var cn=(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})(cn||{});const _y={type:Qo.Static,value:""},Sy=/[a-zA-Z0-9_]/;function ky(e){if(!e)return[[]];if(e==="/")return[[_y]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(k){throw new Error(`ERR (${n})/"${p}": ${k}`)}let n=cn.Static,r=n;const o=[];let s;function i(){s&&o.push(s),s=[]}let l=0,c,p="",f="";function g(){p&&(n===cn.Static?s.push({type:Qo.Static,value:p}):n===cn.Param||n===cn.ParamRegExp||n===cn.ParamRegExpEnd?(s.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${p}) must be alone in its segment. eg: '/:ids+.`),s.push({type:Qo.Param,value:p,regexp:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),p="")}function T(){p+=c}for(;l<e.length;){if(c=e[l++],c==="\\"&&n!==cn.ParamRegExp){r=n,n=cn.EscapeNext;continue}switch(n){case cn.Static:c==="/"?(p&&g(),i()):c===":"?(g(),n=cn.Param):T();break;case cn.EscapeNext:T(),n=r;break;case cn.Param:c==="("?n=cn.ParamRegExp:Sy.test(c)?T():(g(),n=cn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--);break;case cn.ParamRegExp:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=cn.ParamRegExpEnd:f+=c;break;case cn.ParamRegExpEnd:g(),n=cn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--,f="";break;default:t("Unknown state");break}}return n===cn.ParamRegExp&&t(`Unfinished custom RegExp for param "${p}"`),g(),i(),o}const bd="[^/]+?",xy={sensitive:!1,strict:!1,start:!0,end:!0};var Gn=(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})(Gn||{});const Cy=/[.+*?^${}()[\]/\\]/g;function Ay(e,t){const n=Tt({},xy,t),r=[];let o=n.start?"^":"";const s=[];for(const p of e){const f=p.length?[]:[Gn.Root];n.strict&&!p.length&&(o+="/");for(let g=0;g<p.length;g++){const T=p[g];let k=Gn.Segment+(n.sensitive?Gn.BonusCaseSensitive:0);if(T.type===Qo.Static)g||(o+="/"),o+=T.value.replace(Cy,"\\$&"),k+=Gn.Static;else if(T.type===Qo.Param){const{value:U,repeatable:H,optional:Z,regexp:q}=T;s.push({name:U,repeatable:H,optional:Z});const R=q||bd;if(R!==bd){k+=Gn.BonusCustomRegExp;try{`${R}`}catch(z){throw new Error(`Invalid custom RegExp for param "${U}" (${R}): `+z.message)}}let F=H?`((?:${R})(?:/(?:${R}))*)`:`(${R})`;g||(F=Z&&p.length<2?`(?:/${F})`:"/"+F),Z&&(F+="?"),o+=F,k+=Gn.Dynamic,Z&&(k+=Gn.BonusOptional),H&&(k+=Gn.BonusRepeatable),R===".*"&&(k+=Gn.BonusWildcard)}f.push(k)}r.push(f)}if(n.strict&&n.end){const p=r.length-1;r[p][r[p].length-1]+=Gn.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const i=new RegExp(o,n.sensitive?"":"i");function l(p){const f=p.match(i),g={};if(!f)return null;for(let T=1;T<f.length;T++){const k=f[T]||"",U=s[T-1];g[U.name]=k&&U.repeatable?k.split("/"):k}return g}function c(p){let f="",g=!1;for(const T of e){(!g||!f.endsWith("/"))&&(f+="/"),g=!1;for(const k of T)if(k.type===Qo.Static)f+=k.value;else if(k.type===Qo.Param){const{value:U,repeatable:H,optional:Z}=k,q=U in p?p[U]:"";if($r(q)&&!H)throw new Error(`Provided param "${U}" is an array but it is not repeatable (* or + modifiers)`);const R=$r(q)?q.join("/"):q;if(!R)if(Z)T.length<2&&(f.endsWith("/")?f=f.slice(0,-1):g=!0);else throw new Error(`Missing required param "${U}"`);f+=R}}return f||"/"}return{re:i,score:r,keys:s,parse:l,stringify:c}}function Ey(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]===Gn.Static+Gn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Gn.Static+Gn.Segment?1:-1:0}function Kp(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const s=Ey(r[n],o[n]);if(s)return s;n++}if(Math.abs(o.length-r.length)===1){if(Td(r))return 1;if(Td(o))return-1}return o.length-r.length}function Td(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Iy={strict:!1,end:!0,sensitive:!1};function My(e,t,n){const r=Ay(ky(e.path),n),o=Tt(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function Ry(e,t){const n=[],r=new Map;t=pd(Iy,t);function o(g){return r.get(g)}function s(g,T,k){const U=!k,H=Sd(g);H.aliasOf=k&&k.record;const Z=pd(t,g),q=[H];if("alias"in g){const z=typeof g.alias=="string"?[g.alias]:g.alias;for(const de of z)q.push(Sd(Tt({},H,{components:k?k.record.components:H.components,path:de,aliasOf:k?k.record:H})))}let R,F;for(const z of q){const{path:de}=z;if(T&&de[0]!=="/"){const ue=T.record.path,we=ue[ue.length-1]==="/"?"":"/";z.path=T.record.path+(de&&we+de)}if(R=My(z,T,Z),k?k.alias.push(R):(F=F||R,F!==R&&F.alias.push(R),U&&g.name&&!kd(R)&&i(g.name)),Yp(R)&&c(R),H.children){const ue=H.children;for(let we=0;we<ue.length;we++)s(ue[we],R,k&&k.children[we])}k=k||R}return F?()=>{i(F)}:ha}function i(g){if(Wp(g)){const T=r.get(g);T&&(r.delete(g),n.splice(n.indexOf(T),1),T.children.forEach(i),T.alias.forEach(i))}else{const T=n.indexOf(g);T>-1&&(n.splice(T,1),g.record.name&&r.delete(g.record.name),g.children.forEach(i),g.alias.forEach(i))}}function l(){return n}function c(g){const T=Oy(g,n);n.splice(T,0,g),g.record.name&&!kd(g)&&r.set(g.record.name,g)}function p(g,T){let k,U={},H,Z;if("name"in g&&g.name){if(k=r.get(g.name),!k)throw Rs(Wt.MATCHER_NOT_FOUND,{location:g});Z=k.record.name,U=Tt(_d(T.params,k.keys.filter(F=>!F.optional).concat(k.parent?k.parent.keys.filter(F=>F.optional):[]).map(F=>F.name)),g.params&&_d(g.params,k.keys.map(F=>F.name))),H=k.stringify(U)}else if(g.path!=null)H=g.path,k=n.find(F=>F.re.test(H)),k&&(U=k.parse(H),Z=k.record.name);else{if(k=T.name?r.get(T.name):n.find(F=>F.re.test(T.path)),!k)throw Rs(Wt.MATCHER_NOT_FOUND,{location:g,currentLocation:T});Z=k.record.name,U=Tt({},T.params,g.params),H=k.stringify(U)}const q=[];let R=k;for(;R;)q.unshift(R.record),R=R.parent;return{name:Z,path:H,params:U,matched:q,meta:$y(q)}}e.forEach(g=>s(g));function f(){n.length=0,r.clear()}return{addRoute:s,resolve:p,removeRoute:i,clearRoutes:f,getRoutes:l,getRecordMatcher:o}}function _d(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Sd(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Py(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 Py(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 kd(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function $y(e){return e.reduce((t,n)=>Tt(t,n.meta),{})}function Oy(e,t){let n=0,r=t.length;for(;n!==r;){const s=n+r>>1;Kp(e,t[s])<0?r=s:n=s+1}const o=Dy(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function Dy(e){let t=e;for(;t=t.parent;)if(Yp(t)&&Kp(e,t)===0)return t}function Yp({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function xd(e){const t=Ir(Fi),n=Ir(nc),r=re(()=>{const c=Me(e.to);return t.resolve(c)}),o=re(()=>{const{matched:c}=r.value,{length:p}=c,f=c[p-1],g=n.matched;if(!f||!g.length)return-1;const T=g.findIndex(Ms.bind(null,f));if(T>-1)return T;const k=Cd(c[p-2]);return p>1&&Cd(f)===k&&g[g.length-1].path!==k?g.findIndex(Ms.bind(null,c[p-2])):T}),s=re(()=>o.value>-1&&By(n.params,r.value.params)),i=re(()=>o.value>-1&&o.value===n.matched.length-1&&Vp(n.params,r.value.params));function l(c={}){if(Fy(c)){const p=t[Me(e.replace)?"replace":"push"](Me(e.to)).catch(ha);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>p),p}return Promise.resolve()}return{route:r,href:re(()=>r.value.href),isActive:s,isExactActive:i,navigate:l}}function Ly(e){return e.length===1?e[0]:e}const Ny=Cn({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:xd,setup(e,{slots:t}){const n=Pi(xd(e)),{options:r}=Ir(Fi),o=re(()=>({[Ad(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ad(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const s=t.default&&Ly(t.default(n));return e.custom?s:ec("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},s)}}}),jy=Ny;function Fy(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 By(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!$r(o)||o.length!==r.length||r.some((s,i)=>s.valueOf()!==o[i].valueOf()))return!1}return!0}function Cd(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ad=(e,t,n)=>e??t??n,Uy=Cn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Ir(Cu),o=re(()=>e.route||r.value),s=Ir(yd,0),i=re(()=>{let p=Me(s);const{matched:f}=o.value;let g;for(;(g=f[p])&&!g.components;)p++;return p}),l=re(()=>o.value.matched[i.value]);fi(yd,re(()=>i.value+1)),fi(my,l),fi(Cu,o);const c=M();return it(()=>[c.value,l.value,e.name],([p,f,g],[T,k,U])=>{f&&(f.instances[g]=p,k&&k!==f&&p&&p===T&&(f.leaveGuards.size||(f.leaveGuards=k.leaveGuards),f.updateGuards.size||(f.updateGuards=k.updateGuards))),p&&f&&(!k||!Ms(f,k)||!T)&&(f.enterCallbacks[g]||[]).forEach(H=>H(p))},{flush:"post"}),()=>{const p=o.value,f=e.name,g=l.value,T=g&&g.components[f];if(!T)return Ed(n.default,{Component:T,route:p});const k=g.props[f],U=k?k===!0?p.params:typeof k=="function"?k(p):k:null,Z=ec(T,Tt({},U,t,{onVnodeUnmounted:q=>{q.component.isUnmounted&&(g.instances[f]=null)},ref:c}));return Ed(n.default,{Component:Z,route:p})||Z}}});function Ed(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const qy=Uy;function Hy(e){const t=Ry(e.routes,e),n=e.parseQuery||py,r=e.stringifyQuery||gd,o=e.history,s=na(),i=na(),l=na(),c=Om(So);let p=So;gs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=ql.bind(null,Q=>""+Q),g=ql.bind(null,Jg),T=ql.bind(null,ka);function k(Q,pe){let ge,Re;return Wp(Q)?(ge=t.getRecordMatcher(Q),Re=pe):Re=Q,t.addRoute(Re,ge)}function U(Q){const pe=t.getRecordMatcher(Q);pe&&t.removeRoute(pe)}function H(){return t.getRoutes().map(Q=>Q.record)}function Z(Q){return!!t.getRecordMatcher(Q)}function q(Q,pe){if(pe=Tt({},pe||c.value),typeof Q=="string"){const B=Hl(n,Q,pe.path),G=t.resolve({path:B.path},pe),ne=o.createHref(B.fullPath);return Tt(B,G,{params:T(G.params),hash:ka(B.hash),redirectedFrom:void 0,href:ne})}let ge;if(Q.path!=null)ge=Tt({},Q,{path:Hl(n,Q.path,pe.path).path});else{const B=Tt({},Q.params);for(const G in B)B[G]==null&&delete B[G];ge=Tt({},Q,{params:g(B)}),pe.params=g(pe.params)}const Re=t.resolve(ge,pe),ze=Q.hash||"";Re.params=f(T(Re.params));const _=Zg(r,Tt({},Q,{hash:Gg(ze),path:Re.path})),A=o.createHref(_);return Tt({fullPath:_,hash:ze,query:r===gd?hy(Q.query):Q.query||{}},Re,{redirectedFrom:void 0,href:A})}function R(Q){return typeof Q=="string"?Hl(n,Q,c.value.path):Tt({},Q)}function F(Q,pe){if(p!==Q)return Rs(Wt.NAVIGATION_CANCELLED,{from:pe,to:Q})}function z(Q){return we(Q)}function de(Q){return z(Tt(R(Q),{replace:!0}))}function ue(Q,pe){const ge=Q.matched[Q.matched.length-1];if(ge&&ge.redirect){const{redirect:Re}=ge;let ze=typeof Re=="function"?Re(Q,pe):Re;return typeof ze=="string"&&(ze=ze.includes("?")||ze.includes("#")?ze=R(ze):{path:ze},ze.params={}),Tt({query:Q.query,hash:Q.hash,params:ze.path!=null?{}:Q.params},ze)}}function we(Q,pe){const ge=p=q(Q),Re=c.value,ze=Q.state,_=Q.force,A=Q.replace===!0,B=ue(ge,Re);if(B)return we(Tt(R(B),{state:typeof B=="object"?Tt({},ze,B.state):ze,force:_,replace:A}),pe||ge);const G=ge;G.redirectedFrom=pe;let ne;return!_&&ey(r,Re,ge)&&(ne=Rs(Wt.NAVIGATION_DUPLICATED,{to:G,from:Re}),Ve(Re,Re,!0,!1)),(ne?Promise.resolve(ne):Ee(G,Re)).catch(ee=>no(ee)?no(ee,Wt.NAVIGATION_GUARD_REDIRECT)?ee:Ke(ee):_e(ee,G,Re)).then(ee=>{if(ee){if(no(ee,Wt.NAVIGATION_GUARD_REDIRECT))return we(Tt({replace:A},R(ee.to),{state:typeof ee.to=="object"?Tt({},ze,ee.to.state):ze,force:_}),pe||G)}else ee=Y(G,Re,!0,A,ze);return $e(G,Re,ee),ee})}function ke(Q,pe){const ge=F(Q,pe);return ge?Promise.reject(ge):Promise.resolve()}function me(Q){const pe=Xe.values().next().value;return pe&&typeof pe.runWithContext=="function"?pe.runWithContext(Q):Q()}function Ee(Q,pe){let ge;const[Re,ze,_]=vy(Q,pe);ge=Wl(Re.reverse(),"beforeRouteLeave",Q,pe);for(const B of Re)B.leaveGuards.forEach(G=>{ge.push(Eo(G,Q,pe))});const A=ke.bind(null,Q,pe);return ge.push(A),je(ge).then(()=>{ge=[];for(const B of s.list())ge.push(Eo(B,Q,pe));return ge.push(A),je(ge)}).then(()=>{ge=Wl(ze,"beforeRouteUpdate",Q,pe);for(const B of ze)B.updateGuards.forEach(G=>{ge.push(Eo(G,Q,pe))});return ge.push(A),je(ge)}).then(()=>{ge=[];for(const B of _)if(B.beforeEnter)if($r(B.beforeEnter))for(const G of B.beforeEnter)ge.push(Eo(G,Q,pe));else ge.push(Eo(B.beforeEnter,Q,pe));return ge.push(A),je(ge)}).then(()=>(Q.matched.forEach(B=>B.enterCallbacks={}),ge=Wl(_,"beforeRouteEnter",Q,pe,me),ge.push(A),je(ge))).then(()=>{ge=[];for(const B of i.list())ge.push(Eo(B,Q,pe));return ge.push(A),je(ge)}).catch(B=>no(B,Wt.NAVIGATION_CANCELLED)?B:Promise.reject(B))}function $e(Q,pe,ge){l.list().forEach(Re=>me(()=>Re(Q,pe,ge)))}function Y(Q,pe,ge,Re,ze){const _=F(Q,pe);if(_)return _;const A=pe===So,B=gs?history.state:{};ge&&(Re||A?o.replace(Q.fullPath,Tt({scroll:A&&B&&B.scroll},ze)):o.push(Q.fullPath,ze)),c.value=Q,Ve(Q,pe,ge,A),Ke()}let ve;function Fe(){ve||(ve=o.listen((Q,pe,ge)=>{if(!kt.listening)return;const Re=q(Q),ze=ue(Re,kt.currentRoute.value);if(ze){we(Tt(ze,{replace:!0,force:!0}),Re).catch(ha);return}p=Re;const _=c.value;gs&&ly(vd(_.fullPath,ge.delta),ji()),Ee(Re,_).catch(A=>no(A,Wt.NAVIGATION_ABORTED|Wt.NAVIGATION_CANCELLED)?A:no(A,Wt.NAVIGATION_GUARD_REDIRECT)?(we(Tt(R(A.to),{force:!0}),Re).then(B=>{no(B,Wt.NAVIGATION_ABORTED|Wt.NAVIGATION_DUPLICATED)&&!ge.delta&&ge.type===ku.pop&&o.go(-1,!1)}).catch(ha),Promise.reject()):(ge.delta&&o.go(-ge.delta,!1),_e(A,Re,_))).then(A=>{A=A||Y(Re,_,!1),A&&(ge.delta&&!no(A,Wt.NAVIGATION_CANCELLED)?o.go(-ge.delta,!1):ge.type===ku.pop&&no(A,Wt.NAVIGATION_ABORTED|Wt.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),$e(Re,_,A)}).catch(ha)}))}let Ne=na(),Ie=na(),Te;function _e(Q,pe,ge){Ke(Q);const Re=Ie.list();return Re.length?Re.forEach(ze=>ze(Q,pe,ge)):console.error(Q),Promise.reject(Q)}function He(){return Te&&c.value!==So?Promise.resolve():new Promise((Q,pe)=>{Ne.add([Q,pe])})}function Ke(Q){return Te||(Te=!Q,Fe(),Ne.list().forEach(([pe,ge])=>Q?ge(Q):pe()),Ne.reset()),Q}function Ve(Q,pe,ge,Re){const{scrollBehavior:ze}=e;if(!gs||!ze)return Promise.resolve();const _=!ge&&uy(vd(Q.fullPath,0))||(Re||!ge)&&history.state&&history.state.scroll||null;return Gt().then(()=>ze(Q,pe,_)).then(A=>A&&iy(A)).catch(A=>_e(A,Q,pe))}const Je=Q=>o.go(Q);let mt;const Xe=new Set,kt={currentRoute:c,listening:!0,addRoute:k,removeRoute:U,clearRoutes:t.clearRoutes,hasRoute:Z,getRoutes:H,resolve:q,options:e,push:z,replace:de,go:Je,back:()=>Je(-1),forward:()=>Je(1),beforeEach:s.add,beforeResolve:i.add,afterEach:l.add,onError:Ie.add,isReady:He,install(Q){Q.component("RouterLink",jy),Q.component("RouterView",qy),Q.config.globalProperties.$router=kt,Object.defineProperty(Q.config.globalProperties,"$route",{enumerable:!0,get:()=>Me(c)}),gs&&!mt&&c.value===So&&(mt=!0,z(o.location).catch(Re=>{}));const pe={};for(const Re in So)Object.defineProperty(pe,Re,{get:()=>c.value[Re],enumerable:!0});Q.provide(Fi,kt),Q.provide(nc,zf(pe)),Q.provide(Cu,c);const ge=Q.unmount;Xe.add(Q),Q.unmount=function(){Xe.delete(Q),Xe.size<1&&(p=So,ve&&ve(),ve=null,c.value=So,mt=!1,Te=!1),ge()}}};function je(Q){return Q.reduce((pe,ge)=>pe.then(()=>me(ge)),Promise.resolve())}return kt}function Vy(){return Ir(Fi)}function Wy(e){return Ir(nc)}const Id=768;function rc(){const e=M(typeof window<"u"?window.innerWidth<Id:!1);let t=null;function n(r){e.value=r.matches}return Oo(()=>{t=window.matchMedia(`(max-width: ${Id-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Oi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const zy={key:0,class:"desktop-sidebar"},Gy={class:"desktop-main"},Md="codex-web-local.sidebar-width.v1",Ky=260,Yy=620,Rd=320,Jy=Cn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=rc();function r(p){return Math.min(Yy,Math.max(Ky,p))}function o(){if(typeof window>"u")return Rd;const p=window.localStorage.getItem(Md),f=Number(p);return Number.isFinite(f)?r(f):Rd}const s=M(o()),i=re(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${s.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function l(p){typeof window>"u"||window.localStorage.setItem(Md,String(p))}function c(p){p.preventDefault();const f=p.clientX,g=s.value,T=U=>{const H=U.clientX-f;s.value=r(g+H)},k=()=>{l(s.value),window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",k)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",k)}return(p,f)=>(S(),$("div",{class:ot(["desktop-layout",{"is-mobile":Me(n)}]),style:io(i.value)},[Me(n)?(S(),st(bs,{key:0,to:"body"},[Be(Lp,{name:"drawer"},{default:bt(()=>[e.isSidebarCollapsed?ie("",!0):(S(),$("div",{key:0,class:"mobile-drawer-backdrop",onClick:f[1]||(f[1]=g=>p.$emit("close-sidebar"))},[v("aside",{class:"mobile-drawer",onClick:f[0]||(f[0]=lt(()=>{},["stop"]))},[zr(p.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ie("",!0),Me(n)?ie("",!0):(S(),$(qe,{key:1},[e.isSidebarCollapsed?ie("",!0):(S(),$("aside",zy,[zr(p.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ie("",!0):(S(),$("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),v("section",Gy,[zr(p.$slots,"content",{},void 0)])],6))}}),ht=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},Qy=ht(Jy,[["__scopeId","data-v-4c6dbcd7"]]);function Pd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class co extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function ts(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Pd(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=Pd(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function mo(e,t,n){return e instanceof co?e:e instanceof Error?new co(e.message||t,{code:"unknown_error",method:n}):new co(t,{code:"unknown_error",method:n})}function Jp(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Xy(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(l){throw new co(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,s=null;try{s=await r.text(),o=JSON.parse(s)}catch{o=null}if(!r.ok){const l=ts(o,"")||(s==null?void 0:s.slice(0,500))||"",c=`RPC ${e} failed with HTTP ${r.status}`;throw new co(l?`${c}: ${l}`:c,{code:"http_error",method:e,status:r.status})}const i=o;if(!i||typeof i!="object"||!("result"in i))throw new co(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return i.result}function Zy(e){const t=Jp(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 $d(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function ew(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},s=(p,f)=>{if(n||r!==null)return;const g=Math.min(1e3*2**f,1e4);r=window.setTimeout(()=>{r=null,!n&&p()},g)},i=p=>{const f=Zy(p);f&&e(f)},l=(p=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const f=new EventSource("/codex-api/events");let g=!1;f.onmessage=T=>{try{i(JSON.parse(T.data))}catch{}},f.addEventListener("ready",T=>{try{const k=T.data?JSON.parse(T.data):{ok:!0};$d(e,k)}catch{$d(e)}}),f.onerror=()=>{n||g||f.readyState===EventSource.CLOSED&&(g=!0,f.close(),s(()=>l(p+1),p))},t=()=>{g=!0,f.close()}},c=(p=0)=>{if(typeof WebSocket>"u"||n){l();return}t==null||t();const f=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${f}//${window.location.host}/codex-api/ws`);let T=!1,k=!1,U=window.setTimeout(()=>{T||n||k||(k=!0,g.close(),l())},2500);g.onopen=()=>{T=!0,o(),U!==null&&(window.clearTimeout(U),U=null)},g.onmessage=H=>{try{i(JSON.parse(String(H.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(U!==null&&(window.clearTimeout(U),U=null),!(n||k)){if(!T){l();return}s(()=>c(p+1),p)}},t=()=>{k=!0,U!==null&&(window.clearTimeout(U),U=null),g.close()}};return typeof WebSocket<"u"?c():l(),()=>{n=!0,o(),t==null||t()}}async function tw(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 co(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 co(ts(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function nw(){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 co(ts(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Jp(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function rw(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Yt(e){return rw(e)}function ow(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function sw(e){const t=Yt(e).replace(/[\\/]+/gu,"/");return ow(t)?t.toLowerCase():t}function Go(e){const t=Yt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function zl(e){const t=Yt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Ma(e){return Go(e)||Yt(e)||"unknown-project"}function Od(e){return new Date(e*1e3).toISOString()}function aw(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const iw=/^##\s+(.+?):\s+(.+?)\s*$/,lw=/^#\s*files mentioned by the user\s*:?\s*$/i;function uw(e){var o,s;const t=e.split(`
27
- `).findIndex(i=>lw.test(i.trim()));if(t<0)return[];const n=e.split(`
28
- `).slice(t+1),r=[];for(const i of n){const l=i.trim();if(!l)continue;const c=l.match(iw);if(!c)break;const p=(o=c[1])==null?void 0:o.trim(),f=(s=c[2])==null?void 0:s.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");p&&f&&r.push({label:p,path:f})}return r}function cw(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 o=r.index+r[0].length;return e.slice(o).trim()}function Qp(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function dw(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;const n=t.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(n)?`data:image/png;base64,${n}`:""}function Dd(e,t){var r;const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return((r=n==null?void 0:n[1])==null?void 0:r.trim())??""}function fw(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Dd(t,"instructions");return n?{automationId:Dd(t,"automation_id"),instructions:n}:null}function pw(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[];for(const[c,p]of t.entries())p.type==="text"&&typeof p.text=="string"&&p.text.length>0&&n.push(p.text),p.type==="image"&&typeof p.url=="string"&&p.url.trim().length>0&&r.push(p.url.trim()),p.type==="localImage"&&typeof p.path=="string"&&p.path.trim().length>0&&r.push(Qp(p.path.trim())),p.type!=="text"&&p.type!=="image"&&p.type!=="localImage"&&o.push({id:`${e}:user-content:${c}`,role:"user",text:"",messageType:`userContent.${p.type}`,rawPayload:aw(p),isUnhandled:!0});const s=n.join(`
29
- `),i=uw(s),l=fw(s);return{text:(l==null?void 0:l.instructions)??cw(s),images:r,fileAttachments:i,rawBlocks:o,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function hw(e){var s;const t=e.replace(/\r\n/g,`
30
- `).trim();if(!t)return null;const n=t.split(`
31
- `),r=[],o=[];for(const i of n){const l=i.trim();if(!l){r.length===0&&o.push("");continue}const c=l.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(c){const p=(c[1]??" ").toLowerCase(),f=(s=c[2])==null?void 0:s.trim();if(!f)continue;let g="pending";p==="x"&&(g="completed"),(p==="~"||p===">"||p==="-")&&(g="inProgress"),r.push({step:f,status:g});continue}o.push(l)}return r.length===0?null:{explanation:o.join(`
32
- `).trim()||void 0,steps:r}}function Ld(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
33
- `),n=t.endsWith(`
34
- `)?t.slice(0,-1):t;return n?n.split(`
35
- `).length:0}function mw(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
36
- `).split(`
37
- `))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Xp(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Zp(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,s=typeof o.path=="string"?o.path:"",i=typeof o.diff=="string"?o.diff:"",l=o.kind,c=l==null?void 0:l.type;if(!s||c!=="add"&&c!=="delete"&&c!=="update")continue;const p=c==="update"&&typeof(l==null?void 0:l.move_path)=="string"?l.move_path:null,f=c==="update"?mw(i):c==="add"?{addedLineCount:Ld(i),removedLineCount:0}:{addedLineCount:0,removedLineCount:Ld(i)};n.push({path:s,operation:c,movedToPath:p,diff:i,...f})}return n}function vw(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=pw(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:t.isAutomationRun?"system":"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[Qp(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?dw(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}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:hw(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=gw(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,s=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:o,status:n,aggregatedOutput:s,exitCode:i}}]}if(e.type==="fileChange"){const t=Zp(e.changes),n=Xp(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function gw(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function yw(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function ww(e){const t=yw(e);return t.length>0?t:"Untitled thread"}function oc(e){return(e==null?void 0:e.status)==="inProgress"}function bw(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 oc(r)}function Tw(e){const t=e,n=Yt(typeof t.cwd=="string"?t.cwd:e.cwd),r=sw(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:ww(e),projectName:Ma(n),cwd:n,hasWorktree:o,createdAtIso:Od(e.createdAt),updatedAtIso:Od(e.updatedAt),preview:e.preview,unread:!1,inProgress:bw(e)}}function _w(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((o,s)=>new Date(s.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var i,l;const o=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((l=r.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-o})}function Sw(e){const t=e.data.map(Tw);return _w(t)}function Bi(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const o=t[r],s=typeof(o==null?void 0:o.id)=="string"?o.id:void 0,i=Array.isArray(o.items)?o.items:[];for(const l of i)for(const c of vw(l))n.push({...c,turnId:s,turnIndex:r})}return n}function eh(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return oc(t.at(-1))}function th(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(oc(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const kw=5e3;function Gl(e){return e&&e.length>0?e:null}function Kl(e){return e&&e.length>0?e:null}const Nd=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function jd(e,t){const n=t.trim();if(!n)return"";const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),[o="",s=""]=e.split("/",2),i=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=o&&s?`${i}\\s*/\\s*${l}`:r;return n.replace(/^[★☆*\s:|\-]+/u,"").replace(/^(sponsor|star)\s+/i,"").replace(new RegExp(`^${r}\\s*[-:|]*\\s*`,"i"),"").replace(new RegExp(`^${c}\\s*[-:|]*\\s*`,"i"),"").replace(/^(sponsor|star)\s+/i,"").trim()}function Nt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ye(e){return typeof e=="string"&&e.length>0?e:null}function dn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Ps(e){return typeof e=="boolean"?e:null}function xw(e){return e==="payment_required"?e:null}function Cw(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Fd(e){const t=Nt(e);if(!t)return null;const n=dn(t.usedPercent??t.used_percent);if(n===null)return null;const r=dn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:dn(t.resetsAt??t.resets_at)}}function Aw(e){const t=Nt(e);if(!t)return null;const n=Ps(t.hasCredits??t.has_credits),r=Ps(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:Ye(t.balance)}}function Au(e){const t=Nt(e);if(!t)return null;const n=Fd(t.primary),r=Fd(t.secondary),o=Aw(t.credits);return!n&&!r&&!o?null:{limitId:Ye(t.limitId??t.limit_id),limitName:Ye(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:Ye(t.planType??t.plan_type)}}function nh(e,t=null){const n=Nt(e);if(!n)return null;const r=Ye(n.accountId),o=Ye(n.quotaStatus),s=o==="loading"||o==="ready"||o==="error"?o:"idle";return r?{accountId:r,authMode:Ye(n.authMode),email:Ye(n.email),planType:Ye(n.planType),lastRefreshedAtIso:Ye(n.lastRefreshedAtIso)??"",lastActivatedAtIso:Ye(n.lastActivatedAtIso),quotaSnapshot:Au(n.quotaSnapshot),quotaUpdatedAtIso:Ye(n.quotaUpdatedAtIso),quotaStatus:s,quotaError:Ye(n.quotaError),unavailableReason:xw(n.unavailableReason)??(Cw(Ye(n.quotaError))?"payment_required":null),isActive:Ps(n.isActive)??r===t}:null}function rh(e){const t=Nt(e);if(!t)return null;const n=Nt(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Au(n==null?void 0:n.codex);return r||Au(t.rateLimits??t.rate_limits)}async function on(e,t){try{return await Xy(e,t)}catch(n){throw mo(n,`RPC ${e} failed`,e)}}function oh(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n={};for(let r=0;r<t.length;r+=1){const o=t[r];typeof(o==null?void 0:o.id)!="string"||o.id.length===0||(n[o.id]=r)}return n}function Ew(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function Iw(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const Mw=50,Rw=100;async function Pw(e,t){const n=await on("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Sw(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function $w(e){const t=await on("thread/read",{threadId:e,includeTurns:!0});return{messages:Bi(t),inProgress:eh(t),activeTurnId:th(t),turnIndexByTurnId:oh(t)}}async function Bd(e=null,t=Mw){try{return await Pw(e,t)}catch(n){throw mo(n,"Failed to load thread groups","thread/list")}}function Ow(){return Rw}async function Ud(e){try{return await $w(e)}catch(t){throw mo(t,`Failed to load thread ${e}`,"thread/read")}}function Dw(e){const t=Nt(e);if(!t)return null;const n=Ye(t.key),r=typeof t.text=="string"?t.text:"",o=Ye(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:dn(t.oldLine),newLine:dn(t.newLine)}}function Lw(e){const t=Nt(e);if(!t)return null;const n=Ye(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:dn(t.addedLineCount)??0,removedLineCount:dn(t.removedLineCount)??0,oldStart:dn(t.oldStart),oldLineCount:dn(t.oldLineCount)??0,newStart:dn(t.newStart),newLineCount:dn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(s=>Dw(s)).filter(s=>s!==null):[]}:null}function Nw(e){const t=Nt(e);if(!t)return null;const n=Ye(t.id),r=Ye(t.path),o=Ye(t.absolutePath),s=Ye(t.operation);return!n||!r||!o||!s||s!=="add"&&s!=="delete"&&s!=="update"&&s!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:Ye(t.previousPath),previousAbsolutePath:Ye(t.previousAbsolutePath),operation:s,addedLineCount:dn(t.addedLineCount)??0,removedLineCount:dn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(i=>Lw(i)).filter(i=>i!==null):[]}}function sh(e){const t=Nt(e),n=Nt(t==null?void 0:t.data),r=Nt(n==null?void 0:n.summary),o=Ye(n==null?void 0:n.scope)==="baseBranch"?"baseBranch":"workspace",s=Ye(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:Ye(n==null?void 0:n.cwd)??"",gitRoot:Ye(n==null?void 0:n.gitRoot),isGitRepo:Ps(n==null?void 0:n.isGitRepo)??!1,scope:o,workspaceView:s,baseBranch:Ye(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>Ye(i)).filter(i=>typeof i=="string"&&i.length>0):[],headBranch:Ye(n==null?void 0:n.headBranch),mergeBaseSha:Ye(n==null?void 0:n.mergeBaseSha),generatedAtIso:Ye(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:dn(r==null?void 0:r.fileCount)??0,addedLineCount:dn(r==null?void 0:r.addedLineCount)??0,removedLineCount:dn(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>Nw(i)).filter(i=>i!==null):[]}}function jw(e){var r;const t=e.trim();if(!t)return{absolutePath:null,startLine:null,endLine:null};const n=t.match(/^(.*?):(\d+)-(\d+)$/u);return n?{absolutePath:((r=n[1])==null?void 0:r.trim())||null,startLine:Number(n[2]),endLine:Number(n[3])}:{absolutePath:t||null,startLine:null,endLine:null}}function Fw(e){var i;const t=e.replace(/\r\n/g,`
38
- `).trim();if(!t)return{reviewText:"",summary:"",findings:[]};const n=t.search(/\n(?:Full review comments|Review comment):\n/iu),r=n>=0?t.slice(0,n).trim():t,o=n>=0?t.slice(n).trim():"",s=[];if(o){const c=o.replace(/^(?:Full review comments|Review comment):\n*/iu,"").trim().matchAll(/^- (.+?) — (.+)\n?((?: .*(?:\n|$))*)/gmu);let p=0;for(const f of c){const g=((i=f[1])==null?void 0:i.trim())??"",T=jw(f[2]??""),k=(f[0]??"").trim(),U=(f[3]??"").split(`
39
- `).map(H=>H.replace(/^ /u,"")).join(`
40
- `).trim();s.push({id:`finding:${p}`,title:g||`Finding ${p+1}`,body:U,path:T.absolutePath?T.absolutePath.split("/").filter(Boolean).slice(-1)[0]??T.absolutePath:null,absolutePath:T.absolutePath,startLine:T.startLine,endLine:T.endLine,rawText:k}),p+=1}}return{reviewText:t,summary:r,findings:s}}function qd(e,t){const n=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let r=n.length-1;r>=0;r-=1){const o=n[r],s=Array.isArray(o==null?void 0:o.items)?o.items:[];for(let i=s.length-1;i>=0;i-=1){const l=s[i];if((l==null?void 0:l.type)!==t)continue;const c=typeof l.review=="string"?l.review.trim():"";if(c)return c}}return null}async function bA(e){const t=await on("thread/read",{threadId:e,includeTurns:!0}),n=qd(t,"exitedReviewMode");return{enteredReviewLabel:qd(t,"enteredReviewMode"),result:n?Fw(n):null}}function ah(e){const t=Nt(e);if(!t)return null;const n=Ye(t.id),r=Ye(t.kind),o=Ye(t.name),s=Ye(t.prompt),i=Ye(t.rrule),l=Ye(t.status);return!n||!o||!s||!i||r!=="heartbeat"&&r!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:s,rrule:i,status:l,targetThreadId:Ye(t.targetThreadId),createdAtMs:dn(t.createdAtMs),updatedAtMs:dn(t.updatedAtMs),nextRunAtMs:dn(t.nextRunAtMs)}}async function Bw(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(ts(t,"Failed to load thread automations"));const n=Nt((o=Nt(t))==null?void 0:o.data),r={};if(!n)return r;for(const[s,i]of Object.entries(n)){const l=ah(i);l&&(r[s]=l)}return r}async function Uw(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(ts(n,"Failed to save thread automation"));const r=ah((o=Nt(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function Hd(e){const t=await fetch(`/codex-api/thread-automation?threadId=${encodeURIComponent(e)}`,{method:"DELETE"}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(ts(n,"Failed to delete thread automation"))}function qw(e){return ew(e)}function Hw(e){const t=Nt(e);if(!t)return null;const n=Ye(t.id),r=Ye(t.threadId),o=Ye(t.cwd),s=Ye(t.shell);return!n||!r||!o||!s?null:{id:n,threadId:r,cwd:o,shell:s,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Ps(t.truncated)??!1}}async function Ra(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(ts(r,`Terminal request failed with HTTP ${n.status}`));return r}async function TA(e){var r;const t=await Ra("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Hw((r=Nt(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function Vw(){const e=await Ra("/codex-api/thread-terminal/status"),t=Nt(e);return{available:Ps(t==null?void 0:t.available)??!1,reason:Ye(t==null?void 0:t.reason)||null}}async function _A(e,t){await Ra("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function SA(e,t,n){await Ra("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function kA(e){await Ra("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function Ww(e,t){await tw({id:e,...t})}async function zw(){return nw()}async function Gw(){try{const e=await on("account/rateLimits/read");return rh(e)}catch(e){throw mo(e,"Failed to load account rate limits","account/rateLimits/read")}}function sc(e){const t=Nt(e),n=Ye(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:Ye(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(o=>nh(o,n)).filter(o=>o!==null)}}async function Kw(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(jn(t,"Failed to load accounts"));const n=Nt(t);return sc(n==null?void 0:n.data)}async function Yw(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(jn(t,"Failed to refresh accounts"));const n=Nt(t);return sc(n==null?void 0:n.data)}async function Jw(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(jn(n,"Failed to switch account"));const r=Nt(n),o=Nt(r==null?void 0:r.data),s=nh(o==null?void 0:o.account,Ye(o==null?void 0:o.activeAccountId));if(!s)throw new Error("Failed to switch account");return s}async function Qw(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(jn(n,"Failed to remove account"));const r=Nt(n);return sc(r==null?void 0:r.data)}async function Yl(e){const t=await on("thread/resume",{threadId:e});return{model:_i(t),messages:Bi(t),inProgress:eh(t),activeTurnId:th(t),turnIndexByTurnId:oh(t)}}async function Xw(e){await on("thread/archive",{threadId:e})}async function Zw(e,t){await on("thread/name/set",{threadId:e,name:t})}async function Jl(e,t){const n=await on("thread/rollback",{threadId:e,numTurns:t});return Bi(n)}async function eb(e,t,n){try{const r=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n})});return r.ok?await r.json():{reverted:0,errors:["Server error"]}}catch{return{reverted:0,errors:["Network error"]}}}function Eu(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""}function tb(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function _i(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}async function Vd(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 on("thread/start",n),o=Eu(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:_i(r)}}catch(n){throw mo(n,"Failed to start a new thread","thread/start")}}async function Wd(e,t,n){if(arguments.length<=1)try{const r=await on("thread/fork",{threadId:e,persistExtendedHistory:!0}),o=Eu(r);if(!o)throw new Error("thread/fork did not return a thread id");return{threadId:o,cwd:tb(r),model:_i(r),messages:Bi(r)}}catch(r){throw mo(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const o={threadId:r};typeof t=="string"&&t.trim().length>0&&(o.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(o.model=n.trim());const s=await on("thread/fork",o),i=Eu(s);if(!i)throw new Error("thread/fork did not return a thread id");return{threadId:i,model:_i(s)}}catch(r){throw mo(r,`Failed to fork thread ${e}`,"thread/fork")}}function zd(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function nb(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
41
- `;for(const r of t)n+=`
42
- ## ${r.label}: ${r.path}
43
- `;return`${n}
44
- ## My request for Codex:
45
-
46
- ${e}
47
- `}function rb(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function ob(e,t,n){var c;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Gl(n):Kl(n)};let o=null;try{o=await lh()}catch{o=null}const s=(o==null?void 0:o.model.trim())??"";if(s)return{model:s,reasoningEffort:e==="plan"?Gl(n??(o==null?void 0:o.reasoningEffort)):Kl(n??(o==null?void 0:o.reasoningEffort))};let i=[];try{i=await ih()}catch{i=[]}const l=((c=i.find(p=>p.trim().length>0))==null?void 0:c.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?Gl(n??(o==null?void 0:o.reasoningEffort)):Kl(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Ql(e,t,n=[],r,o,s,i=[],l){var c;try{const p=(r==null?void 0:r.trim())??"",f=[];for(const R of n){const F=zd(R.trim());F&&f.push({label:rb(F),path:F,fsPath:F})}const g=[...i,...f],T=g.filter((R,F)=>g.findIndex(z=>z.fsPath===R.fsPath)===F),U=[{type:"text",text:nb(t,T)}];for(const R of n){const F=R.trim();if(!F)continue;const z=zd(F);if(z){U.push({type:"localImage",path:z});continue}U.push({type:"image",url:F,image_url:F})}if(s)for(const R of s)U.push({type:"skill",name:R.name,path:R.path});const H=T.map(R=>({label:R.label,path:R.path,fsPath:R.fsPath})),Z={threadId:e,input:U};if(H.length>0&&(Z.attachments=H),p&&(Z.model=p),typeof o=="string"&&o.length>0&&(Z.effort=o),l&&l!=="default"){const R=await ob(l,p,o);Z.collaborationMode={mode:l,settings:{model:R.model,reasoning_effort:R.reasoningEffort,developer_instructions:null}}}const q=await on("turn/start",Z);return typeof((c=q==null?void 0:q.turn)==null?void 0:c.id)=="string"?q.turn.id.trim():""}catch(p){throw mo(p,`Failed to start turn for thread ${e}`,"turn/start")}}async function sb(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 on("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw mo(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function ab(e){const t=e==="fast"?"fast":"standard";await on("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function ib(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Gd(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Kd(e){return await(await fetch("/codex-api/free-mode/custom-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})})).json()}async function ps(e,t,n){return await(await fetch("/codex-api/free-mode/custom-provider",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:e,apiKey:t,wireApi:n==null?void 0:n.wireApi,provider:n==null?void 0:n.provider})})).json()}async function ih(e={}){const t=await on("model/list",{}),n=[];for(const r of t.data){const o=r.id||r.model;!o||n.includes(o)||n.push(o)}if(e.includeProviderModels===!1)return n;try{const r=await fetch("/codex-api/provider-models",{signal:AbortSignal.timeout(kw)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data)){if(o.exclusive)return o.data.filter(s=>typeof s=="string"&&s.trim().length>0);for(const s of o.data){if(typeof s!="string")continue;const i=s.trim();!i||n.includes(i)||n.push(i)}}}catch{}return n}async function lh(){const e=await on("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=Ew(e.config.model_reasoning_effort),o=Iw(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function lb(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function ub(){try{const e=await on("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"||t.has(o)||(t.add(o),n.push({value:o,label:lb(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of Nd)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return Nd}function cb(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=s=>{if(!Array.isArray(s))return[];const i=[];for(const l of s)typeof l=="string"&&l.length>0&&!i.includes(l)&&i.push(l);return i},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[s,i]of Object.entries(r)){const l=typeof s=="string"?Yt(s):"";l.length>0&&typeof i=="string"&&(o[l]=i)}return{order:n(t.order).map(s=>Yt(s)),labels:o,active:n(t.active).map(s=>Yt(s))}}async function ys(){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 cb(n.data)}async function db(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:Yt(o.data.cwd),gitRoot:Yt(o.data.gitRoot)}}async function fb(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const s=Array.isArray(o.data)?o.data:[],i=[],l=new Set;for(const c of s){if(!c||typeof c!="object"||Array.isArray(c))continue;const p=c,f=typeof p.value=="string"?p.value.trim():"",g=typeof p.label=="string"?p.label.trim():"";!f||l.has(f)||(l.add(f),i.push({value:f,label:g||f}))}return i}async function pb(e){const t=e.trim();if(!t)return{currentBranch:null,options:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const s=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},i=s.currentBranch,l=typeof i=="string"&&i.trim()?i.trim():null,c=Array.isArray(s.options)?s.options:[],p=[],f=new Set;for(const g of c){if(!g||typeof g!="object"||Array.isArray(g))continue;const T=g,k=typeof T.value=="string"?T.value.trim():"",U=typeof T.label=="string"?T.label.trim():"";!k||f.has(k)||(f.add(k),p.push({value:k,label:U||k}))}return l&&!f.has(l)&&p.unshift({value:l,label:l}),{currentBranch:l,options:p}}async function hb(e,t){var s;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(s=r.data)==null?void 0:s.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function xA(e,t,n,r){const o=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&o.set("baseBranch",r.trim());const s=await fetch(`/codex-api/review/snapshot?${o.toString()}`),i=await s.json();if(!s.ok)throw new Error(jn(i,"Failed to load review snapshot"));return sh(i)}async function CA(e){const t=await fetch("/codex-api/review/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw new Error(jn(n,"Failed to apply review action"));return sh(n)}async function AA(e){const t=await fetch("/codex-api/review/git/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})}),n=await t.json();if(!t.ok)throw new Error(jn(n,"Failed to initialize Git"))}async function EA(e,t,n,r){const o=t==="baseBranch"?{type:"baseBranch",branch:(r??"").trim()}:{type:"uncommittedChanges"};if(o.type==="baseBranch"&&!o.branch)throw new Error("Base branch is unavailable");await on("review/start",{threadId:e,target:o,delivery:"inline"})}async function Yd(){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 mb(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await uh(r);if(!r.ok){const c=jn(o,"Failed to load local directories");throw new Error(c)}const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},i=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},l=Array.isArray(i.entries)?i.entries:[];return{path:typeof i.path=="string"?Yt(i.path):"",parentPath:typeof i.parentPath=="string"?Yt(i.parentPath):"",entries:l.flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const p=c,f=typeof p.name=="string"?p.name.trim():"",g=typeof p.path=="string"?Yt(p.path):"";return f&&g?[{name:f,path:g}]:[]})}}async function uh(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}async function Xl(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 Zl(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 l=jn(r,"Failed to open project root");throw new Error(l)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof s.path=="string"?Yt(s.path):""}async function vb(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await uh(t);if(!t.ok){const s=jn(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof o.path=="string"?Yt(o.path):""}async function gb(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=jn(r,"Failed to suggest project name");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof s.name=="string"?s.name.trim():"",path:typeof s.path=="string"?Yt(s.path):""}}async function yb(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),s=await o.json();if(!o.ok){const p=jn(s,"Failed to search files");throw new Error(p)}const i=s&&typeof s=="object"&&!Array.isArray(s)?s:{},l=Array.isArray(i.data)?i.data:[],c=[];for(const p of l){if(!p||typeof p!="object"||Array.isArray(p))continue;const g=p.path,T=typeof g=="string"?g.trim():"";T&&c.push({path:T})}return c}async function wb(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}async function bb(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=jn(r,"Failed to connect Telegram bot");throw new Error(o)}}async function Tb(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const i=jn(t,"Failed to load Telegram configuration");throw new Error(i)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],s=[];for(const i of o){if(i==="*"){s.push("*");continue}typeof i=="number"&&Number.isFinite(i)&&s.push(Math.trunc(i))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:s}}async function _b(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=jn(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}function Sb(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}async function kb(e,t=6){const n=Math.min(10,Math.max(1,Math.floor(t)));if(e.startsWith("search-")){const f=new Date;e==="search-daily"?f.setUTCDate(f.getUTCDate()-1):e==="search-weekly"?f.setUTCDate(f.getUTCDate()-7):f.setUTCDate(f.getUTCDate()-30);const g=new URLSearchParams({q:`created:>=${Sb(f)}`,sort:"stars",order:"desc",per_page:String(n)}),T=await fetch(`https://api.github.com/search/repositories?${g.toString()}`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});if(!T.ok)throw new Error(`Failed to fetch GitHub search projects (${T.status})`);const k=await T.json(),U=k&&typeof k=="object"&&!Array.isArray(k)?k:{},H=Array.isArray(U.items)?U.items:[],Z=[];for(const q of H){if(!q||typeof q!="object"||Array.isArray(q))continue;const R=q,F=typeof R.id=="number"?R.id:0,z=typeof R.full_name=="string"?R.full_name.trim():"",de=typeof R.html_url=="string"?R.html_url.trim():"";if(!F||!z||!de)continue;const[ue="",we=""]=z.split("/",2);Z.push({id:F,fullName:z,owner:ue,repo:we,url:de,description:jd(z,typeof R.description=="string"?R.description:""),language:typeof R.language=="string"?R.language.trim():"",stars:typeof R.stargazers_count=="number"?R.stargazers_count:0})}return Z}const r=e==="trending-daily"?"daily":e==="trending-weekly"?"weekly":"monthly",o=new URLSearchParams({since:r,limit:String(n)}),s=await fetch(`/codex-api/github-trending?${o.toString()}`),i=await s.json();if(!s.ok){const f=jn(i,"Failed to fetch GitHub trending projects");throw new Error(f)}const l=i&&typeof i=="object"&&!Array.isArray(i)?i:{},c=Array.isArray(l.data)?l.data:[],p=[];for(const f of c){if(!f||typeof f!="object"||Array.isArray(f))continue;const g=f,T=typeof g.id=="number"?g.id:0,k=typeof g.fullName=="string"?g.fullName.trim():"",U=typeof g.url=="string"?g.url.trim():"";if(!T||!k||!U)continue;const[H="",Z=""]=k.split("/",2);p.push({id:T,fullName:k,owner:H,repo:Z,url:U,description:jd(k,typeof g.description=="string"?g.description:""),language:typeof g.language=="string"?g.language.trim():"",stars:typeof g.stars=="number"?g.stars:0})}return p}function jn(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 o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}async function xb(){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 eu(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 Cb(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function Ab(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function Eb(e,t){var n;try{return((n=(await on("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function Ib(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await on("skills/list",t),r=[],o=new Set;for(const s of n.data)for(const i of s.skills)!i.name||o.has(i.path)||(o.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[]}}const Mb=6e4;async function tu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),Mb);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const Rb={},Pb={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $b(e,t){return S(),$("svg",Pb,[...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 ac=ht(Rb,[["render",$b]]),Ob={},Db={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Lb(e,t){return S(),$("svg",Db,[...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 Nb=ht(Ob,[["render",Lb]]),jb={},Fb={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bb(e,t){return S(),$("svg",Fb,[...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 ra=ht(jb,[["render",Bb]]),Ub={},qb={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Hb(e,t){return S(),$("svg",qb,[...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 Si=ht(Ub,[["render",Hb]]),Vb={},Wb={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zb(e,t){return S(),$("svg",Wb,[...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 ic=ht(Vb,[["render",zb]]),Gb={},Kb={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Yb(e,t){return S(),$("svg",Kb,[...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 Jb=ht(Gb,[["render",Yb]]),Qb={},Xb={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Zb(e,t){return S(),$("svg",Xb,[...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 hi=ht(Qb,[["render",Zb]]),e0={},t0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function n0(e,t){return S(),$("svg",t0,[...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 nu=ht(e0,[["render",n0]]),r0={key:0,class:"sidebar-menu-row-left"},o0={class:"sidebar-menu-row-main"},s0={key:1,class:"sidebar-menu-row-right"},a0={key:0,class:"sidebar-menu-row-right-default"},i0={key:1,class:"sidebar-menu-row-right-hover"},l0=Cn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=pv(),r=re(()=>!!n.left),o=re(()=>!!n.right),s=re(()=>!!n["right-hover"]),i=re(()=>o.value||s.value);return(l,c)=>(S(),st(Ku(t.as),Mp({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":s.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:bt(()=>[r.value?(S(),$("span",r0,[zr(l.$slots,"left",{},void 0,!0)])):ie("",!0),v("span",o0,[zr(l.$slots,"default",{},void 0,!0)]),i.value?(S(),$("span",s0,[o.value?(S(),$("span",a0,[zr(l.$slots,"right",{},void 0,!0)])):ie("",!0),s.value?(S(),$("span",i0,[zr(l.$slots,"right-hover",{},void 0,!0)])):ie("",!0)])):ie("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Wo=ht(l0,[["__scopeId","data-v-36239f39"]]),u0={class:"thread-tree-root"},c0={key:0,class:"pinned-section"},d0={class:"thread-list"},f0=["data-menu-open"],p0={class:"thread-left-stack"},h0=["data-state"],m0=["onClick"],v0=["onClick"],g0={class:"thread-row-title-wrap"},y0={class:"thread-row-title-line"},w0={class:"thread-row-title"},b0=["title"],T0=["data-state"],_0={class:"thread-row-time"},S0=["onClick"],k0=["aria-expanded"],x0=["data-active"],C0={key:0},A0=["data-active"],E0={key:0},I0={key:1,class:"thread-tree-no-results"},M0={key:2,class:"thread-tree-loading"},R0={key:3,class:"thread-list thread-list-global"},P0=["data-menu-open"],$0={class:"thread-left-stack"},O0=["data-state"],D0=["onClick"],L0=["onClick"],N0={class:"thread-row-title-wrap"},j0={class:"thread-row-title-line"},F0={class:"thread-row-title"},B0=["title"],U0=["data-state"],q0={class:"thread-row-time"},H0=["onClick"],V0=["data-project-name","data-expanded","data-dragging"],W0={class:"project-icon-stack"},z0={class:"project-icon-folder"},G0={class:"project-icon-chevron"},K0=["data-dragging-handle","onMousedown"],Y0={class:"project-title"},J0={class:"project-hover-controls"},Q0=["onClick"],X0=["data-open-direction"],Z0=["onClick"],eT=["onClick"],tT=["onInput"],nT=["aria-label","title","onClick"],rT={key:0,class:"thread-list"},oT=["data-menu-open"],sT={class:"thread-left-stack"},aT=["data-state"],iT=["onClick"],lT=["onClick"],uT={class:"thread-row-title-wrap"},cT={class:"thread-row-title-line"},dT={class:"thread-row-title"},fT=["title"],pT=["data-state"],hT={class:"thread-row-time"},mT=["onClick"],vT=["onClick"],gT=["data-open-direction"],yT={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},wT=["onKeydown"],bT={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},TT={class:"rename-thread-title"},_T={class:"rename-thread-subtitle"},ST={class:"rename-thread-actions"},kT={class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread automation"},xT={class:"rename-thread-title"},CT={class:"automation-thread-field"},AT={class:"automation-thread-field"},ET={class:"automation-thread-field"},IT={class:"automation-thread-field"},MT={key:0,class:"rename-thread-subtitle automation-thread-error"},RT={class:"rename-thread-actions"},PT=["disabled"],$T=["disabled"],OT=["disabled"],DT=4,Jd=6,Qd="codex-web-local.thread-view-mode.v1",Xd="codex-web-local.collapsed-projects.v1",LT=Cn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread"],setup(e,{emit:t}){const n=e,r=t,o=M({}),s=M({});let i=!1;const l=M([]),c=M(""),p=M(""),f=M({}),g=M({}),T=M({}),k=M("actions"),U=M(""),H=M(!1),Z=M(""),q=M(""),R=M(null),F=M(!1),z=M(""),de=M(""),ue=M({}),we=M(!1),ke=M(""),me=M("create"),Ee=M(""),$e=M(!1),Y=M({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),ve=M(null),Fe=M(null),Ne=M(null);let Ie=null,Te=null;const _e=M(""),He=M({}),Ke=new Map,Ve=new Map,Je=new Map,mt=new WeakMap,Xe=M(null),kt=M(null),je=M(!1),Q=M(Re()),pe=typeof window<"u"?new ResizeObserver(y=>{for(const w of y){const E=w.target,W=mt.get(E);W&&vt(W,E)}}):null;function ge(){if(typeof window>"u")return{};try{const y=window.localStorage.getItem(Xd);if(!y)return{};const w=JSON.parse(y);return!w||typeof w!="object"||Array.isArray(w)?{}:w}catch{return{}}}function Re(){return typeof window>"u"?"project":window.localStorage.getItem(Qd)==="chronological"?"chronological":"project"}s.value=ge(),it(s,y=>{typeof window>"u"||window.localStorage.setItem(Xd,JSON.stringify(y))},{deep:!0}),it(Q,y=>{typeof window>"u"||window.localStorage.setItem(Qd,y)});const ze=re(()=>n.searchQuery.trim().toLowerCase()),_=re(()=>ze.value.length>0),A=re(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),B=re(()=>new Set(l.value));function G(y){if(!_.value)return!0;if(A.value)return A.value.has(y.id);const w=ze.value;return y.title.toLowerCase().includes(w)||y.preview.toLowerCase().includes(w)}const ne=re(()=>_.value?n.groups.map(y=>({...y,threads:y.threads.filter(G)})).filter(y=>y.threads.length>0):n.groups),ee=re(()=>Q.value==="chronological"),le=re(()=>{const y=ne.value,w=[];for(const E of y)for(const W of E.threads)B.value.has(W.id)||w.push(W);return w.sort((E,W)=>{const Le=new Date(E.updatedAtIso||E.createdAtIso).getTime();return new Date(W.updatedAtIso||W.createdAtIso).getTime()-Le})}),fe=re(()=>{const y=new Map;for(const w of n.groups)for(const E of w.threads)y.set(E.id,E);return y});it(l,y=>{i&&Ab(y)}),it(fe,y=>{const w=l.value.filter(E=>y.has(E));w.length!==l.value.length&&(l.value=w)}),Oo(async()=>{const{threadIds:y}=await Cb(),w=Array.isArray(y)?y.filter(E=>typeof E=="string").map(E=>E.trim()).filter((E,W,Le)=>E.length>0&&Le.indexOf(E)===W):[];w.length>0&&(l.value=w);try{ue.value=await Bw()}catch{ue.value={}}i=!0});const ce=re(()=>nt(z.value)),oe=re(()=>{const y=new Map;for(const w of n.groups)for(const E of w.threads)y.set(E.id,w.projectName);return y}),Ae=re(()=>{const y=new Map;for(const w of n.groups){const E=w.threads.filter(W=>!B.value.has(W.id));y.set(w.projectName,E)}return y}),ye=re(()=>{const y=new Map;for(const w of n.groups)for(const E of w.threads){const W=new Date(E.updatedAtIso||E.createdAtIso).getTime();y.set(E.id,W)}return y}),he=re(()=>{const y=p.value;return y?fe.value.get(y)??null:null}),Oe=re(()=>l.value.map(y=>fe.value.get(y)??null).filter(y=>y!==null).filter(G)),P=re(()=>{const y=Ne.value;if(!y||y.dropTargetIndexFull===null||n.groups.length===0)return null;const w=Math.max(0,Math.min(y.dropTargetIndexFull,n.groups.length)),E=w>y.fromIndex?w-1:w,W=Math.max(0,Math.min(E,n.groups.length-1));return W===y.fromIndex?null:W}),O=re(()=>{const w=(_.value?ne.value:n.groups).map(yt=>yt.projectName),E=Ne.value,W=P.value;if(!E||W===null)return w;const Le=[...w],[gt]=Le.splice(E.fromIndex,1);return gt?(Le.splice(W,0,gt),Le):w}),N=re(()=>{const y={};let w=0;for(const E of O.value)y[E]=w,w+=hn(E);return y}),V=re(()=>{let y=0;for(const w of O.value)y+=hn(w);return{height:`${Math.max(0,y)}px`}});function te(y){if(Number.isNaN(y))return"n/a";const w=Math.abs(Date.now()-y);if(w<6e4)return"now";const E=Math.floor(w/6e4);if(E<60)return`${E}m`;const W=Math.floor(E/60);return W<24?`${W}h`:`${Math.floor(W/24)}d`}function be(y){const w=ye.value.get(y.id);return te(typeof w=="number"?w:new Date(y.updatedAtIso||y.createdAtIso).getTime())}function Pe(y){return B.value.has(y)}function at(y){if(Pe(y)){l.value=l.value.filter(w=>w!==y);return}l.value=[y,...l.value]}function ut(y){r("select",y)}function nt(y){return!!ue.value[y]}function Ot(y){const w=ue.value[y];if(!w)return"";const E=w.status==="PAUSED"?"-":w.nextRunAtMs?new Date(w.nextRunAtMs).toLocaleString():"Not scheduled";return`${w.name} • Next run: ${E}`}function Rt(y){r("export-thread",y),Ze()}function Fn(y){r("fork-thread",y),Ze()}function Bn(y){return`start new thread ${bn(y)}`}function Kr(y){r("start-new-thread",y)}function fr(y){r("browse-thread-files",y),Ze()}function wr(y,w){if(p.value===y){if(w){const E=w.relatedTarget,W=kt.value;if(E instanceof Node&&W&&W.contains(E))return}Ze()}}function sn(y){return p.value===y}function Ze(){p.value="",T.value={}}function Jn(y){if(p.value===y){Ze();return}Bt(),je.value=!1,p.value=y,Gt(()=>{Xt(y)})}function wn(y,w){y.preventDefault(),p.value=w}function Jt(y,w){Z.value=y,q.value=w,H.value=!0,Ze(),Gt(()=>{var E,W;(E=R.value)==null||E.focus(),(W=R.value)==null||W.select()})}function or(){H.value=!1,Z.value="",q.value=""}function br(){const y=Z.value,w=q.value.trim();!y||!w||(r("rename-thread",{threadId:y,title:w}),or())}function ft(y,w){z.value=y,de.value=w,F.value=!0,Ze()}function It(){F.value=!1,z.value="",de.value=""}async function qt(){const y=z.value;if(y){if(nt(y)){try{await Hd(y)}catch{}ue.value=Object.fromEntries(Object.entries(ue.value).filter(([w])=>w!==y))}l.value=l.value.filter(w=>w!==y),r("archive",y),It()}}function sr(y){const w=ue.value[y];ke.value=y,me.value=w?"edit":"create",Ee.value="",Y.value={name:(w==null?void 0:w.name)??"Thread automation",prompt:(w==null?void 0:w.prompt)??"",rrule:(w==null?void 0:w.rrule)??"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:(w==null?void 0:w.status)??"ACTIVE"},we.value=!0,Ze()}function an(){we.value=!1,ke.value="",Ee.value="",$e.value=!1}async function ar(){const y=ke.value;if(y){$e.value=!0,Ee.value="";try{const w=await Uw({threadId:y,name:Y.value.name,prompt:Y.value.prompt,rrule:Y.value.rrule,status:Y.value.status});ue.value={...ue.value,[y]:w},an()}catch(w){Ee.value=w instanceof Error?w.message:"Failed to save automation",$e.value=!1}}}async function Yr(){const y=ke.value;if(y){$e.value=!0,Ee.value="";try{await Hd(y),ue.value=Object.fromEntries(Object.entries(ue.value).filter(([w])=>w!==y)),an()}catch(w){Ee.value=w instanceof Error?w.message:"Failed to remove automation",$e.value=!1}}}function bn(y){return n.projectDisplayNameById[y]??y}function Tr(y){return c.value===y}function Bt(){c.value="",k.value="actions",U.value=""}function Qn(){const y=!je.value;y&&(Bt(),Ze()),je.value=y}function Xn(y){Q.value=y,je.value=!1}function An(y){if(c.value===y){Bt();return}Ze(),je.value=!1,c.value=y,k.value="actions",U.value=bn(y),Gt(()=>{tr(y)})}function pn(y){Ze(),c.value=y,k.value="rename",U.value=bn(y),Gt(()=>{tr(y)})}function Zn(y){r("rename-project",{projectName:y,displayName:U.value})}function _r(y){r("remove-project",y),Bt()}function Tn(y,w){if(!y.altKey||y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;const E=n.groups.findIndex(gt=>gt.projectName===w);if(E<0)return;const W=y.key==="ArrowUp"?-1:1,Le=Math.max(0,Math.min(E+W,n.groups.length-1));Le!==E&&(y.preventDefault(),r("reorder-project",{projectName:w,toIndex:Le}))}function Sr(y){return o.value[y]===!0}function Qt(y){return s.value[y]===!0}function Jr(y){o.value={...o.value,[y]:!Sr(y)}}function Ut(y){if(_e.value===y){_e.value="";return}s.value={...s.value,[y]:!Qt(y)}}function hn(y){const w=He.value[y]??0,E=Ne.value,Le=((E==null?void 0:E.projectName)===y?E.groupHeight:null)??w,gt=Qt(y)?0:Jd;return Math.max(0,Le+gt)}function En(y,w){const E=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(E){Ve.set(y,E);return}Ve.delete(y)}function Un(y,w){const E=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(E){Je.set(y,E);return}Je.delete(y)}function mn(y){let w=y.parentElement;for(;w;){const E=window.getComputedStyle(w),W=E.overflowY||E.overflow;if(W==="auto"||W==="scroll"||W==="hidden"||W==="clip")return w.getBoundingClientRect();w=w.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function qn(y,w){const E=y.getBoundingClientRect(),W=mn(y),Le=6,gt=W.bottom-E.bottom,yt=E.top-W.top;return gt>=w+Le?"down":yt>gt?"up":"down"}function xt(y,w){const E=Je.get(y);if(!E)return"down";const W=qn(E,w);return g.value={...g.value,[y]:W},W}function er(y){return g.value[y]??"down"}function tr(y){const w=Ve.get(y);w&&(f.value={...f.value,[y]:qn(w,112)})}function In(y,w,E){return Math.min(Math.max(y,w),E)}function Xt(y){const w=Je.get(y);if(!w)return;const E=kt.value,W=E==null?void 0:E.getBoundingClientRect(),Le=(W==null?void 0:W.height)||(E==null?void 0:E.offsetHeight)||112,gt=(W==null?void 0:W.width)||(E==null?void 0:E.offsetWidth)||160,yt=xt(y,Le),vr=w.getBoundingClientRect(),tn=8,gn=4,Sn=Math.max(tn,window.innerWidth-gt-tn),Nr=In(vr.right-gt,tn,Sn),kr=In(yt==="up"?vr.top-Le-gn:vr.bottom+gn,tn,Math.max(tn,window.innerHeight-Le-tn));T.value={left:`${Math.round(Nr)}px`,top:`${Math.round(kr)}px`}}function Ct(){const y=p.value;y&&Xt(y)}function vn(){window.addEventListener("resize",Ct),document.addEventListener("scroll",Ct,!0)}function pr(){window.removeEventListener("resize",Ct),document.removeEventListener("scroll",Ct,!0)}function Or(y){const w=c.value;if(!w)return!1;const E=Ve.get(w);if(!E)return!1;if((typeof y.composedPath=="function"?y.composedPath():[]).includes(E))return!0;const Le=y.target;return Le instanceof Node?E.contains(Le):!1}function Hn(y){const w=p.value;if(!w)return!1;const E=Je.get(w);if(!E)return!1;const W=typeof y.composedPath=="function"?y.composedPath():[];if(W.includes(E))return!0;const Le=kt.value;if(Le&&W.includes(Le))return!0;const gt=y.target;return gt instanceof Node?!!(E.contains(gt)||Le&&Le.contains(gt)):!1}function Mn(y){if(je.value){const w=Xe.value,E=typeof y.composedPath=="function"?y.composedPath():[];!!w&&(E.includes(w)||y.target instanceof Node&&w.contains(y.target))||(je.value=!1)}c.value&&(Or(y)||Bt(),p.value&&(Hn(y)||Ze()))}function Ht(y){c.value&&!Or(y)&&Bt(),p.value&&!Hn(y)&&Ze()}function pt(){je.value&&(je.value=!1),c.value&&Bt(),p.value&&Ze()}function Pt(){window.addEventListener("pointerdown",Mn,{capture:!0}),window.addEventListener("focusin",Ht,{capture:!0}),window.addEventListener("blur",pt)}function Dr(){window.removeEventListener("pointerdown",Mn,{capture:!0}),window.removeEventListener("focusin",Ht,{capture:!0}),window.removeEventListener("blur",pt)}function vt(y,w){const E=w.getBoundingClientRect().height;if(!Number.isFinite(E)||E<=0)return;const W=He.value[y];W!==void 0&&Math.abs(W-E)<.5||(He.value={...He.value,[y]:E})}function _n(y,w){const E=Ke.get(y);E&&E!==w&&pe&&pe.unobserve(E);const W=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(W){Ke.set(y,W),mt.set(W,y),vt(y,W),pe==null||pe.observe(W);return}E&&(pe==null||pe.unobserve(E)),Ke.delete(y)}function Zt(y,w){if(y.button!==0||Fe.value||Ne.value)return;const E=n.groups.findIndex(yt=>yt.projectName===w),W=Ke.get(w);if(E<0||!W)return;const Le=W.getBoundingClientRect(),gt=Qt(w)?0:Jd;Fe.value={projectName:w,fromIndex:E,startClientX:y.clientX,startClientY:y.clientY,pointerOffsetY:y.clientY-Le.top,groupLeft:Le.left,groupWidth:Le.width,groupHeight:Le.height,groupOuterHeight:Le.height+gt},y.preventDefault(),Vn()}function Vn(){window.addEventListener("mousemove",ln),window.addEventListener("mouseup",un),window.addEventListener("keydown",hr)}function ir(){window.removeEventListener("mousemove",ln),window.removeEventListener("mouseup",un),window.removeEventListener("keydown",hr)}function ln(y){Ie={clientX:y.clientX,clientY:y.clientY},Lr()}function un(y){nr({clientX:y.clientX,clientY:y.clientY});const w=Ne.value;if(w&&P.value!==null){const E=n.groups.findIndex(W=>W.projectName===w.projectName);if(E>=0){const W=P.value;W!==E&&r("reorder-project",{projectName:w.projectName,toIndex:W})}}mr()}function hr(y){y.key==="Escape"&&(!Fe.value&&!Ne.value||(y.preventDefault(),mr()))}function mr(){Te!==null&&(window.cancelAnimationFrame(Te),Te=null),Ie=null,Fe.value=null,Ne.value=null,_e.value="",ir()}function Lr(){Te===null&&(Te=window.requestAnimationFrame(()=>{if(Te=null,!Ie)return;const y=Ie;Ie=null,nr(y)}))}function nr(y){const w=Fe.value;if(!Ne.value&&w){const E=y.clientX-w.startClientX,W=y.clientY-w.startClientY;if(Math.hypot(E,W)<DT)return;Bt(),_e.value=w.projectName,Ne.value={projectName:w.projectName,fromIndex:w.fromIndex,pointerOffsetY:w.pointerOffsetY,groupLeft:w.groupLeft,groupWidth:w.groupWidth,groupHeight:w.groupHeight,groupOuterHeight:w.groupOuterHeight,ghostTop:y.clientY-w.pointerOffsetY,dropTargetIndexFull:null}}Ne.value&&C(y)}function C(y){const w=Ne.value;if(!w)return;if(w.ghostTop=y.clientY-w.pointerOffsetY,!j(y)){w.dropTargetIndexFull=null;return}const E=y.clientY,W=ve.value;if(!W){w.dropTargetIndexFull=null;return}const Le=W.getBoundingClientRect(),gt=new Map(n.groups.map((gn,Sn)=>[gn.projectName,Sn])),yt=n.groups.map(gn=>gn.projectName).filter(gn=>gn!==w.projectName);let vr=0,tn=n.groups.length;for(const gn of yt){const Sn=gt.get(gn);if(Sn===void 0)continue;const Nr=hn(gn),kr=Le.top+vr+Nr/2;if(E<kr){tn=Sn;break}vr+=Nr}w.dropTargetIndexFull=tn}function j(y){const w=ve.value;if(!w)return!1;const E=w.getBoundingClientRect(),W=y.clientX>=E.left&&y.clientX<=E.right,Le=y.clientY>=E.top-32&&y.clientY<=E.bottom+32;return W&&Le}function X(y){var w;return((w=Ne.value)==null?void 0:w.projectName)===y}function De(y){const w=Ne.value,E=N.value[y]??0,W=p.value?oe.value.get(p.value)??"":"",Le=c.value===y||W===y;return!w||w.projectName!==y?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Le?"40":"1",transform:`translate3d(0, ${E}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${w.groupLeft}px`,width:`${w.groupWidth}px`,height:`${w.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${w.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Qe(y){return Ae.value.get(y.projectName)??[]}function jt(y){if(_.value)return Qe(y);if(Qt(y.projectName))return[];const w=Qe(y);return Sr(y.projectName)?w:w.slice(0,10)}function Kt(y){return _.value?!1:!Qt(y.projectName)&&Qe(y).length>10}function Ft(y){return Qe(y).length>0}function At(y){return!!y.pendingRequestState||y.inProgress||y.unread}function Rn(y){return y.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function lr(y){return y.pendingRequestState==="approval"?"awaiting-approval":y.pendingRequestState==="response"?"awaiting-response":y.inProgress?"working":y.unread?"unread":"idle"}it(()=>n.groups.map(y=>y.projectName),y=>{var Le,gt;const w=((Le=Ne.value)==null?void 0:Le.projectName)??((gt=Fe.value)==null?void 0:gt.projectName)??"";w&&!n.groups.some(yt=>yt.projectName===w)&&mr();const E=new Set(y),W=Object.fromEntries(Object.entries(He.value).filter(([yt])=>E.has(yt)));Object.keys(W).length!==Object.keys(He.value).length&&(He.value=W)});const en=re(()=>je.value||c.value!==""||p.value!=="");return it(en,y=>{if(y){Pt();return}Dr()}),it(p,y=>{if(!y){pr();return}vn(),Gt(()=>{Xt(y)})}),es(()=>{for(const y of Ke.values())pe==null||pe.unobserve(y);Ke.clear(),Ve.clear(),pr(),Dr(),mr()}),(y,w)=>(S(),$("section",u0,[Oe.value.length>0?(S(),$("section",c0,[v("ul",d0,[(S(!0),$(qe,null,Dt(Oe.value,E=>(S(),$("li",{key:E.id,class:"thread-row-item","data-menu-open":sn(E.id)?"true":"false"},[Be(Wo,{class:"thread-row","data-active":E.id===e.selectedThreadId,"data-pinned":Pe(E.id),"data-menu-open":sn(E.id)?"true":"false","force-right-hover":sn(E.id),onMouseleave:W=>wr(E.id,W),onContextmenu:W=>wn(W,E.id)},{left:bt(()=>[v("span",p0,[At(E)?(S(),$("span",{key:0,class:"thread-status-indicator","data-state":lr(E)},null,8,h0)):ie("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:W=>at(E.id)},[Be(nu,{class:"thread-icon"})],8,m0)])]),right:bt(()=>[v("span",_0,ae(be(E)),1)]),"right-hover":bt(()=>[v("div",{ref_for:!0,ref:W=>Un(E.id,W),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:lt(W=>Jn(E.id),["stop"])},[Be(ra,{class:"thread-icon"})],8,S0)],512)]),default:bt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:W=>ut(E.id)},[v("span",g0,[v("span",y0,[v("span",w0,ae(E.title),1),E.hasWorktree?(S(),st(hi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ie("",!0),nt(E.id)?(S(),$("span",{key:1,class:"thread-row-automation-chip",title:Ot(E.id)}," Auto ",8,b0)):ie("",!0),E.pendingRequestState?(S(),$("span",{key:2,class:"thread-row-request-chip","data-state":E.pendingRequestState},ae(Rn(E)),9,T0)):ie("",!0)])])],8,v0)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onMouseleave","onContextmenu"])],8,f0))),128))])])):ie("",!0),Be(Wo,{as:"header",class:"thread-tree-header-row"},{right:bt(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:Xe,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":je.value,"aria-label":"Organize threads",title:"Organize threads",onClick:Qn},[Be(ra,{class:"thread-icon"})],8,k0),je.value?(S(),$("div",{key:0,class:"organize-menu-panel",onClick:w[2]||(w[2]=lt(()=>{},["stop"]))},[w[19]||(w[19]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":Q.value==="project",type:"button",onClick:w[0]||(w[0]=E=>Xn("project"))},[w[17]||(w[17]=v("span",null,"By project",-1)),Q.value==="project"?(S(),$("span",C0,"✓")):ie("",!0)],8,x0),v("button",{class:"organize-menu-item","data-active":Q.value==="chronological",type:"button",onClick:w[1]||(w[1]=E=>Xn("chronological"))},[w[18]||(w[18]=v("span",null,"Chronological list",-1)),Q.value==="chronological"?(S(),$("span",E0,"✓")):ie("",!0)],8,A0)])):ie("",!0)],512)]),default:bt(()=>[w[20]||(w[20]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),_.value&&ne.value.length===0?(S(),$("p",I0,"No matching threads")):e.isLoading&&e.groups.length===0?(S(),$("p",M0,"Loading threads...")):ee.value?(S(),$("ul",R0,[(S(!0),$(qe,null,Dt(le.value,E=>(S(),$("li",{key:E.id,class:"thread-row-item","data-menu-open":sn(E.id)?"true":"false"},[Be(Wo,{class:"thread-row","data-active":E.id===e.selectedThreadId,"data-pinned":Pe(E.id),"data-menu-open":sn(E.id)?"true":"false","force-right-hover":sn(E.id),onMouseleave:W=>wr(E.id,W),onContextmenu:W=>wn(W,E.id)},{left:bt(()=>[v("span",$0,[At(E)?(S(),$("span",{key:0,class:"thread-status-indicator","data-state":lr(E)},null,8,O0)):ie("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:W=>at(E.id)},[Be(nu,{class:"thread-icon"})],8,D0)])]),right:bt(()=>[v("span",q0,ae(be(E)),1)]),"right-hover":bt(()=>[v("div",{ref_for:!0,ref:W=>Un(E.id,W),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:lt(W=>Jn(E.id),["stop"])},[Be(ra,{class:"thread-icon"})],8,H0)],512)]),default:bt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:W=>ut(E.id)},[v("span",N0,[v("span",j0,[v("span",F0,ae(E.title),1),E.hasWorktree?(S(),st(hi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ie("",!0),nt(E.id)?(S(),$("span",{key:1,class:"thread-row-automation-chip",title:Ot(E.id)}," Auto ",8,B0)):ie("",!0),E.pendingRequestState?(S(),$("span",{key:2,class:"thread-row-request-chip","data-state":E.pendingRequestState},ae(Rn(E)),9,U0)):ie("",!0)])])],8,L0)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onMouseleave","onContextmenu"])],8,P0))),128))])):(S(),$("div",{key:4,ref_key:"groupsContainerRef",ref:ve,class:"thread-tree-groups",style:io(V.value)},[(S(!0),$(qe,null,Dt(ne.value,E=>(S(),$("article",{key:E.projectName,ref_for:!0,ref:W=>_n(E.projectName,W),class:"project-group","data-project-name":E.projectName,"data-expanded":!Qt(E.projectName),"data-dragging":X(E.projectName),style:io(De(E.projectName))},[Be(Wo,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:W=>Ut(E.projectName),onKeydown:[W=>Tn(W,E.projectName),zt(lt(W=>Ut(E.projectName),["prevent"]),["enter"]),zt(lt(W=>Ut(E.projectName),["prevent"]),["space"])]},{left:bt(()=>[v("span",W0,[v("span",z0,[Qt(E.projectName)?(S(),st(ic,{key:0,class:"thread-icon"})):(S(),st(Jb,{key:1,class:"thread-icon"}))]),v("span",G0,[Qt(E.projectName)?(S(),st(Nb,{key:0,class:"thread-icon"})):(S(),st(ac,{key:1,class:"thread-icon"}))])])]),right:bt(()=>[v("div",J0,[v("div",{ref_for:!0,ref:W=>En(E.projectName,W),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:lt(W=>An(E.projectName),["stop"])},[Be(ra,{class:"thread-icon"})],8,Q0),Tr(E.projectName)?(S(),$("div",{key:0,class:"project-menu-panel","data-open-direction":f.value[E.projectName]??"down",onClick:w[4]||(w[4]=lt(()=>{},["stop"]))},[k.value==="actions"?(S(),$(qe,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:W=>pn(E.projectName)}," Edit name ",8,Z0),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:W=>_r(E.projectName)}," Remove ",8,eT)],64)):(S(),$(qe,{key:1},[w[21]||(w[21]=v("label",{class:"project-menu-label"},"Project name",-1)),rn(v("input",{"onUpdate:modelValue":w[3]||(w[3]=W=>U.value=W),class:"project-menu-input",type:"text",onInput:W=>Zn(E.projectName)},null,40,tT),[[yn,U.value]])],64))],8,X0)):ie("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Bn(E.projectName),title:Bn(E.projectName),onClick:lt(W=>Kr(E.projectName),["stop"])},[Be(Si,{class:"thread-icon"})],8,nT)])]),default:bt(()=>[v("span",{class:"project-main-button","data-dragging-handle":X(E.projectName),onMousedown:lt(W=>Zt(W,E.projectName),["left"])},[v("span",Y0,ae(bn(E.projectName)),1)],40,K0)]),_:2},1032,["onClick","onKeydown"]),Ft(E)?(S(),$("ul",rT,[(S(!0),$(qe,null,Dt(jt(E),W=>(S(),$("li",{key:W.id,class:"thread-row-item","data-menu-open":sn(W.id)?"true":"false"},[Be(Wo,{class:"thread-row","data-active":W.id===e.selectedThreadId,"data-pinned":Pe(W.id),"data-menu-open":sn(W.id)?"true":"false","force-right-hover":sn(W.id),onMouseleave:Le=>wr(W.id,Le),onContextmenu:Le=>wn(Le,W.id)},{left:bt(()=>[v("span",sT,[At(W)?(S(),$("span",{key:0,class:"thread-status-indicator","data-state":lr(W)},null,8,aT)):ie("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Le=>at(W.id)},[Be(nu,{class:"thread-icon"})],8,iT)])]),right:bt(()=>[v("span",hT,ae(be(W)),1)]),"right-hover":bt(()=>[v("div",{ref_for:!0,ref:Le=>Un(W.id,Le),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:lt(Le=>Jn(W.id),["stop"])},[Be(ra,{class:"thread-icon"})],8,mT)],512)]),default:bt(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Le=>ut(W.id)},[v("span",uT,[v("span",cT,[v("span",dT,ae(W.title),1),W.hasWorktree?(S(),st(hi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ie("",!0),nt(W.id)?(S(),$("span",{key:1,class:"thread-row-automation-chip",title:Ot(W.id)}," Auto ",8,fT)):ie("",!0),W.pendingRequestState?(S(),$("span",{key:2,class:"thread-row-request-chip","data-state":W.pendingRequestState},ae(Rn(W)),9,pT)):ie("",!0)])])],8,lT)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onMouseleave","onContextmenu"])],8,oT))),128))])):(S(),st(Wo,{key:1,as:"p",class:"project-empty-row"},{left:bt(()=>[...w[22]||(w[22]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:bt(()=>[w[23]||(w[23]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),Kt(E)?(S(),st(Wo,{key:2,class:"thread-show-more-row"},{left:bt(()=>[...w[24]||(w[24]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:bt(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:W=>Jr(E.projectName)},ae(Sr(E.projectName)?"Show less":"Show more"),9,vT)]),_:2},1024)):ie("",!0)],12,V0))),128))],4)),(S(),st(bs,{to:"body"},[he.value?(S(),$("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:kt,class:"thread-menu-panel thread-menu-panel-fixed",style:io(T.value),"data-open-direction":er(he.value.id),onClick:w[11]||(w[11]=lt(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:w[5]||(w[5]=E=>sr(he.value.id))},ae(nt(he.value.id)?"Edit automation…":"Add automation…"),1),v("button",{class:"thread-menu-item",type:"button",onClick:w[6]||(w[6]=E=>fr(he.value.id))}," Browse files "),v("button",{class:"thread-menu-item",type:"button",onClick:w[7]||(w[7]=E=>Rt(he.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:w[8]||(w[8]=E=>Fn(he.value.id))}," Create chat fork "),v("button",{class:"thread-menu-item",type:"button",onClick:w[9]||(w[9]=E=>Jt(he.value.id,he.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:w[10]||(w[10]=E=>ft(he.value.id,he.value.title))}," Delete thread ")],12,gT)):ie("",!0)])),(S(),st(bs,{to:"body"},[H.value?(S(),$("div",{key:0,class:"rename-thread-overlay",onClick:lt(or,["self"])},[v("div",yT,[w[25]||(w[25]=v("h3",{class:"rename-thread-title"},"Rename thread",-1)),w[26]||(w[26]=v("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),rn(v("input",{ref_key:"renameThreadInputRef",ref:R,"onUpdate:modelValue":w[12]||(w[12]=E=>q.value=E),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[zt(lt(br,["prevent"]),["enter"]),zt(lt(or,["prevent"]),["esc"])]},null,40,wT),[[yn,q.value]]),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:or},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:br},"Save")])])])):ie("",!0)])),(S(),st(bs,{to:"body"},[F.value?(S(),$("div",{key:0,class:"rename-thread-overlay",onClick:lt(It,["self"])},[v("div",bT,[v("h3",TT,ae(ce.value?"Archive chat and remove automation?":"Delete thread?"),1),v("p",_T,[ce.value?(S(),$(qe,{key:0},[lo(' This will archive the thread "'+ae(de.value)+'" and remove the attached heartbeat automation. ',1)],64)):(S(),$(qe,{key:1},[lo(' This will archive the thread "'+ae(de.value)+'". You can find it later in archived threads. ',1)],64))]),v("div",ST,[v("button",{class:"rename-thread-button",type:"button",onClick:It},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:qt},ae(ce.value?"Archive and remove":"Delete"),1)])])])):ie("",!0)])),(S(),st(bs,{to:"body"},[we.value?(S(),$("div",{key:0,class:"rename-thread-overlay",onClick:lt(an,["self"])},[v("div",kT,[v("h3",xT,ae(me.value==="edit"?"Edit automation":"Add automation"),1),w[32]||(w[32]=v("p",{class:"rename-thread-subtitle"},"This creates a heartbeat automation attached to the selected thread.",-1)),v("label",CT,[w[27]||(w[27]=v("span",{class:"automation-thread-label"},"Name",-1)),rn(v("input",{"onUpdate:modelValue":w[13]||(w[13]=E=>Y.value.name=E),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[yn,Y.value.name]])]),v("label",AT,[w[28]||(w[28]=v("span",{class:"automation-thread-label"},"Prompt",-1)),rn(v("textarea",{"onUpdate:modelValue":w[14]||(w[14]=E=>Y.value.prompt=E),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[yn,Y.value.prompt]])]),v("label",ET,[w[29]||(w[29]=v("span",{class:"automation-thread-label"},"Schedule (RRULE)",-1)),rn(v("input",{"onUpdate:modelValue":w[15]||(w[15]=E=>Y.value.rrule=E),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0"},null,512),[[yn,Y.value.rrule]])]),v("label",IT,[w[31]||(w[31]=v("span",{class:"automation-thread-label"},"Status",-1)),rn(v("select",{"onUpdate:modelValue":w[16]||(w[16]=E=>Y.value.status=E),class:"automation-thread-select"},[...w[30]||(w[30]=[v("option",{value:"ACTIVE"},"Active",-1),v("option",{value:"PAUSED"},"Paused",-1)])],512),[[Cg,Y.value.status]])]),Ee.value?(S(),$("p",MT,ae(Ee.value),1)):ie("",!0),v("div",RT,[me.value==="edit"?(S(),$("button",{key:0,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:$e.value,onClick:Yr}," Remove ",8,PT)):ie("",!0),v("button",{class:"rename-thread-button",type:"button",disabled:$e.value,onClick:an}," Cancel ",8,$T),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:$e.value,onClick:ar},ae($e.value?"Saving…":"Save"),9,OT)])])])):ie("",!0)]))]))}}),NT=ht(LT,[["__scopeId","data-v-cb33487e"]]),jT={class:"content-header"},FT={class:"content-leading"},BT={class:"content-title"},UT={class:"content-actions"},qT=Cn({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(S(),$("header",jT,[v("div",FT,[zr(t.$slots,"leading",{},void 0)]),v("h1",BT,ae(e.title),1),v("div",UT,[zr(t.$slots,"actions",{},void 0)])]))}}),HT=ht(qT,[["__scopeId","data-v-66ee223c"]]),Zd=.0025,ru=3,ef=2,VT=256;function WT(e){var $e;const t=M("idle"),n=M(typeof navigator<"u"&&!!(($e=navigator.mediaDevices)!=null&&$e.getUserMedia)),r=M(0),o=M(null);let s=null,i=null,l=[],c=null,p=null,f=null,g=null,T=[],k=!1,U=!1,H=null;function Z(){H&&(H.abort(),H=null),t.value==="transcribing"&&(t.value="idle")}function q(){const Y=o.value;if(!Y||typeof window>"u")return;const ve=Y.getContext("2d");if(!ve)return;const Fe=Math.max(1,Math.floor(Y.clientWidth)),Ne=Math.max(1,Math.floor(Y.clientHeight||36)),Ie=window.devicePixelRatio||1,Te=Math.max(1,Math.floor(Fe*Ie)),_e=Math.max(1,Math.floor(Ne*Ie));(Y.width!==Te||Y.height!==_e)&&(Y.width=Te,Y.height=_e),ve.setTransform(Ie,0,0,Ie,0,0),ve.clearRect(0,0,Fe,Ne);const He=Math.max(12,Math.floor(Fe/(ru+ef))),Ke=T.slice(-He),Ve=Math.max(0,He-Ke.length),Je=Ne/2,mt=getComputedStyle(Y).color||"#000000";for(let Xe=0;Xe<He;Xe+=1){const kt=Ke[Xe-Ve]??0,Q=Math.max(.08,Math.min(1,kt*18))*Je,pe=Xe*(ru+ef);ve.globalAlpha=kt<=Zd?.35:1,ve.fillStyle=mt,ve.fillRect(pe,Je-Q,ru,Q*2)}ve.globalAlpha=1}function R(){T=[],r.value=0,q()}function F(){f&&(f.disconnect(),f.onaudioprocess=null,f=null),p&&(p.disconnect(),p=null),c&&(c.close(),c=null),g=null}function z(Y){if(typeof window>"u")return;const ve=window.webkitAudioContext,Fe=window.AudioContext??ve;Fe&&(F(),R(),c=new Fe,p=c.createMediaStreamSource(Y),f=c.createScriptProcessor(2048,1,1),g=performance.now(),f.onaudioprocess=Ne=>{const Ie=Ne.inputBuffer.getChannelData(0);let Te=0;for(let _e=0;_e<Ie.length;_e+=1){const He=Math.abs(Ie[_e]??0);Te+=He<Zd?0:He}T.push(Te/Ie.length),T.length>VT&&T.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),q()},p.connect(f),f.connect(c.destination),q())}async function de(){var Y;if(t.value==="transcribing"&&Z(),!(t.value!=="idle"||!n.value||k)){k=!0,U=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],s=new MediaRecorder(i),s.ondataavailable=ve=>{ve.data.size>0&&l.push(ve.data)},s.onstop=()=>{var Ne;const ve=l,Fe=(s==null?void 0:s.mimeType)||((Ne=ve[0])==null?void 0:Ne.type)||"audio/webm";me(),ke(ve,Fe)},z(i),s.start(250),t.value="recording",U&&ue()}catch(ve){me(),t.value="idle",(Y=e.onError)==null||Y.call(e,ve)}finally{k=!1}}}function ue(){if(k&&t.value==="idle"){U=!0;return}if(!(t.value!=="recording"||!s)&&s.state!=="inactive"){t.value="transcribing";try{s.requestData()}catch{}s.stop()}}function we(){U=!1,Z(),me(),t.value="idle"}async function ke(Y,ve){var Ie,Te,_e,He,Ke;if(Y.length===0){(Ie=e.onEmpty)==null||Ie.call(e),t.value="idle";return}const Fe=new Blob(Y,{type:ve});t.value="transcribing";let Ne=null;try{const Ve=ve.split(/[/;]/)[1]??"webm",Je=new FormData;Je.append("file",Fe,`codex.${Ve}`);const mt=((Te=e.getLanguage)==null?void 0:Te.call(e).trim())??"";mt&&mt.toLowerCase()!=="auto"&&Je.append("language",mt),Ne=new AbortController,H=Ne;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Je,signal:Ne.signal}),kt=await Xe.text();let je=null;try{je=kt.trim()?JSON.parse(kt):null}catch{je=null}if(!Xe.ok){const pe=(_e=je==null?void 0:je.error)==null?void 0:_e.trim(),ge=kt.trim();throw new Error(pe||ge||`Transcription failed: ${Xe.status}`)}const Q=((je==null?void 0:je.text)??"").trim();Q.length>0?e.onTranscript(Q):(He=e.onEmpty)==null||He.call(e)}catch(Ve){if(Ve instanceof DOMException&&Ve.name==="AbortError")return;(Ke=e.onError)==null||Ke.call(e,Ve)}finally{Ne&&H===Ne&&(H=null),t.value==="transcribing"&&(t.value="idle")}}function me(){F(),R(),s&&(s.ondataavailable=null,s.onstop=null,s=null),i&&(i.getTracks().forEach(Y=>Y.stop()),i=null),l=[]}es(()=>{we()});function Ee(){if(t.value==="recording"){ue();return}(t.value==="idle"||t.value==="transcribing")&&de()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:de,stopRecording:ue,toggleRecording:Ee,cancel:we}}const zT={},GT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function KT(e,t){return S(),$("svg",GT,[...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 YT=ht(zT,[["render",KT]]),JT={},QT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function XT(e,t){return S(),$("svg",QT,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const ZT=ht(JT,[["render",XT]]),e_={},t_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function n_(e,t){return S(),$("svg",t_,[...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 r_=ht(e_,[["render",n_]]),o_={},s_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function a_(e,t){return S(),$("svg",s_,[...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 tf=ht(o_,[["render",a_]]),i_=["disabled"],l_={class:"composer-dropdown-value"},u_={class:"composer-dropdown-menu"},c_={key:0,class:"composer-dropdown-search-wrap"},d_=["placeholder","onKeydown"],f_={class:"composer-dropdown-options",role:"listbox"},p_=["onClick"],h_={key:0,class:"composer-dropdown-empty"},m_=Cn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=M(null),s=M(null),i=M(!1),l=M(""),c=re(()=>{var F;const R=n.options.find(z=>z.value===n.modelValue);return R?R.label:((F=n.placeholder)==null?void 0:F.trim())||""}),p=re(()=>n.openDirection??"down"),f=re(()=>n.enableSearch===!0),g=re(()=>{var R;return((R=n.searchPlaceholder)==null?void 0:R.trim())||"Quick search projects"}),T=re(()=>{var R;return((R=n.emptyLabel)==null?void 0:R.trim())||"No results"}),k=re(()=>{const R=l.value.trim().toLowerCase();return R?n.options.filter(F=>F.label.toLowerCase().includes(R)||F.value.toLowerCase().includes(R)):n.options});function U(){n.disabled||(i.value=!i.value)}function H(R){r("update:modelValue",R),i.value=!1,l.value=""}function Z(){if(l.value.length>0){l.value="";return}i.value=!1}function q(R){if(!i.value)return;const F=o.value;if(!F)return;const z=R.target;z instanceof Node&&(F.contains(z)||(i.value=!1,l.value=""))}return it(i,R=>{R&&f.value&&Gt(()=>{var F;return(F=s.value)==null?void 0:F.focus()})}),Oo(()=>{window.addEventListener("pointerdown",q)}),es(()=>{window.removeEventListener("pointerdown",q)}),(R,F)=>(S(),$("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:U},[e.selectedPrefixIcon?(S(),st(Ku(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ie("",!0),v("span",l_,ae(c.value),1),Be(ac,{class:"composer-dropdown-chevron"})],8,i_),i.value?(S(),$("div",{key:0,class:ot(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":p.value==="up","composer-dropdown-menu-wrap-down":p.value==="down"}])},[v("div",u_,[f.value?(S(),$("div",c_,[rn(v("input",{ref_key:"searchInputRef",ref:s,"onUpdate:modelValue":F[0]||(F[0]=z=>l.value=z),class:"composer-dropdown-search-input",type:"text",placeholder:g.value,onKeydown:zt(lt(Z,["prevent"]),["esc"])},null,40,d_),[[yn,l.value]])])):ie("",!0),v("ul",f_,[(S(!0),$(qe,null,Dt(k.value,z=>(S(),$("li",{key:z.value},[v("button",{class:ot(["composer-dropdown-option",{"is-selected":z.value===e.modelValue}]),type:"button",onClick:de=>H(z.value)},ae(z.label),11,p_)]))),128)),k.value.length===0?(S(),$("li",h_,ae(T.value),1)):ie("",!0)])])],2)):ie("",!0)],512))}}),Jo=ht(m_,[["__scopeId","data-v-2527acc2"]]),v_=["disabled"],g_={class:"search-dropdown-value"},y_={class:"search-dropdown-search-wrap"},w_=["placeholder","onKeydown"],b_={key:0,class:"search-dropdown-list",role:"listbox"},T_=["onClick","onPointerenter"],__={class:"search-dropdown-option-check"},S_={class:"search-dropdown-option-label"},k_={key:0,class:"search-dropdown-option-desc"},x_={key:1,class:"search-dropdown-empty"},C_=Cn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,o=M(null),s=M(null),i=M(null),l=M(!1),c=M(""),p=M(0),f=re(()=>n.openDirection??"down"),g=re(()=>new Set(n.selectedValues)),T=re(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const z=n.options.find(de=>de.value===n.selectedValues[0]);return(z==null?void 0:z.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),k=re(()=>{const z=c.value.toLowerCase().trim();return z?n.options.filter(de=>{var ue;return de.label.toLowerCase().includes(z)||(((ue=de.description)==null?void 0:ue.toLowerCase().includes(z))??!1)}):n.options});function U(){const z=s.value,de=o.value;if(!z||!de||window.innerWidth>=640)return;const ue=de.getBoundingClientRect();f.value==="up"?(z.style.setProperty("bottom",`${window.innerHeight-ue.top+8}px`,"important"),z.style.setProperty("top","auto","important")):(z.style.setProperty("top",`${ue.bottom+8}px`,"important"),z.style.setProperty("bottom","auto","important"))}function H(){n.disabled||(l.value=!l.value,l.value&&(c.value="",p.value=0,Gt(()=>{var z;Gt(()=>{U()}),(z=i.value)==null||z.focus()})))}function Z(z){r("toggle",z.value,!g.value.has(z.value)),l.value=!1}function q(z){k.value.length!==0&&(p.value=(p.value+z+k.value.length)%k.value.length)}function R(){const z=k.value[p.value];z&&Z(z)}function F(z){if(!l.value)return;const de=o.value;if(!de)return;const ue=z.target;ue instanceof Node&&(de.contains(ue)||(l.value=!1))}return it(c,()=>{p.value=0}),Oo(()=>window.addEventListener("pointerdown",F)),es(()=>window.removeEventListener("pointerdown",F)),(z,de)=>(S(),$("div",{ref_key:"rootRef",ref:o,class:"search-dropdown"},[v("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:H},[v("span",g_,ae(T.value),1),Be(ac,{class:"search-dropdown-chevron"})],8,v_),l.value?(S(),$("div",{key:0,ref_key:"menuRef",ref:s,class:ot(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":f.value==="up","search-dropdown-menu-wrap-down":f.value==="down"}])},[v("div",y_,[rn(v("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":de[0]||(de[0]=ue=>c.value=ue),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[de[1]||(de[1]=zt(lt(ue=>l.value=!1,["prevent"]),["escape"])),zt(lt(R,["prevent"]),["enter"]),de[2]||(de[2]=zt(lt(ue=>q(1),["prevent"]),["arrow-down"])),de[3]||(de[3]=zt(lt(ue=>q(-1),["prevent"]),["arrow-up"]))]},null,40,w_),[[yn,c.value]])]),k.value.length>0?(S(),$("ul",b_,[(S(!0),$(qe,null,Dt(k.value,(ue,we)=>(S(),$("li",{key:ue.value},[v("button",{class:ot(["search-dropdown-option",{"is-selected":g.value.has(ue.value),"is-highlighted":we===p.value}]),type:"button",onClick:ke=>Z(ue),onPointerenter:ke=>p.value=we},[v("span",__,ae(g.value.has(ue.value)?"✓":""),1),v("span",S_,ae(ue.label),1),ue.description?(S(),$("span",k_,ae(ue.description),1)):ie("",!0)],42,T_)]))),128))])):(S(),$("div",x_,"No results"))],2)):ie("",!0)],512))}}),A_=ht(C_,[["__scopeId","data-v-3147b20f"]]),E_={class:"skill-picker-header"},I_=["onKeydown"],M_={key:0,class:"skill-picker-list",role:"listbox"},R_=["onClick","onPointerenter"],P_={class:"skill-picker-name"},$_={key:0,class:"skill-picker-desc"},O_={key:1,class:"skill-picker-empty"},D_=Cn({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,o=M(null),s=M(null),i=M(""),l=M(0),c=re(()=>{const T=i.value.toLowerCase().trim();return T?n.skills.filter(k=>k.name.toLowerCase().includes(T)||k.description.toLowerCase().includes(T)):n.skills}),p=re(()=>{const T={};return n.anchorBottom!=null&&(T.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(T.left=`${n.anchorLeft}px`),T});function f(T){c.value.length!==0&&(l.value=(l.value+T+c.value.length)%c.value.length)}function g(){const T=c.value[l.value];T&&r("select",T)}return it(()=>n.visible,T=>{T&&(i.value="",l.value=0,Gt(()=>{var k;return(k=s.value)==null?void 0:k.focus()}))}),it(i,()=>{l.value=0}),(T,k)=>e.visible?(S(),$("div",{key:0,ref_key:"rootRef",ref:o,class:"skill-picker",style:io(p.value)},[v("div",E_,[rn(v("input",{ref_key:"searchInputRef",ref:s,"onUpdate:modelValue":k[0]||(k[0]=U=>i.value=U),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[k[1]||(k[1]=zt(lt(U=>T.$emit("close"),["prevent"]),["escape"])),zt(lt(g,["prevent"]),["enter"]),k[2]||(k[2]=zt(lt(U=>f(1),["prevent"]),["arrow-down"])),k[3]||(k[3]=zt(lt(U=>f(-1),["prevent"]),["arrow-up"]))]},null,40,I_),[[yn,i.value]])]),c.value.length>0?(S(),$("ul",M_,[(S(!0),$(qe,null,Dt(c.value,(U,H)=>(S(),$("li",{key:U.path},[v("button",{class:ot(["skill-picker-item",{"is-highlighted":H===l.value}]),type:"button",onClick:Z=>T.$emit("select",U),onPointerenter:Z=>l.value=H},[v("span",P_,ae(U.name),1),U.description?(S(),$("span",$_,ae(U.description),1)):ie("",!0)],42,R_)]))),128))])):(S(),$("div",O_,"No skills found"))],4)):ie("",!0)}}),L_=ht(D_,[["__scopeId","data-v-ff3fb7dc"]]),N_={key:0,class:"thread-composer-dictation-error"},j_={key:0,class:"thread-composer-attachments"},F_=["src","alt"],B_=["aria-label","disabled","onClick"],U_={key:1,class:"thread-composer-folder-chips"},q_=["title"],H_={class:"thread-composer-folder-chip-meta"},V_=["aria-label","disabled","onClick"],W_={key:2,class:"thread-composer-file-chips"},z_=["title"],G_=["aria-label","disabled","onClick"],K_={key:3,class:"thread-composer-skill-chips"},Y_={class:"thread-composer-skill-chip-name"},J_=["aria-label","onClick"],Q_={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},X_={key:1,class:"thread-composer-file-mentions"},Z_=["onMousedown"],eS={key:1,class:"thread-composer-file-mention-icon-markdown"},tS={class:"thread-composer-file-mention-text"},nS={class:"thread-composer-file-mention-name"},rS={key:0,class:"thread-composer-file-mention-dir"},oS={key:1,class:"thread-composer-file-mention-empty"},sS=["placeholder","disabled"],aS=["disabled"],iS={key:0,class:"thread-composer-attach-menu"},lS=["disabled"],uS=["disabled"],cS=["disabled"],dS={class:"thread-composer-attach-mode"},fS={class:"thread-composer-attach-mode-buttons"},pS=["disabled"],hS=["disabled"],mS=["aria-checked","aria-label","disabled"],vS={class:"thread-composer-attach-setting-copy"},gS={class:"thread-composer-attach-setting-description"},yS=["aria-checked","aria-label","disabled"],wS={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},bS={key:1,class:"thread-composer-dictation-timer"},TS=["aria-label","title","disabled"],_S=["aria-label","title","disabled"],SS={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},kS=["aria-label","title","disabled"],xS=["disabled"],CS=["disabled"],AS=["disabled"],ES=2e3,IS="codex-web-local.thread-draft.v1.",MS=Cn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,o=n,s=M(""),i=M([]),l=M([]),c=M([]),p=M([]),f=M(""),g=M(0),T=M(null),k=M(!1),{state:U,isSupported:H,recordingDurationMs:Z,waveformCanvasRef:q,startRecording:R,stopRecording:F,toggleRecording:z,cancel:de}=WT({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:C=>{if(s.value=s.value?`${s.value}
48
- ${C}`:C,f.value="",r.dictationAutoSend!==!1){const j=r.isTurnInProgress?he.value:"steer";be(j);return}Gt(()=>{var j;return(j=Ee.value)==null?void 0:j.focus()})},onEmpty:()=>{f.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:C=>{if(C instanceof DOMException&&C.name==="NotAllowedError"){f.value="Microphone access was denied.";return}f.value=C instanceof Error?C.message:"Dictation failed."}}),ue=M(null),we=M(null),ke=M(null),me=M(null),Ee=M(null),{isMobile:$e}=rc(),Y=M(!1),ve=M(!1),Fe=M(null),Ne=M(""),Ie=M([]),Te=M(!1),_e=M(0),He=M(0);let Ke=0,Ve=null,Je=!1,mt=0,Xe=0;const kt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let je="";const Q=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function pe(C){return C.trim().replace(/^gpt/i,"GPT")}const ge=re(()=>r.models.map(C=>({value:C,label:pe(C)}))),Re=re(()=>r.selectedCollaborationMode==="plan"),ze=re(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),_=re(()=>r.skills??[]),A=re(()=>l.value.map(C=>C.path)),B=re(()=>(r.skills??[]).map(C=>({value:C.path,label:C.name,description:C.description}))),G=re(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||ze.value||g.value>0?!1:s.value.trim().length>0||i.value.length>0||c.value.length>0),ne=re(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||c.value.length>0||p.value.length>0),ee=re(()=>{const C=new Set;for(const j of p.value)for(const X of j.filePaths)C.add(X);return c.value.filter(j=>!C.has(j.fsPath))}),le=re(()=>r.disabled||!r.activeThreadId),fe=re(()=>r.selectedModel.trim()==="gpt-5.4"),ce=re(()=>r.selectedSpeedMode==="fast"&&fe.value),oe=re(()=>le.value||r.isUpdatingSpeedMode===!0),Ae=re(()=>r.isUpdatingSpeedMode?"Saving speed setting...":r.selectedSpeedMode==="fast"?"About 1.5x faster, with credits used at 2x":"Default speed with normal credit usage"),ye=re(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),he=M(ye.value),Oe=re(()=>U.value==="recording"),P=re(()=>U.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),O=re(()=>U.value==="idle"?f.value.trim():""),N=re(()=>{const C=Math.max(0,Math.floor(Z.value/1e3)),j=Math.floor(C/60),X=C%60;return`${j}:${String(X).padStart(2,"0")}`}),V=re(()=>r.activeThreadId?ze.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),te=re(()=>s.value.trim().length>0||i.value.length>0||c.value.length>0);function be(C="steer"){var X;const j=s.value.trim();if(G.value){if(o("submit",{text:j,imageUrls:i.value.map(De=>De.url),fileAttachments:[...c.value],skills:l.value.map(De=>({name:De.name,path:De.path})),mode:C}),Fn(r.activeThreadId),ut(),p.value=[],Y.value=!1,ve.value=!1,Ht(),kt||$e.value){(X=Ee.value)==null||X.blur();return}Gt(()=>{var De;return(De=Ee.value)==null?void 0:De.focus()})}}function Pe(C){he.value=C}function at(C){He.value+=1,s.value=C.text,i.value=C.imageUrls.map((j,X)=>({id:`queued-${Date.now()}-${X}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${X+1}`,url:j})),l.value=C.skills.map(j=>(r.skills??[]).find(X=>X.path===j.path)??{name:j.name,description:"",path:j.path}),c.value=C.fileAttachments.map(j=>({...j})),p.value=[],f.value="",T.value=null,g.value=0,Y.value=!1,ve.value=!1,Ht(),Xe+=1}function ut(){at({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function nt(C){return`${IS}${C}`}function Ot(C){if(typeof window>"u")return null;const j=C.trim();if(!j)return null;try{const X=window.localStorage.getItem(nt(j));if(!X)return null;const De=JSON.parse(X);return typeof De=="string"?{text:De,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof De.text=="string"?De.text:"",imageUrls:Array.isArray(De.imageUrls)?De.imageUrls.filter(Qe=>typeof Qe=="string"):[],fileAttachments:Array.isArray(De.fileAttachments)?De.fileAttachments.filter(Qe=>!!Qe&&typeof Qe.label=="string"&&typeof Qe.path=="string"&&typeof Qe.fsPath=="string"):[],skills:Array.isArray(De.skills)?De.skills.filter(Qe=>!!Qe&&typeof Qe.name=="string"&&typeof Qe.path=="string"):[]}}catch{return null}}function Rt(C,j){if(typeof window>"u")return;const X=C.trim();if(X)try{if(j.text.trim().length>0||j.imageUrls.length>0||j.fileAttachments.length>0||j.skills.length>0){window.localStorage.setItem(nt(X),JSON.stringify(j));return}window.localStorage.removeItem(nt(X))}catch{}}function Fn(C){Rt(C,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Bn(){return{text:s.value,imageUrls:i.value.map(C=>C.url),fileAttachments:c.value.map(C=>({...C})),skills:l.value.map(C=>({name:C.name,path:C.path}))}}function Kr(){o("interrupt")}function fr(C){o("update:selected-model",C)}function wr(){o("update:selected-collaboration-mode",Re.value?"default":"plan")}function sn(C){o("update:selected-reasoning-effort",C)}function Ze(){oe.value||o("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function Jn(){r.dictationClickToToggle&&(f.value&&(f.value=""),z())}function wn(C){if(r.dictationClickToToggle||(C.preventDefault(),Je))return;Je=!0;const j=C.currentTarget;if(j)try{j.setPointerCapture(C.pointerId)}catch{}f.value&&(f.value=""),window.addEventListener("pointerup",Jt),window.addEventListener("pointercancel",Jt),window.addEventListener("blur",Jt),R()}function Jt(){r.dictationClickToToggle||Je&&(Je=!1,window.removeEventListener("pointerup",Jt),window.removeEventListener("pointercancel",Jt),window.removeEventListener("blur",Jt),F())}function or(){le.value||(Y.value=!Y.value)}function br(){var C;(C=we.value)==null||C.click()}function ft(){var C;(C=ke.value)==null||C.click()}function It(){var C;(C=me.value)==null||C.click()}function qt(C){i.value=i.value.filter(j=>j.id!==C)}function sr(C){l.value=l.value.filter(j=>j.path!==C)}function an(C){c.value=c.value.filter(j=>j.fsPath!==C)}function ar(C){const j=p.value.find(De=>De.id===C);if(!j)return;const X=new Set(j.filePaths);c.value=c.value.filter(De=>!X.has(De.fsPath)),p.value=p.value.filter(De=>De.id!==C)}function Yr(C){return C.total<=0?0:Math.round(C.processed/C.total*100)}function bn(C,j){const X=C.replace(/\\/g,"/");if(c.value.some(jt=>jt.fsPath===X))return;const De=X.split("/").filter(Boolean),Qe=(j==null?void 0:j.trim())||De[De.length-1]||X;c.value=[...c.value,{label:Qe,path:X,fsPath:X}]}function Tr(C){return C.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(C.name)}function Bt(C){return C?Array.from(C):[]}function Qn(C){return C!==Xe?!1:(g.value+=1,!0)}function Xn(C){C===Xe&&(g.value=Math.max(0,g.value-1))}function An(C){if(C<=0)return;const j=T.value,X=j?j.succeeded+j.failed:0;if(!j||X>=j.total){T.value={total:C,succeeded:0,failed:0};return}T.value={...j,total:j.total+C}}function pn(C){const j=T.value;j&&(T.value={...j,succeeded:j.succeeded+(C==="success"?1:0),failed:j.failed+(C==="failure"?1:0)})}function Zn(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function _r(C){const j=new Date,X=[j.getFullYear(),String(j.getMonth()+1).padStart(2,"0"),String(j.getDate()).padStart(2,"0"),String(j.getHours()).padStart(2,"0"),String(j.getMinutes()).padStart(2,"0"),String(j.getSeconds()).padStart(2,"0")].join("-"),De=C.type.startsWith("image/")&&C.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${X}.${De}`}function Tn(){const C=new Date;return`pasted-text-${[C.getFullYear(),String(C.getMonth()+1).padStart(2,"0"),String(C.getDate()).padStart(2,"0"),String(C.getHours()).padStart(2,"0"),String(C.getMinutes()).padStart(2,"0"),String(C.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Sr(C){return C.name.trim()?C:new File([C],_r(C),{type:C.type||"image/png",lastModified:Date.now()})}async function Qt(C,j){if(Qn(j))try{const X=Sr(C),De=await tu(X);if(j!==Xe)return;if(!De){pn("failure");return}i.value=[...i.value,{id:Zn(),name:X.name,url:`/codex-local-image?path=${encodeURIComponent(De)}`}],pn("success")}catch{j===Xe&&pn("failure")}finally{Xn(j)}}async function Jr(C,j){if(Qn(j))try{const X=await tu(C);if(j!==Xe)return;if(!X){pn("failure");return}bn(X),pn("success")}catch{j===Xe&&pn("failure")}finally{Xn(j)}}function Ut(C){const j=Bt(C);if(j.length===0)return;An(j.length),Y.value=!1,ve.value=!1,Ht();const X=Xe;for(const De of j)Tr(De)?Qt(De,X):Jr(De,X)}function hn(){mt=0,k.value=!1}function En(C){return C?Array.from(C.types??[]).includes("Files"):!1}async function Un(C){if(!C||C.length===0)return;const j=He.value,X=Array.from(C),Qe=(X[0].webkitRelativePath||X[0].name).split("/").filter(Boolean)[0]||"Folder",jt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;p.value=[...p.value,{id:jt,name:Qe,total:X.length,processed:0,filePaths:[],isUploading:!0}];const Kt=Ft=>{j===He.value&&(p.value=p.value.map(At=>At.id===jt?Ft(At):At))};for(const Ft of X)try{const At=await tu(Ft);if(j!==He.value)return;if(At){const Rn=Ft.webkitRelativePath||Ft.name;bn(At,Rn),Kt(lr=>({...lr,processed:lr.processed+1,filePaths:[...lr.filePaths,At]}));continue}Kt(Rn=>({...Rn,processed:Rn.processed+1}))}catch{Kt(At=>({...At,processed:At.processed+1}))}Kt(Ft=>({...Ft,isUploading:!1}))}function mn(C){C&&(C.value="")}function qn(C){const j=C.target;Ut((j==null?void 0:j.files)??null),mn(j),Y.value=!1}function xt(C){const j=C.target;Ut((j==null?void 0:j.files)??null),mn(j),Y.value=!1}function er(C){const j=C.target;Un((j==null?void 0:j.files)??null),mn(j),Y.value=!1}function tr(C){le.value||!En(C.dataTransfer)||(C.preventDefault(),mt+=1,k.value=!0)}function In(C){le.value||!En(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"),k.value=!0)}function Xt(C){k.value&&(C.preventDefault(),mt=Math.max(0,mt-1),mt===0&&hn())}function Ct(C){var j;le.value||!En(C.dataTransfer)||(C.preventDefault(),hn(),Ut(((j=C.dataTransfer)==null?void 0:j.files)??null))}function vn(){!k.value&&mt===0||hn()}function pr(C){var jt,Kt;if(le.value)return;const j=((jt=C.clipboardData)==null?void 0:jt.getData("text/plain"))??"";if(j.length>=ES){C.preventDefault();const Ft=new File([j],Tn(),{type:"text/plain",lastModified:Date.now()});Ut([Ft]);return}const X=Array.from(((Kt=C.clipboardData)==null?void 0:Kt.items)??[]);if(X.length===0)return;const De=j.length>0,Qe=X.filter(Ft=>Ft.kind==="file"&&Ft.type.startsWith("image/")).map(Ft=>Ft.getAsFile()).filter(Ft=>Ft instanceof File);Qe.length!==0&&(De||C.preventDefault(),Ut(Qe))}function Or(){f.value&&(f.value="");const j=s.value.startsWith("/");j!==ve.value&&(ve.value=j),pt()}function Hn(C){if(Te.value){if(C.key==="Escape"){C.preventDefault(),Ht();return}if(C.key==="ArrowDown"){C.preventDefault(),Ie.value.length>0&&(_e.value=(_e.value+1)%Ie.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),Ie.value.length>0){const X=Ie.value.length;_e.value=(_e.value+X-1)%X}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const X=Ie.value[_e.value];X?Dr(X):Ht();return}}if(r.sendWithEnter!==!1?C.key==="Enter"&&!C.shiftKey:C.key==="Enter"&&(C.metaKey||C.ctrlKey)){C.preventDefault(),be(r.isTurnInProgress?he.value:"steer");return}if(ve.value){if(C.key==="Escape"){C.preventDefault(),Mn();return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){C.preventDefault();return}}}function Mn(){var C;ve.value=!1,(C=Ee.value)==null||C.focus()}function Ht(){Te.value=!1,Fe.value=null,Ne.value="",Ie.value=[],_e.value=0}function pt(){const C=Ee.value;if(!C){Ht();return}const j=C.selectionStart??s.value.length,De=s.value.slice(0,j).match(/(^|\s)(@[^\s@]*)$/);if(!De){Ht();return}const Qe=De[2]??"",jt=Qe.length,Kt=j-jt;Fe.value=Kt,Ne.value=Qe.slice(1),Te.value=!0,Pt()}async function Pt(){if(!Te.value)return;const C=(r.cwd??"").trim();if(!C){Ie.value=[];return}Ve&&clearTimeout(Ve);const j=++Ke;Ve=setTimeout(async()=>{try{const X=await yb(C,Ne.value,20);if(!Te.value||j!==Ke)return;Ie.value=X,_e.value=0}catch{if(!Te.value||j!==Ke)return;Ie.value=[]}},120)}function Dr(C){const j=Ee.value,X=Fe.value;if(X!==null&&j){const De=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,X)}${s.value.slice(De)}`.trimEnd()}bn(C.path),Ht(),Gt(()=>j==null?void 0:j.focus())}function vt(C){de(),at(C),Gt(()=>{var j;return(j=Ee.value)==null?void 0:j.focus()})}function _n(C){const j=C.trim();j&&(de(),s.value.trim().length>0?s.value=`${s.value.trimEnd()}
49
- ${j}`:s.value=j,Gt(()=>{var X;return(X=Ee.value)==null?void 0:X.focus()}))}function Zt(C){const j=C.lastIndexOf("/");return j<0?C:C.slice(j+1)}function Vn(C){const j=C.lastIndexOf("/");return j<=0?"":C.slice(0,j)}function ir(C){const j=Zt(C),X=j.lastIndexOf(".");return X<=0?"":j.slice(X+1).toLowerCase()}function ln(C){const j=ir(C);return j==="ts"?"TS":j==="tsx"?"TSX":j==="js"?"JS":j==="jsx"?"JSX":j==="json"?"{}":""}function un(C){const j=ir(C);return j.startsWith("ts")?"ts":j.startsWith("js")?"js":j==="json"?"json":"default"}function hr(C){const j=ir(C);return j==="md"||j==="mdx"}function mr(C){var j;l.value.some(X=>X.path===C.path)||(l.value=[...l.value,C]),s.value=s.value.startsWith("/")?"":s.value,ve.value=!1,(j=Ee.value)==null||j.focus()}function Lr(C,j){if(j){const X=(r.skills??[]).find(De=>De.path===C);X&&!l.value.some(De=>De.path===C)&&(l.value=[...l.value,X])}else l.value=l.value.filter(X=>X.path!==C)}function nr(C){if(!Y.value)return;const j=ue.value;if(!j)return;const X=C.target;!X||j.contains(X)||(Y.value=!1)}return Oo(()=>{document.addEventListener("click",nr),window.addEventListener("drop",vn),window.addEventListener("dragend",vn),window.addEventListener("blur",vn)}),t({hydrateDraft:vt,appendTextToDraft:_n,hasUnsavedDraft:()=>ne.value}),es(()=>{document.removeEventListener("click",nr),window.removeEventListener("drop",vn),window.removeEventListener("dragend",vn),window.removeEventListener("blur",vn),window.removeEventListener("pointerup",Jt),window.removeEventListener("pointercancel",Jt),window.removeEventListener("blur",Jt),Ve&&clearTimeout(Ve)}),it(()=>r.activeThreadId,C=>{de(),je&&Rt(je,Bn()),ut();const j=Ot(C);j&&(at(j),Or()),je=C.trim()},{immediate:!0}),it([s,i,c,l],()=>{je&&Rt(je,Bn())},{deep:!0}),it(()=>r.cwd,()=>{Te.value&&Pt()}),it(ye,C=>{he.value=C}),(C,j)=>(S(),$("form",{class:"thread-composer",onSubmit:j[4]||(j[4]=lt(X=>be(e.isTurnInProgress?he.value:"steer"),["prevent"]))},[O.value?(S(),$("p",N_,ae(O.value),1)):ie("",!0),v("div",{class:ot(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":k.value}])},[i.value.length>0?(S(),$("div",j_,[(S(!0),$(qe,null,Dt(i.value,X=>(S(),$("div",{key:X.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:X.url,alt:X.name||"Selected image"},null,8,F_),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${X.name||"image"}`,disabled:le.value,onClick:De=>qt(X.id)}," x ",8,B_)]))),128))])):ie("",!0),p.value.length>0?(S(),$("div",U_,[(S(!0),$(qe,null,Dt(p.value,X=>(S(),$("span",{key:X.id,class:"thread-composer-folder-chip"},[Be(ic,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:X.name},ae(X.name),9,q_),v("span",H_,[X.isUploading?(S(),$(qe,{key:0},[lo(ae(Yr(X))+"% uploading ("+ae(X.processed)+"/"+ae(X.total)+") ",1)],64)):(S(),$(qe,{key:1},[lo(ae(X.filePaths.length)+" file"+ae(X.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${X.name}`,disabled:le.value,onClick:De=>ar(X.id)},"×",8,V_)]))),128))])):ie("",!0),ee.value.length>0?(S(),$("div",W_,[(S(!0),$(qe,null,Dt(ee.value,X=>(S(),$("span",{key:X.fsPath,class:"thread-composer-file-chip"},[Be(Si,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:X.fsPath},ae(X.label),9,z_),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${X.label}`,disabled:le.value,onClick:De=>an(X.fsPath)},"×",8,G_)]))),128))])):ie("",!0),l.value.length>0?(S(),$("div",K_,[(S(!0),$(qe,null,Dt(l.value,X=>(S(),$("span",{key:X.path,class:"thread-composer-skill-chip"},[v("span",Y_,ae(X.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${X.name}`,onClick:De=>sr(X.path)},"×",8,J_)]))),128))])):ie("",!0),v("div",{class:ot(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":k.value}]),onDragenter:tr,onDragover:In,onDragleave:Xt,onDrop:Ct},[k.value?(S(),$("div",Q_,[...j[5]||(j[5]=[v("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):ie("",!0),Te.value?(S(),$("div",X_,[Ie.value.length>0?(S(!0),$(qe,{key:0},Dt(Ie.value,(X,De)=>(S(),$("button",{key:X.path,class:ot(["thread-composer-file-mention-row",{"is-active":De===_e.value}]),type:"button",onMousedown:lt(Qe=>Dr(X),["prevent"])},[ln(X.path)?(S(),$("span",{key:0,class:ot(["thread-composer-file-mention-icon-badge",`is-${un(X.path)}`])},ae(ln(X.path)),3)):hr(X.path)?(S(),$("span",eS,"↓")):(S(),st(Si,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",tS,[v("span",nS,ae(Zt(X.path)),1),Vn(X.path)?(S(),$("span",rS,ae(Vn(X.path)),1)):ie("",!0)])],42,Z_))),128)):(S(),$("div",oS,"No matching files"))])):ie("",!0),rn(v("textarea",{ref_key:"inputRef",ref:Ee,"onUpdate:modelValue":j[0]||(j[0]=X=>s.value=X),class:"thread-composer-input",placeholder:V.value,disabled:le.value,onInput:Or,onKeydown:Hn,onPaste:pr},null,40,sS),[[yn,s.value]]),Be(L_,{skills:_.value,visible:ve.value,"anchor-bottom":44,"anchor-left":0,onSelect:mr,onClose:Mn},null,8,["skills","visible"])],34),v("div",{class:ot(["thread-composer-controls",{"thread-composer-controls--recording":Oe.value}])},[v("div",{ref_key:"attachMenuRootRef",ref:ue,class:"thread-composer-attach"},[v("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:le.value,onClick:or}," + ",8,aS),Y.value?(S(),$("div",iS,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:le.value,onClick:br}," Add photos & files ",8,lS),v("button",{class:"thread-composer-attach-item",type:"button",disabled:le.value,onClick:It}," Add folder ",8,uS),v("button",{class:"thread-composer-attach-item",type:"button",disabled:le.value,onClick:ft}," Take photo ",8,cS),j[9]||(j[9]=v("div",{class:"thread-composer-attach-separator"},null,-1)),v("div",dS,[j[6]||(j[6]=v("span",{class:"thread-composer-attach-mode-label"},"In-progress send",-1)),v("div",fS,[v("button",{class:ot(["thread-composer-attach-mode-button",{"is-active":he.value==="steer"}]),type:"button",disabled:le.value,onClick:j[1]||(j[1]=X=>Pe("steer"))}," Steer ",10,pS),v("button",{class:ot(["thread-composer-attach-mode-button",{"is-active":he.value==="queue"}]),type:"button",disabled:le.value,onClick:j[2]||(j[2]=X=>Pe("queue"))}," Queue ",10,hS)])]),j[10]||(j[10]=v("div",{class:"thread-composer-attach-separator"},null,-1)),fe.value?(S(),$("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`Fast mode ${e.selectedSpeedMode==="fast"?"enabled":"disabled"}`,disabled:oe.value,onClick:Ze},[v("span",vS,[j[7]||(j[7]=v("span",{class:"thread-composer-attach-setting-label"},"Fast mode",-1)),v("span",gS,ae(Ae.value),1)]),v("span",{class:ot(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":oe.value}])},null,2)],8,mS)):ie("",!0),v("button",{class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":Re.value,"aria-label":Re.value?"Disable plan mode":"Enable plan mode",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:wr},[j[8]||(j[8]=v("span",{class:"thread-composer-attach-setting-copy"},[v("span",{class:"thread-composer-attach-setting-label"},"Plan mode"),v("span",{class:"thread-composer-attach-setting-description"},"Agent proposes a plan before acting")],-1)),v("span",{class:ot(["thread-composer-attach-switch",{"is-on":Re.value}])},null,2)],8,yS)])):ie("",!0)],512),Oe.value?ie("",!0):(S(),$(qe,{key:0},[Be(Jo,{class:"thread-composer-control","model-value":e.selectedModel,options:ge.value,"selected-prefix-icon":ce.value?ZT:null,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"enable-search":"","search-placeholder":"Search models...","onUpdate:modelValue":fr},null,8,["model-value","options","selected-prefix-icon","disabled"]),Be(A_,{class:"thread-composer-control",options:B.value,"selected-values":A.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:Lr},null,8,["options","selected-values","disabled"]),Be(Jo,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Q,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":sn},null,8,["model-value","disabled"])],64)),v("div",{class:ot(["thread-composer-actions",{"thread-composer-actions--recording":Oe.value}])},[Me(U)==="recording"?(S(),$("div",wS,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:q,class:"thread-composer-dictation-waveform"},null,512)])):ie("",!0),Me(U)==="recording"?(S(),$("span",bS,ae(N.value),1)):ie("",!0),Me(H)?(S(),$("button",{key:2,class:ot(["thread-composer-mic",{"thread-composer-mic--active":Me(U)==="recording"}]),type:"button","aria-label":P.value,title:P.value,disabled:le.value,onClick:Jn,onPointerdown:wn,onPointerup:Jt,onPointercancel:Jt},[Me(U)==="recording"?(S(),st(tf,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(S(),st(r_,{key:1,class:"thread-composer-mic-icon"}))],42,TS)):ie("",!0),e.isTurnInProgress&&!te.value?(S(),$("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?"Saving thread before stop is available":"Stop",title:e.isStopPending?"Saving thread before stop is available":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending,onClick:Kr},[e.isStopPending?(S(),$("span",SS)):(S(),st(tf,{key:1,class:"thread-composer-stop-icon"}))],8,_S)):(S(),$("button",{key:4,class:ot(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&he.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&he.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${he.value}`:"Send",disabled:!G.value,onClick:j[3]||(j[3]=X=>be(e.isTurnInProgress?he.value:"steer"))},[Be(YT,{class:"thread-composer-submit-icon"})],10,kS))],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:we,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:le.value,onChange:qn},null,40,xS),v("input",{ref_key:"cameraCaptureInputRef",ref:ke,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:le.value,onChange:xt},null,40,CS),v("input",{ref_key:"folderPickerInputRef",ref:me,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:le.value,onChange:er},null,40,AS)],32))}}),nf=ht(MS,[["__scopeId","data-v-bb083b71"]]),RS={key:0,class:"thread-pending-request"},PS={class:"thread-pending-request-title"},$S=["title"],OS={class:"thread-pending-request-approval"},DS={class:"thread-pending-request-options",role:"radiogroup","aria-label":"Approval choices"},LS=["aria-pressed","onClick"],NS={class:"thread-pending-request-option-index"},jS={class:"thread-pending-request-option-label"},FS={class:"thread-pending-request-footer thread-pending-request-footer--approval"},BS=["value"],US={class:"thread-pending-request-header"},qS={class:"thread-pending-request-heading"},HS={class:"thread-pending-request-eyebrow"},VS={class:"thread-pending-request-title"},WS={key:0,class:"thread-pending-request-counter"},zS={key:0,class:"thread-pending-request-preview"},GS={class:"thread-pending-request-preview-code"},KS={key:1,class:"thread-pending-request-user-input"},YS={key:0,class:"thread-pending-request-question-description"},JS=["href"],QS={class:"thread-pending-request-question-title"},XS={key:0},ZS={key:0,class:"thread-pending-request-question-text"},ek={key:1,class:"thread-pending-request-input-wrap"},tk=["type","value","onInput"],nk={key:2,class:"thread-pending-request-select-wrap"},rk=["value","onChange"],ok={key:0,value:""},sk={key:3,class:"thread-pending-request-select-wrap"},ak=["value","onChange"],ik={key:0,value:""},lk=["value"],uk={key:4,class:"thread-pending-request-question-options"},ck=["checked","onChange"],dk={class:"thread-pending-request-checkbox-label"},fk={key:2,class:"thread-pending-request-validation-error"},pk={class:"thread-pending-request-footer"},hk={key:2,class:"thread-pending-request-user-input"},mk={class:"thread-pending-request-question-title"},vk={key:0,class:"thread-pending-request-question-text"},gk={key:1,class:"thread-pending-request-question-options"},yk={class:"thread-pending-request-select-wrap"},wk=["value","onChange"],bk=["value"],Tk={key:0,class:"thread-pending-request-question-description"},_k={key:2,class:"thread-pending-request-input-wrap"},Sk=["value","onInput"],kk={class:"thread-pending-request-footer"},xk={key:3,class:"thread-pending-request-actions"},Ck={key:4,class:"thread-pending-request-actions"},Ak=Cn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,o=M("accept"),s=M(""),i=M({}),l=M({}),c=M({}),p=M("");function f(P){return P!==null&&typeof P=="object"&&!Array.isArray(P)?P:null}function g(P){return typeof P=="string"?P.trim():""}function T(P){return typeof P=="string"?P:null}function k(P){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(P)?P:JSON.stringify(P)}function U(P){const N=(Array.isArray(P.commandActions)?P.commandActions:[]).map(V=>f(V)).map(V=>g(V==null?void 0:V.command)).find(V=>V.length>0);if(N)return N.replace(/\s+/g," ").trim();if(Array.isArray(P.command)){const V=P.command.filter(te=>typeof te=="string").map(te=>te.trim()).filter(te=>te.length>0);if(V.length>0)return V.map(te=>k(te)).join(" ")}return we(g(P.command))}function H(P){return P.method==="item/commandExecution/requestApproval"||P.method==="execCommandApproval"}function Z(P){return P.method==="item/fileChange/requestApproval"||P.method==="applyPatchApproval"}function q(P){return P.method==="item/permissions/requestApproval"}function R(P){return H(P)||Z(P)||q(P)}function F(P){return P.method==="mcpServer/elicitation/request"}function z(P){const O=f(P.params);return g(O==null?void 0:O.reason)||g(O==null?void 0:O.prompt)||g(O==null?void 0:O.message)}function de(P){return R(P)?"Awaiting approval":F(P)?"MCP server input required":P.method==="item/tool/requestUserInput"?"Awaiting response":P.method==="item/tool/call"?"Tool call waiting for response":P.method}function ue(P){const O=z(P);return O||(H(P)?"Do you want to run this command?":Z(P)?"Do you want to make these changes?":q(P)?"Do you want to grant these permissions?":F(P)?"An MCP server needs your input before Codex can continue.":P.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function we(P){var be;const O=P.trim();if(!O)return"";const N=O.match(/-Command\s+(.+)$/i),V=((be=N==null?void 0:N[1])==null?void 0:be.trim())??O;return(V.startsWith('"')&&V.endsWith('"')?V.slice(1,-1):V).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function ke(P){const O=f(P.params);if(!O)return"";if(H(P))return U(O);if(Z(P)){const N=g(O.grantRoot)||g(O.grant_root);if(N)return N.replace(/\s+/g," ").trim();const V=f(O.fileChanges)??f(O.changes);if(!V)return"";const te=Object.keys(V).map(be=>be.trim()).filter(be=>be.length>0);return te.length===0?"":te.slice(0,3).join(", ")}return q(P)?me(O.permissions):F(P)?g(O.serverName)||g(O.url):""}function me(P){const O=f(P);if(!O)return"";const N=[],V=f(O.fileSystem),te=f(O.network),be=Array.isArray(V==null?void 0:V.read)?V.read.filter(at=>typeof at=="string"):[],Pe=Array.isArray(V==null?void 0:V.write)?V.write.filter(at=>typeof at=="string"):[];return be.length>0&&N.push(`Read: ${be.join(", ")}`),Pe.length>0&&N.push(`Write: ${Pe.join(", ")}`),(te==null?void 0:te.enabled)===!0&&N.push("Network access"),N.join(" • ")}function Ee(P){return!P||!R(P)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const $e=re(()=>Ee(n.request));it(()=>{var P;return((P=n.request)==null?void 0:P.id)??0},()=>{var P;s.value="",i.value={},l.value={},c.value={},p.value="",o.value=((P=$e.value[0])==null?void 0:P.id)??"accept"},{immediate:!0}),it($e,P=>{var O;o.value!=="decline"&&(P.some(N=>N.id===o.value)||(o.value=((O=P[0])==null?void 0:O.id)??"accept"))},{immediate:!0});function Y(P,O){return`${String(P)}:${O}`}function ve(P){const O=f(P.params),N=Array.isArray(O==null?void 0:O.questions)?O.questions:[],V=[];for(const te of N){const be=f(te);if(!be)continue;const Pe=g(be.id);if(!Pe)continue;const at=Array.isArray(be.options)?be.options.map(ut=>f(ut)).map(ut=>({label:g(ut==null?void 0:ut.label),description:g(ut==null?void 0:ut.description)})).filter(ut=>ut.label.length>0):[];V.push({id:Pe,header:g(be.header),question:g(be.question),isOther:be.isOther===!0,options:at})}return V}function Fe(P,O,N){const V=Y(P,O),te=i.value[V];return typeof te=="string"&&te.length>0?te:N}function Ne(P,O){return l.value[Y(P,O)]??""}function Ie(P,O,N){const V=N.target;if(!(V instanceof HTMLSelectElement))return;const te=Y(P,O);i.value={...i.value,[te]:V.value}}function Te(P,O,N){const V=N.target;if(!(V instanceof HTMLInputElement))return;const te=Y(P,O);l.value={...l.value,[te]:V.value}}function _e(P,O,N){var te,be;const V=Fe(P,O,((te=N[0])==null?void 0:te.label)||"");return((be=N.find(Pe=>Pe.label===V))==null?void 0:be.description)??""}function He(P,O){return`${String(P)}:${O}`}function Ke(P){var O;return g((O=f(P.params))==null?void 0:O.serverName)}function Ve(P){var N;const O=g((N=f(P.params))==null?void 0:N.url);if(!O)return"";try{const V=new URL(O),te=V.protocol.toLowerCase();return te==="https:"||te==="http:"?V.toString():""}catch{return""}}function Je(P){const O=f(P.params),N=f(O==null?void 0:O.requestedSchema),V=f(N==null?void 0:N.properties);if(!V)return[];const te=new Set(Array.isArray(N==null?void 0:N.required)?N.required.filter(be=>typeof be=="string"):[]);return Object.entries(V).map(([be,Pe])=>mt(be,f(Pe),te.has(be))).filter(be=>be!==null)}function mt(P,O,N){if(!O)return null;const V=g(O.title)||P,te=g(O.description),be=g(O.type);if(be==="boolean")return{key:P,label:V,description:te,required:N,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof O.default=="boolean"?O.default:null,hasExplicitDefault:typeof O.default=="boolean"};if(be==="number"||be==="integer")return{key:P,label:V,description:te,required:N,kind:"number",inputType:"number",options:[],defaultValue:typeof O.default=="number"?O.default:null,hasExplicitDefault:typeof O.default=="number"};const Pe=Xe(O);if(be==="array")return{key:P,label:V,description:te,required:N,kind:"multiEnum",inputType:"checkbox",options:Pe,defaultValue:Array.isArray(O.default)?O.default.filter(ut=>typeof ut=="string"):[],hasExplicitDefault:Array.isArray(O.default)};const at=T(O.default);return Pe.length>0?{key:P,label:V,description:te,required:N,kind:"singleEnum",inputType:"select",options:Pe,defaultValue:at,hasExplicitDefault:at!==null}:{key:P,label:V,description:te,required:N,kind:"string",inputType:kt(O),options:[],defaultValue:at,hasExplicitDefault:at!==null}}function Xe(P){const N=(Array.isArray(P.oneOf)?P.oneOf:Array.isArray(P.anyOf)?P.anyOf:[]).map(Pe=>f(Pe)).map(Pe=>({value:g(Pe==null?void 0:Pe.const),label:g(Pe==null?void 0:Pe.title)||g(Pe==null?void 0:Pe.const)})).filter(Pe=>Pe.value.length>0);if(N.length>0)return N;const V=f(P.items);if(V){const Pe=Xe(V);if(Pe.length>0)return Pe}const te=Array.isArray(P.enum)?P.enum.filter(Pe=>typeof Pe=="string"):[],be=Array.isArray(P.enumNames)?P.enumNames.filter(Pe=>typeof Pe=="string"):[];return te.map((Pe,at)=>({value:Pe,label:be[at]||Pe}))}function kt(P){const O=g(P.format);return O==="email"?"email":O==="uri"?"url":O==="date"?"date":O==="date-time"?"datetime-local":"text"}function je(P,O){const N=c.value[He(P,O.key)];return N!==void 0?N:O.defaultValue}function Q(P,O){const N=je(P,O);return Array.isArray(N)?N.filter(V=>typeof V=="string"):[]}function pe(P,O,N){const V=N.target;if(!(V instanceof HTMLInputElement)&&!(V instanceof HTMLSelectElement))return;const te=V.value,be=(O.kind==="number",te);c.value={...c.value,[He(P,O.key)]:te.length>0?be:null},p.value=""}function ge(P,O,N){const V=N.target;if(!(V instanceof HTMLSelectElement))return;let te=null;V.value==="true"?te=!0:V.value==="false"&&(te=!1),c.value={...c.value,[He(P,O.key)]:te},p.value=""}function Re(P,O,N,V){const te=V.target;if(!(te instanceof HTMLInputElement))return;const be=new Set(Q(P,O));te.checked?be.add(N):be.delete(N),c.value={...c.value,[He(P,O.key)]:Array.from(be)},p.value=""}function ze(P){return P===!0?"true":P===!1?"false":""}function _(P,O){const N=je(P,O);return O.kind==="multiEnum"?Array.isArray(N)&&N.length>0:O.kind==="boolean"?typeof N=="boolean":O.kind==="number"&&typeof N=="number"?!0:typeof N=="string"&&N.trim().length>0}function A(P){const O=Je(P).filter(N=>N.required&&!_(P.id,N)).map(N=>N.label);return O.length===0?"":O.length===1?`Answer the required field: ${O[0]}.`:`Answer the required fields: ${O.join(", ")}.`}function B(P){const O={};for(const N of Je(P)){const V=je(P.id,N);if(N.kind==="multiEnum"){const be=Array.isArray(V)?V:[];(be.length>0||N.required)&&(O[N.key]=be);continue}if(N.kind==="boolean"){typeof V=="boolean"&&(O[N.key]=V);continue}if(N.kind==="number"){const be=typeof V=="number"?V:Number(String(V).trim());Number.isNaN(be)||(O[N.key]=be);continue}const te=String(V??"").trim();(te.length>0||N.required)&&(O[N.key]=te)}return O}function G(P){o.value=P}function ne(){o.value="decline"}function ee(P){const O=P.target;O instanceof HTMLInputElement&&(s.value=O.value,o.value="decline")}function le(P,O){var N;if(q(P)){if(O==="decline"||O==="cancel"){r("respondServerRequest",{id:P.id,error:{code:-32e3,message:O==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const V=f((N=f(P.params))==null?void 0:N.permissions)??{};r("respondServerRequest",{id:P.id,result:{permissions:V,scope:O==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:P.id,result:{decision:O}})}function fe(P){const O=s.value.trim(),N=O.length>0?"decline":o.value;if(q(P)){le(P,N);return}r("respondServerRequest",{id:P.id,result:{decision:N},followUpMessageText:O||void 0})}function ce(P,O){const N=f(P.params),V={action:O};if(O==="accept"&&g(N==null?void 0:N.mode)==="form"){const te=A(P);if(te){p.value=te;return}V.content=B(P)}r("respondServerRequest",{id:P.id,result:V})}function oe(P){var V;const O=ve(P),N={};for(const te of O){const be=Fe(P.id,te.id,((V=te.options[0])==null?void 0:V.label)||""),Pe=Ne(P.id,te.id).trim(),at=[be,Pe].map(ut=>ut.trim()).filter(ut=>ut.length>0);N[te.id]={answers:at}}r("respondServerRequest",{id:P.id,result:{answers:N}})}function Ae(P){r("respondServerRequest",{id:P.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function ye(P){r("respondServerRequest",{id:P.id,result:{success:!0,contentItems:[]}})}function he(P){r("respondServerRequest",{id:P.id,result:{}})}function Oe(P){r("respondServerRequest",{id:P.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(P,O)=>e.request?(S(),$("section",RS,[v("article",{class:ot(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[R(e.request)?(S(),$(qe,{key:0},[v("p",PS,ae(ue(e.request)),1),ke(e.request)?(S(),$("p",{key:0,class:"thread-pending-request-command-line",title:ke(e.request)},ae(ke(e.request)),9,$S)):ie("",!0),v("section",OS,[v("div",DS,[(S(!0),$(qe,null,Dt($e.value,(N,V)=>(S(),$("button",{key:N.id,type:"button",class:ot(["thread-pending-request-option",{"is-selected":o.value===N.id}]),"aria-pressed":o.value===N.id,onClick:te=>G(N.id)},[v("span",NS,ae(V+1)+".",1),v("span",jS,ae(N.label),1)],10,LS))),128))]),v("footer",FS,[v("label",{class:ot(["thread-pending-request-inline-input",{"is-active":o.value==="decline"||s.value.length>0}])},[O[11]||(O[11]=v("span",{class:"thread-pending-request-option-index"},"3.",-1)),v("input",{class:"thread-pending-request-inline-control",type:"text",value:s.value,placeholder:"No, and tell Codex what to do differently",onFocus:ne,onInput:ee,onKeydown:O[0]||(O[0]=zt(lt(N=>fe(e.request),["prevent"]),["enter"]))},null,40,BS)],2),v("button",{type:"button",class:"thread-pending-request-secondary",onClick:O[1]||(O[1]=N=>le(e.request,"cancel"))}," Skip "),v("button",{type:"button",class:"thread-pending-request-primary",onClick:O[2]||(O[2]=N=>fe(e.request))}," Send ")])])],64)):(S(),$(qe,{key:1},[v("header",US,[v("div",qS,[v("p",HS,ae(de(e.request)),1),v("p",VS,ae(ue(e.request)),1)]),(e.requestCount??0)>1?(S(),$("span",WS,ae(e.requestCount??0)+" pending",1)):ie("",!0)]),ke(e.request)?(S(),$("div",zS,[v("code",GS,ae(ke(e.request)),1)])):ie("",!0),e.request.method==="mcpServer/elicitation/request"?(S(),$("section",KS,[Ke(e.request)?(S(),$("p",YS," Server: "+ae(Ke(e.request)),1)):ie("",!0),Ve(e.request)?(S(),$("a",{key:1,class:"thread-pending-request-link",href:Ve(e.request),target:"_blank",rel:"noopener noreferrer"}," Open authorization link ",8,JS)):ie("",!0),(S(!0),$(qe,null,Dt(Je(e.request),N=>(S(),$("div",{key:`${e.request.id}:${N.key}`,class:"thread-pending-request-question"},[v("p",QS,[lo(ae(N.label),1),N.required?(S(),$("span",XS," *")):ie("",!0)]),N.description?(S(),$("p",ZS,ae(N.description),1)):ie("",!0),N.kind==="string"||N.kind==="number"?(S(),$("label",ek,[O[12]||(O[12]=v("span",{class:"thread-pending-request-select-label"},"Value",-1)),v("input",{class:"thread-pending-request-input",type:N.inputType,value:String(je(e.request.id,N)??""),onInput:V=>pe(e.request.id,N,V)},null,40,tk)])):N.kind==="boolean"?(S(),$("label",nk,[O[15]||(O[15]=v("span",{class:"thread-pending-request-select-label"},"Choice",-1)),v("select",{class:"thread-pending-request-select",value:ze(je(e.request.id,N)),onChange:V=>ge(e.request.id,N,V)},[N.hasExplicitDefault?ie("",!0):(S(),$("option",ok,"Select true or false")),O[13]||(O[13]=v("option",{value:"true"},"True",-1)),O[14]||(O[14]=v("option",{value:"false"},"False",-1))],40,rk)])):N.kind==="singleEnum"?(S(),$("label",sk,[O[16]||(O[16]=v("span",{class:"thread-pending-request-select-label"},"Choice",-1)),v("select",{class:"thread-pending-request-select",value:String(je(e.request.id,N)??""),onChange:V=>pe(e.request.id,N,V)},[N.hasExplicitDefault?ie("",!0):(S(),$("option",ik,"Select an option")),(S(!0),$(qe,null,Dt(N.options,V=>(S(),$("option",{key:`${e.request.id}:${N.key}:${V.value}`,value:V.value},ae(V.label),9,lk))),128))],40,ak)])):(S(),$("div",uk,[(S(!0),$(qe,null,Dt(N.options,V=>(S(),$("label",{key:`${e.request.id}:${N.key}:${V.value}`,class:"thread-pending-request-checkbox-row"},[v("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:Q(e.request.id,N).includes(V.value),onChange:te=>Re(e.request.id,N,V.value,te)},null,40,ck),v("span",dk,ae(V.label),1)]))),128))]))]))),128)),p.value?(S(),$("p",fk,ae(p.value),1)):ie("",!0),v("footer",pk,[v("button",{type:"button",class:"thread-pending-request-secondary",onClick:O[3]||(O[3]=N=>ce(e.request,"cancel"))}," Cancel "),v("button",{type:"button",class:"thread-pending-request-secondary",onClick:O[4]||(O[4]=N=>ce(e.request,"decline"))}," Decline "),v("button",{type:"button",class:"thread-pending-request-primary",onClick:O[5]||(O[5]=N=>ce(e.request,"accept"))}," Continue ")])])):e.request.method==="item/tool/requestUserInput"?(S(),$("section",hk,[(S(!0),$(qe,null,Dt(ve(e.request),N=>{var V;return S(),$("div",{key:`${e.request.id}:${N.id}`,class:"thread-pending-request-question"},[v("p",mk,ae(N.header||N.question),1),N.question?(S(),$("p",vk,ae(N.question),1)):ie("",!0),N.options.length>0?(S(),$("div",gk,[v("label",yk,[O[17]||(O[17]=v("span",{class:"thread-pending-request-select-label"},"Choice",-1)),v("select",{class:"thread-pending-request-select",value:Fe(e.request.id,N.id,((V=N.options[0])==null?void 0:V.label)||""),onChange:te=>Ie(e.request.id,N.id,te)},[(S(!0),$(qe,null,Dt(N.options,te=>(S(),$("option",{key:`${e.request.id}:${N.id}:${te.label}`,value:te.label},ae(te.label),9,bk))),128))],40,wk)]),_e(e.request.id,N.id,N.options)?(S(),$("p",Tk,ae(_e(e.request.id,N.id,N.options)),1)):ie("",!0)])):ie("",!0),N.isOther?(S(),$("label",_k,[O[18]||(O[18]=v("span",{class:"thread-pending-request-select-label"},"Other answer",-1)),v("input",{class:"thread-pending-request-input",type:"text",value:Ne(e.request.id,N.id),placeholder:"Other answer",onInput:te=>Te(e.request.id,N.id,te)},null,40,Sk)])):ie("",!0)])}),128)),v("footer",kk,[v("button",{type:"button",class:"thread-pending-request-primary",onClick:O[6]||(O[6]=N=>oe(e.request))}," Send ")])])):e.request.method==="item/tool/call"?(S(),$("section",xk,[v("button",{type:"button",class:"thread-pending-request-primary",onClick:O[7]||(O[7]=N=>Ae(e.request))}," Fail Tool Call "),v("button",{type:"button",class:"thread-pending-request-secondary",onClick:O[8]||(O[8]=N=>ye(e.request))}," Success (Empty) ")])):(S(),$("section",Ck,[v("button",{type:"button",class:"thread-pending-request-primary",onClick:O[9]||(O[9]=N=>he(e.request))}," Return Empty Result "),v("button",{type:"button",class:"thread-pending-request-secondary",onClick:O[10]||(O[10]=N=>Oe(e.request))}," Reject Request ")]))],64))],2)])):ie("",!0)}}),Ek=ht(Ak,[["__scopeId","data-v-a033894d"]]),Ik={key:0,class:"queued-messages"},Mk={class:"queued-messages-inner"},Rk={class:"queued-row-text"},Pk={class:"queued-row-actions"},$k=["onClick"],Ok=["onClick"],Dk=["onClick"],Lk=Cn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var c,p,f;const r=n.text.trim();if(r)return r;const o=[],s=((c=n.imageUrls)==null?void 0:c.length)??0,i=((p=n.fileAttachments)==null?void 0:p.length)??0,l=((f=n.skills)==null?void 0:f.length)??0;return s>0&&o.push(`${s} image${s===1?"":"s"}`),i>0&&o.push(`${i} file${i===1?"":"s"}`),l>0&&o.push(`${l} skill${l===1?"":"s"}`),o.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(S(),$("div",Ik,[v("div",Mk,[(S(!0),$(qe,null,Dt(e.messages,o=>(S(),$("div",{key:o.id,class:"queued-row"},[r[1]||(r[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",Rk,ae(t(o)),1),v("div",Pk,[v("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:s=>n.$emit("edit",o.id)},"Edit",8,$k),v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>n.$emit("steer",o.id)},"Steer",8,Ok),v("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>n.$emit("delete",o.id)},[...r[0]||(r[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,Dk)])]))),128))])])):ie("",!0)}}),Nk=ht(Lk,[["__scopeId","data-v-835c6739"]]),jk={key:0,class:"rate-limit-status","aria-live":"polite"},Fk=["title"],Bk={class:"rate-limit-card-header"},Uk={class:"rate-limit-card-title"},qk={key:0,class:"rate-limit-card-plan"},Hk={class:"rate-limit-card-metrics"},Vk={key:0,class:"rate-limit-card-footer"},Wk=Cn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(q){var R,F;return((R=q.limitId)==null?void 0:R.trim())||((F=q.limitName)==null?void 0:F.trim())||"__default__"}function n(q){var R,F;return((R=q.limitName)==null?void 0:R.trim())||((F=q.limitId)==null?void 0:F.trim())||"Rate limits"}function r(q){const R=q.trim();return R?R.replace(/[_-]+/g," ").replace(/\b\w/g,F=>F.toUpperCase()):""}function o(q){return!q||q<=0?"Window":q%1440===0?`${q/1440}d`:q%60===0?`${q/60}h`:q<60?`${q}m`:`${Math.round(q/60*10)/10}h`}function s(q){const R=Math.max(0,Math.min(100,100-q));return`${Math.round(R)}% left`}function i(q){return`${Math.round(q)}%`}function l(q,R){return{key:R,label:`${o(q.windowDurationMins)} ${s(q.usedPercent)}`}}function c(q){const R=[];return q.primary&&R.push(l(q.primary,"primary")),q.secondary&&R.push(l(q.secondary,"secondary")),R}function p(q){if(!q)return"";const R=new Date(q*1e3),F=R.getMonth()+1,z=String(R.getDate()).padStart(2,"0"),de=String(R.getHours()).padStart(2,"0"),ue=String(R.getMinutes()).padStart(2,"0");return`${F}.${z} ${de}:${ue}`}function f(q){if(!(q!=null&&q.resetsAt))return"";const R=q.resetsAt*1e3-Date.now();if(R<=0)return"Resetting now";const F=Math.round(R/6e4);if(F<60)return`Resets in ${F}m`;const z=Math.round(F/60);return z<24?`Resets in ${z}h`:`Resets in ${Math.round(z/24)}d`}function g(q){return[q.primary,q.secondary].filter(R=>R!==null)}function T(q){const R=g(q);return R.length===0?null:[...R].sort((F,z)=>{const de=F.windowDurationMins??Number.MAX_SAFE_INTEGER,ue=z.windowDurationMins??Number.MAX_SAFE_INTEGER;return de!==ue?de-ue:(F.resetsAt??Number.MAX_SAFE_INTEGER)-(z.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function k(q){const R=g(q);if(R.length===0)return"";const F=[...R].sort((de,ue)=>{const we=de.windowDurationMins??-1,ke=ue.windowDurationMins??-1;return we!==ke?ke-we:(ue.resetsAt??-1)-(de.resetsAt??-1)})[0],z=p(F.resetsAt);return z||""}function U(q){const R=q.credits;return R?R.unlimited?"Unlimited credits":R.balance?`Credits ${R.balance}`:R.hasCredits?"Credits available":"":""}function H(q){return[f(T(q)),k(q),U(q)].filter(R=>R.length>0)}function Z(q){const R=[n(q)];for(const F of c(q))R.push(F.label);for(const F of g(q))R.push(`${o(F.windowDurationMins)} used ${i(F.usedPercent)}`);for(const F of H(q))R.push(F);return R.join(`
50
- `)}return(q,R)=>e.snapshots.length>0?(S(),$("aside",jk,[(S(!0),$(qe,null,Dt(e.snapshots,F=>(S(),$("div",{key:t(F),class:"rate-limit-card",title:Z(F)},[v("div",Bk,[v("span",Uk,ae(n(F)),1),F.planType?(S(),$("span",qk,ae(r(F.planType)),1)):ie("",!0)]),v("div",Hk,[(S(!0),$(qe,null,Dt(c(F),z=>(S(),$("span",{key:z.key,class:"rate-limit-card-metric"},ae(z.label),1))),128))]),H(F).length>0?(S(),$("div",Vk,ae(H(F).join(" | ")),1)):ie("",!0)],8,Fk))),128))])):ie("",!0)}}),zk=ht(Wk,[["__scopeId","data-v-df88906b"]]),Gk={class:"runtime-toggle",role:"radiogroup","aria-label":"Continue in"},Kk=["aria-checked","onClick"],Yk={class:"runtime-toggle-option-label"},Jk=Cn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,r=[{value:"local",label:"Local project",icon:ic},{value:"worktree",label:"New worktree",icon:hi}];function o(s){n("update:modelValue",s)}return(s,i)=>(S(),$("div",Gk,[(S(),$(qe,null,Dt(r,l=>v("button",{key:l.value,class:ot(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:c=>o(l.value)},[(S(),st(Ku(l.icon),{class:"runtime-toggle-option-icon"})),v("span",Yk,ae(l.label),1)],10,Kk)),64))]))}}),Qk=ht(Jk,[["__scopeId","data-v-e8b0d0ac"]]),Xk={},Zk={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 ex(e,t){return S(),$("svg",Zk,[...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 tx=ht(Xk,[["render",ex]]),nx={},rx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function ox(e,t){return S(),$("svg",rx,[...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 sx=ht(nx,[["render",ox]]),ax={class:"sidebar-thread-controls"},ix=["aria-label","title"],lx=Cn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(S(),$("div",ax,[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?(S(),st(sx,{key:0,class:"sidebar-thread-controls-icon"})):(S(),st(tx,{key:1,class:"sidebar-thread-controls-icon"}))],8,ix),zr(t.$slots,"default",{},void 0),e.showNewThreadButton?(S(),$("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"))},[Be(Si,{class:"sidebar-thread-controls-icon"})])):ie("",!0)]))}}),rf=ht(lx,[["__scopeId","data-v-46a10052"]]),ux={},cx={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function dx(e,t){return S(),$("svg",cx,[...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 of=ht(ux,[["render",dx]]),fx={},px={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function hx(e,t){return S(),$("svg",px,[...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 mx=ht(fx,[["render",hx]]),vx={},gx={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function yx(e,t){return S(),$("svg",gx,[...t[0]||(t[0]=[v("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),v("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const wx=ht(vx,[["render",yx]]),bx={},Tx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _x(e,t){return S(),$("svg",Tx,[...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 Sx=ht(bx,[["render",_x]]);function cr(e){return e.flatMap(t=>t.threads)}const ch="codex-web-local.thread-read-state.v1",dh="codex-web-local.thread-scroll-state.v1",fh="codex-web-local.thread-token-usage.v1",ph="codex-web-local.thread-terminal-open.v1",Iu="codex-web-local.selected-thread-id.v1",Mu="codex-web-local.selected-model-by-context.v1",hh="codex-web-local.selected-model-id.v1",mh="codex-web-local.project-order.v1",vh="codex-web-local.project-display-name.v1",Ru="codex-web-local.collaboration-mode-by-context.v1",gh="codex-web-local.collaboration-mode.v1",Ro="__new-thread__",yh="__new-thread-provider__::",ou=220,kx=500,xx=3e3,Cx=2e3,sf=["none","minimal","low","medium","high","xhigh"],hs="__global__",Cr="gpt-5.2-codex";function Ax(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ch);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function af(e){typeof window>"u"||window.localStorage.setItem(ch,JSON.stringify(e))}function Pu(e){return e==="plan"?"plan":"default"}function $s(e){return typeof e=="string"?e.trim():""}function Ar(){return Object.create(null)}function oa(e){const t=Ar();for(const[n,r]of Object.entries(e))t[n]=r;return t}function oi(e,t){if(!(t in e))return e;const n=Ar();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function lf(e,t){let n=!1;const r=Ar();for(const[o,s]of Object.entries(e)){if(o===Ro||o.startsWith(yh)||t.has(o)){r[o]=s;continue}n=!0}return n?r:e}function wh(e){return e.trim().toLowerCase()||"codex"}function su(e){const t=wh(e);return`${yh}${t}`}function ma(e){return e.trim()||Ro}function Ex(){if(typeof window>"u")return Ar();try{const n=window.localStorage.getItem(Mu);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Ar();const o=Ar();for(const[s,i]of Object.entries(r)){if(typeof s!="string"||s.length===0)continue;const l=$s(i);l&&(o[s]=l)}return o}}catch{}const e=$s(window.localStorage.getItem(hh)),t=Ar();return e&&(t[Ro]=e),t}function uf(e,t){const n=ma(t),r=$s(e[n]);return r||$s(e[Ro])}function si(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Mu):window.localStorage.setItem(Mu,JSON.stringify(e)),window.localStorage.removeItem(hh)}catch{}}function Ix(){if(typeof window>"u")return Ar();try{const n=window.localStorage.getItem(Ru);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Ar();const o=Ar();for(const[s,i]of Object.entries(r)){if(typeof s!="string"||s.length===0)continue;const l=Pu(i);l==="plan"&&(o[s]=l)}return o}}catch{}const e=Pu(window.localStorage.getItem(gh)),t=Ar();return e==="plan"&&(t[Ro]="plan"),t}function ai(e,t){const n=ma(t);return Pu(e[n])}function cf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Ru):window.localStorage.setItem(Ru,JSON.stringify(e)),window.localStorage.removeItem(gh)}catch{}}function ki(e,t,n){return Math.min(Math.max(e,t),n)}function Mx(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=ki(t.scrollRatio,0,1)),n}function Rx(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(dh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const s=Mx(o);s&&(n[r]=s)}return n}catch{return{}}}function df(e){typeof window>"u"||window.localStorage.setItem(dh,JSON.stringify(e))}function ws(e){if(typeof e=="number"&&Number.isFinite(e))return Math.max(0,Math.trunc(e));if(typeof e=="string"&&e.trim().length>0){const t=Number(e);if(Number.isFinite(t))return Math.max(0,Math.trunc(t))}return null}function ff(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:ws(t.totalTokens)??0,inputTokens:ws(t.inputTokens)??0,cachedInputTokens:ws(t.cachedInputTokens)??0,outputTokens:ws(t.outputTokens)??0,reasoningOutputTokens:ws(t.reasoningOutputTokens)??0}}function Px(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=ff(t.total),r=ff(t.last);if(!n||!r)return null;const o=ws(t.modelContextWindow),s=r.totalTokens,i=typeof o=="number"?Math.max(o-s,0):null,l=typeof o=="number"&&o>0?ki(Math.round((i??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:s,remainingContextTokens:i,remainingContextPercent:l}}function $x(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(fh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const s=Px(o);s&&(n[r]=s)}return n}catch{return{}}}function pf(e){typeof window>"u"||window.localStorage.setItem(fh,JSON.stringify(e))}function Ox(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ph);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function Dx(e){typeof window>"u"||window.localStorage.setItem(ph,JSON.stringify(e))}function Lx(){return typeof window>"u"?"":window.localStorage.getItem(Iu)??""}function Nx(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Iu);return}window.localStorage.setItem(Iu,e)}}function jx(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(mh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=Ma(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function ms(e){typeof window>"u"||window.localStorage.setItem(mh,JSON.stringify(e))}function Fx(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(vh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const s=typeof r=="string"?Ma(r):"";s.length>0&&typeof o=="string"&&(n[s]=o)}return n}catch{return{}}}function au(e){typeof window>"u"||window.localStorage.setItem(vh,JSON.stringify(e))}function ii(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 Io(e,n)?e:n}function iu(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null&&o.threads.length>0);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Io(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function Bx(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function Ux(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function qx(e=[],t=[]){var n,r,o,s;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)||((o=e[i])==null?void 0:o.status)!==((s=t[i])==null?void 0:s.status))return!1;return!0}function Hx(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&qx(e.steps,t.steps)}function li(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 $u(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Io(e.images,t.images)&&Wx(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&Ux(e.commandExecution,t.commandExecution)&&Hx(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function Ts(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 Vx(e,t,n={}){const r=new Map(e.map(f=>[f.id,f])),o=new Map(t.map(f=>[f.id,f])),s=t.map(f=>{const g=r.get(f.id);return g&&$u(g,f)?g:f});if(n.preserveMissing!==!0)return Ts(e,s)?e:s;const i=e.map(f=>{const g=o.get(f.id);return!g||$u(f,g)?f:g}),l=new Set(e.map(f=>f.id)),c=s.filter(f=>!l.has(f.id)),p=[...i,...c];return Ts(e,p)?e:p}function Wx(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function Ou(e){return e.replace(/\s+/gu," ").trim()}function zx(e,t){const n=new Set(t.map(s=>s.id)),r=new Set(t.filter(s=>s.role==="assistant").map(s=>Ou(s.text)).filter(s=>s.length>0));if(r.size===0)return e;const o=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;if(n.has(s.id))return!1;const i=Ou(s.text);return i.length===0?!1:!r.has(i)});return o.length===e.length?e:o}function ui(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const r=e[n];if($u(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const bh="worked";function ko(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function Gx(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),o=t%60,s=[];n>0&&s.push(`${n}h`),(r>0||n>0)&&s.push(`${r}m`);const i=o>0||s.length===0?o:0;return s.push(`${i}s`),s.join(" ")}function Kx(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function Yx(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 Jx(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${Gx(e.durationMs)}`,messageType:bh,turnId:e.turnId}}function Qx(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function Xx(e,t){const n=Jx(t),r=e.filter(i=>i.messageType!==bh),o=Qx(r);if(o<0)return[...r,n];const s=[...r];return s.splice(o,0,n),s}function dt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function Zx(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,s]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=s}return n?r:e}function e1(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&&e.pendingRequestState===t.pendingRequestState}function t1(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 n1(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 Vt(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function ci(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const s=n.get(o.projectName),i=new Map((s==null?void 0:s.threads.map(c=>[c.id,c]))??[]),l=o.threads.map(c=>{const p=i.get(c.id);return p&&e1(p,c)?p:c});return s&&s.projectName===o.projectName&&t1(s.threads,l)?s:{projectName:o.projectName,threads:l}});return n1(e,r)?e:r}function r1(e,t,n){const r=new Set(cr(t).map(l=>l.id)),o=cr(e).filter(l=>n[l.id]===!0&&!r.has(l.id));if(o.length===0)return t;const s=new Map(t.map(l=>[l.projectName,l])),i=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of o){if(s.get(l.projectName)){const p=i.findIndex(f=>f.projectName===l.projectName);p>=0&&(i[p]={projectName:i[p].projectName,threads:[l,...i[p].threads]});continue}i.push({projectName:l.projectName,threads:[l]})}return i}function xo(e){return Ma(e)}function o1(e){const t=e.split(`
51
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function s1(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function a1(){const e=M([]),t=M([]),n=M(Lx()),r=M({}),o=M({}),s=M({}),i=M({}),l=M({}),c=M({}),p=M({}),f=M({}),g=M({}),T=M({}),k=M([]),U=M([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),H=M(Ix()),Z=M(Ex()),q=M(ai(H.value,n.value)),R=M(uf(Z.value,n.value)),F=M("medium"),z=M("standard"),de=M(""),ue=M(Ax()),we=M(Rx()),ke=M(jx()),me=M(Fx()),Ee=M({}),$e=M({}),Y=M({}),ve=M({}),Fe=M({}),Ne=M({}),Ie=M({}),Te=M({}),_e=M({}),He=M({}),Ke=M({}),Ve=M({}),Je=M({}),mt=M(null),Xe=M($x()),kt=M(Ox()),je=M({}),Q=M([]),pe=M([]),ge=M(!1),Re=M(!1),ze=M(!1),_=M(!1),A=M(!1),B=M(!1),G=M(""),ne=M(!1),ee=M(!1);function le(a){var u;try{const h=new URL(a,"http://localhost");return h.pathname!=="/codex-local-image"?"":((u=h.searchParams.get("path"))==null?void 0:u.trim())??""}catch{return""}}function fe(a){const u=a.trim().toLowerCase();return u?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(u):!1}function ce(a){var h;const u=r.value[a]??[];for(let b=u.length-1;b>=0;b-=1){const I=u[b];if(!(I.role!=="user"||!Array.isArray(I.images)||I.images.length===0))for(let L=I.images.length-1;L>=0;L-=1){const D=((h=I.images[L])==null?void 0:h.trim())??"";if(D&&le(D))return D}}return""}let oe=null,Ae=null,ye=null;const he=new Map;let Oe=null;const P=new Map;let O=null,N=null,V=!1;const te=new Set,be=new Map;let Pe=null,at=!1,ut=!1,nt=[],Ot=!1,Rt=!1;const Fn=new Map,Bn=new Set,Kr=re(()=>cr(e.value)),fr=re(()=>Kr.value.find(a=>a.id===n.value)??null),wr=re(()=>we.value[n.value]??null),sn=re(()=>{const a=n.value;return!!(a&&kt.value[a]===!0)}),Ze=re(()=>{const a=n.value;return a?_e.value[a]===!0:!1}),Jn=re(()=>{const a=[],u=n.value;return u&&Array.isArray(Ve.value[u])&&a.push(...Ve.value[u]),Array.isArray(Ve.value[hs])&&a.push(...Ve.value[hs]),a.sort((h,b)=>h.receivedAtIso.localeCompare(b.receivedAtIso))}),wn=re(()=>{var L;const a=n.value;if(!a)return null;const u=p.value[a]===!0,h=u?Ne.value[a]:void 0,b=u?(i.value[a]??"").trim():"",I=(((L=Ie.value[a])==null?void 0:L.message)??"").trim();return!h&&!b&&!I?null:{activityLabel:(h==null?void 0:h.label)||"Thinking",activityDetails:(h==null?void 0:h.details)??[],reasoningText:b,errorText:I}}),Jt=re(()=>mt.value),or=re(()=>{const a=n.value;return a?Xe.value[a]??null:null}),br=re(()=>{const a=n.value;if(!a)return[];const u=r.value[a]??[],h=o.value[a]??[],b=s.value[a]??[],I=l.value[a]??[],L=c.value[a]??[],D=[...u,...h,...I,...L,...b],K=Fe.value[a];return K?Xx(D,K):D});function ft(a){if(ma(a)===Ro){const h=su(de.value),b=h?$s(Z.value[h]):"";if(b)return b}return uf(Z.value,a).trim()}function It(...a){const u=[...k.value];for(const h of a){const b=h.trim();b&&!u.includes(b)&&u.push(b)}Io(k.value,u)||(k.value=u)}function qt(a){n.value!==a&&(n.value=a,Nx(a),R.value=ft(a),It(R.value),q.value=ai(H.value,a),Rt=!1)}function sr(a,u){const h=u.trim(),b=ma(a);if(h){const I=oa(Z.value);I[b]=h,Z.value=I}else Z.value=oi(Z.value,b);if(a.trim()===n.value?(R.value=ft(n.value),It(R.value)):It(h),b===Ro){const I=su(de.value);if(I)if(h){const L=oa(Z.value);L[I]=h,Z.value=L}else Z.value=oi(Z.value,I)}si(Z.value)}function an(a){sr(n.value,a)}function ar(a,u){const h=a.trim();if(!h)return;const b=u.trim();if(b){const I=oa(Z.value);I[h]=b,Z.value=I}else Z.value=oi(Z.value,h);It(b),n.value===h&&(R.value=ft(n.value)),si(Z.value)}function Yr(a,u){const h=a.trim();if(!h)return;if(!u){if(!(h in Xe.value))return;Xe.value=dt(Xe.value,h),pf(Xe.value);return}const b=Xe.value[h];b&&JSON.stringify(b)===JSON.stringify(u)||(Xe.value={...Xe.value,[h]:u},pf(Xe.value))}function bn(a){const u=a==="plan"?"plan":"default",h=ma(n.value);if(!(ai(H.value,n.value)===u&&q.value===u)){if(q.value=u,u==="plan"){const I=oa(H.value);I[h]=u,H.value=I}else H.value=oi(H.value,h);cf(H.value)}}function Tr(a){mt.value=a}async function Bt(a=n.value){a.trim()?ar(a,Cr):an(Cr),It(Cr)}function Qn(a,u){Je.value={...Je.value,[a]:u}}function Xn(a){Je.value[a]&&(Je.value=dt(Je.value,a))}async function An(a){if(Bn.has(a))return;const u=Je.value[a];if(!(!u||u.fallbackRetried)){Bn.add(a),Qn(a,{...u,fallbackRetried:!0});try{await Bt(a);try{const h=await Jl(a,1);ln(a,h),jt(a),un(a,[]),Qe(a),l.value[a]&&(l.value=dt(l.value,a))}catch{}Pt(a,null),G.value="",Xt(a,null),pt(a,{label:"Thinking",details:Tn(Cr,u.effort,u.collaborationMode)}),Ct(a,!0),Y.value[a]!==!0&&await Yl(a),await Ql(a,u.text,u.imageUrls,Cr,u.effort||void 0,u.skills.length>0?u.skills:void 0,u.fileAttachments,u.collaborationMode),Y.value={...Y.value,[a]:!0},Jr(),te.add(a),V=!0,await xr()}catch(h){const b=h instanceof Error?h.message:"Unknown application error";Pt(a,b),G.value=b,Ct(a,!1),pt(a,null)}finally{Bn.delete(a)}}}function pn(a){a&&!sf.includes(a)||(F.value=a)}async function Zn(a){const u=a==="fast"?"fast":"standard";if(A.value||z.value===u)return;const h=z.value;z.value=u,A.value=!0,G.value="";try{await ab(u)}catch(b){z.value=h,G.value=b instanceof Error?b.message:"Failed to update Fast mode"}finally{A.value=!1}}async function _r(){try{const a=await ub();U.value=a,a.some(u=>u.value===q.value)||bn("default")}catch{}}function Tn(a,u,h=q.value){const b=a.trim()||"default",I=u||"default",L=h==="plan"?"Plan":"Default",D=z.value==="fast"?"Fast":"Standard";return[`Mode: ${L}`,`Model: ${b}`,`Thinking: ${I}`,`Speed: ${D}`]}async function Sr(a){try{const[u,h]=await Promise.all([ih({includeProviderModels:(a==null?void 0:a.includeProviderModels)!==!1}),lh()]),b=ft(n.value),I=h.model.trim(),L=wh(h.providerId);de.value=L;const D=su(L),K=D?$s(Z.value[D]):"",J=[...u];if(!(a!=null&&a.providerChanged))for(const Ue of[b,I])Ue&&!J.includes(Ue)&&J.push(Ue);k.value=J;const Ce=b&&u.includes(b);if((!b||!Ce||a!=null&&a.providerChanged)&&(a!=null&&a.providerChanged&&J.length>0?K&&J.includes(K)?an(K):I&&J.includes(I)?an(I):an(J[0]):I&&J.includes(I)?an(h.model):J.length>0?an(J[0]):an("")),D&&R.value.trim().length>0){const Ue=oa(Z.value);Ue[D]=R.value.trim(),Z.value=Ue,si(Z.value)}h.reasoningEffort&&sf.includes(h.reasoningEffort)&&(F.value=h.reasoningEffort),z.value=h.speedMode}catch{}}async function Qt(){if(N){await N;return}N=(async()=>{try{const a=await Gw();Tr(a),pe.value=a?[a]:[]}catch{}finally{N=null}})(),await N}function Jr(){if(typeof window>"u"){Qt();return}ye!==null&&window.clearTimeout(ye),ye=window.setTimeout(()=>{ye=null,Qt()},kx)}function Ut(a){if(!a||typeof window>"u")return;const u=he.get(a);u!==void 0&&(window.clearTimeout(u),he.delete(a))}function hn(a){if(!a||typeof window>"u")return;Ut(a);const u=window.setTimeout(()=>{he.delete(a),te.add(a),xr()},xx);he.set(a,u)}function En(a){const u=je.value;return Object.keys(u).length===0?a:a.map(h=>({projectName:h.projectName,threads:h.threads.map(b=>{const I=u[b.id];return I?{...b,title:I}:b})}))}function Un(a){return a?Array.isArray(Ve.value[a])?Ve.value[a]:[]:[]}function mn(a){return a==="item/commandExecution/requestApproval"||a==="item/fileChange/requestApproval"||a==="item/permissions/requestApproval"||a==="execCommandApproval"||a==="applyPatchApproval"}function qn(a){return a.some(u=>mn(u.method))?"approval":a.length>0?"response":null}function xt(){const u=En(t.value).map(h=>({projectName:h.projectName,threads:h.threads.map(b=>{const I=p.value[b.id]===!0,L=qn(Un(b.id)),D=n.value===b.id,K=ue.value[b.id],J=T.value[b.id]===!0,Ce=!D&&!I&&(J||K!==b.updatedAtIso);return{...b,inProgress:I,unread:Ce,pendingRequestState:L}})}));e.value=ci(e.value,u)}function er(a,u,h){const b=new Date().toISOString(),I=Yt(u),L=Ma(I),D={id:a,title:o1(h),projectName:L,cwd:I,hasWorktree:I.includes("/.codex/worktrees/")||I.includes("/.git/worktrees/"),createdAtIso:b,updatedAtIso:b,preview:h,unread:!1,inProgress:!1},K=t.value.findIndex(Ce=>Ce.projectName===L);if(K>=0){const Ue=t.value[K].threads.filter(Et=>Et.id!==a),tt={projectName:L,threads:[D,...Ue]},ct=[...t.value];ct.splice(K,1,tt),t.value=ct}else t.value=[{projectName:L,threads:[D]},...t.value];const J=ii(ke.value,t.value);Io(ke.value,J)||(ke.value=J,ms(ke.value)),xt()}function tr(a){const u=new Set(a.map(K=>K.id)),h=lf(Z.value,u);h!==Z.value&&(Z.value=h,R.value=ft(n.value),It(R.value),si(h));const b=lf(H.value,u);b!==H.value&&(H.value=b,q.value=ai(b,n.value),cf(b));const I=Vt(ue.value,u);I!==ue.value&&(ue.value=I,af(I));const L=Vt(we.value,u);L!==we.value&&(we.value=L,df(L)),$e.value=Vt($e.value,u),Ee.value=Vt(Ee.value,u),Y.value=Vt(Y.value,u),ve.value=Vt(ve.value,u),r.value=Vt(r.value,u),s.value=Vt(s.value,u),i.value=Vt(i.value,u),l.value=Vt(l.value,u),c.value=Vt(c.value,u),Fe.value=Vt(Fe.value,u),Ne.value=Vt(Ne.value,u),Ie.value=Vt(Ie.value,u),Te.value=Vt(Te.value,u),_e.value=Vt(_e.value,u),He.value=Vt(He.value,u),Ke.value=Vt(Ke.value,u),Xe.value=Vt(Xe.value,u),T.value=Vt(T.value,u),p.value=Vt(p.value,u);const D={};for(const[K,J]of Object.entries(Ve.value))(K===hs||u.has(K))&&(D[K]=J);Ve.value=D}function In(a){const u=cr(t.value).find(h=>h.id===a);u&&(ue.value={...ue.value,[a]:u.updatedAtIso},af(ue.value),T.value[a]&&(T.value=dt(T.value,a)),xt())}function Xt(a,u){if(!a)return;const h=Fe.value[a];if(u){if(Kx(h,u))return;Fe.value={...Fe.value,[a]:u}}else h&&(Fe.value=dt(Fe.value,a))}function Ct(a,u){!a||p.value[a]===!0===u||(u?p.value={...p.value,[a]:!0}:(p.value=dt(p.value,a),Ft(a),vn(a)),xt())}function vn(a){a&&(_e.value[a]&&(_e.value=dt(_e.value,a)),He.value[a]&&(He.value=dt(He.value,a)),Ke.value[a]&&(Ke.value=dt(Ke.value,a)))}function pr(a){a&&(_e.value={..._e.value,[a]:!0},He.value[a]&&(He.value=dt(He.value,a)),Ke.value[a]&&(Ke.value=dt(Ke.value,a)))}function Or(a){a&&_e.value[a]===!0&&He.value[a]===!0&&Ke.value[a]===!0&&vn(a)}function Hn(a){const u=Object.keys(_e.value);if(u.length===0)return;let h=He.value,b=!1;for(const I of u)!a.has(I)||h[I]===!0||(h={...h,[I]:!0},b=!0);if(b){He.value=h;for(const I of u)Or(I)}}function Mn(a,u){a&&_e.value[a]===!0&&u.some(h=>h.role==="user")&&(Ke.value[a]!==!0&&(Ke.value={...Ke.value,[a]:!0}),Or(a))}function Ht(a){a&&a!==n.value&&T.value[a]!==!0&&(T.value={...T.value,[a]:!0},xt())}function pt(a,u){if(!a)return;const h=Ne.value[a];if(!u){h&&(Ne.value=dt(Ne.value,a));return}const b=Ls(u.label)||"Thinking",I=u.details.map(K=>Ls(K)).filter(K=>K.length>0&&K!==b),L=Array.from(new Set([...(h==null?void 0:h.details)??[],...I])).slice(-3),D={label:b,details:L};Yx(h,D)||(Ne.value={...Ne.value,[a]:D})}function Pt(a,u,h={}){if(!a)return;const b=Ie.value[a],I=u?Ou(u):"";if(!I){b&&(Ie.value=dt(Ie.value,a));return}const L=h.transient===!0;(b==null?void 0:b.message)===I&&b.transient===L||(Ie.value={...Ie.value,[a]:{message:I,transient:L}})}function Dr(a){var u;a&&(u=Ie.value[a])!=null&&u.transient&&Pt(a,null)}function vt(){const a=Object.entries(Ie.value).filter(([,h])=>h==null?void 0:h.transient).map(([h])=>h);if(a.length===0)return;let u=Ie.value;for(const h of a)u=dt(u,h);Ie.value=u}function _n(a){const u=cr(t.value).find(h=>h.id===a);return(u==null?void 0:u.updatedAtIso)??""}function Zt(a,u){if(!a)return;const h={scrollTop:Math.max(0,u.scrollTop),isAtBottom:u.isAtBottom===!0};typeof u.scrollRatio=="number"&&Number.isFinite(u.scrollRatio)&&(h.scrollRatio=ki(u.scrollRatio,0,1));const b=we.value[a];b&&b.scrollTop===h.scrollTop&&b.isAtBottom===h.isAtBottom&&b.scrollRatio===h.scrollRatio||(we.value={...we.value,[a]:h},df(we.value))}function Vn(a,u){if(!a)return;const h={...kt.value};u?h[a]=!0:delete h[a],kt.value=h,Dx(h)}function ir(){const a=n.value;a&&Vn(a,!sn.value)}function ln(a,u){const h=r.value[a]??[];Ts(h,u)||(r.value={...r.value,[a]:u})}function un(a,u){const h=s.value[a]??[];Ts(h,u)||(s.value={...s.value,[a]:u})}function hr(a){a&&a in s.value&&(s.value=dt(s.value,a))}function mr(a,u){const h=c.value[a]??[];Ts(h,u)||(c.value={...c.value,[a]:u})}function Lr(a,u){const h=o.value[a]??[];Ts(h,u)||(o.value={...o.value,[a]:u})}function nr(a,u){const h=o.value[a]??[],b=ui(h,u);Lr(a,b)}function C(a,u){const h=s.value[a]??[],b=ui(h,u);un(a,b)}function j(a,u){const h=c.value[a]??[],b=ui(h,u);mr(a,b)}function X(a,u){if(!a)return;const h=u.trim(),b=i.value[a]??"";if(h.length===0){if(!b)return;i.value=dt(i.value,a);return}b!==h&&(i.value={...i.value,[a]:h})}function De(a,u){if(!a)return;const h=i.value[a]??"";X(a,`${h}${u}`)}function Qe(a){a&&a in i.value&&(i.value=dt(i.value,a))}function jt(a){a&&a in o.value&&(o.value=dt(o.value,a))}function Kt(a){a&&a in c.value&&(c.value=dt(c.value,a))}function Ft(a){a&&(jt(a),Qe(a),pt(a,null),n.value,l.value[a]&&(l.value=dt(l.value,a)),Te.value[a]&&(Te.value=dt(Te.value,a)),Xn(a))}function At(a){return a==="completed"?"completed":a==="inProgress"||a==="in_progress"?"inProgress":"pending"}function Rn(a){var h;const u=[];(h=a.explanation)!=null&&h.trim()&&u.push(a.explanation.trim());for(const b of a.steps){const I=b.status==="completed"?"x":b.status==="inProgress"?"~":" ";u.push(`- [${I}] ${b.step}`)}return u.join(`
52
- `).trim()}function lr(a){if(a.method!=="turn/plan/updated")return null;const u=y(a.params),h=yt(a),b=w(u==null?void 0:u.turnId)||w(u==null?void 0:u.turn_id),L=(Array.isArray(u==null?void 0:u.plan)?u==null?void 0:u.plan:[]).map(J=>y(J)).map(J=>({step:w(J==null?void 0:J.step),status:At(J==null?void 0:J.status)})).filter(J=>J.step.length>0);if(!h||!b)return null;const K={explanation:w(u==null?void 0:u.explanation).trim()||void 0,steps:L,isStreaming:!0};return{threadId:h,message:{id:`${b}:plan`,role:"assistant",text:Rn(K),messageType:"plan.live",plan:K}}}function en(a){if(a.method!=="item/plan/delta")return null;const u=y(a.params),h=yt(a),b=w(u==null?void 0:u.turnId)||w(u==null?void 0:u.turn_id),I=w(u==null?void 0:u.delta);if(!h||!b||!I)return null;const L=`${b}:plan`,D=(o.value[h]??[]).find(Ce=>Ce.id===L),K=`${(D==null?void 0:D.text)??""}${I}`,J=D!=null&&D.plan?{...D.plan,isStreaming:!0}:void 0;return{threadId:h,message:{id:L,role:"assistant",text:K,messageType:"plan.live",plan:J}}}function y(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)?a:null}function w(a){return typeof a=="string"?a:""}function E(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function W(a){const u=y(a);if(!u)return null;const h=E(u.totalTokens??u.total_tokens),b=E(u.inputTokens??u.input_tokens),I=E(u.cachedInputTokens??u.cached_input_tokens),L=E(u.outputTokens??u.output_tokens),D=E(u.reasoningOutputTokens??u.reasoning_output_tokens);return h===null||b===null||I===null||L===null||D===null?null:{totalTokens:h,inputTokens:b,cachedInputTokens:I,outputTokens:L,reasoningOutputTokens:D}}function Le(a){const u=y(a);if(!u)return null;const h=W(u.total),b=W(u.last);if(!h||!b)return null;const I=E(u.modelContextWindow??u.model_context_window),L=b.totalTokens,D=typeof I=="number"?Math.max(I-L,0):null,K=typeof I=="number"&&I>0?ki(Math.round((D??0)/I*100),0,100):null;return{total:h,last:b,modelContextWindow:I,currentContextTokens:L,remainingContextTokens:D,remainingContextPercent:K}}function gt(a){if(a.method!=="thread/tokenUsage/updated")return null;const u=y(a.params),h=yt(a),b=Le((u==null?void 0:u.tokenUsage)??(u==null?void 0:u.token_usage));return!h||!b?null:{threadId:h,usage:b}}function yt(a){const u=y(a.params);if(!u)return"";const h=w(u.threadId);if(h)return h;const b=w(u.thread_id);if(b)return b;const I=w(u.conversationId);if(I)return I;const L=w(u.conversation_id);if(L)return L;const D=y(u.thread),K=w(D==null?void 0:D.id);if(K)return K;const J=y(u.turn),Ce=w(J==null?void 0:J.threadId);if(Ce)return Ce;const Ue=w(J==null?void 0:J.thread_id);return Ue||""}function vr(a){if(a.method!=="turn/completed")return"";const u=y(a.params),h=y(u==null?void 0:u.turn);if(!h||h.status!=="failed")return"";const b=y(h.error);return w(b==null?void 0:b.message)}function tn(a){var b;if(a.method!=="error")return null;const u=y(a.params),h=w(u==null?void 0:u.message)||w((b=y(u==null?void 0:u.error))==null?void 0:b.message);return h?{message:h,transient:(u==null?void 0:u.willRetry)===!0}:null}function gn(a){const u=y(a);if(!u)return null;const h=u.id,b=w(u.method),I=u.params;if(typeof h!="number"||!Number.isInteger(h)||!b)return null;const L=y(I),D=Sn(b,L),K=w(L==null?void 0:L.threadId)||w(L==null?void 0:L.thread_id)||w(L==null?void 0:L.conversationId)||w(L==null?void 0:L.conversation_id)||hs,J=w(L==null?void 0:L.turnId)||w(L==null?void 0:L.turn_id),Ce=w(L==null?void 0:L.itemId)||w(L==null?void 0:L.item_id)||w(L==null?void 0:L.callId)||w(L==null?void 0:L.call_id),Ue=w(u.receivedAtIso)||new Date().toISOString();return{id:h,method:D,threadId:K,turnId:J,itemId:Ce,receivedAtIso:Ue,params:I??null}}function Sn(a,u){const h=a.trim();return h&&(h==="item/commandExecution/requestApproval"||h==="execCommandApproval"||h==="exec_approval_request"||Nr(u)?"item/commandExecution/requestApproval":h==="item/fileChange/requestApproval"||h==="applyPatchApproval"||h==="apply_patch_approval_request"||kr(u)?"item/fileChange/requestApproval":h==="item/tool/requestUserInput"||h==="request_user_input"||go(u)?"item/tool/requestUserInput":h==="mcpServer/elicitation/request"||h==="elicitation_request"||yo(u)?"mcpServer/elicitation/request":h==="item/permissions/requestApproval"||Ui(u)?"item/permissions/requestApproval":h==="item/tool/call"||h==="dynamic_tool_call_request"||nn(u)?"item/tool/call":h)}function Nr(a){if(!a)return!1;const u=a.command;return Array.isArray(u)&&u.some(h=>typeof h=="string"&&h.trim().length>0)||typeof u=="string"&&u.trim().length>0?!0:Array.isArray(a.commandActions)}function kr(a){return a?typeof a.grantRoot=="string"&&a.grantRoot.trim().length>0||typeof a.grant_root=="string"&&a.grant_root.trim().length>0||y(a.fileChanges)?!0:y(a.changes)!==null:!1}function go(a){return!!(a&&Array.isArray(a.questions))}function nn(a){return a?typeof a.toolName=="string"||typeof a.tool_name=="string"||typeof a.name=="string"||Array.isArray(a.arguments):!1}function yo(a){if(!a)return!1;const u=w(a.mode);return typeof a.serverName=="string"&&typeof a.threadId=="string"&&typeof a.message=="string"&&(u==="form"||u==="url")}function Ui(a){return a?typeof a.threadId=="string"&&typeof a.turnId=="string"&&typeof a.itemId=="string"&&y(a.permissions)!==null:!1}function qi(a){if(a.method!=="item/tool/requestUserInput")return[];const u=y(a.params),h=Array.isArray(u==null?void 0:u.questions)?u.questions:[],b=[];for(const I of h){const L=y(I),D=w(L==null?void 0:L.id).trim();D&&b.push(D)}return b}function Hi(a){const u=a.threadId||hs,h=Ve.value[u]??[],b=h.findIndex(L=>L.id===a.id),I=[...h];b>=0?I.splice(b,1,a):I.push(a),Ve.value={...Ve.value,[u]:I.sort((L,D)=>L.receivedAtIso.localeCompare(D.receivedAtIso))},xt()}function Do(a){const u={};for(const[h,b]of Object.entries(Ve.value)){const I=b.filter(L=>L.id!==a);I.length>0&&(u[h]=I)}Ve.value=u,xt()}function Vi(a){const u={};for(const h of a){const b=h.threadId||hs,I=u[b]??[];I.push(h),u[b]=I}for(const h of Object.values(u))h.sort((b,I)=>b.receivedAtIso.localeCompare(I.receivedAtIso));Ve.value=u}function wo(a){if(a.method==="server/request"){const u=gn(a.params);return u&&Hi(u),!0}if(a.method==="server/request/resolved"){const u=y(a.params),h=u==null?void 0:u.id;return typeof h=="number"&&Number.isInteger(h)&&Do(h),!0}return!1}function Ls(a){return a.replace(/\s+/gu," ").trim()}function Pa(a){const u=yt(a);if(!u)return null;if(a.method==="turn/started")return{threadId:u,activity:{label:"Thinking",details:[]}};if(a.method==="item/started"){const h=y(a.params),b=y(h==null?void 0:h.item),I=w(b==null?void 0:b.type).toLowerCase();if(I==="reasoning")return{threadId:u,activity:{label:"Thinking",details:[]}};if(I==="agentmessage")return{threadId:u,activity:{label:"Writing response",details:[]}};if(I==="commandexecution"){const L=w(b==null?void 0:b.command);return{threadId:u,activity:{label:"Running command",details:L?[L]:[]}}}if(I==="filechange"){const D=(Array.isArray(b==null?void 0:b.changes)?b.changes:[])[0],K=w(D==null?void 0:D.path);return{threadId:u,activity:{label:"Applying changes",details:K?[K]:[]}}}}return a.method==="item/commandExecution/outputDelta"?{threadId:u,activity:{label:"Running command",details:[]}}:a.method==="item/fileChange/outputDelta"?{threadId:u,activity:{label:"Applying changes",details:[]}}:a.method==="item/reasoning/summaryTextDelta"||a.method==="item/reasoning/summaryPartAdded"?{threadId:u,activity:{label:"Thinking",details:[]}}:a.method==="item/agentMessage/delta"?{threadId:u,activity:{label:"Writing response",details:[]}}:null}function Pn(a){if(a.method!=="turn/started")return null;const u=y(a.params);if(!u)return null;const h=yt(a);if(!h)return null;const b=y(u.turn),I=w(b==null?void 0:b.id)||w(u.turnId)||`${h}:unknown`;if(!I)return null;const L=ko(w(b==null?void 0:b.startedAt))??ko(w(u.startedAt))??ko(a.atIso)??Date.now();return{threadId:h,turnId:I,startedAtMs:L}}function Wi(a){if(a.method!=="turn/completed")return null;const u=y(a.params);if(!u)return null;const h=yt(a);if(!h)return null;const b=y(u.turn),I=w(b==null?void 0:b.id)||w(u.turnId)||`${h}:unknown`;if(!I)return null;const L=ko(w(b==null?void 0:b.completedAt))??ko(w(u.completedAt))??ko(a.atIso)??Date.now(),D=ko(w(b==null?void 0:b.startedAt))??ko(w(u.startedAt))??void 0;return{threadId:h,turnId:I,completedAtMs:L,startedAtMs:D}}function Ns(a){return`${a}:live-reasoning`}function zi(a){const u=r.value[a]??[];let h=-1;for(const b of u)typeof b.turnIndex=="number"&&Number.isFinite(b.turnIndex)&&(h=Math.max(h,b.turnIndex));return h+1}function js(a,u,h){if(!a||!u||!Number.isInteger(h)||h<0)return;const b=ve.value[a]??{};b[u]!==h&&(ve.value={...ve.value,[a]:{...b,[u]:h}})}function Gi(a,u){const h=ve.value[a]??{},b=Object.entries(h),I=Object.entries(u);b.length===I.length&&b.every(([L,D])=>u[L]===D)||(ve.value={...ve.value,[a]:{...u}})}function Fs(a){const u=c.value[a];if(!u||u.length===0)return;const h=ve.value[a]??{};let b=!1;const I=u.map(L=>{if(typeof L.turnIndex=="number"||!L.turnId)return L;const D=h[L.turnId];return typeof D!="number"?L:(b=!0,{...L,turnIndex:D})});b&&(c.value={...c.value,[a]:I})}function ns(a){const u=y(a.params);if(!u)return"";if(a.method==="item/started"){const h=y(u.item);return!h||h.type!=="reasoning"?"":w(h.id)}return""}function Ki(a){const u=y(a.params);if(!u)return null;if(a.method==="item/reasoning/summaryTextDelta"){const h=w(u.itemId),b=w(u.delta);return!h||!b?null:{messageId:Ns(h),delta:b}}return null}function $a(a){const u=y(a.params);if(!u)return"";if(a.method==="item/reasoning/summaryPartAdded"){const h=w(u.itemId);return h?Ns(h):""}return""}function Yi(a){const u=y(a.params);if(!u)return"";if(a.method==="item/completed"){const h=y(u.item);return!h||h.type!=="reasoning"?"":Ns(w(h.id))}return""}function Ji(a){const u=y(a.params);if(!u)return"";if(a.method==="item/started"){const h=y(u.item);return!h||h.type!=="agentMessage"?"":w(h.id)}return""}function Qi(a){const u=y(a.params);if(!u)return null;if(a.method==="item/agentMessage/delta"){const h=w(u.itemId),b=w(u.delta);return!h||!b?null:{messageId:h,delta:b}}return null}function Bs(a){const u=y(a.params);if(!u)return null;if(a.method==="item/completed"){const h=y(u.item);if(!h||h.type!=="agentMessage")return null;const b=w(h.id),I=w(h.text);return!b||!I?null:{id:b,role:"assistant",text:I,messageType:"agentMessage.live"}}return null}function Us(a){return`/codex-local-image?path=${encodeURIComponent(a)}`}function Oa(a){const u=a.trim();if(!u)return"";if(u.startsWith("data:")||u.startsWith("http://")||u.startsWith("https://")||u.startsWith("/codex-local-image?"))return u;const h=u.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(h)?`data:image/png;base64,${h}`:""}function Xi(a){if(a.method!=="item/completed")return null;const u=y(a.params),h=y(u==null?void 0:u.item);if(!h)return null;const b=w(h.id);if(!b)return null;if(h.type==="imageView"){const D=w(h.path);return D?{id:b,role:"assistant",text:"",images:[Us(D)],messageType:"imageView"}:null}if(h.type!=="imageGeneration"&&h.type!=="image_generation")return null;const I=w(h.result),L=I?Oa(I):"";return L?{id:b,role:"assistant",text:"",images:[L],messageType:"imageView"}:null}function Zi(a){var Ce;if(a.method!=="item/started")return null;const u=y(a.params),h=y(u==null?void 0:u.item);if(!h||h.type!=="commandExecution")return null;const b=w(h.id),I=w(h.command);if(!b)return null;const L=typeof h.cwd=="string"?h.cwd:null,D=yt(a),K=w(u==null?void 0:u.turnId)||w(u==null?void 0:u.turn_id),J=D&&K?(Ce=ve.value[D])==null?void 0:Ce[K]:void 0;return{id:b,role:"system",text:I,messageType:"commandExecution",commandExecution:{command:I,cwd:L,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:K||void 0,turnIndex:typeof J=="number"?J:void 0}}function Da(a){if(a.method!=="item/commandExecution/outputDelta")return null;const u=y(a.params);if(!u)return null;const h=w(u.itemId),b=w(u.delta);return!h||!b?null:{itemId:h,delta:b}}function La(a){var Et;if(a.method!=="item/completed")return null;const u=y(a.params),h=y(u==null?void 0:u.item);if(!h||h.type!=="commandExecution")return null;const b=w(h.id),I=w(h.command);if(!b)return null;const L=typeof h.cwd=="string"?h.cwd:null,D=w(h.status),K=D==="failed"?"failed":D==="declined"?"declined":D==="interrupted"?"interrupted":"completed",J=typeof h.aggregatedOutput=="string"?h.aggregatedOutput:"",Ce=typeof h.exitCode=="number"?h.exitCode:null,Ue=yt(a),tt=w(u==null?void 0:u.turnId)||w(u==null?void 0:u.turn_id),ct=Ue&&tt?(Et=ve.value[Ue])==null?void 0:Et[tt]:void 0;return{id:b,role:"system",text:I,messageType:"commandExecution",commandExecution:{command:I,cwd:L,status:K,aggregatedOutput:J,exitCode:Ce},turnId:tt||void 0,turnIndex:typeof ct=="number"?ct:void 0}}function el(a){var Ce;if(a.method!=="item/completed")return null;const u=y(a.params),h=y(u==null?void 0:u.item);if(!h||h.type!=="fileChange")return null;const b=w(h.id);if(!b)return null;const I=w(u==null?void 0:u.threadId),L=w(u==null?void 0:u.turnId),D=I&&L?(Ce=ve.value[I])==null?void 0:Ce[L]:void 0,K=Zp(h.changes),J=Xp(h.status);return K.length===0||J!=="completed"?null:{id:b,role:"system",text:"",messageType:"fileChange",fileChangeStatus:J,fileChanges:K,turnId:L||void 0,turnIndex:typeof D=="number"?D:void 0}}function qs(a,u){const h=l.value[a]??[],b=ui(h,u);b!==h&&(l.value={...l.value,[a]:b})}function tl(a,u){const h=l.value[a];if(!h||h.length===0)return;const b=new Set(u.map(L=>L.id)),I=h.filter(L=>!b.has(L.id));I.length!==h.length&&(I.length===0?l.value=dt(l.value,a):l.value={...l.value,[a]:I})}function Na(a,u){const h=c.value[a];if(!h||h.length===0)return;const b=new Set(u.map(K=>K.id)),I=new Set(u.filter(K=>K.messageType==="fileChange"&&typeof K.turnId=="string"&&K.turnId.length>0).map(K=>K.turnId)),L=new Set(u.filter(K=>K.messageType==="fileChange"&&typeof K.turnIndex=="number").map(K=>K.turnIndex)),D=h.filter(K=>!b.has(K.id)&&!(K.turnId&&I.has(K.turnId))&&!(typeof K.turnIndex=="number"&&L.has(K.turnIndex)));D.length!==h.length&&(D.length===0?c.value=dt(c.value,a):c.value={...c.value,[a]:D})}function Hs(a){if(a.method==="item/agentMessage/delta")return!0;const u=y(a.params);if(!u)return!1;if(a.method==="item/completed"){const h=y(u.item);return(h==null?void 0:h.type)==="agentMessage"}return!1}function bo(a){var Js,za,Ga,Qs,Ka;if(wo(a))return;if(a.method==="account/rateLimits/updated"&&Jr(),a.method==="thread/name/updated"){const Ge=y(a.params),rr=w(Ge==null?void 0:Ge.threadId),ur=w(Ge==null?void 0:Ge.threadName);rr&&ur&&(je.value={...je.value,[rr]:ur},xt(),eu(rr,ur))}if(a.method==="account/rateLimits/updated"){Tr(rh(a.params));return}const u=gt(a);if(u){Yr(u.threadId,u.usage);return}const h=Pa(a);h&&pt(h.threadId,h.activity);const b=yt(a),I=tn(a);!I&&b&&Dr(b);const L=Pn(a);L&&(Fn.set(L.turnId,L),js(L.threadId,L.turnId,zi(L.threadId)),Te.value={...Te.value,[L.threadId]:L.turnId},jt(L.threadId),Kt(L.threadId),Xt(L.threadId,null),Pt(L.threadId,null),Ct(L.threadId,!0),T.value[L.threadId]&&(T.value=dt(T.value,L.threadId)));const D=Wi(a),K=vr(a),J=(D==null?void 0:D.threadId)??yt(a),Ce=J?ft(J):"",Ue=!!J&&!!K&&Ce!==Cr&&li(new Error(K));if(D){Je.value[D.threadId];const Ge=Fn.get(D.turnId);Ge&&Fn.delete(D.turnId);const rr=E((Js=y(a.params))==null?void 0:Js.durationMs)??E((Ga=y((za=y(a.params))==null?void 0:za.turn))==null?void 0:Ga.durationMs)??(typeof D.startedAtMs=="number"?D.completedAtMs-D.startedAtMs:null)??(Ge?D.completedAtMs-Ge.startedAtMs:null),ur=typeof rr=="number"?Math.max(0,rr):0;Xt(D.threadId,{turnId:D.turnId,durationMs:ur}),Te.value[D.threadId]&&(Te.value=dt(Te.value,D.threadId)),Ct(D.threadId,!1),pt(D.threadId,null),Ht(D.threadId),Ue||(Xn(D.threadId),Ha(D.threadId))}if(K){const Ge=(D==null?void 0:D.threadId)||yt(a);Ge&&Pt(Ge,K),G.value=K,Ge&&Ue&&An(Ge)}else D&&Pt(D.threadId,null);if(I){const Ge=b,rr=Ge?ft(Ge):R.value.trim();Ge&&Pt(Ge,I.message,{transient:I.transient}),G.value=I.message,rr!==Cr&&li(new Error(I.message))&&(Ge?An(Ge):Bt())}const tt=lr(a);tt&&(nr(tt.threadId,tt.message),pt(tt.threadId,{label:"Planning",details:((Qs=tt.message.plan)==null?void 0:Qs.steps.map(Ge=>Ge.step).slice(0,2))??[]}));const ct=en(a);if(ct&&(nr(ct.threadId,ct.message),pt(ct.threadId,{label:"Planning",details:[]})),!b||b!==n.value)return;Ji(a);const Et=Qi(a);if(Et){const Ge=(s.value[b]??[]).find(ur=>ur.id===Et.messageId),rr=`${(Ge==null?void 0:Ge.text)??""}${Et.delta}`;C(b,{id:Et.messageId,role:"assistant",text:rr,messageType:"agentMessage.live"})}const Xr=Bs(a);Xr&&C(b,Xr);const Zr=Xi(a);Zr&&C(b,Zr),ns(a);const ls=Ki(a);if(ls&&De(b,ls.delta),$a(a)){const Ge=i.value[b]??"";Ge.trim().length>0&&!Ge.endsWith(`
53
-
54
- `)&&X(b,`${Ge}
55
-
56
- `)}Yi(a);const Fo=Zi(a);Fo&&(qs(b,Fo),pt(b,{label:"Running command",details:[((Ka=Fo.commandExecution)==null?void 0:Ka.command)??""]}));const Bo=Da(a);if(Bo){const Ge=(l.value[b]??[]).find(rr=>rr.id===Bo.itemId);Ge!=null&&Ge.commandExecution&&qs(b,{...Ge,commandExecution:{...Ge.commandExecution,aggregatedOutput:`${Ge.commandExecution.aggregatedOutput}${Bo.delta}`}})}const us=La(a);us&&qs(b,us);const Wa=el(a);if(Wa&&j(b,Wa),Hs(a)&&(Rt&&n.value&&Zt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Qe(b)),a.method==="turn/completed"){Rt=!1,Qe(b),l.value[b]&&(l.value=dt(l.value,b));const Ge=yt(a);Ge&&(Ct(Ge,!1),pt(Ge,null),Ht(Ge),Ue||(Xn(Ge),Ha(Ge)))}}function nl(a){if(a.method==="thread/tokenUsage/updated")return;const u=yt(a);u&&te.add(u);const h=a.method;(h.startsWith("thread/")||h.startsWith("turn/")||h.startsWith("item/"))&&(V=!0),!(Ae!==null||typeof window>"u")&&(Ae=window.setTimeout(()=>{Ae=null,xr()},ou))}async function rl(a,u){if(!Ot){Ot=!0;try{if(!u)return;const h=[];for(const b of u.order){const I=xo(b);h.includes(I)||h.push(I)}if(h.length>0){const b=ii(h,a);Io(ke.value,b)||(ke.value=b,ms(ke.value))}if(Object.keys(u.labels).length>0){const b={...me.value};let I=!1;for(const[L,D]of Object.entries(u.labels)){const K=xo(L);b[K]!==D&&(b[K]=D,I=!0)}I&&(me.value=b,au(b))}}catch{}}}async function ja(){if(!(Object.keys(je.value).length>0))try{const a=await xb();Object.keys(a.titles).length>0&&(je.value=a.titles)}catch{}}async function ol(){try{return await ys()}catch{return null}}async function sl(a,u,h){if(je.value[a])return;const b=u.trim();if(!b)return;const I=b.length>300?b.slice(0,300):b;try{const L=await Eb(I,h);if(!L||je.value[a])return;je.value={...je.value,[a]:L},xt(),eu(a,L)}catch{}}function Qr(a,u){if(!u||u.order.length===0)return a;const h=new Set(u.order.map(b=>xo(b)));return a.filter(b=>h.has(b.projectName))}function Fa(a,u){const h=Qr(a,u),b=ii(ke.value,h);Io(ke.value,b)||(ke.value=b,ms(ke.value));const I=iu(h,ke.value);Hn(new Set(cr(I).map(D=>D.id)));const L=r1(t.value,I,p.value);t.value=ci(t.value,L),p.value=Vt(p.value,new Set(cr(t.value).map(D=>D.id))),xt()}function rs(a,u){if(a.length===0)return u;if(u.length===0)return a;const h=new Map;for(const I of cr(a))h.set(I.id,I);for(const I of cr(u))h.set(I.id,I);const b=new Map;for(const I of h.values()){const L=b.get(I.projectName);L?L.push(I):b.set(I.projectName,[I])}return Array.from(b.entries()).map(([I,L])=>({projectName:I,threads:L.sort((D,K)=>new Date(K.updatedAtIso).getTime()-new Date(D.updatedAtIso).getTime())})).sort((I,L)=>{var J,Ce;const D=new Date(((J=I.threads[0])==null?void 0:J.updatedAtIso)??0).getTime();return new Date(((Ce=L.threads[0])==null?void 0:Ce.updatedAtIso)??0).getTime()-D})}async function Ba(a){if(!(at||!Pe)){at=!0;try{const u=await Bd(Pe,Ow());Pe=u.nextCursor,ut=u.nextCursor===null,nt=rs(nt,u.groups),Fa(nt,a)}catch{}finally{at=!1}}}async function Lo(){if(Oe){await Oe;return}Oe=(async()=>{var a;ee.value||(ge.value=!0);try{const[u,h]=await Promise.all([Bd(),ol(),ja()]),b=u.groups;nt=ee.value?rs(nt,b):b,Pe=ee.value&&!ut?Pe:u.nextCursor,ut=u.nextCursor===null,await rl(b,h),Fa(nt,h),ee.value=!0,ut||Ba(h);const I=cr(e.value);tr(I),!I.some(D=>D.id===n.value)&&!n.value&&qt(((a=I[0])==null?void 0:a.id)??"")}finally{ge.value=!1}})().finally(()=>{Oe=null}),await Oe}async function jr(a,u={}){if(!a)return;const h=P.get(a);if(h){await h;return}const b=$e.value[a]===!0,I=u.silent!==!0&&!b;I&&(Re.value=!0);const L=(async()=>{try{const D=_n(a),K=Ee.value[a]??"",J=Date.now()-(be.get(a)??0)<Cx;if(b&&(J||(D.length===0||K===D)&&p.value[a]!==!0)){In(a);return}const tt=Y.value[a]!==!0?await Yl(a):null,ct=tt??await Ud(a);tt&&(ar(a,tt.model),Y.value={...Y.value,[a]:!0});const{messages:Et,inProgress:Xr,activeTurnId:Zr,turnIndexByTurnId:ls}=ct;Mn(a,Et),Gi(a,ls),Fs(a);const Ys=r.value[a]??[],Fo=Vx(Ys,Et,{preserveMissing:u.silent===!0});ln(a,Fo);const Bo=s.value[a]??[];if(Xr){const us=zx(Bo,Et);un(a,us)}else hr(a);tl(a,Et),Na(a,Et),$e.value={...$e.value,[a]:!0},be.set(a,Date.now()),D&&(Ee.value={...Ee.value,[a]:D}),Ct(a,Xr),Zr?Te.value={...Te.value,[a]:Zr}:Te.value[a]&&(Te.value=dt(Te.value,a)),Xr||Ft(a),In(a)}finally{I&&(Re.value=!1)}})().finally(()=>{P.delete(a)});P.set(a,L),await L}async function al(a,u={}){a&&$e.value[a]!==!0&&await jr(a,u)}async function Vs(){if(O){await O;return}O=(async()=>{var a,u;try{const h=((u=(a=fr.value)==null?void 0:a.cwd)==null?void 0:u.trim())??"";Q.value=await Ib(h?[h]:void 0)}catch{}finally{O=null}})(),await O}async function il(){await Qt()}async function ll(a={}){G.value="";const u=a.includeSelectedThreadMessages!==!1,h=a.awaitAncillaryRefreshes===!0;try{await Lo();const b=Promise.allSettled([Sr({providerChanged:a.providerChanged,includeProviderModels:a.providerChanged===!0||h}),Qt(),_r(),Vs(),il()]).then(()=>{});u&&await jr(n.value),h&&await b}catch(b){G.value=b instanceof Error?b.message:"Unknown application error"}}async function ul(a){qt(a);try{await Promise.all([jr(a),Vs()])}catch(u){G.value=u instanceof Error?u.message:"Unknown application error"}}async function cl(a){try{await Xw(a),await Lo(),n.value===a&&await jr(n.value)}catch(u){G.value=u instanceof Error?u.message:"Unknown application error"}}async function Ws(a,u){const h=u.trim();if(!(!a||!h))try{await Zw(a,h),je.value={...je.value,[a]:h},xt(),eu(a,h)}catch(b){G.value=b instanceof Error?b.message:"Unknown application error"}}async function dl(a){var D,K;const u=a.trim();if(!u)return"";const h=cr(t.value).find(J=>J.id===u),b=((D=h==null?void 0:h.cwd)==null?void 0:D.trim())??"",I=((K=h==null?void 0:h.title)==null?void 0:K.trim())??"Forked chat",L=ft(u);G.value="";try{const J=await Wd(u,b||void 0,L||void 0),Ce=J.threadId.trim();return Ce?(er(Ce,b,I),ar(Ce,J.model),Y.value={...Y.value,[Ce]:!0},qt(Ce),await Lo(),await jr(Ce),Ce):""}catch(J){return G.value=J instanceof Error?J.message:"Unknown application error",""}}async function No(a,u){var D;const h=a.trim();if(!h||!Number.isInteger(u)||u<0)return"";if(p.value[h]===!0)return G.value="Finish the current turn before forking from a response.","";if($e.value[h]!==!0)try{await jr(h)}catch(K){return G.value=K instanceof Error?K.message:"Unknown application error",""}const b=r.value[h]??[];let I=-1;for(const K of b)typeof K.turnIndex=="number"&&Number.isFinite(K.turnIndex)&&(I=Math.max(I,K.turnIndex));if(I>=0&&u>I)return"";const L=cr(t.value).find(K=>K.id===h)??null;try{G.value="";const K=await Wd(h),J=K.threadId.trim();if(!J)return"";const Ce=K.cwd.trim()||((D=L==null?void 0:L.cwd)==null?void 0:D.trim())||"",Ue=s1((L==null?void 0:L.title)||(L==null?void 0:L.preview)||"Untitled thread");er(J,Ce,Ue),ar(J,K.model),ln(J,K.messages),$e.value={...$e.value,[J]:!0},Y.value={...Y.value,[J]:!0},jt(J),un(J,[]),Qe(J),l.value[J]&&(l.value=dt(l.value,J)),Xt(J,null),pt(J,null),Pt(J,null),Ct(J,!1);const tt=I-u;if(tt>0){const ct=await Jl(J,tt);ln(J,ct)}return await Ws(J,Ue),qt(J),Lo().catch(()=>{}),J}catch(K){return G.value=K instanceof Error?K.message:"Unknown application error",""}}async function Ua(a,u,h=[],b=[],I=[]){if(!a||!u.trim()||h.length>0||b.length>0||I.length>0)return!1;const D=(Ve.value[a]??[]).filter(Ce=>Ce.method==="item/tool/requestUserInput");if(D.length!==1)return!1;const[K]=D,J=qi(K);return J.length!==1?!1:is({id:K.id,result:{answers:{[J[0]]:{answers:[u.trim()]}}}})}async function jo(a,u=[],h=[],b="steer",I=[],L){if(A.value)return;const D=n.value,K=a.trim();if(!D||!K&&u.length===0&&I.length===0||await Ua(D,K,u,h,I))return;const J=p.value[D]===!0;if(J&&b==="queue"){const Ce=f.value[D]??[],Ue=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,tt=[...Ce],ct=typeof L=="number"?Math.max(0,Math.min(L,tt.length)):tt.length;tt.splice(ct,0,{id:Ue,text:K,imageUrls:u,skills:h,fileAttachments:I,collaborationMode:q.value}),f.value={...f.value,[D]:tt};return}if(J){Rt=!0,os(D,K,u,h,I).catch(Ce=>{const Ue=Ce instanceof Error?Ce.message:"Unknown application error";Pt(D,Ue),G.value=Ue});return}G.value="",Rt=!0,Xt(D,null),pt(D,{label:"Thinking",details:Tn(ft(D),F.value,q.value)}),Pt(D,null),Ct(D,!0);try{await os(D,K,u,h,I)}catch(Ce){Rt=!1,Ct(D,!1),pt(D,null);const Ue=Ce instanceof Error?Ce.message:"Unknown application error";throw Pt(D,Ue),G.value=Ue,Ce}}async function qa(a,u,h=[],b=[],I=[]){if(A.value)return"";const L=a.trim(),D=u.trim(),K=ft(Ro).trim();if(!L&&h.length===0&&I.length===0)return"";ze.value=!0,G.value="";let J="";try{try{const ct=await Vd(D||void 0,K||void 0);J=ct.threadId,ar(J,ct.model)}catch(ct){if(K&&K!==Cr&&li(ct)){await Bt();const Et=await Vd(D||void 0,Cr);J=Et.threadId,ar(J,Et.model)}else throw ct}if(!J)return"";er(J,D,L||"[Image]"),pr(J),Y.value={...Y.value,[J]:!0},qt(J),Rt=!0,Xt(J,null),pt(J,{label:"Thinking",details:Tn(ft(J),F.value,q.value)}),Pt(J,null),Ct(J,!0);const Ce=J,Ue=D||null,tt=L;return os(J,L,h,b,I).catch(ct=>{Rt=!1,Ct(J,!1),pt(J,null);const Et=ct instanceof Error?ct.message:"Unknown application error";Pt(J,Et),G.value=Et}).finally(()=>{ze.value=!1}),sl(Ce,tt,Ue),J}catch(Ce){Rt=!1,J&&(Ct(J,!1),pt(J,null));const Ue=Ce instanceof Error?Ce.message:"Unknown application error";throw J&&Pt(J,Ue),G.value=Ue,ze.value=!1,Ce}}async function os(a,u,h=[],b=[],I=[]){const L=F.value,D=q.value,K=u.trim(),J=[...h];if(J.length===0&&fe(K)){const tt=ce(a);tt&&J.push(tt)}const Ce=b.map(tt=>({name:tt.name,path:tt.path})),Ue=I.map(tt=>({...tt}));Qn(a,{text:K,imageUrls:[...J],skills:Ce,fileAttachments:Ue,effort:L,collaborationMode:D,fallbackRetried:!1});try{if(Y.value[a]!==!0){const Et=await Yl(a);ar(a,Et.model)}const tt=ft(a);let ct="";try{ct=await Ql(a,u,J,tt||void 0,L||void 0,b.length>0?b:void 0,I,D)}catch(Et){if(tt&&tt!==Cr&&li(Et))await Bt(a),Qn(a,{text:K,imageUrls:[...J],skills:Ce,fileAttachments:Ue,effort:L,collaborationMode:D,fallbackRetried:!0}),ct=await Ql(a,u,J,Cr,L||void 0,b.length>0?b:void 0,I,D);else throw Et}ct&&(Te.value={...Te.value,[a]:ct}),Y.value={...Y.value,[a]:!0},te.add(a),V=!0,await xr(),hn(a)}catch(tt){throw tt}}async function Ha(a){if(g.value[a]===!0)return;const u=f.value[a];if(!u||u.length===0)return;g.value={...g.value,[a]:!0};const[h,...b]=u;f.value=b.length>0?{...f.value,[a]:b}:dt(f.value,a),ze.value=!0,G.value="",Rt=!0,Xt(a,null),pt(a,{label:"Thinking",details:Tn(ft(a),F.value,h.collaborationMode)}),Pt(a,null),Ct(a,!0);try{bn(h.collaborationMode),await os(a,h.text,h.imageUrls,h.skills,h.fileAttachments)}catch{Ct(a,!1),pt(a,null)}finally{g.value=dt(g.value,a),ze.value=!1}}async function fl(){const a=n.value;if(!a||p.value[a]!==!0||_e.value[a]===!0)return;let u=Te.value[a];if(!u){const{activeTurnId:h}=await Ud(a);u=h,u&&(Te.value={...Te.value,[a]:u})}if(!u)throw new Error("Could not determine active turn id for interrupt");_.value=!0,G.value="";try{await sb(a,u),Ct(a,!1),pt(a,null),Pt(a,null),Te.value[a]&&(Te.value=dt(Te.value,a)),te.add(a),V=!0,await xr()}catch(h){const b=h instanceof Error?h.message:"Failed to interrupt active turn";Pt(a,b),G.value=b}finally{_.value=!1}}async function pl(a){var K,J;const u=n.value;if(!u||B.value||!a.trim())return;const h=r.value[u]??[],b=h.find(Ce=>Ce.turnId===a),I=typeof(b==null?void 0:b.turnIndex)=="number"?b.turnIndex:-1;if(I<0)return;const L=h.reduce((Ce,Ue)=>typeof Ue.turnIndex=="number"&&Ue.turnIndex>Ce?Ue.turnIndex:Ce,-1);if(L<0||I>L)return;const D=L-I+1;if(!(D<1)){B.value=!0,G.value="";try{const Ce=((J=(K=fr.value)==null?void 0:K.cwd)==null?void 0:J.trim())??"";Ce&&await eb(u,a,Ce);const Ue=await Jl(u,D);ln(u,Ue),un(u,[]),Qe(u),l.value[u]&&(l.value=dt(l.value,u)),Xt(u,null),pt(u,null),Pt(u,null),V=!0,await xr()}catch(Ce){G.value=Ce instanceof Error?Ce.message:"Failed to rollback thread"}finally{B.value=!1}}}let ss=null;async function hl(a,u){try{const h=await ys(),b={...h.labels};let I=!1;for(const L of h.order){if(xo(L)!==a)continue;const D=u.trim();D.length===0?b[L]!==void 0&&(delete b[L],I=!0):b[L]!==D&&(b[L]=D,I=!0)}I&&await Xl({order:h.order,labels:b,active:h.active})}catch{}}function Va(a,u){a.length===0||(me.value[a]??"")===u||(me.value={...me.value,[a]:u},au(me.value),ss!==null&&clearTimeout(ss),ss=setTimeout(()=>{ss=null,hl(a,u)},500))}async function ml(a){var L;if(a.length===0)return;const u=ke.value.filter(D=>D!==a);if(Io(ke.value,u)||(ke.value=u,ms(ke.value)),t.value=t.value.filter(D=>D.projectName!==a),me.value[a]!==void 0){const D={...me.value};delete D[a],me.value=D,au(D)}xt();const h=cr(e.value);tr(h),h.some(D=>D.id===n.value)||qt(((L=h[0])==null?void 0:L.id)??"");const I=new Set;try{const D=await ys();for(const K of D.order)xo(K)===a&&I.add(K);for(const K of D.active)xo(K)===a&&I.add(K);for(const K of Object.keys(D.labels))xo(K)===a&&I.add(K)}catch{}if(I.size>0)try{const D=await ys(),K=D.order.filter(Ue=>!I.has(Ue)),J=D.active.filter(Ue=>!I.has(Ue)),Ce=J.length===0&&K.length>0?[K[0]]:J;await Xl({order:K,labels:Zx(D.labels,I),active:Ce});return}catch{}await zs()}function as(a,u){if(a.length===0||t.value.length===0)return;const h=t.value.map(J=>J.projectName),b=h.indexOf(a);if(b===-1)return;const I=Math.max(0,Math.min(u,h.length-1)),L=Bx(h,b,I);if(L===h)return;const D=ii(L,t.value);ke.value=D,ms(ke.value);const K=iu(t.value,ke.value);t.value=ci(t.value,K),xt(),zs()}function vl(a){const u=a.trim();if(!u)return;const h=[u,...ke.value.filter(I=>I!==u)];if(Io(ke.value,h))return;ke.value=h,ms(ke.value);const b=iu(t.value,ke.value);t.value=ci(t.value,b),xt(),zs()}async function zs(){var a,u;try{const h=await ys(),b=new Map;for(const D of h.order){const K=xo(D);b.has(K)||b.set(K,D)}for(const D of t.value){const K=((u=(a=D.threads[0])==null?void 0:a.cwd)==null?void 0:u.trim())??"";K&&b.set(D.projectName,K)}const I=[];for(const D of ke.value){const K=b.get(D);K&&!I.includes(K)&&I.push(K)}for(const D of h.order)I.includes(D)||I.push(D);const L=h.active.filter(D=>I.includes(D));L.length===0&&I.length>0&&L.push(I[0]),await Xl({order:I,labels:h.labels,active:L})}catch{}}async function xr(){if(ne.value){typeof window<"u"&&Ae===null&&(Ae=window.setTimeout(()=>{Ae=null,xr()},ou));return}ne.value=!0;const a=V,u=new Set(te);V=!1,te.clear();try{a&&await Lo();const h=n.value;if(!h)return;const b=u.has(h),I=p.value[h]===!0,L=_n(h),D=Ee.value[h]??"";(L.length>0&&L!==D||I&&$e.value[h]!==!0||b&&$e.value[h]!==!0||a&&$e.value[h]!==!0)&&await jr(h,{silent:!0})}catch{}finally{ne.value=!1,(V||te.size>0)&&typeof window<"u"&&Ae===null&&(Ae=window.setTimeout(()=>{Ae=null,xr()},ou))}}async function gl(){await Gs(),V=!ee.value,n.value&&$e.value[n.value]!==!0&&te.add(n.value),await xr()}function yl(){typeof window>"u"||oe||(Gs(),oe=qw(a=>{if(a.method==="ready"){vt(),gl();return}bo(a),nl(a)}))}async function Gs(){try{const u=(await zw()).map(h=>gn(h)).filter(h=>h!==null);Vi(u)}catch{}}async function is(a){try{return await Ww(a.id,{result:a.result,error:a.error}),Do(a.id),!0}catch(u){return G.value=u instanceof Error?u.message:"Failed to reply to server request",!1}}function wl(){if(oe&&(oe(),oe=null),V=!1,te.clear(),Fn.clear(),Ae!==null&&typeof window<"u"&&(window.clearTimeout(Ae),Ae=null),ye!==null&&typeof window<"u"&&(window.clearTimeout(ye),ye=null),typeof window<"u")for(const a of he.values())window.clearTimeout(a);he.clear(),Rt=!1,r.value={},o.value={},s.value={},i.value={},l.value={},c.value={},ve.value={},Ne.value={},Fe.value={},Ie.value={},Te.value={},_e.value={},He.value={},Ke.value={},f.value={},g.value={},mt.value=null,Xe.value={}}const bl=re(()=>{const a=n.value;return a?f.value[a]??[]:[]});function Ks(a){const u=n.value;if(!u)return;const h=f.value[u];if(!h)return;const b=h.filter(I=>I.id!==a);f.value=b.length>0?{...f.value,[u]:b}:dt(f.value,u)}function Tl(a){const u=n.value;if(!u)return;const h=f.value[u];if(!h)return;const b=h.find(I=>I.id===a);b&&(Ks(a),bn(b.collaborationMode),jo(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments))}function _l(a){qt(a)}return{projectGroups:e,projectDisplayNameById:me,selectedThread:fr,selectedThreadTokenUsage:or,selectedThreadScrollState:wr,selectedThreadTerminalOpen:sn,isSelectedThreadInterruptPending:Ze,selectedThreadServerRequests:Jn,selectedLiveOverlay:wn,codexQuota:Jt,selectedThreadId:n,availableCollaborationModes:U,availableModelIds:k,selectedCollaborationMode:q,selectedModelId:R,selectedReasoningEffort:F,selectedSpeedMode:z,installedSkills:Q,accountRateLimitSnapshots:pe,messages:br,isLoadingThreads:ge,isLoadingMessages:Re,isSendingMessage:ze,isInterruptingTurn:_,isUpdatingSpeedMode:A,isRollingBack:B,error:G,refreshAll:ll,refreshSkills:Vs,selectThread:ul,loadMessages:jr,ensureThreadMessagesLoaded:al,setThreadScrollState:Zt,setThreadTerminalOpen:Vn,toggleSelectedThreadTerminal:ir,archiveThreadById:cl,renameThreadById:Ws,forkThreadById:dl,forkThreadFromTurn:No,rollbackSelectedThread:pl,sendMessageToSelectedThread:jo,sendMessageToNewThread:qa,interruptSelectedThreadTurn:fl,selectedThreadQueuedMessages:bl,removeQueuedMessage:Ks,steerQueuedMessage:Tl,setSelectedCollaborationMode:bn,readModelIdForThread:ft,setSelectedModelIdForThread:sr,setSelectedModelId:an,setSelectedReasoningEffort:pn,updateSelectedSpeedMode:Zn,respondToPendingServerRequest:is,renameProject:Va,removeProject:ml,reorderProject:as,pinProjectToTop:vl,startPolling:yl,stopPolling:wl,primeSelectedThread:_l}}const i1={class:"sidebar-root"},l1={class:"sidebar-scrollable"},u1=["aria-pressed"],c1={key:1,class:"sidebar-search-bar"},d1={class:"sidebar-settings-account-section"},f1={class:"sidebar-settings-account-header"},p1={class:"sidebar-settings-account-header-main"},h1=["aria-expanded","title"],m1={class:"sidebar-settings-account-collapse-icon"},v1={class:"sidebar-settings-account-count"},g1=["disabled"],y1={key:0,class:"sidebar-settings-account-error"},w1={key:1,class:"sidebar-settings-account-empty"},b1={key:2,class:"sidebar-settings-account-list"},T1=["title","onMouseenter","onMouseleave"],_1={class:"sidebar-settings-account-main"},S1={class:"sidebar-settings-account-email"},k1={class:"sidebar-settings-account-meta"},x1={class:"sidebar-settings-account-quota"},C1={class:"sidebar-settings-account-id"},A1={class:"sidebar-settings-account-actions"},E1=["disabled","onClick"],I1=["disabled","onClick"],M1=["title"],R1=["title"],P1={class:"sidebar-settings-value"},$1=["title"],O1={class:"sidebar-settings-value"},D1=["title"],L1={class:"sidebar-settings-value"},N1=["title"],j1=["title"],F1=["title"],B1={class:"sidebar-settings-row sidebar-settings-row--select",title:"Choose the API provider for the Codex backend"},U1=["value","disabled"],q1={key:0,class:"sidebar-settings-row sidebar-settings-error"},H1={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},V1={class:"sidebar-settings-key-group"},W1={class:"sidebar-settings-key-masked"},z1=["disabled"],G1=["disabled"],K1={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},Y1={class:"sidebar-settings-segmented",role:"group","aria-label":"OpenRouter API format"},J1=["disabled"],Q1=["disabled"],X1={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},Z1={class:"sidebar-settings-key-group"},eC=["disabled"],tC={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},nC={class:"sidebar-settings-key-group"},rC={class:"sidebar-settings-key-group"},oC=["disabled"],sC={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},aC={class:"sidebar-settings-segmented",role:"group","aria-label":"Custom endpoint API format"},iC=["title"],lC={class:"sidebar-settings-value"},uC={key:4,class:"sidebar-settings-telegram-panel"},cC={class:"sidebar-settings-field"},dC={class:"sidebar-settings-field"},fC={key:0,class:"sidebar-settings-telegram-error"},pC={class:"sidebar-settings-telegram-actions"},hC=["disabled"],mC=["data-state","title"],vC=["data-state"],gC={class:"sidebar-settings-context-meta"},yC={class:"sidebar-settings-rate-limits"},wC={class:"sidebar-settings-build-label","aria-label":"Worktree name and version"},bC={class:"sidebar-settings-button-version"},TC={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},_C=["aria-pressed","title"],SC={class:"content-header-terminal-shortcut"},kC={class:"content-body"},xC={key:1,class:"content-grid content-grid-home"},CC={class:"new-thread-empty"},AC=["title"],EC=["onKeydown"],IC={class:"new-thread-open-folder-current"},MC=["title"],RC=["disabled"],PC={class:"new-thread-open-folder-actions"},$C={class:"new-thread-open-folder-toggle"},OC=["aria-pressed","disabled"],DC={key:0,class:"new-thread-open-folder-create"},LC={class:"new-thread-open-folder-create-composer"},NC=["onKeydown"],jC=["disabled"],FC={key:0,class:"new-thread-open-folder-error"},BC=["onKeydown"],UC={key:1,class:"new-thread-open-folder-error-actions"},qC={class:"new-thread-open-folder-error"},HC=["disabled"],VC={key:2,class:"new-thread-open-folder-status"},WC={key:3,class:"new-thread-open-folder-status"},zC={key:4,class:"new-thread-open-folder-list"},GC=["title","disabled","onClick"],KC={class:"new-thread-open-folder-item-name"},YC=["disabled","onClick"],JC={key:1,class:"new-thread-branch-select"},QC={class:"new-thread-branch-select-help"},XC={class:"worktree-init-status-title"},ZC={class:"worktree-init-status-message"},eA={key:3,class:"new-thread-trending"},tA={class:"new-thread-trending-header"},nA={key:0,class:"new-thread-trending-empty"},rA={key:1,class:"new-thread-trending-empty"},oA={key:2,class:"new-thread-trending-list"},sA=["onClick"],aA=["title"],iA={class:"new-thread-trending-tip-name-owner"},lA={class:"new-thread-trending-tip-name-repo"},uA={key:1,class:"new-thread-trending-tip-name-repo"},cA={class:"new-thread-trending-tip-meta"},dA={class:"new-thread-trending-tip-description"},fA={class:"composer-with-queue"},pA={key:2,class:"content-grid"},hA={class:"content-thread"},mA={class:"composer-with-queue"},hf="codex-web-local.sidebar-collapsed.v1",mf="codex-web-local.accounts-section-collapsed.v1",vf="codex-web-local.send-with-enter.v1",gf="codex-web-local.in-progress-send-mode.v1",yf="codex-web-local.dark-mode.v1",wf="codex-web-local.dictation-click-to-toggle.v1",bf="codex-web-local.dictation-auto-send.v1",Tf="codex-web-local.dictation-language.v1",_f="codex-web-local.github-trending-projects.v1",Sf="codex-web-local.chat-width.v1",vA=400,gA=Cn({__name:"App",setup(e){var Tc;const t=ti(()=>ri(()=>import("./ThreadConversation-BNvqi1ws.js"),__vite__mapDeps([0,1]))),n=ti(()=>ri(()=>import("./ThreadTerminalPanel-DjP4TSjB.js"),__vite__mapDeps([2,3]))),r=ti(()=>ri(()=>import("./ReviewPane-CUrlR8zS.js"),__vite__mapDeps([4,5]))),o=ti(()=>ri(()=>import("./SkillsHub-BxltnLjE.js"),__vite__mapDeps([6,7]))),s="2c53",i="0.1.84",l={sendWithEnter:"When enabled, press Enter to send. When disabled, use Command+Enter to send.",inProgressSendMode:"If a turn is still running, choose whether a new prompt should steer the current turn or be queued.",appearance:"Switch between system theme, light mode, and dark mode.",chatWidth:"Choose how wide the conversation column and composer can grow on desktop screens.",dictationClickToToggle:"Use click-to-start and click-to-stop dictation instead of hold-to-talk.",dictationAutoSend:"Automatically send transcribed dictation when recording stops.",githubTrendingProjects:"Show or hide GitHub trending project cards on the new thread screen.",dictationLanguage:"Choose transcription language or keep auto-detect."},c={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},p={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:f,projectDisplayNameById:g,selectedThread:T,selectedThreadTokenUsage:k,selectedThreadScrollState:U,selectedThreadTerminalOpen:H,selectedThreadServerRequests:Z,selectedLiveOverlay:q,codexQuota:R,selectedThreadId:F,availableCollaborationModes:z,availableModelIds:de,selectedCollaborationMode:ue,selectedReasoningEffort:we,selectedSpeedMode:ke,installedSkills:me,accountRateLimitSnapshots:Ee,messages:$e,isLoadingThreads:Y,isLoadingMessages:ve,isSendingMessage:Fe,isInterruptingTurn:Ne,isSelectedThreadInterruptPending:Ie,isUpdatingSpeedMode:Te,refreshAll:_e,refreshSkills:He,selectThread:Ke,ensureThreadMessagesLoaded:Ve,setThreadScrollState:Je,setThreadTerminalOpen:mt,toggleSelectedThreadTerminal:Xe,archiveThreadById:kt,forkThreadById:je,renameThreadById:Q,forkThreadFromTurn:pe,sendMessageToSelectedThread:ge,sendMessageToNewThread:Re,interruptSelectedThreadTurn:ze,selectedThreadQueuedMessages:_,removeQueuedMessage:A,steerQueuedMessage:B,setSelectedCollaborationMode:G,readModelIdForThread:ne,setSelectedModelIdForThread:ee,setSelectedReasoningEffort:le,updateSelectedSpeedMode:fe,respondToPendingServerRequest:ce,renameProject:oe,removeProject:Ae,reorderProject:ye,pinProjectToTop:he,startPolling:Oe,stopPolling:P,primeSelectedThread:O,rollbackSelectedThread:N}=a1(),V=Wy(),te=Vy(),{isMobile:be}=rc(),Pe=M(null),at=M(null),ut=M(null),nt=M(!1),Ot=M(!0),Rt=M([]),Fn=M(!1),Bn=M("trending-daily"),Kr=M(null),fr=M(!1);let wr=!1;const sn=M(!1),Ze=M(""),Jn=M("local"),wn=M(""),Jt=M([]),or=M(!1),br=M({order:[],labels:{}}),ft=M({phase:"idle",title:"",message:""}),It=M(Kh()),qt=M(""),sr=M(!1),an=M(null),ar=M(null),Yr=M(null),bn=M(null),Tr=M(null);let Bt=null;const Qn=M("New Project (1)"),Xn=M(""),An=M(!1),pn=M(Jh()),Zn=M(!1),_r=M([]),Tn=M(null),Sr=M(!1),Qt=M(!1),Jr=M(null),Ut=M([]),hn=M(!1),En=M(!1),Un=M(""),mn=M(""),qn=M(""),xt=M(""),er=M(Ya(vf,!0)),tr=M(Oh()),In=M($h()),Xt=M(Dh()),Ct=M(Ya(wf,!1)),vn=M(Ya(bf,!0)),pr=M(zh()),Or=re(()=>Gh()),Hn=M(Ya(_f,!1)),Mn=M(!1),Ht=M(!1),pt=M(""),Pt=M(!1),Dr=M(null),vt=M(!1),_n=M(""),Zt=M("codex"),Vn=M(""),ir=M(""),ln=M("responses"),un=M("responses"),hr=M(""),mr=M(!1),Lr=M(""),nr=M(""),C=M(""),j=M(!1),X=M(!1),De=M(""),Qe=M(""),jt=M(!1),Kt=M(!1),Ft=M(null),At=M(""),Rn=M(""),lr=M([]),en=M(""),y=M(!1),w=M(!1),E=M(!1),W=M(""),Le=M({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),gt=M(null),yt=M(!1),vr=M(!1),tn=M(typeof window<"u"?((Tc=window.visualViewport)==null?void 0:Tc.height)??window.innerHeight:0),gn=M(typeof window<"u"?window.innerHeight:0);let Sn=null,Nr=!1,kr=0;const go=re(()=>{const d=V.params.threadId;return typeof d=="string"?d:""}),nn=re(()=>V.name==="home"),yo=re(()=>V.name==="skills"),Ui=re(()=>{var d;return yo.value?"Skills":nn.value?"New thread":((d=T.value)==null?void 0:d.title)??"Choose a thread"}),qi=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Hi=re(()=>{var m,x;return(((x=(m=T.value)==null?void 0:m.title)==null?void 0:x.trim())??"")||qi}),Do=re(()=>$e.value.filter(d=>{const m=Xh(d.messageType,d.role);return m==="worked"?!0:!(m==="turnActivity.live"||m==="turnError.live"||m==="agentReasoning.live")})),Vi=re(()=>q.value),wo=re(()=>nn.value?"__new-thread__":F.value),Ls=re(()=>ne(wo.value)),Pa=re(()=>{const d=Z.value;return d.length>0?d[d.length-1]:null}),Pn=re(()=>{var d,m;return nn.value?Ze.value.trim():((m=(d=T.value)==null?void 0:d.cwd)==null?void 0:m.trim())??""}),Wi=re(()=>Ot.value&&nn.value&&Pn.value.length>0||Ot.value&&V.name==="thread"&&F.value.length>0),Ns=re(()=>nn.value?nt.value:H.value),zi=re(()=>!be.value||tn.value<=0||gn.value<=0?!1:gn.value-tn.value>120),js=re(()=>{var d;return!nn.value&&((d=T.value)==null?void 0:d.inProgress)===!0}),Gi=re(()=>!nn.value&&!yo.value&&F.value.trim().length>0),Fs=re(()=>Fe.value||Ne.value||js.value||Z.value.length>0);function ns(d){return Number.isFinite(d)?new Intl.NumberFormat("en-US",{notation:d>=1e3?"compact":"standard",maximumFractionDigits:d>=1e5?0:1}).format(Math.max(0,Math.trunc(d))):"0"}function Ki(d){if(!d)return"Waiting for Codex thread/tokenUsage/updated events for this thread.";const m=[`Current context usage: ${d.currentContextTokens.toLocaleString()} tokens`,`Cumulative thread usage: ${d.total.totalTokens.toLocaleString()} tokens`];return typeof d.modelContextWindow=="number"?(m.unshift(`Model context window: ${d.modelContextWindow.toLocaleString()} tokens`),m.push(`Remaining context: ${(d.remainingContextTokens??0).toLocaleString()} tokens`)):m.push("Model context window is unavailable in the latest usage event."),m.join(`
57
- `)}const $a=re(()=>{var m;const d=(m=k.value)==null?void 0:m.remainingContextPercent;return d===null||typeof d!="number"?"pending":d<=10?"danger":d<=25?"warning":"ok"}),Yi=re(()=>{const d=k.value;return d?typeof d.remainingContextTokens=="number"?`${ns(d.remainingContextTokens)} left`:`${ns(d.currentContextTokens)} used`:"Awaiting data"}),Ji=re(()=>{const d=k.value;return d?typeof d.modelContextWindow=="number"?`${ns(d.currentContextTokens)} used / ${ns(d.modelContextWindow)}`:"Window size unavailable":"Updates after the next token usage event"}),Qi=re(()=>Ki(k.value)),Bs=re(()=>{var se,Se;const d=[],m=new Set;for(const xe of br.value.order){const rt=xe.trim();!rt||m.has(rt)||(m.add(rt),d.push({value:rt,label:br.value.labels[rt]||Go(rt)}))}for(const xe of f.value){const rt=((Se=(se=xe.threads[0])==null?void 0:se.cwd)==null?void 0:Se.trim())??"";!rt||m.has(rt)||(m.add(rt),d.push({value:rt,label:g.value[xe.projectName]??xe.projectName}))}const x=Ze.value.trim();return x&&!m.has(x)&&d.unshift({value:x,label:Go(x)}),d}),Us=re(()=>{const d=wn.value.trim(),m=[...Jt.value];return d&&!m.some(x=>x.value===d)&&m.unshift({value:d,label:d}),m}),Oa=re(()=>{const d=wn.value.trim();if(!d)return"";const m=Us.value.find(x=>x.value===d);return(m==null?void 0:m.label)??d}),Xi=re(()=>Tn.value??"__detached_head__"),Zi=re(()=>{var se;const d=[{value:"__review__",label:Zn.value?"Review (Open)":"Review"}],m=new Set,x=((se=Tn.value)==null?void 0:se.trim())??"";x?(d.push({value:x,label:x}),m.add(x)):(d.push({value:"__detached_head__",label:"Detached HEAD"}),m.add("__detached_head__"));for(const Se of _r.value)!Se.value||m.has(Se.value)||(m.add(Se.value),d.push(Se));return d}),Da=re(()=>At.value.trim()),La=re(()=>{const d=De.value.trim();return!d||d==="."||d===".."?!1:!/[\\/]/u.test(d)}),el=re(()=>La.value&&Da.value.trim().length>0&&!en.value),qs=re(()=>jt.value?"Creating…":"Create"),tl=re(()=>{const d=At.value.trim(),m=Rn.value.trim();return!!(d&&m&&d!==m)}),Na=re(()=>{const d=[];tl.value&&d.push({key:`parent:${Rn.value}`,name:"..",path:Rn.value,kind:"parent"});for(const m of lr.value)d.push({key:`directory:${m.path}`,name:m.name,path:m.path,kind:"directory"});return d}),Hs=re(()=>{const d=W.value.trim().toLowerCase();return d?Na.value.filter(m=>m.kind==="parent"||m.name.toLowerCase().includes(d)):Na.value}),bo=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,nl=re(()=>[{value:"search-daily",label:"Search daily"},{value:"search-weekly",label:"Search weekly"},{value:"search-monthly",label:"Search monthly"},{value:"trending-daily",label:"Trending daily"},{value:"trending-weekly",label:"Trending weekly"},{value:"trending-monthly",label:"Trending monthly"}]),rl=re(()=>c[Xt.value].label),ja=re(()=>typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)?"⌘J":"Ctrl+J"),ol=re(()=>{const d=c[Xt.value];return{"--chat-column-max":d.columnMax,"--chat-card-max":d.cardMax,"--visual-viewport-height":tn.value>0?`${tn.value}px`:"100dvh"}}),sl=re(()=>{if(!Le.value.configured)return"Not configured";const d=Le.value.active?"Online":"Configured (offline)",m=Le.value.allowAllUsers?"allow all users":`${Le.value.allowedUsers} allowed user(s)`,x=`${Le.value.mappedChats} chat(s), ${Le.value.mappedThreads} thread(s), ${m}`,se=Le.value.lastError?`, error: ${Le.value.lastError}`:"";return`${d}, ${x}${se}`});Oo(()=>{var d,m;document.addEventListener("pointerdown",Ue),window.addEventListener("keydown",K),document.addEventListener("visibilitychange",ct),window.addEventListener("pageshow",Et),window.addEventListener("focus",Xr),window.addEventListener("resize",Qr),(d=window.visualViewport)==null||d.addEventListener("resize",Qr),(m=window.visualViewport)==null||m.addEventListener("scroll",Qr),Qr(),Ja(),bo==null||bo.addEventListener("change",Ja),Zh(),Ch(),cs(),To(),Ba(),rs(),Al(),Ce(),Hn.value&&kl()}),Oi(()=>{var d,m;document.removeEventListener("pointerdown",Ue),window.removeEventListener("keydown",K),document.removeEventListener("visibilitychange",ct),window.removeEventListener("pageshow",Et),window.removeEventListener("focus",Xr),window.removeEventListener("resize",Qr),(d=window.visualViewport)==null||d.removeEventListener("resize",Qr),(m=window.visualViewport)==null||m.removeEventListener("scroll",Qr),bo==null||bo.removeEventListener("change",Ja),Sn!==null&&(window.clearInterval(Sn),Sn=null),Bt&&(clearTimeout(Bt),Bt=null),P()});function Qr(){var d;typeof window>"u"||(gn.value=window.innerHeight,tn.value=((d=window.visualViewport)==null?void 0:d.height)??window.innerHeight)}it(qt,d=>{const m=d.trim();if(Bt&&(clearTimeout(Bt),Bt=null),!m){Tr.value=null;return}Bt=setTimeout(()=>{wb(m,1e3).then(x=>{qt.value.trim()===m&&(Tr.value=x.threadIds)}).catch(()=>{qt.value.trim()===m&&(Tr.value=null)})},220)}),it(Ut,()=>{if(typeof window>"u")return;if(!Ut.value.some(m=>m.quotaStatus==="loading")){Sn!==null&&(window.clearInterval(Sn),Sn=null);return}Sn===null&&(Sn=window.setInterval(()=>{Nr||(Nr=!0,as({silent:!0}).finally(()=>{Nr=!1}))},1500))},{deep:!0});function Fa(){He()}async function rs(){try{Le.value=await _b()}catch(d){const m=d instanceof Error?d.message:"Failed to load Telegram status";Le.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:m}}}async function Ba(){try{const d=await Tb();Lr.value=d.botToken,nr.value=d.allowedUserIds.map(m=>String(m)).join(`
58
- `),C.value=""}catch(d){C.value=d instanceof Error?d.message:"Failed to load Telegram configuration"}}function Lo(d){const m=d.split(/[\n,]/).map(Se=>Se.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),x=m.includes("*"),se=Array.from(new Set(m.filter(Se=>/^-?\d+$/.test(Se)).map(Se=>Number.parseInt(Se,10))));return x?["*",...se]:se}async function jr(){const d=Lr.value.trim(),m=Lo(nr.value);if(!d){C.value="Telegram bot token is required.";return}if(m.length===0){C.value="At least one allowed Telegram user ID or * is required.";return}j.value=!0,C.value="";try{await bb(d,m),nr.value=m.map(x=>String(x)).join(`
59
- `),await Promise.all([Ba(),rs()]),window.alert("Telegram bot configured. Only allowlisted Telegram users can use the bridge.")}catch(x){C.value=x instanceof Error?x.message:"Failed to connect Telegram bot",rs()}finally{j.value=!1}}function al(){sr.value=!sr.value,sr.value?Gt(()=>{var d;return(d=an.value)==null?void 0:d.focus()}):qt.value=""}function Vs(){var d;qt.value="",(d=an.value)==null||d.focus()}function il(d){d.key==="Escape"&&(sr.value=!1,qt.value="")}function ll(d){d&&(V.name==="thread"&&go.value===d||(te.push({name:"thread",params:{threadId:d}}),be.value&&D(!0)))}async function ul(d){d&&(F.value!==d&&(await Ke(d),await te.push({name:"thread",params:{threadId:d}})),await Gt(),Ih())}function cl(d){return d.length>8?d.slice(-8):d}function Ws(d){const m=[d.planType||"unknown"];return d.authMode&&m.unshift(d.authMode),m.join(" · ")}function dl(d){if(!d)return!1;const m=d.toLowerCase();return m.includes("payment required")||/\b402\b/.test(m)}function No(d){return d.unavailableReason==="payment_required"||dl(d.quotaError)}function Ua(d){return hn.value||En.value||Un.value.length>0||d.isActive&&Un.value!==d.accountId&&Fs.value}function jo(d){return mn.value===d.accountId}function qa(d){return qn.value===d.accountId||jo(d)}function os(d){return No(d)?"Unavailable":d.isActive?"Active":En.value?"Switching…":"Switch"}function Ha(d){return Un.value===d.accountId?"Removing…":jo(d)?"Click again to remove":"Remove"}function fl(d){qn.value=d}function pl(d){qn.value===d&&(qn.value=""),Un.value!==d&&mn.value===d&&(mn.value="")}function ss(d){const m=d.quotaSnapshot;if(!m)return null;const x=[m==null?void 0:m.primary,m==null?void 0:m.secondary].filter(xe=>xe!==null),se=x.find(xe=>xe.windowMinutes===10080);if(se)return se;const Se=x.filter(xe=>typeof xe.windowMinutes=="number"&&xe.windowMinutes>=10080).sort((xe,rt)=>(xe.windowMinutes??0)-(rt.windowMinutes??0))[0]??null;return Se||(m.secondary??null)}function hl(d){if(typeof d!="number"||!Number.isFinite(d))return"";const m=new Date(d*1e3);return`${m.getMonth()+1}月${m.getDate()}日`}function Va(d){var xe,rt;if(No(d))return d.quotaError||"402 Payment Required";const m=d.quotaSnapshot,x=ss(d),se=(m==null?void 0:m.primary)??(m==null?void 0:m.secondary)??null,Se=x??se;if(Se){const $n=Math.max(0,Math.min(100,100-Math.round(Se.usedPercent))),Fr=hl(Se.resetsAt);return Fr?`${$n}% weekly remaining · ${Fr}`:`${$n}% weekly remaining`}return(xe=m==null?void 0:m.credits)!=null&&xe.unlimited?"Unlimited credits":(rt=m==null?void 0:m.credits)!=null&&rt.hasCredits&&m.credits.balance?`${m.credits.balance} credits`:d.quotaStatus==="loading"?"Loading quota…":d.quotaStatus==="error"?d.quotaError||"Quota unavailable":d.quotaStatus==="ready"||d.quotaStatus==="idle"?"Quota unavailable":"Fetching account details…"}function ml(d){return[d.email||"Account",Ws(d),No(d)?"Unavailable account":null,Va(d),`Workspace ${d.accountId}`].filter(Boolean).join(`
60
- `)}async function as(d={}){try{const m=await Kw();Ut.value=m.accounts,m.accounts.some(x=>x.accountId===qn.value)||(qn.value=""),m.accounts.some(x=>x.accountId===mn.value)||(mn.value="")}catch(m){if(d.silent===!0)return;xt.value=m instanceof Error?m.message:"Failed to load accounts"}}async function vl(){if(!(hn.value||En.value)){xt.value="",qn.value="",mn.value="",hn.value=!0;try{const d=await Yw();Ut.value=d.accounts,P(),Oe(),_e({includeSelectedThreadMessages:!0})}catch(d){xt.value=d instanceof Error?d.message:"Failed to refresh accounts"}finally{hn.value=!1}}}async function zs(d){if(!(En.value||hn.value)){if(Fs.value){xt.value="Finish the current turn and pending requests before switching accounts.";return}xt.value="",qn.value="",mn.value="",En.value=!0;try{const m=await Jw(d);Ut.value=Ut.value.map(x=>x.accountId===d?m:{...x,isActive:!1}),P(),Oe(),_e({includeSelectedThreadMessages:!0}),as({silent:!0})}catch(m){xt.value=m instanceof Error?m.message:"Failed to switch account"}finally{En.value=!1}}}async function xr(d){if(hn.value||En.value||Un.value.length>0)return;const m=Ut.value.find(se=>se.accountId===d)??null;if(!m)return;if(mn.value!==d){mn.value=d;return}if(m.isActive&&Fs.value){xt.value="Finish the current turn and pending requests before removing the active account.";return}const x=m.isActive;xt.value="",mn.value="",Un.value=d;try{const se=await Qw(d);Ut.value=se.accounts,P(),Oe(),x&&_e({includeSelectedThreadMessages:!0}),as({silent:!0})}catch(se){xt.value=se instanceof Error?se.message:"Failed to remove account"}finally{Un.value=""}}function gl(d){kt(d)}async function yl(d){const m=await je(d);m&&(nn.value?await te.replace({name:"thread",params:{threadId:m}}):await te.push({name:"thread",params:{threadId:m}}),be.value&&D(!0))}function Gs(d){const m=d.trim().replace(/\\/gu,"/");return m?m.includes("/.codex/worktrees/")||m.includes("/.git/worktrees/"):!1}function is(d,m=""){var xe,rt,$n;const x=f.value.find(Fr=>Fr.projectName===d);if(!x)return m.trim();const se=x.threads.find(Fr=>!Gs(Fr.cwd));return(((xe=se==null?void 0:se.cwd)==null?void 0:xe.trim())??(($n=(rt=x.threads[0])==null?void 0:rt.cwd)==null?void 0:$n.trim())??"")||m.trim()}function wl(d){var se,Se;const m=f.value.find(xe=>xe.projectName===d),x=is(d,((Se=(se=m==null?void 0:m.threads[0])==null?void 0:se.cwd)==null?void 0:Se.trim())??"");x&&(Ze.value=x),be.value&&D(!0),!nn.value&&te.push({name:"home"})}function bl(d){var x;let m="";for(const se of f.value){const Se=se.threads.find(xe=>xe.id===d);if((x=Se==null?void 0:Se.cwd)!=null&&x.trim()){m=Se.cwd.trim();break}}!m||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(m)}`,"_blank","noopener,noreferrer")}function Ks(){var x;const d=T.value,m=d?is(d.projectName,((x=d.cwd)==null?void 0:x.trim())??""):"";m&&(Ze.value=m),be.value&&D(!0),!nn.value&&te.push({name:"home"})}function Tl(d){oe(d.projectName,d.displayName)}function _l(d){Q(d.threadId,d.title)}async function a(d){await Ae(d),await cs(),To()}function u(d){ye(d.projectName,d.toIndex)}function h(d){Je(d.threadId,d.state)}function b(d){I(d)}async function I(d){var se;const m=await ce(d),x=((se=d.followUpMessageText)==null?void 0:se.trim())??"";if(!(!m||!x||nn.value))try{await ge(x,[],[],"steer",[])}catch{}}async function L(d){const m=await pe(d.threadId,d.turnIndex);m&&(await te.push({name:"thread",params:{threadId:m}}),F.value!==m&&await Ke(m),be.value&&D(!0))}function D(d){It.value!==d&&(It.value=d,Yh(d))}function K(d){if(d.defaultPrevented)return;if(d.key==="Escape"&&An.value){An.value=!1;return}if(!d.ctrlKey&&!d.metaKey||d.shiftKey||d.altKey)return;const m=d.key.toLowerCase();if(m==="b"){d.preventDefault(),D(!It.value);return}if(m==="j"&&V.name==="thread"&&F.value){d.preventDefault(),J();return}m==="j"&&nn.value&&Pn.value&&(d.preventDefault(),J())}function J(){if(Ot.value){if(nn.value){if(!Pn.value)return;nt.value=!nt.value;return}Xe()}}async function Ce(){try{const d=await Vw();Ot.value=d.available,d.available||(nt.value=!1,F.value&&mt(F.value,!1))}catch{Ot.value=!1,nt.value=!1}}function Ue(d){var x,se;if(!An.value)return;const m=d.target;m instanceof Node&&((x=Yr.value)!=null&&x.contains(m)||(se=bn.value)!=null&&se.contains(m)||(An.value=!1))}function tt(d){var x,se;if(!An.value)return;const m=d.target;m instanceof Node&&((x=Yr.value)!=null&&x.contains(m)||(se=bn.value)!=null&&se.contains(m)||(An.value=!1))}function ct(){if(!(typeof document>"u")&&be.value){if(document.visibilityState==="hidden"){gt.value=Date.now(),yt.value=!1;return}Zr()}}function Et(d){d.persisted&&Zr()}function Xr(){V.name==="home"&&(cs(),To()),Zr()}function Zr(){typeof window>"u"||typeof document>"u"||!be.value||document.visibilityState!=="visible"||yt.value||gt.value===null||Date.now()-gt.value<vA||(yt.value=!0,gt.value=null,ls())}async function ls(){if(!vr.value){vr.value=!0;try{await _e({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Il()}finally{vr.value=!1}}}function Ys(d){const m=d.text;Js();const x=Kr.value,se=d.mode==="queue"&&x&&x.threadId===F.value?x.queueIndex:void 0;if(Kr.value=null,nn.value){em(m,d.imageUrls,d.skills,d.fileAttachments);return}ge(m,d.imageUrls,d.skills,d.mode,d.fileAttachments,se)}function Fo(d){const m=new Intl.NumberFormat().format(d.stars);return d.language?`${d.language} · ★ ${m}`:`★ ${m}`}function Bo(d){const x=new Set(["search-daily","search-weekly","search-monthly","trending-daily","trending-weekly","trending-monthly"]).has(d)?d:"trending-daily";Bn.value!==x&&(Bn.value=x)}function us(d){const m=Pe.value;m&&m.hydrateDraft({text:`Clone this GitHub project and run it: ${d.url}
61
- Then explain what this project does in very simple words a 5th grader can understand.`,imageUrls:[],fileAttachments:[],skills:[]})}function Wa(d){const m=_.value.findIndex(xe=>xe.id===d),x=m>=0?_.value[m]:void 0,se=at.value;if(!x||!se||se.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Kr.value=F.value?{threadId:F.value,queueIndex:m}:null;const Se={text:x.text,imageUrls:[...x.imageUrls],fileAttachments:x.fileAttachments.map(xe=>({...xe})),skills:x.skills.map(xe=>({...xe}))};se.hydrateDraft(Se),A(d)}function Js(){if(!be.value||nn.value)return;const d=()=>{var m;(m=ut.value)==null||m.jumpToLatest()};d(),Gt(()=>{d(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{d(),window.requestAnimationFrame(d)})})}function za(d){Ze.value=d.trim(),Qe.value=""}function Ga(d){wn.value=d.trim()}async function Qs(d){const m=d.trim();if(!m||V.name!=="thread"){_r.value=[],Tn.value=null;return}Sr.value=!0;try{const x=await pb(m);_r.value=x.options,Tn.value=x.currentBranch}catch{_r.value=[],Tn.value=null}finally{Sr.value=!1}}function Ka(d){if(d==="__review__"){Zn.value=!Zn.value;return}if(d==="__detached_head__"||Qt.value)return;const m=d.trim();if(!m||m===(Tn.value??""))return;const x=Pn.value.trim();x&&(Qt.value=!0,hb(x,m).then(se=>(Tn.value=se||m,Zn.value=!1,Qs(x))).catch(se=>{const Se=se instanceof Error?se.message:"Failed to switch branch";window.alert(Se)}).finally(()=>{Qt.value=!1}))}async function Ge(){const d=await Sl();if(!d)return;await To();const m=Qn.value.trim()||"New Project (1)",x=window.prompt(`Create project in ${d}`,m);if(x===null)return;const se=x.trim();if(!se)return;const Se=fc(dc(d,se));if(Se)try{const xe=await Zl(Se,{createIfMissing:!0,label:""});if(!xe)return;Ze.value=xe,he(Go(xe)),await cs(),await To()}catch(xe){const rt=xe instanceof Error?xe.message:"Failed to create the project.";window.alert(rt)}}async function rr(){const d=Ze.value.trim()||await Sl();d&&(X.value=!1,Kt.value=!0,W.value="",await ds(d),en.value||Gt(()=>{var m;return(m=Ft.value)==null?void 0:m.focus()}))}function ur(){kr+=1,Kt.value=!1,y.value=!1,en.value="",W.value="",Xs()}async function Th(d){!d||y.value||(W.value="",await ds(d))}function _h(){const d=At.value.trim();!Kt.value||!d||ds(d)}function Sh(){const d=At.value.trim();!Kt.value||!d||y.value||ds(d)}async function lc(d=At.value){const m=d.trim();if(m){en.value="",w.value=!0;try{const x=await Zl(m,{createIfMissing:!1,label:""});if(!x){en.value="Failed to open the selected folder.";return}Ze.value=x,he(Go(x)),await cs(),await To(),ur()}catch(x){en.value=x instanceof Error?x.message:"Failed to open the selected folder."}finally{w.value=!1}}}async function kh(){if(Qe.value="",X.value){Xs();return}if(!Kt.value){const d=Ze.value.trim()||await Sl();if(!d||(Kt.value=!0,W.value="",await ds(d),en.value))return}en.value||(De.value=Qn.value,X.value=!0,Gt(()=>{var d;return(d=Jr.value)==null?void 0:d.focus()}))}function Xs(){Qe.value="",De.value="",X.value=!1}async function uc(){const d=De.value.trim();if(!d)return;if(Qe.value="",en.value){Qe.value="Reload the current folder before creating a new one.";return}jt.value=!0;const m=Da.value.trim(),x=fc(dc(m,d));if(!x){Qe.value="Unable to determine where the new folder should be created.",jt.value=!1;return}if(!La.value){Qe.value="Enter a single folder name.",jt.value=!1;return}try{const se=await vb(x);if(!se){Qe.value="Failed to create the folder.";return}Qe.value="",W.value="",await ds(se),Xs()}catch(se){Qe.value=se instanceof Error?se.message:"Failed to create folder."}finally{jt.value=!1}}async function xh(){var m;if(typeof window>"u")return!1;const d=((m=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:m.trim())??"";if(!d)return!1;try{const x=await Zl(d,{createIfMissing:!1,label:""});if(!x)return!1;Ze.value=x,he(Go(x)),await te.replace({name:"home"}),await cs();const se=new URL(window.location.href);return se.searchParams.delete("openProjectPath"),window.history.replaceState({},"",se.toString()),!0}catch{return!1}}async function Sl(){const d=cc();if(d)return d;try{const m=await Yd();if(m)return Xn.value=m,m}catch{}return""}async function To(){const d=cc();if(!d){Qn.value="New Project (1)";return}try{const m=await gb(d);Qn.value=m.name||"New Project (1)"}catch{Qn.value="New Project (1)"}}function cc(){var x,se;const d=Ze.value.trim();if(d)return zl(d);const m=((se=(x=Bs.value[0])==null?void 0:x.value)==null?void 0:se.trim())??"";return m?zl(m):Xn.value.trim()}async function Ch(){try{Xn.value=await Yd()}catch{Xn.value=""}}async function cs(){try{const d=await ys();br.value={order:[...d.order],labels:{...d.labels}}}catch{br.value={order:[],labels:{}}}}async function ds(d){const m=++kr;At.value=Yt(d).trim(),en.value="",y.value=!0;try{const x=await mb(d,{showHidden:E.value});if(m!==kr)return;At.value=x.path,Rn.value=x.parentPath,lr.value=x.entries}catch(x){if(m!==kr)return;en.value=x instanceof Error?x.message:"Failed to load local folders.",Rn.value=zl(At.value),lr.value=[],Xs()}finally{m===kr&&(y.value=!1)}}async function kl(){Fn.value=!0;try{Rt.value=await kb(Bn.value,6)}catch{Rt.value=[]}finally{Fn.value=!1}}function dc(d,m){const x=Yt(d).trim(),se=Yt(m).trim().replace(/^[\\/]+/u,"");if(!x||!se)return"";const Se=x.includes("\\")&&!x.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(x))return`${x.slice(0,2)}${Se}${se}`;if(/^\/+$/u.test(x))return`/${se}`;const xe=x.replace(/[\\/]+$/u,"");return xe?`${xe}${Se}${se}`:""}function fc(d){const m=Yt(d).trim();if(!m)return"";const x=m.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(x){const[,Se,xe,rt=""]=x,$n=xl(rt.split(/[\\/]+/u));return $n.length>0?`\\\\${Se}\\${xe}\\${$n.join("\\")}`:`\\\\${Se}\\${xe}`}const se=m.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(se){const[,Se,xe=""]=se,rt=m.includes("\\")&&!m.includes("/")?"\\":"/",$n=xl(xe.split(/[\\/]+/u));return $n.length>0?`${Se}${rt}${$n.join(rt)}`:`${Se}${rt}`}if(m.startsWith("/")){const Se=xl(m.split("/"));return Se.length>0?`/${Se.join("/")}`:"/"}return m}function xl(d){const m=[];for(const x of d){const se=x.trim();if(!(!se||se===".")){if(se===".."){m.length>0&&m.pop();continue}m.push(se)}}return m}function pc(d){ee(wo.value,d)}function hc(d){le(d)}function mc(d){fe(d)}function Ah(){ze()}function Eh(d){const m=d.turnId.trim();if(m.length>0){const x=[...Do.value].reverse().find(se=>{var Se;return se.role==="user"&&(((Se=se.turnId)==null?void 0:Se.trim())??"")===m&&se.text.trim().length>0});x!=null&&x.text&&at.value&&at.value.appendTextToDraft(x.text)}N(d.turnId)}function Ih(){if(nn.value||yo.value||typeof document>"u"||!T.value||Do.value.length===0)return;const d=Mh(),m=Rh(),x=new Blob([d],{type:"text/markdown;charset=utf-8"}),se=URL.createObjectURL(x),Se=document.createElement("a");Se.href=se,Se.download=m,document.body.appendChild(Se),Se.click(),document.body.removeChild(Se),window.setTimeout(()=>URL.revokeObjectURL(se),0)}function Mh(){var x,se,Se;const d=[],m=((se=(x=T.value)==null?void 0:x.title)==null?void 0:se.trim())||"Untitled thread";d.push(`# ${Ph(m)}`),d.push(""),d.push(`- Exported: ${new Date().toISOString()}`),d.push(`- Thread ID: ${((Se=T.value)==null?void 0:Se.id)??""}`),d.push(""),d.push("---"),d.push("");for(const xe of Do.value){const rt=xe.role?xe.role.toUpperCase():"MESSAGE";d.push(`## ${rt}`),d.push("");const $n=xe.text.trim();if($n&&(d.push($n),d.push("")),xe.commandExecution&&(d.push("```text"),d.push(`command: ${xe.commandExecution.command}`),d.push(`status: ${xe.commandExecution.status}`),xe.commandExecution.cwd&&d.push(`cwd: ${xe.commandExecution.cwd}`),xe.commandExecution.exitCode!==null&&d.push(`exitCode: ${xe.commandExecution.exitCode}`),d.push(xe.commandExecution.aggregatedOutput||"(no output)"),d.push("```"),d.push("")),xe.fileAttachments&&xe.fileAttachments.length>0){d.push("Attachments:");for(const Fr of xe.fileAttachments)d.push(`- ${Fr.path}`);d.push("")}if(xe.images&&xe.images.length>0){d.push("Images:");for(const Fr of xe.images)d.push(`- ${Fr}`);d.push("")}}return`${d.join(`
62
- `).trimEnd()}
63
- `}function Rh(){var Se,xe;const x=(((xe=(Se=T.value)==null?void 0:Se.title)==null?void 0:xe.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",se=new Date().toISOString().replace(/[:.]/g,"-");return`${x}-${se}.md`}function Ph(d){return d.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Ya(d,m){if(typeof window>"u")return m;const x=window.localStorage.getItem(d);return x===null?m:x==="1"}function $h(){if(typeof window>"u")return"system";const d=window.localStorage.getItem(yf);return d==="light"||d==="dark"?d:"system"}function Oh(){return typeof window>"u"?"steer":window.localStorage.getItem(gf)==="queue"?"queue":"steer"}function Dh(){if(typeof window>"u")return"standard";const d=window.localStorage.getItem(Sf);return d==="standard"||d==="wide"||d==="extra-wide"?d:"standard"}function Lh(){er.value=!er.value,window.localStorage.setItem(vf,er.value?"1":"0")}function Nh(){tr.value=tr.value==="steer"?"queue":"steer",window.localStorage.setItem(gf,tr.value)}function jh(){const d=["system","light","dark"],m=d.indexOf(In.value);In.value=d[(m+1)%d.length],window.localStorage.setItem(yf,In.value),Ja()}function Fh(){const d=["standard","wide","extra-wide"],m=d.indexOf(Xt.value);Xt.value=d[(m+1)%d.length],window.localStorage.setItem(Sf,Xt.value)}function Bh(){Ct.value=!Ct.value,window.localStorage.setItem(wf,Ct.value?"1":"0")}function Uh(){vn.value=!vn.value,window.localStorage.setItem(bf,vn.value?"1":"0")}function qh(){Hn.value=!Hn.value,window.localStorage.setItem(_f,Hn.value?"1":"0")}async function Hh(d){if(!Ht.value){Ht.value=!0;try{if(d==="codex"){Zt.value="codex";const m=await Gd(!1);Mn.value=m.enabled}else if(d==="openrouter"){Zt.value="openrouter";const m=await Gd(!0);Mn.value=m.enabled,await ps("","",{wireApi:un.value,provider:"openrouter"})}else d==="opencode-zen"?(Zt.value="opencode-zen",await ps("",hr.value.trim(),{wireApi:"chat",provider:"opencode-zen"}),Mn.value=!0):d==="custom"&&(Zt.value="custom",Vn.value.trim()&&ir.value.trim()&&(await ps(Vn.value.trim(),ir.value.trim(),{wireApi:ln.value}),Mn.value=!0));_n.value="",await _e({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0}),V.name==="thread"&&te.push({name:"home"})}catch(m){_n.value=m instanceof Error?m.message:"Failed to switch provider"}finally{Ht.value=!1}}}async function Cl(){if(vt.value)return;const d=Vn.value.trim();if(d){vt.value=!0;try{_n.value="",await ps(d,ir.value.trim(),{wireApi:ln.value}),Mn.value=!0,await _e({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(m){_n.value=m instanceof Error?m.message:"Failed to save custom endpoint"}finally{vt.value=!1}}}async function vc(d){if(vt.value||Ht.value||un.value===d)return;const m=un.value;un.value=d,vt.value=!0;try{_n.value="",await ps("","",{wireApi:d,provider:"openrouter"}),Mn.value=!0,await _e({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(x){un.value=m,_n.value=x instanceof Error?x.message:"Failed to save OpenRouter API format"}finally{vt.value=!1}}async function gc(){if(vt.value)return;const d=hr.value.trim();if(d){vt.value=!0;try{_n.value="",await ps("",d,{wireApi:"chat",provider:"opencode-zen"}),Mn.value=!0,await _e({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(m){_n.value=m instanceof Error?m.message:"Failed to save OpenCode Zen config"}finally{vt.value=!1}}}async function yc(){if(!vt.value){vt.value=!0;try{const d=pt.value.trim();await Kd(d),pt.value="",await Al(),await _e({includeSelectedThreadMessages:!1})}catch{}finally{vt.value=!1}}}async function Vh(){if(!vt.value){vt.value=!0;try{await Kd(""),pt.value="",await Al(),await _e({includeSelectedThreadMessages:!1})}catch{}finally{vt.value=!1}}}async function Al(){try{const d=await ib();Mn.value=d.enabled,Pt.value=d.customKey??!1,Dr.value=d.maskedKey??null,d.enabled?d.provider==="opencode-zen"?Zt.value="opencode-zen":d.provider==="custom"?(Zt.value="custom",Vn.value=d.customBaseUrl??"",ln.value=d.wireApi==="chat"?"chat":"responses"):(Zt.value="openrouter",un.value=d.wireApi==="chat"?"chat":"responses"):Zt.value="codex"}catch{}}function Wh(d){const x=El(d.trim())||"auto";pr.value=x,window.localStorage.setItem(Tf,x)}function zh(){var x;if(typeof window>"u")return"auto";const d=((x=window.localStorage.getItem(Tf))==null?void 0:x.trim())||"auto";return El(d)||"auto"}function Gh(){const d=[{value:"auto",label:"Auto-detect"}],m=new Set(["auto"]);function x(Se){const xe=p[Se]||Se;return`${xe.charAt(0).toUpperCase()+xe.slice(1)} (${Se})`}for(const Se of typeof navigator<"u"?navigator.languages??[]:[]){const xe=El(Se);!xe||m.has(xe)||(m.add(xe),d.push({value:xe,label:`Preferred: ${x(xe)}`}))}for(const Se of Object.keys(p))m.has(Se)||(m.add(Se),d.push({value:Se,label:x(Se)}));const se=pr.value.trim();return se&&!m.has(se)&&d.push({value:se,label:x(se)}),d}function El(d){const m=d.trim().toLowerCase();if(!m||m==="auto")return"";if(m in p)return m;const x=m.split("-")[0]??m;return x in p?x:""}function Ja(){const d=document.documentElement;if(In.value==="dark")d.classList.add("dark");else if(In.value==="light")d.classList.remove("dark");else{const m=window.matchMedia("(prefers-color-scheme: dark)").matches;d.classList.toggle("dark",m)}}function Kh(){return typeof window>"u"?!1:window.localStorage.getItem(hf)==="1"}function Yh(d){typeof window>"u"||window.localStorage.setItem(hf,d?"1":"0")}function Jh(){if(typeof window>"u")return!0;const d=window.localStorage.getItem(mf);return d===null?!0:d==="1"}function Qh(){pn.value=!pn.value,!(typeof window>"u")&&window.localStorage.setItem(mf,pn.value?"1":"0")}function Xh(d,m){const x=(d??"").trim();return x.length>0?x:m.trim()||"message"}function wc(d){G(d)}async function Zh(){await te.isReady(),V.name==="thread"&&go.value&&O(go.value),await _e({includeSelectedThreadMessages:V.name==="thread"}),as({silent:!0}),await xh(),sn.value=!0,await Il(),Oe()}async function Il(){if(fr.value){wr=!0;return}fr.value=!0;try{do{if(wr=!1,V.name==="home"||V.name==="skills"){F.value!==""&&await Ke("");continue}if(V.name==="thread"){const d=go.value;if(!d)continue;F.value!==d?await Ke(d):Ve(d,{silent:!0})}}while(wr)}finally{fr.value=!1}}it(()=>[V.name,go.value,Y.value,F.value],async()=>{sn.value&&await Il()}),it(()=>F.value,async d=>{if(sn.value&&!fr.value&&!(nn.value||yo.value)){if(!d){V.name!=="home"&&await te.replace({name:"home"});return}V.name==="thread"&&go.value===d||await te.replace({name:"thread",params:{threadId:d}})}}),it(()=>Bn.value,()=>{Hn.value&&kl()}),it(()=>Hn.value,d=>{if(!d){Rt.value=[];return}kl()}),it(()=>[sn.value,V.name,F.value],([d,m,x])=>{d&&m==="thread"&&x&&Ve(x,{silent:!0})}),it(()=>Bs.value,d=>{if(d.length===0){Ze.value="";return}d.some(x=>x.value===Ze.value)||(Ze.value=d[0].value),To()},{immediate:!0}),it(()=>Ze.value,()=>{ft.value={phase:"idle",title:"",message:""},To()}),it(()=>[Jn.value,Ze.value],([d,m])=>{d==="worktree"&&bc(m)},{immediate:!0}),it(()=>Jn.value,d=>{var m;if(d==="local"){ft.value={phase:"idle",title:"",message:""};const x=Ze.value.trim();if(x&&Gs(x)){const se=((m=T.value)==null?void 0:m.projectName)??Go(x),Se=is(se,"");Se&&(Ze.value=Se)}return}bc(Ze.value)}),it(()=>V.name,d=>{d!=="home"&&(ft.value={phase:"idle",title:"",message:""}),d!=="thread"&&(Zn.value=!1)}),it(()=>F.value,()=>{ft.value={phase:"idle",title:"",message:""}}),it(()=>[V.name,Pn.value],([d,m])=>{if(d!=="thread"){_r.value=[],Tn.value=null;return}Qs(m)},{immediate:!0}),it(Hi,d=>{typeof document>"u"||(document.title=d)},{immediate:!0}),it(be,d=>{d&&!It.value&&D(!0)},{immediate:!0});async function em(d,m=[],x=[],se=[]){try{ft.value={phase:"idle",title:"",message:""};let Se=Ze.value;if(Jn.value==="worktree"){ft.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const rt=await db(Ze.value,wn.value);Se=rt.cwd,Ze.value=rt.cwd,ft.value={phase:"idle",title:"",message:""}}catch{ft.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const xe=await Re(d,Se,m,x,se);if(!xe)return;await te.replace({name:"thread",params:{threadId:xe}}),Js()}catch{}}async function bc(d){var x;const m=d.trim();if(!m){Jt.value=[],wn.value="";return}or.value=!0;try{const se=await fb(m);Jt.value=se;const Se=wn.value.trim();if(!(Se.length>0&&se.some(rt=>rt.value===Se))){const rt=se.find($n=>$n.value.trim()==="main");wn.value=(rt==null?void 0:rt.value)??((x=se[0])==null?void 0:x.value)??""}}catch{Jt.value=[],wn.value=""}finally{or.value=!1}}return(d,m)=>(S(),st(Qy,{"is-sidebar-collapsed":It.value,onCloseSidebar:m[26]||(m[26]=x=>D(!0))},{sidebar:bt(()=>[v("section",i1,[v("div",l1,[It.value?ie("",!0):(S(),st(rf,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":It.value,"show-new-thread-button":!0,onToggleSidebar:m[0]||(m[0]=x=>D(!It.value)),onStartNewThread:Ks},{default:bt(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":sr.value,"aria-label":"Search threads",title:"Search threads",onClick:al},[Be(of,{class:"sidebar-search-toggle-icon"})],8,u1)]),_:1},8,["is-sidebar-collapsed"])),!It.value&&sr.value?(S(),$("div",c1,[Be(of,{class:"sidebar-search-bar-icon"}),rn(v("input",{ref_key:"sidebarSearchInputRef",ref:an,"onUpdate:modelValue":m[1]||(m[1]=x=>qt.value=x),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:il},null,544),[[yn,qt.value]]),qt.value.length>0?(S(),$("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Vs},[Be(Sx,{class:"sidebar-search-clear-icon"})])):ie("",!0)])):ie("",!0),It.value?ie("",!0):(S(),$("button",{key:2,class:ot(["sidebar-skills-link",{"is-active":yo.value}]),type:"button",onClick:m[2]||(m[2]=x=>{Me(te).push({name:"skills"}),Me(be)&&D(!0)})}," Skills Hub ",2)),It.value?ie("",!0):(S(),st(NT,{key:3,groups:Me(f),"project-display-name-by-id":Me(g),"selected-thread-id":Me(F),"is-loading":Me(Y),"search-query":qt.value,"search-matched-thread-ids":Tr.value,onSelect:ll,onArchive:gl,onStartNewThread:wl,onRenameProject:Tl,onBrowseThreadFiles:bl,onRenameThread:_l,onForkThread:yl,onRemoveProject:a,onReorderProject:u,onExportThread:ul},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),It.value?ie("",!0):(S(),$("div",{key:0,ref_key:"settingsAreaRef",ref:ar,class:"sidebar-settings-area",onClick:tt},[Be(Lp,{name:"settings-panel"},{default:bt(()=>[An.value?(S(),$("div",{key:0,ref_key:"settingsPanelRef",ref:Yr,class:"sidebar-settings-panel",onClick:m[15]||(m[15]=lt(()=>{},["stop"]))},[v("div",d1,[v("div",f1,[v("div",p1,[v("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!pn.value,title:pn.value?"Expand accounts":"Collapse accounts",onClick:Qh},[v("span",m1,ae(pn.value?"▸":"▾"),1)],8,h1),m[27]||(m[27]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",v1,ae(Ut.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:hn.value||En.value,onClick:vl},ae(hn.value?"Reloading…":"Reload"),9,g1)]),pn.value?ie("",!0):(S(),$(qe,{key:0},[xt.value?(S(),$("p",y1,ae(xt.value),1)):ie("",!0),Ut.value.length===0?(S(),$("p",w1," Run `codex login`, then click reload. ")):(S(),$("div",b1,[(S(!0),$(qe,null,Dt(Ut.value,x=>(S(),$("article",{key:x.accountId,class:ot(["sidebar-settings-account-item",{"is-active":x.isActive,"is-unavailable":No(x),"is-confirming-remove":jo(x),"is-remove-visible":qa(x)}]),title:ml(x),onMouseenter:se=>fl(x.accountId),onMouseleave:se=>pl(x.accountId)},[v("div",_1,[v("p",S1,ae(x.email||"Account"),1),v("p",k1,ae(Ws(x)),1),v("p",x1,ae(Va(x)),1),v("p",C1," Workspace "+ae(cl(x.accountId)),1)]),v("div",A1,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:Ua(x)||x.isActive||No(x),onClick:se=>zs(x.accountId)},ae(os(x)),9,E1),v("button",{class:ot(["sidebar-settings-account-remove",{"is-visible":qa(x),"is-confirming":jo(x)}]),type:"button",disabled:Ua(x),onClick:se=>xr(x.accountId)},ae(Ha(x)),11,I1)])],42,T1))),128))]))],64))]),v("button",{class:"sidebar-settings-row",type:"button",title:l.sendWithEnter,onClick:Lh},[m[28]||(m[28]=v("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),v("span",{class:ot(["sidebar-settings-toggle",{"is-on":!er.value}])},null,2)],8,M1),v("button",{class:"sidebar-settings-row",type:"button",title:l.inProgressSendMode,onClick:Nh},[m[29]||(m[29]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",P1,ae(tr.value==="steer"?"Steer":"Queue"),1)],8,R1),v("button",{class:"sidebar-settings-row",type:"button",title:l.appearance,onClick:jh},[m[30]||(m[30]=v("span",{class:"sidebar-settings-label"},"Appearance",-1)),v("span",O1,ae(In.value==="system"?"System":In.value==="dark"?"Dark":"Light"),1)],8,$1),v("button",{class:"sidebar-settings-row",type:"button",title:l.chatWidth,onClick:Fh},[m[31]||(m[31]=v("span",{class:"sidebar-settings-label"},"Chat width",-1)),v("span",L1,ae(rl.value),1)],8,D1),v("button",{class:"sidebar-settings-row",type:"button",title:l.dictationClickToToggle,onClick:Bh},[m[32]||(m[32]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:ot(["sidebar-settings-toggle",{"is-on":Ct.value}])},null,2)],8,N1),v("button",{class:"sidebar-settings-row",type:"button",title:l.dictationAutoSend,onClick:Uh},[m[33]||(m[33]=v("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),v("span",{class:ot(["sidebar-settings-toggle",{"is-on":vn.value}])},null,2)],8,j1),v("button",{class:"sidebar-settings-row",type:"button",title:l.githubTrendingProjects,onClick:qh},[m[34]||(m[34]=v("span",{class:"sidebar-settings-label"},"GitHub trending projects",-1)),v("span",{class:ot(["sidebar-settings-toggle",{"is-on":Hn.value}])},null,2)],8,F1),v("div",B1,[m[36]||(m[36]=v("span",{class:"sidebar-settings-label"},"Provider",-1)),v("select",{class:"sidebar-settings-provider-select",value:Zt.value,disabled:Ht.value,onChange:m[3]||(m[3]=x=>Hh(x.target.value))},[...m[35]||(m[35]=[v("option",{value:"codex"},"Codex",-1),v("option",{value:"openrouter"},"OpenRouter",-1),v("option",{value:"opencode-zen"},"OpenCode Zen",-1),v("option",{value:"custom"},"Custom endpoint",-1)])],40,U1)]),_n.value?(S(),$("div",q1,ae(_n.value),1)):ie("",!0),Zt.value==="openrouter"?(S(),$("div",H1,[m[38]||(m[38]=v("div",{class:"sidebar-settings-provider-info"},[v("span",{class:"sidebar-settings-label"},"OpenRouter API key"),v("a",{class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},"Get API key")],-1)),v("div",V1,[Pt.value&&!pt.value?(S(),$(qe,{key:0},[v("span",W1,ae(Dr.value),1),v("button",{class:"sidebar-settings-key-clear",type:"button",disabled:vt.value,title:"Remove custom key, use community keys",onClick:Vh},"✕",8,z1)],64)):(S(),$(qe,{key:1},[rn(v("input",{"onUpdate:modelValue":m[4]||(m[4]=x=>pt.value=x),class:"sidebar-settings-key-input",type:"password",placeholder:"sk-or-v1-... (optional, uses free keys if empty)",onKeydown:zt(yc,["enter"])},null,544),[[yn,pt.value]]),v("button",{class:"sidebar-settings-key-save",type:"button",disabled:vt.value||!pt.value.trim(),onClick:yc},ae(vt.value?"...":"Set"),9,G1)],64))]),v("div",K1,[m[37]||(m[37]=v("span",{class:"sidebar-settings-label"},"API format",-1)),v("div",Y1,[v("button",{type:"button",class:ot(["sidebar-settings-segmented-option",{"is-active":un.value==="responses"}]),disabled:vt.value||Ht.value,onClick:m[5]||(m[5]=x=>vc("responses"))}," Responses ",10,J1),v("button",{type:"button",class:ot(["sidebar-settings-segmented-option",{"is-active":un.value==="chat"}]),disabled:vt.value||Ht.value,onClick:m[6]||(m[6]=x=>vc("chat"))}," Completions ",10,Q1)])])])):ie("",!0),Zt.value==="opencode-zen"?(S(),$("div",X1,[m[39]||(m[39]=v("div",{class:"sidebar-settings-provider-info"},[v("span",{class:"sidebar-settings-label"},"OpenCode Zen API key"),v("a",{class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},"Get API key")],-1)),v("div",Z1,[rn(v("input",{"onUpdate:modelValue":m[7]||(m[7]=x=>hr.value=x),class:"sidebar-settings-key-input",type:"password",placeholder:"sk-...",onKeydown:zt(gc,["enter"])},null,544),[[yn,hr.value]]),v("button",{class:"sidebar-settings-key-save",type:"button",disabled:vt.value||!hr.value.trim(),onClick:gc},ae(vt.value?"...":"Save"),9,eC)])])):ie("",!0),Zt.value==="custom"?(S(),$("div",tC,[m[41]||(m[41]=v("span",{class:"sidebar-settings-label"},"Custom endpoint URL",-1)),v("div",nC,[rn(v("input",{"onUpdate:modelValue":m[8]||(m[8]=x=>Vn.value=x),class:"sidebar-settings-key-input",type:"url",placeholder:"https://api.example.com/v1",onKeydown:zt(Cl,["enter"])},null,544),[[yn,Vn.value]])]),m[42]||(m[42]=v("span",{class:"sidebar-settings-label",style:{"margin-top":"4px"}},"API key",-1)),v("div",rC,[rn(v("input",{"onUpdate:modelValue":m[9]||(m[9]=x=>ir.value=x),class:"sidebar-settings-key-input",type:"password",placeholder:"Bearer token (optional)",onKeydown:zt(Cl,["enter"])},null,544),[[yn,ir.value]]),v("button",{class:"sidebar-settings-key-save",type:"button",disabled:vt.value||!Vn.value.trim(),onClick:Cl},ae(vt.value?"...":"Save"),9,oC)]),v("div",sC,[m[40]||(m[40]=v("span",{class:"sidebar-settings-label"},"API format",-1)),v("div",aC,[v("button",{type:"button",class:ot(["sidebar-settings-segmented-option",{"is-active":ln.value==="responses"}]),onClick:m[10]||(m[10]=x=>ln.value="responses")}," Responses ",2),v("button",{type:"button",class:ot(["sidebar-settings-segmented-option",{"is-active":ln.value==="chat"}]),onClick:m[11]||(m[11]=x=>ln.value="chat")}," Completions ",2)])])])):ie("",!0),v("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:l.dictationLanguage},[m[43]||(m[43]=v("span",{class:"sidebar-settings-label"},"Dictation language",-1)),Be(Jo,{class:"sidebar-settings-language-dropdown","model-value":pr.value,options:Or.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":Wh},null,8,["model-value","options"])],8,iC),v("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:m[12]||(m[12]=x=>mr.value=!mr.value)},[m[44]||(m[44]=v("span",{class:"sidebar-settings-label"},"Telegram",-1)),v("span",lC,ae(sl.value),1)]),mr.value?(S(),$("div",uC,[v("label",cC,[m[45]||(m[45]=v("span",{class:"sidebar-settings-field-label"},"Bot token",-1)),rn(v("input",{"onUpdate:modelValue":m[13]||(m[13]=x=>Lr.value=x),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[yn,Lr.value]])]),v("label",dC,[m[46]||(m[46]=v("span",{class:"sidebar-settings-field-label"},"Allowed Telegram user IDs",-1)),rn(v("textarea",{"onUpdate:modelValue":m[14]||(m[14]=x=>nr.value=x),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
64
- 987654321`,spellcheck:"false"},null,512),[[yn,nr.value]])]),m[47]||(m[47]=v("div",{class:"sidebar-settings-field-help"}," Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here. ",-1)),C.value?(S(),$("div",fC,ae(C.value),1)):ie("",!0),v("div",pC,[v("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:j.value,onClick:jr},ae(j.value?"Saving…":"Save Telegram config"),9,hC)])])):ie("",!0),Gi.value?(S(),$("div",{key:5,class:"sidebar-settings-row sidebar-settings-context-row","data-state":$a.value,title:Qi.value},[m[48]||(m[48]=v("span",{class:"sidebar-settings-label"},"Context",-1)),v("span",{class:"sidebar-settings-context-value","data-state":$a.value},[lo(ae(Yi.value)+" ",1),v("span",gC,ae(Ji.value),1)],8,vC)],8,mC)):ie("",!0),v("div",yC,[Be(zk,{snapshots:Me(Ee)},null,8,["snapshots"])]),v("div",wC," WT "+ae(Me(s))+" · v"+ae(Me(i)),1)],512)):ie("",!0)]),_:1}),v("button",{ref_key:"settingsButtonRef",ref:bn,class:"sidebar-settings-button",type:"button",onClick:m[16]||(m[16]=lt(x=>An.value=!An.value,["stop"]))},[Be(mx,{class:"sidebar-settings-icon"}),m[49]||(m[49]=v("span",null,"Settings",-1)),v("span",bC,ae(Me(s))+" · v"+ae(Me(i)),1)],512)],512))])]),content:bt(()=>[v("section",{class:"content-root",style:io(ol.value)},[zi.value?(S(),$("span",TC)):ie("",!0),Be(HT,{title:Ui.value},{leading:bt(()=>[It.value||Me(be)?(S(),st(rf,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":It.value,"show-new-thread-button":!0,onToggleSidebar:m[17]||(m[17]=x=>D(!It.value)),onStartNewThread:Ks},null,8,["is-sidebar-collapsed"])):ie("",!0)]),actions:bt(()=>[Wi.value?(S(),$("button",{key:0,class:"content-header-terminal-toggle",type:"button","aria-pressed":Ns.value,title:`Toggle terminal (${ja.value})`,"aria-label":"Toggle terminal",onClick:J},[Be(wx,{class:"content-header-terminal-toggle-icon"}),v("span",SC,ae(ja.value),1)],8,_C)):ie("",!0),Me(V).name==="thread"&&Me(F)?(S(),st(Jo,{key:1,class:ot(["content-header-branch-dropdown",{"is-review-open":Zn.value}]),"model-value":Xi.value,options:Zi.value,disabled:Sr.value||Qt.value,"enable-search":!0,"search-placeholder":"Search branches...","onUpdate:modelValue":Ka},null,8,["class","model-value","options","disabled"])):ie("",!0)]),_:1},8,["title"]),v("section",kC,[yo.value?(S(),st(Me(o),{key:0,onSkillsChanged:Fa})):nn.value?(S(),$("div",xC,[v("div",CC,[m[56]||(m[56]=v("p",{class:"new-thread-hero"},"Let's build",-1)),Be(Jo,{class:"new-thread-folder-dropdown","model-value":Ze.value,options:Bs.value,placeholder:"Choose folder","enable-search":!0,"search-placeholder":"Quick search project",disabled:!1,"onUpdate:modelValue":za},null,8,["model-value","options"]),Ze.value?(S(),$("p",{key:0,class:"new-thread-folder-selected",title:Ze.value}," Selected folder: "+ae(Ze.value),9,AC)):ie("",!0),v("div",{class:"new-thread-folder-actions"},[v("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:rr}," Select folder "),v("button",{class:"new-thread-folder-action",type:"button",onClick:Ge}," Create Project ")]),(S(),st(bs,{to:"body"},[Kt.value?(S(),$("div",{key:0,class:"new-thread-open-folder-overlay",onClick:lt(ur,["self"])},[v("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":"Select folder",onKeydown:zt(lt(ur,["prevent"]),["esc"])},[v("div",{class:"new-thread-open-folder-header"},[m[50]||(m[50]=v("p",{class:"new-thread-open-folder-title"},"Select folder",-1)),v("button",{class:"new-thread-open-folder-close",type:"button",onClick:ur}," Cancel ")]),m[52]||(m[52]=v("p",{class:"new-thread-open-folder-label"},"Current folder",-1)),v("div",IC,[v("p",{class:"new-thread-open-folder-path",title:At.value||"Unavailable"},ae(At.value||"Unavailable"),9,MC),v("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!At.value||!!en.value||y.value||w.value,onClick:m[18]||(m[18]=x=>lc())},ae(w.value?"Opening…":"Open"),9,RC)]),v("div",PC,[v("label",$C,[rn(v("input",{"onUpdate:modelValue":m[19]||(m[19]=x=>E.value=x),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:_h},null,544),[[xg,E.value]]),m[51]||(m[51]=v("span",null,"Show hidden folders",-1))]),v("button",{class:ot(["new-thread-folder-action",{"new-thread-folder-action-primary":X.value}]),type:"button","aria-pressed":X.value,disabled:!At.value||y.value||w.value||jt.value||!!en.value&&!X.value,onClick:kh}," New folder ",10,OC)]),X.value?(S(),$("div",DC,[v("div",LC,[rn(v("input",{ref_key:"createFolderInputRef",ref:Jr,"onUpdate:modelValue":m[20]||(m[20]=x=>De.value=x),class:"new-thread-open-folder-create-input",type:"text",placeholder:"Folder name",onKeydown:[zt(lt(uc,["prevent"]),["enter"]),zt(lt(Xs,["prevent"]),["esc"])]},null,40,NC),[[yn,De.value]]),v("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!el.value||jt.value,onClick:uc},ae(qs.value),9,jC)]),Qe.value?(S(),$("p",FC,ae(Qe.value),1)):ie("",!0)])):ie("",!0),rn(v("input",{ref_key:"existingFolderFilterInputRef",ref:Ft,"onUpdate:modelValue":m[21]||(m[21]=x=>W.value=x),class:"new-thread-open-folder-filter",type:"text",placeholder:"Filter folders...",onKeydown:zt(lt(ur,["prevent"]),["esc"])},null,40,BC),[[yn,W.value]]),en.value?(S(),$("div",UC,[v("p",qC,ae(en.value),1),v("button",{class:"new-thread-folder-action",type:"button",disabled:y.value||w.value,onClick:Sh}," Retry ",8,HC)])):ie("",!0),y.value?(S(),$("p",VC,"Loading folders…")):!en.value&&Hs.value.length===0?(S(),$("p",WC,ae(W.value.trim()?"No folders match this filter.":"No subfolders found here."),1)):Hs.value.length>0?(S(),$("ul",zC,[(S(!0),$(qe,null,Dt(Hs.value,x=>(S(),$("li",{key:x.key,class:"new-thread-open-folder-item"},[v("button",{class:"new-thread-open-folder-item-main",type:"button",title:x.path,disabled:y.value||w.value,onClick:se=>Th(x.path)},[v("span",KC,ae(x.name),1)],8,GC),x.kind==="directory"?(S(),$("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:y.value||w.value,onClick:se=>lc(x.path)}," Open ",8,YC)):ie("",!0)]))),128))])):ie("",!0)],40,EC)])):ie("",!0)])),Be(Qk,{class:"new-thread-runtime-dropdown",modelValue:Jn.value,"onUpdate:modelValue":m[22]||(m[22]=x=>Jn.value=x)},null,8,["modelValue"]),Jn.value==="worktree"?(S(),$("div",JC,[m[53]||(m[53]=v("p",{class:"new-thread-branch-select-label"},"Base branch",-1)),Be(Jo,{class:"new-thread-branch-dropdown","model-value":wn.value,options:Us.value,placeholder:"Select branch","enable-search":!0,"search-placeholder":"Search branches...",disabled:or.value||Us.value.length===0,"onUpdate:modelValue":Ga},null,8,["model-value","options","disabled"]),v("p",QC,ae(or.value?"Loading branches…":Oa.value?`New worktree branch will start from ${Oa.value}.`:"No Git branches found for this folder."),1)])):ie("",!0),m[57]||(m[57]=v("p",{class:"new-thread-runtime-help"},[v("code",null,"Local project"),lo(" uses the selected folder directly. "),v("code",null,"New worktree"),lo(" creates an isolated Git worktree before the first prompt. ")],-1)),ft.value.phase!=="idle"?(S(),$("div",{key:2,class:ot(["worktree-init-status",{"is-running":ft.value.phase==="running","is-error":ft.value.phase==="error"}])},[v("strong",XC,ae(ft.value.title),1),v("span",ZC,ae(ft.value.message),1)],2)):ie("",!0),Hn.value?(S(),$("div",eA,[v("div",tA,[m[54]||(m[54]=v("p",{class:"new-thread-trending-title"},"Trending GitHub projects",-1)),Be(Jo,{class:"new-thread-trending-scope-dropdown","model-value":Bn.value,options:nl.value,"onUpdate:modelValue":Bo},null,8,["model-value","options"])]),Fn.value?(S(),$("p",nA,"Loading trending projects...")):Rt.value.length===0?(S(),$("p",rA," Trending repos are unavailable right now. ")):(S(),$("div",oA,[(S(!0),$(qe,null,Dt(Rt.value,x=>(S(),$("button",{key:x.id,type:"button",class:"new-thread-trending-tip",onClick:se=>us(x)},[v("span",{class:"new-thread-trending-tip-name",title:x.fullName},[x.owner&&x.repo?(S(),$(qe,{key:0},[v("span",iA,ae(x.owner),1),m[55]||(m[55]=v("span",{class:"new-thread-trending-tip-name-slash"},"/",-1)),v("span",lA,ae(x.repo),1)],64)):(S(),$("span",uA,ae(x.fullName),1))],8,aA),v("span",cA,ae(Fo(x)),1),v("span",dA,ae(x.description||"No description available."),1)],8,sA))),128))]))])):ie("",!0)]),v("div",fA,[nt.value&&Pn.value?(S(),st(Me(n),{key:0,class:"content-thread-terminal-panel","thread-id":wo.value,cwd:Pn.value,onHide:m[23]||(m[23]=x=>nt.value=!1)},null,8,["thread-id","cwd"])):ie("",!0),Be(nf,{ref_key:"homeThreadComposerRef",ref:Pe,"active-thread-id":wo.value,cwd:Pn.value,"collaboration-modes":Me(z),"selected-collaboration-mode":Me(ue),models:Me(de),"selected-model":Ls.value,"selected-reasoning-effort":Me(we),"selected-speed-mode":Me(ke),"is-updating-speed-mode":Me(Te),skills:Me(me),"thread-token-usage":Me(k),"codex-quota":Me(R),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":er.value,"in-progress-submit-mode":tr.value,"dictation-click-to-toggle":Ct.value,"dictation-auto-send":vn.value,"dictation-language":pr.value,onSubmit:Ys,"onUpdate:selectedCollaborationMode":wc,"onUpdate:selectedModel":pc,"onUpdate:selectedReasoningEffort":hc,"onUpdate:selectedSpeedMode":mc},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"])])])):(S(),$("div",pA,[Zn.value&&Me(F)&&Pn.value?(S(),st(Me(r),{key:0,"thread-id":Me(F),cwd:Pn.value,"is-thread-in-progress":js.value,onClose:m[24]||(m[24]=x=>Zn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress"])):(S(),$(qe,{key:1},[v("div",hA,[Be(Me(t),{ref_key:"threadConversationRef",ref:ut,messages:Do.value,"is-loading":Me(ve),"active-thread-id":wo.value,cwd:Pn.value,"scroll-state":Me(U),"live-overlay":Vi.value,"pending-requests":Me(Z),onUpdateScrollState:h,onForkThread:L,onRollback:Eh,onRespondServerRequest:b},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",mA,[Be(Nk,{messages:Me(_),onEdit:Wa,onSteer:Me(B),onDelete:Me(A)},null,8,["messages","onSteer","onDelete"]),Me(H)&&Me(F)&&Pn.value?(S(),st(Me(n),{key:0,class:"content-thread-terminal-panel","thread-id":Me(F),cwd:Pn.value,onHide:m[25]||(m[25]=x=>Me(mt)(Me(F),!1))},null,8,["thread-id","cwd"])):ie("",!0),Pa.value?(S(),st(Ek,{key:1,request:Pa.value,"request-count":Me(Z).length,"has-queue-above":Me(_).length>0,onRespondServerRequest:b},null,8,["request","request-count","has-queue-above"])):(S(),st(nf,{key:2,ref_key:"threadComposerRef",ref:at,"active-thread-id":wo.value,cwd:Pn.value,"collaboration-modes":Me(z),"selected-collaboration-mode":Me(ue),models:Me(de),"selected-model":Ls.value,"selected-reasoning-effort":Me(we),"selected-speed-mode":Me(ke),"is-updating-speed-mode":Me(Te),skills:Me(me),"thread-token-usage":Me(k),"codex-quota":Me(R),"is-turn-in-progress":js.value,"is-stop-pending":Me(Ie),"is-interrupting-turn":Me(Ne),"has-queue-above":Me(_).length>0,"send-with-enter":er.value,"in-progress-submit-mode":tr.value,"dictation-click-to-toggle":Ct.value,"dictation-auto-send":vn.value,"dictation-language":pr.value,"onUpdate:selectedCollaborationMode":wc,onSubmit:Ys,"onUpdate:selectedModel":pc,"onUpdate:selectedReasoningEffort":hc,"onUpdate:selectedSpeedMode":mc,onInterrupt:Ah},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"]))])],64))]))])],4)]),_:1},8,["is-sidebar-collapsed"]))}}),yA=ht(gA,[["__scopeId","data-v-c57c0269"]]),lu={render:()=>null},wA=Hy({history:Ty(),routes:[{path:"/",name:"home",component:lu},{path:"/thread/:threadId",name:"thread",component:lu},{path:"/skills",name:"skills",component:lu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. github: https://github.com/friuns2/codexUI");Pg(yA).use(wA).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});export{ri as A,qw as B,_A as C,TA as D,SA as E,qe as F,kA as G,rn as H,Si as I,Cg as J,xA as K,AA as L,EA as M,bA as N,CA as O,ic as P,bs as Q,Nb as R,of as S,Lp as T,yn as U,zt as V,ht as _,v as a,Oo as b,$ as c,Cn as d,es as e,ie as f,Dt as g,ot as h,st as i,bt as j,Ku as k,io as l,Be as m,Gt as n,S as o,hi as p,YT as q,M as r,Sx as s,ae as t,rc as u,lt as v,it as w,Me as x,lo as y,re as z};