codex-mobile-re 0.1.129 → 0.1.131

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.
@@ -0,0 +1,83 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-CVVohemt.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-D1JHRys4.css","assets/ThreadTerminalPanel-DhYhXg8u.js","assets/ThreadTerminalPanel-DkX7vTl_.css","assets/ReviewPane-DO60w4j5.js","assets/ReviewPane-BFBDQWlW.css","assets/DirectoryHub-Yd0fIqxf.js","assets/DirectoryHub-DcMzIMOW.css","assets/AutomationsPanel-CZ_k1aNL.js","assets/AutomationsPanel-Dz1E0PMi.css","assets/SettingsDialog-D9kB2mzO.js","assets/SettingsDialog-C6mYdSFF.css","assets/RightGitPanel-BxZdreeN.js","assets/RightGitPanel-CQgG9pXB.css","assets/RightFilesPanel-r9ijJqw4.js","assets/RightFilesPanel-ev__hRb5.css","assets/RightFilePreview-B2tx1lOm.js","assets/RightFilePreview-DNZDBkBr.css","assets/ThreadPendingRequestPanel-DGbhyPFH.js","assets/ThreadPendingRequestPanel-BlBoJVzv.css","assets/QueuedMessages-DSxRli0y.js","assets/QueuedMessages-D6bvkQIC.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 a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
3
+ * @vue/shared v3.5.40
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function Af(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ut={},el=[],ga=()=>{},Tv=()=>!1,pc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),hc=e=>e.startsWith("onUpdate:"),gn=Object.assign,_f=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},WT=Object.prototype.hasOwnProperty,Ot=(e,t)=>WT.call(e,t),at=Array.isArray,tl=e=>nu(e)==="[object Map]",mc=e=>nu(e)==="[object Set]",Xp=e=>nu(e)==="[object Date]",ft=e=>typeof e=="function",Yt=e=>typeof e=="string",Ro=e=>typeof e=="symbol",$t=e=>e!==null&&typeof e=="object",Sv=e=>($t(e)||ft(e))&&ft(e.then)&&ft(e.catch),Cv=Object.prototype.toString,nu=e=>Cv.call(e),qT=e=>nu(e).slice(8,-1),xv=e=>nu(e)==="[object Object]",Pf=e=>Yt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Bl=Af(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),vc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},GT=/-\w/g,cr=vc(e=>e.replace(GT,t=>t.slice(1).toUpperCase())),VT=/\B([A-Z])/g,qs=vc(e=>e.replace(VT,"-$1").toLowerCase()),gc=vc(e=>e.charAt(0).toUpperCase()+e.slice(1)),ud=vc(e=>e?`on${gc(e)}`:""),Ao=(e,t)=>!Object.is(e,t),Hu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},kv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Mf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},KT=e=>{const t=Yt(e)?Number(e):NaN;return isNaN(t)?e:t};let Zp;const yc=()=>Zp||(Zp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function to(e){if(at(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Yt(r)?XT(r):to(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(Yt(e)||$t(e))return e}const YT=/;(?![^(]*\))/g,JT=/:([^]+)/,QT=/\/\*[^]*?\*\//g;function XT(e){const t={};return e.replace(QT,"").split(YT).forEach(n=>{if(n){const r=n.split(JT);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function lt(e){let t="";if(Yt(e))t=e;else if(at(e))for(let n=0;n<e.length;n++){const r=lt(e[n]);r&&(t+=r+" ")}else if($t(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ZT="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",e0=Af(ZT);function Iv(e){return!!e||e===""}function t0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ru(e[r],t[r]);return n}function ru(e,t){if(e===t)return!0;let n=Xp(e),r=Xp(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Ro(e),r=Ro(t),n||r)return e===t;if(n=at(e),r=at(t),n||r)return n&&r?t0(e,t):!1;if(n=$t(e),r=$t(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!ru(e[s],t[s]))return!1}}return String(e)===String(t)}function Av(e,t){return e.findIndex(n=>ru(n,t))}const _v=e=>!!(e&&e.__v_isRef===!0),F=e=>Yt(e)?e:e==null?"":at(e)||$t(e)&&(e.toString===Cv||!ft(e.toString))?_v(e)?F(e.value):JSON.stringify(e,Pv,2):String(e),Pv=(e,t)=>_v(t)?Pv(e,t.value):tl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[cd(r,a)+" =>"]=o,n),{})}:mc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>cd(n))}:Ro(t)?cd(t):$t(t)&&!at(t)&&!xv(t)?String(t):t,cd=(e,t="")=>{var n;return Ro(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
+ * @vue/reactivity v3.5.40
8
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
+ * @license MIT
10
+ **/let Dn;class n0{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Dn&&(Dn.active?(this.parent=Dn,this.index=(Dn.scopes||(Dn.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[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){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const r=this.effects.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}}run(t){if(this._active){const n=Dn;try{return Dn=this,t()}finally{Dn=n}}}on(){++this._on===1&&(this.prevScope=Dn,Dn=this)}off(){if(this._on>0&&--this._on===0){if(Dn===this)Dn=this.prevScope;else{let t=Dn;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){const o=this.scopes.slice();for(n=0,r=o.length;n<r;n++)o[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 r0(){return Dn}let Wt;const dd=new WeakSet;class Mv{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,Dn&&(Dn.active?Dn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,dd.has(this)&&(dd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Rv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,eh(this),jv(this);const t=Wt,n=Mo;Wt=this,Mo=!0;try{return this.fn()}finally{Lv(this),Wt=t,Mo=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)jf(t);this.deps=this.depsTail=void 0,eh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?dd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Hd(this)&&this.run()}get dirty(){return Hd(this)}}let Ev=0,Ul,zl;function Rv(e,t=!1){if(e.flags|=8,t){e.next=zl,zl=e;return}e.next=Ul,Ul=e}function Ef(){Ev++}function Rf(){if(--Ev>0)return;if(zl){let t=zl;for(zl=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ul;){let t=Ul;for(Ul=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 jv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Lv(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),jf(r),o0(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Hd(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Nv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Nv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Kl)||(e.globalVersion=Kl,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Hd(e))))return;e.flags|=2;const t=e.dep,n=Wt,r=Mo;Wt=e,Mo=!0;try{jv(e);const o=e.fn(e._value);(t.version===0||Ao(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Wt=n,Mo=r,Lv(e),e.flags&=-3}}function jf(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 a=n.computed.deps;a;a=a.nextDep)jf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function o0(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Mo=!0;const Ov=[];function Ya(){Ov.push(Mo),Mo=!1}function Ja(){const e=Ov.pop();Mo=e===void 0?!0:e}function eh(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Wt;Wt=void 0;try{t()}finally{Wt=n}}}let Kl=0;class a0{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 Lf{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(!Wt||!Mo||Wt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Wt)n=this.activeLink=new a0(Wt,this),Wt.deps?(n.prevDep=Wt.depsTail,Wt.depsTail.nextDep=n,Wt.depsTail=n):Wt.deps=Wt.depsTail=n,$v(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=Wt.depsTail,n.nextDep=void 0,Wt.depsTail.nextDep=n,Wt.depsTail=n,Wt.deps===n&&(Wt.deps=r)}return n}trigger(t){this.version++,Kl++,this.notify(t)}notify(t){Ef();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Rf()}}}function $v(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)$v(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Wd=new WeakMap,Ti=Symbol(""),qd=Symbol(""),Yl=Symbol("");function Jn(e,t,n){if(Mo&&Wt){let r=Wd.get(e);r||Wd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new Lf),o.map=r,o.key=n),o.track()}}function Wa(e,t,n,r,o,a){const s=Wd.get(e);if(!s){Kl++;return}const i=l=>{l&&l.trigger()};if(Ef(),t==="clear")s.forEach(i);else{const l=at(e),c=l&&Pf(n);if(l&&n==="length"){const d=Number(r);s.forEach((v,f)=>{(f==="length"||f===Yl||!Ro(f)&&f>=d)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),c&&i(s.get(Yl)),t){case"add":l?c&&i(s.get("length")):(i(s.get(Ti)),tl(e)&&i(s.get(qd)));break;case"delete":l||(i(s.get(Ti)),tl(e)&&i(s.get(qd)));break;case"set":tl(e)&&i(s.get(Ti));break}}Rf()}function qi(e){const t=Rt(e);return t===e?t:(Jn(t,"iterate",Yl),no(e)?t:t.map(jo))}function wc(e){return Jn(e=Rt(e),"iterate",Yl),e}function ha(e,t){return Qa(e)?cl(Si(e)?jo(t):t):jo(t)}const s0={__proto__:null,[Symbol.iterator](){return fd(this,Symbol.iterator,e=>ha(this,e))},concat(...e){return qi(this).concat(...e.map(t=>at(t)?qi(t):t))},entries(){return fd(this,"entries",e=>(e[1]=ha(this,e[1]),e))},every(e,t){return Da(this,"every",e,t,void 0,arguments)},filter(e,t){return Da(this,"filter",e,t,n=>n.map(r=>ha(this,r)),arguments)},find(e,t){return Da(this,"find",e,t,n=>ha(this,n),arguments)},findIndex(e,t){return Da(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Da(this,"findLast",e,t,n=>ha(this,n),arguments)},findLastIndex(e,t){return Da(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Da(this,"forEach",e,t,void 0,arguments)},includes(...e){return pd(this,"includes",e)},indexOf(...e){return pd(this,"indexOf",e)},join(e){return qi(this).join(e)},lastIndexOf(...e){return pd(this,"lastIndexOf",e)},map(e,t){return Da(this,"map",e,t,void 0,arguments)},pop(){return El(this,"pop")},push(...e){return El(this,"push",e)},reduce(e,...t){return th(this,"reduce",e,t)},reduceRight(e,...t){return th(this,"reduceRight",e,t)},shift(){return El(this,"shift")},some(e,t){return Da(this,"some",e,t,void 0,arguments)},splice(...e){return El(this,"splice",e)},toReversed(){return qi(this).toReversed()},toSorted(e){return qi(this).toSorted(e)},toSpliced(...e){return qi(this).toSpliced(...e)},unshift(...e){return El(this,"unshift",e)},values(){return fd(this,"values",e=>ha(this,e))}};function fd(e,t,n){const r=wc(e),o=r[t]();return r!==e&&!no(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const i0=Array.prototype;function Da(e,t,n,r,o,a){const s=wc(e),i=s!==e&&!no(e),l=s[t];if(l!==i0[t]){const v=l.apply(e,a);return i?jo(v):v}let c=n;s!==e&&(i?c=function(v,f){return n.call(this,ha(e,v),f,e)}:n.length>2&&(c=function(v,f){return n.call(this,v,f,e)}));const d=l.call(s,c,r);return i&&o?o(d):d}function th(e,t,n,r){const o=wc(e),a=o!==e&&!no(e);let s=n,i=!1;o!==e&&(a?(i=r.length===0,s=function(c,d,v){return i&&(i=!1,c=ha(e,c)),n.call(this,c,ha(e,d),v,e)}):n.length>3&&(s=function(c,d,v){return n.call(this,c,d,v,e)}));const l=o[t](s,...r);return i?ha(e,l):l}function pd(e,t,n){const r=Rt(e);Jn(r,"iterate",Yl);const o=r[t](...n);return(o===-1||o===!1)&&$f(n[0])?(n[0]=Rt(n[0]),r[t](...n)):o}function El(e,t,n=[]){Ya(),Ef();const r=Rt(e)[t].apply(e,n);return Rf(),Ja(),r}const l0=Af("__proto__,__v_isRef,__isVue"),Dv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ro));function u0(e){Ro(e)||(e=String(e));const t=Rt(this);return Jn(t,"has",e),t.hasOwnProperty(e)}class Fv{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,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?w0:Hv:a?zv:Uv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=at(t);if(!o){let l;if(s&&(l=s0[n]))return l;if(n==="hasOwnProperty")return u0}const i=Reflect.get(t,n,Rn(t)?t:r);if((Ro(n)?Dv.has(n):l0(n))||(o||Jn(t,"get",n),a))return i;if(Rn(i)){const l=s&&Pf(n)?i:i.value;return o&&$t(l)?Vd(l):l}return $t(i)?o?Vd(i):bc(i):i}}class Bv extends Fv{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=at(t)&&Pf(n);if(!this._isShallow){const c=Qa(a);if(!no(r)&&!Qa(r)&&(a=Rt(a),r=Rt(r)),!s&&Rn(a)&&!Rn(r))return c||(a.value=r),!0}const i=s?Number(n)<t.length:Ot(t,n),l=Reflect.set(t,n,r,Rn(t)?t:o);return t===Rt(o)&&l&&(i?Ao(r,a)&&Wa(t,"set",n,r):Wa(t,"add",n,r)),l}deleteProperty(t,n){const r=Ot(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&Wa(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Ro(n)||!Dv.has(n))&&Jn(t,"has",n),r}ownKeys(t){return Jn(t,"iterate",at(t)?"length":Ti),Reflect.ownKeys(t)}}class c0 extends Fv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const d0=new Bv,f0=new c0,p0=new Bv(!0);const Gd=e=>e,Iu=e=>Reflect.getPrototypeOf(e);function h0(e,t,n){return function(...r){const o=this.__v_raw,a=Rt(o),s=tl(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=o[e](...r),d=n?Gd:t?cl:jo;return!t&&Jn(a,"iterate",l?qd:Ti),gn(Object.create(c),{next(){const{value:v,done:f}=c.next();return f?{value:v,done:f}:{value:i?[d(v[0]),d(v[1])]:d(v),done:f}}})}}function Au(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function m0(e,t){const n={get(o){const a=this.__v_raw,s=Rt(a),i=Rt(o);e||(Ao(o,i)&&Jn(s,"get",o),Jn(s,"get",i));const{has:l}=Iu(s),c=t?Gd:e?cl:jo;if(l.call(s,o))return c(a.get(o));if(l.call(s,i))return c(a.get(i));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&Jn(Rt(o),"iterate",Ti),o.size},has(o){const a=this.__v_raw,s=Rt(a),i=Rt(o);return e||(Ao(o,i)&&Jn(s,"has",o),Jn(s,"has",i)),o===i?a.has(o):a.has(o)||a.has(i)},forEach(o,a){const s=this,i=s.__v_raw,l=Rt(i),c=t?Gd:e?cl:jo;return!e&&Jn(l,"iterate",Ti),i.forEach((d,v)=>o.call(a,c(d),c(v),s))}};return gn(n,e?{add:Au("add"),set:Au("set"),delete:Au("delete"),clear:Au("clear")}:{add(o){const a=Rt(this),s=Iu(a),i=Rt(o),l=!t&&!no(o)&&!Qa(o)?i:o;return s.has.call(a,l)||Ao(o,l)&&s.has.call(a,o)||Ao(i,l)&&s.has.call(a,i)||(a.add(l),Wa(a,"add",l,l)),this},set(o,a){!t&&!no(a)&&!Qa(a)&&(a=Rt(a));const s=Rt(this),{has:i,get:l}=Iu(s);let c=i.call(s,o);c||(o=Rt(o),c=i.call(s,o));const d=l.call(s,o);return s.set(o,a),c?Ao(a,d)&&Wa(s,"set",o,a):Wa(s,"add",o,a),this},delete(o){const a=Rt(this),{has:s,get:i}=Iu(a);let l=s.call(a,o);l||(o=Rt(o),l=s.call(a,o)),i&&i.call(a,o);const c=a.delete(o);return l&&Wa(a,"delete",o,void 0),c},clear(){const o=Rt(this),a=o.size!==0,s=o.clear();return a&&Wa(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=h0(o,e,t)}),n}function Nf(e,t){const n=m0(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Ot(n,o)&&o in r?n:r,o,a)}const v0={get:Nf(!1,!1)},g0={get:Nf(!1,!0)},y0={get:Nf(!0,!1)};const Uv=new WeakMap,zv=new WeakMap,Hv=new WeakMap,w0=new WeakMap;function b0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function bc(e){return Qa(e)?e:Of(e,!1,d0,v0,Uv)}function Wv(e){return Of(e,!1,p0,g0,zv)}function Vd(e){return Of(e,!0,f0,y0,Hv)}function Of(e,t,n,r,o){if(!$t(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=o.get(e);if(a)return a;const s=b0(qT(e));if(s===0)return e;const i=new Proxy(e,s===2?r:n);return o.set(e,i),i}function Si(e){return Qa(e)?Si(e.__v_raw):!!(e&&e.__v_isReactive)}function Qa(e){return!!(e&&e.__v_isReadonly)}function no(e){return!!(e&&e.__v_isShallow)}function $f(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function T0(e){return!Ot(e,"__v_skip")&&Object.isExtensible(e)&&kv(e,"__v_skip",!0),e}const jo=e=>$t(e)?bc(e):e,cl=e=>$t(e)?Vd(e):e;function Rn(e){return e?e.__v_isRef===!0:!1}function S(e){return qv(e,!1)}function S0(e){return qv(e,!0)}function qv(e,t){return Rn(e)?e:new C0(e,t)}class C0{constructor(t,n){this.dep=new Lf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:jo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||no(t)||Qa(t);t=r?t:Rt(t),Ao(t,n)&&(this._rawValue=t,this._value=r?t:jo(t),this.dep.trigger())}}function m(e){return Rn(e)?e.value:e}const x0={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Rn(o)&&!Rn(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Gv(e){return Si(e)?e:new Proxy(e,x0)}class k0{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Lf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Kl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Wt!==this)return Rv(this,!0),!0}get value(){const t=this.dep.track();return Nv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function I0(e,t,n=!1){let r,o;return ft(e)?r=e:(r=e.get,o=e.set),new k0(r,o,n)}const _u={},Yu=new WeakMap;let mi;function A0(e,t=!1,n=mi){if(n){let r=Yu.get(n);r||Yu.set(n,r=[]),r.push(e)}}function _0(e,t,n=Ut){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:i,call:l}=n,c=R=>o?R:no(R)||o===!1||o===0?qa(R,1):qa(R);let d,v,f,y,T=!1,A=!1;if(Rn(e)?(v=()=>e.value,T=no(e)):Si(e)?(v=()=>c(e),T=!0):at(e)?(A=!0,T=e.some(R=>Si(R)||no(R)),v=()=>e.map(R=>{if(Rn(R))return R.value;if(Si(R))return c(R);if(ft(R))return l?l(R,2):R()})):ft(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Ya();try{f()}finally{Ja()}}const R=mi;mi=d;try{return l?l(e,3,[y]):e(y)}finally{mi=R}}:v=ga,t&&o){const R=v,pe=o===!0?1/0:o;v=()=>qa(R(),pe)}const U=r0(),O=()=>{d.stop(),U&&U.active&&_f(U.effects,d)};if(a&&t){const R=t;t=(...pe)=>{const ce=R(...pe);return O(),ce}}let $=A?new Array(e.length).fill(_u):_u;const q=R=>{if(!(!(d.flags&1)||!d.dirty&&!R))if(t){const pe=d.run();if(R||o||T||(A?pe.some((ce,K)=>Ao(ce,$[K])):Ao(pe,$))){f&&f();const ce=mi;mi=d;try{const K=[pe,$===_u?void 0:A&&$[0]===_u?[]:$,y];$=pe,l?l(t,3,K):t(...K)}finally{mi=ce}}}else d.run()};return i&&i(q),d=new Mv(v),d.scheduler=s?()=>s(q,!1):q,y=R=>A0(R,!1,d),f=d.onStop=()=>{const R=Yu.get(d);if(R){if(l)l(R,4);else for(const pe of R)pe();Yu.delete(d)}},t?r?q(!0):$=d.run():s?s(q.bind(null,!0),!0):d.run(),O.pause=d.pause.bind(d),O.resume=d.resume.bind(d),O.stop=O,O}function qa(e,t=1/0,n){if(t<=0||!$t(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Rn(e))qa(e.value,t,n);else if(at(e))for(let r=0;r<e.length;r++)qa(e[r],t,n);else if(mc(e)||tl(e))e.forEach(r=>{qa(r,t,n)});else if(xv(e)){for(const r in e)qa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&qa(e[r],t,n)}return e}/**
11
+ * @vue/runtime-core v3.5.40
12
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
+ * @license MIT
14
+ **/function ou(e,t,n,r){try{return r?e(...r):e()}catch(o){au(o,t,n)}}function oo(e,t,n,r){if(ft(e)){const o=ou(e,t,n,r);return o&&Sv(o)&&o.catch(a=>{au(a,t,n)}),o}if(at(e)){const o=[];for(let a=0;a<e.length;a++)o.push(oo(e[a],t,n,r));return o}}function au(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Ut;if(t){let i=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const d=i.ec;if(d){for(let v=0;v<d.length;v++)if(d[v](e,l,c)===!1)return}i=i.parent}if(a){Ya(),ou(a,null,10,[e,l,c]),Ja();return}}P0(e,n,o,r,s)}function P0(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const lr=[];let pa=-1;const nl=[];let Ns=null,Yi=0;const Vv=Promise.resolve();let Ju=null;function Ft(e){const t=Ju||Vv;return e?t.then(this?e.bind(this):e):t}function M0(e){let t=pa+1,n=lr.length;for(;t<n;){const r=t+n>>>1,o=lr[r],a=Jl(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function Df(e){if(!(e.flags&1)){const t=Jl(e),n=lr[lr.length-1];!n||!(e.flags&2)&&t>=Jl(n)?lr.push(e):lr.splice(M0(t),0,e),e.flags|=1,Kv()}}function Kv(){Ju||(Ju=Vv.then(Jv))}function E0(e){at(e)?nl.push(...e):Ns&&e.id===-1?Ns.splice(Yi+1,0,e):e.flags&1||(nl.push(e),e.flags|=1),Kv()}function nh(e,t,n=pa+1){for(;n<lr.length;n++){const r=lr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;lr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Yv(e){if(nl.length){const t=[...new Set(nl)].sort((n,r)=>Jl(n)-Jl(r));if(nl.length=0,Ns){Ns.push(...t);return}for(Ns=t,Yi=0;Yi<Ns.length;Yi++){const n=Ns[Yi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ns=null,Yi=0}}const Jl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Jv(e){try{for(pa=0;pa<lr.length;pa++){const t=lr[pa];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),ou(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;pa<lr.length;pa++){const t=lr[pa];t&&(t.flags&=-2)}pa=-1,lr.length=0,Yv(),Ju=null,(lr.length||nl.length)&&Jv()}}let zn=null,Qv=null;function Qu(e){const t=zn;return zn=e,Qv=e&&e.type.__scopeId||null,t}function dt(e,t=zn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&ec(-1);const a=Qu(t),s=Va.length;let i;try{i=e(...o)}finally{for(let l=Va.length;l>s;l--)Wf();Qu(a),r._d&&ec(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function En(e,t){if(zn===null)return e;const n=xc(zn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,i,l=Ut]=t[o];a&&(ft(a)&&(a={mounted:a,updated:a}),a.deep&&qa(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function ci(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const i=o[s];a&&(i.oldValue=a[s].value);let l=i.dir[r];l&&(Ya(),oo(l,n,8,[e.el,i,e,t]),Ja())}}function Wu(e,t){if(Un){let n=Un.provides;const r=Un.parent&&Un.parent.provides;r===n&&(n=Un.provides=Object.create(r)),n[e]=t}}function Eo(e,t,n=!1){const r=Gf();if(r||ol){let o=ol?ol._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&&ft(t)?t.call(r&&r.proxy):t}}const R0=Symbol.for("v-scx"),j0=()=>Eo(R0);function rt(e,t,n){return Xv(e,t,n)}function Xv(e,t,n=Ut){const{immediate:r,deep:o,flush:a,once:s}=n,i=gn({},n),l=t&&r||!t&&a!=="post";let c;if(pl){if(a==="sync"){const y=j0();c=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=ga,y.resume=ga,y.pause=ga,y}}const d=Un;i.call=(y,T,A)=>oo(y,d,T,A);let v=!1;a==="post"?i.scheduler=y=>{sr(y,d&&d.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(y,T)=>{T?y():Df(y)}),i.augmentJob=y=>{t&&(y.flags|=4),v&&(y.flags|=2,d&&(y.id=d.uid,y.i=d))};const f=_0(e,t,i);return pl&&(c?c.push(f):l&&f()),f}function L0(e,t,n){const r=this.proxy,o=Yt(e)?e.includes(".")?Zv(r,e):()=>r[e]:e.bind(r,r);let a;ft(t)?a=t:(a=t.handler,n=t);const s=lu(this),i=Xv(o,a.bind(r),n);return s(),i}function Zv(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 Rs=new WeakMap,eg=Symbol("_vte"),tg=e=>e.__isTeleport,gi=e=>e&&(e.disabled||e.disabled===""),N0=e=>e&&(e.defer||e.defer===""),rh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,oh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Kd=(e,t)=>{const n=e&&e.to;return Yt(n)?t?t(n):null:n},O0={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,i,l,c){const{mc:d,pc:v,pbc:f,o:{insert:y,querySelector:T,createText:A,createComment:U,parentNode:O}}=c,$=gi(t.props);let{dynamicChildren:q}=t;const R=(K,le,ye)=>{K.shapeFlag&16&&d(K.children,le,ye,o,a,s,i,l)},pe=(K=t)=>{const le=gi(K.props),ye=K.target=Kd(K.props,T),Pe=Yd(ye,K,A,y);ye&&(s!=="svg"&&rh(ye)?s="svg":s!=="mathml"&&oh(ye)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(ye),le||(R(K,ye,Pe),Ol(K,!1)))},ce=K=>{const le=()=>{if(Rs.get(K)===le){if(Rs.delete(K),gi(K.props)){const ye=O(K.el)||n;R(K,ye,K.anchor),Ol(K,!0)}pe(K)}};Rs.set(K,le),sr(le,a)};if(e==null){const K=t.el=A(""),le=t.anchor=A("");if(y(K,n,r),y(le,n,r),N0(t.props)||a&&a.pendingBranch){ce(t);return}$&&(R(t,n,le),Ol(t,!0)),pe()}else{t.el=e.el;const K=t.anchor=e.anchor,le=Rs.get(e);if(le){le.flags|=8,Rs.delete(e),ce(t);return}t.targetStart=e.targetStart;const ye=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ge=gi(e.props),ee=ge?n:ye,me=ge?K:Pe;if(s==="svg"||rh(ye)?s="svg":(s==="mathml"||oh(ye))&&(s="mathml"),q?(f(e.dynamicChildren,q,ee,o,a,s,i),Hf(e,t,!0)):l||v(e,t,ee,me,o,a,s,i,!1),$)ge?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Pu(t,n,K,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const re=Kd(t.props,T);re&&(t.target=re,Pu(t,re,null,c,0))}else ge&&Pu(t,ye,Pe,c,1);Ol(t,$)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:c,targetAnchor:d,target:v,props:f}=e,y=gi(f),T=a||!y,A=Rs.get(e);if(A&&(A.flags|=8,Rs.delete(e)),v&&(o(c),o(d)),a&&o(l),!A&&(y||v)&&s&16)for(let U=0;U<i.length;U++){const O=i[U];r(O,t,n,T,!!O.dynamicChildren)}},move:Pu,hydrate:$0};function Pu(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:c,props:d}=e,v=a===2;if(v&&r(s,t,n),!Rs.has(e)&&(!v||gi(d))&&l&16)for(let f=0;f<c.length;f++)o(c[f],t,n,2);v&&r(i,t,n)}function $0(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:c,createText:d}},v){function f(U,O){let $=O;for(;$;){if($&&$.nodeType===8){if($.data==="teleport start anchor")t.targetStart=$;else if($.data==="teleport anchor"){t.targetAnchor=$,U._lpa=t.targetAnchor&&s(t.targetAnchor);break}}$=s($)}}function y(U,O){O.anchor=v(s(U),O,i(U),n,r,o,a)}const T=t.target=Kd(t.props,l),A=gi(t.props);if(T){const U=T._lpa||T.firstChild;t.shapeFlag&16&&(A?(y(e,t),f(T,U),t.targetAnchor||Yd(T,t,d,c,i(e)===T?e:null)):(t.anchor=s(e),f(T,U),t.targetAnchor||Yd(T,t,d,c),v(U&&s(U),t,T,n,r,o,a))),Ol(t,A)}else A&&t.shapeFlag&16&&(y(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const dl=O0;function Ol(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 Yd(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[eg]=s,e&&(r(a,e,o),r(s,e,o)),s}const eo=Symbol("_leaveCb"),Rl=Symbol("_enterCb");function D0(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ii(()=>{e.isMounted=!0}),Gs(()=>{e.isUnmounting=!0}),e}const Zr=[Function,Array],ng={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Zr,onEnter:Zr,onAfterEnter:Zr,onEnterCancelled:Zr,onBeforeLeave:Zr,onLeave:Zr,onAfterLeave:Zr,onLeaveCancelled:Zr,onBeforeAppear:Zr,onAppear:Zr,onAfterAppear:Zr,onAppearCancelled:Zr},rg=e=>{const t=e.subTree;return t.component?rg(t.component):t},F0={name:"BaseTransition",props:ng,setup(e,{slots:t}){const n=Gf(),r=D0();return()=>{const o=t.default&&sg(t.default(),!0),a=o&&o.length?og(o):n.subTree?ve():void 0;if(!a)return;const s=Rt(e),{mode:i}=s;if(r.isLeaving)return hd(a);const l=ah(a);if(!l)return hd(a);let c=Jd(l,s,r,n,v=>c=v);l.type!==Qn&&Ql(l,c);let d=n.subTree&&ah(n.subTree);if(d&&d.type!==Qn&&!yi(d,l)&&rg(n).type!==Qn){let v=Jd(d,s,r,n);if(Ql(d,v),i==="out-in"&&l.type!==Qn)return r.isLeaving=!0,v.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,d=void 0},hd(a);i==="in-out"&&l.type!==Qn?v.delayLeave=(f,y,T)=>{const A=ag(r,d);A[String(d.key)]=d,f[eo]=()=>{y(),f[eo]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{T(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return a}}};function og(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Qn){t=n;break}}return t}const B0=F0;function ag(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 Jd(e,t,n,r,o){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:v,onBeforeLeave:f,onLeave:y,onAfterLeave:T,onLeaveCancelled:A,onBeforeAppear:U,onAppear:O,onAfterAppear:$,onAppearCancelled:q}=t,R=String(e.key),pe=ag(n,e),ce=(ye,Pe)=>{ye&&oo(ye,r,9,Pe)},K=(ye,Pe)=>{const ge=Pe[1];ce(ye,Pe),at(ye)?ye.every(ee=>ee.length<=1)&&ge():ye.length<=1&&ge()},le={mode:s,persisted:i,beforeEnter(ye){let Pe=l;if(!n.isMounted)if(a)Pe=U||l;else return;ye[eo]&&ye[eo](!0);const ge=pe[R];ge&&yi(e,ge)&&ge.el[eo]&&ge.el[eo](),ce(Pe,[ye])},enter(ye){if(pe[R]===e)return;let Pe=c,ge=d,ee=v;if(!n.isMounted)if(a)Pe=O||c,ge=$||d,ee=q||v;else return;let me=!1;ye[Rl]=Ie=>{me||(me=!0,Ie?ce(ee,[ye]):ce(ge,[ye]),le.delayedLeave&&le.delayedLeave(),ye[Rl]=void 0)};const re=ye[Rl].bind(null,!1);Pe?K(Pe,[ye,re]):re()},leave(ye,Pe){const ge=String(e.key);if(ye[Rl]&&ye[Rl](!0),n.isUnmounting)return Pe();ce(f,[ye]);let ee=!1;ye[eo]=re=>{ee||(ee=!0,Pe(),re?ce(A,[ye]):ce(T,[ye]),ye[eo]=void 0,pe[ge]===e&&delete pe[ge])};const me=ye[eo].bind(null,!1);pe[ge]=e,y?K(y,[ye,me]):me()},clone(ye){const Pe=Jd(ye,t,n,r,o);return o&&o(Pe),Pe}};return le}function hd(e){if(su(e))return e=Hs(e),e.children=null,e}function ah(e){if(!su(e))return tg(e.type)&&e.children?og(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&&ft(n.default))return n.default()}}function Ql(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ql(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 sg(e,t=!1,n){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===ut?(s.patchFlag&128&&o++,r=r.concat(sg(s.children,t,i))):(t||s.type!==Qn)&&r.push(i!=null?Hs(s,{key:i}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function yn(e,t){return ft(e)?gn({name:e.name},t,{setup:e}):e}function Ff(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function sh(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Xu=new WeakMap;function Hl(e,t,n,r,o=!1){if(at(e)){e.forEach((A,U)=>Hl(A,t&&(at(t)?t[U]:t),n,r,o));return}if(rl(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Hl(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?xc(r.component):r.el,s=o?null:a,{i,r:l}=e,c=t&&t.r,d=i.refs===Ut?i.refs={}:i.refs,v=i.setupState,f=Rt(v),y=v===Ut?Tv:A=>sh(d,A)?!1:Ot(f,A),T=(A,U)=>!(U&&sh(d,U));if(c!=null&&c!==l){if(ih(t),Yt(c))d[c]=null,y(c)&&(v[c]=null);else if(Rn(c)){const A=t;T(c,A.k)&&(c.value=null),A.k&&(d[A.k]=null)}}if(ft(l))ou(l,i,12,[s,d]);else{const A=Yt(l),U=Rn(l);if(A||U){const O=()=>{if(e.f){const $=A?y(l)?v[l]:d[l]:T()||!e.k?l.value:d[e.k];if(o)at($)&&_f($,a);else if(at($))$.includes(a)||$.push(a);else if(A)d[l]=[a],y(l)&&(v[l]=d[l]);else{const q=[a];T(l,e.k)&&(l.value=q),e.k&&(d[e.k]=q)}}else A?(d[l]=s,y(l)&&(v[l]=s)):U&&(T(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const $=()=>{O(),Xu.delete(e)};$.id=-1,Xu.set(e,$),sr($,n)}else ih(e),O()}}}function ih(e){const t=Xu.get(e);t&&(t.flags|=8,Xu.delete(e))}const lh=e=>e.nodeType===8;yc().requestIdleCallback;yc().cancelIdleCallback;function U0(e,t){if(lh(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(lh(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const rl=e=>!!e.type.__asyncLoader;function xo(e){ft(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let c=null,d,v=0;const f=()=>(v++,c=null,y()),y=()=>{let T;return c||(T=c=t().catch(A=>{if(A=A instanceof Error?A:new Error(String(A)),l)return new Promise((U,O)=>{l(A,()=>U(f()),()=>O(A),v+1)});throw A}).then(A=>T!==c&&c?c:(A&&(A.__esModule||A[Symbol.toStringTag]==="Module")&&(A=A.default),d=A,A)))};return yn({name:"AsyncComponentWrapper",__asyncLoader:y,__asyncHydrate(T,A,U){const O=T.isConnected;let $=!1;(A.bu||(A.bu=[])).push(()=>$=!0);const q=()=>{$||!T.parentNode||O&&!T.isConnected||U()},R=a?()=>{const pe=a(q,ce=>U0(T,ce));pe&&(A.bum||(A.bum=[])).push(pe)}:q;d?R():y().then(()=>!A.isUnmounted&&R())},get __asyncResolved(){return d},setup(){const T=Un;if(Ff(T),d)return()=>Mu(d,T);const A=pe=>{c=null,au(pe,T,13,!r)};if(i&&T.suspense||pl)return y().then(pe=>()=>Mu(pe,T)).catch(pe=>(A(pe),()=>r?Fe(r,{error:pe}):null));const U=S(!1),O=S(),$=S(!!o);let q,R;return iu(()=>{q!=null&&clearTimeout(q),R!=null&&clearTimeout(R)}),o&&(R=setTimeout(()=>{T.isUnmounted||($.value=!1)},o)),s!=null&&(q=setTimeout(()=>{if(!T.isUnmounted&&!U.value&&!O.value){const pe=new Error(`Async component timed out after ${s}ms.`);A(pe),O.value=pe}},s)),y().then(()=>{T.isUnmounted||(U.value=!0,T.parent&&su(T.parent.vnode)&&T.parent.update())}).catch(pe=>{if(T.isUnmounted){c=null;return}A(pe),O.value=pe}),()=>{if(U.value&&d)return Mu(d,T);if(O.value&&r)return Fe(r,{error:O.value});if(n&&!$.value)return Mu(n,T)}}})}function Mu(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=Fe(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const su=e=>e.type.__isKeepAlive;function z0(e,t){ig(e,"a",t)}function H0(e,t){ig(e,"da",t)}function ig(e,t,n=Un){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Tc(t,r,n),n){let o=n.parent;for(;o&&o.parent;)su(o.parent.vnode)&&W0(r,t,n,o),o=o.parent}}function W0(e,t,n,r){const o=Tc(t,e,r,!0);iu(()=>{_f(r[t],o)},n)}function Tc(e,t,n=Un,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Ya();const i=lu(n),l=oo(t,n,e,s);return i(),Ja(),l});return r?o.unshift(a):o.push(a),a}}const Za=e=>(t,n=Un)=>{(!pl||e==="sp")&&Tc(e,(...r)=>t(...r),n)},q0=Za("bm"),Ii=Za("m"),G0=Za("bu"),V0=Za("u"),Gs=Za("bum"),iu=Za("um"),K0=Za("sp"),Y0=Za("rtg"),J0=Za("rtc");function Q0(e,t=Un){Tc("ec",e,t)}const X0="components",lg=Symbol.for("v-ndc");function Bf(e){return Yt(e)?Z0(X0,e,!1)||e:e||lg}function Z0(e,t,n=!0,r=!1){const o=zn||Un;if(o){const a=o.type;{const i=OS(a,!1);if(i&&(i===t||i===cr(t)||i===gc(cr(t))))return a}const s=uh(o[e]||a[e],t)||uh(o.appContext[e],t);return!s&&r?a:s}}function uh(e,t){return e&&(e[t]||e[cr(t)]||e[gc(cr(t))])}function on(e,t,n,r){let o;const a=n,s=at(e);if(s||Yt(e)){const i=s&&Si(e);let l=!1,c=!1;i&&(l=!no(e),c=Qa(e),e=wc(e)),o=new Array(e.length);for(let d=0,v=e.length;d<v;d++)o[d]=t(l?c?cl(jo(e[d])):jo(e[d]):e[d],d,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let i=0;i<e;i++)o[i]=t(i+1,i,void 0,a)}else if($t(e))if(e[Symbol.iterator])o=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);o=new Array(i.length);for(let l=0,c=i.length;l<c;l++){const d=i[l];o[l]=t(e[d],d,l,a)}}else o=[];return o}function br(e,t,n={},r,o,a){if(zn.ce||zn.parent&&rl(zn.parent)&&zn.parent.ce){const c=a!=null&&n.key==null?gn({},n,{key:a}):n,d=Object.keys(c).length>0;return t!=="default"&&(c.name=t),P(),tt(ut,null,[Fe("slot",c,r)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=Va.length;P();let l;try{const c=s&&ug(s(n)),d=n.key||a||c&&c.key;l=tt(ut,{key:(d&&!Ro(d)?d:`_${t}`)+(!c&&r?"_fb":"")},c||(r?r():[]),c&&e._===1?64:-2)}catch(c){for(let d=Va.length;d>i;d--)Wf();throw c}finally{s&&s._c&&(s._d=!0)}return l}function ug(e){return e.some(t=>Xl(t)?!(t.type===Qn||t.type===ut&&!ug(t.children)):!0)?e:null}const Qd=e=>e?_g(e)?xc(e):Qd(e.parent):null,Wl=gn(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=>Qd(e.parent),$root:e=>Qd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>dg(e),$forceUpdate:e=>e.f||(e.f=()=>{Df(e.update)}),$nextTick:e=>e.n||(e.n=Ft.bind(e.proxy)),$watch:e=>L0.bind(e)}),md=(e,t)=>e!==Ut&&!e.__isScriptSetup&&Ot(e,t),eS={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(md(r,t))return s[t]=1,r[t];if(o!==Ut&&Ot(o,t))return s[t]=2,o[t];if(Ot(a,t))return s[t]=3,a[t];if(n!==Ut&&Ot(n,t))return s[t]=4,n[t];Xd&&(s[t]=0)}}const c=Wl[t];let d,v;if(c)return t==="$attrs"&&Jn(e.attrs,"get",""),c(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==Ut&&Ot(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Ot(v,t))return v[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return md(o,t)?(o[t]=n,!0):r!==Ut&&Ot(r,t)?(r[t]=n,!0):Ot(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},i){let l;return!!(n[i]||e!==Ut&&i[0]!=="$"&&Ot(e,i)||md(t,i)||Ot(a,i)||Ot(r,i)||Ot(Wl,i)||Ot(o.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ot(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function tS(){return nS().slots}function nS(e){const t=Gf();return t.setupContext||(t.setupContext=Mg(t))}function ch(e){return at(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Xd=!0;function rS(e){const t=dg(e),n=e.proxy,r=e.ctx;Xd=!1,t.beforeCreate&&dh(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:i,provide:l,inject:c,created:d,beforeMount:v,mounted:f,beforeUpdate:y,updated:T,activated:A,deactivated:U,beforeDestroy:O,beforeUnmount:$,destroyed:q,unmounted:R,render:pe,renderTracked:ce,renderTriggered:K,errorCaptured:le,serverPrefetch:ye,expose:Pe,inheritAttrs:ge,components:ee,directives:me,filters:re}=t;if(c&&oS(c,r,null),s)for(const Ne in s){const Le=s[Ne];ft(Le)&&(r[Ne]=Le.bind(n))}if(o){const Ne=o.call(n,n);$t(Ne)&&(e.data=bc(Ne))}if(Xd=!0,a)for(const Ne in a){const Le=a[Ne],Ce=ft(Le)?Le.bind(n,n):ft(Le.get)?Le.get.bind(n,n):ga,Se=!ft(Le)&&ft(Le.set)?Le.set.bind(n):ga,xe=Y({get:Ce,set:Se});Object.defineProperty(r,Ne,{enumerable:!0,configurable:!0,get:()=>xe.value,set:Me=>xe.value=Me})}if(i)for(const Ne in i)cg(i[Ne],r,n,Ne);if(l){const Ne=ft(l)?l.call(n):l;Reflect.ownKeys(Ne).forEach(Le=>{Wu(Le,Ne[Le])})}d&&dh(d,e,"c");function De(Ne,Le){at(Le)?Le.forEach(Ce=>Ne(Ce.bind(n))):Le&&Ne(Le.bind(n))}if(De(q0,v),De(Ii,f),De(G0,y),De(V0,T),De(z0,A),De(H0,U),De(Q0,le),De(J0,ce),De(Y0,K),De(Gs,$),De(iu,R),De(K0,ye),at(Pe))if(Pe.length){const Ne=e.exposed||(e.exposed={});Pe.forEach(Le=>{Object.defineProperty(Ne,Le,{get:()=>n[Le],set:Ce=>n[Le]=Ce,enumerable:!0})})}else e.exposed||(e.exposed={});pe&&e.render===ga&&(e.render=pe),ge!=null&&(e.inheritAttrs=ge),ee&&(e.components=ee),me&&(e.directives=me),ye&&Ff(e)}function oS(e,t,n=ga){at(e)&&(e=Zd(e));for(const r in e){const o=e[r];let a;$t(o)?"default"in o?a=Eo(o.from||r,o.default,!0):a=Eo(o.from||r):a=Eo(o),Rn(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function dh(e,t,n){oo(at(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function cg(e,t,n,r){let o=r.includes(".")?Zv(n,r):()=>n[r];if(Yt(e)){const a=t[e];ft(a)&&rt(o,a)}else if(ft(e))rt(o,e.bind(n));else if($t(e))if(at(e))e.forEach(a=>cg(a,t,n,r));else{const a=ft(e.handler)?e.handler.bind(n):t[e.handler];ft(a)&&rt(o,a,e)}}function dg(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(c=>Zu(l,c,s,!0)),Zu(l,t,s)),$t(t)&&a.set(t,l),l}function Zu(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&Zu(e,a,n,!0),o&&o.forEach(s=>Zu(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const i=aS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const aS={data:fh,props:ph,emits:ph,methods:$l,computed:$l,beforeCreate:ar,created:ar,beforeMount:ar,mounted:ar,beforeUpdate:ar,updated:ar,beforeDestroy:ar,beforeUnmount:ar,destroyed:ar,unmounted:ar,activated:ar,deactivated:ar,errorCaptured:ar,serverPrefetch:ar,components:$l,directives:$l,watch:iS,provide:fh,inject:sS};function fh(e,t){return t?e?function(){return gn(ft(e)?e.call(this,this):e,ft(t)?t.call(this,this):t)}:t:e}function sS(e,t){return $l(Zd(e),Zd(t))}function Zd(e){if(at(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ar(e,t){return e?[...new Set([].concat(e,t))]:t}function $l(e,t){return e?gn(Object.create(null),e,t):t}function ph(e,t){return e?at(e)&&at(t)?[...new Set([...e,...t])]:gn(Object.create(null),ch(e),ch(t??{})):t}function iS(e,t){if(!e)return t;if(!t)return e;const n=gn(Object.create(null),e);for(const r in t)n[r]=ar(e[r],t[r]);return n}function fg(){return{app:null,config:{isNativeTag:Tv,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 lS=0;function uS(e,t){return function(r,o=null){ft(r)||(r=gn({},r)),o!=null&&!$t(o)&&(o=null);const a=fg(),s=new WeakSet,i=[];let l=!1;const c=a.app={_uid:lS++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:FS,get config(){return a.config},set config(d){},use(d,...v){return s.has(d)||(d&&ft(d.install)?(s.add(d),d.install(c,...v)):ft(d)&&(s.add(d),d(c,...v))),c},mixin(d){return a.mixins.includes(d)||a.mixins.push(d),c},component(d,v){return v?(a.components[d]=v,c):a.components[d]},directive(d,v){return v?(a.directives[d]=v,c):a.directives[d]},mount(d,v,f){if(!l){const y=c._ceVNode||Fe(r,o);return y.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(y,d,f),l=!0,c._container=d,d.__vue_app__=c,xc(y.component)}},onUnmount(d){i.push(d)},unmount(){l&&(oo(i,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(d,v){return a.provides[d]=v,c},runWithContext(d){const v=ol;ol=c;try{return d()}finally{ol=v}}};return c}}let ol=null;const cS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${cr(t)}Modifiers`]||e[`${qs(t)}Modifiers`];function dS(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ut;let o=n;const a=t.startsWith("update:"),s=a&&cS(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Yt(d)?d.trim():d)),s.number&&(o=n.map(Mf)));let i,l=r[i=ud(t)]||r[i=ud(cr(t))];!l&&a&&(l=r[i=ud(qs(t))]),l&&oo(l,e,6,o);const c=r[i+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,oo(c,e,6,o)}}const fS=new WeakMap;function pg(e,t,n=!1){const r=n?fS:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},i=!1;if(!ft(e)){const l=c=>{const d=pg(c,t,!0);d&&(i=!0,gn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?($t(e)&&r.set(e,null),null):(at(a)?a.forEach(l=>s[l]=null):gn(s,a),$t(e)&&r.set(e,s),s)}function Sc(e,t){return!e||!pc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Ot(e,t[0].toLowerCase()+t.slice(1))||Ot(e,qs(t))||Ot(e,t))}function hh(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:i,emit:l,render:c,renderCache:d,props:v,data:f,setupState:y,ctx:T,inheritAttrs:A}=e,U=Qu(e);let O,$;try{if(n.shapeFlag&4){const R=o||r,pe=R;O=ma(c.call(pe,R,d,v,y,f,T)),$=i}else{const R=t;O=ma(R.length>1?R(v,{attrs:i,slots:s,emit:l}):R(v,null)),$=t.props?i:pS(i)}}catch(R){Va.length=0,au(R,e,1),O=Fe(Qn)}let q=O;if($&&A!==!1){const R=Object.keys($),{shapeFlag:pe}=q;R.length&&pe&7&&(a&&R.some(hc)&&($=hS($,a)),q=Hs(q,$,!1,!0))}return n.dirs&&(q=Hs(q,null,!1,!0),q.dirs=q.dirs?q.dirs.concat(n.dirs):n.dirs),n.transition&&Ql(q,n.transition),O=q,Qu(U),O}const pS=e=>{let t;for(const n in e)(n==="class"||n==="style"||pc(n))&&((t||(t={}))[n]=e[n]);return t},hS=(e,t)=>{const n={};for(const r in e)(!hc(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function mS(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:i,patchFlag:l}=t,c=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?mh(r,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let v=0;v<d.length;v++){const f=d[v];if(hg(s,r,f)&&!Sc(c,f))return!0}}}else return(o||i)&&(!i||!i.$stable)?!0:r===s?!1:r?s?mh(r,s,c):!0:!!s;return!1}function mh(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 a=r[o];if(hg(t,e,a)&&!Sc(n,a))return!0}return!1}function hg(e,t,n){const r=e[n],o=t[n];return n==="style"&&$t(r)&&$t(o)?!ru(r,o):r!==o}function vS({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 mg={},vg=()=>Object.create(mg),gg=e=>Object.getPrototypeOf(e)===mg;function gS(e,t,n,r=!1){const o={},a=vg();e.propsDefaults=Object.create(null),yg(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:Wv(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function yS(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,i=Rt(o),[l]=e.propsOptions;let c=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let v=0;v<d.length;v++){let f=d[v];if(Sc(e.emitsOptions,f))continue;const y=t[f];if(l)if(Ot(a,f))y!==a[f]&&(a[f]=y,c=!0);else{const T=cr(f);o[T]=ef(l,i,T,y,e,!1)}else y!==a[f]&&(a[f]=y,c=!0)}}}else{yg(e,t,o,a)&&(c=!0);let d;for(const v in i)(!t||!Ot(t,v)&&((d=qs(v))===v||!Ot(t,d)))&&(l?n&&(n[v]!==void 0||n[d]!==void 0)&&(o[v]=ef(l,i,v,void 0,e,!0)):delete o[v]);if(a!==i)for(const v in a)(!t||!Ot(t,v))&&(delete a[v],c=!0)}c&&Wa(e.attrs,"set","")}function yg(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Bl(l))continue;const c=t[l];let d;o&&Ot(o,d=cr(l))?!a||!a.includes(d)?n[d]=c:(i||(i={}))[d]=c:Sc(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,s=!0)}if(a){const l=Rt(n),c=i||Ut;for(let d=0;d<a.length;d++){const v=a[d];n[v]=ef(o,l,v,c[v],e,!Ot(c,v))}}return s}function ef(e,t,n,r,o,a){const s=e[n];if(s!=null){const i=Ot(s,"default");if(i&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ft(l)){const{propsDefaults:c}=o;if(n in c)r=c[n];else{const d=lu(o);r=c[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!i?r=!1:s[1]&&(r===""||r===qs(n))&&(r=!0))}return r}const wS=new WeakMap;function wg(e,t,n=!1){const r=n?wS:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},i=[];let l=!1;if(!ft(e)){const d=v=>{l=!0;const[f,y]=wg(v,t,!0);gn(s,f),y&&i.push(...y)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!a&&!l)return $t(e)&&r.set(e,el),el;if(at(a))for(let d=0;d<a.length;d++){const v=cr(a[d]);vh(v)&&(s[v]=Ut)}else if(a)for(const d in a){const v=cr(d);if(vh(v)){const f=a[d],y=s[v]=at(f)||ft(f)?{type:f}:gn({},f),T=y.type;let A=!1,U=!0;if(at(T))for(let O=0;O<T.length;++O){const $=T[O],q=ft($)&&$.name;if(q==="Boolean"){A=!0;break}else q==="String"&&(U=!1)}else A=ft(T)&&T.name==="Boolean";y[0]=A,y[1]=U,(A||Ot(y,"default"))&&i.push(v)}}const c=[s,i];return $t(e)&&r.set(e,c),c}function vh(e){return e[0]!=="$"&&!Bl(e)}const Uf=e=>e==="_"||e==="_ctx"||e==="$stable",zf=e=>at(e)?e.map(ma):[ma(e)],bS=(e,t,n)=>{if(t._n)return t;const r=dt((...o)=>zf(t(...o)),n);return r._c=!1,r},bg=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Uf(o))continue;const a=e[o];if(ft(a))t[o]=bS(o,a,r);else if(a!=null){const s=zf(a);t[o]=()=>s}}},Tg=(e,t)=>{const n=zf(t);e.slots.default=()=>n},Sg=(e,t,n)=>{for(const r in t)(n||!Uf(r))&&(e[r]=t[r])},TS=(e,t,n)=>{const r=e.slots=vg();if(e.vnode.shapeFlag&32){const o=t._;o?(Sg(r,t,n),n&&kv(r,"_",o,!0)):bg(t,r)}else t&&Tg(e,t)},SS=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=Ut;if(r.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:Sg(o,t,n):(a=!t.$stable,bg(t,o)),s=t}else t&&(Tg(e,t),s={default:1});if(a)for(const i in o)!Uf(i)&&s[i]==null&&delete o[i]},sr=AS;function CS(e){return xS(e)}function xS(e,t){const n=yc();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:i,createComment:l,setText:c,setElementText:d,parentNode:v,nextSibling:f,setScopeId:y=ga,insertStaticContent:T}=e,A=(_,E,z,ue=null,ne=null,ae=null,_e=void 0,Oe=null,ke=!!E.dynamicChildren)=>{if(_===E)return;_&&!yi(_,E)&&(ue=N(_),Me(_,ne,ae,!0),_=null),E.patchFlag===-2&&(ke=!1,E.dynamicChildren=null);const{type:he,ref:Ke,shapeFlag:$e}=E;switch(he){case Cc:U(_,E,z,ue);break;case Qn:O(_,E,z,ue);break;case gd:_==null&&$(E,z,ue,_e);break;case ut:ee(_,E,z,ue,ne,ae,_e,Oe,ke);break;default:$e&1?pe(_,E,z,ue,ne,ae,_e,Oe,ke):$e&6?me(_,E,z,ue,ne,ae,_e,Oe,ke):($e&64||$e&128)&&he.process(_,E,z,ue,ne,ae,_e,Oe,ke,je)}Ke!=null&&ne?Hl(Ke,_&&_.ref,ae,E||_,!E):Ke==null&&_&&_.ref!=null&&Hl(_.ref,null,ae,_,!0)},U=(_,E,z,ue)=>{if(_==null)r(E.el=i(E.children),z,ue);else{const ne=E.el=_.el;E.children!==_.children&&c(ne,E.children)}},O=(_,E,z,ue)=>{_==null?r(E.el=l(E.children||""),z,ue):E.el=_.el},$=(_,E,z,ue)=>{[_.el,_.anchor]=T(_.children,E,z,ue,_.el,_.anchor)},q=({el:_,anchor:E},z,ue)=>{let ne;for(;_&&_!==E;)ne=f(_),r(_,z,ue),_=ne;r(E,z,ue)},R=({el:_,anchor:E})=>{let z;for(;_&&_!==E;)z=f(_),o(_),_=z;o(E)},pe=(_,E,z,ue,ne,ae,_e,Oe,ke)=>{if(E.type==="svg"?_e="svg":E.type==="math"&&(_e="mathml"),_==null)ce(E,z,ue,ne,ae,_e,Oe,ke);else{const he=_.el&&_.el._isVueCE?_.el:null;try{he&&he._beginPatch(),ye(_,E,ne,ae,_e,Oe,ke)}finally{he&&he._endPatch()}}},ce=(_,E,z,ue,ne,ae,_e,Oe)=>{let ke,he;const{props:Ke,shapeFlag:$e,transition:qe,dirs:Ge}=_;if(ke=_.el=s(_.type,ae,Ke&&Ke.is,Ke),$e&8?d(ke,_.children):$e&16&&le(_.children,ke,null,ue,ne,vd(_,ae),_e,Oe),Ge&&ci(_,null,ue,"created"),K(ke,_,_.scopeId,_e,ue),Ke){for(const bt in Ke)bt!=="value"&&!Bl(bt)&&a(ke,bt,null,Ke[bt],ae,ue);"value"in Ke&&a(ke,"value",null,Ke.value,ae),(he=Ke.onVnodeBeforeMount)&&fa(he,ue,_)}Ge&&ci(_,null,ue,"beforeMount");const ct=kS(ne,qe);ct&&qe.beforeEnter(ke),r(ke,E,z),((he=Ke&&Ke.onVnodeMounted)||ct||Ge)&&sr(()=>{try{he&&fa(he,ue,_),ct&&qe.enter(ke),Ge&&ci(_,null,ue,"mounted")}finally{}},ne)},K=(_,E,z,ue,ne)=>{if(z&&y(_,z),ue)for(let ae=0;ae<ue.length;ae++)y(_,ue[ae]);if(ne){let ae=ne.subTree;if(E===ae||kg(ae.type)&&(ae.ssContent===E||ae.ssFallback===E)){const _e=ne.vnode;K(_,_e,_e.scopeId,_e.slotScopeIds,ne.parent)}}},le=(_,E,z,ue,ne,ae,_e,Oe,ke=0)=>{for(let he=ke;he<_.length;he++){const Ke=_[he]=Oe?Ha(_[he]):ma(_[he]);A(null,Ke,E,z,ue,ne,ae,_e,Oe)}},ye=(_,E,z,ue,ne,ae,_e)=>{const Oe=E.el=_.el;let{patchFlag:ke,dynamicChildren:he,dirs:Ke}=E;ke|=_.patchFlag&16;const $e=_.props||Ut,qe=E.props||Ut;let Ge;if(z&&di(z,!1),(Ge=qe.onVnodeBeforeUpdate)&&fa(Ge,z,E,_),Ke&&ci(E,_,z,"beforeUpdate"),z&&di(z,!0),he&&(!_.dynamicChildren||_.dynamicChildren.length!==he.length)&&(ke=0,_e=!1,he=null),($e.innerHTML&&qe.innerHTML==null||$e.textContent&&qe.textContent==null)&&d(Oe,""),he?Pe(_.dynamicChildren,he,Oe,z,ue,vd(E,ne),ae):_e||Le(_,E,Oe,null,z,ue,vd(E,ne),ae,!1),ke>0){if(ke&16)ge(Oe,$e,qe,z,ne);else if(ke&2&&$e.class!==qe.class&&a(Oe,"class",null,qe.class,ne),ke&4&&a(Oe,"style",$e.style,qe.style,ne),ke&8){const ct=E.dynamicProps;for(let bt=0;bt<ct.length;bt++){const nt=ct[bt],it=$e[nt],J=qe[nt];(J!==it||nt==="value")&&a(Oe,nt,it,J,ne,z)}}ke&1&&_.children!==E.children&&d(Oe,E.children)}else!_e&&he==null&&ge(Oe,$e,qe,z,ne);((Ge=qe.onVnodeUpdated)||Ke)&&sr(()=>{Ge&&fa(Ge,z,E,_),Ke&&ci(E,_,z,"updated")},ue)},Pe=(_,E,z,ue,ne,ae,_e)=>{for(let Oe=0;Oe<E.length;Oe++){const ke=_[Oe],he=E[Oe],Ke=ke.el&&(ke.type===ut||!yi(ke,he)||ke.shapeFlag&198)?v(ke.el):z;A(ke,he,Ke,null,ue,ne,ae,_e,!0)}},ge=(_,E,z,ue,ne)=>{if(E!==z){if(E!==Ut)for(const ae in E)!Bl(ae)&&!(ae in z)&&a(_,ae,E[ae],null,ne,ue);for(const ae in z){if(Bl(ae))continue;const _e=z[ae],Oe=E[ae];_e!==Oe&&ae!=="value"&&a(_,ae,Oe,_e,ne,ue)}"value"in z&&a(_,"value",E.value,z.value,ne)}},ee=(_,E,z,ue,ne,ae,_e,Oe,ke)=>{const he=E.el=_?_.el:i(""),Ke=E.anchor=_?_.anchor:i("");let{patchFlag:$e,dynamicChildren:qe,slotScopeIds:Ge}=E;Ge&&(Oe=Oe?Oe.concat(Ge):Ge),_==null?(r(he,z,ue),r(Ke,z,ue),le(E.children||[],z,Ke,ne,ae,_e,Oe,ke)):$e>0&&$e&64&&qe&&_.dynamicChildren&&_.dynamicChildren.length===qe.length?(Pe(_.dynamicChildren,qe,z,ne,ae,_e,Oe),(E.key!=null||ne&&E===ne.subTree)&&Hf(_,E,!0)):Le(_,E,z,Ke,ne,ae,_e,Oe,ke)},me=(_,E,z,ue,ne,ae,_e,Oe,ke)=>{E.slotScopeIds=Oe,_==null?E.shapeFlag&512?ne.ctx.activate(E,z,ue,_e,ke):re(E,z,ue,ne,ae,_e,ke):Ie(_,E,ke)},re=(_,E,z,ue,ne,ae,_e)=>{const Oe=_.component=RS(_,ue,ne);if(su(_)&&(Oe.ctx.renderer=je),jS(Oe,!1,_e),Oe.asyncDep){if(ne&&ne.registerDep(Oe,De,_e),!_.el){const ke=Oe.subTree=Fe(Qn);O(null,ke,E,z),_.placeholder=ke.el}}else De(Oe,_,E,z,ne,ae,_e)},Ie=(_,E,z)=>{const ue=E.component=_.component;if(mS(_,E,z))if(ue.asyncDep&&!ue.asyncResolved){Ne(ue,E,z);return}else ue.next=E,ue.update();else E.el=_.el,ue.vnode=E},De=(_,E,z,ue,ne,ae,_e)=>{const Oe=()=>{if(_.isMounted){let{next:$e,bu:qe,u:Ge,parent:ct,vnode:bt}=_;{const Te=Cg(_);if(Te){$e&&($e.el=bt.el,Ne(_,$e,_e)),Te.asyncDep.then(()=>{sr(()=>{_.isUnmounted||he()},ne)});return}}let nt=$e,it;di(_,!1),$e?($e.el=bt.el,Ne(_,$e,_e)):$e=bt,qe&&Hu(qe),(it=$e.props&&$e.props.onVnodeBeforeUpdate)&&fa(it,ct,$e,bt),di(_,!0);const J=hh(_),fe=_.subTree;_.subTree=J,A(fe,J,v(fe.el),N(fe),_,ne,ae),$e.el=J.el,nt===null&&vS(_,J.el),Ge&&sr(Ge,ne),(it=$e.props&&$e.props.onVnodeUpdated)&&sr(()=>fa(it,ct,$e,bt),ne)}else{let $e;const{el:qe,props:Ge}=E,{bm:ct,m:bt,parent:nt,root:it,type:J}=_,fe=rl(E);di(_,!1),ct&&Hu(ct),!fe&&($e=Ge&&Ge.onVnodeBeforeMount)&&fa($e,nt,E),di(_,!0);{it.ce&&it.ce._hasShadowRoot()&&it.ce._injectChildStyle(J,_.parent?_.parent.type:void 0);const Te=_.subTree=hh(_);A(null,Te,z,ue,_,ne,ae),E.el=Te.el}if(bt&&sr(bt,ne),!fe&&($e=Ge&&Ge.onVnodeMounted)){const Te=E;sr(()=>fa($e,nt,Te),ne)}(E.shapeFlag&256||nt&&rl(nt.vnode)&&nt.vnode.shapeFlag&256)&&_.a&&sr(_.a,ne),_.isMounted=!0,E=z=ue=null}};_.scope.on();const ke=_.effect=new Mv(Oe);_.scope.off();const he=_.update=ke.run.bind(ke),Ke=_.job=ke.runIfDirty.bind(ke);Ke.i=_,Ke.id=_.uid,ke.scheduler=()=>Df(Ke),di(_,!0),he()},Ne=(_,E,z)=>{E.component=_;const ue=_.vnode.props;_.vnode=E,_.next=null,yS(_,E.props,ue,z),SS(_,E.children,z),Ya(),nh(_),Ja()},Le=(_,E,z,ue,ne,ae,_e,Oe,ke=!1)=>{const he=_&&_.children,Ke=_?_.shapeFlag:0,$e=E.children,{patchFlag:qe,shapeFlag:Ge}=E;if(qe>0){if(qe&128){Se(he,$e,z,ue,ne,ae,_e,Oe,ke);return}else if(qe&256){Ce(he,$e,z,ue,ne,ae,_e,Oe,ke);return}}Ge&8?(Ke&16&&de(he,ne,ae),$e!==he&&d(z,$e)):Ke&16?Ge&16?Se(he,$e,z,ue,ne,ae,_e,Oe,ke):de(he,ne,ae,!0):(Ke&8&&d(z,""),Ge&16&&le($e,z,ue,ne,ae,_e,Oe,ke))},Ce=(_,E,z,ue,ne,ae,_e,Oe,ke)=>{_=_||el,E=E||el;const he=_.length,Ke=E.length,$e=Math.min(he,Ke);let qe;for(qe=0;qe<$e;qe++){const Ge=E[qe]=ke?Ha(E[qe]):ma(E[qe]);A(_[qe],Ge,z,null,ne,ae,_e,Oe,ke)}he>Ke?de(_,ne,ae,!0,!1,$e):le(E,z,ue,ne,ae,_e,Oe,ke,$e)},Se=(_,E,z,ue,ne,ae,_e,Oe,ke)=>{let he=0;const Ke=E.length;let $e=_.length-1,qe=Ke-1;for(;he<=$e&&he<=qe;){const Ge=_[he],ct=E[he]=ke?Ha(E[he]):ma(E[he]);if(yi(Ge,ct))A(Ge,ct,z,null,ne,ae,_e,Oe,ke);else break;he++}for(;he<=$e&&he<=qe;){const Ge=_[$e],ct=E[qe]=ke?Ha(E[qe]):ma(E[qe]);if(yi(Ge,ct))A(Ge,ct,z,null,ne,ae,_e,Oe,ke);else break;$e--,qe--}if(he>$e){if(he<=qe){const Ge=qe+1,ct=Ge<Ke?E[Ge].el:ue;for(;he<=qe;)A(null,E[he]=ke?Ha(E[he]):ma(E[he]),z,ct,ne,ae,_e,Oe,ke),he++}}else if(he>qe)for(;he<=$e;)Me(_[he],ne,ae,!0),he++;else{const Ge=he,ct=he,bt=new Map;for(he=ct;he<=qe;he++){const yt=E[he]=ke?Ha(E[he]):ma(E[he]);yt.key!=null&&bt.set(yt.key,he)}let nt,it=0;const J=qe-ct+1;let fe=!1,Te=0;const Be=new Array(J);for(he=0;he<J;he++)Be[he]=0;for(he=Ge;he<=$e;he++){const yt=_[he];if(it>=J){Me(yt,ne,ae,!0);continue}let Dt;if(yt.key!=null)Dt=bt.get(yt.key);else for(nt=ct;nt<=qe;nt++)if(Be[nt-ct]===0&&yi(yt,E[nt])){Dt=nt;break}Dt===void 0?Me(yt,ne,ae,!0):(Be[Dt-ct]=he+1,Dt>=Te?Te=Dt:fe=!0,A(yt,E[Dt],z,null,ne,ae,_e,Oe,ke),it++)}const Tt=fe?IS(Be):el;for(nt=Tt.length-1,he=J-1;he>=0;he--){const yt=ct+he,Dt=E[yt],No=E[yt+1],Gt=yt+1<Ke?No.el||xg(No):ue;Be[he]===0?A(null,Dt,z,Gt,ne,ae,_e,Oe,ke):fe&&(nt<0||he!==Tt[nt]?xe(Dt,z,Gt,2):nt--)}}},xe=(_,E,z,ue,ne=null)=>{const{el:ae,type:_e,transition:Oe,children:ke,shapeFlag:he}=_;if(he&6){xe(_.component.subTree,E,z,ue);return}if(he&128){_.suspense.move(E,z,ue);return}if(he&64){_e.move(_,E,z,je);return}if(_e===ut){r(ae,E,z);for(let $e=0;$e<ke.length;$e++)xe(ke[$e],E,z,ue);r(_.anchor,E,z);return}if(_e===gd){q(_,E,z);return}if(ue!==2&&he&1&&Oe)if(ue===0)Oe.persisted&&!ae[eo]?r(ae,E,z):(Oe.beforeEnter(ae),r(ae,E,z),sr(()=>Oe.enter(ae),ne));else{const{leave:$e,delayLeave:qe,afterLeave:Ge}=Oe,ct=()=>{_.ctx.isUnmounted?o(ae):r(ae,E,z)},bt=()=>{const nt=ae._isLeaving||!!ae[eo];ae._isLeaving&&ae[eo](!0),Oe.persisted&&!nt?ct():$e(ae,()=>{ct(),Ge&&Ge()})};qe?qe(ae,ct,bt):bt()}else r(ae,E,z)},Me=(_,E,z,ue=!1,ne=!1)=>{const{type:ae,props:_e,ref:Oe,children:ke,dynamicChildren:he,shapeFlag:Ke,patchFlag:$e,dirs:qe,cacheIndex:Ge,memo:ct}=_;if($e===-2&&(ne=!1),Oe!=null&&(Ya(),Hl(Oe,null,z,_,!0),Ja()),Ge!=null&&(E.renderCache[Ge]=void 0),Ke&256){E.ctx.deactivate(_);return}const bt=Ke&1&&qe,nt=!rl(_);let it;if(nt&&(it=_e&&_e.onVnodeBeforeUnmount)&&fa(it,E,_),Ke&6)st(_.component,z,ue);else{if(Ke&128){_.suspense.unmount(z,ue);return}bt&&ci(_,null,E,"beforeUnmount"),Ke&64?_.type.remove(_,E,z,je,ue):he&&!he.hasOnce&&(ae!==ut||$e>0&&$e&64)?de(he,E,z,!1,!0):(ae===ut&&$e&384||!ne&&Ke&16)&&de(ke,E,z),ue&&Je(_)}const J=ct!=null&&Ge==null;(nt&&(it=_e&&_e.onVnodeUnmounted)||bt||J)&&sr(()=>{it&&fa(it,E,_),bt&&ci(_,null,E,"unmounted"),J&&(_.el=null)},z)},Je=_=>{const{type:E,el:z,anchor:ue,transition:ne}=_;if(E===ut){Xe(z,ue);return}if(E===gd){R(_);return}const ae=()=>{o(z),ne&&!ne.persisted&&ne.afterLeave&&ne.afterLeave()};if(_.shapeFlag&1&&ne&&!ne.persisted){const{leave:_e,delayLeave:Oe}=ne,ke=()=>_e(z,ae);Oe?Oe(_.el,ae,ke):ke()}else ae()},Xe=(_,E)=>{let z;for(;_!==E;)z=f(_),o(_),_=z;o(E)},st=(_,E,z)=>{const{bum:ue,scope:ne,job:ae,subTree:_e,um:Oe,m:ke,a:he}=_;gh(ke),gh(he),ue&&Hu(ue),ne.stop(),ae&&(ae.flags|=8,Me(_e,_,E,z)),Oe&&sr(Oe,E),sr(()=>{_.isUnmounted=!0},E)},de=(_,E,z,ue=!1,ne=!1,ae=0)=>{for(let _e=ae;_e<_.length;_e++)Me(_[_e],E,z,ue,ne)},N=_=>{if(_.shapeFlag&6)return N(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const E=f(_.anchor||_.el),z=E&&E[eg];return z?f(z):E};let oe=!1;const se=(_,E,z)=>{let ue;_==null?E._vnode&&(Me(E._vnode,null,null,!0),ue=E._vnode.component):A(E._vnode||null,_,E,null,null,null,z),E._vnode=_,oe||(oe=!0,nh(ue),Yv(),oe=!1)},je={p:A,um:Me,m:xe,r:Je,mt:re,mc:le,pc:Le,pbc:Pe,n:N,o:e};return{render:se,hydrate:void 0,createApp:uS(se)}}function vd({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 di({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function kS(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Hf(e,t,n=!1){const r=e.children,o=t.children;if(at(r)&&at(o))for(let a=0;a<r.length;a++){const s=r[a];let i=o[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=o[a]=Ha(o[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Hf(s,i)),i.type===Cc&&(i.patchFlag===-1&&(i=o[a]=Ha(i)),i.el=s.el),i.type===Qn&&!i.el&&(i.el=s.el)}}function IS(e){const t=e.slice(),n=[0];let r,o,a,s,i;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(o=n[n.length-1],e[o]<c){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<c?a=i+1:s=i;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Cg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Cg(t)}function gh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function xg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?xg(t.subTree):null}const kg=e=>e.__isSuspense;function AS(e,t){t&&t.pendingBranch?at(e)?t.effects.push(...e):t.effects.push(e):E0(e)}const ut=Symbol.for("v-fgt"),Cc=Symbol.for("v-txt"),Qn=Symbol.for("v-cmt"),gd=Symbol.for("v-stc"),Va=[];let ur=null;function P(e=!1){Va.push(ur=e?null:[])}function Wf(){Va.pop(),ur=Va[Va.length-1]||null}let fl=1;function ec(e,t=!1){fl+=e,e<0&&ur&&t&&(ur.hasOnce=!0)}function Ig(e){return e.dynamicChildren=fl>0?ur||el:null,Wf(),fl>0&&ur&&ur.push(e),e}function B(e,t,n,r,o,a){return Ig(w(e,t,n,r,o,a,!0))}function tt(e,t,n,r,o){return Ig(Fe(e,t,n,r,o,!0))}function Xl(e){return e?e.__v_isVNode===!0:!1}function yi(e,t){return e.type===t.type&&e.key===t.key}const Ag=({key:e})=>e??null,qu=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Yt(e)||Rn(e)||ft(e)?{i:zn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,r=0,o=null,a=e===ut?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ag(t),ref:t&&qu(t),scopeId:Qv,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:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:zn};return i?(tc(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Yt(n)?8:16),fl>0&&!s&&ur&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&ur.push(l),l}const Fe=_S;function _S(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===lg)&&(e=Qn),Xl(e)){const i=Hs(e,t,!0);return n&&tc(i,n),fl>0&&!a&&ur&&(i.shapeFlag&6?ur[ur.indexOf(e)]=i:ur.push(i)),i.patchFlag=-2,i}if($S(e)&&(e=e.__vccOpts),t){t=PS(t);let{class:i,style:l}=t;i&&!Yt(i)&&(t.class=lt(i)),$t(l)&&($f(l)&&!at(l)&&(l=gn({},l)),t.style=to(l))}const s=Yt(e)?1:kg(e)?128:tg(e)?64:$t(e)?4:ft(e)?2:0;return w(e,t,n,r,o,s,a,!0)}function PS(e){return e?$f(e)||gg(e)?gn({},e):e:null}function Hs(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:i,transition:l}=e,c=t?qf(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ag(c),ref:t&&t.ref?n&&a?at(a)?a.concat(qu(t)):[a,qu(t)]:qu(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ut?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Hs(e.ssContent),ssFallback:e.ssFallback&&Hs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ql(d,l.clone(d)),d}function Ds(e=" ",t=0){return Fe(Cc,null,e,t)}function ve(e="",t=!1){return t?(P(),tt(Qn,null,e)):Fe(Qn,null,e)}function ma(e){return e==null||typeof e=="boolean"?Fe(Qn):at(e)?Fe(ut,null,e.slice()):Xl(e)?Ha(e):Fe(Cc,null,String(e))}function Ha(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Hs(e)}function tc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(at(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),tc(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!gg(t)?t._ctx=zn:o===3&&zn&&(zn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ft(t)){if(r&65){tc(e,{default:t});return}t={default:t,_ctx:zn},n=32}else t=String(t),r&64?(n=16,t=[Ds(t)]):n=8;e.children=t,e.shapeFlag|=n}function qf(...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=lt([t.class,r.class]));else if(o==="style")t.style=to([t.style,r.style]);else if(pc(o)){const a=t[o],s=r[o];s&&a!==s&&!(at(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!hc(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function fa(e,t,n,r=null){oo(e,t,7,[n,r])}const MS=fg();let ES=0;function RS(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||MS,a={uid:ES++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new n0(!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:wg(r,o),emitsOptions:pg(r,o),emit:null,emitted:null,propsDefaults:Ut,inheritAttrs:r.inheritAttrs,ctx:Ut,data:Ut,props:Ut,attrs:Ut,slots:Ut,refs:Ut,setupState:Ut,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 a.ctx={_:a},a.root=t?t.root:a,a.emit=dS.bind(null,a),e.ce&&e.ce(a),a}let Un=null;const Gf=()=>Un||zn;let nc,tf;{const e=yc(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};nc=t("__VUE_INSTANCE_SETTERS__",n=>Un=n),tf=t("__VUE_SSR_SETTERS__",n=>pl=n)}const lu=e=>{const t=Un;return nc(e),e.scope.on(),()=>{e.scope.off(),nc(t)}},yh=()=>{Un&&Un.scope.off(),nc(null)};function _g(e){return e.vnode.shapeFlag&4}let pl=!1;function jS(e,t=!1,n=!1){t&&tf(t);const{props:r,children:o}=e.vnode,a=_g(e);gS(e,r,a,t),TS(e,o,n||t);const s=a?LS(e,t):void 0;return t&&tf(!1),s}function LS(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,eS);const{setup:r}=n;if(r){Ya();const o=e.setupContext=r.length>1?Mg(e):null,a=lu(e),s=ou(r,e,0,[e.props,o]),i=Sv(s);if(Ja(),a(),(i||e.sp)&&!rl(e)&&Ff(e),i){if(s.then(yh,yh),t)return s.then(l=>{wh(e,l)}).catch(l=>{au(l,e,0)});e.asyncDep=s}else wh(e,s)}else Pg(e)}function wh(e,t,n){ft(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:$t(t)&&(e.setupState=Gv(t)),Pg(e)}function Pg(e,t,n){const r=e.type;e.render||(e.render=r.render||ga);{const o=lu(e);Ya();try{rS(e)}finally{Ja(),o()}}}const NS={get(e,t){return Jn(e,"get",""),e[t]}};function Mg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,NS),slots:e.slots,emit:e.emit,expose:t}}function xc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Gv(T0(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Wl)return Wl[n](e)},has(t,n){return n in t||n in Wl}})):e.proxy}function OS(e,t=!0){return ft(e)?e.displayName||e.name:e.name||t&&e.__name}function $S(e){return ft(e)&&"__vccOpts"in e}const Y=(e,t)=>I0(e,t,pl);function Vf(e,t,n){try{ec(-1);const r=arguments.length;return r===2?$t(t)&&!at(t)?Xl(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Xl(n)&&(n=[n]),Fe(e,t,n))}finally{ec(1)}}function jF(e,t,n,r){const o=n[r];if(o&&DS(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function DS(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Ao(n[r],t[r]))return!1;return fl>0&&ur&&ur.push(e),!0}const FS="3.5.40";/**
15
+ * @vue/runtime-dom v3.5.40
16
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
+ * @license MIT
18
+ **/let nf;const bh=typeof window<"u"&&window.trustedTypes;if(bh)try{nf=bh.createPolicy("vue",{createHTML:e=>e})}catch{}const Eg=nf?e=>nf.createHTML(e):e=>e,BS="http://www.w3.org/2000/svg",US="http://www.w3.org/1998/Math/MathML",za=typeof document<"u"?document:null,Th=za&&za.createElement("template"),zS={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"?za.createElementNS(BS,e):t==="mathml"?za.createElementNS(US,e):n?za.createElement(e,{is:n}):za.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>za.createTextNode(e),createComment:e=>za.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>za.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{Th.innerHTML=Eg(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const i=Th.content;if(r==="svg"||r==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ms="transition",jl="animation",Zl=Symbol("_vtc"),Rg={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},HS=gn({},ng,Rg),WS=e=>(e.displayName="Transition",e.props=HS,e),uu=WS((e,{slots:t})=>Vf(B0,qS(e),t)),fi=(e,t=[])=>{at(e)?e.forEach(n=>n(...t)):e&&e(...t)},Sh=e=>e?at(e)?e.some(t=>t.length>1):e.length>1:!1;function qS(e){const t={};for(const ee in e)ee in Rg||(t[ee]=e[ee]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:c=s,appearToClass:d=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:y=`${n}-leave-to`}=e,T=GS(o),A=T&&T[0],U=T&&T[1],{onBeforeEnter:O,onEnter:$,onEnterCancelled:q,onLeave:R,onLeaveCancelled:pe,onBeforeAppear:ce=O,onAppear:K=$,onAppearCancelled:le=q}=t,ye=(ee,me,re,Ie)=>{ee._enterCancelled=Ie,pi(ee,me?d:i),pi(ee,me?c:s),re&&re()},Pe=(ee,me)=>{ee._isLeaving=!1,pi(ee,v),pi(ee,y),pi(ee,f),me&&me()},ge=ee=>(me,re)=>{const Ie=ee?K:$,De=()=>ye(me,ee,re);fi(Ie,[me,De]),Ch(()=>{pi(me,ee?l:a),Fa(me,ee?d:i),Sh(Ie)||xh(me,r,A,De)})};return gn(t,{onBeforeEnter(ee){fi(O,[ee]),Fa(ee,a),Fa(ee,s)},onBeforeAppear(ee){fi(ce,[ee]),Fa(ee,l),Fa(ee,c)},onEnter:ge(!1),onAppear:ge(!0),onLeave(ee,me){ee._isLeaving=!0;const re=()=>Pe(ee,me);Fa(ee,v),ee._enterCancelled?(Fa(ee,f),Ah(ee)):(Ah(ee),Fa(ee,f)),Ch(()=>{ee._isLeaving&&(pi(ee,v),Fa(ee,y),Sh(R)||xh(ee,r,U,re))}),fi(R,[ee,re])},onEnterCancelled(ee){ye(ee,!1,void 0,!0),fi(q,[ee])},onAppearCancelled(ee){ye(ee,!0,void 0,!0),fi(le,[ee])},onLeaveCancelled(ee){Pe(ee),fi(pe,[ee])}})}function GS(e){if(e==null)return null;if($t(e))return[yd(e.enter),yd(e.leave)];{const t=yd(e);return[t,t]}}function yd(e){return KT(e)}function Fa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Zl]||(e[Zl]=new Set)).add(t)}function pi(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Zl];n&&(n.delete(t),n.size||(e[Zl]=void 0))}function Ch(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let VS=0;function xh(e,t,n,r){const o=e._endId=++VS,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=KS(e,t);if(!s)return r();const c=s+"end";let d=0;const v=()=>{e.removeEventListener(c,f),a()},f=y=>{y.target===e&&++d>=l&&v()};setTimeout(()=>{d<l&&v()},i+1),e.addEventListener(c,f)}function KS(e,t){const n=window.getComputedStyle(e),r=T=>(n[T]||"").split(", "),o=r(`${Ms}Delay`),a=r(`${Ms}Duration`),s=kh(o,a),i=r(`${jl}Delay`),l=r(`${jl}Duration`),c=kh(i,l);let d=null,v=0,f=0;t===Ms?s>0&&(d=Ms,v=s,f=a.length):t===jl?c>0&&(d=jl,v=c,f=l.length):(v=Math.max(s,c),d=v>0?s>c?Ms:jl:null,f=d?d===Ms?a.length:l.length:0);const y=d===Ms&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ms}Property`).toString());return{type:d,timeout:v,propCount:f,hasTransform:y}}function kh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Ih(n)+Ih(e[r])))}function Ih(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Ah(e){return(e?e.ownerDocument:document).body.offsetHeight}function YS(e,t,n){const r=e[Zl];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const rc=Symbol("_vod"),jg=Symbol("_vsh"),LF={name:"show",beforeMount(e,{value:t},{transition:n}){e[rc]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Ll(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Ll(e,!0),r.enter(e)):r.leave(e,()=>{Ll(e,!1)}):Ll(e,t))},beforeUnmount(e,{value:t}){Ll(e,t)}};function Ll(e,t){e.style.display=t?e[rc]:"none",e[jg]=!t}const JS=Symbol(""),QS=/(?:^|;)\s*display\s*:/;function XS(e,t,n){const r=e.style,o=Yt(n);let a=!1;if(n&&!o){if(t)if(Yt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Dl(r,i,"")}else for(const s in t)n[s]==null&&Dl(r,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?eC(e,s,!Yt(t)&&t?t[s]:void 0,i)||Dl(r,s,i):Dl(r,s,"")}}else if(o){if(t!==n){const s=r[JS];s&&(n+=";"+s),r.cssText=n,a=QS.test(n)}}else t&&e.removeAttribute("style");rc in e&&(e[rc]=a?r.display:"",e[jg]&&(r.display="none"))}const _h=/\s*!important$/;function Dl(e,t,n){if(at(n))n.forEach(r=>Dl(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=ZS(e,t);_h.test(n)?e.setProperty(qs(r),n.replace(_h,""),"important"):e[r]=n}}const Ph=["Webkit","Moz","ms"],wd={};function ZS(e,t){const n=wd[t];if(n)return n;let r=cr(t);if(r!=="filter"&&r in e)return wd[t]=r;r=gc(r);for(let o=0;o<Ph.length;o++){const a=Ph[o]+r;if(a in e)return wd[t]=a}return t}function eC(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Yt(r)&&n===r}const Mh="http://www.w3.org/1999/xlink";function Eh(e,t,n,r,o,a=e0(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Mh,t.slice(6,t.length)):e.setAttributeNS(Mh,t,n):n==null||a&&!Iv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Ro(n)?String(n):n)}function Rh(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Eg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=Iv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function wi(e,t,n,r){e.addEventListener(t,n,r)}function tC(e,t,n,r){e.removeEventListener(t,n,r)}const jh=Symbol("_vei");function nC(e,t,n,r,o=null){const a=e[jh]||(e[jh]={}),s=a[t];if(r&&s)s.value=r;else{const[i,l]=aC(t);if(r){const c=a[t]=lC(r,o);wi(e,i,c,l)}else s&&(tC(e,i,s,l),a[t]=void 0)}}const rC=/(Once|Passive|Capture)$/,oC=/^on:?(?:Once|Passive|Capture)$/;function aC(e){let t,n;for(;(n=e.match(rC))&&!oC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):qs(e.slice(2)),t]}let bd=0;const sC=Promise.resolve(),iC=()=>bd||(sC.then(()=>bd=0),bd=Date.now());function lC(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(at(o)){const a=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{a.call(r),r._stopped=!0};const s=o.slice(),i=[r];for(let l=0;l<s.length&&!r._stopped;l++){const c=s[l];c&&oo(c,t,5,i)}}else oo(o,t,5,[r])};return n.value=e,n.attached=iC(),n}const Lh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,uC=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?YS(e,r,s):t==="style"?XS(e,n,r):pc(t)?hc(t)||nC(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):cC(e,t,r,s))?(Rh(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Eh(e,t,r,s,a,t!=="value")):e._isVueCE&&(dC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Yt(r)))?Rh(e,cr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Eh(e,t,r,s))};function cC(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Lh(t)&&ft(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 Lh(t)&&Yt(n)?!1:t in e}function dC(e,t){const n=e._def.props;if(!n)return!1;const r=cr(t);return Array.isArray(n)?n.some(o=>cr(o)===r):Object.keys(n).some(o=>cr(o)===r)}const oc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return at(t)?n=>Hu(t,n):t};function fC(e){e.target.composing=!0}function Nh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const al=Symbol("_assign");function Oh(e,t,n){return t&&(e=e.trim()),n&&(e=Mf(e)),e}const Bn={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[al]=oc(o);const a=r||o.props&&o.props.type==="number";wi(e,t?"change":"input",s=>{s.target.composing||e[al](Oh(e.value,n,a))}),(n||a)&&wi(e,"change",()=>{e.value=Oh(e.value,n,a)}),t||(wi(e,"compositionstart",fC),wi(e,"compositionend",Nh),wi(e,"change",Nh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[al]=oc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?Mf(e.value):e.value,l=t??"";if(i===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},pC={deep:!0,created(e,t,n){e[al]=oc(n),wi(e,"change",()=>{const r=e._modelValue,o=hC(e),a=e.checked,s=e[al];if(at(r)){const i=Av(r,o),l=i!==-1;if(a&&!l)s(r.concat(o));else if(!a&&l){const c=[...r];c.splice(i,1),s(c)}}else if(mc(r)){const i=new Set(r);a?i.add(o):i.delete(o),s(i)}else s(Lg(e,a))})},mounted:$h,beforeUpdate(e,t,n){e[al]=oc(n),$h(e,t,n)}};function $h(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(at(t))o=Av(t,r.props.value)>-1;else if(mc(t))o=t.has(r.props.value);else{if(t===n)return;o=ru(t,Lg(e,!0))}e.checked!==o&&(e.checked=o)}function hC(e){return"_value"in e?e._value:e.value}function Lg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const mC=["ctrl","shift","alt","meta"],vC={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)=>mC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(o,...a)=>{for(let s=0;s<t.length;s++){const i=vC[t[s]];if(i&&i(o,t))return}return e(o,...a)})},gC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},wr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=o=>{if(!("key"in o))return;const a=qs(o.key);if(t.some(s=>s===a||gC[s]===a))return e(o)})},yC=gn({patchProp:uC},zS);let Dh;function wC(){return Dh||(Dh=CS(yC))}const bC=(...e)=>{const t=wC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=SC(r);if(!o)return;const a=t._component;!ft(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,TC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function TC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function SC(e){return Yt(e)?document.querySelector(e):e}const CC="modulepreload",xC=function(e){return"/"+e},Fh={},ko=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=s(n.map(c=>{if(c=xC(c),c in Fh)return;Fh[c]=!0;const d=c.endsWith(".css"),v=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${v}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":CC,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((y,T)=>{f.addEventListener("load",y),f.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return o.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
19
+ * vue-router v4.6.4
20
+ * (c) 2025 Eduardo San Martin Morote
21
+ * @license MIT
22
+ */const Ji=typeof document<"u";function Ng(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function kC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ng(e.default)}const Nt=Object.assign;function Td(e,t){const n={};for(const r in t){const o=t[r];n[r]=Lo(o)?o.map(e):e(o)}return n}const ql=()=>{},Lo=Array.isArray;function Bh(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Og=/#/g,IC=/&/g,AC=/\//g,_C=/=/g,PC=/\?/g,$g=/\+/g,MC=/%5B/g,EC=/%5D/g,Dg=/%5E/g,RC=/%60/g,Fg=/%7B/g,jC=/%7C/g,Bg=/%7D/g,LC=/%20/g;function Kf(e){return e==null?"":encodeURI(""+e).replace(jC,"|").replace(MC,"[").replace(EC,"]")}function NC(e){return Kf(e).replace(Fg,"{").replace(Bg,"}").replace(Dg,"^")}function rf(e){return Kf(e).replace($g,"%2B").replace(LC,"+").replace(Og,"%23").replace(IC,"%26").replace(RC,"`").replace(Fg,"{").replace(Bg,"}").replace(Dg,"^")}function OC(e){return rf(e).replace(_C,"%3D")}function $C(e){return Kf(e).replace(Og,"%23").replace(PC,"%3F")}function DC(e){return $C(e).replace(AC,"%2F")}function eu(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const FC=/\/$/,BC=e=>e.replace(FC,"");function Sd(e,t,n="/"){let r,o={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(r=t.slice(0,l),a=t.slice(l,i>0?i:t.length),o=e(a.slice(1))),i>=0&&(r=r||t.slice(0,i),s=t.slice(i,t.length)),r=WC(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:eu(s)}}function UC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Uh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function zC(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&hl(t.matched[r],n.matched[o])&&Ug(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function hl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ug(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!HC(e[n],t[n]))return!1;return!0}function HC(e,t){return Lo(e)?zh(e,t):Lo(t)?zh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function zh(e,t){return Lo(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function WC(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 a=n.length-1,s,i;for(s=0;s<r.length;s++)if(i=r[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const Es={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let of=function(e){return e.pop="pop",e.push="push",e}({}),Cd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function qC(e){if(!e)if(Ji){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),BC(e)}const GC=/^[^#]+#/;function VC(e,t){return e.replace(GC,"#")+t}function KC(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 kc=()=>({left:window.scrollX,top:window.scrollY});function YC(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=KC(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 Hh(e,t){return(history.state?history.state.position-t:-1)+e}const af=new Map;function JC(e,t){af.set(e,t)}function QC(e){const t=af.get(e);return af.delete(e),t}function XC(e){return typeof e=="string"||e&&typeof e=="object"}function zg(e){return typeof e=="string"||typeof e=="symbol"}let ln=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 Hg=Symbol("");ln.MATCHER_NOT_FOUND+"",ln.NAVIGATION_GUARD_REDIRECT+"",ln.NAVIGATION_ABORTED+"",ln.NAVIGATION_CANCELLED+"",ln.NAVIGATION_DUPLICATED+"";function ml(e,t){return Nt(new Error,{type:e,[Hg]:!0},t)}function Ba(e,t){return e instanceof Error&&Hg in e&&(t==null||!!(e.type&t))}const ZC=["params","query","hash"];function ex(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of ZC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function tx(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($g," "),a=o.indexOf("="),s=eu(a<0?o:o.slice(0,a)),i=a<0?null:eu(o.slice(a+1));if(s in t){let l=t[s];Lo(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Wh(e){let t="";for(let n in e){const r=e[n];if(n=OC(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Lo(r)?r.map(o=>o&&rf(o)):[r&&rf(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function nx(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Lo(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const rx=Symbol(""),qh=Symbol(""),Ic=Symbol(""),Yf=Symbol(""),sf=Symbol("");function Nl(){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 Os(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const c=f=>{f===!1?l(ml(ln.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):XC(f)?l(ml(ln.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&r.enterCallbacks[o]===s&&typeof f=="function"&&s.push(f),i())},d=a(()=>e.call(r&&r.instances[o],t,n,c));let v=Promise.resolve(d);e.length<3&&(v=v.then(c)),v.catch(f=>l(f))})}function xd(e,t,n,r,o=a=>a()){const a=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(Ng(l)){const c=(l.__vccOpts||l)[t];c&&a.push(Os(c,n,r,s,i,o))}else{let c=l();a.push(()=>c.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const v=kC(d)?d.default:d;s.mods[i]=d,s.components[i]=v;const f=(v.__vccOpts||v)[t];return f&&Os(f,n,r,s,i,o)()}))}}return a}function ox(e,t){const n=[],r=[],o=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const i=t.matched[s];i&&(e.matched.find(c=>hl(c,i))?r.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(c=>hl(c,l))||o.push(l))}return[n,r,o]}/*!
23
+ * vue-router v4.6.4
24
+ * (c) 2025 Eduardo San Martin Morote
25
+ * @license MIT
26
+ */let ax=()=>location.protocol+"//"+location.host;function Wg(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,i=o.slice(s);return i[0]!=="/"&&(i="/"+i),Uh(i,"")}return Uh(n,e)+r+o}function sx(e,t,n,r){let o=[],a=[],s=null;const i=({state:f})=>{const y=Wg(e,location),T=n.value,A=t.value;let U=0;if(f){if(n.value=y,t.value=f,s&&s===T){s=null;return}U=A?f.position-A.position:0}else r(y);o.forEach(O=>{O(n.value,T,{delta:U,type:of.pop,direction:U?U>0?Cd.forward:Cd.back:Cd.unknown})})};function l(){s=n.value}function c(f){o.push(f);const y=()=>{const T=o.indexOf(f);T>-1&&o.splice(T,1)};return a.push(y),y}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Nt({},f.state,{scroll:kc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",d)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",d),document.addEventListener("visibilitychange",d),{pauseListeners:l,listen:c,destroy:v}}function Gh(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?kc():null}}function ix(e){const{history:t,location:n}=window,r={value:Wg(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,c,d){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:ax()+e+l;try{t[d?"replaceState":"pushState"](c,"",f),o.value=c}catch(y){console.error(y),n[d?"replace":"assign"](f)}}function s(l,c){a(l,Nt({},t.state,Gh(o.value.back,l,o.value.forward,!0),c,{position:o.value.position}),!0),r.value=l}function i(l,c){const d=Nt({},o.value,t.state,{forward:l,scroll:kc()});a(d.current,d,!0),a(l,Nt({},Gh(r.value,l,null),{position:d.position+1},c),!1),r.value=l}return{location:r,state:o,push:i,replace:s}}function lx(e){e=qC(e);const t=ix(e),n=sx(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Nt({location:"",base:e,go:r,createHref:VC.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 ux(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),lx(e)}let bi=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var In=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}(In||{});const cx={type:bi.Static,value:""},dx=/[a-zA-Z0-9_]/;function fx(e){if(!e)return[[]];if(e==="/")return[[cx]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${n})/"${c}": ${y}`)}let n=In.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let i=0,l,c="",d="";function v(){c&&(n===In.Static?a.push({type:bi.Static,value:c}):n===In.Param||n===In.ParamRegExp||n===In.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),a.push({type:bi.Param,value:c,regexp:d,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function f(){c+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==In.ParamRegExp){r=n,n=In.EscapeNext;continue}switch(n){case In.Static:l==="/"?(c&&v(),s()):l===":"?(v(),n=In.Param):f();break;case In.EscapeNext:f(),n=r;break;case In.Param:l==="("?n=In.ParamRegExp:dx.test(l)?f():(v(),n=In.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case In.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=In.ParamRegExpEnd:d+=l;break;case In.ParamRegExpEnd:v(),n=In.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===In.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),v(),s(),o}const Vh="[^/]+?",px={sensitive:!1,strict:!1,start:!0,end:!0};var ir=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}(ir||{});const hx=/[.+*?^${}()[\]/\\]/g;function mx(e,t){const n=Nt({},px,t),r=[];let o=n.start?"^":"";const a=[];for(const c of e){const d=c.length?[]:[ir.Root];n.strict&&!c.length&&(o+="/");for(let v=0;v<c.length;v++){const f=c[v];let y=ir.Segment+(n.sensitive?ir.BonusCaseSensitive:0);if(f.type===bi.Static)v||(o+="/"),o+=f.value.replace(hx,"\\$&"),y+=ir.Static;else if(f.type===bi.Param){const{value:T,repeatable:A,optional:U,regexp:O}=f;a.push({name:T,repeatable:A,optional:U});const $=O||Vh;if($!==Vh){y+=ir.BonusCustomRegExp;try{`${$}`}catch(R){throw new Error(`Invalid custom RegExp for param "${T}" (${$}): `+R.message)}}let q=A?`((?:${$})(?:/(?:${$}))*)`:`(${$})`;v||(q=U&&c.length<2?`(?:/${q})`:"/"+q),U&&(q+="?"),o+=q,y+=ir.Dynamic,U&&(y+=ir.BonusOptional),A&&(y+=ir.BonusRepeatable),$===".*"&&(y+=ir.BonusWildcard)}d.push(y)}r.push(d)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=ir.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function i(c){const d=c.match(s),v={};if(!d)return null;for(let f=1;f<d.length;f++){const y=d[f]||"",T=a[f-1];v[T.name]=y&&T.repeatable?y.split("/"):y}return v}function l(c){let d="",v=!1;for(const f of e){(!v||!d.endsWith("/"))&&(d+="/"),v=!1;for(const y of f)if(y.type===bi.Static)d+=y.value;else if(y.type===bi.Param){const{value:T,repeatable:A,optional:U}=y,O=T in c?c[T]:"";if(Lo(O)&&!A)throw new Error(`Provided param "${T}" is an array but it is not repeatable (* or + modifiers)`);const $=Lo(O)?O.join("/"):O;if(!$)if(U)f.length<2&&(d.endsWith("/")?d=d.slice(0,-1):v=!0);else throw new Error(`Missing required param "${T}"`);d+=$}}return d||"/"}return{re:s,score:r,keys:a,parse:i,stringify:l}}function vx(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]===ir.Static+ir.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===ir.Static+ir.Segment?1:-1:0}function qg(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=vx(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Kh(r))return 1;if(Kh(o))return-1}return o.length-r.length}function Kh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const gx={strict:!1,end:!0,sensitive:!1};function yx(e,t,n){const r=mx(fx(e.path),n),o=Nt(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function wx(e,t){const n=[],r=new Map;t=Bh(gx,t);function o(v){return r.get(v)}function a(v,f,y){const T=!y,A=Jh(v);A.aliasOf=y&&y.record;const U=Bh(t,v),O=[A];if("alias"in v){const R=typeof v.alias=="string"?[v.alias]:v.alias;for(const pe of R)O.push(Jh(Nt({},A,{components:y?y.record.components:A.components,path:pe,aliasOf:y?y.record:A})))}let $,q;for(const R of O){const{path:pe}=R;if(f&&pe[0]!=="/"){const ce=f.record.path,K=ce[ce.length-1]==="/"?"":"/";R.path=f.record.path+(pe&&K+pe)}if($=yx(R,f,U),y?y.alias.push($):(q=q||$,q!==$&&q.alias.push($),T&&v.name&&!Qh($)&&s(v.name)),Gg($)&&l($),A.children){const ce=A.children;for(let K=0;K<ce.length;K++)a(ce[K],$,y&&y.children[K])}y=y||$}return q?()=>{s(q)}:ql}function s(v){if(zg(v)){const f=r.get(v);f&&(r.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&r.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=Sx(v,n);n.splice(f,0,v),v.record.name&&!Qh(v)&&r.set(v.record.name,v)}function c(v,f){let y,T={},A,U;if("name"in v&&v.name){if(y=r.get(v.name),!y)throw ml(ln.MATCHER_NOT_FOUND,{location:v});U=y.record.name,T=Nt(Yh(f.params,y.keys.filter(q=>!q.optional).concat(y.parent?y.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),v.params&&Yh(v.params,y.keys.map(q=>q.name))),A=y.stringify(T)}else if(v.path!=null)A=v.path,y=n.find(q=>q.re.test(A)),y&&(T=y.parse(A),U=y.record.name);else{if(y=f.name?r.get(f.name):n.find(q=>q.re.test(f.path)),!y)throw ml(ln.MATCHER_NOT_FOUND,{location:v,currentLocation:f});U=y.record.name,T=Nt({},f.params,v.params),A=y.stringify(T)}const O=[];let $=y;for(;$;)O.unshift($.record),$=$.parent;return{name:U,path:A,params:T,matched:O,meta:Tx(O)}}e.forEach(v=>a(v));function d(){n.length=0,r.clear()}return{addRoute:a,resolve:c,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:o}}function Yh(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Jh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:bx(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 bx(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 Qh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Tx(e){return e.reduce((t,n)=>Nt(t,n.meta),{})}function Sx(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;qg(e,t[a])<0?r=a:n=a+1}const o=Cx(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function Cx(e){let t=e;for(;t=t.parent;)if(Gg(t)&&qg(e,t)===0)return t}function Gg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Xh(e){const t=Eo(Ic),n=Eo(Yf),r=Y(()=>{const l=m(e.to);return t.resolve(l)}),o=Y(()=>{const{matched:l}=r.value,{length:c}=l,d=l[c-1],v=n.matched;if(!d||!v.length)return-1;const f=v.findIndex(hl.bind(null,d));if(f>-1)return f;const y=Zh(l[c-2]);return c>1&&Zh(d)===y&&v[v.length-1].path!==y?v.findIndex(hl.bind(null,l[c-2])):f}),a=Y(()=>o.value>-1&&_x(n.params,r.value.params)),s=Y(()=>o.value>-1&&o.value===n.matched.length-1&&Ug(n.params,r.value.params));function i(l={}){if(Ax(l)){const c=t[m(e.replace)?"replace":"push"](m(e.to)).catch(ql);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:Y(()=>r.value.href),isActive:a,isExactActive:s,navigate:i}}function xx(e){return e.length===1?e[0]:e}const kx=yn({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:Xh,setup(e,{slots:t}){const n=bc(Xh(e)),{options:r}=Eo(Ic),o=Y(()=>({[em(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[em(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&xx(t.default(n));return e.custom?a:Vf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),Ix=kx;function Ax(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 _x(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(!Lo(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function Zh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const em=(e,t,n)=>e??t??n,Px=yn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Eo(sf),o=Y(()=>e.route||r.value),a=Eo(qh,0),s=Y(()=>{let c=m(a);const{matched:d}=o.value;let v;for(;(v=d[c])&&!v.components;)c++;return c}),i=Y(()=>o.value.matched[s.value]);Wu(qh,Y(()=>s.value+1)),Wu(rx,i),Wu(sf,o);const l=S();return rt(()=>[l.value,i.value,e.name],([c,d,v],[f,y,T])=>{d&&(d.instances[v]=c,y&&y!==d&&c&&c===f&&(d.leaveGuards.size||(d.leaveGuards=y.leaveGuards),d.updateGuards.size||(d.updateGuards=y.updateGuards))),c&&d&&(!y||!hl(d,y)||!f)&&(d.enterCallbacks[v]||[]).forEach(A=>A(c))},{flush:"post"}),()=>{const c=o.value,d=e.name,v=i.value,f=v&&v.components[d];if(!f)return tm(n.default,{Component:f,route:c});const y=v.props[d],T=y?y===!0?c.params:typeof y=="function"?y(c):y:null,U=Vf(f,Nt({},T,t,{onVnodeUnmounted:O=>{O.component.isUnmounted&&(v.instances[d]=null)},ref:l}));return tm(n.default,{Component:U,route:c})||U}}});function tm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Mx=Px;function Ex(e){const t=wx(e.routes,e),n=e.parseQuery||tx,r=e.stringifyQuery||Wh,o=e.history,a=Nl(),s=Nl(),i=Nl(),l=S0(Es);let c=Es;Ji&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=Td.bind(null,N=>""+N),v=Td.bind(null,DC),f=Td.bind(null,eu);function y(N,oe){let se,je;return zg(N)?(se=t.getRecordMatcher(N),je=oe):je=N,t.addRoute(je,se)}function T(N){const oe=t.getRecordMatcher(N);oe&&t.removeRoute(oe)}function A(){return t.getRoutes().map(N=>N.record)}function U(N){return!!t.getRecordMatcher(N)}function O(N,oe){if(oe=Nt({},oe||l.value),typeof N=="string"){const z=Sd(n,N,oe.path),ue=t.resolve({path:z.path},oe),ne=o.createHref(z.fullPath);return Nt(z,ue,{params:f(ue.params),hash:eu(z.hash),redirectedFrom:void 0,href:ne})}let se;if(N.path!=null)se=Nt({},N,{path:Sd(n,N.path,oe.path).path});else{const z=Nt({},N.params);for(const ue in z)z[ue]==null&&delete z[ue];se=Nt({},N,{params:v(z)}),oe.params=v(oe.params)}const je=t.resolve(se,oe),We=N.hash||"";je.params=d(f(je.params));const _=UC(r,Nt({},N,{hash:NC(We),path:je.path})),E=o.createHref(_);return Nt({fullPath:_,hash:We,query:r===Wh?nx(N.query):N.query||{}},je,{redirectedFrom:void 0,href:E})}function $(N){return typeof N=="string"?Sd(n,N,l.value.path):Nt({},N)}function q(N,oe){if(c!==N)return ml(ln.NAVIGATION_CANCELLED,{from:oe,to:N})}function R(N){return K(N)}function pe(N){return R(Nt($(N),{replace:!0}))}function ce(N,oe){const se=N.matched[N.matched.length-1];if(se&&se.redirect){const{redirect:je}=se;let We=typeof je=="function"?je(N,oe):je;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=$(We):{path:We},We.params={}),Nt({query:N.query,hash:N.hash,params:We.path!=null?{}:N.params},We)}}function K(N,oe){const se=c=O(N),je=l.value,We=N.state,_=N.force,E=N.replace===!0,z=ce(se,je);if(z)return K(Nt($(z),{state:typeof z=="object"?Nt({},We,z.state):We,force:_,replace:E}),oe||se);const ue=se;ue.redirectedFrom=oe;let ne;return!_&&zC(r,je,se)&&(ne=ml(ln.NAVIGATION_DUPLICATED,{to:ue,from:je}),xe(je,je,!0,!1)),(ne?Promise.resolve(ne):Pe(ue,je)).catch(ae=>Ba(ae)?Ba(ae,ln.NAVIGATION_GUARD_REDIRECT)?ae:Se(ae):Le(ae,ue,je)).then(ae=>{if(ae){if(Ba(ae,ln.NAVIGATION_GUARD_REDIRECT))return K(Nt({replace:E},$(ae.to),{state:typeof ae.to=="object"?Nt({},We,ae.to.state):We,force:_}),oe||ue)}else ae=ee(ue,je,!0,E,We);return ge(ue,je,ae),ae})}function le(N,oe){const se=q(N,oe);return se?Promise.reject(se):Promise.resolve()}function ye(N){const oe=Xe.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(N):N()}function Pe(N,oe){let se;const[je,We,_]=ox(N,oe);se=xd(je.reverse(),"beforeRouteLeave",N,oe);for(const z of je)z.leaveGuards.forEach(ue=>{se.push(Os(ue,N,oe))});const E=le.bind(null,N,oe);return se.push(E),de(se).then(()=>{se=[];for(const z of a.list())se.push(Os(z,N,oe));return se.push(E),de(se)}).then(()=>{se=xd(We,"beforeRouteUpdate",N,oe);for(const z of We)z.updateGuards.forEach(ue=>{se.push(Os(ue,N,oe))});return se.push(E),de(se)}).then(()=>{se=[];for(const z of _)if(z.beforeEnter)if(Lo(z.beforeEnter))for(const ue of z.beforeEnter)se.push(Os(ue,N,oe));else se.push(Os(z.beforeEnter,N,oe));return se.push(E),de(se)}).then(()=>(N.matched.forEach(z=>z.enterCallbacks={}),se=xd(_,"beforeRouteEnter",N,oe,ye),se.push(E),de(se))).then(()=>{se=[];for(const z of s.list())se.push(Os(z,N,oe));return se.push(E),de(se)}).catch(z=>Ba(z,ln.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function ge(N,oe,se){i.list().forEach(je=>ye(()=>je(N,oe,se)))}function ee(N,oe,se,je,We){const _=q(N,oe);if(_)return _;const E=oe===Es,z=Ji?history.state:{};se&&(je||E?o.replace(N.fullPath,Nt({scroll:E&&z&&z.scroll},We)):o.push(N.fullPath,We)),l.value=N,xe(N,oe,se,E),Se()}let me;function re(){me||(me=o.listen((N,oe,se)=>{if(!st.listening)return;const je=O(N),We=ce(je,st.currentRoute.value);if(We){K(Nt(We,{replace:!0,force:!0}),je).catch(ql);return}c=je;const _=l.value;Ji&&JC(Hh(_.fullPath,se.delta),kc()),Pe(je,_).catch(E=>Ba(E,ln.NAVIGATION_ABORTED|ln.NAVIGATION_CANCELLED)?E:Ba(E,ln.NAVIGATION_GUARD_REDIRECT)?(K(Nt($(E.to),{force:!0}),je).then(z=>{Ba(z,ln.NAVIGATION_ABORTED|ln.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===of.pop&&o.go(-1,!1)}).catch(ql),Promise.reject()):(se.delta&&o.go(-se.delta,!1),Le(E,je,_))).then(E=>{E=E||ee(je,_,!1),E&&(se.delta&&!Ba(E,ln.NAVIGATION_CANCELLED)?o.go(-se.delta,!1):se.type===of.pop&&Ba(E,ln.NAVIGATION_ABORTED|ln.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),ge(je,_,E)}).catch(ql)}))}let Ie=Nl(),De=Nl(),Ne;function Le(N,oe,se){Se(N);const je=De.list();return je.length?je.forEach(We=>We(N,oe,se)):console.error(N),Promise.reject(N)}function Ce(){return Ne&&l.value!==Es?Promise.resolve():new Promise((N,oe)=>{Ie.add([N,oe])})}function Se(N){return Ne||(Ne=!N,re(),Ie.list().forEach(([oe,se])=>N?se(N):oe()),Ie.reset()),N}function xe(N,oe,se,je){const{scrollBehavior:We}=e;if(!Ji||!We)return Promise.resolve();const _=!se&&QC(Hh(N.fullPath,0))||(je||!se)&&history.state&&history.state.scroll||null;return Ft().then(()=>We(N,oe,_)).then(E=>E&&YC(E)).catch(E=>Le(E,N,oe))}const Me=N=>o.go(N);let Je;const Xe=new Set,st={currentRoute:l,listening:!0,addRoute:y,removeRoute:T,clearRoutes:t.clearRoutes,hasRoute:U,getRoutes:A,resolve:O,options:e,push:R,replace:pe,go:Me,back:()=>Me(-1),forward:()=>Me(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:De.add,isReady:Ce,install(N){N.component("RouterLink",Ix),N.component("RouterView",Mx),N.config.globalProperties.$router=st,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>m(l)}),Ji&&!Je&&l.value===Es&&(Je=!0,R(o.location).catch(je=>{}));const oe={};for(const je in Es)Object.defineProperty(oe,je,{get:()=>l.value[je],enumerable:!0});N.provide(Ic,st),N.provide(Yf,Wv(oe)),N.provide(sf,l);const se=N.unmount;Xe.add(N),N.unmount=function(){Xe.delete(N),Xe.size<1&&(c=Es,me&&me(),me=null,l.value=Es,Je=!1,Ne=!1),se()}}};function de(N){return N.reduce((oe,se)=>oe.then(()=>ye(se)),Promise.resolve())}return st}function Rx(){return Eo(Ic)}function jx(e){return Eo(Yf)}const nm=768;function Jf(){const e=S(typeof window<"u"?window.innerWidth<nm:!1);let t=null;function n(r){e.value=r.matches}return Ii(()=>{t=window.matchMedia(`(max-width: ${nm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),iu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Lx={key:0,class:"desktop-sidebar"},Nx={class:"desktop-main"},rm="codex-web-local.sidebar-width.v1",Ox=260,$x=620,om=320,Dx=yn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Jf();function r(c){return Math.min($x,Math.max(Ox,c))}function o(){if(typeof window>"u")return om;const c=window.localStorage.getItem(rm),d=Number(c);return Number.isFinite(d)?r(d):om}const a=S(o()),s=Y(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(c){typeof window>"u"||window.localStorage.setItem(rm,String(c))}function l(c){c.preventDefault();const d=c.clientX,v=a.value,f=T=>{const A=T.clientX-d;a.value=r(v+A)},y=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",y)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",y)}return(c,d)=>(P(),B("div",{class:lt(["desktop-layout",{"is-mobile":m(n)}]),style:to(s.value)},[m(n)?(P(),tt(dl,{key:0,to:"body"},[Fe(uu,{name:"drawer"},{default:dt(()=>[e.isSidebarCollapsed?ve("",!0):(P(),B("div",{key:0,class:"mobile-drawer-backdrop",onClick:d[1]||(d[1]=v=>c.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:d[0]||(d[0]=gt(()=>{},["stop"]))},[br(c.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),m(n)?ve("",!0):(P(),B(ut,{key:1},[e.isSidebarCollapsed?ve("",!0):(P(),B("aside",Lx,[br(c.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ve("",!0):(P(),B("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",Nx,[br(c.$slots,"content",{},void 0)])],6))}}),Ct=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},Fx=Ct(Dx,[["__scopeId","data-v-336d0207"]]);function am(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Nr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function so(e,t){if(typeof e=="string"&&e.length>0)return e;const n=am(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=am(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 ao(e,t,n){return e instanceof Nr?e:e instanceof Error?new Nr(e.message||t,{code:"unknown_error",method:n}):new Nr(t,{code:"unknown_error",method:n})}function Vg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Bx(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Nr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const i=so(o,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${r.status}`;throw new Nr(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new Nr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function Ux(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(so(t,`Method catalog failed with HTTP ${e.status}`),{code:"http_error",method:"meta/methods",status:e.status});const n=t;return Array.isArray(n.data)?n.data:[]}function zx(e){const t=Vg(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 sm(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Hx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(c,d)=>{if(n||r!==null)return;const v=Math.min(1e3*2**d,1e4);r=window.setTimeout(()=>{r=null,!n&&c()},v)},s=c=>{const d=zx(c);d&&e(d)},i=(c=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const d=new EventSource("/codex-api/events");let v=!1;d.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},d.addEventListener("ready",f=>{try{const y=f.data?JSON.parse(f.data):{ok:!0};sm(e,y)}catch{sm(e)}}),d.onerror=()=>{n||v||d.readyState===EventSource.CLOSED&&(v=!0,d.close(),a(()=>i(c+1),c))},t=()=>{v=!0,d.close()}},l=(c=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const d=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${d}//${window.location.host}/codex-api/ws`);let f=!1,y=!1,T=window.setTimeout(()=>{f||n||y||(y=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,o(),T!==null&&(window.clearTimeout(T),T=null)},v.onmessage=A=>{try{s(JSON.parse(String(A.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(T!==null&&(window.clearTimeout(T),T=null),!(n||y)){if(!f){i();return}a(()=>l(c+1),c)}},t=()=>{y=!0,T!==null&&(window.clearTimeout(T),T=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,o(),t==null||t()}}async function Wx(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 Nr(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 Nr(so(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function qx(){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 Nr(so(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Vg(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}async function ot(e,t){try{return await Bx(e,t)}catch(n){throw ao(n,`RPC ${e} failed`,e)}}function Xt(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}function Ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function te(e){return typeof e=="string"&&e.length>0?e:null}function qt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xn(e){return typeof e=="boolean"?e:null}function _o(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Ai(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"}`)}}function ac(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.kind),o=te(t.name),a=te(t.prompt),s=te(t.rrule),i=te(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:i,targetThreadId:te(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:qt(t.createdAtMs),updatedAtMs:qt(t.updatedAtMs),nextRunAtMs:qt(t.nextRunAtMs)}}function Kg(e){if(Array.isArray(e))return e.flatMap(n=>{const r=ac(n);return r?[r]:[]});const t=ac(e);return t?[t]:[]}async function Gx(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(so(t,"Failed to load thread automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Kg(s);i.length>0&&(r[a]=i)}return r}async function Vx(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(so(t,"Failed to load project automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Kg(s);i.length>0&&(r[a]=i)}return r}async function Kx(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(so(n,"Failed to save thread automation"));const r=ac((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function Yx(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(so(n,"Failed to save project automation"));const r=ac((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function im(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(so(o,"Failed to delete thread automation"))}async function Yg(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(so(o,"Failed to delete project automation"))}async function Jx(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(so(r,"Failed to run thread automation"))}const Qx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Jg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||Qx.has(n))}function Xx(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],r=[];for(const o of n){if(!o||typeof o!="object"||Array.isArray(o))continue;const s=o.path,i=typeof s=="string"?s.trim():"";!i||Jg(i)||r.push({path:i})}return r}async function Zx(e,t){await ot("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function ek(e,t){await ot("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function tk(e){await ot("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function lm(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})}),a=await o.json();if(!o.ok){const c=Xt(a,"Failed to search files");throw new Error(c)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const c of i){if(!c||typeof c!="object"||Array.isArray(c))continue;const v=c.path,f=typeof v=="string"?v.trim():"";!f||Jg(f)||l.push({path:f})}return l}async function nk(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function rk(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.threadId),o=te(t.cwd),a=te(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Xn(t.truncated)??!1}}async function wl(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(so(r,`Terminal request failed with HTTP ${n.status}`));return r}async function NF(e){var r;const t=await wl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=rk((r=Ye(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function ok(){const e=await wl("/codex-api/thread-terminal/status"),t=Ye(e);return{available:Xn(t==null?void 0:t.available)??!1,reason:te(t==null?void 0:t.reason)||null}}async function OF(e){const t=await wl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ye(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=Ye(o),s=te(a==null?void 0:a.label),i=te(a==null?void 0:a.value),l=te(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function $F(e,t){await wl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function DF(e,t,n){await wl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function FF(e){await wl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function ak(e,t=[],n=[]){if(e.trim().length>0)return e;const r=t.map(o=>(o.label??"").trim()).find(o=>o.length>0);return r||(n.some(o=>(o??"").trim().length>0)?"[Image]":"[Attachment]")}const Qg=["none","minimal","low","medium","high","xhigh","max","ultra"];function vl(e){return typeof e=="string"&&Qg.some(t=>t===e)}function sk(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function et(e){return sk(e)}function Xg(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function ik(e){const t=et(e);return t.startsWith("/")||Xg(t)}function lk(e){const t=et(e).replace(/[\\/]+/gu,"/");return Xg(t)?t.toLowerCase():t}function Lr(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function sl(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function ro(e){return Lr(e)||et(e)||"Projectless"}function sc(e){const t=et(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function um(e){return new Date(e*1e3).toISOString()}function uk(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e>1e11?e:e*1e3,n=new Date(t);return Number.isNaN(n.getTime())?null:n.toISOString()}function ck(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function dk(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const fk=/^##\s+(.+?):\s+(.+?)\s*$/,pk=/^#\s*files mentioned by the user\s*:?\s*$/i;function hk(e){var o,a;const t=e.split(`
27
+ `).findIndex(s=>pk.test(s.trim()));if(t<0)return[];const n=e.split(`
28
+ `).slice(t+1),r=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(fk);if(!l)break;const c=(o=l[1])==null?void 0:o.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");c&&d&&r.push({label:c,path:d})}return r}function mk(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()}const vk=new Set(["text","image","localImage","audio","localAudio","skill","mention"]);function Zg(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function gk(e){return`/codex-local-file?path=${encodeURIComponent(e)}`}function yk(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 wk(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,r=typeof n.ref=="string"?n.ref.trim():"",o=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=o(n.totalBytes),s=o(n.omittedBytes);if(!(s<=0))return{ref:r,totalBytes:a,omittedBytes:s}}function bk(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function kd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?bk(n[1].trim()):""}function Tk(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=kd(t,"current_time_iso"),r=kd(t,"instructions");return!n||!r?null:{automationId:kd(t,"automation_id"),currentTimeIso:n,instructions:r}}function Sk(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],imageAttachmentIds:[],audioSources:[],mentions:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[],s=[],i=[],l=[];for(const[f,y]of t.entries()){if(y.type==="text"&&typeof y.text=="string"&&y.text.length>0&&n.push(y.text),y.type==="image"&&"url"in y&&typeof y.url=="string"&&y.url.trim().length>0&&r.push(y.url.trim()),y.type==="image"&&!("url"in y)&&"fileId"in y&&typeof y.fileId=="string"&&y.fileId.trim().length>0&&o.push(y.fileId.trim()),y.type==="localImage"&&typeof y.path=="string"&&y.path.trim().length>0&&r.push(Zg(y.path.trim())),y.type==="skill"){const A=typeof y.name=="string"?y.name.trim():"",U=typeof y.path=="string"?y.path.trim():"";A&&U&&i.push({name:A,path:U})}if(y.type==="audio"&&typeof y.url=="string"&&y.url.trim().length>0&&a.push(y.url.trim()),y.type==="localAudio"&&typeof y.path=="string"&&y.path.trim().length>0&&a.push(gk(y.path.trim())),y.type==="mention"){const A=typeof y.name=="string"?y.name.trim():"",U=typeof y.path=="string"?y.path.trim():"";A&&s.push({name:A,path:U})}const T=y.type;vk.has(T)||l.push({id:`${e}:user-content:${f}`,role:"user",text:"",messageType:`userContent.${T}`,rawPayload:ck(y),isUnhandled:!0})}const c=n.join(`
29
+ `),d=hk(c),v=Tk(c);return{text:(v==null?void 0:v.instructions)??mk(c),images:r,skills:i,fileAttachments:d,imageAttachmentIds:o,audioSources:a,mentions:s,rawBlocks:l,isAutomationRun:v!==null,automationDisplayName:(v==null?void 0:v.automationId)||null}}function Ck(e){var a;const t=e.replace(/\r\n/g,`
30
+ `).trim();if(!t)return null;const n=t.split(`
31
+ `),r=[],o=[];for(const s of n){const i=s.trim();if(!i){r.length===0&&o.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const c=(l[1]??" ").toLowerCase(),d=(a=l[2])==null?void 0:a.trim();if(!d)continue;let v="pending";c==="x"&&(v="completed"),(c==="~"||c===">"||c==="-")&&(v="inProgress"),r.push({step:d,status:v});continue}o.push(i)}return r.length===0?null:{explanation:o.join(`
32
+ `).trim()||void 0,steps:r}}function cm(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 xk(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 ey(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function lf(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",i=o.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const c=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,d=l==="update"?xk(s):l==="add"?{addedLineCount:cm(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:cm(s)};n.push({path:a,operation:l,movedToPath:c,diff:s,...d})}return n}function kk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Sk(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0||t.imageAttachmentIds.length>0||t.audioSources.length>0||t.mentions.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,imageAttachmentIds:t.imageAttachmentIds.length>0?t.imageAttachmentIds:void 0,audioSources:t.audioSources.length>0?t.audioSources:void 0,mentions:t.mentions.length>0?t.mentions:void 0,messageType:e.type,clientId:typeof e.clientId=="string"&&e.clientId.length>0?e.clientId:null,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:[Zg(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?yk(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],r=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],o=n.join(`
38
+ `).trim(),s=r.join(`
39
+ `).trim()||o;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:r}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",r=typeof t.tool=="string"?t.tool:"";if(!n&&!r)return[];const o=t.status;let a="completed";const s=typeof o=="string"?o:o==null?void 0:o.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:r,messageType:"toolCall",toolCall:{server:n,tool:r,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Ck(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Ik(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=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:a,exitCode:s,outputSpill:wk(t)}}]}if(e.type==="fileChange"){const t=lf(e.changes),n=ey(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return e.type==="contextCompaction"?[{id:e.id,role:"system",text:"",messageType:"compaction.done"}]:[]}function Ik(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Ak(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 _k(e){const t=Ak(e);return t.length>0?t:"Untitled thread"}function Qf(e){return(e==null?void 0:e.status)==="inProgress"}function Xf(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,o=typeof r.origin=="string"&&r.origin.trim().length>0?r.origin.trim():"";return o?{origin:o,active:r.active===!0,lastWriteAt:typeof r.lastWriteAt=="string"?r.lastWriteAt:null}:null}function Pk(e){var t;return((t=Xf(e))==null?void 0:t.active)===!0}function ty(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const o=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Qf(o)||Pk(e)}function ny(e){const t=e,n=et(typeof t.cwd=="string"?t.cwd:e.cwd),r=lk(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:_k(e),projectName:ro(n),cwd:n,hasWorktree:o,createdAtIso:um(e.createdAt),updatedAtIso:um(e.updatedAt),preview:e.preview,historyMode:t.historyMode==="legacy"?"legacy":"paginated",originator:typeof t.originator=="string"&&t.originator.trim().length>0?t.originator.trim():null,unread:!1,inProgress:ty(e),externalSession:Xf(e)}}function Mk(e){return ny(e.thread)}function Ek(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,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,i;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=r.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-o})}function Rk(e){const t=e.data.map(ny);return Ek(t)}const jk=["<subagent_notification>","<environment_context>"];function Lk(e,t){const n=e.text.trimStart();return jk.some(r=>n.startsWith(r))?!0:t<=0?!1:(e.clientId??null)===null}function cu(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,c=Array.isArray(s.items)?s.items:[],d=uk(s==null?void 0:s.startedAt),v=[];for(const T of c)for(const A of kk(T))v.push({...A,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});let f=0;for(const T of v)T.role!=="user"||T.isUnhandled===!0||(Lk(T,f)&&(T.isAgentNote=!0),f+=1);const y=dk(s);if(s.status==="failed"&&y){const T=l??`turn-${a}`;v.push({id:`${T}-error`,role:"system",text:y,messageType:"turnError",turnId:l,turnIndex:a,turnStartedAtIso:d??void 0})}r.push(...v)}return Ok(Nk(r))}function Nk(e){var n;let t=-1;for(let r=e.length-1;r>=0;r-=1)if(((n=e[r])==null?void 0:n.messageType)==="compaction.done"){t=r;break}return t<0?e:e.filter((r,o)=>r.messageType!=="compaction.done"||o===t)}function Ok(e){var s;let t=-1;for(let i=0;i<e.length;i+=1)if(((s=e[i])==null?void 0:s.messageType)==="compaction.done"){t=i;break}if(t<0)return e;const n=e[t],r=n.turnIndex;let o=-1;for(let i=0;i<e.length;i+=1){const l=e[i];if((l==null?void 0:l.turnIndex)===r&&(l==null?void 0:l.role)==="user"&&(l==null?void 0:l.isAgentNote)!==!0){o=i;break}}if(o<0||t<=o)return e;const a=e.filter((i,l)=>l!==t);return a.splice(o+1,0,n),a}function Zf(e){if(ty(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Qf(t.at(-1))}function ry(e){return Xf(e.thread)}function ep(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(Qf(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const $k=50,Dk=3e4,Gi=new Map,Fk=5e3;function Id(e){return e&&e.length>0?e:null}function Ad(e){return e&&e.length>0?e:null}function Bk(e){return vl(e)?e:""}function Uk(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function tp(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function np(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function uf(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 zk(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 tu(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Ac(e){var o,a;const t=Ye(e);if(!t)return"";const n=((o=te(t.modelProvider))==null?void 0:o.trim())??"";if(n)return n;const r=Ye(t.thread);return((a=te(r==null?void 0:r.modelProvider))==null?void 0:a.trim())??""}function dm(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 Hk(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
40
+ `;for(const r of t)n+=`
41
+ ## ${r.label}: ${r.path}
42
+ `;return`${n}
43
+ ## My request for Codex:
44
+
45
+ ${e}
46
+ `}function Wk(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function qk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",r=await fetch(n,{signal:AbortSignal.timeout(Fk)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data))return{ids:o.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:o.exclusive===!0}}catch{}return null}function Gk(e){var s;const t=Ye(e);if(!t)return null;const n=((s=te(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return vl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:vl(a)?a:null}}function fm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Vk(e={}){const t=e.includeProviderModels!==!1,n=t?await qk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(fm);const r=await ot("model/list",{}),o=[];for(const a of r.data){const s=Gk(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(fm(a));return o}async function Kk(e={}){return(await Vk(e)).map(t=>t.id)}async function Yk(){const e=await ot("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=Bk(e.config.model_reasoning_effort),o=Uk(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}async function Jk(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Id(n):Ad(n)};let o=null;try{o=await Yk()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Id(n??(o==null?void 0:o.reasoningEffort)):Ad(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await Kk()}catch{s=[]}const i=((l=s.find(c=>c.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?Id(n??(o==null?void 0:o.reasoningEffort)):Ad(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 Qk(e,t){const n=await ot("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Rk(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function Xk(e){const t=await ot("thread/read",{threadId:e,includeTurns:!1});return Mk(t)}async function Zk(e){const t=await ot("thread/read",{threadId:e,includeTurns:!0}),n=np(t),r=cu(t,n);return{model:tu(t),modelProvider:Ac(t),messages:r,inProgress:Zf(t),activeTurnId:ep(t),hasMoreOlder:n>0,turnIndexByTurnId:tp(t,n),externalSession:ry(t)}}async function eI(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(a.olderTurnsUnavailable===!0)throw new Nr("当前 codex-cli 版本暂不支持加载更早的消息",{code:"older_turns_unavailable",method:"thread/turns/list"});if(!a.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof a.startTurnIndex=="number"?a.startTurnIndex:0));return{messages:cu(a.result,s),inProgress:Zf(a.result),activeTurnId:ep(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:tp(a.result,s)}}async function pm(e=null,t=$k){try{return await Qk(e,t)}catch(n){throw ao(n,"Failed to load thread groups","thread/list")}}async function tI(e){try{return await Xk(e)}catch(t){throw ao(t,`Failed to load thread ${e}`,"thread/read")}}async function cf(e){try{return await Zk(e)}catch(t){throw ao(t,`Failed to load thread ${e}`,"thread/read")}}async function nI(e,t,n){try{return await eI(e,t,n)}catch(r){throw ao(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function BF(e){const t=new URLSearchParams({ref:e}),n=await fetch(`/codex-api/command-output?${t.toString()}`);if(!n.ok)throw new Error(`Command output request failed with ${n.status}`);const r=await n.json();return typeof r.text=="string"?r.text:""}async function df(e){const t=Gi.get(e);if(t)return t;const n=(async()=>{const o=await ot("thread/resume",{threadId:e}),a=np(o),s=cu(o,a);return{model:tu(o),modelProvider:Ac(o),messages:s,inProgress:Zf(o),activeTurnId:ep(o),hasMoreOlder:a>0,turnIndexByTurnId:tp(o,a),externalSession:ry(o)}})();Gi.set(e,n);const r=globalThis.setTimeout(()=>{Gi.get(e)===n&&Gi.delete(e)},Dk);return n.finally(()=>{globalThis.clearTimeout(r),globalThis.setTimeout(()=>{Gi.get(e)===n&&Gi.delete(e)},2e3)}).catch(()=>{}),n}async function rI(e){await ot("thread/archive",{threadId:e})}async function oI(e){await ot("thread/unarchive",{threadId:e})}async function aI(e){await ot("thread/compact/start",{threadId:e})}async function sI(e,t){await ot("thread/name/set",{threadId:e,name:t})}async function _d(e,t){const n=await ot("thread/revert",{threadId:e,beforeTurnId:t});if(!n.turnsBackwardsCursor)return[];const r=await ot("thread/turns/list",{threadId:e,cursor:n.turnsBackwardsCursor,sortDirection:"desc",limit:200,itemsView:"full"});return cu({thread:{...n.thread,turns:[...r.data].reverse()}},0)}async function iI(e){const t=await ot("thread/turns/list",{threadId:e,limit:1e4,sortDirection:"desc",itemsView:"notLoaded"});return{turnIds:(Array.isArray(t.data)?t.data:[]).map(o=>{var a;return te((a=Ye(o))==null?void 0:a.id)}).filter(o=>typeof o=="string"&&o.length>0),complete:!te(t.nextCursor)}}async function hm(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 ot("thread/start",n),o=uf(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:tu(r),modelProvider:Ac(r)}}catch(n){throw ao(n,"Failed to start a new thread","thread/start")}}async function mm(e,t,n){if(arguments.length<=1)try{const r=await ot("thread/fork",{threadId:e,persistExtendedHistory:!0}),o=uf(r);if(!o)throw new Error("thread/fork did not return a thread id");return{threadId:o,cwd:zk(r),model:tu(r),messages:cu(r,np(r))}}catch(r){throw ao(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 a=await ot("thread/fork",o),s=uf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:tu(a),modelProvider:Ac(a)}}catch(r){throw ao(r,`Failed to fork thread ${e}`,"thread/fork")}}function oy(e,t,n,r=[]){const o=[];for(const c of t){const d=dm(c.trim());d&&o.push({label:Wk(d),path:d,fsPath:d})}const a=[...r,...o],s=a.filter((c,d)=>a.findIndex(v=>v.fsPath===c.fsPath)===d),l=[{type:"text",text:Hk(ak(e,s,t),s)}];for(const c of t){const d=c.trim();if(!d)continue;const v=dm(d);if(v){l.push({type:"localImage",path:v});continue}l.push({type:"image",url:d,image_url:d})}if(n)for(const c of n)l.push({type:"skill",name:c.name,path:c.path});return{input:l,dedupedFileAttachments:s}}function ay(){const e=typeof globalThis>"u"?void 0:globalThis.crypto;if(e&&typeof e.randomUUID=="function")try{return e.randomUUID()}catch{}const t="0123456789abcdef";let n="";for(let r=0;r<36;r+=1){if(r===8||r===13||r===18||r===23){n+="-";continue}if(r===14){n+="4";continue}const o=Math.floor(Math.random()*16);n+=r===19?t[o&3|8]:t[o]}return n}async function Pd(e,t,n=[],r,o,a,s=[],i){var l;try{const c=(r==null?void 0:r.trim())??"",{input:d,dedupedFileAttachments:v}=oy(t,n,a,s),f=v.map(A=>({label:A.label,path:A.path,fsPath:A.fsPath})),y={threadId:e,input:d,clientUserMessageId:ay()};if(f.length>0&&(y.attachments=f),c&&(y.model=c),typeof o=="string"&&o.length>0&&(y.effort=o),i){const A=await Jk(i,c,o);y.collaborationMode={mode:i,settings:{model:A.model,reasoning_effort:A.reasoningEffort,developer_instructions:null}}}const T=await ot("turn/start",y);return typeof((l=T==null?void 0:T.turn)==null?void 0:l.id)=="string"?T.turn.id.trim():""}catch(c){throw ao(c,`Failed to start turn for thread ${e}`,"turn/start")}}async function lI(e,t,n,r=[],o,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=oy(n,r,o,a),c=await ot("turn/steer",{threadId:s,input:l,expectedTurnId:i,clientUserMessageId:ay()});return typeof(c==null?void 0:c.turnId)=="string"&&c.turnId.trim().length>0?c.turnId.trim():i}catch(l){throw ao(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function uI(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 ot("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw ao(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const cI=5e3,dI=3e4,vm=new Map,Md=new Map,gm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function fI(e){return vl(e)?e:""}function pI(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function hI(e){const t=e==="fast"?"fast":"standard";await ot("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 ym(){return await(await fetch("/codex-api/free-mode/status")).json()}async function wm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function bm(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 Vi(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 mI(e){const t=(e==null?void 0:e.trim())??"",n=t,r=vm.get(n);if(r&&Date.now()-r.fetchedAt<dI)return r.result;const o=Md.get(n);if(o)return o;const a=(async()=>{let s=null;try{const i=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",l=await fetch(i,{signal:AbortSignal.timeout(cI)});let c=null;try{c=await l.json()}catch{c=null}l.ok&&Array.isArray(c==null?void 0:c.data)&&(s={ids:c.data.map(d=>typeof d=="string"?d.trim():"").filter((d,v,f)=>d.length>0&&f.indexOf(d)===v),exclusive:c.exclusive===!0})}catch{}return vm.set(n,{fetchedAt:Date.now(),result:s}),s})();Md.set(n,a);try{return await a}finally{Md.delete(n)}}function vI(e){var s;const t=Ye(e);if(!t)return null;const n=((s=te(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return vl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:vl(a)?a:null}}function Tm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function gI(e={}){const t=e.includeProviderModels!==!1,n=t?await mI(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(Tm);const r=await ot("model/list",{}),o=[];for(const a of r.data){const s=vI(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(Tm(a));return o}async function yI(){const e=await ot("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=fI(e.config.model_reasoning_effort),o=pI(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function wI(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function bI(){try{const e=await ot("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"&&o!=="execplans"||t.has(o)||(t.add(o),n.push({value:o,label:wI(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of gm)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return gm}async function TI(){return Ux()}function SI(e){const t=Ye(e);if(!t)return null;const n=te(t.event??t.name??t.hookName),r=te(t.command??t.cmd);return!n||!r?null:{event:n,command:r,timeout:qt(t.timeout??t.timeout_ms),enabled:Xn(t.enabled??t.active)}}async function CI(){const e=await ot("hooks/list",{}),t=[];for(const n of e.data??[]){const r=Ye(n);r&&t.push({cwd:te(r.cwd)??"",hooks:Array.isArray(r.hooks)?r.hooks.map(SI).filter(o=>o!==null):[],warnings:_o(r.warnings),errors:_o(r.errors)})}return t}async function UF(e){await ot("marketplace/add",{source:e})}async function zF(e){await ot("marketplace/remove",{marketplaceName:e})}async function HF(){const e=await ot("marketplace/upgrade",{});return{selectedMarketplaces:_o(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:_o(e.upgradedRoots??e.upgraded_roots),errors:_o(e.errors)}}function xI(e){const t=Ye(e);if(!t)return null;const n=te(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:te(t.pluginName??t.plugin_name??t.name)??n,shareUrl:te(t.shareUrl??t.share_url??t.url)??"",createdAt:te(t.createdAt??t.created_at)??""}:null}async function WF(e){const t=await ot("plugin/share/save",{pluginPath:e});return{remotePluginId:te(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:te(t.shareUrl??t.share_url??t.url)??""}}async function qF(){const e=await ot("plugin/share/list",{});return(e.data??e.shares??[]).map(xI).filter(n=>n!==null)}async function GF(e){await ot("plugin/share/delete",{remotePluginId:e})}async function VF(e){await ot("plugin/share/checkout",{remotePluginId:e})}function sy(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.name);return!n||!r?null:{id:n,name:r,description:te(t.description)??"",installUrl:te(t.installUrl??t.install_url)??"",needsAuth:Xn(t.needsAuth??t.needs_auth)??!1}}function kI(e){const t=Ye(e);if(!t)return null;const n=te(t.name),r=te(t.path);if(!n||!r)return null;const o=Ye(t.interface);return{name:n,path:r,description:te(t.description)??"",enabled:Xn(t.enabled)??!0,displayName:te((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:te(t.shortDescription??t.short_description)??""}}function iy(e,t={}){const n=Ye(e);if(!n)return null;const r=te(n.id),o=te(n.name);if(!r||!o)return null;const a=Ye(n.interface),s=Ye(n.source),i=te(s==null?void 0:s.type)??"",l=te(s==null?void 0:s.path),c=te(s==null?void 0:s.url)??"",d=i==="remote"?t.name??null:null,v=t.path??(i==="local"?l:null),f=te((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,y=te((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),T=te((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:f,description:y??T,longDescription:T,developerName:te((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:te(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:v,remoteMarketplaceName:d,sourceType:i,sourceUrl:c,installed:Xn(n.installed)??!1,enabled:Xn(n.enabled)??!0,installPolicy:te(n.installPolicy??n.install_policy)??"",authPolicy:te(n.authPolicy??n.auth_policy)??"",logoUrl:te((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:te(a==null?void 0:a.logo)??"",composerIconUrl:te((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:te((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:te((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:_o(a==null?void 0:a.capabilities),defaultPrompt:_o((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:_o((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:_o(a==null?void 0:a.screenshots),websiteUrl:te((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:te((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:te((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function II(e,t=0){const n=Ye(e);if(!n)return null;const r=te(n.id),o=te(n.name);if(!r||!o)return null;const a=Ye(n.branding),s=Ye(n.appMetadata??n.app_metadata);return{id:r,name:o,description:te(n.description)??te((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:te(n.logoUrl??n.logo_url)??"",logoUrlDark:te(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:te(n.distributionChannel??n.distribution_channel)??"",installUrl:te(n.installUrl??n.install_url)??"",isAccessible:Xn(n.isAccessible??n.is_accessible)??!1,isEnabled:Xn(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:_o(n.pluginDisplayNames??n.plugin_display_names),category:te(a==null?void 0:a.category)??"",developer:te(a==null?void 0:a.developer)??te(s==null?void 0:s.developer)??"",website:te(a==null?void 0:a.website)??"",privacyPolicy:te((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:te((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function AI(e){const t=Ye(e);if(!t)return null;const n=te(t.name);if(!n)return null;const r=Ye(t.tools)??{},o=Object.entries(r).map(([l,c])=>{const d=Ye(c);return{name:te(d==null?void 0:d.name)??l,title:te(d==null?void 0:d.title)??"",description:te(d==null?void 0:d.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const c=Ye(l);return{name:te(c==null?void 0:c.name)??"",title:te(c==null?void 0:c.title)??"",uri:te(c==null?void 0:c.uri)??"",description:te(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const c=Ye(l);return{name:te(c==null?void 0:c.name)??"",title:te(c==null?void 0:c.title)??"",uriTemplate:te((c==null?void 0:c.uriTemplate)??(c==null?void 0:c.uri_template))??"",description:te(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:te(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:i}}async function KF(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await ot("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=Ye(o);if(!a)continue;const s=Ye(a.interface),i={name:te(a.name)??"",displayName:te((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:te(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const c of l){const d=iy(c,i);d&&r.push(d)}}return r}async function YF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await ot("plugin/read",t),r=Ye(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=iy(r.summary,{name:te(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:te(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:te(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(sy).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(kI).filter(a=>a!==null):[],mcpServers:_o(r.mcpServers??r.mcp_servers)}}async function JF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await ot("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:te(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(sy).filter(o=>o!==null)}}async function QF(e){await ot("plugin/uninstall",{pluginId:e})}async function XF(e,t){await ot("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function ZF(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await ot("app/list",o);for(const s of a.data??[]){const i=II(s,r);i&&t.push(i),r+=1}n=te(a.nextCursor??a.next_cursor)}while(n);return t}async function eB(e,t){await ot("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function tB(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await ot("mcpServerStatus/list",n);for(const o of r.data??[]){const a=AI(o);a&&e.push(a)}t=te(r.nextCursor??r.next_cursor)}while(t);return e}async function nB(){await ot("config/mcpServer/reload",{})}async function rB(e){const t=await ot("mcpServer/oauth/login",{name:e});return{authorizationUrl:te(t.authorizationUrl??t.authorization_url)??""}}async function oB(){const e=await fetch("/codex-api/composio/status");if(!e.ok)throw new Error(`Failed to load Composio status (${e.status})`);return await e.json()}async function aB(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function sB(e){const t=await fetch(`/codex-api/composio/connector?slug=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`Failed to load Composio connector (${t.status})`);return await t.json()}async function iB(e){const t=await fetch("/codex-api/composio/link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e})});if(!t.ok)throw new Error(`Failed to start Composio login (${t.status})`);return await t.json()}async function lB(){const e=await fetch("/codex-api/composio/login",{method:"POST"});if(!e.ok)throw new Error(`Failed to start Composio CLI login (${e.status})`);return await e.json()}async function uB(){const e=await fetch("/codex-api/composio/install",{method:"POST"});if(!e.ok)throw new Error(`Failed to install Composio CLI (${e.status})`);return await e.json()}function Sm(e){const t=Ye(e);if(!t)return null;const n=qt(t.usedPercent??t.used_percent);if(n===null)return null;const r=qt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:qt(t.resetsAt??t.resets_at)}}function _I(e){const t=Ye(e);if(!t)return null;const n=Xn(t.hasCredits??t.has_credits),r=Xn(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function Cm(e){const t=Ye(e);if(!t)return null;const n=Sm(t.primary),r=Sm(t.secondary),o=_I(t.credits);return!n&&!r&&!o?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:te(t.planType??t.plan_type)}}function ly(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Cm(n==null?void 0:n.codex);return r||Cm(t.rateLimits??t.rate_limits)}const PI=100;function MI(){return PI}function EI(e){return Hx(e)}async function RI(e,t){await Wx({id:e,...t})}async function xm(){return qx()}function jI(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",c=typeof i.path=="string"?i.path.trim():"";return l&&c?[{name:l,path:c}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.label=="string"?i.label.trim():"",c=typeof i.path=="string"?i.path.trim():"",d=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&c&&d?[{label:l,path:c,fsPath:d}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function uy(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const i=jI(s);return i?[i]:[]});a.length>0&&(t[o]=a)}return t}async function km(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return uy(n.data)}async function LI(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(uy(e))})).ok)throw new Error("Failed to save thread queue state")}async function NI(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=Xt(r,"Failed to connect Telegram bot");throw new Error(o)}}async function OI(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Xt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function $I(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=Xt(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:""}}async function DI(){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 ic(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 FI(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function BI(e,t){try{await fetch("/codex-api/thread-reasoning",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,messages:t})})}catch{}}async function UI(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function zI(e,t,n){try{await fetch("/codex-api/thread-turn-durations",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,durationMs:n})})}catch{}}async function HI(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function WI(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function qI(){var e;try{const t=await fetch("/codex-api/preferences/first-launch-plugins-card");return t.ok?{dismissed:((e=(await t.json()).data)==null?void 0:e.dismissed)===!0}:{dismissed:!1}}catch{return{dismissed:!1}}}async function GI(e){try{await fetch("/codex-api/preferences/first-launch-plugins-card",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dismissed:e})})}catch{}}async function VI(e,t){var n;try{return((n=(await ot("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function ff(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function KI(e,t){const n=ff(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const l=r[o-2]??"";if(l){const c=`/${[...r.slice(0,o+1),l,"SKILL.md"].join("/")}`;if(t.has(c))return{rootPath:c,rootName:l,isNested:c!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const i=`/${[...r.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(i)?{rootPath:i,rootName:s,isNested:i!==n}:{rootPath:i,rootName:s,isNested:i!==n}}async function YI(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await ot("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>ff(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const i of s.skills){if(!i.name)continue;const l=KI(i.path,o),c=ff(i.path),v=!!(l!=null&&l.isNested&&o.has(l.rootPath))?l.rootPath:c,f=c===v,y=a.get(v),T={name:i.name,displayName:l&&v===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:v,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!y){a.set(v,T);continue}if(y.enabled=y.enabled||i.enabled,!y.__hasRoot&&f){a.set(v,T);continue}!y.displayName&&T.displayName&&(y.displayName=T.displayName),!y.description&&T.description&&(y.description=T.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const JI=6e4;async function Eu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),JI);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)}}function QI(e){return e==="payment_required"?e:null}function XI(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Im(e){const t=Ye(e);if(!t)return null;const n=qt(t.usedPercent??t.used_percent);if(n===null)return null;const r=qt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:qt(t.resetsAt??t.resets_at)}}function ZI(e){const t=Ye(e);if(!t)return null;const n=Xn(t.hasCredits??t.has_credits),r=Xn(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function eA(e){const t=Ye(e);if(!t)return null;const n=Im(t.primary),r=Im(t.secondary),o=ZI(t.credits);return!n&&!r&&!o?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:te(t.planType??t.plan_type)}}function cy(e,t=null,n=null){const r=Ye(e);if(!r)return null;const o=te(r.accountId),a=te(r.storageId)??o,s=te(r.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return o?{accountId:o,storageId:a??o,userId:te(r.userId),authMode:te(r.authMode),email:te(r.email),planType:te(r.planType),lastRefreshedAtIso:te(r.lastRefreshedAtIso)??"",lastActivatedAtIso:te(r.lastActivatedAtIso),quotaSnapshot:eA(r.quotaSnapshot),quotaUpdatedAtIso:te(r.quotaUpdatedAtIso),quotaStatus:i,quotaError:te(r.quotaError),unavailableReason:QI(r.unavailableReason)??(XI(te(r.quotaError))?"payment_required":null),isActive:Xn(r.isActive)??(a===n||o===t)}:null}function dy(e){const t=Ye(e);if(!t)return null;const n=te(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:te(t.deviceName??t.device_name??t.name)??"",lastSeenAt:te(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function tA(){const e=await ot("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Xn(e.enabled)??!1,clients:t.map(dy).filter(n=>n!==null)}}async function nA(){var r;const e=await fetch("/codex-api/approval-policy"),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to read approval policy");const n=te((r=t.data)==null?void 0:r.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function rA(e){const t=await fetch("/codex-api/approval-policy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({policy:e})}),n=await t.json();if(!t.ok)throw new Error(n.error||"Failed to save approval policy")}async function oA(e){await ot(e?"remoteControl/enable":"remoteControl/disable",{})}async function aA(){const e=await ot("remoteControl/pairing/start",{});return{pairingCode:te(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:te(e.expiresAt??e.expires_at)}}async function sA(){const e=await ot("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(dy).filter(n=>n!==null)}async function iA(e){await ot("remoteControl/client/revoke",{clientId:e})}async function lA(){try{const e=await ot("account/rateLimits/read");return ly(e)}catch(e){throw ao(e,"Failed to load account rate limits","account/rateLimits/read")}}function _c(e){const t=Ye(e),n=te(t==null?void 0:t.activeAccountId),r=te(t==null?void 0:t.activeStorageId),o=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:r,importedAccountId:te(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:te(t==null?void 0:t.importedStorageId)??void 0,accounts:o.map(a=>cy(a,n,r)).filter(a=>a!==null)}}async function uA(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Xt(t,"Failed to load accounts"));const n=Ye(t);return _c(n==null?void 0:n.data)}async function Am(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Xt(t,"Failed to refresh accounts"));const n=Ye(t);return _c(n==null?void 0:n.data)}async function cA(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Xt(t,"Failed to start Codex login"));const n=Ye(t),r=Ye(n==null?void 0:n.data),o=te(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function dA(e){const t=await fetch("/codex-api/accounts/login/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:e})}),n=await t.json();if(!t.ok)throw new Error(Xt(n,"Failed to complete Codex login"));const r=Ye(n);return _c(r==null?void 0:r.data)}async function fA(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Xt(n,"Failed to switch account"));const r=Ye(n),o=Ye(r==null?void 0:r.data),a=cy(o==null?void 0:o.account,te(o==null?void 0:o.activeAccountId),te(o==null?void 0:o.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function pA(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Xt(n,"Failed to remove account"));const r=Ye(n);return _c(r==null?void 0:r.data)}let Ru=null,Gl=null;function hA(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const i=typeof a=="string"?et(a):"";i.length>0&&typeof s=="string"&&(o[i]=s)}return{order:n(t.order).map(a=>et(a)),labels:o,active:n(t.active).map(a=>et(a)),projectOrder:n(t.projectOrder).map(a=>et(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,i=typeof s.id=="string"?s.id.trim():"";return i?[{id:i,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?et(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function Zi(){return Gl?pf(Gl):(Ru||(Ru=mA().then(e=>(Gl=e,e)).finally(()=>{Ru=null})),pf(await Ru))}async function mA(){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 hA(n.data)}function pf(e){var t;return{order:[...e.order],labels:{...e.labels},active:[...e.active],projectOrder:[...e.projectOrder],remoteProjects:((t=e.remoteProjects)==null?void 0:t.map(n=>({...n})))??[]}}function rp(){Gl=null}async function vA(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:et(o.data.cwd),gitRoot:et(o.data.gitRoot)}}async function gA(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:et(r.data.cwd),gitRoot:et(r.data.gitRoot)}}async function yA(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 a=Array.isArray(o.data)?o.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const c=l,d=typeof c.value=="string"?c.value.trim():"",v=typeof c.label=="string"?c.label.trim():"";!d||i.has(d)||(i.add(d),s.push({value:d,label:v||d}))}return s}async function wA(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[],changedFiles:[]};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 a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],c=[],d=new Set;for(const U of l){if(!U||typeof U!="object"||Array.isArray(U))continue;const O=U,$=typeof O.value=="string"?O.value.trim():"",q=typeof O.label=="string"?O.label.trim():"";!$||d.has($)||(d.add($),c.push({value:$,label:q||$,isCurrent:O.isCurrent===!0,isRemote:O.isRemote===!0}))}i&&!d.has(i)&&c.unshift({value:i,label:i,isCurrent:!0});const v=a.headSha,f=a.headSubject,y=a.headDate,T=a.gitRoot,A=fy(a.changedFiles);return{currentBranch:i,headSha:typeof v=="string"&&v.trim()?v.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof y=="string"&&y.trim()?y.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof T=="string"?et(T):"",options:c,changedFiles:A}}function fy(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){if(!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.path,s=typeof a=="string"?et(a.trim()):"";if(!s)continue;const i=o.status,l=typeof i=="string"?i.trim():"",c=o.label,d=typeof c=="string"&&c.trim()?c.trim():l;n.push({path:s,previousPath:typeof o.previousPath=="string"&&o.previousPath.trim()?et(o.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof o.addedLineCount=="number"?o.addedLineCount:null,removedLineCount:typeof o.removedLineCount=="number"?o.removedLineCount:null})}return n}async function bA(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):""}}async function TA(e,t){var a;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=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function SA(e,t,n={}){const r=e.trim(),o=t.trim();if(!r||!o)return[];const a=new URLSearchParams({cwd:r,branch:o,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(i.error||"Failed to load branch commits");return(Array.isArray(i.data)?i.data:[]).flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const d=c,v=typeof d.sha=="string"?d.sha.trim():"",f=typeof d.shortSha=="string"?d.shortSha.trim():"",y=typeof d.subject=="string"?d.subject.trim():"",T=typeof d.date=="string"?d.date.trim():"";return!v||!f?[]:[{sha:v,shortSha:f,subject:y||f,date:T}]})}async function CA(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,sha:r}),a=await fetch(`/codex-api/git/commit-files?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const c=l,d=typeof c.path=="string"?c.path:"",v=typeof c.previousPath=="string"&&c.previousPath.length>0?c.previousPath:null,f=typeof c.status=="string"?c.status.trim():"",y=typeof c.label=="string"?c.label.trim():"",T=typeof c.addedLineCount=="number"&&Number.isFinite(c.addedLineCount)?c.addedLineCount:null,A=typeof c.removedLineCount=="number"&&Number.isFinite(c.removedLineCount)?c.removedLineCount:null;return!d||!f?[]:[{path:d,previousPath:v,status:f,label:y||f,addedLineCount:T,removedLineCount:A}]})}async function xA(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):"",options:[],changedFiles:fy(a.changedFiles)}}async function Ed(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");Gl=pf(e)}async function ju(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 i=Xt(r,"Failed to open project root");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?et(a.path):"";return rp(),s}function kA(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function IA(e,t){var a;const n=e.headers.get("content-disposition")??"",r=n.match(/filename\*=UTF-8''([^;]+)/iu);if(r!=null&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}const o=n.match(/filename="?([^";]+)"?/iu);return((a=o==null?void 0:o[1])==null?void 0:a.trim())||t}async function AA(e,t){var d;const n=await fetch(kA(e));if(!n.ok){const v=await n.json().catch(()=>null),f="Failed to export project",y=Xt(v,f),T=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),A=y!==f?y:T?`Failed to export project: ${T}`:f;throw new Error(A)}const r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=IA(n,"project.zip"),s=(d=n.body)==null?void 0:d.getReader();if(!s){const v=await n.blob();return t==null||t({loaded:v.size,total:v.size||o}),{blob:v,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:o});;){const{done:v,value:f}=await s.read();if(v)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:o}))}const c=i.map(v=>{const f=new Uint8Array(v.byteLength);return f.set(v),f.buffer});return{blob:new Blob(c,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function _A(e,t){const n=new URLSearchParams({parent:t}),r=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),o=await Ai(r);if(!r.ok){const l=Xt(o,"Failed to import project");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?et(s.path):"";return i&&rp(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function _m(){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 PA(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 Ai(r);if(!r.ok){const l=Xt(o,"Failed to load local directories");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?et(s.path):"",parentPath:typeof s.parentPath=="string"?et(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const c=l,d=typeof c.name=="string"?c.name.trim():"",v=typeof c.path=="string"?et(c.path):"";return d&&v?[{name:d,path:v}]:[]})}}async function cB(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=Xt(r,"Failed to load workspace files");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,c=typeof l.path=="string"?et(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!c||!d?[]:[{path:c,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function dB(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=Xt(r,"Failed to preview file");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data,s=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return{path:typeof s.path=="string"?s.path:e,name:typeof s.name=="string"?s.name:"",size:typeof s.size=="number"?s.size:0,isText:s.isText===!0,isImage:s.isImage===!0,content:typeof s.content=="string"?s.content:void 0,truncated:s.truncated===!0}}async function MA(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Ai(t);if(!t.ok){const s=Xt(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:{},a=typeof o.path=="string"?et(o.path):"";return a&&rp(),a}async function EA(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await Ai(n);if(!n.ok){const s=Xt(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?et(a.path):""}async function RA(e){const t=await fetch("/codex-api/projectless-thread-cwd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e??null})}),n=await Ai(t);if(!t.ok){const s=Xt(n,"Failed to create new chat folder");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:{},a=typeof o.cwd=="string"?et(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?et(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?et(o.workspaceRoot):""}}async function jA(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 s=Xt(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?et(a.path):""}}function LA(e){const t=Ye(e);if(!t)return null;const n=te(t.key),r=typeof t.text=="string"?t.text:"",o=te(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:qt(t.oldLine),newLine:qt(t.newLine)}}function NA(e){const t=Ye(e);if(!t)return null;const n=te(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:qt(t.addedLineCount)??0,removedLineCount:qt(t.removedLineCount)??0,oldStart:qt(t.oldStart),oldLineCount:qt(t.oldLineCount)??0,newStart:qt(t.newStart),newLineCount:qt(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>LA(a)).filter(a=>a!==null):[]}:null}function OA(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.path),o=te(t.absolutePath),a=te(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:te(t.previousPath),previousAbsolutePath:te(t.previousAbsolutePath),operation:a,addedLineCount:qt(t.addedLineCount)??0,removedLineCount:qt(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>NA(s)).filter(s=>s!==null):[]}}function py(e){const t=Ye(e),n=Ye(t==null?void 0:t.data),r=Ye(n==null?void 0:n.summary),o=te(n==null?void 0:n.scope),a=o==="baseBranch"||o==="commit"?o:"workspace",s=te(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:te(n==null?void 0:n.cwd)??"",gitRoot:te(n==null?void 0:n.gitRoot),isGitRepo:Xn(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:te(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>te(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:te(n==null?void 0:n.commitSha),headBranch:te(n==null?void 0:n.headBranch),mergeBaseSha:te(n==null?void 0:n.mergeBaseSha),generatedAtIso:te(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:qt(r==null?void 0:r.fileCount)??0,addedLineCount:qt(r==null?void 0:r.addedLineCount)??0,removedLineCount:qt(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>OA(i)).filter(i=>i!==null):[]}}function $A(e){const t=Ye(e),n=Ye(t==null?void 0:t.data);return{fileCount:qt(n==null?void 0:n.fileCount)??0,addedLineCount:qt(n==null?void 0:n.addedLineCount)??0,removedLineCount:qt(n==null?void 0:n.removedLineCount)??0}}async function fB(e,t,n,r,o){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim()),o&&o.trim()&&a.set("commitSha",o.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Xt(i,"Failed to load review snapshot"));return py(i)}async function DA(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),r=await fetch(`/codex-api/review/summary?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(Xt(o,"Failed to load review summary"));return $A(o)}async function pB(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(Xt(n,"Failed to apply review action"));return py(n)}async function hB(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(Xt(n,"Failed to initialize Git"))}async function FA(e,t,n,r,o,a,s){try{const i=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:r,patchIds:o,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const c=typeof l.message=="string"&&l.message.trim()?l.message.trim():typeof l.error=="string"&&l.error.trim()?l.error.trim():"Server error";return{changed:0,errors:Array.isArray(l.errors)&&l.errors.length>0?l.errors:[c],message:l.message}}return{changed:l.changed??l.reverted??l.applied??0,errors:Array.isArray(l.errors)?l.errors:[],message:l.message,revertedPatchIds:Array.isArray(l.revertedPatchIds)?l.revertedPatchIds:[],appliedPatchIds:Array.isArray(l.appliedPatchIds)?l.appliedPatchIds:[]}}catch(i){return{changed:0,errors:[i instanceof Error?i.message:"Network error"]}}}async function BA(e,t,n){const r=await FA(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}const UA={},zA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function HA(e,t){return P(),B("svg",zA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Us=Ct(UA,[["render",HA]]),WA={},qA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function GA(e,t){return P(),B("svg",qA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Lu=Ct(WA,[["render",GA]]),VA={},KA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function YA(e,t){return P(),B("svg",KA,[...t[0]||(t[0]=[w("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 hf=Ct(VA,[["render",YA]]),JA={},QA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function XA(e,t){return P(),B("svg",QA,[...t[0]||(t[0]=[w("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 gl=Ct(JA,[["render",XA]]),ZA={},e_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function t_(e,t){return P(),B("svg",e_,[...t[0]||(t[0]=[w("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 op=Ct(ZA,[["render",t_]]),n_={},r_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function o_(e,t){return P(),B("svg",r_,[...t[0]||(t[0]=[w("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 a_=Ct(n_,[["render",o_]]),s_={},i_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function l_(e,t){return P(),B("svg",i_,[...t[0]||(t[0]=[w("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 Pc=Ct(s_,[["render",l_]]),hy="codex-web-local.ui-language.v1",u_={English:"English","Simplified Chinese":"简体中文",Commands:"命令",Command:"命令",Local:"本地","Compact the current thread context":"压缩当前线程上下文","Open the code review pane":"打开代码审查面板","Rename the current thread":"重命名当前线程","Archive the current thread":"归档当前线程","Fork the current thread":"派生当前线程","Start a new thread":"新建线程","Open the skills page":"打开技能页面","Generate or update AGENTS.md":"生成或更新 AGENTS.md","Show help about Codex":"显示 Codex 使用帮助","Mention files with @":"使用 @ 提及文件","Show the current git diff":"显示当前 git diff","Clear the input":"清空输入","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索",Chats:"聊天",Projects:"项目",Pinned:"已固定","Chats first":"聊天优先","Sort by":"排序",Created:"创建时间",Updated:"更新时间","New chat":"新聊天","No chats":"没有聊天","Skills Hub":"技能中心","Expand accounts":"展开账户","Collapse accounts":"折叠账户",Accounts:"账户","Reloading…":"重新加载中…",Reload:"重新加载","Run `codex login`, then click reload.":"先运行 `codex login`,然后点击重新加载。",Account:"账户",Workspace:"工作区","Require ⌘ + enter to send":"需要 ⌘ + Enter 才发送","When busy, send as":"忙碌时发送方式",Steer:"引导",Queue:"排队",Appearance:"外观",System:"跟随系统",Dark:"深色",Light:"浅色","Chat width":"聊天宽度","Click to toggle dictation":"点击切换语音输入","Auto send dictation":"语音输入后自动发送",Provider:"提供方","Choose the API provider for the Codex backend":"选择 Codex 后端使用的 API 提供方","OpenRouter API key":"OpenRouter API Key","Get API key":"获取 API Key","Remove custom key, use community keys":"移除自定义 key,改用社区 key",Set:"设置",Save:"保存","API format":"API 格式","OpenRouter API format":"OpenRouter API 格式",Responses:"Responses",Completions:"Completions","OpenCode Zen API key":"OpenCode Zen API Key","Custom endpoint URL":"自定义端点 URL","API key":"API Key","Custom endpoint API format":"自定义端点 API 格式","UI language":"界面语言","Choose the interface language for the app.":"选择应用界面语言。","Dictation language":"听写语言","Auto-detect":"自动检测","Search language...":"搜索语言...",Telegram:"Telegram","Bot token":"Bot Token","Allowed Telegram user IDs":"允许的 Telegram 用户 ID","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.":"每行填写一个 Telegram 用户 ID,或用逗号分隔。使用 `*` 可允许所有 Telegram 用户。未授权用户会在拒绝消息中看到自己的 ID,方便复制到这里。","Saving…":"保存中…","Save Telegram config":"保存 Telegram 配置",Context:"上下文","Worktree name and version":"工作树名称和版本",Settings:"设置","General settings":"常规","Models & providers":"模型与提供商",Integrations:"集成","Usage & about":"用量与关于","Thinking process":"思考过程","Turn process":"本轮过程","Collapse turn process":"收起本轮过程","Expand turn process":"展开本轮过程","{n} process items":"{n} 个过程项","Working…":"执行中…",Processed:"已处理","{n} tools":"{n} 个工具","{n} thoughts":"{n} 条思考","{n} commands":"{n} 个命令","Question navigation":"问题导航","Jump to question {n}":"跳转到问题 {n}","Read {n} files":"已读 {n} 个文件","Search {n} files":"搜索 {n} 个文件","{n} read calls":"{n} 次只读调用","Modified {n} files":"已修改 {n} 个文件","Delegated {n} tasks":"已委派 {n} 个任务","Explored {n} items":"已探索 {n} 项","Stopped: message not submitted, restored to input.":"已停止:消息未提交,已回填到输入框。","Stopped: message not submitted.":"已停止:消息未提交。","Load earlier ({n} turns)":"展开前 {n} 轮对话","Load earlier messages":"加载更早的消息",Steps:"步骤","Implement plan":"执行计划","Plan executed":"计划已执行","Implementing…":"执行中…","Toggle terminal":"切换终端","Open terminal":"打开终端","Terminal command":"终端命令","No commands":"没有命令","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","Create or clone":"创建或克隆","Create or clone project":"创建或克隆项目","Project source":"项目来源","New project":"新项目","Destination folder":"目标文件夹","New project name":"新项目名称","GitHub repository URL":"GitHub 仓库 URL","Create project":"创建项目","Creating…":"创建中…","Clone repository":"克隆仓库","Clone from GitHub":"从 GitHub 克隆","Cloning…":"克隆中…","Current folder":"当前文件夹",Unavailable:"不可用","Opening…":"打开中…",Open:"打开","Show hidden folders":"显示隐藏文件夹","New folder":"新建文件夹","Folder name":"文件夹名称","Filter folders...":"筛选文件夹...",Retry:"重试","Loading folders…":"加载文件夹中…","No folders match this filter.":"没有匹配此筛选条件的文件夹。","No subfolders found here.":"这里没有子文件夹。","Base branch":"基础分支","Select branch":"选择分支","Loading branches…":"加载分支中…","No Git branches found for this folder.":"此文件夹未找到 Git 分支。","Local project":"本地项目","New worktree":"新工作树","Service worker registration failed.":"Service Worker 注册失败。","No matching files":"没有匹配的文件","Add photos & files":"添加图片和文件","Add folder":"添加文件夹","Take photo":"拍照","In-progress send":"执行中发送","Fast mode":"快速模式","Plan mode":"规划模式","Agent proposes a plan before acting":"代理在执行前先提出计划",Model:"模型","Search models...":"搜索模型...",Skills:"技能","Search skills...":"搜索技能...","Search skills and prompts...":"搜索技能和提示词...",Thinking:"思考强度","Saving thread before stop is available":"线程保存后才能停止",Stop:"停止","This thread is running in the Codex TUI":"该线程正在 Codex TUI 中运行","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...","Still loading — the first open of a large history can take a while.":"仍在加载——较大的历史会话首次打开可能需要较长时间。",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Rollback this message":"回退此消息",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查",Commit:"提交","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","No file changes in this commit.":"此提交中没有文件更改。","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads. Clear the search to see all threads.":"没有匹配的线程。清除搜索即可查看全部线程。","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads yet. Start a new thread to begin.":"还没有线程。新建一个线程即可开始。","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Yes:"是","Yes for Session":"本次会话内允许",pending:"条待处理","Do you want to run this command?":"是否运行此命令?","Do you want to make these changes?":"是否进行这些更改?","Do you want to grant these permissions?":"是否授予这些权限?","An MCP server needs your input before Codex can continue.":"MCP 服务器需要你的输入,Codex 才能继续。","Codex needs your answer before it can continue.":"Codex 需要你的回答才能继续。","Codex is waiting for a response before it can continue.":"Codex 正在等待你的回复,然后才能继续。",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作",Skill:"技能","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Ask Codex anything, @ to add files, / for commands":"向 Codex 提问,@ 添加文件,/ 执行命令",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑","Edit automation":"编辑自动化",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽",Hooks:"Hooks","Reload lifecycle hooks":"重新加载生命周期 Hooks","Hooks are not supported by this Codex version.":"当前 Codex 版本不支持 Hooks。","Loading hooks…":"加载 Hooks 中…","No hooks registered.":"未注册任何 Hooks。",Global:"全局",Enabled:"已启用","Compacting thread context…":"正在压缩上下文…","Context compacted":"上下文已压缩","Agent note":"代理注记","Approval policy":"审批策略","Choose when Codex asks for your permission before running commands or changing files.":"选择 Codex 在执行命令或修改文件前何时征求你的许可。","Only untrusted commands":"仅不受信任的命令","After a command fails":"命令失败后","When Codex requests it":"请求时",Never:"从不","Unless trusted":"除非信任",Default:"默认","Execution plans":"执行计划","Not supported by this Codex version":"当前 Codex 版本不支持","Remote control":"远程控制","Enable or disable remote control":"启用或禁用远程控制","Remote control is not supported by this Codex version.":"当前 Codex 版本不支持远程控制。","Pair a new device":"配对新设备","Generate code":"生成配对码","Paired devices":"已配对设备","No paired devices.":"暂无已配对设备。",Revoke:"撤销","Starting…":"启动中…","Add panel":"添加面板","Approval policy saved":"审批策略已保存",Automations:"自动化","Bearer token (optional)":"Bearer Token(可选)","Close panel":"关闭面板","Close side panel":"关闭侧边面板",Codex:"Codex",Compact:"压缩","Compacting…":"正在压缩…","Compacts context before send":"发送前压缩上下文","Auto-compact before send":"发送前自动压缩","Compacting context — the message will send after compaction":"正在压缩上下文——消息将在压缩完成后发送","Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.":"当剩余上下文占比等于或低于该百分比时,发送前先自动压缩上下文。0 表示关闭,退回服务端自动压缩。","Custom endpoint":"自定义端点","Failed to resolve model from custom endpoint; check the URL and try again":"无法从自定义端点获取模型,请检查 URL 后重试",Off:"关闭",Dismiss:"忽略",Download:"下载","Drag to reorder queued message":"拖动可重新排列排队消息","Exit full screen composer":"退出全屏输入框","Expand composer":"展开输入框","Explore Plugins & Apps":"探索插件与应用","Export Project":"导出项目",Exporting:"正在导出","Failed to share project. Use Download instead.":"项目分享失败,请改用下载。","Files panel":"文件面板","Filter files...":"筛选文件...",Git:"Git","Git panel":"Git 面板","Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.":"将 Codex 接入 Gmail、日历、GitHub、Slack、Browser Use 等应用,让它可以立即帮你处理实际工作。","Import Project":"导入项目","Importing…":"正在导入…","Issue detected":"发现问题","Loading files...":"加载文件中...","Loading…":"加载中…","New in Codex":"Codex 新功能","No files in workspace.":"工作区中没有文件。","No searchable directory for this thread":"此线程没有可搜索的目录","Open side panel":"打开侧边面板","OpenCode Zen":"OpenCode Zen",OpenRouter:"OpenRouter",Plugin:"插件","Plugins are here":"插件来了","Plugins, apps, MCPs":"插件、应用、MCP","Preparing project ZIP...":"正在准备项目 ZIP...","Preparing...":"正在准备...",Ready:"就绪",Repo:"仓库","Scheduled work":"定时任务",Search:"搜索","Search options...":"搜索选项...","Send feedback":"发送反馈",Share:"分享","Skills directory":"技能目录","Terminal panel":"终端面板","This browser blocked sharing the ZIP. Use Download instead.":"浏览器阻止了分享 ZIP,请改用下载。",User:"用户","sk-or-v1-... (optional, uses free keys if empty)":"sk-or-v1-...(可选,留空则使用免费 key)","File preview":"文件预览","Loading file…":"正在加载文件…","Failed to preview file":"文件预览失败","This file type cannot be previewed.":"此文件类型无法预览。","Open in browser":"在浏览器中打开","File is large; showing the first part.":"文件较大,仅显示开头部分。","Confirm delete":"确认删除",Confirm:"确认",Authenticated:"已认证",Failed:"失败","Logged in":"已登录",Unknown:"未知","No auth":"无需认证","No auth required":"无需认证","Connection required":"需要连接","Composio workspace":"Composio 工作区","Apps needing auth":"需要认证的应用","Plugin shares":"插件分享",Connector:"连接器",connected:"已连接",account:"个账户",accounts:"个账户",Manage:"管理",Reconnect:"重新连接",Connect:"连接",App:"应用",Plugins:"插件",Apps:"应用","Composio CLI shares the login and connections from this machine.":"Composio CLI 共享本机的登录状态与连接。","Bearer token":"Bearer Token","Login required":"需要登录","Auth unsupported":"不支持认证","Status unknown":"状态未知","OpenAI catalog":"OpenAI 目录","Ecosystem directory":"生态系统目录",Expired:"已过期",Pending:"待处理","Plugins make Codex work your way.":"插件让 Codex 按你的方式工作。","Connect Codex to external apps and services.":"将 Codex 连接到外部应用与服务。","Browse Composio connectors, auth state, and ready-to-try integrations.":"浏览 Composio 连接器、认证状态与可直接尝试的集成。","MCPs first, then installed skills and GitHub sync state.":"先看 MCP,再是已安装技能与 GitHub 同步状态。","Close plugin detail":"关闭插件详情","Close plugin shares":"关闭插件分享","Close Composio detail":"关闭 Composio 详情","Add another automation":"再添加一个自动化","New thread":"新建线程",methods:"个方法",Schedule:"计划",Daily:"每天",days:"天",Interval:"间隔","Run every day at":"每天运行时间","Run every":"每隔",Unit:"单位","Running…":"运行中…","Run now":"立即运行","Archive and remove":"归档并移除",Delete:"删除",'This will archive the thread "{title}" and remove the attached heartbeat automations.':"这将归档线程「{title}」并移除其关联的心跳自动化。",'This will archive the thread "{title}". You can find it later in archived threads.':"这将归档线程「{title}」。你之后可以在已归档线程中找到它。","Recycle bin":"回收站","Threads you removed are kept here so you can restore them.":"被移除的线程会保存在这里,你可以随时还原。","Recycle bin is empty.":"回收站是空的。",Restore:"还原","Restoring…":"还原中…","Delete permanently":"永久删除","Delete thread?":"删除线程?","Archive chat and remove automations?":"归档聊天并移除自动化?",active:"个进行中",added:"已新增","Add automation":"添加自动化","Add automation…":"添加自动化…",ago:"前","Answer the required field":"请填写必填字段",app:"应用",automations:"个自动化",cached:"缓存",changed:"已更改",Checkout:"检出","Checking out...":"检出中…","command:":"命令:","Context window":"上下文窗口","Copy path":"复制路径",Credits:"额度","cwd:":"工作目录:","day(s)":"天",deleted:"已删除",Detached:"已分离",edited:"已编辑",Edited:"已编辑",Every:"每","exitCode:":"退出码:","Failed to connect {name}":"连接 {name} 失败","Failed to start login for {name}":"为 {name} 启动登录失败","file changed":"个文件已更改","files changed":"个文件已更改","hour(s)":"小时",hours:"小时",Image:"图片",input:"输入","Last turn":"上一轮","Manage automations…":"管理自动化…","minute(s)":"分钟",minutes:"分钟",moved:"已移动","Network access":"网络访问",Next:"下次","Next run":"下次运行","Not scheduled":"未计划",RRULE:"规则","No login URL returned for {name}":"未返回 {name} 的登录链接","Opened {name} authorization":"已打开 {name} 授权",output:"输出",plugin:"插件","plugin installed":"插件已安装","plugin uninstalled":"插件已卸载",Preferred:"首选","Primary window":"主窗口","Project automation":"项目自动化",Read:"读取",reasoning:"推理","Removing...":"移除中…","resets in":"重置于","Resets in":"重置于","runs every":"每","Secondary window":"次窗口","Session total":"会话总计","Share this plugin":"共享此插件","Sharing...":"共享中…",Show:"显示","skill installed":"技能已安装","skill uninstalled":"技能已卸载","start new thread":"新建线程","status:":"状态:",total:"总计","Weekly refresh":"每周刷新",Write:"写入","Current branch":"当前分支","Credits available":"额度可用","Custom schedule":"自定义计划","Detached HEAD":"已分离 HEAD","Every minute":"每分钟",Hourly:"每小时","In context":"上下文内","Loading branch...":"加载分支中...","Rate limits":"速率限制","Resetting now":"正在重置",unlimited:"无限",Weekly:"每周",Window:"窗口","Automation details":"自动化详情","Automation run queued.":"自动化运行已排队。","Automation saved.":"自动化已保存。","Awaiting approval":"等待审批","Awaiting response":"等待响应",Branches:"分支",command:"个命令",commands:"个命令","Command approval required":"需要命令审批",Commits:"提交",Completed:"已完成","Copied commit ref":"已复制提交引用",Copied:"已复制",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成","Rollback this turn?":"回退到该轮?",Exit:"退出","Failed to delete project automation":"删除项目自动化失败","Failed to install skill":"安装技能失败","Failed to load automations":"加载自动化失败","Failed to load skills":"加载技能失败","Failed to remove automation":"移除自动化失败","Failed to run automation":"运行自动化失败","Failed to save automation":"保存自动化失败","Failed to search skills":"搜索技能失败","Failed to uninstall skill":"卸载技能失败","Failed to update file changes.":"更新文件变更失败。","Failed to update skill":"更新技能失败","File change approval required":"需要文件变更审批",Heartbeat:"心跳","Input required":"需要输入","Install completed but no local skill path was returned":"安装完成,但未返回本地技能路径","Install completed but the local skill was not found after refresh":"安装完成,但刷新后未找到本地技能","Install failed":"安装失败",Interrupted:"已中断","latest:":"最新:","Loading automations...":"加载自动化中...","Loading commits...":"加载提交中...","MCP server input required":"需要 MCP 服务器输入","Modified files":"修改的文件","New automation":"新自动化","No automations yet":"还没有自动化","No branches found.":"未找到分支。","No commits found.":"未找到提交。","No file changes.":"无文件更改。","No file changes to redo.":"没有可重做的文件变更。","No file changes to undo.":"没有可撤销的文件变更。","No messages in this thread yet. Type a message below to get started.":"此线程还没有消息。在下方输入消息即可开始。","Image attachment (preview unavailable)":"图片附件(无法预览)",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。","Output trimmed: {omitted} omitted of {total}.":"输出已截断:省略 {omitted}(共 {total})。","Show full output":"查看完整输出","Loading full output…":"正在加载完整输出…","Could not load the full output.":"无法加载完整输出。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","This rolls the thread back to this turn so you can edit the message. Later replies will be removed.":"将线程回退到本轮,以便你编辑消息。之后的回复将被移除。","Tool call rejected from codex-web-local UI.":"工具调用已在 codex-web-local 界面中拒绝。","Tool call waiting for response":"工具调用等待响应","Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"切换或重置前,必须提交、暂存或丢弃已跟踪的更改。除非 Git 会覆盖,否则允许存在未跟踪的文件。",Undo:"撤销","Undo file changes?":"撤销文件变更?","Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically.":"撤销本轮的文件变更?这会修改工作树,Codex 无法自动还原。","Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.":"撤销对 {file} 的变更?这会修改工作树,Codex 无法自动还原。","Redo the changes to {file}? This reapplies the edits to the working tree.":"重做对 {file} 的变更?这会重新应用对工作树的编辑。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。"},Pm={en:"English","zh-CN":"简体中文"};function c_(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(hy))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Mc=S(c_());function my(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}my(Mc.value);function d_(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function f_(e){Mc.value=e,my(e),typeof window<"u"&&window.localStorage.setItem(hy,e)}function vy(e,t){const n=Mc.value==="zh-CN"?u_[e]??e:e;return d_(n,t)}function ya(){return{uiLanguage:Mc,uiLanguageOptions:[{value:"en",label:Pm.en},{value:"zh-CN",label:Pm["zh-CN"]}],t:vy,setUiLanguage:f_}}const gy="brutalstrikedevs@gmail.com",p_=20,h_=6500,Mm=1800,Rd=12,Em=240,Rm=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,il=S([]);let jm=!1,jd=!1,Ld=null;function Fl(e){if(e instanceof Error)return e.stack||e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function m_(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function v_(e,t){var r;const n=(r=t==null?void 0:t.method)==null?void 0:r.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function yy(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Lm(e){return encodeURIComponent(e)}function g_(){return`mailto:${gy}`}function y_(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
47
+ `).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
48
+
49
+ `).trim())??"";return e?e.length>Mm?`${e.slice(0,Mm)}
50
+ ...[truncated]`:e:"No visible page text captured."}function w_(e,t){const n=t.replace(/\r\n/g,`
51
+ `).replace(/[ \t]+/g," ").trim();return n?Rm.test(e)||Rm.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Em?`${n.slice(0,Em)}...[truncated, ${n.length} chars total]`:n:""}function Nm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,Rd);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${w_(s,e.getItem(s)??"")}`)}const o=e.length>Rd?`
52
+ ...${e.length-Rd} more item(s)`:"";return`${t}:
53
+ ${n.join(`
54
+ `)||"empty"}${o}`}catch(n){return`${t}: unavailable (${yy(Fl(n))})`}}function b_(){return typeof window>"u"?"unknown":[`Path: ${window.location.pathname||"/"}`,`Hash: ${window.location.hash||"(none)"}`,`Search: ${window.location.search||"(none)"}`,`Online: ${typeof navigator>"u"?"unknown":String(navigator.onLine)}`,`Language: ${typeof navigator>"u"?"unknown":navigator.language}`,`Platform: ${typeof navigator>"u"?"unknown":navigator.platform}`,Nm(window.localStorage,"localStorage"),Nm(window.sessionStorage,"sessionStorage")].join(`
55
+ `)}function vi(e){const t=e.message.trim();if(!t)return;const n=il.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const r={...e,message:t,atIso:e.atIso??new Date().toISOString()};il.value=[r,...il.value].slice(0,p_)}function wy(e=il.value){var c;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,r=typeof navigator>"u"?"unknown":navigator.userAgent,o="0.1.131",a="codex-mobile",s=e.slice(0,12).map((d,v)=>[`${v+1}. [${d.atIso}] ${d.kind}`,d.method?`${d.method}`:"",d.url??"",typeof d.status=="number"?`${d.status} ${d.statusText??""}`.trim():"",d.message].filter(Boolean).join(" | ")).join(`
56
+ `),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",b_(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",y_()].join(`
57
+ `).slice(0,h_),l=`Codex Web feedback: ${yy((c=e[0])==null?void 0:c.message)}`;return`mailto:${gy}?subject=${Lm(l)}&body=${Lm(i)}`}function T_(){typeof window>"u"||(window.location.href=wy())}function S_(){if(!(typeof window>"u")&&(jm||(jm=!0,window.addEventListener("error",e=>{vi({kind:"window-error",message:e.error?Fl(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{vi({kind:"unhandled-rejection",message:Fl(e.reason),url:window.location.href})})),!jd)){if(typeof window.fetch!="function"){vi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Ld=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=m_(e),r=v_(e,t);try{const o=await Ld(e,t);return o.ok||vi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${o.status}`,url:n,method:r,status:o.status,statusText:o.statusText}),o}catch(o){throw vi({kind:"fetch-error",message:Fl(o),url:n,method:r}),o}},jd=!0}catch(e){Ld=null,jd=!1;try{vi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Fl(e)}`,url:window.location.href})}catch{}}}}function by(){const e=Y(()=>il.value.length>0);function t(n,r){vi({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:il,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:T_,buildFeedbackMailto:wy,feedbackMailtoBase:g_}}const Ty="codex-web-local.recycle-bin.v1";function Sy(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ty);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n.id=="string"&&typeof n.title=="string"):[]}catch{return[]}}function Om(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ty,JSON.stringify(e))}catch{}}const Ua=S(Sy());function C_(){function e(){Ua.value=Sy()}function t(o){Ua.value=[{...o,archivedAtIso:new Date().toISOString()},...Ua.value.filter(a=>a.id!==o.id)],Om(Ua.value)}function n(o){Ua.value=Ua.value.filter(a=>a.id!==o),Om(Ua.value)}async function r(o){if(!Ua.value.some(a=>a.id===o))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await oI(o),n(o),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Ua,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:r}}function $m(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function x_(e){let t=!1;const n=e.map(r=>{const o=[],a=new Map;for(const s of r.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,o.length),o.push(s);continue}t=!0,$m(s)>$m(o[i])&&(o[i]=s)}return o.length===r.threads.length?r:{...r,threads:o}});return t?n:e}const k_=["title","aria-label","disabled"],I_={key:1,class:"composer-dropdown-value"},A_={key:0,class:"composer-dropdown-search-wrap"},__=["placeholder","onKeydown"],P_={class:"composer-dropdown-options",role:"listbox"},M_=["onClick"],E_={key:0,class:"composer-dropdown-empty"},R_=yn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},menuAlign:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{},variant:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=S(null),a=S(null),s=S(null),i=S(null),l=S(!1),c=S(""),d=S({});let v=!1;const f=Y(()=>{var Ie;const re=n.options.find(De=>De.value===n.modelValue);return re?re.label:((Ie=n.placeholder)==null?void 0:Ie.trim())||""}),y=Y(()=>n.openDirection??"down"),T=Y(()=>n.menuAlign??"start"),A=Y(()=>n.iconOnly===!0),U=Y(()=>n.enableSearch===!0),O=Y(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),$=Y(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),q=Y(()=>{var re;return((re=n.emptyLabel)==null?void 0:re.trim())||"No results"}),R=Y(()=>{var re;return f.value||((re=n.placeholder)==null?void 0:re.trim())||"Select option"}),pe=Y(()=>{const re=c.value.trim().toLowerCase();return re?n.options.filter(Ie=>Ie.label.toLowerCase().includes(re)||Ie.value.toLowerCase().includes(re)):n.options});function ce(){n.disabled||(l.value=!l.value)}function K(re,Ie,De){return Math.min(De,Math.max(Ie,re))}function le(){var oe,se,je,We;if(!l.value)return;const re=o.value;if(!re||typeof window>"u")return;const Ie=re.getBoundingClientRect(),De=window.innerWidth,Ne=window.innerHeight,Le=8,Ce=8,Se=Math.max(0,De-Le*2),xe=((oe=s.value)==null?void 0:oe.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,Me=((je=s.value)==null?void 0:je.offsetHeight)??((We=a.value)==null?void 0:We.offsetHeight)??0,Je=Math.min(xe,Se),Xe=Math.max(Le,De-Je-Le),st=T.value==="end"?Ie.right-Je:Ie.left,de=K(st,Le,Xe);let N=y.value==="up"?Ie.top-Me-Ce:Ie.bottom+Ce;Me>0&&N+Me>Ne-Le&&(N=Ne-Me-Le),N=Math.max(Le,N),d.value={position:"fixed",left:`${de}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${Je}px`}}function ye(){v||typeof window>"u"||(window.addEventListener("resize",le),window.addEventListener("scroll",le,!0),v=!0)}function Pe(){!v||typeof window>"u"||(window.removeEventListener("resize",le),window.removeEventListener("scroll",le,!0),v=!1)}function ge(re){r("update:modelValue",re),l.value=!1,c.value=""}function ee(){if(c.value.length>0){c.value="";return}l.value=!1}function me(re){if(!l.value)return;const Ie=o.value;if(!Ie)return;const De=re.target;De instanceof Node&&(Ie.contains(De)||(l.value=!1,c.value=""))}return rt(l,re=>{if(!re){Pe(),d.value={};return}ye(),Ft(()=>{var Ie;le(),window.requestAnimationFrame(le),U.value&&((Ie=i.value)==null||Ie.focus())})}),Ii(()=>{window.addEventListener("pointerdown",me)}),Gs(()=>{window.removeEventListener("pointerdown",me),Pe()}),(re,Ie)=>(P(),B("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[w("button",{class:lt(["composer-dropdown-trigger",O.value]),type:"button",title:R.value,"aria-label":R.value,disabled:e.disabled,onClick:ce},[e.selectedPrefixIcon?(P(),tt(Bf(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),A.value?ve("",!0):(P(),B("span",I_,F(f.value),1)),Fe(Us,{class:"composer-dropdown-chevron"})],10,k_),l.value?(P(),B("div",{key:0,ref_key:"menuWrapRef",ref:a,class:lt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":y.value==="up","composer-dropdown-menu-wrap-down":y.value==="down"}]),style:to(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[U.value?(P(),B("div",A_,[En(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Ie[0]||(Ie[0]=De=>c.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:wr(gt(ee,["prevent"]),["esc"])},null,40,__),[[Bn,c.value]])])):ve("",!0),w("ul",P_,[(P(!0),B(ut,null,on(pe.value,De=>(P(),B("li",{key:De.value},[w("button",{class:lt(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ne=>ge(De.value)},F(De.label),11,M_)]))),128)),pe.value.length===0?(P(),B("li",E_,F(q.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),Ci=Ct(R_,[["__scopeId","data-v-58b5aa2e"]]),j_={},L_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function N_(e,t){return P(),B("svg",L_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const mf=Ct(j_,[["render",N_]]),O_=["aria-label","onKeydown"],$_={class:"app-dialog-header"},D_={class:"app-dialog-title-wrap"},F_={class:"app-dialog-title"},B_={key:0,class:"app-dialog-subtitle"},U_=["aria-label","title"],z_={class:"app-dialog-body"},H_={key:0,class:"app-dialog-footer"},W_=yn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ya();function a(){r("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return rt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Gs(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(P(),tt(dl,{to:"body"},[e.open?(P(),B("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:lt(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:wr(gt(a,["prevent"]),["esc"])},[w("div",$_,[w("div",D_,[w("h3",F_,F(e.title),1),e.subtitle?(P(),B("p",B_,F(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":m(o)("Close"),title:m(o)("Close"),onClick:a},[Fe(mf,{class:"app-dialog-close-icon"})],8,U_)]),w("div",z_,[br(i.$slots,"default",{},void 0)]),i.$slots.footer?(P(),B("div",H_,[br(i.$slots,"footer",{},void 0)])):ve("",!0)],42,O_)])):ve("",!0)]))}}),Nd=Ct(W_,[["__scopeId","data-v-3405af9b"]]),q_={key:0,class:"sidebar-menu-row-left"},G_={class:"sidebar-menu-row-main"},V_={key:1,class:"sidebar-menu-row-right"},K_={key:0,class:"sidebar-menu-row-right-default"},Y_={key:1,class:"sidebar-menu-row-right-hover"},J_=yn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=tS(),r=Y(()=>!!n.left),o=Y(()=>!!n.right),a=Y(()=>!!n["right-hover"]),s=Y(()=>o.value||a.value);return(i,l)=>(P(),tt(Bf(t.as),qf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:dt(()=>[r.value?(P(),B("span",q_,[br(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",G_,[br(i.$slots,"default",{},void 0,!0)]),s.value?(P(),B("span",V_,[o.value?(P(),B("span",K_,[br(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(P(),B("span",Y_,[br(i.$slots,"right-hover",{},void 0,!0)])):ve("",!0)])):ve("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),js=Ct(J_,[["__scopeId","data-v-06eaad4c"]]),Q_={},X_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Z_(e,t){return P(),B("svg",X_,[...t[0]||(t[0]=[w("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 lc=Ct(Q_,[["render",Z_]]),eP={},tP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function nP(e,t){return P(),B("svg",tP,[...t[0]||(t[0]=[w("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"},null,-1)])])}const Cy=Ct(eP,[["render",nP]]),rP=["data-menu-open"],oP={class:"thread-left-stack"},aP=["data-state"],sP=["data-confirming","title"],iP={key:0,class:"thread-delete-confirm-label"},lP=["title"],uP={class:"thread-row-title-wrap"},cP={class:"thread-row-title-line"},dP={class:"thread-row-title"},fP={key:0,class:"thread-row-originator"},pP=["title"],hP={key:0,class:"thread-row-automation-count"},mP=["data-state"],vP={class:"thread-row-time"},gP=yn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,r=t,o=Y(()=>n.thread.originator?`${n.thread.originator}`:"");function a(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,i)=>(P(),B("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Fe(js,{class:"thread-row","data-thread-id":n.thread.id,"data-active":n.selected,"data-live":n.threadState==="working"?"true":"false","data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:i[3]||(i[3]=l=>r("select")),onMouseleave:i[4]||(i[4]=l=>r("row-leave",l)),onContextmenu:i[5]||(i[5]=l=>r("row-contextmenu",l))},{left:dt(()=>[w("span",oP,[n.showStatusIndicator?(P(),B("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,aP)):ve("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:i[0]||(i[0]=gt(l=>r("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(P(),B("span",iP,F(n.confirmLabel),1)):(P(),tt(Cy,{key:1,class:"thread-icon"}))],8,sP)])]),right:dt(()=>[w("span",vP,F(n.relativeTime),1)]),"right-hover":dt(()=>[w("div",{ref:a,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:i[2]||(i[2]=gt(l=>r("menu-toggle"),["stop"]))},[Fe(hf,{class:"thread-icon"})])])]),default:dt(()=>[w("button",{class:"thread-main-button",type:"button",title:o.value,onClick:i[1]||(i[1]=gt(l=>r("select"),["stop"]))},[w("span",uP,[w("span",cP,[w("span",dP,F(n.thread.title),1),n.thread.originator?(P(),B("span",fP,F(n.thread.originator),1)):ve("",!0),n.thread.hasWorktree?(P(),tt(lc,{key:1,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(P(),B("span",{key:2,class:"thread-row-automation-chip",title:n.automationTooltip},[Fe(Pc,{class:"thread-row-automation-icon"}),n.automationCount>1?(P(),B("span",hP,F(n.automationCount),1)):ve("",!0)],8,pP)):ve("",!0),n.thread.pendingRequestState?(P(),B("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},F(n.requestLabel),9,mP)):ve("",!0)])])],8,lP)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,rP))}}),Nu=Ct(gP,[["__scopeId","data-v-d01c8f46"]]);function yP(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}function wP(e){const{getGroups:t,t:n}=e,r=S({}),o=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),c=S(""),d=S("create"),v=S(!1),f=S("thread"),y=S(""),T=S(""),A=S(""),U=S(""),O=S(!1),$=S(!1),q=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),R=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),pe=Y(()=>{if(s.value==="project"){const fe=l.value;return fe?o.value[fe]??[]:[]}const J=i.value;return J?r.value[J]??[]:[]}),ce=Y(()=>de(q.value.rrule)),K=Y(()=>v.value&&d.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),le=Y(()=>{var fe;const J=[];for(const Te of t())for(const Be of Te.threads){const Tt=((fe=Be.title)==null?void 0:fe.trim())||Be.id,yt=e.getProjectDisplayName(Te.projectName);J.push({value:Be.id,label:`${Tt} · ${yt}`,searchText:`${Tt} ${yt} ${Be.id}`.toLowerCase()})}return J}),ye=Y(()=>{const J=[];for(const fe of t()){const Te=e.getProjectAutomationKey(fe.projectName);if(!Te)continue;const Be=e.getProjectDisplayName(fe.projectName);J.push({value:Te,label:Be,searchText:`${Be} ${Te}`.toLowerCase()})}return J}),Pe=Y(()=>(f.value==="project"?ye.value:le.value).map(fe=>({value:fe.value,label:fe.label}))),ge=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],ee=Y(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);rt(Pe,J=>{var fe;v.value&&(J.some(Te=>Te.value===y.value)||(y.value=((fe=J[0])==null?void 0:fe.value)??""))});function me(J){var fe;return((fe=r.value[J])==null?void 0:fe.length)??0}function re(J){return me(J)>0}function Ie(J){var Te;const fe=e.getProjectAutomationKey(J);return fe?((Te=o.value[fe])==null?void 0:Te.length)??0:0}function De(J){return Ie(J)>0}function Ne(J){if(J.length===0)return"";if(J.length>1){const Be=J.filter(Tt=>Tt.status==="ACTIVE").length;return`${J.length} ${n("automations")} • ${Be} ${n("active")}`}const[fe]=J,Te=fe.status==="PAUSED"?"-":fe.nextRunAtMs?new Date(fe.nextRunAtMs).toLocaleString():n("Not scheduled");return`${fe.name} • ${n("Next run")}: ${Te}`}function Le(J){return Ne(r.value[J]??[])}function Ce(J){const fe=e.getProjectAutomationKey(J);return Ne(fe?o.value[fe]??[]:[])}function Se(J){return String(Math.max(0,J)).padStart(2,"0")}function xe(J,fe){const Te=typeof J=="number"?J:Number(J);return Number.isFinite(Te)?Math.max(1,Math.floor(Te)):fe}function Me(J){const[fe,Te]=J.split(":"),Be=Math.min(23,Math.max(0,Number(fe)||0)),Tt=Math.min(59,Math.max(0,Number(Te)||0));return`FREQ=DAILY;BYHOUR=${Be};BYMINUTE=${Tt}`}function Je(J,fe){const Te=xe(J,1);return fe==="minutes"?`FREQ=MINUTELY;INTERVAL=${Te}`:fe==="hours"?`FREQ=HOURLY;INTERVAL=${Te}`:`FREQ=DAILY;INTERVAL=${Te}`}function Xe(J){return Object.fromEntries(J.split(";").map(fe=>fe.trim()).filter(Boolean).map(fe=>{const[Te,...Be]=fe.split("=");return[Te.toUpperCase(),Be.join("=").trim()]}).filter(([fe,Te])=>fe&&Te))}function st(J){var Tt;const fe=Xe(J),Te=(Tt=fe.FREQ)==null?void 0:Tt.toUpperCase(),Be=xe(fe.INTERVAL,1);if(Te==="DAILY"&&fe.BYHOUR!==void 0&&fe.BYMINUTE!==void 0&&Be===1){const yt=Math.min(23,Math.max(0,Number(fe.BYHOUR)||0)),Dt=Math.min(59,Math.max(0,Number(fe.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Se(yt)}:${Se(Dt)}`,interval:1,intervalUnit:"hours"}}return Te==="MINUTELY"||Te==="HOURLY"||Te==="DAILY"&&fe.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Be,intervalUnit:Te==="MINUTELY"?"minutes":Te==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function de(J){var Tt;const fe=Xe(J),Te=(Tt=fe.FREQ)==null?void 0:Tt.toUpperCase(),Be=xe(fe.INTERVAL,1);if(Te==="DAILY"&&fe.BYHOUR!==void 0&&fe.BYMINUTE!==void 0&&Be===1){const yt=Math.min(23,Math.max(0,Number(fe.BYHOUR)||0)),Dt=Math.min(59,Math.max(0,Number(fe.BYMINUTE)||0));return`${n("RRULE")}: ${J} · ${n("runs daily at")} ${Se(yt)}:${Se(Dt)}`}return Te==="MINUTELY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("minute(s)")}`:Te==="HOURLY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("hour(s)")}`:Te==="DAILY"&&fe.INTERVAL!==void 0?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("day(s)")}`:J?`${n("RRULE")}: ${J}`:n("RRULE is required.")}function N(){const J=R.value;J.mode==="daily"?q.value.rrule=Me(J.dailyTime):J.mode==="interval"&&(q.value.rrule=Je(J.interval,J.intervalUnit))}function oe(J){J!=="minutes"&&J!=="hours"&&J!=="days"||(R.value={...R.value,intervalUnit:J},N())}function se(J){J!=="ACTIVE"&&J!=="PAUSED"||(q.value={...q.value,status:J})}function je(){R.value=st(q.value.rrule)}function We(J){R.value={...R.value,mode:J},N()}function _(J){var Te;s.value="thread",i.value=J,l.value="",v.value=!1,T.value="",A.value="";const fe=(Te=r.value[J])==null?void 0:Te[0];fe?_e(fe.id):ae(),a.value=!0,e.closeThreadMenu()}function E(J){var Be;const fe=e.getProjectAutomationKey(J);if(!fe){s.value="project",i.value="",l.value="",v.value=!1,T.value=n("Project automation requires a resolved absolute project path."),A.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=fe,v.value=!1,T.value="",A.value="";const Te=(Be=o.value[fe])==null?void 0:Be[0];Te?_e(Te.id):ae(),a.value=!0,e.closeProjectMenu()}function z(J){s.value=J.scope,i.value=J.scope==="thread"?J.target:"",l.value=J.scope==="project"?J.target:"",v.value=!1,T.value="",A.value="",J.scope==="project"?o.value=qe(o.value,J.target,J.automation):r.value=he(r.value,J.target,J.automation),_e(J.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ue(){var J;v.value=!0,f.value="thread",y.value=((J=le.value[0])==null?void 0:J.value)??"",s.value="thread",i.value="",l.value="",T.value="",A.value="",ae(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ne(J){var fe;f.value=J,y.value="",s.value=J==="project"?"project":"thread",y.value=((fe=Pe.value[0])==null?void 0:fe.value)??""}function ae(){c.value="",d.value="create",T.value="",A.value="",q.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},R.value=st(q.value.rrule)}function _e(J){const fe=pe.value.find(Te=>Te.id===J);fe&&(c.value=fe.id,d.value="edit",T.value="",A.value="",q.value={name:fe.name,prompt:fe.prompt,rrule:fe.rrule,status:fe.status},R.value=st(fe.rrule))}function Oe(){a.value=!1,s.value="thread",i.value="",l.value="",c.value="",T.value="",A.value="",O.value=!1,$.value=!1}function ke(J,fe){return Object.fromEntries(Object.entries(J).filter(([Te])=>Te!==fe))}function he(J,fe,Te){const Be=J[fe]??[],Tt=Be.findIndex(Dt=>Dt.id===Te.id),yt=[...Be];return Tt>=0?yt.splice(Tt,1,Te):yt.push(Te),{...J,[fe]:yt}}function Ke(J,fe,Te){const Be=(J[fe]??[]).filter(Tt=>Tt.id!==Te);return Be.length>0?{...J,[fe]:Be}:ke(J,fe)}function $e(J,fe){return Object.fromEntries(Object.entries(J).filter(([Te])=>Te!==fe))}function qe(J,fe,Te){const Be=J[fe]??[],Tt=Be.findIndex(Dt=>Dt.id===Te.id),yt=[...Be];return Tt>=0?yt.splice(Tt,1,Te):yt.push(Te),{...J,[fe]:yt}}async function Ge(){o.value=await Vx()}async function ct(J){await im(J).catch(()=>{}),r.value=ke(r.value,J)}async function bt(){let J=i.value,fe=l.value;O.value=!0,T.value="",A.value="";try{if(N(),v.value&&d.value==="create"&&(f.value==="thread"?(J=y.value,fe="",s.value="thread",i.value=J,l.value=""):(fe=y.value,J="",s.value="project",i.value="",l.value=fe)),s.value==="thread"&&!J)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!fe)throw new Error(n("Select a project target for this automation"));const Te={id:c.value||void 0,name:q.value.name,prompt:q.value.prompt,rrule:q.value.rrule,status:q.value.status},Be=s.value==="project"?await Yx({...Te,projectName:fe}):await Kx({...Te,threadId:J});s.value==="project"?await Ge():r.value=he(r.value,J,Be),e.onAutomationsChanged(),_e(Be.id),A.value=n("Automation saved."),O.value=!1}catch(Te){T.value=Te instanceof Error?Te.message:n("Failed to save automation"),O.value=!1}}async function nt(){const J=i.value,fe=l.value,Te=c.value;if(Te&&!(s.value==="thread"&&!J)&&!(s.value==="project"&&!fe)){O.value=!0,T.value="",A.value="";try{s.value==="project"?(await Yg(fe,Te),await Ge()):(await im(J,Te),r.value=Ke(r.value,J,Te));const Be=pe.value[0];Be?_e(Be.id):ae(),e.onAutomationsChanged(),O.value=!1}catch(Be){T.value=Be instanceof Error?Be.message:n("Failed to remove automation"),O.value=!1}}}async function it(){const J=i.value,fe=c.value;if(!(!J||!fe)){$.value=!0,T.value="",A.value="";try{await Jx(J,fe),A.value=n("Automation run queued.")}catch(Te){T.value=Te instanceof Error?Te.message:n("Failed to run automation")}finally{$.value=!1}}}return{automationByThreadId:r,automationByProjectName:o,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:c,automationDialogMode:d,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:y,automationDialogError:T,automationDialogNotice:A,projectAutomationActionError:U,isSavingAutomation:O,isRunningAutomation:$,automationDraft:q,automationScheduleDraft:R,automationDialogAutomations:pe,automationSchedulePreview:ce,automationDialogSubtitle:K,automationThreadTargetOptions:le,automationProjectTargetOptions:ye,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ge,automationStatusOptions:ee,threadAutomationCount:me,threadHasAutomation:re,projectAutomationCount:Ie,projectHasAutomation:De,threadAutomationTooltip:Le,projectAutomationTooltip:Ce,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:je,setAutomationScheduleMode:We,openAutomationDialog:_,openProjectAutomationDialog:E,openAutomationEditorFromPanel:z,openAutomationCreatorFromPanel:ue,setAutomationTargetMode:ne,startNewAutomationDraft:ae,selectAutomationForEditing:_e,closeAutomationDialog:Oe,omitAutomationProject:$e,reloadProjectAutomations:Ge,removeAutomationsForThread:ct,submitAutomationDialog:bt,onDeleteAutomationFromDialog:nt,onRunAutomationFromDialog:it}}const bP=4,Dm=6;function TP(e,t,n){if(e===null||n===0)return null;const r=Math.max(0,Math.min(e,n)),o=r>t?r-1:r,a=Math.max(0,Math.min(o,n-1));return a===t?null:a}function SP(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:r,isCollapsed:o,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),c=S(null),d=S(null);let v=null,f=null;const y=S(""),T=S({}),A=new Map,U=new WeakMap,O=typeof window<"u"?new ResizeObserver(de=>{for(const N of de){const oe=N.target,se=U.get(oe);se&&q(se,oe)}}):null,$=()=>{var de,N;return((de=d.value)==null?void 0:de.projectName)??((N=c.value)==null?void 0:N.projectName)??""};function q(de,N){const oe=N.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const se=T.value[de];se!==void 0&&Math.abs(se-oe)<.5||(T.value={...T.value,[de]:oe})}function R(de,N){const oe=A.get(de);oe&&oe!==N&&O&&O.unobserve(oe);const se=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(se){A.set(de,se),U.set(se,de),q(de,se),O==null||O.observe(se);return}oe&&(O==null||O.unobserve(oe)),A.delete(de)}function pe(de){const N=T.value[de]??0,oe=d.value,je=((oe==null?void 0:oe.projectName)===de?oe.groupHeight:null)??N,We=o(de)?0:Dm;return Math.max(0,je+We)}const ce=Y(()=>{const de=d.value;return de?TP(de.dropTargetIndexFull,de.fromIndex,t().length):null}),K=Y(()=>{const N=(r()?n():t()).map(_=>_.projectName),oe=d.value,se=ce.value;if(!oe||se===null)return N;const je=[...N],[We]=je.splice(oe.fromIndex,1);return We?(je.splice(se,0,We),je):N}),le=Y(()=>{const de={};let N=0;for(const oe of K.value)de[oe]=N,N+=pe(oe);return de}),ye=Y(()=>{let de=0;for(const N of K.value)de+=pe(N);return{height:`${Math.max(0,de)}px`}});function Pe(de,N){if(de.button!==0||r()||c.value||d.value)return;const se=t().findIndex(E=>E.projectName===N),je=A.get(N);if(se<0||!je)return;const We=je.getBoundingClientRect(),_=o(N)?0:Dm;c.value={projectName:N,fromIndex:se,startClientX:de.clientX,startClientY:de.clientY,pointerOffsetY:de.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+_},de.preventDefault(),ge()}function ge(){window.addEventListener("mousemove",me),window.addEventListener("mouseup",re),window.addEventListener("keydown",Ie)}function ee(){window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",re),window.removeEventListener("keydown",Ie)}function me(de){v={clientX:de.clientX,clientY:de.clientY},Ne()}function re(de){Le({clientX:de.clientX,clientY:de.clientY});const N=d.value;if(N&&ce.value!==null){const oe=t().findIndex(se=>se.projectName===N.projectName);if(oe>=0){const se=ce.value;se!==oe&&s(N.projectName,se)}}De({preserveToggleSuppression:!!N})}function Ie(de){de.key==="Escape"&&(!c.value&&!d.value||(de.preventDefault(),De()))}function De(de={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,c.value=null,d.value=null,de.preserveToggleSuppression||(y.value=""),ee()}function Ne(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const de=v;v=null,Le(de)}))}function Le(de){const N=c.value;if(!d.value&&N){const oe=de.clientX-N.startClientX,se=de.clientY-N.startClientY;if(Math.hypot(oe,se)<bP)return;i(),y.value=N.projectName,d.value={projectName:N.projectName,fromIndex:N.fromIndex,pointerOffsetY:N.pointerOffsetY,groupLeft:N.groupLeft,groupWidth:N.groupWidth,groupHeight:N.groupHeight,groupOuterHeight:N.groupOuterHeight,ghostTop:de.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}d.value&&Ce(de)}function Ce(de){const N=d.value;if(!N)return;if(N.ghostTop=de.clientY-N.pointerOffsetY,!Se(de)){N.dropTargetIndexFull=null;return}const oe=de.clientY,se=l.value;if(!se){N.dropTargetIndexFull=null;return}const je=t(),We=se.getBoundingClientRect(),_=new Map(je.map((ne,ae)=>[ne.projectName,ae])),E=je.map(ne=>ne.projectName).filter(ne=>ne!==N.projectName);let z=0,ue=je.length;for(const ne of E){const ae=_.get(ne);if(ae===void 0)continue;const _e=pe(ne),Oe=We.top+z+_e/2;if(oe<Oe){ue=ae;break}z+=_e}N.dropTargetIndexFull=ue}function Se(de){const N=l.value;if(!N)return!1;const oe=N.getBoundingClientRect(),se=de.clientX>=oe.left&&de.clientX<=oe.right,je=de.clientY>=oe.top-32&&de.clientY<=oe.bottom+32;return se&&je}function xe(de){var N;return((N=d.value)==null?void 0:N.projectName)===de}function Me(de){const N=d.value,oe=le.value[de]??0,se=a()===de;return!N||N.projectName!==de?{position:"absolute",top:"0",left:"0",right:"0",zIndex:se?"40":"1",transform:`translate3d(0, ${oe}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(de){return y.value===de?(y.value="",!0):!1}function Xe(de){const N=$();N&&!de.includes(N)&&De();const oe=new Set(de),se=Object.fromEntries(Object.entries(T.value).filter(([je])=>oe.has(je)));Object.keys(se).length!==Object.keys(T.value).length&&(T.value=se)}function st(){for(const de of A.values())O==null||O.unobserve(de);A.clear(),De()}return{groupsContainerRef:l,groupsContainerStyle:ye,setProjectGroupRef:R,isDraggingProject:xe,projectGroupStyle:Me,onProjectHandleMouseDown:Pe,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:st}}const CP={key:0,class:"pinned-section"},xP={class:"thread-tree-header"},kP={key:0,class:"thread-list"},IP={class:"projects-section"},AP={class:"thread-tree-header"},_P=["aria-expanded","aria-label","title"],PP={class:"organize-menu-title"},MP=["data-active"],EP={key:0},RP=["data-active"],jP={key:0},LP=["data-active"],NP={key:0},OP={class:"organize-menu-title"},$P=["data-active"],DP={key:0},FP=["data-active"],BP={key:0},UP={key:0,class:"thread-tree-action-error"},zP={key:1,class:"thread-tree-no-results"},HP={key:2,class:"thread-tree-loading"},WP={key:3,class:"thread-list thread-list-global"},qP=["data-project-name","data-expanded","data-dragging"],GP={class:"project-icon-stack"},VP={class:"project-icon-folder"},KP={class:"project-icon-chevron"},YP=["data-dragging-handle","onMousedown"],JP=["title"],QP=["title"],XP={key:0,class:"thread-row-automation-count"},ZP={class:"project-hover-controls"},eM=["onClick"],tM=["data-open-direction"],nM=["onClick"],rM=["onClick"],oM=["onClick"],aM=["onClick"],sM=["onClick"],iM=["onClick"],lM={class:"project-menu-label"},uM=["onInput"],cM=["aria-label","title","onClick"],dM={key:0,class:"thread-list"},fM={class:"project-empty"},pM=["onClick"],hM={class:"chats-section"},mM={class:"thread-tree-header"},vM={class:"chats-section-actions"},gM=["aria-label","title"],yM={key:0,class:"thread-tree-no-results"},wM={key:1,class:"thread-list thread-list-global"},bM=["data-open-direction"],TM=["disabled","title"],SM=["placeholder","onKeydown"],CM={class:"recycle-bin-content"},xM={key:0,class:"recycle-bin-empty"},kM={key:1,class:"recycle-bin-list"},IM={class:"recycle-bin-item-copy"},AM={class:"recycle-bin-item-title"},_M={key:0,class:"recycle-bin-item-meta"},PM={class:"recycle-bin-item-time"},MM={class:"recycle-bin-item-actions"},EM=["disabled","onClick"],RM=["onClick"],jM={key:2,class:"recycle-bin-error",role:"alert"},LM=["aria-label"],NM={class:"rename-thread-title"},OM={class:"rename-thread-subtitle"},$M={key:0,class:"automation-target-picker"},DM={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},FM={class:"automation-target-dropdown"},BM=["aria-label"],UM=["onClick"],zM={class:"automation-thread-field"},HM={class:"automation-thread-label"},WM=["placeholder"],qM={class:"automation-thread-field"},GM={class:"automation-thread-label"},VM=["placeholder"],KM={class:"automation-thread-field"},YM={class:"automation-thread-label"},JM={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},QM={key:0,class:"automation-schedule-row"},XM={class:"automation-schedule-copy"},ZM={key:1,class:"automation-schedule-row"},eE={class:"automation-schedule-copy"},tE={class:"automation-schedule-preview"},nE={class:"automation-thread-field"},rE={class:"automation-thread-label"},oE={key:2,class:"rename-thread-subtitle automation-thread-error"},aE={key:3,class:"rename-thread-subtitle automation-thread-notice"},sE={class:"rename-thread-actions"},iE=["disabled"],lE=["disabled"],uE=["disabled"],cE=["disabled"],Fm="codex-web-local.sidebar-section-expansion.v1",Bm="codex-web-local.sidebar-chats-first.v1",Um="codex-web-local.sidebar-chat-sort-mode.v1",zm="codex-web-local.thread-view-mode.v1",Hm="codex-web-local.collapsed-projects.v1",dE=yn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},projectCwdByName:{},selectedThreadId:{},isLoading:{type:Boolean},isThreadListFullyLoaded:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","save-thread-project","browse-project-files","save-project","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","copy-thread-chat","fork-thread","start-new-chat","automations-changed","restore-thread"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=ya(),{recordVisibleFailure:a}=by(),s=n,{records:i,loadRecords:l,recordArchivedThread:c,removeArchivedRecord:d,restoreArchivedThread:v}=C_(),f=S(!1),y=S(""),T=S("");function A(){cn.value=!1,y.value="",l(),f.value=!0}async function U(C){if(!T.value){T.value=C,y.value="";try{const M=await v(C);M.ok?s("restore-thread",C):y.value=M.error??"Failed to restore thread"}finally{T.value=""}}}const O=S({}),$=S({}),q=S(!0),R=S(!0),pe=S(!0),ce=S(!1),K=S(fo(Bm,!1)),le=S(tr());let ye=!1;const Pe=S([]),ge=S({}),ee=S(""),me=S([]),re=S(""),Ie=S(""),De=S("hover"),Ne=S({}),Le=S({}),Ce=S({}),Se=S("actions"),xe=S(""),Me=S(!1),Je=S(""),Xe=S(""),st=S(null),de=S(!1),N=S(""),oe=S(""),se=wP({getGroups:()=>r.groups,t:o,getProjectDisplayName:Pn,getProjectAutomationKey:Pi,closeThreadMenu:ze,closeProjectMenu:tn,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:je,automationByProjectName:We,automationDialogVisible:_,automationDialogScope:E,automationDialogAutomationId:z,automationDialogMode:ue,automationTargetPickerVisible:ne,automationTargetMode:ae,automationTargetValue:_e,automationDialogError:Oe,automationDialogNotice:ke,projectAutomationActionError:he,isSavingAutomation:Ke,isRunningAutomation:$e,automationDraft:qe,automationScheduleDraft:Ge,automationDialogAutomations:ct,automationSchedulePreview:bt,automationDialogSubtitle:nt,automationTargetDropdownOptions:it,automationIntervalUnitOptions:J,automationStatusOptions:fe,threadAutomationCount:Te,threadHasAutomation:Be,projectAutomationCount:Tt,projectHasAutomation:yt,threadAutomationTooltip:Dt,projectAutomationTooltip:No,syncAutomationRruleFromScheduleDraft:Gt,onAutomationIntervalUnitChange:io,onAutomationStatusChange:Zn,syncAutomationScheduleDraftFromRrule:wa,setAutomationScheduleMode:lo,openAutomationDialog:Vs,openProjectAutomationDialog:ba,openAutomationEditorFromPanel:es,openAutomationCreatorFromPanel:Or,setAutomationTargetMode:ts,startNewAutomationDraft:$r,selectAutomationForEditing:Oo,closeAutomationDialog:$o,omitAutomationProject:Ks,reloadProjectAutomations:Do,removeAutomationsForThread:Dr,submitAutomationDialog:ns,onDeleteAutomationFromDialog:Ta,onRunAutomationFromDialog:Fo}=se,uo=SP({getGroups:()=>r.groups,getFilteredGroups:()=>po.value,isSearchActive:()=>An.value,isCollapsed:Lt,getElevatedProjectName:()=>re.value?re.value:Ie.value?Vt.value.get(Ie.value)??"":"",onReorderProject:(C,M)=>s("reorder-project",{projectName:C,toIndex:M}),closeProjectMenu:tn}),{groupsContainerRef:co,groupsContainerStyle:Tr,setProjectGroupRef:rs,isDraggingProject:os,projectGroupStyle:vt,onProjectHandleMouseDown:xt,takeToggleSuppression:kt,pruneProjectGroups:dn,dispose:Hn}=uo,un=new Map,Sr=new Map,dr=S(null),Bo=S(null),cn=S(!1),er=S(Et());function Cr(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(Hm);if(!C)return{};const M=JSON.parse(C);return!M||typeof M!="object"||Array.isArray(M)?{}:M}catch{return{}}}function Et(){return typeof window>"u"?"project":window.localStorage.getItem(zm)==="chronological"?"chronological":"project"}function fo(C,M){if(typeof window>"u")return M;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:M}function tr(){return typeof window>"u"?"updated":window.localStorage.getItem(Um)==="created"?"created":"updated"}$.value=Cr();function wn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Fm)||"{}");typeof C.pinned=="boolean"&&(q.value=C.pinned),typeof C.projects=="boolean"&&(R.value=C.projects),typeof C.chats=="boolean"&&(pe.value=C.chats)}catch{}}function Fr(){typeof window>"u"||window.localStorage.setItem(Fm,JSON.stringify({pinned:q.value,projects:R.value,chats:pe.value}))}wn(),rt($,C=>{typeof window>"u"||window.localStorage.setItem(Hm,JSON.stringify(C))},{deep:!0}),rt(er,C=>{typeof window>"u"||window.localStorage.setItem(zm,C)}),rt(K,C=>{typeof window>"u"||window.localStorage.setItem(Bm,String(C))}),rt(le,C=>{typeof window>"u"||window.localStorage.setItem(Um,C)}),rt([q,R,pe],Fr);const jn=Y(()=>r.searchQuery.trim().toLowerCase()),An=Y(()=>jn.value.length>0),bn=Y(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Sa=Y(()=>new Set(Pe.value)),fr=Y(()=>new Set(me.value));function Br(C){if(fr.value.has(C.id))return!1;if(!An.value)return!0;if(bn.value)return bn.value.has(C.id);const M=jn.value;return C.title.toLowerCase().includes(M)||C.preview.toLowerCase().includes(M)}const Bt=Y(()=>x_(r.groups)),po=Y(()=>Bt.value.flatMap(C=>{const M=C.threads.filter(x=>!sc(x.cwd)&&Br(x));return M.length>0?[{...C,threads:M}]:!An.value&&C.threads.length===0?[{...C,threads:M}]:[]})),Uo=Y(()=>er.value==="chronological"),zo=Y(()=>{const C=[];for(const M of Bt.value)for(const x of M.threads)Sa.value.has(x.id)||Br(x)&&C.push(x);return C.sort((M,x)=>{const Z=new Date(M.updatedAtIso||M.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-Z})}),Tn=Y(()=>{const C=zo.value.filter(x=>sc(x.cwd)),M=le.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,Z)=>{const Qe=new Date(x[M]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(Z[M]||Z.updatedAtIso||Z.createdAtIso).getTime()-Qe})}),Jt=Y(()=>An.value||ce.value?Tn.value:Tn.value.slice(0,10)),pr=Y(()=>An.value?!1:Tn.value.length>10),an=Y(()=>{const C=new Map;for(const M of Bt.value)for(const x of M.threads)fr.value.has(x.id)||C.set(x.id,x);return C});rt(Pe,C=>{ye&&WI(C)}),rt([an,()=>r.isThreadListFullyLoaded],([C])=>{const M=yP(Pe.value,new Set(C.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(M.length===Pe.value.length)return;const x=new Set(M),Z=Object.fromEntries(Object.entries(ge.value).filter(([Qe])=>x.has(Qe)));ge.value=Z,Pe.value=M});let Ho=0;async function Zt(){if(r.isLoading)return;const C=Pe.value.filter(Qe=>!an.value.has(Qe)&&!ge.value[Qe]);if(C.length===0)return;const M=Ho+=1,x=await Promise.all(C.map(async Qe=>{try{return await tI(Qe)}catch{return null}}));if(M!==Ho)return;const Z={...ge.value};for(const Qe of x)Qe&&(Z[Qe.id]=Qe);ge.value=Z}rt([Pe,an,()=>r.isLoading],()=>{ye&&Zt()}),Ii(async()=>{const{threadIds:C}=await HI(),M=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,Z,Qe)=>x.length>0&&Qe.indexOf(x)===Z):[];M.length>0&&(Pe.value=M);try{je.value=await Gx()}catch{je.value={}}try{await Do()}catch{We.value={}}ye=!0,Zt()});const Ur=Y(()=>Be(N.value)),Ca=Y(()=>{const C=oe.value;return Ur.value?o('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):o('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),Vt=Y(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads)C.set(x.id,M.projectName);return C}),Wo=Y(()=>{const C=new Map;for(const M of r.groups){const x=M.threads.filter(Z=>!Sa.value.has(Z.id)&&!fr.value.has(Z.id));C.set(M.projectName,x)}return C}),qo=Y(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads){const Z=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,Z)}return C}),It=Y(()=>{const C=Ie.value;return C?an.value.get(C)??null:null}),Sn=Y(()=>Pe.value.map(C=>an.value.get(C)??ge.value[C]??null).filter(C=>C!==null).filter(Br));function Go(){q.value=!q.value}function xr(){R.value=!R.value}function kr(){pe.value=!pe.value}function Vo(C){if(Number.isNaN(C))return"n/a";const M=Math.abs(Date.now()-C);if(M<6e4)return o("now");const x=Math.floor(M/6e4);if(x<60)return`${x}m`;const Z=Math.floor(x/60);return Z<24?`${Z}h`:`${Math.floor(Z/24)}d`}function zr(C){const M=qo.value.get(C.id);return Vo(typeof M=="number"?M:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function Ko(C){const M=new Date(C).getTime();return Number.isNaN(M)?"":new Date(M).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function nr(C){return Sa.value.has(C)}function ho(C){if(nr(C)){Pe.value=Pe.value.filter(M=>M!==C);return}Pe.value=[C,...Pe.value]}function Yo(C){ho(C),ze()}function Ir(C){ee.value="",s("select",C)}function ht(C){C===r.selectedThreadId&&(s("copy-thread-chat",C),ze())}function _n(C){s("fork-thread",C),ze()}function Cn(C){return`${o("start new thread")} ${Pn(C)}`}function xa(C){s("start-new-thread",C)}function Wn(C){s("browse-thread-files",C),ze()}function k(C){s("save-thread-project",C),ze()}async function L(C){var x,Z;const M=((Z=(x=an.value.get(C))==null?void 0:x.cwd)==null?void 0:Z.trim())??"";if(ze(),!(!M||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(M)}catch{}}function V(C,M){if(Ie.value===C&&De.value==="hover"){if(M){const x=M.relatedTarget,Z=Bo.value;if(x instanceof Node&&Z&&Z.contains(x))return}ze()}}function be(C){return Ie.value===C}function ze(){Ie.value="",De.value="hover",Ce.value={}}function jt(C){if(ee.value="",Ie.value===C){ze();return}De.value="hover",tn(),cn.value=!1,Ie.value=C,Ft(()=>{Vr(C)})}function At(C,M){C.preventDefault(),ee.value="",De.value="contextmenu",Ie.value=M}function en(C,M){Je.value=C,Xe.value=M,Me.value=!0,ze(),Ft(()=>{var x,Z;(x=st.value)==null||x.focus(),(Z=st.value)==null||Z.select()})}function Kt(){Me.value=!1,Je.value="",Xe.value=""}function Hr(){const C=Je.value,M=Xe.value.trim();!C||!M||(s("rename-thread",{threadId:C,title:M}),Kt())}function ka(C,M){ee.value="",N.value=C,oe.value=M,de.value=!0,ze()}function as(){de.value=!1,N.value="",oe.value=""}async function fn(){const C=N.value;C&&(Ys(C),as())}function Ia(C){return ee.value===C}function Aa(C){if(ee.value!==C){ee.value=C,ze();return}Ys(C),ee.value=""}function Ys(C){var x,Z;const M=an.value.get(C)??null;fr.value.has(C)||(me.value=[C,...me.value]),ee.value="",ze(),c({id:C,title:((x=M==null?void 0:M.title)==null?void 0:x.trim())||"(untitled)",cwd:((Z=M==null?void 0:M.cwd)==null?void 0:Z.trim())??"",projectName:Vt.value.get(C)??""}),Pe.value=Pe.value.filter(Qe=>Qe!==C),s("archive",C),Be(C)&&Dr(C)}function Pn(C){return r.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:es,openAutomationCreatorFromPanel:Or,openRenameThreadDialog:en,openRecycleBin:A});function ss(C){return C.includes("/")||C.includes("\\")}function Js(C){return ss(C)?C:Pn(C)}function is(C){const M=Lr(C);if(!M)return!1;let x=0;for(const Z of r.groups)if(ss(Z.projectName)&&Lr(Z.projectName)===M&&(x+=1,x>1))return!0;return!1}function _a(C){const M=r.projectDisplayNameById[C.projectName],x=Pn(C.projectName),Z=C.projectName;if(M&&!ss(Z)&&Z!==x)return x.includes(Z)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(Z)?x:`${x} ${Z}`;if(M&&ss(Z)){const Gn=Lr(Z),vr=Lr(sl(Z)),nn=is(Z)?vr:Gn;return nn&&nn!==x?`${x} ${nn}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Qe=Lr(x)||x,zt=Lr(sl(x));return zt.startsWith(".")&&zt!==Qe?`${Qe} ${zt}`:C.threads.length>0||!is(Z)?Qe:zt?`${Qe} ${zt}`:Qe}function Jo(C){return re.value===C}function tn(){re.value="",Se.value="actions",xe.value=""}function Qo(){const C=!cn.value;C&&(tn(),ze()),cn.value=C}function Wr(C){er.value=C,cn.value=!1}function pn(){K.value=!K.value}function mo(C){le.value=C}function vo(C){s("request-project-git-status",C),Ft(()=>{ea(C)})}function ls(C){if(re.value===C){tn();return}ze(),cn.value=!1,re.value=C,Se.value="actions",xe.value=Pn(C),vo(C)}function sn(C){ze(),cn.value=!1,re.value=C,Se.value="actions",xe.value=Pn(C),vo(C)}function _i(C){return r.projectDisplayNameById[C.projectName]??_a(C)}function hn(C){ze();const M=C.projectName;re.value=M,Se.value="rename",xe.value=_i(C),Ft(()=>{ea(M)})}function Qs(C){s("browse-project-files",C),tn()}function rr(C){s("save-project",C),tn()}function us(C){s("create-project-worktree",C),tn()}function cs(C){s("rename-project",{projectName:C,displayName:xe.value})}function bl(C){const M=Pi(C);if(s("remove-project",C),M&&yt(C)){he.value="";const x=We.value;We.value=Ks(We.value,M),Yg(M).then(Do).catch(async Z=>{We.value=x;const Qe=Z instanceof Error?Z.message:o("Failed to delete project automation");he.value=Qe,a(Qe);try{await Do()}catch{We.value=x}}).finally(()=>{s("automations-changed")})}tn()}function Pi(C){var x;const M=((x=r.projectCwdByName[C])==null?void 0:x.trim())??"";return ik(M)?M:""}function Xs(C,M){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=r.groups.findIndex(zt=>zt.projectName===M);if(x<0)return;const Z=C.key==="ArrowUp"?-1:1,Qe=Math.max(0,Math.min(x+Z,r.groups.length-1));Qe!==x&&(C.preventDefault(),s("reorder-project",{projectName:M,toIndex:Qe}))}function Pt(C){return O.value[C]===!0}function Lt(C){return $.value[C]===!0}function ds(C){O.value={...O.value,[C]:!Pt(C)}}function Ar(){ce.value=!ce.value}function qn(C){kt(C)||($.value={...$.value,[C]:!Lt(C)})}function qr(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){un.set(C,x);return}un.delete(C)}function Xo(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){Sr.set(C,x);return}Sr.delete(C)}function Ln(C){let M=C.parentElement;for(;M;){const x=window.getComputedStyle(M),Z=x.overflowY||x.overflow;if(Z==="auto"||Z==="scroll"||Z==="hidden"||Z==="clip")return M.getBoundingClientRect();M=M.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Zo(C,M){const x=C.getBoundingClientRect(),Z=Ln(C),Qe=6,zt=Z.bottom-x.bottom,Gn=x.top-Z.top;return zt>=M+Qe?"down":Gn>zt?"up":"down"}function go(C,M){const x=Sr.get(C);if(!x)return"down";const Z=Zo(x,M);return Le.value={...Le.value,[C]:Z},Z}function Pa(C){return Le.value[C]??"down"}function ea(C){const M=un.get(C);if(!M)return;const x=M.querySelector(".project-menu-panel"),Z=(x==null?void 0:x.getBoundingClientRect().height)??0;Ne.value={...Ne.value,[C]:Zo(M,Z)}}function Gr(C,M,x){return Math.min(Math.max(C,M),x)}function Vr(C){const M=Sr.get(C);if(!M)return;const x=Bo.value,Z=x==null?void 0:x.getBoundingClientRect(),Qe=(Z==null?void 0:Z.height)||(x==null?void 0:x.offsetHeight)||112,zt=(Z==null?void 0:Z.width)||(x==null?void 0:x.offsetWidth)||160,Gn=go(C,Qe),vr=M.getBoundingClientRect(),nn=8,Pr=4,Ma=Math.max(nn,window.innerWidth-zt-nn),ra=Gr(vr.right-zt,nn,Ma),vs=Gr(Gn==="up"?vr.top-Qe-Pr:vr.bottom+Pr,nn,Math.max(nn,window.innerHeight-Qe-nn));Ce.value={left:`${Math.round(ra)}px`,top:`${Math.round(vs)}px`}}function Kr(){const C=Ie.value;C&&Vr(C)}function Mi(){window.addEventListener("resize",Kr),document.addEventListener("scroll",Kr,!0)}function Ei(){window.removeEventListener("resize",Kr),document.removeEventListener("scroll",Kr,!0)}function fs(C){const M=re.value;if(!M)return!1;const x=un.get(M);if(!x)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(x))return!0;const Qe=C.target;return Qe instanceof Node?x.contains(Qe):!1}function Yr(C){const M=Ie.value;if(!M)return!1;const x=Sr.get(M);if(!x)return!1;const Z=typeof C.composedPath=="function"?C.composedPath():[];if(Z.includes(x))return!0;const Qe=Bo.value;if(Qe&&Z.includes(Qe))return!0;const zt=C.target;return zt instanceof Node?!!(x.contains(zt)||Qe&&Qe.contains(zt)):!1}function ta(C){if(cn.value){const M=dr.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!M&&(x.includes(M)||C.target instanceof Node&&M.contains(C.target))||(cn.value=!1)}re.value&&(fs(C)||tn(),Ie.value&&(Yr(C)||ze()))}function ps(C){re.value&&!fs(C)&&tn(),Ie.value&&!Yr(C)&&ze()}function hs(){cn.value&&(cn.value=!1),re.value&&tn(),Ie.value&&ze()}function Ri(){window.addEventListener("pointerdown",ta,{capture:!0}),window.addEventListener("focusin",ps,{capture:!0}),window.addEventListener("blur",hs)}function Zs(){window.removeEventListener("pointerdown",ta,{capture:!0}),window.removeEventListener("focusin",ps,{capture:!0}),window.removeEventListener("blur",hs)}function ms(C){return Wo.value.get(C.projectName)??[]}function Tl(C){if(An.value)return ms(C);if(Lt(C.projectName))return[];const M=ms(C);return Pt(C.projectName)?M:M.slice(0,10)}function or(C){return An.value?!1:!Lt(C.projectName)&&ms(C).length>10}function hr(C){return ms(C).length>0}function _r(C){var M;return!!C.pendingRequestState||C.inProgress||C.unread||((M=C.externalSession)==null?void 0:M.active)===!0}function Jr(C){return C.pendingRequestState==="approval"?o("Awaiting approval"):o("Awaiting response")}function mr(C){var M;return((M=C.externalSession)==null?void 0:M.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}rt(()=>r.groups.map(C=>C.projectName),C=>{dn(C)}),rt(()=>{const C=re.value;return C?r.projectGitRepoByName[C]:void 0},()=>{const C=re.value;C&&Ft(()=>{re.value===C&&ea(C)})});const na=Y(()=>cn.value||re.value!==""||Ie.value!=="");return rt(na,C=>{if(C){Ri();return}Zs()}),rt(Ie,C=>{if(!C){Ei();return}Mi(),Ft(()=>{Vr(C)})}),Gs(()=>{un.clear(),Ei(),Zs(),Hn()}),(C,M)=>(P(),B("section",{class:lt(["thread-tree-root",{"chats-first":K.value}])},[Sn.value.length>0?(P(),B("section",CP,[Fe(js,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":q.value,onClick:Go},{left:dt(()=>[q.value?(P(),tt(Us,{key:1,class:"thread-icon"})):(P(),tt(Lu,{key:0,class:"thread-icon"}))]),default:dt(()=>[w("span",xP,F(m(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),q.value?(P(),B("ul",kP,[(P(!0),B(ut,null,on(Sn.value,x=>(P(),tt(Nu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:nr(x.id),"menu-open":be(x.id),"show-status-indicator":_r(x),"thread-state":mr(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Dt)(x.id),"request-label":Jr(x),"relative-time":zr(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":Z=>Xo(x.id,Z),onSelect:Z=>Ir(x.id),onInlineDelete:Z=>Aa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>V(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0)])):ve("",!0),w("section",IP,[Fe(js,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":R.value,onClick:xr},{left:dt(()=>[R.value?(P(),tt(Us,{key:1,class:"thread-icon"})):(P(),tt(Lu,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:dr,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":cn.value,"aria-label":m(o)("Organize threads"),title:m(o)("Organize threads"),onClick:gt(Qo,["stop"])},[Fe(hf,{class:"thread-icon"})],8,_P),cn.value?(P(),B("div",{key:0,class:"organize-menu-panel",onClick:M[4]||(M[4]=gt(()=>{},["stop"]))},[w("p",PP,F(m(o)("Organize")),1),w("button",{class:"organize-menu-item","data-active":er.value==="project",type:"button",onClick:M[0]||(M[0]=x=>Wr("project"))},[w("span",null,F(m(o)("By project")),1),er.value==="project"?(P(),B("span",EP,"✓")):ve("",!0)],8,MP),w("button",{class:"organize-menu-item","data-active":er.value==="chronological",type:"button",onClick:M[1]||(M[1]=x=>Wr("chronological"))},[w("span",null,F(m(o)("Chronological list")),1),er.value==="chronological"?(P(),B("span",jP,"✓")):ve("",!0)],8,RP),w("button",{class:"organize-menu-item","data-active":K.value,type:"button",onClick:pn},[w("span",null,F(m(o)("Chats first")),1),K.value?(P(),B("span",NP,"✓")):ve("",!0)],8,LP),M[40]||(M[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",OP,F(m(o)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":le.value==="created",type:"button",onClick:M[2]||(M[2]=x=>mo("created"))},[w("span",null,F(m(o)("Created")),1),le.value==="created"?(P(),B("span",DP,"✓")):ve("",!0)],8,$P),w("button",{class:"organize-menu-item","data-active":le.value==="updated",type:"button",onClick:M[3]||(M[3]=x=>mo("updated"))},[w("span",null,F(m(o)("Updated")),1),le.value==="updated"?(P(),B("span",BP,"✓")):ve("",!0)],8,FP),M[41]||(M[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:A},[w("span",null,F(m(o)("Recycle bin")),1)])])):ve("",!0)],512)]),default:dt(()=>[w("span",AP,F(m(o)("Projects")),1)]),_:1},8,["aria-expanded"]),R.value?(P(),B(ut,{key:0},[m(he)?(P(),B("p",UP,F(m(he)),1)):ve("",!0),An.value&&po.value.length===0?(P(),B("p",zP,F(m(o)("No matching threads. Clear the search to see all threads.")),1)):e.isLoading&&e.groups.length===0?(P(),B("p",HP,F(m(o)("Loading threads...")),1)):Uo.value?(P(),B("ul",WP,[(P(!0),B(ut,null,on(zo.value,x=>(P(),tt(Nu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:nr(x.id),"menu-open":be(x.id),"show-status-indicator":_r(x),"thread-state":mr(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Dt)(x.id),"request-label":Jr(x),"relative-time":zr(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":Z=>Xo(x.id,Z),onSelect:Z=>Ir(x.id),onInlineDelete:Z=>Aa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>V(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(P(),B("div",{key:4,ref_key:"groupsContainerRef",ref:co,class:"thread-tree-groups",style:to(m(Tr))},[(P(!0),B(ut,null,on(po.value,x=>(P(),B("article",{key:x.projectName,ref_for:!0,ref:Z=>m(rs)(x.projectName,Z),class:"project-group","data-project-name":x.projectName,"data-expanded":!Lt(x.projectName),"data-dragging":m(os)(x.projectName),style:to(m(vt)(x.projectName))},[Fe(js,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Z=>qn(x.projectName),onContextmenu:gt(Z=>sn(x.projectName),["prevent"]),onKeydown:[Z=>Xs(Z,x.projectName),wr(gt(Z=>qn(x.projectName),["prevent"]),["enter"]),wr(gt(Z=>qn(x.projectName),["prevent"]),["space"])]},{left:dt(()=>[w("span",GP,[w("span",VP,[Lt(x.projectName)?(P(),tt(op,{key:0,class:"thread-icon"})):(P(),tt(a_,{key:1,class:"thread-icon"}))]),w("span",KP,[Lt(x.projectName)?(P(),tt(Lu,{key:0,class:"thread-icon"})):(P(),tt(Us,{key:1,class:"thread-icon"}))])])]),right:dt(()=>[w("div",ZP,[w("div",{ref_for:!0,ref:Z=>qr(x.projectName,Z),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(Z=>ls(x.projectName),["stop"])},[Fe(hf,{class:"thread-icon"})],8,eM),Jo(x.projectName)?(P(),B("div",{key:0,class:"project-menu-panel","data-open-direction":Ne.value[x.projectName]??"down",onClick:M[6]||(M[6]=gt(()=>{},["stop"]))},[Se.value==="actions"?(P(),B(ut,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:Z=>Qs(x.projectName)},F(m(o)("Browse files")),9,nM),w("button",{class:"project-menu-item",type:"button",onClick:Z=>rr(x.projectName)},F(m(o)("Export Project")),9,rM),w("button",{class:"project-menu-item",type:"button",onClick:Z=>m(ba)(x.projectName)},F(m(yt)(x.projectName)?m(o)("Manage automations…"):m(o)("Add automation…")),9,oM),e.projectGitRepoByName[x.projectName]?(P(),B("button",{key:0,class:"project-menu-item",type:"button",onClick:Z=>us(x.projectName)},F(m(o)("New worktree")),9,aM)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:Z=>hn(x)},F(m(o)("Rename project")),9,sM),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Z=>bl(x.projectName)},F(m(o)("Remove")),9,iM)],64)):(P(),B(ut,{key:1},[w("label",lM,F(m(o)("Project name")),1),En(w("input",{"onUpdate:modelValue":M[5]||(M[5]=Z=>xe.value=Z),class:"project-menu-input",type:"text",onInput:Z=>cs(x.projectName)},null,40,uM),[[Bn,xe.value]])],64))],8,tM)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":Cn(x.projectName),title:Cn(x.projectName),onClick:gt(Z=>xa(x.projectName),["stop"])},[Fe(gl,{class:"thread-icon"})],8,cM)])]),default:dt(()=>[w("span",{class:"project-main-button","data-dragging-handle":m(os)(x.projectName),onMousedown:gt(Z=>m(xt)(Z,x.projectName),["left"])},[w("span",{class:"project-title",title:Js(x.projectName)},F(_a(x)),9,JP),m(yt)(x.projectName)?(P(),B("span",{key:0,class:"thread-row-automation-chip",title:m(No)(x.projectName)},[Fe(Pc,{class:"thread-row-automation-icon"}),m(Tt)(x.projectName)>1?(P(),B("span",XP,F(m(Tt)(x.projectName)),1)):ve("",!0)],8,QP)):ve("",!0)],40,YP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),hr(x)?(P(),B("ul",dM,[(P(!0),B(ut,null,on(Tl(x),Z=>(P(),tt(Nu,{key:Z.id,thread:Z,selected:Z.id===e.selectedThreadId,pinned:nr(Z.id),"menu-open":be(Z.id),"show-status-indicator":_r(Z),"thread-state":mr(Z),"inline-delete-confirming":Ia(Z.id),"automation-count":m(Te)(Z.id),"automation-tooltip":m(Dt)(Z.id),"request-label":Jr(Z),"relative-time":zr(Z),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":Qe=>Xo(Z.id,Qe),onSelect:Qe=>Ir(Z.id),onInlineDelete:Qe=>Aa(Z.id),onMenuToggle:Qe=>jt(Z.id),onRowLeave:Qe=>V(Z.id,Qe),onRowContextmenu:Qe=>At(Qe,Z.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(P(),tt(js,{key:1,as:"p",class:"project-empty-row"},{left:dt(()=>[...M[42]||(M[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:dt(()=>[w("span",fM,F(m(o)("No threads yet. Start a new thread to begin.")),1)]),_:1})),or(x)?(P(),tt(js,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...M[43]||(M[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Z=>ds(x.projectName)},F(Pt(x.projectName)?"Show less":"Show more"),9,pM)]),_:2},1024)):ve("",!0)],12,qP))),128))],4))],64)):ve("",!0)]),w("section",hM,[Fe(js,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":pe.value,onClick:kr},{left:dt(()=>[pe.value?(P(),tt(Us,{key:1,class:"thread-icon"})):(P(),tt(Lu,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",vM,[w("button",{class:"chats-section-action",type:"button","aria-label":m(o)("New chat"),title:m(o)("New chat"),onClick:M[7]||(M[7]=gt(x=>C.$emit("start-new-chat"),["stop"]))},[Fe(gl,{class:"thread-icon"})],8,gM)])]),default:dt(()=>[w("span",mM,F(m(o)("Chats")),1)]),_:1},8,["aria-expanded"]),pe.value&&Tn.value.length===0?(P(),B("p",yM,F(m(o)("No chats")),1)):pe.value?(P(),B("ul",wM,[(P(!0),B(ut,null,on(Jt.value,x=>(P(),tt(Nu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:nr(x.id),"menu-open":be(x.id),"show-status-indicator":_r(x),"thread-state":mr(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Dt)(x.id),"request-label":Jr(x),"relative-time":zr(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":Z=>Xo(x.id,Z),onSelect:Z=>Ir(x.id),onInlineDelete:Z=>Aa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>V(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0),pe.value&&pr.value?(P(),tt(js,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...M[44]||(M[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Ar},F(ce.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(P(),tt(dl,{to:"body"},[It.value?(P(),B("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Bo,class:"thread-menu-panel thread-menu-panel-fixed",style:to(Ce.value),"data-open-direction":Pa(It.value.id),onClick:M[17]||(M[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:M[8]||(M[8]=x=>m(Vs)(It.value.id))},F(m(Be)(It.value.id)?m(o)("Manage automations…"):m(o)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[9]||(M[9]=x=>Wn(It.value.id))},F(m(o)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[10]||(M[10]=x=>k(It.value.id))},F(m(o)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[11]||(M[11]=x=>L(It.value.id))},F(m(o)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:It.value.id!==e.selectedThreadId,title:It.value.id===e.selectedThreadId?m(o)("Copy chat"):m(o)("Open this chat before copying"),onClick:M[12]||(M[12]=x=>ht(It.value.id))},F(m(o)("Copy chat")),9,TM),w("button",{class:"thread-menu-item",type:"button",onClick:M[13]||(M[13]=x=>_n(It.value.id))},F(m(o)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[14]||(M[14]=x=>Yo(It.value.id))},F(nr(It.value.id)?m(o)("Unpin thread"):m(o)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[15]||(M[15]=x=>en(It.value.id,It.value.title))},F(m(o)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:M[16]||(M[16]=x=>ka(It.value.id,It.value.title))},F(m(o)("Delete thread")),1)],12,bM)):ve("",!0)])),Fe(Nd,{open:Me.value,title:m(o)("Rename thread"),subtitle:m(o)("Make it short and recognizable."),onClose:Kt},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Kt},F(m(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Hr},F(m(o)("Save")),1)]),default:dt(()=>[En(w("input",{ref_key:"renameThreadInputRef",ref:st,"onUpdate:modelValue":M[18]||(M[18]=x=>Xe.value=x),class:"rename-thread-input",type:"text",placeholder:m(o)("Add title..."),onKeydown:wr(gt(Hr,["prevent"]),["enter"])},null,40,SM),[[Bn,Xe.value]])]),_:1},8,["open","title","subtitle"]),Fe(Nd,{open:de.value,title:Ur.value?m(o)("Archive chat and remove automations?"):m(o)("Delete thread?"),subtitle:Ca.value,onClose:as},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:as},F(m(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:fn},F(Ur.value?m(o)("Archive and remove"):m(o)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Fe(Nd,{open:f.value,title:m(o)("Recycle bin"),subtitle:m(o)("Threads you removed are kept here so you can restore them."),size:"md",onClose:M[19]||(M[19]=x=>f.value=!1)},{default:dt(()=>[w("div",CM,[m(i).length===0?(P(),B("div",xM,F(m(o)("Recycle bin is empty.")),1)):(P(),B("ul",kM,[(P(!0),B(ut,null,on(m(i),x=>(P(),B("li",{key:x.id,class:"recycle-bin-item"},[w("div",IM,[w("span",AM,F(x.title),1),x.projectName?(P(),B("span",_M,F(x.projectName),1)):ve("",!0),w("span",PM,F(Ko(x.archivedAtIso)),1)]),w("div",MM,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:T.value===x.id,onClick:Z=>U(x.id)},F(T.value===x.id?m(o)("Restoring…"):m(o)("Restore")),9,EM),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:Z=>m(d)(x.id)},F(m(o)("Delete permanently")),9,RM)])]))),128))])),y.value?(P(),B("p",jM,F(y.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(P(),tt(dl,{to:"body"},[m(_)?(P(),B("div",{key:0,class:"rename-thread-overlay",onClick:M[39]||(M[39]=gt((...x)=>m($o)&&m($o)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":m(E)==="project"?m(o)("Project automation"):m(o)("Thread automation")},[w("h3",NM,F(m(ue)==="edit"?m(o)("Edit automation"):m(o)("Add automation")),1),w("p",OM,F(m(nt)),1),m(ne)&&m(ue)==="create"?(P(),B("div",$M,[M[45]||(M[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",DM,[w("button",{class:lt(["automation-target-mode",{"is-active":m(ae)==="thread"}]),type:"button",onClick:M[20]||(M[20]=x=>m(ts)("thread"))}," Existing chat ",2),w("button",{class:lt(["automation-target-mode",{"is-active":m(ae)==="project"}]),type:"button",onClick:M[21]||(M[21]=x=>m(ts)("project"))}," Project ",2)]),w("div",FM,[Fe(Ci,{modelValue:m(_e),"onUpdate:modelValue":M[22]||(M[22]=x=>Rn(_e)?_e.value=x:null),class:"automation-thread-dropdown",options:m(it),placeholder:m(ae)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":m(ae)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ve("",!0),m(ct).length>0?(P(),B("div",{key:1,class:"automation-thread-list","aria-label":m(E)==="project"?"Project automations":"Thread automations"},[(P(!0),B(ut,null,on(m(ct),x=>(P(),B("button",{key:x.id,class:lt(["automation-thread-list-item",{"is-active":x.id===m(z)}]),type:"button",onClick:Z=>m(Oo)(x.id)},[w("span",null,F(x.name),1),w("small",null,F(x.status==="PAUSED"?"Paused":"Active"),1)],10,UM))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:M[23]||(M[23]=(...x)=>m($r)&&m($r)(...x))},F(m(o)("Add another automation")),1)],8,BM)):ve("",!0),w("label",zM,[w("span",HM,F(m(o)("Name")),1),En(w("input",{"onUpdate:modelValue":M[24]||(M[24]=x=>m(qe).name=x),class:"rename-thread-input",type:"text",placeholder:m(o)("Automation name")},null,8,WM),[[Bn,m(qe).name]])]),w("label",qM,[w("span",GM,F(m(o)("Prompt")),1),En(w("textarea",{"onUpdate:modelValue":M[25]||(M[25]=x=>m(qe).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:m(o)("Describe what the automation should do")},null,8,VM),[[Bn,m(qe).prompt]])]),w("div",KM,[w("span",YM,F(m(o)("Schedule")),1),w("div",JM,[w("button",{class:lt(["automation-schedule-mode",{"is-active":m(Ge).mode==="daily"}]),type:"button",onClick:M[26]||(M[26]=x=>m(lo)("daily"))},F(m(o)("Daily")),3),w("button",{class:lt(["automation-schedule-mode",{"is-active":m(Ge).mode==="interval"}]),type:"button",onClick:M[27]||(M[27]=x=>m(lo)("interval"))},F(m(o)("Interval")),3),w("button",{class:lt(["automation-schedule-mode",{"is-active":m(Ge).mode==="advanced"}]),type:"button",onClick:M[28]||(M[28]=x=>m(lo)("advanced"))}," RRULE ",2)]),m(Ge).mode==="daily"?(P(),B("div",QM,[w("span",XM,F(m(o)("Run every day at")),1),En(w("input",{"onUpdate:modelValue":M[29]||(M[29]=x=>m(Ge).dailyTime=x),class:"automation-schedule-time",type:"time",onInput:M[30]||(M[30]=(...x)=>m(Gt)&&m(Gt)(...x))},null,544),[[Bn,m(Ge).dailyTime]])])):m(Ge).mode==="interval"?(P(),B("div",ZM,[w("span",eE,F(m(o)("Run every")),1),En(w("input",{"onUpdate:modelValue":M[31]||(M[31]=x=>m(Ge).interval=x),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:M[32]||(M[32]=(...x)=>m(Gt)&&m(Gt)(...x))},null,544),[[Bn,m(Ge).interval,void 0,{number:!0}]]),Fe(Ci,{class:"automation-schedule-unit-dropdown","model-value":m(Ge).intervalUnit,options:m(J),placeholder:m(o)("Unit"),"onUpdate:modelValue":m(io)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),m(Ge).mode==="advanced"?En((P(),B("input",{key:2,"onUpdate:modelValue":M[33]||(M[33]=x=>m(qe).rrule=x),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:M[34]||(M[34]=(...x)=>m(wa)&&m(wa)(...x))},null,544)),[[Bn,m(qe).rrule]]):ve("",!0),w("p",tE,F(m(bt)),1)]),w("div",nE,[w("span",rE,F(m(o)("Status")),1),Fe(Ci,{class:"automation-thread-dropdown","model-value":m(qe).status,options:m(fe),placeholder:m(o)("Status"),"onUpdate:modelValue":m(Zn)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),m(Oe)?(P(),B("p",oE,F(m(Oe)),1)):m(ke)?(P(),B("p",aE,F(m(ke)),1)):ve("",!0),w("div",sE,[m(ue)==="edit"&&m(E)==="thread"?(P(),B("button",{key:0,class:"rename-thread-button",type:"button",disabled:m(Ke)||m($e),onClick:M[35]||(M[35]=(...x)=>m(Fo)&&m(Fo)(...x))},F(m($e)?m(o)("Running…"):m(o)("Run now")),9,iE)):ve("",!0),m(ue)==="edit"?(P(),B("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:m(Ke)||m($e),onClick:M[36]||(M[36]=(...x)=>m(Ta)&&m(Ta)(...x))},F(m(o)("Remove")),9,lE)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:m(Ke)||m($e),onClick:M[37]||(M[37]=(...x)=>m($o)&&m($o)(...x))},F(m(o)("Cancel")),9,uE),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:m(Ke)||m($e),onClick:M[38]||(M[38]=(...x)=>m(ns)&&m(ns)(...x))},F(m(Ke)?m(o)("Saving…"):m(o)("Save")),9,cE)])],8,LM)])):ve("",!0)]))],2))}}),fE=Ct(dE,[["__scopeId","data-v-0b490210"]]),pE={class:"content-header"},hE=["title"],mE={class:"content-actions"},vE=yn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(P(),B("header",pE,[w("div",{class:lt(["content-leading",{"is-accent":e.accent}])},[br(t.$slots,"leading",{},void 0)],2),w("h1",{class:lt(["content-title",{"is-accent":e.accent}]),title:e.title},F(e.title),11,hE),w("div",mE,[br(t.$slots,"actions",{},void 0)])]))}}),gE=Ct(vE,[["__scopeId","data-v-413c4c2d"]]),Wm=.0025,Od=3,qm=2,yE=256;function wE(e){var ge;const t=S("idle"),n=S(typeof navigator<"u"&&!!((ge=navigator.mediaDevices)!=null&&ge.getUserMedia)),r=S(0),o=S(null);let a=null,s=null,i=[],l=null,c=null,d=null,v=null,f=[],y=!1,T=!1,A=null;function U(){A&&(A.abort(),A=null),t.value==="transcribing"&&(t.value="idle")}function O(){const ee=o.value;if(!ee||typeof window>"u")return;const me=ee.getContext("2d");if(!me)return;const re=Math.max(1,Math.floor(ee.clientWidth)),Ie=Math.max(1,Math.floor(ee.clientHeight||36)),De=window.devicePixelRatio||1,Ne=Math.max(1,Math.floor(re*De)),Le=Math.max(1,Math.floor(Ie*De));(ee.width!==Ne||ee.height!==Le)&&(ee.width=Ne,ee.height=Le),me.setTransform(De,0,0,De,0,0),me.clearRect(0,0,re,Ie);const Ce=Math.max(12,Math.floor(re/(Od+qm))),Se=f.slice(-Ce),xe=Math.max(0,Ce-Se.length),Me=Ie/2,Je=getComputedStyle(ee).color||"#000000";for(let Xe=0;Xe<Ce;Xe+=1){const st=Se[Xe-xe]??0,N=Math.max(.08,Math.min(1,st*18))*Me,oe=Xe*(Od+qm);me.globalAlpha=st<=Wm?.35:1,me.fillStyle=Je,me.fillRect(oe,Me-N,Od,N*2)}me.globalAlpha=1}function $(){f=[],r.value=0,O()}function q(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),c&&(c.disconnect(),c=null),l&&(l.close(),l=null),v=null}function R(ee){if(typeof window>"u")return;const me=window.webkitAudioContext,re=window.AudioContext??me;re&&(q(),$(),l=new re,c=l.createMediaStreamSource(ee),d=l.createScriptProcessor(2048,1,1),v=performance.now(),d.onaudioprocess=Ie=>{const De=Ie.inputBuffer.getChannelData(0);let Ne=0;for(let Le=0;Le<De.length;Le+=1){const Ce=Math.abs(De[Le]??0);Ne+=Ce<Wm?0:Ce}f.push(Ne/De.length),f.length>yE&&f.shift(),v!==null&&(r.value=Math.max(0,performance.now()-v)),O()},c.connect(d),d.connect(l.destination),O())}async function pe(){var ee;if(t.value==="transcribing"&&U(),!(t.value!=="idle"||!n.value||y)){y=!0,T=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=me=>{me.data.size>0&&i.push(me.data)},a.onstop=()=>{var Ie;const me=i,re=(a==null?void 0:a.mimeType)||((Ie=me[0])==null?void 0:Ie.type)||"audio/webm";ye(),le(me,re)},R(s),a.start(250),t.value="recording",T&&ce()}catch(me){ye(),t.value="idle",(ee=e.onError)==null||ee.call(e,me)}finally{y=!1}}}function ce(){if(y&&t.value==="idle"){T=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function K(){T=!1,U(),ye(),t.value="idle"}async function le(ee,me){var De,Ne,Le,Ce,Se;if(ee.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const re=new Blob(ee,{type:me});t.value="transcribing";let Ie=null;try{const xe=me.split(/[/;]/)[1]??"webm",Me=new FormData;Me.append("file",re,`codex.${xe}`);const Je=((Ne=e.getLanguage)==null?void 0:Ne.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&Me.append("language",Je),Ie=new AbortController,A=Ie;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Me,signal:Ie.signal}),st=await Xe.text();let de=null;try{de=st.trim()?JSON.parse(st):null}catch{de=null}if(!Xe.ok){const oe=(Le=de==null?void 0:de.error)==null?void 0:Le.trim(),se=st.trim();throw new Error(oe||se||`Transcription failed: ${Xe.status}`)}const N=((de==null?void 0:de.text)??"").trim();N.length>0?e.onTranscript(N):(Ce=e.onEmpty)==null||Ce.call(e)}catch(xe){if(xe instanceof DOMException&&xe.name==="AbortError")return;(Se=e.onError)==null||Se.call(e,xe)}finally{Ie&&A===Ie&&(A=null),t.value==="transcribing"&&(t.value="idle")}}function ye(){q(),$(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ee=>ee.stop()),s=null),i=[]}Gs(()=>{K()});function Pe(){if(t.value==="recording"){ce();return}(t.value==="idle"||t.value==="transcribing")&&pe()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:pe,stopRecording:ce,toggleRecording:Pe,cancel:K}}const bE={},TE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function SE(e,t){return P(),B("svg",TE,[...t[0]||(t[0]=[w("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 CE=Ct(bE,[["render",SE]]),xE={},kE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function IE(e,t){return P(),B("svg",kE,[...t[0]||(t[0]=[w("path",{d:"M4 8V4h4"},null,-1),w("path",{d:"M20 8V4h-4"},null,-1),w("path",{d:"M4 16v4h4"},null,-1),w("path",{d:"M20 16v4h-4"},null,-1)])])}const AE=Ct(xE,[["render",IE]]),_E={},PE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function ME(e,t){return P(),B("svg",PE,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const EE=Ct(_E,[["render",ME]]),RE={},jE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function LE(e,t){return P(),B("svg",jE,[...t[0]||(t[0]=[w("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),w("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 NE=Ct(RE,[["render",LE]]),OE=["aria-label"],$E=8,hi=8,DE=yn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const r=e,o=n,a=S(null),s=S(null),i=S({});let l=!1;const c=Y(()=>r.open),d=Y(()=>r.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v(O,$,q){return Math.min(Math.max($,O),q)}function f(){var Pe,ge;if(!c.value)return;const O=a.value;if(!O||typeof window>"u")return;const $=O.getBoundingClientRect(),q=window.innerWidth,R=window.innerHeight,pe=Math.max(0,q-hi*2),ce=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,pe),K=((ge=s.value)==null?void 0:ge.offsetHeight)??0;let le;r.align==="end"?le=$.right-ce:r.align==="center"?le=$.left+($.width-ce)/2:le=$.left,le=v(le,hi,Math.max(hi,q-ce-hi));let ye=$.top-K-$E;ye=v(ye,hi,Math.max(hi,R-K-hi)),i.value={position:"fixed",left:`${le}px`,right:"auto",top:`${ye}px`,bottom:"auto",width:`${ce}px`}}function y(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function T(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}rt(c,O=>{if(!O){T(),i.value={};return}y(),Ft(()=>{var $;($=s.value)==null||$.focus(),f(),window.requestAnimationFrame(f)})}),Gs(()=>{T()});function A(){o("update:open",!r.open)}function U(O){var K,le,ye;if(O.key==="Escape"){o("update:open",!1);return}const $=s.value;if(!$)return;const q=Array.from($.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(q.length===0)return;if(O.key==="Home"){O.preventDefault(),(K=q[0])==null||K.focus();return}if(O.key==="End"){O.preventDefault(),(le=q[q.length-1])==null||le.focus();return}if(O.key!=="ArrowDown"&&O.key!=="ArrowUp")return;O.preventDefault();let R=q.findIndex(Pe=>Pe===document.activeElement);R<0&&(R=O.key==="ArrowDown"?-1:0);const pe=O.key==="ArrowDown"?1:-1,ce=(R+pe+q.length)%q.length;(ye=q[ce])==null||ye.focus()}return t({root:a}),(O,$)=>(P(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[br(O.$slots,"trigger",{toggle:A,isOpen:c.value},void 0),Fe(uu,{name:"composer-popover"},{default:dt(()=>[c.value?(P(),B("div",{key:0,ref_key:"panelRef",ref:s,class:lt(["composer-popover-panel",[d.value,e.panelClass]]),style:to(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:U},[br(O.$slots,"default",{},void 0,!0)],46,OE)):ve("",!0)]),_:3})],512))}}),uc=Ct(DE,[["__scopeId","data-v-1fb1570a"]]),FE=["aria-label"],BE={class:"composer-popover-group-label"},UE=["aria-selected","onMousedown"],zE={class:"thread-composer-slash-body"},HE={class:"thread-composer-slash-name"},WE={class:"thread-composer-slash-desc"},qE={class:"thread-composer-slash-kind"},GE={class:"composer-popover-group-label composer-popover-group-label--skills"},VE=["aria-selected","onMousedown"],KE=["aria-label","title"],YE={class:"thread-composer-slash-body thread-composer-slash-body--skill"},JE={class:"thread-composer-slash-skill-name"},QE={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},XE=yn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ya(),a=S(null),s=Y(()=>n.commands.filter(v=>v.group!=="skill")),i=Y(()=>n.commands.filter(v=>v.group==="skill"));rt(()=>n.highlightedIndex,async()=>{var v,f;await Ft(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return o(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function c(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function d(v){return o(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(P(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":m(o)("Commands")},[s.value.length>0?(P(),B(ut,{key:0},[w("div",BE,F(m(o)("Commands")),1),(P(!0),B(ut,null,on(s.value,(y,T)=>(P(),B("button",{key:y.id,class:lt(["thread-composer-slash-row",{"is-active":T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":T===e.highlightedIndex,onMousedown:gt(A=>r("select",y),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",zE,[w("span",HE,F(y.id),1),w("span",WE,F(m(o)(y.description)),1)]),w("span",qE,F(l(y.kind)),1)],42,UE))),128))],64)):ve("",!0),i.value.length>0?(P(),B(ut,{key:1},[w("div",GE,F(m(o)("Skills")),1),(P(!0),B(ut,null,on(i.value,(y,T)=>(P(),B("button",{key:y.skillPath||y.id,class:lt(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+T===e.highlightedIndex,onMousedown:gt(A=>r("select",y),["prevent"])},[w("span",{class:lt(["thread-composer-slash-skill-icon",`is-${y.scope||"user"}`]),"aria-label":d(y.scope),title:d(y.scope)},F(c(y.scope)),11,KE),w("span",YE,[w("span",JE,F(y.displayName||y.id),1),w("span",QE,F(y.description),1)])],42,VE))),128))],64)):ve("",!0)],8,FE))}}),ZE=Ct(XE,[["__scopeId","data-v-bc518c3f"]]),eR=["data-streaming"],tR=["aria-expanded"],nR={class:"thread-composer-plan-panel-title"},rR={key:0,class:"thread-composer-plan-panel-badge"},oR={class:"thread-composer-plan-panel-progress"},aR=["title"],sR=["data-status"],iR={class:"thread-composer-plan-panel-latest-text"},lR={class:"thread-composer-plan-panel-popover-content"},uR={class:"thread-composer-plan-panel-popover-scroll"},cR={class:"thread-composer-plan-panel-popover-head"},dR={class:"thread-composer-plan-panel-title"},fR={class:"thread-composer-plan-panel-progress"},pR={key:0,class:"thread-composer-plan-panel-popover-section"},hR={class:"thread-composer-plan-panel-section-label"},mR=["title"],vR={class:"thread-composer-plan-panel-popover-section"},gR={class:"thread-composer-plan-panel-section-label"},yR={class:"thread-composer-plan-panel-steps"},wR=["data-status"],bR=["data-status"],TR=["title"],SR={class:"thread-composer-plan-panel-popover-footer"},CR=["disabled","data-state"],xR=yn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ya(),a=S(!1),s=Y(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(y=>y.status==="completed").length}),i=Y(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let y=v.length-1;y>=0;y-=1){const T=v[y];if(T.status==="inProgress")return T}return v[v.length-1]}),l=Y(()=>{var T,A,U;const v=((A=(T=n.planPanel)==null?void 0:T.explanation)==null?void 0:A.trim())??"";if(!v)return"";const f=((U=v.split(/[。!?!?\n]/u)[0])==null?void 0:U.trim())??"";if(!f)return v;const y=80;return f.length>y?`${f.slice(0,y)}…`:f});function c(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function d(){a.value=!1,r("implement-plan")}return(v,f)=>(P(),B("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Fe(uc,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":m(o)("Plan"),"onUpdate:open":f[1]||(f[1]=y=>a.value=y)},{trigger:dt(()=>{var y,T;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=A=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",nR,F(m(o)("Plan")),1),e.planPanel.streaming?(P(),B("span",rR,F(m(o)("Updating")),1)):ve("",!0),w("span",oR,F(s.value)+"/"+F(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((y=i.value)==null?void 0:y.step)??""},[i.value?(P(),B("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},F(c(i.value.status)),9,sR)):ve("",!0),w("span",iR,F(((T=i.value)==null?void 0:T.step)??""),1)],8,aR),Fe(Us,{class:"thread-composer-plan-panel-chevron"})],8,tR)]}),default:dt(()=>[w("div",lR,[w("div",uR,[w("header",cR,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",dR,F(m(o)("Plan")),1),w("span",fR,F(s.value)+"/"+F(e.planPanel.steps.length),1)]),e.planPanel.explanation?(P(),B("section",pR,[w("p",hR,F(m(o)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},F(l.value),9,mR)])):ve("",!0),w("section",vR,[w("p",gR,F(m(o)("Steps"))+" ("+F(e.planPanel.steps.length)+")",1),w("ol",yR,[(P(!0),B(ut,null,on(e.planPanel.steps,(y,T)=>(P(),B("li",{key:`composer-plan-${e.planPanel.id}-${T}`,class:"thread-composer-plan-panel-step","data-status":y.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":y.status},F(c(y.status)),9,bR),w("span",{class:"thread-composer-plan-panel-step-text",title:y.step},F(y.step),9,TR)],8,wR))),128))])])]),w("footer",SR,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:d},F(e.planPanel.implemented?m(o)("Plan executed"):e.planPanel.streaming?m(o)("Implementing…"):m(o)("Implement plan")),9,CR)])])]),_:1},8,["open","aria-label"])],8,eR))}}),kR=Ct(xR,[["__scopeId","data-v-970a9351"]]),IR={key:0,class:"thread-composer-attachments"},AR=["src"],_R=["src","alt"],PR=["aria-label","disabled","onClick"],MR={key:1,class:"thread-composer-folder-chips"},ER=["title"],RR={class:"thread-composer-folder-chip-meta"},jR=["aria-label","disabled","onClick"],LR={key:2,class:"thread-composer-file-chips"},NR=["title"],OR=["aria-label","disabled","onClick"],$R={key:3,class:"thread-composer-skill-chips"},DR=["title","aria-label","onClick"],FR=["aria-label","onClick"],BR=yn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,r=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function o(l){const c=l.trim();return c?!!(/^video\/|^data:video\//i.test(c)||r.test(c)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const c=l.trim();return c?c.endsWith("/SKILL.md")?c:`${c.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const c=s(l.path);!c||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(c)}`,"_blank","noopener,noreferrer")}return(l,c)=>(P(),B(ut,null,[e.selectedImages.length>0?(P(),B("div",IR,[(P(!0),B(ut,null,on(e.selectedImages,d=>(P(),B("div",{key:d.id,class:"thread-composer-attachment"},[o(d.url)?(P(),B("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,AR)):(P(),B("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,_R)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${d.name||"image"}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-image",d.id)}," x ",8,PR)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(P(),B("div",MR,[(P(!0),B(ut,null,on(e.folderUploadGroups,d=>(P(),B("span",{key:d.id,class:"thread-composer-folder-chip"},[Fe(op,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},F(d.name),9,ER),w("span",RR,[d.isUploading?(P(),B(ut,{key:0},[Ds(F(a(d))+"% uploading ("+F(d.processed)+"/"+F(d.total)+") ",1)],64)):(P(),B(ut,{key:1},[Ds(F(d.filePaths.length)+" file"+F(d.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${d.name}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-folder",d.id)},"×",8,jR)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(P(),B("div",LR,[(P(!0),B(ut,null,on(e.standaloneFileAttachments,d=>(P(),B("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Fe(gl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},F(d.label),9,NR),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${d.label}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-file",d.fsPath)},"×",8,OR)]))),128))])):ve("",!0),e.selectedSkills.length>0?(P(),B("div",$R,[(P(!0),B(ut,null,on(e.selectedSkills,d=>(P(),B("span",{key:d.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(d.path),"aria-label":`Open ${d.displayName||d.name} SKILL.md`,onClick:v=>i(d)},F(d.displayName||d.name),9,DR),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${d.displayName||d.name}`,onClick:v=>n("remove-skill",d.path)},"×",8,FR)]))),128))])):ve("",!0)],64))}}),UR=Ct(BR,[["__scopeId","data-v-7ba5474c"]]),zR=yn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ya(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=Y(()=>{var U;const T=(U=n.modelReasoningEfforts)==null?void 0:U[n.selectedModel];if(T===void 0)return a;const A=new Set(T);return a.filter(O=>A.has(O.value))});function i(T){return T.trim().replace(/^gpt/i,"GPT")}const l=Y(()=>n.models.map(T=>({value:T,label:i(T)}))),c=Y(()=>n.disabled||!n.activeThreadId),d=Y(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=Y(()=>n.selectedSpeedMode==="fast"&&d.value);function f(T){r("update:selected-model",T)}function y(T){r("update:selected-reasoning-effort",T)}return(T,A)=>(P(),B(ut,null,[Fe(Ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?Pc:null,placeholder:m(o)("Model"),"open-direction":"up",variant:"pill",disabled:c.value||e.models.length===0,"enable-search":"","search-placeholder":m(o)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(Ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:m(o)("Thinking"),"open-direction":"up",variant:"pill",disabled:c.value||s.value.length===0,"onUpdate:modelValue":y},null,8,["model-value","options","placeholder","disabled"])],64))}}),HR=Ct(zR,[["__scopeId","data-v-245f3391"]]),WR=["aria-label","disabled"],qR=["disabled"],GR=["disabled"],VR=["disabled"],KR={class:"thread-composer-attach-mode"},YR={class:"thread-composer-attach-mode-label"},JR={class:"thread-composer-attach-mode-buttons"},QR=["disabled"],XR=["disabled"],ZR={class:"thread-composer-attach-mode"},e1={class:"thread-composer-attach-mode-label"},t1={class:"thread-composer-attach-mode-buttons"},n1=["disabled","onClick"],r1={class:"thread-composer-attach-mode"},o1={class:"thread-composer-attach-mode-label"},a1={class:"thread-composer-attach-mode-buttons"},s1=["disabled","onClick"],i1={key:0,class:"thread-composer-menu-error",role:"alert"},l1={key:0,class:"thread-composer-approval-tip",role:"status"},u1=yn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:r}=ya();function o(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function c(v){n("select-collaboration-mode",v)}function d(v){n("select-approval-policy",v)}return(v,f)=>(P(),tt(uc,{open:e.open,align:"start",width:"lg","aria-label":m(r)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=y=>n("update:open",y))},{trigger:dt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":m(r)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:o}," + ",8,WR)]),default:dt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},F(m(r)("Add photos & files")),9,qR),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},F(m(r)("Add folder")),9,GR),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},F(m(r)("Take photo")),9,VR),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",KR,[w("span",YR,F(m(r)("In-progress send")),1),w("div",JR,[w("button",{class:lt(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=y=>a("steer"))},F(m(r)("Steer")),11,QR),w("button",{class:lt(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=y=>a("queue"))},F(m(r)("Queue")),11,XR)])]),e.isMobile?(P(),B(ut,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",ZR,[w("span",e1,F(m(r)("Plan mode")),1),w("div",t1,[(P(!0),B(ut,null,on(e.collaborationModeChoices,y=>(P(),B("button",{key:`mobile-plan-${y.value}`,class:lt(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===y.value}]),type:"button",disabled:y.disabled||e.isComposerConfigDisabled,onClick:T=>c(y.value)},F(m(r)(y.labelKey)),11,n1))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",r1,[w("span",o1,F(m(r)("Approval policy")),1),w("div",a1,[(P(!0),B(ut,null,on(e.approvalPolicyChoices,y=>(P(),B("button",{key:`mobile-approval-${y.value}`,class:lt(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===y.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:T=>d(y.value)},F(m(r)(y.label)),11,s1))),128))])]),e.approvalPolicyError?(P(),B("p",i1,F(e.approvalPolicyError),1)):ve("",!0),Fe(uu,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(P(),B("span",l1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),c1=Ct(u1,[["__scopeId","data-v-4d71ea67"]]),d1=/(^|\s)(\/[a-zA-Z]*)$/,Gm=[{id:"compact",description:"Compact the current thread context",kind:"rpc",group:"builtin"},{id:"review",description:"Open the code review pane",kind:"rpc",group:"builtin"},{id:"rename",description:"Rename the current thread",kind:"rpc",group:"builtin"},{id:"archive",description:"Archive the current thread",kind:"rpc",group:"builtin"},{id:"fork",description:"Fork the current thread",kind:"rpc",group:"builtin"},{id:"new",description:"Start a new thread",kind:"rpc",group:"builtin"},{id:"skills",description:"Open the skills page",kind:"rpc",group:"builtin"},{id:"init",description:"Generate or update AGENTS.md",kind:"text",group:"builtin",insertText:"Create or update the AGENTS.md file for this project: include an overview, architecture notes, development conventions, and a workflow guide based on the codebase."},{id:"help",description:"Show help about Codex",kind:"text",group:"builtin",insertText:"How do I use Codex? Point me to the official documentation and explain the available commands."},{id:"mention",description:"Mention files with @",kind:"text",group:"builtin",insertText:"Please review the files I mention with @, starting with: "},{id:"diff",description:"Show the current git diff",kind:"text",group:"builtin",insertText:"Show the current git diff of this project and summarize the changes."},{id:"clear",description:"Clear the input",kind:"local",group:"builtin"}];function f1(e){var r,o,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((r=s.description)==null?void 0:r.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((o=s.displayName)==null?void 0:o.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function p1(e){const t=e.match(d1);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function h1(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=e.filter(o=>o.id===n);return r.length>0?r:e.filter(o=>o.id.startsWith(n))}const m1={class:"thread-composer-main"},v1={class:"thread-composer-input-row"},g1={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},y1={class:"thread-composer-drop-overlay-copy"},w1={key:1,class:"composer-popover"},b1=["onMousedown"],T1={key:1,class:"thread-composer-file-mention-icon-markdown"},S1={class:"thread-composer-file-mention-text"},C1={class:"thread-composer-file-mention-name"},x1={key:0,class:"thread-composer-file-mention-dir"},k1={key:1,class:"thread-composer-file-mention-empty"},I1={key:2,class:"thread-composer-file-mention-empty"},A1=["placeholder","disabled"],_1=["aria-label","title","disabled"],P1={class:"thread-composer-actions"},M1=["aria-label","title","disabled"],E1={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},R1=["aria-label","title","disabled"],j1={key:0,class:"thread-composer-secondary"},L1=["aria-label","disabled"],N1={class:"thread-composer-plan-trigger-label"},O1=["aria-checked","disabled","onClick"],$1={class:"thread-composer-menu-item-copy"},D1={class:"thread-composer-menu-item-title"},F1={key:0,class:"thread-composer-menu-item-sub"},B1={key:1,class:"thread-composer-menu-item-hint"},U1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},z1=["aria-label","disabled"],H1={class:"thread-composer-approval-trigger-label"},W1=["aria-checked","disabled","onClick"],q1={class:"thread-composer-menu-item-copy"},G1={class:"thread-composer-menu-item-title"},V1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},K1={key:0,class:"thread-composer-menu-error",role:"alert"},Y1={key:0,class:"thread-composer-approval-tip",role:"status"},J1=["title","aria-label"],Q1={class:"thread-composer-context-usage-value"},X1={key:0,class:"thread-composer-context-usage-compact"},Z1=["disabled"],ej=["disabled"],tj=["disabled"],$d=12e3,nj=2e3,rj="codex-web-local.thread-draft.v1.",oj=yn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const r=e,o=n,{t:a}=ya(),s=S(""),i=S([]),l=S([]),c=S([]),d=S([]),v=S(""),f=S(0),y=S(null),T=S(!1),{state:A,cancel:U}=wE({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:k=>{if(s.value=s.value?`${s.value}
58
+ ${k}`:k,v.value="",r.dictationAutoSend!==!1){const L=r.isTurnInProgress?$e.value:"steer";Gt(L);return}Ft(()=>{var L;return(L=R.value)==null?void 0:L.focus()})},onEmpty:()=>{v.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:k=>{if(k instanceof DOMException&&k.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=k instanceof Error?k.message:"Dictation failed."}}),O=S(null),$=S(null),q=S(null),R=S(null),{isMobile:pe}=Jf(),ce=S(!1),K=S(!1),le=S(!1),ye=S(null),Pe=S(""),ge=S([]),ee=S(!1),me=S(0),re=S(!1),Ie=S(null),De=S(""),Ne=S(0),Le=S(Gm),Ce=Y(()=>[...Gm,...f1(r.skills??[])]),Se=S(!1),xe=S(!1);let Me=!1;const Je=S(0);let Xe=0,st=null,de="",N=!1,oe=0,se=0;const je=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let We="";const _=Y(()=>{const k=new Set((r.collaborationModes??[]).map(L=>L.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:a("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!k.has("execplans")}]}),E=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],z=Y(()=>{const k=_.value.find(L=>L.value===r.selectedCollaborationMode);return a(k?k.labelKey:"Plan mode")}),ue=Y(()=>{const k=E.find(L=>L.value===r.approvalPolicy);return a(k?k.label:"Approval policy")}),ne=Y(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),ae=Y(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||ne.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||c.value.length>0),_e=Y(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||c.value.length>0||d.value.length>0),Oe=Y(()=>{const k=new Set;for(const L of d.value)for(const V of L.filePaths)k.add(V);return c.value.filter(L=>!k.has(L.fsPath))}),ke=Y(()=>r.disabled||!r.activeThreadId||r.externalSessionActive===!0),he=Y(()=>r.disabled||!r.activeThreadId),Ke=Y(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),$e=S(Ke.value),qe=Y(()=>A.value==="recording"),Ge=Y(()=>r.activeThreadId?ne.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),ct=Y(()=>s.value.trim().length>0||i.value.length>0||c.value.length>0),bt=Y(()=>s.value.split(`
59
+ `).length),nt=Y(()=>Se.value||bt.value>=6||xe.value),it=Y(()=>No(r.threadTokenUsage??null)),J=Y(()=>{var k;return((k=it.value)==null?void 0:k.summaryText)??""}),fe=Y(()=>{var k;return((k=it.value)==null?void 0:k.tooltipText)??""}),Te=Y(()=>{var k;return((k=it.value)==null?void 0:k.tone)??"healthy"});function Be(){Te.value!=="healthy"&&o("compact-context")}function Tt(k){if(!Number.isFinite(k))return"0";const L=Math.abs(k);return L>=1e6?`${(L>=1e7?(k/1e6).toFixed(0):(k/1e6).toFixed(1)).replace(/\.0$/,"")}M`:L>=1e3?`${(L>=1e5?(k/1e3).toFixed(0):(k/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(k))}function yt(k){const L=Math.max(0,k.inputTokens-k.cachedInputTokens),V=[`${Tt(k.totalTokens)} ${a("total")}`,`${Tt(L)} ${a("input")}`];return k.cachedInputTokens>0&&V.push(`${Tt(k.cachedInputTokens)} ${a("cached")}`),k.outputTokens>0&&V.push(`${Tt(k.outputTokens)} ${a("output")}`),k.reasoningOutputTokens>0&&V.push(`${Tt(k.reasoningOutputTokens)} ${a("reasoning")}`),V.join(" · ")}function Dt(k,L){if(!Number.isFinite(k)||!Number.isFinite(L)||L<=0)return 0;if(L<=$d){const jt=Math.max(0,L-Math.max(0,k));return Math.max(0,Math.min(100,Math.round(jt/L*100)))}const V=L-$d,be=Math.max(0,k-$d),ze=Math.max(0,V-be);return Math.max(0,Math.min(100,Math.round(ze/V*100)))}function No(k){if(!k)return null;const L=k.modelContextWindow??null;if(typeof L!="number"||!Number.isFinite(L)||L<=0)return null;const V=Math.max(0,k.last.totalTokens),be=Dt(V,L),ze=Math.max(0,Math.min(100,100-be)),jt=be<=15?"danger":be<=35?"warning":"healthy";return{summaryText:`${be}% · ${Tt(V)} / ${Tt(L)}`,tooltipText:[`${a("Context window")}: ${be}% ${a("left")} (${ze}% ${a("used")})`,`${a("In context")}: ${V.toLocaleString()} / ${L.toLocaleString()} tokens`,`${a("Last turn")}: ${yt(k.last)}`,`${a("Session total")}: ${yt(k.total)}`].join(`
60
+ `),percentRemaining:be,tone:jt}}function Gt(k="steer"){var V;const L=s.value.trim();if(ae.value){if(o("submit",{text:L,imageUrls:i.value.map(be=>be.url),fileAttachments:[...c.value],skills:l.value.map(be=>({name:be.name,path:be.path})),mode:k}),es(r.activeThreadId),wa(),Se.value=!1,d.value=[],ce.value=!1,Sn(),je||pe.value){(V=R.value)==null||V.blur();return}Ft(()=>{var be;return(be=R.value)==null?void 0:be.focus()})}}function io(k){$e.value=k}function Zn(k){Je.value+=1,s.value=k.text,i.value=k.imageUrls.map((L,V)=>({id:`queued-${Date.now()}-${V}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${V+1}`,url:L})),l.value=k.skills.map(L=>(r.skills??[]).find(V=>V.path===L.path)??{name:L.name,displayName:void 0,description:"",path:L.path}),c.value=k.fileAttachments.map(L=>({...L})),d.value=[],v.value="",y.value=null,f.value=0,ce.value=!1,Sn(),xr(),se+=1}function wa(){Zn({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Se.value=!1}function lo(k){return`${rj}${k}`}function Vs(k){if(typeof window>"u")return null;const L=k.trim();if(!L)return null;try{const V=window.localStorage.getItem(lo(L));if(!V)return null;const be=JSON.parse(V);return typeof be=="string"?{text:be,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof be.text=="string"?be.text:"",imageUrls:Array.isArray(be.imageUrls)?be.imageUrls.filter(ze=>typeof ze=="string"):[],fileAttachments:Array.isArray(be.fileAttachments)?be.fileAttachments.filter(ze=>!!ze&&typeof ze.label=="string"&&typeof ze.path=="string"&&typeof ze.fsPath=="string"):[],skills:Array.isArray(be.skills)?be.skills.filter(ze=>!!ze&&typeof ze.name=="string"&&typeof ze.path=="string"):[]}}catch{return null}}function ba(k,L){if(typeof window>"u")return;const V=k.trim();if(V)try{if(L.text.trim().length>0||L.imageUrls.length>0||L.fileAttachments.length>0||L.skills.length>0){window.localStorage.setItem(lo(V),JSON.stringify(L));return}window.localStorage.removeItem(lo(V))}catch{}}function es(k){ba(k,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Or(){return{text:s.value,imageUrls:i.value.map(k=>k.url),fileAttachments:c.value.map(k=>({...k})),skills:l.value.map(k=>({name:k.name,path:k.path}))}}function ts(){o("interrupt")}function $r(){const k=R.value;if(!k){xe.value=!1;return}xe.value=k.scrollHeight>k.clientHeight+2}function Oo(){Me||(Me=!0,Ft(()=>{Me=!1,$r()}))}function $o(){ke.value||(Se.value=!Se.value,Oo(),Ft(()=>{var k;return(k=R.value)==null?void 0:k.focus()}))}function Ks(k){o("update:selected-model",k)}function Do(k){if(k===r.selectedCollaborationMode){K.value=!1;return}o("update:selected-collaboration-mode",k),K.value=!1}function Dr(k){if(k===r.selectedCollaborationMode){ce.value=!1;return}o("update:selected-collaboration-mode",k),ce.value=!1}function ns(k){o("update:selected-reasoning-effort",k)}function Ta(k){r.approvalPolicy===k||r.isApprovalPolicySaving===!0||(o("update:approval-policy",k),o("save-approval-policy"))}function Fo(){r.dictationClickToToggle}function uo(){ke.value||(ce.value=!ce.value,K.value=!1,le.value=!1)}function co(){he.value||(K.value=!K.value,ce.value=!1,le.value=!1)}function Tr(){he.value||(le.value=!le.value,ce.value=!1,K.value=!1)}function rs(){var k;(k=O.value)==null||k.click()}function os(){var k;(k=$.value)==null||k.click()}function vt(){var k;(k=q.value)==null||k.click()}function xt(k){const L=i.value.find(V=>V.id===k);if(L&&cn(L.url)){const V=er(L.url);V&&dn(V)}i.value=i.value.filter(V=>V.id!==k)}function kt(k){l.value=l.value.filter(L=>L.path!==k)}function dn(k){c.value=c.value.filter(L=>L.fsPath!==k)}function Hn(k){const L=d.value.find(be=>be.id===k);if(!L)return;const V=new Set(L.filePaths);c.value=c.value.filter(be=>!V.has(be.fsPath)),d.value=d.value.filter(be=>be.id!==k)}function un(k,L){const V=k.replace(/\\/g,"/");if(c.value.some(jt=>jt.fsPath===V))return;const be=V.split("/").filter(Boolean),ze=(L==null?void 0:L.trim())||be[be.length-1]||V;c.value=[...c.value,{label:ze,path:V,fsPath:V}]}function Sr(k){return k.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(k.name)}const dr=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Bo(k){return k.type.startsWith("video/")?!0:dr.test(k.name)}function cn(k){const L=k.trim();if(!L)return!1;if(L.startsWith("data:video/"))return!0;try{const V=new URL(L,window.location.href);return dr.test(V.pathname)?!0:V.pathname==="/codex-local-image"?dr.test(V.searchParams.get("path")??""):!1}catch{return dr.test(L)}}function er(k){try{const L=new URL(k,window.location.href);return L.pathname!=="/codex-local-image"?"":decodeURIComponent(L.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function Cr(k){return k?Array.from(k):[]}function Et(k){return k!==se?!1:(f.value+=1,!0)}function fo(k){k===se&&(f.value=Math.max(0,f.value-1))}function tr(k){if(k<=0)return;const L=y.value,V=L?L.succeeded+L.failed:0;if(!L||V>=L.total){y.value={total:k,succeeded:0,failed:0};return}y.value={...L,total:L.total+k}}function wn(k){const L=y.value;L&&(y.value={...L,succeeded:L.succeeded+(k==="success"?1:0),failed:L.failed+(k==="failure"?1:0)})}function Fr(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function jn(k){const L=new Date,V=[L.getFullYear(),String(L.getMonth()+1).padStart(2,"0"),String(L.getDate()).padStart(2,"0"),String(L.getHours()).padStart(2,"0"),String(L.getMinutes()).padStart(2,"0"),String(L.getSeconds()).padStart(2,"0")].join("-"),be=k.type.startsWith("image/")&&k.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${V}.${be}`}function An(){const k=new Date;return`pasted-text-${[k.getFullYear(),String(k.getMonth()+1).padStart(2,"0"),String(k.getDate()).padStart(2,"0"),String(k.getHours()).padStart(2,"0"),String(k.getMinutes()).padStart(2,"0"),String(k.getSeconds()).padStart(2,"0")].join("-")}.txt`}function bn(k){return k.name.trim()?k:new File([k],jn(k),{type:k.type||"image/png",lastModified:Date.now()})}async function Sa(k,L){if(Et(L))try{const V=bn(k),be=await Eu(V);if(L!==se)return;if(!be){wn("failure");return}i.value=[...i.value,{id:Fr(),name:V.name,url:`/codex-local-image?path=${encodeURIComponent(be)}`}],wn("success")}catch{L===se&&wn("failure")}finally{fo(L)}}async function fr(k,L){if(Et(L))try{const V=await Eu(k);if(L!==se)return;if(!V){wn("failure");return}un(V),wn("success")}catch{L===se&&wn("failure")}finally{fo(L)}}async function Br(k,L){if(Et(L))try{const V=bn(k),be=await Eu(V);if(L!==se)return;if(!be){wn("failure");return}const ze=be.replace(/\\/g,"/");i.value=[...i.value,{id:Fr(),name:V.name,url:`/codex-local-image?path=${encodeURIComponent(ze)}`}],un(ze),wn("success")}catch{L===se&&wn("failure")}finally{fo(L)}}function Bt(k){const L=Cr(k);if(L.length===0)return;tr(L.length),ce.value=!1,Sn();const V=se;for(const be of L)Sr(be)?Sa(be,V):Bo(be)?Br(be,V):fr(be,V)}function po(){oe=0,T.value=!1}function Uo(k){return k?Array.from(k.types??[]).includes("Files"):!1}async function zo(k){if(!k||k.length===0)return;const L=Je.value,V=Array.from(k),ze=(V[0].webkitRelativePath||V[0].name).split("/").filter(Boolean)[0]||"Folder",jt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:jt,name:ze,total:V.length,processed:0,filePaths:[],isUploading:!0}];const At=en=>{L===Je.value&&(d.value=d.value.map(Kt=>Kt.id===jt?en(Kt):Kt))};for(const en of V)try{const Kt=await Eu(en);if(L!==Je.value)return;if(Kt){const Hr=en.webkitRelativePath||en.name;un(Kt,Hr),At(ka=>({...ka,processed:ka.processed+1,filePaths:[...ka.filePaths,Kt]}));continue}At(Hr=>({...Hr,processed:Hr.processed+1}))}catch{At(Kt=>({...Kt,processed:Kt.processed+1}))}At(en=>({...en,isUploading:!1}))}function Tn(k){k&&(k.value="")}function Jt(k){const L=k.target;Bt((L==null?void 0:L.files)??null),Tn(L),ce.value=!1}function pr(k){const L=k.target;Bt((L==null?void 0:L.files)??null),Tn(L),ce.value=!1}function an(k){const L=k.target;zo((L==null?void 0:L.files)??null),Tn(L),ce.value=!1}function Ho(k){ke.value||!Uo(k.dataTransfer)||(k.preventDefault(),oe+=1,T.value=!0)}function Zt(k){ke.value||!Uo(k.dataTransfer)||(k.preventDefault(),k.dataTransfer&&(k.dataTransfer.dropEffect="copy"),T.value=!0)}function Ur(k){T.value&&(k.preventDefault(),oe=Math.max(0,oe-1),oe===0&&po())}function Ca(k){var L;ke.value||!Uo(k.dataTransfer)||(k.preventDefault(),po(),Bt(((L=k.dataTransfer)==null?void 0:L.files)??null))}function Vt(){!T.value&&oe===0||po()}function Wo(k){var jt,At;if(ke.value)return;const L=((jt=k.clipboardData)==null?void 0:jt.getData("text/plain"))??"";if(L.length>=nj){k.preventDefault();const en=new File([L],An(),{type:"text/plain",lastModified:Date.now()});Bt([en]);return}const V=Array.from(((At=k.clipboardData)==null?void 0:At.items)??[]);if(V.length===0)return;const be=L.length>0,ze=V.filter(en=>en.kind==="file"&&en.type.startsWith("image/")).map(en=>en.getAsFile()).filter(en=>en instanceof File);ze.length!==0&&(be||k.preventDefault(),Bt(ze))}function qo(){v.value&&(v.value=""),Oo(),Go(),kr()}function It(k){if(k.isComposing||k.keyCode===229)return;if(ee.value){if(k.key==="Escape"){k.preventDefault(),Sn();return}if(k.key==="ArrowDown"){k.preventDefault(),ge.value.length>0&&(me.value=(me.value+1)%ge.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),ge.value.length>0){const V=ge.value.length;me.value=(me.value+V-1)%V}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const V=ge.value[me.value];V?Ko(V):Sn();return}}if(re.value){if(k.key==="Escape"){k.preventDefault(),xr();return}if(k.key==="ArrowDown"){k.preventDefault(),Le.value.length>0&&(Ne.value=(Ne.value+1)%Le.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),Le.value.length>0){const V=Le.value.length;Ne.value=(Ne.value+V-1)%V}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const V=Le.value[Ne.value];V?Vo(V):xr();return}}if(r.sendWithEnter!==!1?k.key==="Enter"&&!k.shiftKey:k.key==="Enter"&&(k.metaKey||k.ctrlKey)){k.preventDefault(),Gt(r.isTurnInProgress?$e.value:"steer");return}}function Sn(){if(ee.value=!1,ye.value=null,Pe.value="",ge.value=[],me.value=0,N=!1,de){const k=de;de="",tk(k)}}function Go(){const k=R.value;if(!k){Sn();return}const L=k.selectionStart??s.value.length,be=s.value.slice(0,L).match(/(^|\s)(@[^\s@]*)$/);if(!be){Sn();return}const ze=be[2]??"",jt=ze.length,At=L-jt;re.value&&xr(),ye.value=At,Pe.value=ze.slice(1),ee.value=!0,zr()}function xr(){re.value=!1,Ie.value=null,De.value="",Ne.value=0,Le.value=Ce.value}function kr(){const k=R.value;if(!k){xr();return}const L=k.selectionStart??s.value.length,V=s.value.slice(0,L),be=p1(V);if(!be){xr();return}ee.value&&Sn(),Ie.value=be.startIndex,De.value=be.query,Le.value=h1(Ce.value,be.query),Ne.value=0,re.value=!0}function Vo(k){const L=R.value,V=Ie.value;if(V!==null&&L){const be=L.selectionStart??s.value.length;s.value=`${s.value.slice(0,V)}${s.value.slice(be)}`}if(xr(),k.kind==="skill"){const be=(r.skills??[]).find(jt=>jt.path===k.skillPath||jt.name===k.id);be&&!l.value.some(jt=>jt.path===be.path)&&(l.value=[...l.value,{...be}]);const ze=s.value.trim();s.value=ze.length>0?`${ze} (Use the ${k.id} skill.)`:`Use the ${k.id} skill.`,Ft(()=>{L==null||L.focus(),$r()});return}if(k.kind==="rpc"){o("slash-command",k.id);return}k.kind==="text"&&k.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${k.insertText}`:k.insertText),k.kind==="local"&&k.id==="clear"&&(s.value=""),Ft(()=>{L==null||L.focus(),$r()})}async function zr(){if(!ee.value)return;const k=(r.cwd??"").trim();if(!k){ge.value=[],N=!0;return}N=!1,st&&clearTimeout(st);const L=++Xe;st=setTimeout(async()=>{const V=`composer-${L}`,be=Pe.value;try{if(de||(await Zx([k],V),de=V,o("register-fuzzy-session",V)),await ek(de,be),!ee.value||L!==Xe)return;if(ge.value=(r.fuzzyFileSearchResults??[]).map(ze=>({path:ze.path})),me.value=0,ge.value.length===0)try{const ze=await lm(k,be,20);if(!ee.value||L!==Xe)return;ge.value=ze,me.value=0}catch{if(!ee.value||L!==Xe)return;ge.value=[]}}catch{if(!ee.value||L!==Xe)return;de="";try{const ze=await lm(k,be,20);if(!ee.value||L!==Xe)return;ge.value=ze,me.value=0}catch{if(!ee.value||L!==Xe)return;ge.value=[]}}},120)}function Ko(k){const L=R.value,V=ye.value;if(V!==null&&L){const be=L.selectionStart??s.value.length;s.value=`${s.value.slice(0,V)}${s.value.slice(be)}`.trimEnd()}un(k.path),Sn(),Ft(()=>L==null?void 0:L.focus())}function nr(k){U(),Zn(k),Ft(()=>{var L;(L=R.value)==null||L.focus(),$r()})}function ho(k){const L=k.trim();L&&(s.value=s.value.trim()?`${s.value.trim()}
61
+ ${L}`:L,Ft(()=>{var V;(V=R.value)==null||V.focus(),$r()}))}function Yo(k){const L=k.lastIndexOf("/");return L<0?k:k.slice(L+1)}function Ir(k){const L=k.lastIndexOf("/");return L<=0?"":k.slice(0,L)}function ht(k){const L=Yo(k),V=L.lastIndexOf(".");return V<=0?"":L.slice(V+1).toLowerCase()}function _n(k){const L=ht(k);return L==="ts"?"TS":L==="tsx"?"TSX":L==="js"?"JS":L==="jsx"?"JSX":L==="json"?"{}":""}function Cn(k){const L=ht(k);return L.startsWith("ts")?"ts":L.startsWith("js")?"js":L==="json"?"json":"default"}function xa(k){const L=ht(k);return L==="md"||L==="mdx"}function Wn(k){if(!ce.value&&!K.value&&!le.value)return;const L=k.target;L&&(typeof L.closest=="function"&&L.closest(".composer-popover-anchor")||(ce.value=!1,K.value=!1,le.value=!1))}return Ii(()=>{document.addEventListener("click",Wn),window.addEventListener("drop",Vt),window.addEventListener("dragend",Vt),window.addEventListener("blur",Vt),Oo()}),t({hydrateDraft:nr,appendTextToDraft:ho,hasUnsavedDraft:()=>_e.value}),Gs(()=>{document.removeEventListener("click",Wn),window.removeEventListener("drop",Vt),window.removeEventListener("dragend",Vt),window.removeEventListener("blur",Vt),window.removeEventListener("pointerup",Fo),window.removeEventListener("pointercancel",Fo),window.removeEventListener("blur",Fo),st&&clearTimeout(st)}),rt(()=>r.activeThreadId,k=>{U(),We&&ba(We,Or()),wa();const L=Vs(k);L&&(Zn(L),qo()),We=k.trim()},{immediate:!0}),rt([s,i,c,l],()=>{We&&ba(We,Or())},{deep:!0}),rt(s,()=>{Oo()}),rt(()=>r.cwd,()=>{ee.value&&zr()}),rt(()=>r.fuzzyFileSearchResults,k=>{!ee.value||!de||(ge.value=(k??[]).map(L=>({path:L.path})),me.value=0)}),rt(Ke,k=>{$e.value=k}),(k,L)=>(P(),B("form",{class:"thread-composer",onSubmit:L[6]||(L[6]=gt(V=>Gt(e.isTurnInProgress?$e.value:"steer"),["prevent"]))},[w("div",{class:lt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":T.value}])},[e.planPanel?(P(),tt(kR,{key:0,"plan-panel":e.planPanel,onImplementPlan:L[0]||(L[0]=V=>k.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Fe(UR,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":Oe.value,"selected-skills":l.value,"is-interaction-disabled":ke.value,onRemoveImage:xt,onRemoveFolder:Hn,onRemoveFile:dn,onRemoveSkill:kt},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",m1,[w("div",v1,[w("div",{class:lt(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":T.value,"thread-composer-input-wrap--expanded":Se.value}]),onDragenter:Ho,onDragover:Zt,onDragleave:Ur,onDrop:Ca},[T.value?(P(),B("div",g1,[w("span",y1,F(m(a)("Drop images or files")),1)])):ve("",!0),ee.value?(P(),B("div",w1,[ge.value.length>0?(P(!0),B(ut,{key:0},on(ge.value,(V,be)=>(P(),B("button",{key:V.path,class:lt(["thread-composer-file-mention-row",{"is-active":be===me.value}]),type:"button",onMousedown:gt(ze=>Ko(V),["prevent"])},[_n(V.path)?(P(),B("span",{key:0,class:lt(["thread-composer-file-mention-icon-badge",`is-${Cn(V.path)}`])},F(_n(V.path)),3)):xa(V.path)?(P(),B("span",T1,"↓")):(P(),tt(gl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",S1,[w("span",C1,F(Yo(V.path)),1),Ir(V.path)?(P(),B("span",x1,F(Ir(V.path)),1)):ve("",!0)])],42,b1))),128)):m(N)?(P(),B("div",k1,F(m(a)("No searchable directory for this thread")),1)):(P(),B("div",I1,F(m(a)("No matching files")),1))])):ve("",!0),re.value?(P(),tt(ZE,{key:2,commands:Le.value,"highlighted-index":Ne.value,onSelect:Vo},null,8,["commands","highlighted-index"])):ve("",!0),En(w("textarea",{ref_key:"inputRef",ref:R,"onUpdate:modelValue":L[1]||(L[1]=V=>s.value=V),class:"thread-composer-input",placeholder:Ge.value,disabled:ke.value,onInput:qo,onKeydown:It,onPaste:Wo},null,40,A1),[[Bn,s.value]]),nt.value?(P(),B("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Se.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),title:Se.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),disabled:ke.value,onClick:$o},[Se.value?(P(),tt(EE,{key:0,class:"thread-composer-expand-icon"})):(P(),tt(AE,{key:1,class:"thread-composer-expand-icon"}))],8,_1)):ve("",!0)],34),w("div",P1,[e.isTurnInProgress&&!ct.value?(P(),B("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),title:e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:ts},[e.isStopPending?(P(),B("span",E1)):(P(),tt(NE,{key:1,class:"thread-composer-stop-icon"}))],8,M1)):(P(),B("button",{key:1,class:lt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&$e.value==="queue"}]),type:"button","aria-label":e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&$e.value==="queue"?m(a)("Queue message"):m(a)("Send message"),title:e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${m(a)("Send")} ${$e.value==="queue"?m(a)("Queue"):m(a)("Steer")}`:m(a)("Send"),disabled:!ae.value,onClick:L[2]||(L[2]=V=>Gt(e.isTurnInProgress?$e.value:"steer"))},[Fe(CE,{class:"thread-composer-submit-icon"})],10,R1))])]),w("div",{class:lt(["thread-composer-controls",{"thread-composer-controls--recording":qe.value}])},[Fe(c1,{open:ce.value,"is-mobile":m(pe),"is-interaction-disabled":ke.value,"is-composer-config-disabled":he.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":_.value,"approval-policy-choices":E,"active-in-progress-mode":$e.value,"onUpdate:open":L[3]||(L[3]=V=>ce.value=V),onToggle:uo,onSetActiveMode:io,onSelectPhoto:rs,onSelectFolder:vt,onCaptureCamera:os,onSelectCollaborationMode:Dr,onSelectApprovalPolicy:Ta},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),Fe(HR,{models:e.models,"selected-model":e.selectedModel,"model-reasoning-efforts":e.modelReasoningEfforts,"selected-reasoning-effort":e.selectedReasoningEffort,"selected-speed-mode":e.selectedSpeedMode,disabled:e.disabled,"active-thread-id":e.activeThreadId,"onUpdate:selectedModel":Ks,"onUpdate:selectedReasoningEffort":ns},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),m(pe)?ve("",!0):(P(),B("div",j1,[Fe(uc,{open:K.value,align:"start",width:"md","aria-label":m(a)("Plan mode"),"onUpdate:open":L[4]||(L[4]=V=>K.value=V)},{trigger:dt(()=>[w("button",{class:lt(["thread-composer-plan-trigger",{"is-active":K.value}]),type:"button","aria-label":m(a)("Plan mode"),disabled:he.value,onClick:co},[w("span",N1,F(z.value),1),Fe(Us,{class:"thread-composer-plan-trigger-chevron"})],10,L1)]),default:dt(()=>[(P(!0),B(ut,null,on(_.value,V=>(P(),B("button",{key:V.value,class:lt(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===V.value,disabled:V.disabled||he.value,onClick:be=>Do(V.value)},[w("span",$1,[w("span",D1,F(m(a)(V.labelKey)),1),V.subLabel?(P(),B("span",F1,F(V.subLabel),1)):ve("",!0),V.disabled?(P(),B("span",B1,F(m(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===V.value?(P(),B("span",U1,"✓")):ve("",!0)],10,O1))),128))]),_:1},8,["open","aria-label"]),Fe(uc,{open:le.value,align:"center",width:"md","aria-label":m(a)("Approval policy"),"onUpdate:open":L[5]||(L[5]=V=>le.value=V)},{trigger:dt(()=>[w("button",{class:lt(["thread-composer-approval-trigger",{"is-active":le.value}]),type:"button","aria-label":m(a)("Approval policy"),disabled:he.value,onClick:Tr},[w("span",H1,F(ue.value),1),Fe(Us,{class:"thread-composer-approval-trigger-chevron"})],10,z1)]),default:dt(()=>[(P(),B(ut,null,on(E,V=>w("button",{key:V.value,class:lt(["thread-composer-menu-item",{"is-active":e.approvalPolicy===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===V.value,disabled:e.isApprovalPolicySaving,onClick:be=>Ta(V.value)},[w("span",q1,[w("span",G1,F(m(a)(V.label)),1)]),e.approvalPolicy===V.value?(P(),B("span",V1,"✓")):ve("",!0)],10,W1)),64)),e.approvalPolicyError?(P(),B("p",K1,F(e.approvalPolicyError),1)):ve("",!0),Fe(uu,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(P(),B("span",Y1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),it.value?(P(),B("button",{key:1,type:"button",class:lt(["thread-composer-context-usage-inline",{"is-warning":Te.value==="warning","is-danger":Te.value==="danger"}]),title:fe.value,"aria-label":m(a)("Context"),onClick:Be},[w("span",Q1,F(J.value),1),Te.value!=="healthy"?(P(),B("span",X1,F(m(a)("Compact")),1)):ve("",!0)],10,J1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:O,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:ke.value,onChange:Jt},null,40,Z1),w("input",{ref_key:"cameraCaptureInputRef",ref:$,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:ke.value,onChange:pr},null,40,ej),w("input",{ref_key:"folderPickerInputRef",ref:q,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:ke.value,onChange:an},null,40,tj)],32))}}),Vm=Ct(oj,[["__scopeId","data-v-c87250dc"]]),aj=["aria-label"],sj=["aria-checked","onClick"],ij={class:"runtime-toggle-option-label"},lj=yn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=ya(),o=[{value:"local",label:r("Local project"),icon:op},{value:"worktree",label:r("New worktree"),icon:lc}];function a(s){n("update:modelValue",s)}return(s,i)=>(P(),B("div",{class:"runtime-toggle",role:"radiogroup","aria-label":m(r)("Continue in")},[(P(),B(ut,null,on(o,l=>w("button",{key:l.value,class:lt(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:c=>a(l.value)},[(P(),tt(Bf(l.icon),{class:"runtime-toggle-option-icon"})),w("span",ij,F(l.label),1)],10,sj)),64))],8,aj))}}),uj=Ct(lj,[["__scopeId","data-v-b3c220d3"]]),cj={},dj={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 fj(e,t){return P(),B("svg",dj,[...t[0]||(t[0]=[w("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),w("path",{d:"M9 4l0 16"},null,-1)])])}const xy=Ct(cj,[["render",fj]]),pj={},hj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function mj(e,t){return P(),B("svg",hj,[...t[0]||(t[0]=[w("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 vj=Ct(pj,[["render",mj]]),gj={class:"sidebar-thread-controls"},yj=["aria-label","title"],wj=["aria-label","title"],bj=yn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=ya();return(n,r)=>(P(),B("div",gj,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),title:e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(P(),tt(vj,{key:0,class:"sidebar-thread-controls-icon"})):(P(),tt(xy,{key:1,class:"sidebar-thread-controls-icon"}))],8,yj),br(n.$slots,"default",{},void 0),e.showNewThreadButton?(P(),B("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":m(t)("Start new thread"),title:m(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Fe(gl,{class:"sidebar-thread-controls-icon"})],8,wj)):ve("",!0)]))}}),Km=Ct(bj,[["__scopeId","data-v-de38b7ee"]]),Tj={},Sj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Cj(e,t){return P(),B("svg",Sj,[...t[0]||(t[0]=[w("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.9"},null,-1),w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M12 8v4l3 2"},null,-1)])])}const Ym=Ct(Tj,[["render",Cj]]),xj={},kj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ij(e,t){return P(),B("svg",kj,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M4 7h16M4 12h16M4 17h10"},null,-1)])])}const Jm=Ct(xj,[["render",Ij]]),Aj={},_j={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function Pj(e,t){return P(),B("svg",_j,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Qm=Ct(Aj,[["render",Pj]]),Mj={},Ej={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Rj(e,t){return P(),B("svg",Ej,[...t[0]||(t[0]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("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"}),w("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const jj=Ct(Mj,[["render",Rj]]),Lj={},Nj={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function Oj(e,t){return P(),B("svg",Nj,[...t[0]||(t[0]=[w("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),w("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const $j=Ct(Lj,[["render",Oj]]),Dj={},Fj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Bj(e,t){return P(),B("svg",Fj,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const Xm=Ct(Dj,[["render",Bj]]);function ky(e){var o;const t=e.replace(/\r\n/g,`
62
+ `).trim();if(!t)return null;const n=[],r=[];for(const a of t.split(`
63
+ `)){const s=a.trim();if(!s){n.length===0&&r.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let c="pending";l==="x"&&(c="completed"),(l==="~"||l===">"||l==="-")&&(c="inProgress"),n.push({step:((o=i[2])==null?void 0:o.trim())??"",status:c});continue}r.push(s)}if(n.length===0){const a=Uj(t);return a||null}return{explanation:r.join(`
64
+ `).trim(),steps:n.filter(a=>a.step.length>0)}}function Uj(e){var a,s;const t=[],n=[],r=[];for(const i of e.split(`
65
+ `)){const l=i.trim();if(!l){t.length===0&&n.length===0&&r.push("");continue}const c=l.match(/^\d+[.)]\s+(.+)$/);if(c){t.push({step:((a=c[1])==null?void 0:a.trim())??"",status:"pending"});continue}const d=l.match(/^[-*]\s+(.+)$/);if(d){n.push({step:((s=d[1])==null?void 0:s.trim())??"",status:"pending"});continue}r.push(l)}const o=t.length>0?t:n;return o.length===0?null:{explanation:zj(r.join(`
66
+ `)),steps:o.filter(i=>i.step.length>0)}}function zj(e){return e.split(`
67
+ `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
68
+ `).trim()}function Zm(e){var t;return e.plan&&e.plan.steps.length>0?{explanation:((t=e.plan.explanation)==null?void 0:t.trim())??"",steps:e.plan.steps}:ky(e.text)}const Iy="modelSwitch",Ay=20;function Hj(e){return e.messageType===Iy}function Ws(e){return e.role==="user"&&e.isAgentNote!==!0}function Wj(e){return e.isAgentNote===!0?"agent-note":e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function qj(e,t=!1){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&(t||!((n=e.messageType)!=null&&n.endsWith(".live")))&&e.text.trim().length>0}function mB(e,t){var a,s;const n=[];let r=null;for(const i of e)(Ws(i)||!r)&&(r={key:`turn-${i.id}`,items:[]},n.push(r)),r.items.push({message:i,kind:Wj(i)});const o=n.length-1;for(let i=0;i<n.length;i+=1){const l=n[i],c=(s=(a=l.items.find(y=>{var T;return(T=y.message.turnId)==null?void 0:T.trim()}))==null?void 0:a.message.turnId)==null?void 0:s.trim(),d=t!==void 0&&"liveTurnId"in t;if((t==null?void 0:t.liveOverlayActive)===!0&&(d?c===(t==null?void 0:t.liveTurnId):i===o))continue;const f=[...l.items].reverse().find(y=>qj(y.message,(t==null?void 0:t.liveOverlayActive)===!1));f&&((t==null?void 0:t.liveOverlayActive)!==!1&&l.items.some(T=>typeof T.message.messageType=="string"&&T.message.messageType.endsWith(".live"))||(f.kind="final-assistant"))}return n}function _y(e){return e.replace(/\s+/g," ").trim()}function vB(e){const t=_y(e);return t.length<=80?t:t.slice(0,80)}function Gj(e){const t=_y(e);return t.length<=80?t:t.slice(0,77)+"..."}function Vj(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function ap(e,t){return e.sessionKey===t?e:Vj(t)}function gB(e,t){const n=ap(e,t);return{...n,coldPage:n.coldPage+1}}function yB(e,t,n){const r=ap(e,t),o=Math.max(0,Math.floor(n));return r.coldPage>=o?r:{...r,coldPage:o}}function wB(e,t,n,r){const o=ap(e,t),a=new Set(o.expandedWarmTurns);return r?a.add(n):a.delete(n),{...o,expandedWarmTurns:a}}function Kj(e){return Ws(e)}function Yj(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function bB(e){var a;const t=[];let n=-1,r=0;const o=(s,i)=>{t.push({userItem:s,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length})};for(let s=0;s<e.length;s+=1){const i=e[s];if(Kj(i)){if(n>=0)t[t.length-1].endIdx=s;else{t.push({userItem:i,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length}),n=s,r=s;continue}n=s,o(i,s)}else if(n>=0&&t.length>0){const l=t[t.length-1],c=((a=i.text)==null?void 0:a.trim())||"";i.role==="assistant"&&!Yj(i)&&c&&(l.assistantPreview=Gj(c)),i.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function TB({turnCount:e,hotTurns:t,pageSize:n,coldPage:r}){const o=Math.max(0,e),a=Math.max(0,t),s=Math.max(0,o-Math.min(o,a));if(s===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const i=Math.max(0,n),l=Math.max(0,Math.floor(r)),c=Math.min(s,i*(l+1));return{warmStartTurn:s-c,warmEndTurn:s,coldTurnCount:s-c}}function SB({turn:e,turnCount:t,hotTurns:n,pageSize:r}){const o=Math.max(0,t),a=Math.max(0,n),s=Math.max(0,o-Math.min(o,a));if(s===0||e>=s)return 0;const i=Math.max(1,r),l=Math.max(0,Math.floor(e)),c=s-l;return Math.max(0,Math.ceil(c/i)-1)}function CB(e,t,n){if(t.length===0)return e.slice(0);if(n>=t.length)return[];const r=t[n].startIdx;return e.slice(r)}const va="__new-thread__",Py="__new-thread-provider__::";function My(e){return e==="plan"?"plan":"default"}function xi(e){return typeof e=="string"?e.trim():""}function Po(){return Object.create(null)}function Gu(e){const t=Po();for(const[n,r]of Object.entries(e))t[n]=r;return t}function Vl(e,t){if(!(t in e))return e;const n=Po();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function Ey(e,t){let n=!1;const r=Po();for(const[o,a]of Object.entries(e)){if(o===va||o.startsWith(Py)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function Ls(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function Jj(e){return e===va}function Ou(e){const t=Ls(e);return t?`${Py}${t}`:""}function Ga(e){return e.trim()||va}function Dd(e,t){const n=Ga(t),r=xi(e[n]);return r||xi(e[va])}function Fd(e,t){const n=Ga(t);return My(e[n])}function ev(e,t,n){const r=Ga(t);if(Jj(r))return Vl(e,r);if(n==="plan"){const o=Gu(e);return o[r]="plan",o}return Vl(e,r)}function Qj(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Yn(e){return e.flatMap(t=>t.threads)}function Xj(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}function Ry(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function Zj(e){if(e instanceof Nr&&e.status===404)return!0;const t=e instanceof Error?e.message:String(e??"");return/\b404\b|thread.*not found|conversation.*not found|no such thread|no rollout found for thread id/i.test(t)}function eL(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function tL(e,t,n){return eL(e,t??n)}function jy(e,t,n){return Math.min(Math.max(e,t),n)}function Qi(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 tv(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Qi(t.totalTokens)??0,inputTokens:Qi(t.inputTokens)??0,cachedInputTokens:Qi(t.cachedInputTokens)??0,outputTokens:Qi(t.outputTokens)??0,reasoningOutputTokens:Qi(t.reasoningOutputTokens)??0}}function nL(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=tv(t.total),r=tv(t.last);if(!n||!r)return null;const o=Qi(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?jy(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function Xi(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 Ka(e,n)?e:n}function vf(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Ka(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 rL(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 oL(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function aL(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function sL(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&aL(e.steps,t.steps)}function $u(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")||t.includes("requires a newer version of codex")}function gf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ka(e.images,t.images)&&iL(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&oL(e.commandExecution,t.commandExecution)&&sL(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function yl(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 nv(e,t,n={}){var T;const r=new Map(e.map(A=>[A.id,A])),o=new Map(t.map(A=>[A.id,A])),a=t.map(A=>{const U=r.get(A.id);return U&&gf(U,A)?U:A});if(n.preserveMissing!==!0)return yl(e,a)?e:a;const s=e.map(A=>{const U=o.get(A.id);return!U||gf(A,U)?A:U}).filter(A=>!ll(A)||!rv(A,t)),i=new Set(e.map(A=>A.id)),l=a.filter(A=>!i.has(A.id)),c=e.filter(ll);let d=[],v=l;if(c.length>0){const A=a.findIndex(U=>c.some(O=>rv(O,[U])));if(A>=0){const U=l.findIndex(O=>O.id===a[A].id);U>=0?(d=l.slice(0,U),v=l.slice(U)):(d=[],v=l)}else{const U=new Set(e.map(O=>{var $;return(($=O.turnId)==null?void 0:$.trim())??""}).filter(O=>O!==""));if(U.size>0){const O=[],$=[];for(const q of l){const R=((T=q.turnId)==null?void 0:T.trim())??"";R!==""&&U.has(R)?O.push(q):$.push(q)}d=O,v=$}}}const f=s.findIndex(ll),y=f>=0?[...s.slice(0,f),...d,...s.slice(f),...v]:[...s,...d,...v];return yl(e,y)?e:y}function iL(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 Xa(e){return e.replace(/\s+/gu," ").trim()}function ll(e){return e.messageType==="userMessage.optimistic"}function lL(e){return e.some(ll)}function rv(e,t){if(!Ws(e))return!1;const n=Xa(e.text),r=Array.isArray(e.images)?e.images:[],o=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||!Ws(s)||ll(s))return!1;const i=Xa(s.text),l=Array.isArray(s.images)?s.images:[],c=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,d=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Ka(l,r)&&c===o&&d===a})}function uL(e){const t=[];let n=new Map;for(const r of e){if(!(r.role==="assistant"&&typeof r.messageType=="string"&&(r.messageType==="agentMessage"||r.messageType==="agentMessage.live"))){Ws(r)&&(n=new Map),t.push(r);continue}const a=Xa(r.text);if(a.length===0){t.push(r);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,l]of n)l>s&&n.set(i,l-1);n.set(a,t.length),t.push(r)}else n.set(a,t.length),t.push(r)}return t}function cL(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>Xa(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Xa(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Ec(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(gf(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const sp="worked";function Fs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function dL(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,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function fL(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function pL(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 Ly(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${dL(e.durationMs)}`,messageType:sp,turnId:e.turnId,durationMs:e.durationMs}}function hL(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function mL(e,t){const n=Ly(t),r=e.filter(s=>s.messageType!==sp),o=hL(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function vL(e,t){if(!t)return e;const n=new Set;for(const o of e)o.messageType===sp&&o.turnId&&n.add(o.turnId);const r=[];for(const[o,a]of Object.entries(t))!o||n.has(o)||typeof a!="number"||!Number.isFinite(a)||a<=0||(r.push(Ly({turnId:o,durationMs:Math.round(a)})),n.add(o));return r.length===0?e:[...e,...r]}function St(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function gL(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function yL(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 wL(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 bL(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function rn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Ny(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(r=!0),s.length>0?o.push(i?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function cc(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=o.threads.map(l=>{const c=s.get(l.id);return c&&yL(c,l)?c:l});return a&&a.projectName===o.projectName&&wL(a.threads,i)?a:{projectName:o.projectName,threads:i}});return bL(e,r)?e:r}function TL(e,t,n){const r=new Set(Yn(t).map(i=>i.id)),o=Yn(e).filter(i=>n[i.id]===!0&&!r.has(i.id));if(o.length===0)return t;const a=new Map(t.map(i=>[i.projectName,i])),s=t.map(i=>({projectName:i.projectName,threads:[...i.threads]}));for(const i of o){if(a.get(i.projectName)){const c=s.findIndex(d=>d.projectName===i.projectName);c>=0&&(s[c]={projectName:s[c].projectName,threads:[i,...s[c].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function ki(e){return ro(e)}function SL(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function CL(e){const t=e.label||ro(e.remotePath),n=SL(e.hostId);return n?`${t} ${n}`:t}function Oy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Rc(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function yf(e,t){const n=Oy(e);return Rc(e).map(r=>{if(n.has(r))return r;const o=et(r).trim(),a=ki(o);return t.has(a)?o:a})}function Vu(e,t){return et(e).trim()===t||ki(e)===t}function xL(e,t){const n=new Set;for(const r of e.order)Vu(r,t)&&n.add(r);for(const r of e.active)Vu(r,t)&&n.add(r);for(const r of Object.keys(e.labels))Vu(r,t)&&n.add(r);return n}function kL(e,t,n){var c,d;const r=new Set((e.remoteProjects??[]).map(v=>v.id)),o=new Map;for(const v of e.order){const f=ki(v);o.has(f)||o.set(f,v)}for(const v of n){const f=((d=(c=v.threads[0])==null?void 0:c.cwd)==null?void 0:d.trim())??"";f&&o.set(v.projectName,f)}const a=[],s=v=>{v&&!a.includes(v)&&a.push(v)};for(const v of t){if(r.has(v)){s(v);continue}const f=o.get(v);f&&s(f)}for(const v of Rc(e))s(v);const i=a.filter(v=>e.order.includes(v));for(const v of e.order)i.includes(v)||i.push(v);const l=e.active.filter(v=>i.includes(v));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function IL(e,t,n){const r=yf(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(Tf(a)||Tf(s))return 0;const i=o.get(a.projectName)??Number.POSITIVE_INFINITY,l=o.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function wf(e,t){const n=new Map,r=new Map,o=s=>{const i=et(s).trim();if(!i)return;const l=ro(i),c=n.get(l)??new Set;c.add(i),n.set(l,c)};for(const s of(t==null?void 0:t.order)??[]){const i=et(s).trim();if(!i)continue;const l=ro(i);dc(i)||r.set(l,(r.get(l)??0)+1),o(s)}for(const s of e)for(const i of s.threads){const l=et(i.cwd).trim(),c=ro(l),d=(t==null?void 0:t.order.some(v=>et(v).trim()===l))===!0;dc(l)&&!d&&r.get(c)===1||o(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function dc(e){return e.includes("/.codex/worktrees/")}function AL(e,t){const n=wf(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const c of(t==null?void 0:t.order)??[]){const d=et(c).trim();if(!d||(s.add(d),dc(d)))continue;const v=ro(d);r.has(v)?(r.delete(v),o.add(v),a.delete(v)):o.has(v)||(r.add(v),a.set(v,d))}const i=[],l=new Map;for(const c of e)for(const d of c.threads){const v=et(d.cwd).trim(),f=ro(v),y=s.has(v),T=dc(v)&&!y&&r.has(f);let A=c.projectName;T&&n.has(f)?A=a.get(f)??c.projectName:v&&n.has(f)&&(A=v);const U=d.projectName===A?d:{...d,projectName:A},O=l.get(A);if(O)O.threads.push(U);else{const $={projectName:A,threads:[U]};l.set(A,$),i.push($)}}return i}function _L(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=Oy(t);for(const s of Rc(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const i=et(s).trim();if(!i)continue;const l=ki(i),c=n.has(l)?i:l;r.has(c)||(o.push({projectName:c,threads:[]}),r.add(c))}return o}const bf=20;function $s(e){const t=e.split(`
69
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,bf):"Untitled thread"}function PL(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Tf(e){return e.threads.some(t=>t.cwd.trim().length===0||sc(t.cwd))}const zs=new Map;let Ku=0;function Bd(e,t){const n=`${e}:${t.id}`,r=zs.get(n);return r!==void 0?r:(Ku+=1,zs.set(n,Ku),Ku)}function ML(e){const t=`${e}:`;for(const n of[...zs.keys()])n.startsWith(t)&&zs.delete(n)}function EL(){zs.clear(),Ku=0}function RL(e){if(zs.size!==0)for(const t of[...zs.keys()]){const n=t.indexOf(":"),r=n>0?t.slice(0,n):"";e.has(r)||zs.delete(t)}}function ov(e,t){const n=t.trim();if(!n)return-1;const r=e.findIndex(i=>i.id===n);if(r>=0)return r;const o=`session-cmd-${n}`,a=e.findIndex(i=>i.id===o);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(l=>l.id===n.slice(s.length));if(i>=0)return i}return-1}function jL(e,t){var a,s;if(t.length===0)return e;const n=[...e],r=[],o=new Map;for(const i of t){const l=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(l&&ov(n,l)>=0)continue;const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c))continue;const d=o.get(c)??[];d.push(i),o.set(c,d)}for(const i of[...t].reverse()){const l=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(l){const T=ov(n,l);if(T>=0){n.splice(T+1,0,i);continue}}const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c)){r.push(i);continue}let d=-1,v=-1;const f=[];for(let T=0;T<n.length;T+=1)n[T].turnIndex===c&&(v=T,Ws(n[T])?d=T:n[T].messageType!=="reasoning"&&f.push(T));if(f.some(T=>{const A=n[T].messageType;return A==="commandExecution"||A==="toolCall"||A==="fileChange"||A==="worked"})){const A=(o.get(c)??[]).indexOf(i),U=A>=0?A:0;n.splice(f[Math.min(U,f.length-1)]+1,0,i)}else if(d>=0)n.splice(d+1,0,i);else if(v>=0)n.splice(v+1,0,i);else continue}return r.length>0?[...n,...r.reverse()]:n}function LL(e,t,n){const r=new Set(n.map(s=>s.id)),o=new Map;for(const s of t)for(const i of s)r.has(i.id)||o.has(i.id)||o.set(i.id,i);const a=Array.from(o.values());for(const s of a)Bd(e,s);return a.sort((s,i)=>Bd(e,s)-Bd(e,i))}function NL(e,t,n,r,o){const a=LL(e,r,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const y=t[f];!Ws(y)||!Number.isInteger(y.turnIndex)||y.turnIndex<0||(i!==void 0&&s.set(i,f),i=y.turnIndex)}if(i!==void 0){const f=t.findIndex(ll);s.set(i,f>=0?f:t.length)}const l=new Map,c=[];for(const f of a){const y=f.turnIndex,T=Number.isInteger(y)&&y>=0?s.get(y):void 0;if(T===void 0){c.push(f);continue}const A=l.get(T);A?A.push(f):l.set(T,[f])}const d=[];for(let f=0;f<=t.length;f+=1)d.push(...l.get(f)??[]),f<t.length&&d.push(t[f]);d.push(...c);const v=uL(d);return[...jL(v,n),...o]}const $y="codex-web-local.thread-read-state.v1",av="codex-web-local.thread-unread-cutoff.v1",Dy="codex-web-local.thread-token-usage.v1",Fy="codex-web-local.thread-reasoning.v1",Sf="codex-web-local.thread-turn-durations.v1",By="codex-web-local.thread-last-plan.v1",Uy="codex-web-local.live-reasoning-snapshot.v1",zy="codex-web-local.thread-terminal-open.v1",Cf="codex-web-local.selected-thread-id.v1",xf="codex-web-local.selected-model-by-context.v1",Hy="codex-web-local.selected-model-id.v1",Wy="codex-web-local.project-order.v1",qy="codex-web-local.project-display-name.v1",kf="codex-web-local.collaboration-mode-by-context.v1",OL="codex-web-local.collaboration-mode.v1";function $L(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($y);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function sv(e){typeof window>"u"||window.localStorage.setItem($y,JSON.stringify(e))}function DL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Du(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Fy,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&BI(t,n)}}function FL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Sf);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||!o||typeof o!="object"||Array.isArray(o))continue;const a={};for(const[s,i]of Object.entries(o))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[r]=a)}return n}catch{return{}}}let Gy={};function Vy(e){const t={};for(const[n,r]of Object.entries(e))n&&Object.keys(r).length>0&&(t[n]={...r});Gy=t}function iv(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(Sf):window.localStorage.setItem(Sf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const r=Gy[t]??{};for(const[o,a]of Object.entries(n))!o||typeof a!="number"||a<=0||r[o]!==a&&zI(t,o,a)}Vy(e)}}function BL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(By);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Ky(e){if(!(typeof window>"u"))try{window.localStorage.setItem(By,JSON.stringify(e))}catch{}}function UL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uy);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 a=o;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[r]={text:a.text,ts:a.ts})}return n}catch{return{}}}function zL(){if(typeof window>"u")return"";const e=window.localStorage.getItem(av);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(av,t),t}function HL(){if(typeof window>"u")return Po();try{const n=window.localStorage.getItem(xf);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Po();const o=Po();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const i=xi(s);i&&(o[a]=i)}return o}}catch{}const e=xi(window.localStorage.getItem(Hy)),t=Po();return e&&(t[va]=e),t}function Fu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(xf):window.localStorage.setItem(xf,JSON.stringify(e)),window.localStorage.removeItem(Hy)}catch{}}function WL(){if(typeof window>"u")return Po();try{const e=window.localStorage.getItem(kf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Po();const n=Po();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=My(o);a==="plan"&&(n[r]=a)}return n}}catch{}return Po()}function Ud(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(kf):window.localStorage.setItem(kf,JSON.stringify(e)),window.localStorage.removeItem(OL)}catch{}}function qL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dy);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 a=nL(o);a&&(n[r]=a)}return n}catch{return{}}}function zd(e){typeof window>"u"||window.localStorage.setItem(Dy,JSON.stringify(e))}const If="codex-web-local.thread-model-switch-markers.v1";function GL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(If);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||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&Hj(s)).slice(0,Ay);a.length>0&&(n[r]=a)}return n}catch{return{}}}function VL(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(If):window.localStorage.setItem(If,JSON.stringify(e))}catch{}}function KL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zy);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 YL(e){typeof window>"u"||window.localStorage.setItem(zy,JSON.stringify(e))}function JL(){return typeof window>"u"?"":window.localStorage.getItem(Cf)??""}function QL(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Cf);return}window.localStorage.setItem(Cf,e)}}function XL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Wy);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=ro(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function ZL(e){typeof window>"u"||window.localStorage.setItem(Wy,JSON.stringify(e))}function eN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qy);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 a=typeof r=="string"?ro(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function tN(e){typeof window>"u"||window.localStorage.setItem(qy,JSON.stringify(e))}function nN(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function rN(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const r of e.steps){const o=r.status==="completed"?"x":r.status==="inProgress"?"~":" ";t.push(`- [${o}] ${r.step}`)}return t.join(`
70
+ `).trim()}function Ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Re(e){return typeof e=="string"?e:""}function Bs(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function lv(e){const t=Ve(e);if(!t)return null;const n=Bs(t.totalTokens??t.total_tokens),r=Bs(t.inputTokens??t.input_tokens),o=Bs(t.cachedInputTokens??t.cached_input_tokens),a=Bs(t.outputTokens??t.output_tokens),s=Bs(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||r===null||o===null||a===null||s===null?null:{totalTokens:n,inputTokens:r,cachedInputTokens:o,outputTokens:a,reasoningOutputTokens:s}}function oN(e){const t=Ve(e);if(!t)return null;const n=lv(t.total),r=lv(t.last);if(!n||!r)return null;const o=Bs(t.modelContextWindow??t.model_context_window),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?jy(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function aN(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ve(e.params),n=Fn(e),r=oN((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!r?null:{threadId:n,usage:r}}function Fn(e){const t=Ve(e.params);if(!t)return"";const n=Re(t.threadId);if(n)return n;const r=Re(t.thread_id);if(r)return r;const o=Re(t.conversationId);if(o)return o;const a=Re(t.conversation_id);if(a)return a;const s=Ve(t.thread),i=Re(s==null?void 0:s.id);if(i)return i;const l=Ve(t.turn),c=Re(l==null?void 0:l.threadId);if(c)return c;const d=Re(l==null?void 0:l.thread_id);return d||""}function sN(e){if(e.method!=="turn/completed")return"";const t=Ve(e.params),n=Ve(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const r=Ve(n.error);return Re(r==null?void 0:r.message)}function iN(e){var r;if(e.method!=="error")return null;const t=Ve(e.params),n=Re(t==null?void 0:t.message)||Re((r=Ve(t==null?void 0:t.error))==null?void 0:r.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function lN(e){const t=Fn(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ve(e.params),r=Ve(n==null?void 0:n.item),o=Re(r==null?void 0:r.type).toLowerCase();if(o==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(o==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(o==="commandexecution"){const a=Re(r==null?void 0:r.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(o==="filechange"){const s=(Array.isArray(r==null?void 0:r.changes)?r.changes:[])[0],i=Re(s==null?void 0:s.path);return{threadId:t,activity:{label:"Applying changes",details:i?[i]:[]}}}}return e.method==="item/commandExecution/outputDelta"?{threadId:t,activity:{label:"Running command",details:[]}}:e.method==="item/fileChange/outputDelta"?{threadId:t,activity:{label:"Applying changes",details:[]}}:e.method==="item/reasoning/summaryTextDelta"||e.method==="item/reasoning/summaryPartAdded"||e.method==="item/reasoning/textDelta"?{threadId:t,activity:{label:"Thinking",details:[]}}:e.method==="item/agentMessage/delta"?{threadId:t,activity:{label:"Writing response",details:[]}}:null}function uN(e){if(e.method!=="turn/started")return null;const t=Ve(e.params);if(!t)return null;const n=Fn(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Fs(Re(r==null?void 0:r.startedAt))??Fs(Re(t.startedAt))??Fs(e.atIso)??Date.now();return{threadId:n,turnId:o,startedAtMs:a}}function cN(e){if(e.method!=="turn/completed")return null;const t=Ve(e.params);if(!t)return null;const n=Fn(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Fs(Re(r==null?void 0:r.completedAt))??Fs(Re(t.completedAt))??Fs(e.atIso)??Date.now(),s=Fs(Re(r==null?void 0:r.startedAt))??Fs(Re(t.startedAt))??void 0;return{threadId:n,turnId:o,completedAtMs:a,startedAtMs:s}}function fc(e){return`${e}:live-reasoning`}function dN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":Re(n.id)}return""}function fN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:fc(n),itemId:n,delta:r}}if(e.method==="item/reasoning/textDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:fc(n),itemId:n,delta:r}}return null}function pN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Re(t.itemId);return n?fc(n):""}return""}function hN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":fc(Re(n.id))}return""}function mN(e){var n;const t=[];for(const r of["content","summary"]){const o=Array.isArray(e[r])?e[r]:[];for(const a of o){const s=typeof a=="string"?a:(n=Ve(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
71
+ `).trim()}function vN(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n||Re(n.type).toLowerCase()!=="reasoning")return null;const r=Re(n.id);return r?{itemId:r,text:mN(n)}:null}function gN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="agentMessage"?"":Re(n.id)}return""}function yN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Re(t.itemId),r=Re(t.delta);if(!n||!r)return null;const o=Re(t.turnId)||Re(t.turn_id);return{messageId:n,delta:r,turnId:o||void 0}}return null}function wN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ve(t.item);if(!n||n.type!=="agentMessage")return null;const r=Re(n.id),o=Re(n.text);if(!r||!o)return null;const a=Re(t.turnId)||Re(t.turn_id);return{id:r,role:"assistant",text:o,messageType:"agentMessage",turnId:a||void 0}}return null}function bN(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function TN(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 SN(e){if(e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n)return null;const r=Re(n.id);if(!r)return null;if(n.type==="imageView"){const s=Re(n.path);return s?{id:r,role:"assistant",text:"",images:[bN(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const o=Re(n.result),a=o?TN(o):"";return a?{id:r,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function CN(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ve(e.params);if(!t)return null;const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{itemId:n,delta:r}}const ul="__global__";function xN(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function Yy(e){const t=Ve(e);if(!t)return null;const n=t.id,r=Re(t.method),o=t.params;if(typeof n!="number"||!Number.isInteger(n)||!r)return null;const a=Ve(o),s=kN(r,a),i=Re(a==null?void 0:a.threadId)||Re(a==null?void 0:a.thread_id)||Re(a==null?void 0:a.conversationId)||Re(a==null?void 0:a.conversation_id)||ul,l=Re(a==null?void 0:a.turnId)||Re(a==null?void 0:a.turn_id),c=Re(a==null?void 0:a.itemId)||Re(a==null?void 0:a.item_id)||Re(a==null?void 0:a.callId)||Re(a==null?void 0:a.call_id),d=Re(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:c,receivedAtIso:d,params:o??null}}function kN(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||IN(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||AN(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||_N(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||MN(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||EN(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||PN(t)?"item/tool/call":n)}function IN(e){if(!e)return!1;const t=e.command;return Array.isArray(t)&&t.some(n=>typeof n=="string"&&n.trim().length>0)||typeof t=="string"&&t.trim().length>0?!0:Array.isArray(e.commandActions)}function AN(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||Ve(e.fileChanges)?!0:Ve(e.changes)!==null:!1}function _N(e){return!!(e&&Array.isArray(e.questions))}function PN(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function MN(e){if(!e)return!1;const t=Re(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function EN(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ve(e.permissions)!==null:!1}function RN(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ve(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const o of n){const a=Ve(o),s=Re(a==null?void 0:a.id).trim();s&&r.push(s)}return r}function jN(e,t){const n=t.threadId||ul,r=e.pendingServerRequestsByThreadId.value[n]??[],o=r.findIndex(s=>s.id===t.id),a=[...r];o>=0?a.splice(o,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function LN(e,t){const n={};for(const[r,o]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=o.filter(s=>s.id!==t);a.length>0&&(n[r]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=St(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function NN(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function ON(e,t){const n={},r=new Set;for(const a of t){const s=a.threadId||ul,i=n[s]??[];i.push(a),n[s]=i,r.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const o={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))r.has(Number(a))&&(o[a]=s);e.pendingReplyErrorByRequestId.value=o}function Jy(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];yl(r,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function $N(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=St(e.liveAgentMessagesByThreadId.value,t))}function DN(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[];yl(r,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function FN(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},Ky(e.lastPlanByThreadId.value))}function BN(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[],o=Ec(r,n);DN(e,t,o),FN(e,t,n)}function UN(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[],o=Ec(r,n);ip(e,t,o)}function zN(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];let o=Ec(r,n);const a=Xa(n.text);if(n.role==="assistant"&&a.length>0){const s=o.filter(i=>i.id===n.id||Xa(i.text)!==a);s.length!==o.length&&(o=s)}Jy(e,t,o)}function ip(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[];yl(r,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function HN(e,t,n){const r=e.liveCommandsByThreadId.value[t]??[],o=Ec(r,n);o!==r&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:o})}function WN(e,t,n){const r=e.liveCommandsByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(s=>s.id)),a=r.filter(s=>!o.has(s.id));a.length!==r.length&&(a.length===0?e.liveCommandsByThreadId.value=St(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function qN(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=r.filter(l=>!o.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==r.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=St(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function GN(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...o];s[a]={...s[a],fileChanges:r},ip(e,t,s)}function VN(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...o],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:r}))},ip(e,t,s)}function KN(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let r=-1;for(const o of n)typeof o.turnIndex=="number"&&Number.isFinite(o.turnIndex)&&(r=Math.max(r,o.turnIndex));return r+1}function YN(e,t,n,r){if(!t||!n||!Number.isInteger(r)||r<0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};o[n]!==r&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...o,[n]:r}})}function JN(e,t,n){const r=e.turnIndexByTurnIdByThreadId.value[t]??{},o=Object.entries(r),a=Object.entries(n);o.length===a.length&&o.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function QN(e,t,n){var o;if(!t||!n)return;const r=(o=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:o[n];return typeof r=="number"?r:void 0}function XN(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};let o=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=r[s.turnId];return typeof i!="number"?s:(o=!0,{...s,turnIndex:i})});o&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const uv=8e3,ZN=1500,eO=15*60*1e3;function tO(e){let t=UL(),n=!1,r=null;function o(){r===null&&(r=setTimeout(()=>{if(r=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(Uy,JSON.stringify(t))}catch{}n&&o()},ZN))}function a(d,v){if(!d||e.inProgressById.value[d]!==!0)return;const f=v.length>uv?v.slice(-uv):v;t[d]={text:f,ts:Date.now()},n=!0,o()}function s(d,v){if(!d)return;const f=v.trim(),y=e.liveReasoningTextByThreadId.value[d]??"";if(f.length===0){if(!y)return;e.liveReasoningTextByThreadId.value=St(e.liveReasoningTextByThreadId.value,d);return}y!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f},a(d,f))}function i(d,v){if(!d)return;const f=e.liveReasoningTextByThreadId.value[d]??"";s(d,`${f}${v}`)}function l(d){var y;if(!d||((y=e.liveReasoningTextByThreadId.value[d])==null?void 0:y.trim()))return;const f=t[d];f!=null&&f.text&&(Date.now()-f.ts>eO||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function c(d){d&&d in t&&(delete t[d],n=!0,o())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:c}}function nO(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function rO(e,t,n=!1){var l;if(!t)return;const r=e.liveReasoningTextByThreadId.value[t];if(r===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const o=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=o?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[o]:void 0,s=lO(e,t),i=o||void 0;s.length>0?aO(e,t,s,i,a):n||oO(e,t,r,i,a),e.liveReasoningTextByThreadId.value=St(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function oO(e,t,n,r,o){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(c=>c.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function aO(e,t,n,r,o){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const c=l.text.trim();if(!c)continue;const d=`reasoning:item:${t}:${l.itemId}`,v=s.findIndex(f=>f.id===d);if(v>=0){const f=s[v],y=l.anchorMessageId||f.reasoningAnchorMessageId,T=typeof o=="number"?o:f.turnIndex;if(f.text===c&&f.turnIndex===T&&f.reasoningAnchorMessageId===y)continue;s[v]={...f,text:c,reasoning:{summary:[],content:[c]},turnId:r||f.turnId,turnIndex:T,reasoningAnchorMessageId:y};continue}s.some(f=>f.text===c)||s.push({id:d,role:"system",text:c,messageType:"reasoning",reasoning:{summary:[],content:[c]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function sO(e,t,n,r){if(!t||!r)return;r.trim()&&e.reasoningItemTextByItemId.set(n,r.trim());const o=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(o.endsWith(r)||a&&r===a){e.reasoningAppendedTextByItemId.set(n,r);return}if(a&&r.startsWith(a)){const i=r.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,r);return}const s=o.length>0&&!o.endsWith(`
72
+ `)?`
73
+
74
+ `:"";e.appendLiveReasoningText(t,`${s}${r}`),e.reasoningAppendedTextByItemId.set(n,r)}function iO(e,t){const n=Ve(t.params);if(!n)return;const r=t.method==="item/started"||t.method==="item/completed",o=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!r&&!o)return;const a=Ve(n.item),s=Re(o?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Fn(t);if(!i)return;const l=o||Re(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",c=e.turnItemSequenceByThreadId.get(i)??[];c.some(d=>d.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...c,{itemId:s,kind:l}])}function lO(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],r=[];let o="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&r.push({text:i,anchorMessageId:o,itemId:s.itemId})}else o=s.itemId;return r}function uO(e,t,n){if(!t||!n)return;const r=e.reasoningItemTextByItemId.get(t)??"";r.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${r}${n}`)}function cv(e){e.reasoningItemTextByItemId.clear()}const Io="gpt-5.4-mini",Qy="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",cO="big-pickle",dO=Qg;function fO(e){const t=S([]),n=S({}),r=S({}),o=S(HL()),a=S(Dd(o.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),c=S(""),d=S(!1),v=S({});let f=!1;function y(Ce){if(Ga(Ce)===va){const xe=Ls(l.value),Me=Ou(xe),Je=Me?xi(o.value[Me]):"";if(Je)return Je}return Dd(o.value,Ce).trim()}function T(Ce){const Se=Ce.trim();return Ls(Se?v.value[Se]??l.value:l.value)}function A(Ce){const Se=Ce.trim();return!Se||Ga(Se)===va?!1:Dd(o.value,Se).trim().length>0}function U(Ce){const Se=Ce.trim();if(!Se)return!1;const xe=Ga(Se);return xe===va?!1:xi(o.value[xe]).length>0}function O(Ce){return n.value[Ce.trim()]??dO}function $(Ce,Se=s.value){const xe=Ce.trim(),Me=O(xe);if(Se&&Me.includes(Se))return Se;if(Me.includes("medium"))return"medium";const Je=r.value[xe];return Je&&Me.includes(Je)?Je:Me[0]??""}function q(Ce){s.value=$(Ce)}function R(Ce){const Se={},xe={};for(const Me of Ce)Me.supportedReasoningEfforts!==null&&(Se[Me.id]=[...Me.supportedReasoningEfforts]),Me.defaultReasoningEffort&&(xe[Me.id]=Me.defaultReasoningEffort);n.value=Se,r.value=xe}function pe(...Ce){const Se=[...t.value];for(const xe of Ce){const Me=xe.trim();Me&&!Se.includes(Me)&&Se.push(Me)}Ka(t.value,Se)||(t.value=Se)}function ce(Ce){const Se=Ce.trim();return t.value.length===0||Se&&t.value.includes(Se)?Se:t.value[0]??""}function K(Ce,Se){const xe=Se.trim(),Me=Ga(Ce),Je=Ls(l.value),Xe=Me===va?Ou(Je):"",st=Xe||Me;if(xe){const de=Gu(o.value);de[st]=xe,Xe&&delete de[Me],o.value=de}else{let de=Vl(o.value,st);Xe&&(de=Vl(de,Me)),o.value=de}Me===Ga(e.selectedThreadId.value)?(a.value=y(e.selectedThreadId.value),pe(a.value),q(a.value)):pe(xe),Fu(o.value)}function le(Ce){K(e.selectedThreadId.value,Ce)}function ye(Ce,Se){const xe=Ce.trim();if(!xe)return;const Me=Se.trim();if(Me){const Je=Gu(o.value);Je[xe]=Me,o.value=Je}else o.value=Vl(o.value,xe);pe(Me),e.selectedThreadId.value===xe&&(a.value=y(e.selectedThreadId.value),q(a.value)),Fu(o.value)}function Pe(Ce,Se){const xe=Ce.trim();if(!xe)return;const Me=Ls(Se);Me?v.value={...v.value,[xe]:Me}:v.value[xe]&&(v.value=St(v.value,xe))}function ge(Ce,Se,xe){const Me=Se.trim();if(Ls(xe)!=="opencode-zen")return Me;const Xe=y(Ce).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:Me&&!/^gpt-/i.test(Me)?Me:cO}async function ee(Ce=e.selectedThreadId.value){var xe;const Se=Ce.trim();Se?(ye(Se,Io),(xe=e.onThreadModelChanged)==null||xe.call(e,Se)):le(Io),pe(Io)}function me(Ce){Ce&&!O(a.value).includes(Ce)||(f=!0,s.value=Ce)}async function re(Ce){const Se=Ce==="fast"?"fast":"standard";if(d.value||i.value===Se)return;const xe=i.value;i.value=Se,d.value=!0,e.error.value="";try{await hI(Se)}catch(Me){i.value=xe,e.error.value=Me instanceof Error?Me.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ie(Ce,Se,xe){const Me=Ce.trim()||"default",Je=Se||"default",Xe=xe==="plan"?"Plan":"Default",st=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${Me}`,`Thinking: ${Je}`,`Speed: ${st}`]}async function De(Ce){c.value="";try{const Se=await yI(),xe=Se.model.trim(),Me=Ls(Se.providerId);l.value=Me;const Je=T(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",st=y(e.selectedThreadId.value),de=await gI({includeProviderModels:Xe||(Ce==null?void 0:Ce.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),N=de.map(_=>_.id);R(de);const oe=Ou(Je),se=oe?xi(o.value[oe]):"",je=[...N];!(Ce!=null&&Ce.providerChanged)&&Xe&&Je===Me&&xe&&!je.includes(xe)&&je.push(xe),t.value=je;const We=st&&N.includes(st);if(!st||!We||Ce!=null&&Ce.providerChanged?Ce!=null&&Ce.providerChanged&&je.length>0?se&&N.includes(se)?le(se):Je===Me&&xe&&je.includes(xe)?le(xe):le(je[0]):Je===Me&&xe&&je.includes(xe)?le(Se.model):je.length>0?le(je[0]):le(""):a.value.trim()!==st&&le(st),oe&&a.value.trim().length>0){const _=Gu(o.value);_[oe]=a.value.trim();const E=Ou(Me);E&&E!==oe&&xe&&(_[E]=xe),o.value=_,Fu(o.value)}s.value=$(a.value,f?s.value:"medium"),i.value=Se.speedMode}catch(Se){c.value=Ry(Se)?Qy:""}}function Ne(Ce){a.value=ce(y(Ce)),q(a.value)}function Le(Ce){const Se=Ey(o.value,Ce);Se!==o.value&&(o.value=Se,Ne(e.selectedThreadId.value),Fu(Se)),v.value=rn(v.value,Ce)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:c,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:ee,buildPendingTurnDetails:Ie,hasThreadModelSelection:A,hasThreadOwnModelSelection:U,pruneThreadModelState:Le,readModelIdForThread:y,refreshModelPreferences:De,resolveThreadModelForProvider:ge,setSelectedModelId:le,setSelectedModelIdForThread:K,setSelectedReasoningEffort:me,setThreadModelId:ye,setThreadModelProviderId:Pe,syncSelectedThreadModel:Ne,updateSelectedSpeedMode:re}}function pO(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(WL()),r=S(Fd(n.value,e.value));function o(c){const d=c==="plan"?"plan":"default",v=Ga(e.value);Fd(n.value,e.value)===d&&r.value===d||(r.value=d,n.value=ev(n.value,v,d),Ud(n.value))}function a(c,d){const v=d==="plan"?"plan":"default";n.value=ev(n.value,c,v),c.trim()===e.value&&(r.value=v),Ud(n.value)}function s(c){r.value=Fd(n.value,c)}function i(c){const d=Ey(n.value,c);d!==n.value&&(n.value=d,s(e.value),Ud(d))}async function l(){try{const c=await bI();t.value=c,c.some(d=>d.value===r.value)||o("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:r,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:o,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const hO=500;function mO(){const e=S(null),t=S([]),n=Y(()=>e.value);let r=null,o=null;function a(c){e.value=c}async function s(){if(o){await o;return}o=(async()=>{try{const c=await lA();a(c),t.value=c?[c]:[]}catch{}finally{o=null}})(),await o}function i(){if(typeof window>"u"){s();return}r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,s()},hO)}function l(){r===null||typeof window>"u"||(window.clearTimeout(r),r=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function vO(e){const t=S(XL()),n=S(eN());let r=null;function o(f,y={}){t.value=f,y.persist!==!1&&ZL(f)}function a(f,y={}){n.value=f,y.persist!==!1&&tN(f)}async function s(f,y){try{const T=await Zi(),A={...T.labels};let U=!1;for(const O of T.order){if(!Vu(O,f))continue;const $=y.trim();$.length===0?A[O]!==void 0&&(delete A[O],U=!0):A[O]!==$&&(A[O]=$,U=!0)}U&&await Ed({order:T.order,labels:A,active:T.active,projectOrder:T.projectOrder})}catch{}}function i(f,y){f.length===0||(n.value[f]??"")===y||(a({...n.value,[f]:y}),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s(f,y)},500))}async function l(){try{const f=await Zi(),y=kL(f,t.value,e.sourceGroups.value);await Ed({order:y.order,labels:f.labels,active:y.active,projectOrder:y.projectOrder})}catch{}}async function c(f){var O;if(f.length===0)return;const y=t.value.filter($=>$!==f);if(Ka(t.value,y)||o(y),e.sourceGroups.value=e.sourceGroups.value.filter($=>$.projectName!==f),n.value[f]!==void 0){const $={...n.value};delete $[f],a($)}e.applyThreadFlags();const T=Yn(e.projectGroups.value);e.pruneThreadScopedState(T),T.some($=>$.id===e.selectedThreadId.value)||e.setSelectedThreadId(((O=T[0])==null?void 0:O.id)??"");const U=new Set;try{const $=await Zi();xL($,f).forEach(q=>{U.add(q)})}catch{}if(U.size>0)try{const $=await Zi(),q=$.order.filter(ce=>!U.has(ce)),R=$.active.filter(ce=>!U.has(ce)),pe=R.length===0&&q.length>0?[q[0]]:R;await Ed({order:q,labels:gL($.labels,U),active:pe,projectOrder:$.projectOrder.filter(ce=>ce!==f&&!U.has(ce))});return}catch{}await l()}function d(f,y){if(f.length===0||e.sourceGroups.value.length===0)return;const T=e.sourceGroups.value.map(q=>q.projectName),A=T.indexOf(f);if(A===-1)return;const U=Math.max(0,Math.min(y,T.length-1)),O=rL(T,A,U);if(O===T)return;o(Xi(O,e.sourceGroups.value));const $=vf(e.sourceGroups.value,t.value);e.sourceGroups.value=cc(e.sourceGroups.value,$),e.applyThreadFlags(),l()}function v(f){const y=f.trim();if(!y)return;const T=[y,...t.value.filter(U=>U!==y)];if(Ka(t.value,T))return;o(T);const A=vf(e.sourceGroups.value,t.value);e.sourceGroups.value=cc(e.sourceGroups.value,A),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:c,renameProject:i,reorderProject:d,setProjectDisplayNames:a,setProjectOrder:o}}const gO=2e3;function yO(e){const t=S([]),n=S([]),r=S(!1);let o=null,a=null,s=!1,i=!1,l=0,c="";async function d(f={}){const y=e.getSelectedCwd().trim(),T=y||"__global__";if(o){await o;return}f.force!==!0&&s&&c===T&&Date.now()-l<gO||(o=(async()=>{try{t.value=await YI(y?[y]:void 0),s=!0,l=Date.now(),c=T}catch{}finally{o=null}})(),await o)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(r.value=!0,a=(async()=>{try{n.value=await CI(),i=!0}catch{}finally{r.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:r,refreshHooks:v,refreshSkills:d}}const Xy="codex-web-local.stashed-messages.v1",Zy="codex-web-local.auto-compact-threshold.v1",Bu=10,wO=650;function bO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Xy);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||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[r]=a)}return n}catch{return{}}}function TO(){if(typeof window>"u")return Bu;try{const e=window.localStorage.getItem(Zy);if(e===null)return Bu;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Bu}catch{return Bu}}function SO(e){const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();!o||r.length===0||(t[o]=r.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function CO(e){const t=S({}),n=S({}),r=S(bO()),o=S(TO());let a=!1;const s=Y(()=>{const K=e.value;if(!K)return[];const le=t.value[K]??[];return[...(r.value[K]??[]).map(ge=>({...ge,awaitingCompaction:!0})),...le]});function i(){typeof window>"u"||window.localStorage.setItem(Xy,JSON.stringify(r.value))}function l(){LI(SO(t.value)).catch(()=>{})}async function c(){if(!a){a=!0;try{t.value=await km()}catch{}}}async function d(K){if(n.value[K]!==!0){n.value={...n.value,[K]:!0};try{t.value=await km()}catch{}finally{n.value=St(n.value,K)}}}function v(K){d(K),!(typeof window>"u")&&window.setTimeout(()=>{d(K)},wO)}function f(K){const le=Number.isFinite(K)&&K>0?Math.round(K):0;le!==o.value&&(o.value=le,!(typeof window>"u")&&window.localStorage.setItem(Zy,String(le)))}function y(K){return r.value[K]??[]}function T(K,le){r.value={...r.value,[K]:[...y(K),le]},i()}function A(K){const le=[...y(K)];return le.length===0||(r.value=St(r.value,K),i()),le}function U(K,le,ye){const ge=[...t.value[K]??[]],ee=typeof ye=="number"?Math.max(0,Math.min(ye,ge.length)):ge.length;ge.splice(ee,0,le),t.value={...t.value,[K]:ge},l()}function O(K,le){return y(K).find(ye=>ye.id===le)}function $(K,le){var ye;return(ye=t.value[K])==null?void 0:ye.find(Pe=>Pe.id===le)}function q(K){const le=e.value;if(!le)return;if(O(le,K)){const ge=y(le).filter(ee=>ee.id!==K);r.value=ge.length>0?{...r.value,[le]:ge}:St(r.value,le),i();return}const ye=t.value[le];if(!ye)return;const Pe=ye.filter(ge=>ge.id!==K);t.value=Pe.length>0?{...t.value,[le]:Pe}:St(t.value,le),l()}function R(K,le){const ye=e.value;if(!ye)return;const Pe=t.value[ye];if(!Pe||O(ye,K)||O(ye,le))return;const ge=Pe.findIndex(Ie=>Ie.id===K),ee=Pe.findIndex(Ie=>Ie.id===le);if(ge<0||ee<0||ge===ee)return;const me=[...Pe],[re]=me.splice(ge,1);me.splice(ee,0,re),t.value={...t.value,[ye]:me},l()}function pe(K){const le=rn(t.value,K);le!==t.value&&(t.value=le,l())}function ce(){t.value={},n.value={},r.value={},i(),l()}return{appendStashedMessage:T,autoCompactThreshold:o,clearQueueState:ce,enqueueQueuedMessage:U,findQueuedMessage:$,findStashedMessage:O,getStashedMessages:y,loadPersistedQueueStateIfNeeded:c,processQueuedMessages:d,pruneQueueState:pe,removeQueuedMessage:q,reorderQueuedMessage:R,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:A}}const xO=1e4,kO=2e3;function IO(e){const{selectedThreadId:t,projectGroups:n,inProgressById:r,applyThreadGroups:o,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:c}=e,d=S(!1),v=S(!1),f=S(!1);let y=null,T=0,A=null,U=null,O=!1,$=!1,q=[],R=null;function pe(me,re){if(me.length===0)return re;if(re.length===0)return me;const Ie=new Map;for(const Ne of Yn(me))Ie.set(Ne.id,Ne);for(const Ne of Yn(re))Ie.set(Ne.id,Ne);const De=new Map;for(const Ne of Ie.values()){const Le=De.get(Ne.projectName);Le?Le.push(Ne):De.set(Ne.projectName,[Ne])}return Array.from(De.entries()).map(([Ne,Le])=>({projectName:Ne,threads:Le.sort((Ce,Se)=>new Date(Se.updatedAtIso).getTime()-new Date(Ce.updatedAtIso).getTime())})).sort((Ne,Le)=>{var xe,Me;const Ce=new Date(((xe=Ne.threads[0])==null?void 0:xe.updatedAtIso)??0).getTime();return new Date(((Me=Le.threads[0])==null?void 0:Me.updatedAtIso)??0).getTime()-Ce})}function ce(){return Object.values(r.value).some(me=>me===!0)}function K(me=R){if(!(!A||O||ce())){if(R=me,typeof window>"u"){le(me);return}U!==null&&window.clearTimeout(U),U=window.setTimeout(()=>{U=null,!(!A||ce())&&le(R)},xO)}}async function le(me){if(!(O||!A||ce())){O=!0;try{const re=await pm(A,MI());A=re.nextCursor,$=re.nextCursor===null,f.value=$,q=pe(q,re.groups),o(q,me)}catch{}finally{O=!1,A&&!ce()&&K(me)}}}async function ye(me={}){if(y){await y;return}me.force!==!0&&d.value&&Date.now()-T<kO||(y=(async()=>{var re;d.value||(v.value=!0);try{const[Ie,De]=await Promise.all([pm(),i(),s({force:me.force===!0})]);R=De;const Ne=Ie.groups;q=Ne,A=Ie.nextCursor,$=Ie.nextCursor===null,f.value=$,await a(Ne,De),o(q,De),d.value=!0,T=Date.now(),$||K(De);const Le=Yn(n.value);l(Le),!Le.some(Se=>Se.id===t.value)&&!t.value&&c(((re=Le[0])==null?void 0:re.id)??"")}finally{v.value=!1}})().finally(()=>{y=null}),await y)}function Pe(me){q=Ny(q,me)}function ge(){return A!==null}function ee(){U!==null&&typeof window<"u"&&(window.clearTimeout(U),U=null)}return{dispose:ee,hasActiveInProgressThreads:ce,hasLoadedThreads:d,hasRemainingThreadPages:ge,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:ye,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:K}}const dv=2e3;function AO(e){const t=S({}),n=S({}),r=S({}),o=S({}),a=S(!1),s=5e3,i=S(null);let l=0,c=null;function d(){l&&(clearTimeout(l),l=0),c=null,i.value=null}function v(R){d(),c=R,l=window.setTimeout(()=>{l=0,i.value=c},s)}const f=new Map,y=new Map,T=new Map;let A=0;async function U(R,pe={}){var ge;if(!R)return;const ce=Date.now()-(T.get(R)??0)<dv;if((ge=e.turnErrorByThreadId.value[R])!=null&&ge.transient&&(pe.silent===!0||ce))return;const K=f.get(R);if(K&&pe.force!==!0){await K;return}const le=n.value[R]===!0,ye=pe.silent!==!0&&!le;ye&&(A+=1,a.value=!0),v(R);const Pe=(async()=>{try{const ee=e.currentThreadVersion(R),me=t.value[R]??"",re=Date.now()-(y.get(R)??0)<dv;if(pe.force===!0?!1:le&&(re||(ee.length===0||me===ee)&&e.inProgressById.value[R]!==!0)){e.markThreadAsRead(R);return}const Ne=e.resumedThreadById.value[R]!==!0?await df(R):null,Le=Ne??await cf(R);Le.modelProvider&&e.setThreadModelProviderId(R,Le.modelProvider),Le.model&&!e.hasThreadOwnModelSelection(R)&&e.setThreadModelId(R,e.resolveThreadModelForProvider(R,Le.model,Le.modelProvider)),Ne&&(e.resumedThreadById.value={...e.resumedThreadById.value,[R]:!0});const{messages:Ce,inProgress:Se,activeTurnId:xe,turnIndexByTurnId:Me}=Le,Je=e.persistedMessagesByThreadId.value[R]??[],Xe=Ce.length===0&&Je.length>0;Xe&&console.warn(`[thread-load] ${R}: server returned 0 messages while ${Je.length} are persisted locally; keeping local history`),r.value={...r.value,[R]:Le.hasMoreOlder===!0},e.markThreadMessagesPersisted(R,Ce),Xe||e.replaceTurnIndexLookupForThread(R,Me),e.rebindLiveFileChangeTurnIndices(R);const st=nv(Je,Ce,{preserveMissing:pe.silent===!0||lL(Je)||Xe});e.setPersistedMessagesForThread(R,st);const de=e.liveAgentMessagesByThreadId.value[R]??[];if(Se){const N=cL(de,Ce);e.setLiveAgentMessagesForThread(R,N)}else e.clearLiveAgentMessagesForThread(R);e.removeLiveCommandsPersistedIn(R,Ce),e.removeLiveFileChangesPersistedIn(R,Ce),n.value={...n.value,[R]:!0},y.set(R,Date.now()),T.delete(R),ee&&(t.value={...t.value,[R]:ee}),e.setThreadInProgress(R,Se),Le.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[R]:Le.externalSession}),e.clearTransientTurnErrorForThread(R),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[R]:xe}:e.activeTurnIdByThreadId.value[R]&&(e.activeTurnIdByThreadId.value=St(e.activeTurnIdByThreadId.value,R)),Se||e.clearCompletedTurnLiveState(R),e.markThreadAsRead(R)}catch(ee){const me=ee instanceof Error?ee.message:"Unknown application error";throw e.selectedThreadId.value===R&&e.setTurnErrorForThread(R,me,{transient:!0}),T.set(R,Date.now()),ee}finally{ye&&(A=Math.max(0,A-1),A===0&&(a.value=!1))}})().finally(()=>{c===R&&d(),f.delete(R)});f.set(R,Pe),await Pe}async function O(R=e.selectedThreadId.value){if(!R||o.value[R]===!0||r.value[R]!==!0)return;const pe=e.getFirstPersistedTurnId(R);if(!pe){r.value={...r.value,[R]:!1};return}o.value={...o.value,[R]:!0};try{const ce=await nI(R,pe),K=e.persistedMessagesByThreadId.value[R]??[],le=nv(ce.messages,K,{preserveMissing:!0});e.setPersistedMessagesForThread(R,le),e.replaceTurnIndexLookupForThread(R,{...e.turnIndexByTurnIdByThreadId.value[R]??{},...ce.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(R),r.value={...r.value,[R]:ce.hasMoreOlder}}catch(ce){throw ce instanceof Nr&&ce.code==="older_turns_unavailable"&&(r.value={...r.value,[R]:!1}),e.error.value=ce instanceof Error?ce.message:"Failed to load earlier messages",ce}finally{o.value={...o.value,[R]:!1}}}async function $(R,pe={}){var ce;R&&n.value[R]!==!0&&(pe.silent===!0&&((ce=e.turnErrorByThreadId.value[R])!=null&&ce.transient)||await U(R,pe))}function q(R){n.value=rn(n.value,R),t.value=rn(t.value,R)}return{ensureThreadMessagesLoaded:$,hasMoreOlderMessagesByThreadId:r,isLoadingMessages:a,loadMessages:U,loadOlderMessages:O,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:o,pruneMessageHistoryState:q,slowOpenThreadId:i}}function _O(e){const t=S({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(c=>({...c,title:$s(c.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(c=>{const d=i[c.id];return{...c,title:$s(d??c.title)}})}))}async function r(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await DI();if(Object.keys(i.titles).length>0){const l={};for(const[c,d]of Object.entries(i.titles))l[c]=$s(d);t.value=l}}catch{}}function o(s,i,l){const c=s.trim();if(c)return $s(c);const d=l.map(v=>v.label.trim()).find(v=>v.length>0);return d?$s(d):i.length>0?$s("[Image]"):"Untitled thread"}async function a(s,i,l,c=[],d=[]){if(t.value[s])return;const v=i.trim();if(!v){const y=o(i,c,d);t.value={...t.value,[s]:y},e.applyThreadFlags(),ic(s,y);return}const f=v.length>300?v.slice(0,300):v;try{const y=await VI(f,l);if(!y||t.value[s])return;const T=y.length>bf?y.slice(0,bf):y;t.value={...t.value,[s]:T},e.applyThreadFlags(),ic(s,T)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:r,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:o,threadTitleById:t}}function PO(e){const t=S({}),n=S({});function r(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function o(T){jN(r(),T)}function a(T){LN(r(),T)}function s(T){ON(r(),T)}function i(T){return NN(r(),T)}const l=Y(()=>{const T=[],A=e.getSelectedThreadId();return A&&Array.isArray(t.value[A])&&T.push(...t.value[A]),Array.isArray(t.value[ul])&&T.push(...t.value[ul]),T.sort((U,O)=>U.receivedAtIso.localeCompare(O.receivedAtIso))});function c(T){return T?Array.isArray(t.value[T])?t.value[T]:[]:[]}function d(T){return T.some(A=>xN(A.method))?"approval":T.length>0?"response":null}function v(T){const A={};for(const[U,O]of Object.entries(t.value))(U===ul||T.has(U))&&(A[U]=O);t.value=A}async function f(){try{const A=(await xm()).map(U=>Yy(U)).filter(U=>U!==null);s(A)}catch{}}async function y(T){try{const A=await xm();for(const U of A){const O=Ve(U);if((O==null?void 0:O.id)===T)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:c,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:y,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:v,readPendingRequestState:d,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:o}}const Uu=220,MO=3e3,EO=1500,RO=new Set(["account/login/completed","account/updated","authStatusChange","command/exec/outputDelta","configWarning","deprecationNotice","externalAgentConfig/import/completed","externalAgentConfig/import/progress","fs/changed","guardianWarning","item/autoApprovalReview/completed","item/autoApprovalReview/started","item/mcpToolCall/progress","loginChatGptComplete","model/rerouted","model/safetyBuffering/updated","model/verification","process/exited","process/outputDelta","sessionConfigured","thread/environment/connected","thread/environment/disconnected","thread/goal/cleared","thread/goal/updated","thread/realtime/closed","thread/realtime/error","thread/realtime/itemAdded","thread/realtime/outputAudio/delta","thread/realtime/sdp","thread/realtime/started","thread/realtime/transcript/delta","thread/realtime/transcript/done","thread/settings/updated","thread/started","turn/moderationMetadata","warning","windows/worldWritableWarning","windowsSandbox/setupCompleted"]);function jO(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),r=new Map,o=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=r.get(i)??[];l.push(s),r.set(i,l)}else o.push(s)}const a=[];for(const s of e){a.push(s);const i=r.get(s.id);i&&i.length>0&&a.push(...i)}return o.length>0&&a.push(...o),a}function LO(){const e=S([]),t=S([]),n=S(JL()),r=S(""),o=S({}),a=S({}),s=S(BL()),i=S({}),l=S({}),c=S(DL()),d=S(FL()),v=S({}),f=new Map,y=new Map,T=new Map,A=new Map,U=S({}),O=S({}),$=S({}),R=tO({liveReasoningTextByThreadId:v,inProgressById:$}),pe=S({});let ce=!1;const K=S({}),{activeProviderId:le,availableModelIds:ye,availableModelReasoningEfforts:Pe,codexCliMissingError:ge,isUpdatingSpeedMode:ee,selectedModelId:me,selectedReasoningEffort:re,selectedSpeedMode:Ie,applyFallbackModelSelection:De,buildPendingTurnDetails:Ne,hasThreadModelSelection:Le,hasThreadOwnModelSelection:Ce,pruneThreadModelState:Se,readModelIdForThread:xe,refreshModelPreferences:Me,resolveThreadModelForProvider:Je,setSelectedModelId:Xe,setSelectedModelIdForThread:st,setSelectedReasoningEffort:de,setThreadModelId:N,setThreadModelProviderId:oe,syncSelectedThreadModel:se,updateSelectedSpeedMode:je}=fO({selectedThreadId:n,error:r,onThreadModelChanged:h=>_a(h)}),{availableCollaborationModes:We,selectedCollaborationMode:_,pruneThreadCollaborationState:E,refreshCollaborationModes:z,setSelectedCollaborationMode:ue,setSelectedCollaborationModeForThread:ne,syncSelectedThreadCollaborationMode:ae}=pO(n),_e=S($L()),Oe=S(zL()),{projectDisplayNameById:ke,projectOrder:he,pinProjectToTop:Ke,removeProject:$e,renameProject:qe,reorderProject:Ge,setProjectDisplayNames:ct,setProjectOrder:bt}=vO({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:pn,pruneThreadScopedState:vo,setSelectedThreadId:Pn}),nt=S({}),it=S({}),J=S({}),fe=S({}),Te=S({}),Be=S({}),Tt=AO({selectedThreadId:n,error:r,persistedMessagesByThreadId:o,liveAgentMessagesByThreadId:i,inProgressById:$,externalSessionByThreadId:pe,resumedThreadById:nt,turnIndexByTurnIdByThreadId:it,turnErrorByThreadId:Te,activeTurnIdByThreadId:Be,markThreadAsRead:ls,markThreadMessagesPersisted:Pi,replaceTurnIndexLookupForThread:C,rebindLiveFileChangeTurnIndices:x,setPersistedMessagesForThread:Ln,setLiveAgentMessagesForThread:go,clearLiveAgentMessagesForThread:Pa,removeLiveCommandsPersistedIn:Ma,removeLiveFileChangesPersistedIn:ra,setThreadInProgress:hn,setThreadModelProviderId:oe,setThreadModelId:N,resolveThreadModelForProvider:Je,hasThreadOwnModelSelection:Ce,clearTransientTurnErrorForThread:ds,clearCompletedTurnLiveState:Ri,setTurnErrorForThread:Lt,getFirstPersistedTurnId:Ys,currentThreadVersion:qn}),{ensureThreadMessagesLoaded:yt,hasMoreOlderMessagesByThreadId:Dt,isLoadingMessages:No,loadMessages:Gt,loadOlderMessages:io,loadedMessagesByThreadId:Zn,loadedVersionByThreadId:wa,loadingOlderMessagesByThreadId:lo,pruneMessageHistoryState:Vs,slowOpenThreadId:ba}=Tt,es=_O({applyThreadFlags:pn}),{threadTitleById:Or,applyCachedTitlesToGroups:ts,loadThreadTitleCacheIfNeeded:$r,requestThreadTitleGeneration:Oo}=es,$o=PO({applyThreadFlags:pn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Ks,loadPendingServerRequestsFromBridge:Do,pendingReplyErrorByRequestId:Dr,pendingReplyErrorForRequest:ns,pendingRequestStillExistsOnServer:Ta,pendingServerRequestsByThreadId:Fo,prunePendingServerRequestsByActiveThreads:uo,readPendingRequestState:co,removePendingServerRequestById:Tr,selectedThreadServerRequests:rs,upsertPendingServerRequest:os}=$o,vt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:c,turnIndexByTurnIdByThreadId:it,activeTurnIdByThreadId:Be,activeReasoningTurnIdByThreadId:A,reasoningItemTextByItemId:y,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:T,appendLiveReasoningText:(h,g)=>R.appendLiveReasoningText(h,g),clearLiveReasoningSnapshot:h=>R.clearLiveReasoningSnapshot(h),savePersistedReasoningMap:Du},xt=S({}),kt=S({}),dn=S({}),Hn=S({}),un=S({}),{accountRateLimitSnapshots:Sr,codexQuota:dr,refreshRateLimits:Bo,scheduleRateLimitRefresh:cn,setCodexRateLimit:er,stopRateLimitRefresh:Cr}=mO(),Et=S(qL()),fo=S(KL()),tr=S(GL()),wn=S({}),Fr=S(!1),jn=S(!1),An=S(!1),bn=S(new Set),Sa=6e4,fr=S([]);let Br="";const Bt=S(!1);function po(h){var g;try{const I=new URL(h,"http://localhost");return I.pathname!=="/codex-local-image"?"":((g=I.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function Uo(h){const g=h.trim().toLowerCase();return g?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(g):!1}function zo(h){var I;const g=o.value[h]??[];for(let j=g.length-1;j>=0;j-=1){const H=g[j];if(!(H.role!=="user"||!Array.isArray(H.images)||H.images.length===0))for(let Q=H.images.length-1;Q>=0;Q-=1){const W=((I=H.images[Q])==null?void 0:I.trim())??"";if(W&&po(W))return W}}return""}let Tn=null,Jt=null;const pr=new Map;let an=!1,Ho=!1;const Zt=new Set,Ur=new Set;let Ca=!1,Vt=!1;const Wo=new Map,qo=new Set,It=IO({selectedThreadId:n,projectGroups:e,inProgressById:$,applyThreadGroups:ei,hydrateWorkspaceRootsStateIfNeeded:aa,loadThreadTitleCacheIfNeeded:$r,loadWorkspaceRootsStateForThreadList:Nn,pruneThreadScopedState:vo,setSelectedThreadId:Pn}),Sn=Y(()=>Yn(e.value)),Go=Y(()=>Sn.value.find(h=>h.id===n.value)??null),{appendStashedMessage:xr,autoCompactThreshold:kr,clearQueueState:Vo,enqueueQueuedMessage:zr,findQueuedMessage:Ko,findStashedMessage:nr,getStashedMessages:ho,loadPersistedQueueStateIfNeeded:Yo,pruneQueueState:Ir,removeQueuedMessage:ht,reorderQueuedMessage:_n,scheduleQueueStateRefresh:Cn,selectedThreadQueuedMessages:xa,setAutoCompactThreshold:Wn,takeStashedMessages:k}=CO(n),{hooksList:L,installedSkills:V,isHooksLoading:be,refreshHooks:ze,refreshSkills:jt}=yO({getSelectedCwd:()=>{var h;return((h=Go.value)==null?void 0:h.cwd)??""}}),At=Y(()=>{const h=n.value;return!!(h&&fo.value[h]===!0)}),en=Y(()=>{const h=n.value;return h?xt.value[h]===!0:!1}),Kt=Y(()=>{const h=n.value;return h?Be.value[h]??"":""}),Hr=Y(()=>{var G;const h=n.value;if(!h)return null;const g=$.value[h]===!0,I=g?fe.value[h]:void 0,j=g?(v.value[h]??"").trim():"",H=(((G=Te.value[h])==null?void 0:G.message)??"").trim();let Q="";if(!g&&H){const ie=o.value[h]??[];for(let Ae=ie.length-1;Ae>=0;Ae-=1){const He=ie[Ae];if(He.messageType==="turnError"){Q=Xa(He.text);break}}}const W=!g&&H&&Q===H?"":H;return!g&&!I&&!j&&!W?null:{activityLabel:(I==null?void 0:I.label)||"Thinking",activityDetails:(I==null?void 0:I.details)??[],reasoningText:j,errorText:W}}),ka=Y(()=>{const h=n.value;return h?Et.value[h]??null:null}),as=Y(()=>{const h=n.value;if(!h)return[];const g=o.value[h]??[],I=a.value[h]??[],j=i.value[h]??[],H=U.value[h]??[],Q=O.value[h]??[],W=l.value[h]??[],G=c.value[h]??[],ie=g.some(On=>On.messageType==="compaction.done"),Ae=bn.value.has(h),He=ie&&!Ae?W.filter(On=>On.messageType!=="compaction.pending"&&On.messageType!=="compaction.done"):W,Ze=NL(h,g,G,[I,H,Q,j],He),mt=J.value[h],wt=mt?mL(Ze,mt):Ze,pt=vL(wt,d.value[h]),_t=tr.value[h]??[];return jO(pt,_t)}),fn=Y(()=>{const h=n.value;return h?Hn.value[h]??null:null}),Ia=Y(()=>{const h=n.value;return h?Dt.value[h]===!0:!1}),Aa=Y(()=>{const h=n.value;return h?lo.value[h]===!0:!1});function Ys(h){var I;const g=o.value[h]??[];for(const j of g){const H=((I=j.turnId)==null?void 0:I.trim())??"";if(H)return H}return""}function Pn(h,g={}){n.value!==h&&(n.value=h,g.persist!==!1&&QL(h),se(h),ae(h),Vt=!1)}function ss(h,g){const I=h.trim();if(!I)return;if(!g){if(!(I in Et.value))return;Et.value=St(Et.value,I),zd(Et.value);return}const j=Et.value[I];if(j&&JSON.stringify(j)===JSON.stringify(g))return;Et.value={...Et.value,[I]:g},zd(Et.value);const H=ho(I);H&&H.length>0&&kr.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=kr.value?bn.value.has(I)||la(I):wo(I))}function Js(h,g){un.value={...un.value,[h]:g}}function is(h,g,I){var mt;const j=h.trim(),H=g.trim(),Q=I.trim();if(!j||!Q||H===Q)return;const W=tr.value[j]??[],G=o.value[j]??[],ie=G.length,Ae=wn.value[j],He=W.length>0&&Ae!==void 0&&Ae===ie;let Ze;if(He){const wt=W[W.length-1];Ze=[...W.slice(0,-1),{...wt,modelSwitchFrom:H||void 0,modelSwitchTo:Q}]}else{const wt=(mt=G[G.length-1])==null?void 0:mt.id,pt={id:`model-switch:${j}:${Date.now()}:${W.length}`,role:"system",text:"",messageType:Iy,modelSwitchFrom:H||void 0,modelSwitchTo:Q,...wt?{modelSwitchInsertAfterId:wt}:{}};Ze=[...W,pt].slice(-Ay)}tr.value={...tr.value,[j]:Ze},wn.value={...wn.value,[j]:ie},VL(tr.value)}function _a(h){const g=h.trim(),I=Et.value[g];I&&I.modelContextWindow!==null&&(Et.value={...Et.value,[g]:{...I,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},zd(Et.value))}function Jo(h){un.value[h]&&(un.value=St(un.value,h))}async function tn(h){var I,j;if(qo.has(h))return;const g=un.value[h];if(!(!g||g.fallbackRetried)){qo.add(h),Js(h,{...g,fallbackRetried:!0});try{await De(h);try{const H=((j=(I=(o.value[h]??[]).reduce((Q,W)=>{const G=typeof W.turnIndex=="number"?W.turnIndex:-1,ie=Q!==null&&typeof Q.turnIndex=="number"?Q.turnIndex:-1;return G>=0&&G>ie?W:Q},null))==null?void 0:I.turnId)==null?void 0:j.trim())??"";if(H){const Q=await _d(h,H);Ln(h,Q),ta(h),go(h,[]),Yr(h),U.value[h]&&(U.value=St(U.value,h))}}catch{}if(Lt(h,null),r.value="",sn(h,null),Pt(h,{label:"Thinking",details:Ne(Io,g.effort,g.collaborationMode)}),hn(h,!0),nt.value[h]!==!0){const H=await df(h);H.model&&N(h,Je(h,H.model,H.modelProvider)),H.modelProvider&&oe(h,H.modelProvider),nt.value={...nt.value,[h]:!0}}await Pd(h,g.text,g.imageUrls,Io,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),cn(),Zt.add(h),await vn()}catch(H){const Q=H instanceof Error?H.message:"Unknown application error";Lt(h,Q),r.value=Q,hn(h,!1),Pt(h,null)}finally{qo.delete(h)}}}function Qo(h){if(!h||typeof window>"u")return;const g=pr.get(h);g!==void 0&&(window.clearTimeout(g),pr.delete(h))}function Wr(h){if(!h||typeof window>"u")return;Qo(h);const g=window.setTimeout(()=>{pr.delete(h),Zt.add(h),vn()},MO);pr.set(h,g)}function pn(){const g=ts(t.value).map(I=>({projectName:I.projectName,threads:I.threads.map(j=>{const H=pe.value[j.id]??j.externalSession??null,Q=$.value[j.id]===!0||(H==null?void 0:H.active)===!0,W=co(Ks(j.id)),G=n.value===j.id,ie=K.value[j.id]===!0,Ae=tL(j.updatedAtIso,_e.value[j.id],Oe.value);return{...j,inProgress:Q,unread:!G&&!Q&&(ie||Ae),pendingRequestState:W,...H?{externalSession:H}:{}}})}));e.value=cc(e.value,g)}function mo(h,g,I){const j=new Date().toISOString(),H=et(g),Q=ro(H),W={id:h,title:$s(I),projectName:Q,cwd:H,hasWorktree:H.includes("/.codex/worktrees/")||H.includes("/.git/worktrees/"),createdAtIso:j,updatedAtIso:j,preview:I,unread:!1,inProgress:!1},G=t.value.findIndex(Ae=>Ae.projectName===Q);if(G>=0){const He=t.value[G].threads.filter(wt=>wt.id!==h),Ze={projectName:Q,threads:[W,...He]},mt=[...t.value];mt.splice(G,1,Ze),t.value=mt}else t.value=[{projectName:Q,threads:[W]},...t.value];const ie=Xi(he.value,t.value);Ka(he.value,ie)||bt(ie),pn()}function vo(h){const g=new Set(h.map(H=>H.id)),I=n.value.trim();I&&g.add(I),Se(g),E(g);const j=rn(_e.value,g);if(j!==_e.value&&(_e.value=j,sv(j)),Vs(g),nt.value=rn(nt.value,g),it.value=rn(it.value,g),o.value=rn(o.value,g),i.value=rn(i.value,g),v.value=rn(v.value,g),U.value=rn(U.value,g),O.value=rn(O.value,g),J.value=rn(J.value,g),fe.value=rn(fe.value,g),Te.value=rn(Te.value,g),Be.value=rn(Be.value,g),A.size>0)for(const H of[...A.keys()])g.has(H)||A.delete(H);RL(g),xt.value=rn(xt.value,g),kt.value=rn(kt.value,g),dn.value=rn(dn.value,g),Ir(g),Et.value=rn(Et.value,g),K.value=rn(K.value,g),$.value=rn($.value,g),uo(g)}function ls(h){const g=Yn(t.value).find(I=>I.id===h);g&&(_e.value={..._e.value,[h]:g.updatedAtIso},sv(_e.value),K.value[h]&&(K.value=St(K.value,h)),pn())}function sn(h,g){if(!h)return;const I=J.value[h];if(g){if(fL(I,g))return;J.value={...J.value,[h]:g}}else I&&(J.value=St(J.value,h))}function _i(h,g,I){if(!h||!g)return;const j={...d.value[h]??{}},H=Number.isFinite(I)?Math.max(0,Math.round(I)):0;H<=0?delete j[g]:j[g]=H,Object.keys(j).length===0?d.value=St(d.value,h):d.value={...d.value,[h]:j},iv(d.value)}function hn(h,g,I={}){!h||$.value[h]===!0===g||(g?($.value={...$.value,[h]:!0},Ei(h)):($.value=St($.value,h),Ri(h,{keepLiveCommands:I.keepDeferredLiveCommands===!0}),Qs(h),bs(h)?la(h):wo(h)),pn(),!g&&!It.hasActiveInProgressThreads()&&It.hasRemainingThreadPages()&&It.scheduleRemainingThreadPages())}function Qs(h){h&&(xt.value[h]&&(xt.value=St(xt.value,h)),kt.value[h]&&(kt.value=St(kt.value,h)),dn.value[h]&&(dn.value=St(dn.value,h)))}function rr(h){h&&(xt.value={...xt.value,[h]:!0},kt.value[h]&&(kt.value=St(kt.value,h)),dn.value[h]&&(dn.value=St(dn.value,h)))}function us(h){h&&xt.value[h]===!0&&kt.value[h]===!0&&dn.value[h]===!0&&Qs(h)}function cs(h,g){!h||!g||xt.value[h]===!0&&Qs(h)}function bl(h){const g=Object.keys(xt.value);if(g.length===0)return;let I=kt.value,j=!1;for(const H of g)!h.has(H)||I[H]===!0||(I={...I,[H]:!0},j=!0);if(j){kt.value=I;for(const H of g)us(H)}}function Pi(h,g){h&&xt.value[h]===!0&&g.some(I=>I.role==="user")&&(dn.value[h]!==!0&&(dn.value={...dn.value,[h]:!0}),us(h))}function Xs(h){h&&h!==n.value&&K.value[h]!==!0&&(K.value={...K.value,[h]:!0},pn())}function Pt(h,g){if(!h)return;const I=fe.value[h];if(!g){I&&(fe.value=St(fe.value,h));return}const j=Jr(g.label)||"Thinking",H=g.details.map(G=>Jr(G)).filter(G=>G.length>0&&G!==j),Q=Array.from(new Set([...(I==null?void 0:I.details)??[],...H])).slice(-3),W={label:j,details:Q};pL(I,W)||(fe.value={...fe.value,[h]:W})}function Lt(h,g,I={}){if(!h)return;const j=Te.value[h],H=g?Xa(g):"";if(!H){j&&(Te.value=St(Te.value,h));return}const Q=I.transient===!0;(j==null?void 0:j.message)===H&&j.transient===Q||(Te.value={...Te.value,[h]:{message:H,transient:Q}})}function ds(h){var g;h&&(g=Te.value[h])!=null&&g.transient&&Lt(h,null)}function Ar(){const h=Object.entries(Te.value).filter(([,I])=>I==null?void 0:I.transient).map(([I])=>I);if(h.length===0)return;let g=Te.value;for(const I of h)g=St(g,I);Te.value=g}function qn(h){const g=Yn(t.value).find(I=>I.id===h);return(g==null?void 0:g.updatedAtIso)??""}function qr(h,g){if(!h)return;const I={...fo.value};g?I[h]=!0:delete I[h],fo.value=I,YL(I)}function Xo(){const h=n.value;h&&qr(h,!At.value)}function Ln(h,g){const I=o.value[h]??[];yl(I,g)||(o.value={...o.value,[h]:g})}function Zo(h,g,I=[],j=[],H=[]){const Q=o.value[h]??[],W={id:`optimistic-user:${h}:${Date.now()}`,role:"user",text:g,images:I.length>0?[...I]:void 0,skills:j.length>0?j.map(G=>({name:G.name,path:G.path})):void 0,fileAttachments:H.length>0?H.map(G=>({...G})):void 0,messageType:"userMessage.optimistic"};Ln(h,[...Q,W])}function go(h,g){Jy(or,h,g)}function Pa(h){$N(or,h)}function ea(h,g){BN(or,h,g)}function Gr(h,g){zN(or,h,g)}function Vr(h,g){UN(or,h,g)}function Kr(h,g){R.setLiveReasoningText(h,g)}function Mi(h,g){R.appendLiveReasoningText(h,g)}function Ei(h){R.restoreLiveReasoningSnapshot(h)}function fs(h){nO(vt,h)}function Yr(h,g=!1){rO(vt,h,g)}function ta(h){h&&h in a.value&&(a.value=St(a.value,h))}function ps(h){h&&h in O.value&&(O.value=St(O.value,h))}function hs(h){h&&(Ur.delete(h),U.value[h]&&(U.value=St(U.value,h)))}function Ri(h,g={}){if(!h)return;ta(h);const I=s.value[h];if(I&&I.messageType==="plan.live"){const j={...I,messageType:"plan",plan:I.plan?{...I.plan,isStreaming:!1}:I.plan};s.value={...s.value,[h]:j},Ky(s.value)}Yr(h),ML(h),Pt(h,null),n.value,g.keepLiveCommands===!0&&U.value[h]?Ur.add(h):hs(h),Be.value[h]&&(Be.value=St(Be.value,h)),Jo(h)}function Zs(h){if(!h)return;const g=h===n.value;hn(h,!1,{keepDeferredLiveCommands:g}),!(!g||typeof window>"u")&&window.setTimeout(()=>{Ur.has(h)&&$.value[h]!==!0&&hs(h)},EO)}function ms(h){var Ae;if(h.method!=="turn/plan/updated")return null;const g=Ve(h.params),I=Fn(h),j=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),Q=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(He=>Ve(He)).map(He=>({step:Re(He==null?void 0:He.step),status:nN(He==null?void 0:He.status)})).filter(He=>He.step.length>0);if(!I||!j)return null;const G={explanation:Re(g==null?void 0:g.explanation).trim()||void 0,steps:Q,isStreaming:!0},ie=(Ae=it.value[I])==null?void 0:Ae[j];return{threadId:I,message:{id:`${j}:plan`,role:"assistant",text:rN(G),messageType:"plan.live",plan:G,turnId:j||void 0,turnIndex:typeof ie=="number"?ie:void 0}}}function Tl(h){var He;if(h.method!=="item/plan/delta")return null;const g=Ve(h.params),I=Fn(h),j=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),H=Re(g==null?void 0:g.delta);if(!I||!j||!H)return null;const Q=`${j}:plan`,W=(a.value[I]??[]).find(Ze=>Ze.id===Q),G=`${(W==null?void 0:W.text)??""}${H}`,ie=W!=null&&W.plan?{...W.plan,isStreaming:!0}:void 0,Ae=(He=it.value[I])==null?void 0:He[j];return{threadId:I,message:{id:Q,role:"assistant",text:G,messageType:"plan.live",plan:ie,turnId:j||void 0,turnIndex:typeof Ae=="number"?Ae:void 0}}}const or={liveCommandsByThreadId:U,liveFileChangeMessagesByThreadId:O,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},hr={turnIndexByTurnIdByThreadId:it,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:O};function _r(h){if(h.method==="server/request"){const g=Yy(h.params);return g&&os(g),!0}if(h.method==="server/request/resolved"){const g=Ve(h.params),I=g==null?void 0:g.id;return typeof I=="number"&&Number.isInteger(I)&&Tr(I),!0}return!1}function Jr(h){return h.replace(/\s+/gu," ").trim()}function mr(h){return KN(hr,h)}function na(h,g,I){YN(hr,h,g,I)}function C(h,g){JN(hr,h,g)}function M(h,g){return QN(hr,h,g)}function x(h){XN(hr,h)}function Z(h,g,I){sO(vt,h,g,I)}function Qe(h){iO(vt,h)}function zt(h){var ie;if(h.method!=="item/started"&&h.method!=="item/completed")return null;const g=Ve(h.params),I=Ve(g==null?void 0:g.item);if(!I||Re(I.type).toLowerCase()!=="plan")return null;const j=Fn(h),H=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),Q=Re(I.id),W=Re(I.text);if(!j||!Q||!W)return null;const G=j&&H?(ie=it.value[j])==null?void 0:ie[H]:void 0;return{threadId:j,message:{id:Q,role:"assistant",text:W,messageType:h.method==="item/completed"?"plan":"plan.live",plan:ky(W)??void 0,turnId:H||void 0,turnIndex:typeof G=="number"?G:void 0}}}function Gn(h){var Ae;if(h.method!=="item/started")return null;const g=Ve(h.params),I=Ve(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const j=Re(I.id),H=Re(I.command);if(!j)return null;const Q=typeof I.cwd=="string"?I.cwd:null,W=Fn(h),G=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),ie=W&&G?(Ae=it.value[W])==null?void 0:Ae[G]:void 0;return{id:j,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:Q,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:G||void 0,turnIndex:typeof ie=="number"?ie:void 0}}function vr(h){var wt;if(h.method!=="item/completed")return null;const g=Ve(h.params),I=Ve(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const j=Re(I.id),H=Re(I.command);if(!j)return null;const Q=typeof I.cwd=="string"?I.cwd:null,W=Re(I.status),G=W==="failed"?"failed":W==="declined"?"declined":W==="interrupted"?"interrupted":"completed",ie=typeof I.aggregatedOutput=="string"?I.aggregatedOutput:"",Ae=typeof I.exitCode=="number"?I.exitCode:null,He=Fn(h),Ze=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),mt=He&&Ze?(wt=it.value[He])==null?void 0:wt[Ze]:void 0;return{id:j,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:Q,status:G,aggregatedOutput:ie,exitCode:Ae},turnId:Ze||void 0,turnIndex:typeof mt=="number"?mt:void 0}}function nn(h){var Ae;if(h.method!=="item/completed")return null;const g=Ve(h.params),I=Ve(g==null?void 0:g.item);if(!I||I.type!=="fileChange")return null;const j=Re(I.id);if(!j)return null;const H=Re(g==null?void 0:g.threadId),Q=Re(g==null?void 0:g.turnId),W=H&&Q?(Ae=it.value[H])==null?void 0:Ae[Q]:void 0,G=lf(I.changes),ie=ey(I.status);return G.length===0||ie!=="completed"?null:{id:j,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ie,fileChanges:G,turnId:Q||void 0,turnIndex:typeof W=="number"?W:void 0}}function Pr(h,g){HN(or,h,g)}function Ma(h,g){WN(or,h,g)}function ra(h,g){qN(or,h,g)}function vs(h){if(h.method==="item/agentMessage/delta")return!0;const g=Ve(h.params);if(!g)return!1;if(h.method==="item/completed"){const I=Ve(g.item);return(I==null?void 0:I.type)==="agentMessage"}return!1}const gs=new Set;function Ea(h){for(const g of gs)try{g(h)}catch{}}function jc(h){return gs.add(h),()=>{gs.delete(h)}}function du(h,g,I){GN(or,h,g,I)}function Vn(h,g,I){VN(or,h,g,I)}function oa(h){var Rr,$i,Di,Fi,da,Bi,xs,To;if(_r(h))return;if(Qe(h),h.method==="turn/started"){const Ee=Fn(h);Ee&&T.delete(Ee)}if(RO.has(h.method))return;if(h.method==="app/list/updated"||h.method==="mcpServer/startupStatus/updated"||h.method==="mcpServer/oauthLogin/completed"||h.method==="remoteControl/status/changed"){Ea(h.method);return}if(h.method==="skills/changed"){jt({force:!0});return}if(h.method==="hook/started"||h.method==="hook/completed"){ze({force:!0});return}if(h.method==="thread/status/changed"){const Ee=Fn(h);Ee&&Ee===n.value&&Zt.add(Ee);return}if(h.method==="thread/archived"||h.method==="thread/unarchived"||h.method==="thread/deleted"||h.method==="thread/closed")return;if(h.method==="item/fileChange/patchUpdated"||h.method==="turn/diff/updated"){const Ee=Ve(h.params),Mt=Re(Ee==null?void 0:Ee.threadId);Mt&&(h.method==="item/fileChange/patchUpdated"?du(Mt,Re(Ee==null?void 0:Ee.itemId),lf(Ee==null?void 0:Ee.changes)):Vn(Mt,Re(Ee==null?void 0:Ee.turnId),Re(Ee==null?void 0:Ee.diff)??""),Mt===n.value&&Zt.add(Mt));return}if(h.method==="account/rateLimits/updated"&&cn(),h.method==="thread/name/updated"){const Ee=Ve(h.params),Mt=Re(Ee==null?void 0:Ee.threadId),jr=Re(Ee==null?void 0:Ee.threadName);if(Mt&&jr){const So=$s(jr);Or.value={...Or.value,[Mt]:So},pn(),ic(Mt,So)}}if(h.method==="thread/compacted"){const Ee=Ve(h.params),Mt=Re(Ee==null?void 0:Ee.threadId);Mt&&(Xr(Mt,!1),ni(Mt,"done"),Zt.add(Mt));return}if(h.method==="fuzzyFileSearch/sessionUpdated"){const Ee=Ve(h.params),Mt=Re(Ee==null?void 0:Ee.sessionId);Mt&&Mt===Br&&(fr.value=Xx(Ee));return}if(h.method==="fuzzyFileSearch/sessionCompleted"){const Ee=Ve(h.params),Mt=Re(Ee==null?void 0:Ee.sessionId);Mt&&Mt===Br&&(Br="");return}if(h.method==="account/rateLimits/updated"){er(ly(h.params));return}const g=aN(h);if(g){ss(g.threadId,g.usage);return}const I=lN(h);I&&Pt(I.threadId,I.activity);const j=Fn(h),H=iN(h);!H&&j&&ds(j);const Q=uN(h);Q&&(Wo.set(Q.turnId,Q),na(Q.threadId,Q.turnId,mr(Q.threadId)),Be.value={...Be.value,[Q.threadId]:Q.turnId},cs(Q.threadId,Q.turnId),ta(Q.threadId),ps(Q.threadId),sn(Q.threadId,null),Lt(Q.threadId,null),hn(Q.threadId,!0),Cn(Q.threadId),K.value[Q.threadId]&&(K.value=St(K.value,Q.threadId)));const W=cN(h),G=sN(h),ie=(W==null?void 0:W.threadId)??Fn(h),Ae=ie?xe(ie):"",He=!!ie&&!!G&&Ae!==Io&&$u(new Error(G));if(W){un.value[W.threadId];const Ee=Wo.get(W.turnId);Ee&&Wo.delete(W.turnId);const Mt=Bs((Rr=Ve(h.params))==null?void 0:Rr.durationMs)??Bs((Di=Ve(($i=Ve(h.params))==null?void 0:$i.turn))==null?void 0:Di.durationMs)??(typeof W.startedAtMs=="number"?W.completedAtMs-W.startedAtMs:null)??(Ee?W.completedAtMs-Ee.startedAtMs:null),jr=typeof Mt=="number"?Math.max(0,Mt):0;sn(W.threadId,{turnId:W.turnId,durationMs:jr}),_i(W.threadId,W.turnId,jr),Be.value[W.threadId]&&(Be.value=St(Be.value,W.threadId)),Zs(W.threadId),Pt(W.threadId,null),Xs(W.threadId),He||(Jo(W.threadId),Cn(W.threadId))}if(G){const Ee=(W==null?void 0:W.threadId)||Fn(h);Ee&&Lt(Ee,G),r.value=G,Ee&&He&&tn(Ee)}else W&&Lt(W.threadId,null);if(H){const Ee=j,Mt=Ee?xe(Ee):me.value.trim();Ee&&Lt(Ee,H.message,{transient:H.transient}),r.value=H.message,Mt!==Io&&$u(new Error(H.message))&&(Ee?tn(Ee):De())}const Ze=ms(h);Ze&&(ea(Ze.threadId,Ze.message),Pt(Ze.threadId,{label:"Planning",details:((Fi=Ze.message.plan)==null?void 0:Fi.steps.map(Ee=>Ee.step).slice(0,2))??[]}));const mt=Tl(h);mt&&(ea(mt.threadId,mt.message),Pt(mt.threadId,{label:"Planning",details:[]}));const wt=zt(h);if(wt&&(ea(wt.threadId,wt.message),Pt(wt.threadId,{label:"Planning",details:((da=wt.message.plan)==null?void 0:da.steps.map(Ee=>Ee.step).slice(0,2))??[]})),!j||j!==n.value)return;gN(h);const pt=yN(h);if(pt){const Ee=(i.value[j]??[]).find($a=>$a.id===pt.messageId),Mt=`${(Ee==null?void 0:Ee.text)??""}${pt.delta}`,jr=pt.turnId??(Ee==null?void 0:Ee.turnId),So=jr?(Bi=it.value[j])==null?void 0:Bi[jr]:Ee==null?void 0:Ee.turnIndex;Gr(j,{id:pt.messageId,role:"assistant",text:Mt,messageType:"agentMessage.live",turnId:jr,turnIndex:typeof So=="number"?So:void 0})}const _t=wN(h);if(_t){const Ee=_t.turnId?(xs=it.value[j])==null?void 0:xs[_t.turnId]:void 0;Gr(j,{..._t,turnIndex:typeof Ee=="number"?Ee:void 0})}const On=SN(h);On&&Gr(j,On),dN(h)&&fs(j);const Qt=fN(h);Qt&&(Mi(j,Qt.delta),uO(vt,Qt.itemId,Qt.delta));const $n=vN(h);if($n&&(Z(j,$n.itemId,$n.text),fs(j)),pN(h)){const Ee=v.value[j]??"";Ee.trim().length>0&&!Ee.endsWith(`
75
+
76
+ `)&&Kr(j,`${Ee}
77
+
78
+ `)}hN(h);const si=Gn(h);si&&(Pr(j,si),Pt(j,{label:"Running command",details:[((To=si.commandExecution)==null?void 0:To.command)??""]}));const Er=CN(h);if(Er){const Ee=(U.value[j]??[]).find(Mt=>Mt.id===Er.itemId);Ee!=null&&Ee.commandExecution&&Pr(j,{...Ee,commandExecution:{...Ee.commandExecution,aggregatedOutput:`${Ee.commandExecution.aggregatedOutput}${Er.delta}`}})}const Cl=vr(h);Cl&&Pr(j,Cl);const mu=nn(h);if(mu&&Vr(j,mu),vs(h)&&Yr(j,!0),h.method==="turn/completed"){Vt=!1,Yr(j),cv(vt);const Ee=Fn(h);Ee&&(Qo(Ee),Zs(Ee),Pt(Ee,null),Xs(Ee),He||(Jo(Ee),Cn(Ee)))}}function yo(h){if(h.method==="thread/tokenUsage/updated"||h.method.startsWith("thread/realtime/"))return;const g=h.method,I=g==="turn/started"||g==="turn/completed"||g==="error",j=g.startsWith("thread/")||g==="turn/completed";if(!I&&!j)return;const H=Fn(h);H&&I&&Zt.add(H),j&&(an=!0,Ho=!0),!(Jt!==null||typeof window>"u")&&(Jt=window.setTimeout(()=>{Jt=null,vn()},Uu))}async function aa(h,g){if(!Ca){Ca=!0;try{if(!g)return;const I=[];for(const j of Rc(g)){const H=ki(j);I.includes(H)||I.push(H)}if(I.length>0){const j=g.projectOrder.length>0?Xi(I,h):Xi(he.value,h);Ka(he.value,j)||bt(j,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const j={...ke.value};let H=!1;for(const[Q,W]of Object.entries(g.labels)){const G=et(Q).trim(),ie=[ki(Q)];G&&ie.push(G);for(const Ae of ie)j[Ae]!==W&&(j[Ae]=W,H=!0)}for(const Q of g.order){const W=ki(Q),G=ro(sl(Q));if(!G.startsWith(".")||G===W)continue;const ie=`${W} ${G}`;j[W]!==void 0||j[W]===ie||(j[W]=ie,H=!0)}for(const Q of g.remoteProjects??[]){const W=CL(Q);j[Q.id]!==W&&(j[Q.id]=W,H=!0)}H&&ct(j,{persist:!1})}}catch{}}}async function Nn(){try{return await Zi()}catch{return null}}function ji(h,g){const I=wf(h,g),j=AL(h,g),H=_L(j,g,I);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return H;const Q=new Set;for(const G of yf(g,I))Q.add(G);const W=H.filter(G=>Q.has(G.projectName)?!0:Tf(G));return IL(W,g,I)}function ei(h,g){const I=ji(h,g),j=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),H=g!=null&&g.projectOrder.length?Xi(yf(g,wf(h,g)),I):Xi(he.value,I);Ka(he.value,H)||bt(H,{persist:!j});const Q=vf(I,he.value);bl(new Set(Yn(Q).map(ie=>ie.id)));const W=TL(t.value,Q,$.value);t.value=cc(t.value,W),$.value=rn($.value,new Set(Yn(t.value).map(ie=>ie.id))),new Set(Yn(t.value).map(ie=>ie.id));const G={};for(const ie of Yn(t.value))G[ie.id]=ie.externalSession??pe.value[ie.id]??null;pe.value=G,pn()}function Ra(h){It.removeThreadFromLoadedLists(h),t.value=Ny(t.value,h),$.value=St($.value,h),pn()}async function Sl(h={}){await Promise.allSettled([Me({providerChanged:h.providerChanged,includeProviderModels:h.includeProviderModels}),Bo(),z(),jt()])}function ja(h={}){const g=()=>{Sl(h)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function Qr(h={}){r.value="",ge.value="";const g=h.includeSelectedThreadMessages!==!1,I=h.awaitAncillaryRefreshes===!0;try{if(await Yo(),await It.loadThreads({force:h.forceThreadRefresh===!0}),g)try{await Gt(n.value)}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}I?await Sl({providerChanged:h.providerChanged,includeProviderModels:h.providerChanged===!0||I}):ja({providerChanged:h.providerChanged,includeProviderModels:!1})}catch(j){r.value=j instanceof Error?j.message:"Unknown application error",Ry(j)?ge.value=Qy:ge.value=""}}async function sa(h){Pn(h);try{return await Gt(h),await Me({includeProviderModels:!0}),jt(),"ok"}catch(g){const I=g instanceof Error?g.message:"Unknown application error";r.value=I;const j=Zj(g)?"not-found":"error";return h.trim()&&Lt(h,I,{transient:!0}),j}}async function mn(h){const g=n.value===h,I=g?Xj(Yn(e.value),h):"";g&&(Pn(I),I&&Gt(I,{silent:!0}));try{await rI(h),Ra(h),await It.loadThreads(),g&&I&&n.value===I&&await yt(I,{silent:!0})}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}}async function La(h,g){const I=g.trim();if(!(!h||!I))try{await sI(h,I),Or.value={...Or.value,[h]:I},pn(),ic(h,I)}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}}async function ys(h){var W,G;const g=h.trim();if(!g)return"";const I=Yn(t.value).find(ie=>ie.id===g),j=((W=I==null?void 0:I.cwd)==null?void 0:W.trim())??"",H=((G=I==null?void 0:I.title)==null?void 0:G.trim())??"Forked chat",Q=xe(g);r.value="";try{const ie=await mm(g,j||void 0,Q||void 0),Ae=ie.threadId.trim();return Ae?(mo(Ae,j,H),N(Ae,ie.model),nt.value={...nt.value,[Ae]:!0},Pn(Ae),await It.loadThreads(),await Gt(Ae),Ae):""}catch(ie){return r.value=ie instanceof Error?ie.message:"Unknown application error",""}}async function ws(h,g){var W;const I=h.trim();if(!I||!Number.isInteger(g)||g<0)return"";if($.value[I]===!0)return r.value="Finish the current turn before forking from a response.","";if(Zn.value[I]!==!0)try{await Gt(I)}catch(G){return r.value=G instanceof Error?G.message:"Unknown application error",""}const j=o.value[I]??[];let H=-1;for(const G of j)typeof G.turnIndex=="number"&&Number.isFinite(G.turnIndex)&&(H=Math.max(H,G.turnIndex));if(H>=0&&g>H)return"";const Q=Yn(t.value).find(G=>G.id===I)??null;try{r.value="";const G=await mm(I),ie=G.threadId.trim();if(!ie)return"";const Ae=G.cwd.trim()||((W=Q==null?void 0:Q.cwd)==null?void 0:W.trim())||"",He=PL((Q==null?void 0:Q.title)||(Q==null?void 0:Q.preview)||"Untitled thread");if(mo(ie,Ae,He),N(ie,G.model),Ln(ie,G.messages),Zn.value={...Zn.value,[ie]:!0},nt.value={...nt.value,[ie]:!0},ta(ie),go(ie,[]),Yr(ie),U.value[ie]&&(U.value=St(U.value,ie)),sn(ie,null),Pt(ie,null),Lt(ie,null),hn(ie,!1),H-g>0){const Ze=G.messages.find(mt=>{var wt;return typeof mt.turnIndex=="number"&&mt.turnIndex>g&&!!((wt=mt.turnId)!=null&&wt.trim())});if(Ze!=null&&Ze.turnId){const mt=await _d(ie,Ze.turnId.trim());Ln(ie,mt)}}return await La(ie,He),Pn(ie),It.loadThreads().catch(()=>{}),ie}catch(G){return r.value=G instanceof Error?G.message:"Unknown application error",""}}async function ti(h,g,I=[],j=[],H=[]){if(!h||!g.trim()||I.length>0||j.length>0||H.length>0)return!1;const W=(Fo.value[h]??[]).filter(Ae=>Ae.method==="item/tool/requestUserInput");if(W.length!==1)return!1;const[G]=W,ie=RN(G);return ie.length!==1?!1:Oi({id:G.id,result:{answers:{[ie[0]]:{answers:[g.trim()]}}}})}function bs(h){if(kr.value<=0||bn.value.has(h))return!1;const g=Et.value[h];return!g||g.remainingContextPercent===null?!1:g.remainingContextPercent<=kr.value}async function Ts(h,g,I,j,H,Q){if(ce||kr.value<=0||$.value[h]===!0)return!1;const W=Et.value[h];if(!W||W.remainingContextPercent===null||W.remainingContextPercent>kr.value)return!1;const G=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ie=Q==="plan"?"plan":Q==="default"?"default":_.value;return xr(h,{id:G,text:g,imageUrls:I,skills:j,fileAttachments:H,collaborationMode:ie}),bn.value.has(h)||la(h),!0}async function wo(h){const g=ho(h);if(!g||g.length===0||$.value[h]===!0)return;const I=k(h);ce=!0;try{for(const j of I)try{await Na(j.text,j.imageUrls,j.skills,"steer",j.fileAttachments,void 0,j.collaborationMode)}catch{}}finally{ce=!1}}function Lc(h){return h instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(h.message)}function Nc(h){return h instanceof Error&&/expected active turn id/i.test(h.message)}async function Oc(h,g,I,j,H,Q){const W=Be.value[h]??"";if(W)try{await lI(h,W,g,I,j,H),Zo(h,g,I,j,H),Zt.add(h),await vn(),Wr(h);return}catch(G){if(Lc(G)){const ie=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;zr(h,{id:ie,text:g,imageUrls:I,skills:j,fileAttachments:H,collaborationMode:Q==="plan"?"plan":Q==="default"?"default":_.value});return}if(!Nc(G))throw G}Zo(h,g,I,j,H),await Oa(h,g,I,j,H,Q)}async function Na(h,g=[],I=[],j="steer",H=[],Q,W){if(ee.value)return;const G=n.value,ie=h.trim();if(!G||!ie&&g.length===0&&H.length===0||await ti(G,ie,g,I,H)||await Ts(G,ie,g,I,H,W))return;const Ae=$.value[G]===!0;if(Ae&&j==="queue"){const He=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;zr(G,{id:He,text:ie,imageUrls:g,skills:I,fileAttachments:H,collaborationMode:W==="plan"?"plan":W==="default"?"default":_.value},Q);return}if(Ae){Vt=!0,Oc(G,ie,g,I,H,W).catch(He=>{const Ze=He instanceof Error?He.message:"Unknown application error";Lt(G,Ze),r.value=Ze});return}r.value="",Vt=!0,sn(G,null),Zo(G,ie,g,I,H),Pt(G,{label:"Thinking",details:Ne(xe(G),re.value,W==="plan"?"plan":W==="default"?"default":_.value)}),Lt(G,null),hn(G,!0);try{await Oa(G,ie,g,I,H,W)}catch(He){Vt=!1,hn(G,!1),Pt(G,null);const Ze=He instanceof Error?He.message:"Unknown application error";throw Lt(G,Ze),r.value=Ze,He}}async function ia(h,g,I=[],j=[],H=[]){if(ee.value)return"";const Q=h.trim(),W=g.trim(),G=xe(va).trim(),ie=_.value;if(!Q&&I.length===0&&H.length===0)return"";Fr.value=!0,r.value="";let Ae="";try{try{const wt=await hm(W||void 0,G||void 0);Ae=wt.threadId,N(Ae,wt.model),oe(Ae,wt.modelProvider||le.value),ne(Ae,ie)}catch(wt){if(G&&G!==Io&&$u(wt)){await De();const pt=await hm(W||void 0,Io);Ae=pt.threadId,N(Ae,pt.model),oe(Ae,pt.modelProvider||le.value),ne(Ae,ie)}else throw wt}if(!Ae)return"";mo(Ae,W,Q||"[Image]"),Zo(Ae,Q,I,j,H),rr(Ae),nt.value={...nt.value,[Ae]:!0},Pn(Ae),Vt=!0,sn(Ae,null),Pt(Ae,{label:"Thinking",details:Ne(xe(Ae),re.value,ie)}),Lt(Ae,null),hn(Ae,!0);const He=Ae,Ze=W||null,mt=Q;return Oa(Ae,Q,I,j,H,ie).catch(wt=>{Vt=!1,hn(Ae,!1),Pt(Ae,null);const pt=wt instanceof Error?wt.message:"Unknown application error";Lt(Ae,pt),r.value=pt}).finally(()=>{Fr.value=!1}),Oo(He,mt,Ze,I,H),Ae}catch(He){Vt=!1,Ae&&(hn(Ae,!1),Pt(Ae,null));const Ze=He instanceof Error?He.message:"Unknown application error";throw Ae&&Lt(Ae,Ze),r.value=Ze,Fr.value=!1,He}}async function Oa(h,g,I=[],j=[],H=[],Q){const W=re.value,G=Q==="plan"?"plan":Q==="default"?"default":_.value,ie=g.trim(),Ae=[...I];if(Ae.length===0&&Uo(ie)){const mt=zo(h);mt&&Ae.push(mt)}const He=j.map(mt=>({name:mt.name,path:mt.path})),Ze=H.map(mt=>({...mt}));Js(h,{text:ie,imageUrls:[...Ae],skills:He,fileAttachments:Ze,effort:W,collaborationMode:G,fallbackRetried:!1});try{if(nt.value[h]!==!0){const pt=Le(h),_t=await df(h);_t.model&&!pt&&N(h,Je(h,_t.model,_t.modelProvider)),_t.modelProvider&&oe(h,_t.modelProvider),nt.value={...nt.value,[h]:!0}}const mt=xe(h);let wt="";try{wt=await Pd(h,g,Ae,mt||void 0,W||void 0,j.length>0?j:void 0,H,G)}catch(pt){if(mt&&mt!==Io&&$u(pt))await De(h),Js(h,{text:ie,imageUrls:[...Ae],skills:He,fileAttachments:Ze,effort:W,collaborationMode:G,fallbackRetried:!0}),wt=await Pd(h,g,Ae,Io,W||void 0,j.length>0?j:void 0,H,G);else throw pt}wt&&(Be.value={...Be.value,[h]:wt},cs(h,wt)),Zt.add(h),await vn(),Wr(h)}catch(mt){throw mt}}async function Ss(){const h=n.value;if(!h||$.value[h]!==!0||xt.value[h]===!0)return;let g=Be.value[h];if(!g){const{activeTurnId:Q}=await cf(h);g=Q,g&&(Be.value={...Be.value,[h]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const I=as.value.filter(Q=>Q.turnId===g),j=I.find(Q=>Q.role==="user"&&Q.isAgentNote!==!0),H=I.some(Q=>{if(Q.role==="assistant")return!0;const W=Q.messageType??"";return W==="commandExecution"||W==="toolCall"||W==="worked"||W==="fileChange"||W==="plan"||W==="plan.live"||W==="compaction.done"||W==="turnError"});jn.value=!0,r.value="";try{if(await uI(h,g),hn(h,!1),Pt(h,null),Lt(h,null),Be.value[h]&&(Be.value=St(Be.value,h)),Zt.add(h),an=!0,await vn(),j&&!H){const Q=(o.value[h]??[]).filter(G=>G.turnId!==g);Ln(h,Q);const W=c.value[h];if(W){const G=W.filter(ie=>ie.turnId!==g);G.length!==W.length&&(c.value={...c.value,[h]:G},Du(c.value))}Hn.value={...Hn.value,[h]:{text:j.text??"",imageUrls:j.images??[],fileAttachments:(j.fileAttachments??[]).map(G=>({label:G.label,path:G.path,fsPath:G.fsPath??G.path})),skills:j.skills??[]}}}}catch(Q){const W=Q instanceof Error?Q.message:"Failed to interrupt active turn";Lt(h,W),r.value=W}finally{jn.value=!1}}function fu(h){h&&Hn.value[h]&&(Hn.value=St(Hn.value,h))}async function pu(h,g){if(!g)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await _d(h,g)}async function Mn(h,g){if(!h||!g||$.value[h]===!0||g===(Be.value[h]??""))return!1;let I;try{I=await iI(h)}catch{return!1}return I.complete&&!I.turnIds.includes(g)}function Mr(h,g){const I=o.value[h]??[],j=I.filter(W=>{var G;return(((G=W.turnId)==null?void 0:G.trim())??"")!==g});j.length!==I.length&&Ln(h,j);const H=c.value[h];if(!H)return;const Q=H.filter(W=>{var G;return(((G=W.turnId)==null?void 0:G.trim())??"")!==g});Q.length!==H.length&&(c.value={...c.value,[h]:Q},Du(c.value))}async function gr(h){var I,j,H,Q,W;const g=n.value;if(g&&!An.value&&h.trim()){An.value=!0,r.value="";try{$.value[g]===!0&&await Ss();const G=o.value[g]??[],ie=G.find(pt=>pt.turnId===h),Ae=G.reduce((pt,_t)=>typeof _t.turnIndex=="number"&&_t.turnIndex>pt?_t.turnIndex:pt,-1);if(Ae<0)return;let He=typeof(ie==null?void 0:ie.turnIndex)=="number"?ie.turnIndex:((I=it.value[g])==null?void 0:I[h])??-1;(He<0||He>Ae)&&(console.warn(`[rollback] turn ${h} not resolvable (index=${He}), clamping to newest turn`),He=Ae);let Ze=((j=ie==null?void 0:ie.turnId)==null?void 0:j.trim())??"";if(!Ze&&He>=0){const pt=it.value[g]??{};Ze=Object.keys(pt).find(_t=>pt[_t]===He)??""}if(!Ze){const pt=G.reduce((_t,On)=>{const ai=typeof On.turnIndex=="number"?On.turnIndex:-1,Qt=_t!==null&&typeof _t.turnIndex=="number"?_t.turnIndex:-1;return ai>=0&&ai>Qt?On:_t},null);Ze=((H=pt==null?void 0:pt.turnId)==null?void 0:H.trim())??""}if(await Mn(g,Ze)){console.warn(`[rollback] ${g}: turn ${Ze} is already gone on the server; reconciling locally instead of sending thread/revert`),Mr(g,Ze),an=!0;try{await Gt(g,{force:!0}),await vn()}catch{}return}const mt=await pu(g,Ze),wt=((W=(Q=Go.value)==null?void 0:Q.cwd)==null?void 0:W.trim())??"";if(wt){const pt=await BA(g,h,wt);pt.errors.length>0&&console.warn(`[rollback] file revert for ${g} left errors: ${pt.errors.join("; ")}`)}Ln(g,mt),go(g,[]),Yr(g),U.value[g]&&(U.value=St(U.value,g)),sn(g,null),Pt(g,null),Lt(g,null),an=!0,await vn()}catch(G){r.value=G instanceof Error?G.message:"Failed to rollback thread";try{await Gt(g,{force:!0})}catch{}}finally{An.value=!1}}}function ni(h,g){const j=(l.value[h]??[]).filter(H=>H.messageType!=="compaction.pending"&&H.messageType!=="compaction.done");j.push({id:`compaction:${g}:${h}:${Date.now()}`,role:"system",text:"",messageType:g==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[h]:j}}function Xr(h,g){const I=new Set(bn.value);g?I.add(h):I.delete(h),bn.value=I}function ri(h){Br=h.trim(),fr.value=[]}async function la(h){const g=h.trim();if(!(!g||bn.value.has(g))){Xr(g,!0),ni(g,"pending");try{await aI(g);const I=2e3,j=14,H=Date.now()+Sa;let Q=0;for(;Date.now()<H&&Q<j&&bn.value.has(g);){if((await cf(g)).messages.some(ie=>ie.messageType==="compaction.done")){Xr(g,!1),n.value===g&&await Gt(g,{silent:!0,force:!0}),ni(g,"done"),wo(g);break}Q+=1,await Qj(I)}bn.value.has(g)&&(Xr(g,!1),ni(g,"done"),wo(g))}catch(I){r.value=I instanceof Error?I.message:"Failed to compact thread",Xr(g,!1),ni(g,"done"),wo(g)}}}async function vn(){if(Bt.value){typeof window<"u"&&Jt===null&&(Jt=window.setTimeout(()=>{Jt=null,vn()},Uu));return}Bt.value=!0;const h=an,g=Ho,I=new Set(Zt);an=!1,Ho=!1,Zt.clear();try{h&&await It.loadThreads({force:g});const j=n.value;if(!j)return;const H=I.has(j),Q=$.value[j]===!0,W=qn(j),G=wa.value[j]??"";(W.length>0&&W!==G||H||Q&&Zn.value[j]!==!0||h&&Zn.value[j]!==!0)&&await Gt(j,{silent:!0,force:H})}catch{}finally{Bt.value=!1,(an||Zt.size>0)&&typeof window<"u"&&Jt===null&&(Jt=window.setTimeout(()=>{Jt=null,vn()},Uu))}}async function Li(){await Do(),an=!It.hasLoadedThreads.value,n.value&&Zn.value[n.value]!==!0&&Zt.add(n.value),await vn()}function hu(h){const g=Ve(h.params),I=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!I)return;const j=Ve(g==null?void 0:g.externalSession),H=j&&typeof j.origin=="string"&&j.origin.trim().length>0?{origin:j.origin.trim(),active:j.active===!0,lastWriteAt:typeof j.lastWriteAt=="string"?j.lastWriteAt:null}:null;pe.value={...pe.value,[I]:H},hn(I,(H==null?void 0:H.active)===!0),pn(),an=!0,n.value===I&&Zt.add(I),Jt===null&&typeof window<"u"&&(Jt=window.setTimeout(()=>{Jt=null,vn()},Uu))}function Ni(){typeof window>"u"||Tn||(Do(),oi(),ua(),Tn=EI(h=>{if(h.method==="ready"){Ar(),Li();return}if(h.method==="externalSessionChanged"){hu(h);return}oa(h),yo(h)}))}async function oi(){try{const h=await FI(),g=Object.entries(h);if(g.length===0)return;const I={...c.value};let j=!1;for(const[H,Q]of g){const W=Q.filter(He=>!!He&&typeof He.id=="string");if(W.length===0)continue;const G=I[H]??[],ie=new Set(G.map(He=>He.text)),Ae=[...G];for(const He of W)ie.has(He.text)||(Ae.push(He),ie.add(He.text));I[H]=Ae.slice(-20),j=!0}j&&(c.value=I,Du(I))}catch{}}async function ua(){try{const h=await UI(),g=Object.entries(h);if(g.length===0)return;const I={...d.value};let j=!1;for(const[H,Q]of g){if(!H||!Q||typeof Q!="object"||Array.isArray(Q))continue;const W={};for(const[Ae,He]of Object.entries(Q))!Ae||typeof He!="number"||!Number.isFinite(He)||He<=0||(W[Ae]=Math.round(He));if(Object.keys(W).length===0)continue;const G={...I[H]??{},...W},ie=Object.keys(G);I[H]=ie.length>200?Object.fromEntries(ie.slice(-200).map(Ae=>[Ae,G[Ae]])):G,j=!0}j&&(d.value=I,Vy(h),iv(I))}catch{}}async function Oi(h){try{return await RI(h.id,{result:h.result,error:h.error}),Tr(h.id),Dr.value=St(Dr.value,String(h.id)),!0}catch(g){const I=g instanceof Error?g.message:"Failed to reply to server request";return await Ta(h.id)?(r.value=I,Dr.value={...Dr.value,[String(h.id)]:I},!1):(Tr(h.id),Dr.value=St(Dr.value,String(h.id)),!0)}}function ca(){if(Tn&&(Tn(),Tn=null),an=!1,Zt.clear(),Wo.clear(),Jt!==null&&typeof window<"u"&&(window.clearTimeout(Jt),Jt=null),Cr(),It.dispose(),typeof window<"u")for(const h of pr.values())window.clearTimeout(h);pr.clear(),Vt=!1,o.value={},a.value={},i.value={},v.value={},c.value={},d.value={},U.value={},O.value={},it.value={},fe.value={},J.value={},Te.value={},Be.value={},A.clear(),cv(vt),T.clear(),EL(),xt.value={},kt.value={},dn.value={},Vo(),er(null),Et.value={}}function Cs(h){const g=n.value;if(!g)return;const I=nr(g,h);if(I){ht(h),ue(I.collaborationMode),ce=!0,Na(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments).finally(()=>{ce=!1});return}const j=Ko(g,h);j&&(ht(h),ue(j.collaborationMode),Na(j.text,j.imageUrls,j.skills,"steer",j.fileAttachments))}function Kn(h,g={}){Pn(h,g)}return{projectGroups:e,projectDisplayNameById:ke,selectedThread:Go,selectedThreadTokenUsage:ka,selectedThreadTerminalOpen:At,isSelectedThreadInterruptPending:en,selectedThreadServerRequests:rs,selectedLiveOverlay:Hr,selectedActiveTurnId:Kt,lastPlanByThreadId:s,resolveThreadTurnIndex:M,codexQuota:dr,selectedThreadId:n,availableCollaborationModes:We,availableModelIds:ye,availableModelReasoningEfforts:Pe,selectedCollaborationMode:_,selectedModelId:me,selectedReasoningEffort:re,selectedSpeedMode:Ie,codexCliMissingError:ge,installedSkills:V,accountRateLimitSnapshots:Sr,messages:as,hasMoreOlderMessages:Ia,isLoadingThreads:It.isLoadingThreads,isThreadListFullyLoaded:It.isThreadListFullyLoaded,isLoadingMessages:No,slowOpenThreadId:ba,isLoadingOlderMessages:Aa,isSendingMessage:Fr,isInterruptingTurn:jn,isUpdatingSpeedMode:ee,isRollingBack:An,compactingThreadIds:bn,fuzzyFileSearchResults:fr,registerFuzzyFileSearchSession:ri,error:r,refreshAll:Qr,refreshSkills:jt,refreshHooks:ze,hooksList:L,isHooksLoading:be,onRealtimeEvent:jc,selectThread:sa,loadMessages:Gt,loadOlderMessages:io,ensureThreadMessagesLoaded:yt,setThreadTerminalOpen:qr,toggleSelectedThreadTerminal:Xo,archiveThreadById:mn,compactThreadById:la,renameThreadById:La,forkThreadById:ys,forkThreadFromTurn:ws,rollbackSelectedThread:gr,sendMessageToSelectedThread:Na,sendMessageToNewThread:ia,interruptSelectedThreadTurn:Ss,interruptedUnsubmittedMessage:fn,clearInterruptedUnsubmittedMessage:fu,selectedThreadQueuedMessages:xa,removeQueuedMessage:ht,reorderQueuedMessage:_n,steerQueuedMessage:Cs,autoCompactThreshold:kr,setAutoCompactThreshold:Wn,setSelectedCollaborationMode:ue,readModelIdForThread:xe,setSelectedModelIdForThread:st,injectModelSwitchDivision:is,invalidateThreadContextWindow:_a,setSelectedModelId:Xe,setSelectedReasoningEffort:de,updateSelectedSpeedMode:je,respondToPendingServerRequest:Oi,pendingReplyErrorForRequest:ns,renameProject:qe,removeProject:$e,reorderProject:Ge,pinProjectToTop:Ke,startPolling:Ni,stopPolling:ca,primeSelectedThread:Kn}}const ew="codex-web-local.sidebar-collapsed.v1",tw="codex-web-local.accounts-section-collapsed.v1";function NO(){return typeof window>"u"?!1:window.localStorage.getItem(ew)==="1"}function OO(e){typeof window>"u"||window.localStorage.setItem(ew,e?"1":"0")}function $O(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(tw);return e===null?!0:e==="1"}function DO(){const e=S(NO()),t=S($O()),n=S(""),r=S(!1),o=S(null),a=S(null);let s=0,i=0,l=!1;function c(O){var $;if(e.value!==O){if(O){const q=($=f())==null?void 0:$.scrollTop;typeof q=="number"&&(q>0||s===0)&&(s=q)}e.value=O,OO(O),O||T()}}function d(){r.value=!r.value,r.value?Ft(()=>{var O;return(O=a.value)==null?void 0:O.focus()}):n.value=""}function v(){var O;n.value="",(O=a.value)==null||O.focus()}function f(){return o.value?o.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function y(O){if(e.value||l)return;const q=(O==null?void 0:O.currentTarget)&&typeof HTMLElement<"u"&&O.currentTarget instanceof HTMLElement?O.currentTarget:f();s=(q==null?void 0:q.scrollTop)??s}function T(){const O=++i,$=s,q=90;l=!0;const R=()=>{O===i&&(s=$,l=!1)},pe=ce=>{if(O!==i)return;if(e.value){R();return}const K=f();if(K&&(K.scrollTop=$,Math.abs(K.scrollTop-$)<=1||ce>=q)){R();return}if(ce>=q||typeof window>"u"){R();return}window.requestAnimationFrame(()=>pe(ce+1))};Ft(()=>pe(0))}function A(O){O.key==="Escape"&&(r.value=!1,n.value="")}function U(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(tw,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:r,sidebarScrollableRef:o,sidebarSearchInputRef:a,setSidebarCollapsed:c,toggleSidebarSearch:d,clearSidebarSearch:v,onSidebarScroll:y,onSidebarSearchKeydown:A,restoreSidebarScrollPosition:T,toggleAccountsSectionCollapsed:U}}const nw="codex-web-local.right-panel-width.v1",FO=260,BO=640,fv=320;function rw(e){return Math.min(BO,Math.max(FO,e))}function UO(){if(typeof window>"u")return fv;const e=window.localStorage.getItem(nw),t=Number(e);return Number.isFinite(t)?rw(t):fv}function zO(e){typeof window>"u"||window.localStorage.setItem(nw,String(e))}function HO(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:r}=e,o=S("git"),a=S([]),s=S(""),i=Y(()=>a.value.find(ge=>ge.key===s.value)??null),l=S(!1),c=S(!1),d=S(!1),v=S(UO()),f=S(!1),y=S(!1);let T=null;function A(){T&&(clearTimeout(T),T=null)}function U(){f.value=!1,y.value=!1,A()}function O(ge){ge.preventDefault();const ee=ge.clientX,me=v.value,re=De=>{const Ne=ee-De.clientX;v.value=rw(me+Ne)},Ie=()=>{zO(v.value),window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Ie)};window.addEventListener("mousemove",re),window.addEventListener("mouseup",Ie)}function $(){n()&&(t()&&!c.value&&(c.value=!0),t()||(d.value=!1),o.value=o.value==="terminal"?"git":"terminal",o.value!=="terminal"&&U())}function q(ge){o.value=ge,l.value=!1,t()||(d.value=!1),t()&&(c.value=!0),ge!=="terminal"&&U()}function R(ge){const ee=a.value.find(me=>me.path===ge.path);if(ee)s.value=ee.key;else{const me={key:`preview-${Date.now()}`,path:ge.path,label:ge.label};a.value=[...a.value,me],s.value=me.key}q("preview")}function pe(ge){a.value.some(ee=>ee.key===ge)&&(s.value=ge,q("preview"))}function ce(ge){const ee=a.value.findIndex(Ie=>Ie.key===ge);if(ee<0)return;const me=a.value.filter(Ie=>Ie.key!==ge);if(a.value=me,s.value!==ge)return;if(me.length===0){s.value="",o.value="files";return}const re=me[Math.min(ee,me.length-1)];s.value=re.key}function K(){if(t()){c.value=!1;return}d.value=!0,l.value=!1,U()}function le(){if(t()){c.value=!c.value;return}d.value=!d.value,d.value&&(l.value=!1,U())}function ye(){o.value="git",t()&&(c.value=!1),U()}function Pe(ge){if(f.value=ge,!ge){y.value=!1,A();return}y.value=!0,A(),T=setTimeout(()=>{T=null,r()||(y.value=!1)},1500)}return{activeRightPanelTab:o,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:c,isRightPanelCollapsed:d,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:y,onRightResizeHandleMouseDown:O,toggleRightPanelTerminal:$,selectRightPanelTab:q,onOpenFilePreview:R,selectFilePreviewTab:pe,closeFilePreviewTab:ce,onCloseRightPanel:K,onToggleRightPanelToggle:le,onHideRightPanelTerminal:ye,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:U,clearTerminalKeyboardFocusFallbackTimer:A}}function WO(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,e.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function qO(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!WO(e))throw new Error("Copy failed")}const GO=400;function VO(e,t,n,r){return e==="visible"&&!n&&t!==null&&r-t>=GO}const KO=[[/(gmail|google calendar|google docs|google sheets|google drive|github|slack|notion|linear|outlook|supabase)/i,140],[/(email|calendar|document|sheet|drive|repo|issue|message|project|database|crm|deploy)/i,50]];function ow(e){return e.trim().toLowerCase()}function YO(e,t){return t.reduce((n,[r,o])=>n+(r.test(e)?o:0),0)}function pv(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+YO(`${e.name} ${e.slug} ${e.description}`,KO)}function JO(e,t){const n=ow(t);if(!n)return 0;const r=e.name.toLowerCase(),o=e.slug.toLowerCase();return r===n||o===n?1e6:r.replace(/\s+/gu,"")===n.replace(/\s+/gu,"")?9e5:r.startsWith(n)||o.startsWith(n)?8e5:r.includes(n)||o.includes(n)?7e5:0}function Ki(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function xB(e,t,n=""){const r=ow(n),o=a=>JO(a,r);return t==="name"?[...e].sort((a,s)=>o(s)-o(a)||Ki(a)-Ki(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>o(s)-o(a)||Ki(a)-Ki(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>o(s)-o(a)||Ki(a)-Ki(s)||pv(s)-pv(a)||a.name.localeCompare(s.name))}function QO(e,t){var a;const n=e.lastIndexOf(":"),r=n>=0?e.slice(n+1):e,o=t.find(s=>s.name===e)??t.find(s=>s.name===r||s.name.endsWith(`:${r}`));return((a=o==null?void 0:o.path)==null?void 0:a.trim())??""}function XO(e,t){const n=[];for(const r of e){const o=r.name.trim();if(!o)continue;const a=(r.path??"").trim()||QO(o,t);a&&n.push({name:o,path:a})}return n}const ZO={class:"sidebar-root"},e$=["aria-pressed","aria-label","title"],t$={key:1,class:"sidebar-search-bar"},n$=["placeholder"],r$=["aria-label"],o$={class:"sidebar-skills-link-icon","aria-hidden":"true"},a$={class:"sidebar-skills-link-copy"},s$={class:"sidebar-skills-link-title"},i$={class:"sidebar-skills-link-subtitle"},l$={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},u$={class:"sidebar-skills-link-copy"},c$={class:"sidebar-skills-link-title"},d$={class:"sidebar-skills-link-subtitle"},f$={class:"sidebar-settings-actions"},p$=["title","aria-label"],h$=["title","aria-label"],m$={class:"content-root-wrap"},v$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},g$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},y$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},w$=["aria-label","title"],b$={class:"content-body"},T$={key:2,class:"content-grid content-grid-home"},S$={class:"new-thread-empty"},C$={class:"new-thread-hero"},x$=["title"],k$={class:"new-thread-folder-actions"},I$=["disabled"],A$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},_$={class:"new-thread-launch-card-copy"},P$={class:"new-thread-launch-card-topline"},M$={class:"new-thread-launch-card-badge","aria-hidden":"true"},E$={class:"new-thread-launch-card-eyebrow"},R$={class:"new-thread-launch-card-title"},j$={class:"new-thread-launch-card-text"},L$={class:"new-thread-launch-card-actions"},N$=["aria-label","onKeydown"],O$={class:"new-thread-open-folder-header"},$$={class:"new-thread-open-folder-title"},D$={class:"new-thread-open-folder-label"},F$={class:"new-thread-open-folder-current"},B$=["placeholder","title","disabled","onKeydown"],U$=["disabled"],z$={class:"new-thread-open-folder-actions"},H$={class:"new-thread-open-folder-toggle"},W$=["aria-pressed","disabled"],q$={key:0,class:"new-thread-open-folder-create"},G$={class:"new-thread-open-folder-create-composer"},V$=["placeholder","onKeydown"],K$=["disabled"],Y$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},J$=["href"],Q$=["placeholder","onKeydown"],X$={key:1,class:"new-thread-open-folder-error-actions"},Z$={class:"new-thread-open-folder-error visible-error-with-feedback"},eD=["href"],tD=["disabled"],nD={key:2,class:"new-thread-open-folder-status"},rD={key:3,class:"new-thread-open-folder-status"},oD={key:4,class:"new-thread-open-folder-list"},aD=["title","disabled","onClick"],sD={class:"new-thread-open-folder-item-name"},iD=["disabled","onClick"],lD=["aria-label","onKeydown"],uD={class:"new-thread-open-folder-header"},cD={class:"new-thread-open-folder-title"},dD=["disabled"],fD=["aria-label"],pD=["aria-selected","disabled"],hD=["aria-selected","disabled"],mD={class:"new-thread-project-field"},vD={class:"new-thread-open-folder-label"},gD=["disabled","placeholder"],yD={key:0,class:"new-thread-project-field"},wD={class:"new-thread-open-folder-label"},bD=["disabled","placeholder","onKeydown"],TD={key:1,class:"new-thread-project-field"},SD={class:"new-thread-open-folder-label"},CD=["disabled","onKeydown"],xD={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},kD=["href"],ID={class:"new-thread-project-modal-actions"},AD=["disabled"],_D=["disabled"],PD={key:3,class:"new-thread-branch-select"},MD={class:"new-thread-branch-select-label"},ED={class:"new-thread-branch-select-help"},RD={key:4,class:"new-thread-runtime-help"},jD={class:"worktree-init-status-title"},LD={class:"worktree-init-status-message"},ND={class:"composer-with-queue"},OD={key:0,class:"composer-runtime-error",role:"alert"},$D=["href"],DD={key:3,class:"content-grid"},FD={class:"content-thread"},BD={key:0,class:"external-session-banner",role:"alert"},UD={key:1,class:"composer-runtime-error",role:"alert"},zD=["href"],HD={key:2,class:"interrupt-recovered-banner",role:"status"},WD=["aria-label"],qD={class:"content-right-panel-header"},GD={class:"content-right-panel-tabs",role:"tablist"},VD=["aria-selected"],KD=["aria-selected"],YD=["aria-selected","title","onClick"],JD={class:"content-right-panel-tab-label"},QD=["aria-label","title","onClick"],XD={class:"content-right-panel-actions"},ZD={class:"content-right-panel-add-wrap"},eF=["aria-label","title"],tF={key:0,class:"content-right-panel-menu"},nF=["aria-label","title"],rF={class:"content-right-panel-body"},oF={key:0,class:"project-zip-modal-backdrop",role:"presentation"},aF=["aria-label"],sF={class:"project-zip-modal-header"},iF={class:"project-zip-modal-title"},lF=["aria-label","disabled"],uF={class:"project-zip-modal-copy"},cF={class:"project-zip-progress-label",role:"status","aria-live":"polite"},dF={class:"project-zip-progress-track"},fF={key:0,class:"project-zip-modal-error",role:"alert"},pF={class:"project-zip-modal-actions"},hF=["disabled"],mF=["disabled"],vF=["disabled"],gF=["aria-label"],yF={class:"codex-login-modal-header"},wF={class:"codex-login-modal-title"},bF=["aria-label","disabled"],TF={class:"codex-login-modal-copy"},SF=["href"],CF=["placeholder","disabled"],xF={key:1,class:"codex-login-modal-error visible-error-with-feedback"},kF=["href"],IF={class:"codex-login-modal-actions"},AF=["disabled"],_F=["disabled"],PF=400,hv="codex-web-local.send-with-enter.v1",mv="codex-web-local.in-progress-send-mode.v1",vv="codex-web-local.dark-mode.v1",gv="codex-web-local.dictation-click-to-toggle.v1",yv="codex-web-local.dictation-auto-send.v1",wv="codex-web-local.dictation-language.v1",bv="codex-web-local.chat-width.v1",MF=yn({__name:"App",setup(e){var Jp,Qp;const t=xo(()=>ko(()=>import("./ThreadConversation-CVVohemt.js"),__vite__mapDeps([0,1,2]))),n=xo(()=>ko(()=>import("./ThreadTerminalPanel-DhYhXg8u.js"),__vite__mapDeps([3,4]))),r=xo(()=>ko(()=>import("./ReviewPane-DO60w4j5.js"),__vite__mapDeps([5,6]))),o=xo(()=>ko(()=>import("./DirectoryHub-Yd0fIqxf.js"),__vite__mapDeps([7,1,8]))),a=xo(()=>ko(()=>import("./AutomationsPanel-CZ_k1aNL.js"),__vite__mapDeps([9,10]))),s=xo(()=>ko(()=>import("./SettingsDialog-D9kB2mzO.js"),__vite__mapDeps([11,12]))),i=xo(()=>ko(()=>import("./RightGitPanel-BxZdreeN.js"),__vite__mapDeps([13,14]))),l=xo(()=>ko(()=>import("./RightFilesPanel-r9ijJqw4.js"),__vite__mapDeps([15,16]))),c=xo(()=>ko(()=>import("./RightFilePreview-B2tx1lOm.js"),__vite__mapDeps([17,18]))),d=xo(()=>ko(()=>import("./ThreadPendingRequestPanel-DGbhyPFH.js"),__vite__mapDeps([19,20]))),v=xo(()=>ko(()=>import("./QueuedMessages-DSxRli0y.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:y,uiLanguageOptions:T,setUiLanguage:A}=ya(),U="codex-mobile",O="0.1.131",$={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},q={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:R,projectDisplayNameById:pe,selectedThread:ce,selectedThreadTokenUsage:K,selectedThreadServerRequests:le,selectedLiveOverlay:ye,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ge,selectedActiveTurnId:ee,codexQuota:me,selectedThreadId:re,availableCollaborationModes:Ie,availableModelIds:De,availableModelReasoningEfforts:Ne,selectedCollaborationMode:Le,selectedReasoningEffort:Ce,selectedSpeedMode:Se,codexCliMissingError:xe,installedSkills:Me,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:st,isLoadingThreads:de,isThreadListFullyLoaded:N,isLoadingMessages:oe,slowOpenThreadId:se,isLoadingOlderMessages:je,isSendingMessage:We,isInterruptingTurn:_,isSelectedThreadInterruptPending:E,isUpdatingSpeedMode:z,error:ue,refreshAll:ne,refreshSkills:ae,refreshHooks:_e,hooksList:Oe,isHooksLoading:ke,onRealtimeEvent:he,selectThread:Ke,ensureThreadMessagesLoaded:$e,loadMessages:qe,loadOlderMessages:Ge,archiveThreadById:ct,compactThreadById:bt,compactingThreadIds:nt,fuzzyFileSearchResults:it,registerFuzzyFileSearchSession:J,forkThreadById:fe,renameThreadById:Te,forkThreadFromTurn:Be,sendMessageToSelectedThread:Tt,sendMessageToNewThread:yt,interruptSelectedThreadTurn:Dt,interruptedUnsubmittedMessage:No,clearInterruptedUnsubmittedMessage:Gt,selectedThreadQueuedMessages:io,removeQueuedMessage:Zn,reorderQueuedMessage:wa,steerQueuedMessage:lo,autoCompactThreshold:Vs,setAutoCompactThreshold:ba,setSelectedCollaborationMode:es,readModelIdForThread:Or,setSelectedModelIdForThread:ts,injectModelSwitchDivision:$r,invalidateThreadContextWindow:Oo,setSelectedReasoningEffort:$o,updateSelectedSpeedMode:Ks,respondToPendingServerRequest:Do,pendingReplyErrorForRequest:Dr,renameProject:ns,removeProject:Ta,reorderProject:Fo,pinProjectToTop:uo,startPolling:co,stopPolling:Tr,primeSelectedThread:rs,rollbackSelectedThread:os}=LO(),vt=jx(),xt=Rx(),{isMobile:kt}=Jf();function dn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Hn=S(null),un=S(null),Sr=S(null);let dr=null;const{buildFeedbackMailto:Bo,feedbackMailtoBase:cn,recordVisibleFailure:er}=by(),Cr=cn();function Et(u,p){p&&er(p);const b=u.currentTarget;b instanceof HTMLAnchorElement&&(b.href=Bo())}const fo=S(null),tr=S(null),wn=S(null),Fr=S(0);let jn=null;function An(){const u=wn.value;if(!u)return;const p=window.getComputedStyle(u),b=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),D=Math.max(0,u.clientWidth-(Number.isFinite(b)?b:0)),X=p.getPropertyValue("--chat-column-max").trim(),we=Number.parseFloat(X)*(X.endsWith("rem")?16:1),Ue=Number.isFinite(we)&&we>0?Math.min(D,we):D;Fr.value=Ue}const bn=S(null),Sa=S(null),fr=S(!0),Br=HO({isMobile:()=>kt.value,canShowRightPanel:()=>gu.value,isVirtualKeyboardOpen:()=>xl.value}),{activeRightPanelTab:Bt,filePreviewTabs:po,activeFilePreviewTabKey:Uo,activeFilePreviewTab:zo,isRightPanelMenuOpen:Tn,isMobileRightPanelOpen:Jt,isRightPanelCollapsed:pr,rightPanelWidth:an,isTerminalInputFocused:Ho,isTerminalKeyboardFocusFallbackActive:Zt,onRightResizeHandleMouseDown:Ur,toggleRightPanelTerminal:Ca,selectRightPanelTab:Vt,onOpenFilePreview:Wo,selectFilePreviewTab:qo,closeFilePreviewTab:It,onCloseRightPanel:Sn,onToggleRightPanelToggle:Go,onHideRightPanelTerminal:xr,onTerminalFocusChange:kr,resetTerminalKeyboardFocusState:Vo,clearTerminalKeyboardFocusFallbackTimer:zr}=Br,Ko=S(null),nr=S(!1),ho=S("");let Yo=!1;const Ir=S(!1),ht=S(""),_n=S("local"),Cn=S({}),xa=new Map,Wn=S(""),k=S([]),L=S(!1),V=S({order:[],labels:{},projectOrder:[]}),be=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),ze=S({phase:"idle",title:"",message:""}),jt=DO(),{isSidebarCollapsed:At,isAccountsSectionCollapsed:en,sidebarSearchQuery:Kt,isSidebarSearchVisible:Hr,sidebarScrollableRef:ka,sidebarSearchInputRef:as,setSidebarCollapsed:fn,toggleSidebarSearch:Ia,clearSidebarSearch:Aa,onSidebarScroll:Ys,onSidebarSearchKeydown:Pn,toggleAccountsSectionCollapsed:ss}=jt,Js=S(null),is=S(null),_a=S(null),Jo=S(null);let tn=null,Qo=0,Wr=0,pn=0,mo=0;const vo=S("New Project (1)"),ls=S(""),sn=S(!1),_i=S("general");let hn=0;function Qs(){if(sn.value){hn=Date.now(),sn.value=!1;return}Date.now()-hn<PF||(sn.value=!0)}const rr=S(!1),us=S(!1),cs=S(new Set);async function bl(){try{cs.value=new Set(await TI())}catch{}finally{us.value=!0}}const Pi=Y(()=>!us.value||cs.value.has("hooks/list")),Xs=Y(()=>!us.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>cs.value.has(u)));rt(sn,u=>{u&&(_e(),fs(),Xs.value&&hs())});const Pt=S({enabled:!1,clients:[]}),Lt=S(null),ds=S(!1),Ar=S(!1),qn=S(""),qr=S(""),Xo=S("");let Ln=null,Zo=!1,go=null;const Pa=S("never"),ea=S(!1),Gr=S(!1),Vr=S(""),Kr=S("");let Mi=!1;const Ei=S(!1);async function fs(u={}){if(!(u.force!==!0&&Mi)){ea.value=!0,Vr.value="";try{Pa.value=await nA(),Mi=!0}catch(p){Vr.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{ea.value=!1}}}function Yr(u){Pa.value=u}async function ta(){Gr.value=!0,Vr.value="",Kr.value="";try{await rA(Pa.value),Ei.value=!0,Kr.value=f("Approval policy saved"),ps&&clearTimeout(ps),ps=setTimeout(()=>{Kr.value=""},2200)}catch(u){Vr.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{Gr.value=!1}}let ps=null;async function hs(u={}){if(!(u.force!==!0&&Zo)){ds.value=!0,qr.value="";try{const p=await tA();Pt.value=p,Zo=!0}catch(p){qr.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{ds.value=!1}}}async function Ri(){const u=!Pt.value.enabled;Ar.value=!0,qn.value=u?"enable":"disable";try{await oA(u),Pt.value={...Pt.value,enabled:u},or(u?"Remote control enabled":"Remote control disabled")}catch(p){qr.value=p instanceof Error?p.message:"Failed to update remote control"}finally{Ar.value=!1,qn.value=""}}async function Zs(){Ar.value=!0,qn.value="pairing";try{Lt.value=await aA()}catch(u){qr.value=u instanceof Error?u.message:"Failed to start pairing"}finally{Ar.value=!1,qn.value=""}}async function ms(){Ar.value=!0,qn.value="clients";try{Pt.value={...Pt.value,clients:await sA()}}catch(u){qr.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{Ar.value=!1,qn.value=""}}async function Tl(u){Ar.value=!0,qn.value=`revoke:${u}`;try{await iA(u),Pt.value={...Pt.value,clients:Pt.value.clients.filter(p=>p.clientId!==u)},or("Remote client removed")}catch(p){qr.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{Ar.value=!1,qn.value=""}}function or(u){Xo.value=u,Ln&&clearTimeout(Ln),Ln=setTimeout(()=>{Xo.value=""},3e3)}const hr=S(""),_r=S(""),Jr=S([]),mr=S(null),na=S(null),C=S(null),M=S(null),x=S(!1),Z=S(!1),Qe=S({addedLineCount:0,removedLineCount:0}),zt=S([]),Gn=S(""),vr=S({}),nn=S(""),Pr=S(""),Ma=S({}),ra=S(""),vs=S(""),gs=S(!1),Ea=S(!1);function jc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const du=S(null),Vn=S([]),oa=S(!1),yo=S(!1),aa=S(!1),Nn=S(!1),ji=S(!1),ei=S(""),Ra=S(""),Sl=S(null),ja=S(""),Qr=S(""),sa=S(""),mn=S(""),La=S(ad(hv,!0)),ys=S(vT()),ws=S(mT()),ti=S(gT()),bs=S(ad(gv,!1)),Ts=S(ad(yv,!0)),wo=S(jT()),Lc=Y(()=>LT()),Nc=Y(()=>{const{loaded:u,total:p}=be.value,b=Ap(u);return p&&p>0?`${b} / ${Ap(p)}`:u>0?b:f("Preparing...")}),Oc=Y(()=>{const{loaded:u,total:p,phase:b}=be.value;return b==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),Na=S(!1),ia=S(!1),Oa=S(!1),Ss=S(""),fu=S(!1),pu=S(null),Mn=S(!1),Mr=S(""),gr=S("codex"),ni=Y(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),Xr=S(""),ri=S(""),la=S("responses"),vn=S("responses"),Li=S(""),hu=S(!1),Ni=S(""),oi=S(""),ua=S(""),Oi=S(!1),ca=S(!1),Cs=S(""),Kn=S(""),h=S(!1),g=S(!1),I=S("create"),j=S(""),H=S(""),Q=S(""),W=S(!1),G=S(""),ie=S(!1),Ae=S(null),He=S(null),Ze=S(!1),mt=S(null),wt=S(null),pt=S(""),_t=S(""),On=S(""),ai=S([]),Qt=S(""),$n=S(!1),bo=S(!1),si=S(!1),Er=S(""),Cl=[ue,xe,Gn,Pr,mn,Mr,ua,Kn,G,Qt],mu=Y(()=>Cl.some(u=>u.value.trim().length>0)),Rr=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),$i=S(null),Di=S(!1),Fi=S(!1),da=S(typeof window<"u"?((Jp=window.visualViewport)==null?void 0:Jp.height)??window.innerHeight:0),Bi=S(typeof window<"u"?((Qp=window.visualViewport)==null?void 0:Qp.offsetTop)??0:0),xs=S(typeof window<"u"?window.innerHeight:0);let To=null,Ee=!1,Mt=!1,jr=!1,So=0;const $a=Y(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),xn=Y(()=>vt.name==="home"),ks=Y(()=>vt.name==="skills"),ii=Y(()=>vt.name==="automations"),lp=Y(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),aw=Y(()=>{var u;return ii.value?f("Automations"):ks.value?f("Skills"):xn.value?f("Start new thread"):((u=ce.value)==null?void 0:u.title)??f("Choose a thread")}),sw=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",iw=Y(()=>{var p,b;return(((b=(p=ce.value)==null?void 0:p.title)==null?void 0:b.trim())??"")||sw}),Ui=Y(()=>Xe.value.filter(u=>{const p=$T(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),$c=S([]);rt(()=>[Ui.value,oe.value],([u,p])=>{p||($c.value=u)},{immediate:!0});const lw=Y(()=>oe.value&&$c.value.length>0?$c.value:Ui.value),up=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Dc=S(null);function uw(u,p,b){const D=typeof p.turnIndex=="number"?p.turnIndex:-1;return D<0?!1:u.some((X,we)=>we>b&&typeof X.turnIndex=="number"&&X.turnIndex>=D&&up.has(X.messageType??""))}function cw(u,p){return u.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=p&&up.has(b.messageType??""))}const Fc=Y(()=>{const u=Ui.value,p=oe.value;for(let we=u.length-1;we>=0;we-=1){const Ue=u[we];if(Ue.messageType!=="plan"&&Ue.messageType!=="plan.live")continue;const Ht=Zm(Ue);if(!Ht||Dc.value!==null&&Ue.id===Dc.value)return null;const HT=p?!0:uw(u,Ue,we);return{id:Ue.id,streaming:Ue.messageType==="plan.live",explanation:Ht.explanation,steps:Ht.steps,implemented:HT}}const b=re.value?Pe.value[re.value]??null:null;if(!b)return null;const D=Zm(b);if(!D)return null;const X=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?ge(re.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:D.explanation,steps:D.steps,implemented:p?!0:X>=0?cw(u,X):!1}}),dw=Y(()=>ye.value),Is=Y(()=>xn.value?"__new-thread__":re.value),cp=Y(()=>Or(Is.value)),vu=Y(()=>{const u=le.value;return u.length>0?u[u.length-1]:null}),fw=Y(()=>vu.value?Dr(vu.value.id):""),kn=Y(()=>{var u,p;return xn.value?ht.value.trim():((p=(u=ce.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),gu=Y(()=>fr.value&&(xn.value&&kn.value.length>0||vt.name==="thread"&&re.value.length>0)),pw=Y(()=>gu.value&&Bt.value==="terminal"),xl=Y(()=>!kt.value||da.value<=0||xs.value<=0?!1:xs.value-da.value>120),hw=Y(()=>xl.value||pw.value&&Zt.value),dp=Y(()=>{var u,p;return((p=(u=ce.value)==null?void 0:u.cwd)==null?void 0:p.trim())??ht.value.trim()}),Bc=Y(()=>{var u;return!xn.value&&((u=ce.value)==null?void 0:u.inProgress)===!0}),mw=Y(()=>{const u=re.value;return!!u&&nt.value.has(u)}),fp=Y(()=>{var u,p;return!xn.value&&((p=(u=ce.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Uc=Y(()=>We.value||_.value||Bc.value||le.value.length>0);function pp(){Na.value&&(Na.value=!1,GI(!0))}function vw(){pp(),xt.push({name:"skills",query:{tab:"plugins"}})}function gw(){const u=re.value;u&&bt(u)}function zc(u,p){const b=et(u).trim(),D=Lr(b);return!b||!D?!1:p.some(X=>{const we=et(X).trim();return we!==b&&Lr(we)===D})}function Hc(u,p=""){const b=et(u).trim(),D=p.trim();if(D)return D;const X=Lr(b),we=[...V.value.order,...R.value.map(Ue=>{var Ht,yr;return((yr=(Ht=Ue.threads[0])==null?void 0:Ht.cwd)==null?void 0:yr.trim())??""}).filter(Boolean)];return zc(b,we)?b:X}function yw(){const u=new Set(V.value.order),p=V.value.projectOrder.filter(b=>u.has(b));for(const b of V.value.order)p.includes(b)||p.push(b);return p}function kl(u){const p=et(u).trim(),b=[...V.value.order,...R.value.map(D=>{var X,we;return((we=(X=D.threads[0])==null?void 0:X.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];return zc(p,b)?p:Lr(p)}function hp(u){const p=et(u).trim();if(!p)return"";const b=[...V.value.order,...R.value.map(D=>{var X,we;return((we=(X=D.threads[0])==null?void 0:X.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];for(const D of V.value.order){const X=et(D).trim();if(!X)continue;const we=Lr(X),Ue=zc(X,b)?X:we;if(X===p||Ue===p||we===p)return X}return""}const Wc=Y(()=>{var D,X;const u=[],p=new Set;for(const we of yw()){const Ue=we.trim();!Ue||p.has(Ue)||(p.add(Ue),u.push({value:Ue,label:Hc(Ue,V.value.labels[Ue])}))}for(const we of R.value){const Ue=((X=(D=we.threads[0])==null?void 0:D.cwd)==null?void 0:X.trim())??"";!Ue||p.has(Ue)||sc(Ue)||(p.add(Ue),u.push({value:Ue,label:Hc(Ue,pe.value[we.projectName])}))}const b=ht.value.trim();return b&&!p.has(b)&&u.unshift({value:b,label:Hc(b)}),u}),li=Y(()=>{const u=ht.value.trim();return u?Cn.value[u]===!0:!1}),ww=Y(()=>{var p,b;const u={};for(const D of R.value){const X=Hi(D.projectName,((b=(p=D.threads[0])==null?void 0:p.cwd)==null?void 0:b.trim())??"");u[D.projectName]=X?Cn.value[X]===!0:!1}return u}),qc=Y(()=>{const u=Wn.value.trim(),p=[...k.value];return u&&!p.some(b=>b.value===u)&&p.unshift({value:u,label:u}),p}),mp=Y(()=>{const u=Wn.value.trim();if(!u)return"";const p=qc.value.find(b=>b.value===u);return(p==null?void 0:p.label)??u}),vp=Y(()=>_t.value.trim()),gp=Y(()=>{const u=Cs.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),bw=Y(()=>gp.value&&vp.value.trim().length>0&&!Qt.value),yp=Y(()=>{const u=H.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),wp=Y(()=>j.value.trim()?I.value==="create"?yp.value:Q.value.trim().length>0:!1),Il=Y(()=>{const u=et(pt.value).trim();return u||_t.value.trim()}),Tw=Y(()=>h.value?"Creating…":"Create"),Sw=Y(()=>ie.value?I.value==="clone"?f("Cloning…"):f("Creating…"):I.value==="clone"?f("Clone repository"):f("Create project")),Cw=Y(()=>{const u=_t.value.trim(),p=On.value.trim();return!!(u&&p&&u!==p)}),bp=Y(()=>{const u=[];Cw.value&&u.push({key:`parent:${On.value}`,name:"..",path:On.value,kind:"parent"});for(const p of ai.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Gc=Y(()=>{const u=Er.value.trim().toLowerCase();return u?bp.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):bp.value}),zi=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,xw=Y(()=>f($[ti.value].label)),kw=Y(()=>{const u=$[ti.value],p=Math.max(0,xs.value-da.value-Bi.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":da.value>0?`${da.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Bi.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),Iw=Y(()=>{if(!Rr.value.configured)return f("Not configured");const u=Rr.value.active?f("Online"):f("Configured (offline)"),p=Rr.value.allowAllUsers?f("allow all users"):`${Rr.value.allowedUsers} ${f("allowed user(s)")}`,b=`${Rr.value.mappedChats} ${f("chat(s)")}, ${Rr.value.mappedThreads} ${f("thread(s)")}, ${p}`,D=Rr.value.lastError?`, ${f("error")}: ${Rr.value.lastError}`:"";return`${u}, ${b}${D}`});Ii(()=>{var u,p;document.addEventListener("pointerdown",Rp),window.addEventListener("keydown",Ep),document.addEventListener("visibilitychange",jp),window.addEventListener("pageshow",Lp),window.addEventListener("focus",Np),window.addEventListener("resize",ui),(u=window.visualViewport)==null||u.addEventListener("resize",ui),(p=window.visualViewport)==null||p.addEventListener("scroll",ui),ui(),ku(),zi==null||zi.addEventListener("change",ku),dr=he(b=>{Sr.value&&Sr.value.refreshFromNotification(b)}),go=he(b=>{b==="remoteControl/status/changed"&&hs({force:!0})}),DT(),iT(),bl(),Pw(),_s(),Co(),Sp(),Vc(),sd(),_b(),fs()}),rt(Cl,(u,p)=>{u.forEach((b,D)=>{if(b===p[D])return;const X=b.trim();X&&er(X)})}),rt(wn,u=>{if(jn&&(jn.disconnect(),jn=null),typeof ResizeObserver<"u"){jn=new ResizeObserver(An),u&&jn.observe(u);return}An()},{immediate:!0}),iu(()=>{var u,p;document.removeEventListener("pointerdown",Rp),window.removeEventListener("keydown",Ep),document.removeEventListener("visibilitychange",jp),window.removeEventListener("pageshow",Lp),window.removeEventListener("focus",Np),window.removeEventListener("resize",ui),(u=window.visualViewport)==null||u.removeEventListener("resize",ui),(p=window.visualViewport)==null||p.removeEventListener("scroll",ui),zi==null||zi.removeEventListener("change",ku),jn&&(jn.disconnect(),jn=null),To!==null&&(window.clearInterval(To),To=null),tn&&(clearTimeout(tn),tn=null),zr(),Tr(),dr&&(dr(),dr=null),go&&(go(),go=null),Ln&&(clearTimeout(Ln),Ln=null)});function ui(){var u,p;typeof window>"u"||(xs.value=Math.max(xs.value,window.innerHeight),da.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Bi.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}rt(Kt,u=>{const p=u.trim();if(tn&&(clearTimeout(tn),tn=null),!p){Jo.value=null;return}tn=setTimeout(()=>{nk(p,1e3).then(b=>{Kt.value.trim()===p&&(Jo.value=b.threadIds)}).catch(()=>{Kt.value.trim()===p&&(Jo.value=null)})},220)}),rt(xl,u=>{u||(Zt.value=!1)}),rt(Vn,()=>{if(typeof window>"u")return;if(!Vn.value.some(p=>p.quotaStatus==="loading")){To!==null&&(window.clearInterval(To),To=null);return}To===null&&(To=window.setInterval(()=>{Ee||(Ee=!0,Al({silent:!0}).finally(()=>{Ee=!1}))},1500))},{deep:!0}),rt(Je,()=>{Tp().then(u=>{u&&ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Tp(){if(!Mt||jr||gr.value!=="codex"||Vn.value.length>0||Je.value.length===0)return!1;jr=!0;const u=JSON.stringify(Vn.value.map(b=>b.accountId).sort());try{const b=await Am();Vn.value=b.accounts}catch{await Al({silent:!0})}const p=JSON.stringify(Vn.value.map(b=>b.accountId).sort());return u!==p}function Aw(){ae({force:!0})}function _w(u){u&&qe(u,{silent:!0,force:!0})}async function Vc(){try{Rr.value=await $I()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";Rr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function Sp(){try{const u=await OI();Ni.value=u.botToken,oi.value=u.allowedUserIds.map(p=>String(p)).join(`
79
+ `),ua.value=""}catch(u){ua.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function Pw(){const u=await qI();Na.value=u.dismissed!==!0}function Mw(u){const p=u.split(/[\n,]/).map(X=>X.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=p.includes("*"),D=Array.from(new Set(p.filter(X=>/^-?\d+$/.test(X)).map(X=>Number.parseInt(X,10))));return b?["*",...D]:D}async function Ew(){const u=Ni.value.trim(),p=Mw(oi.value);if(!u){ua.value=f("Telegram bot token is required.");return}if(p.length===0){ua.value=f("At least one allowed Telegram user ID or * is required.");return}Oi.value=!0,ua.value="";try{await NI(u,p),oi.value=p.map(b=>String(b)).join(`
80
+ `),await Promise.all([Sp(),Vc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){ua.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),Vc()}finally{Oi.value=!1}}const yu=S(""),Rw=Y(()=>yu.value||re.value);rt(re,()=>{yu.value=""});function jw(){return new Promise(u=>{let p=!1;const b=()=>{p||(p=!0,u())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let Kc=0;function Lw(u){if(!u)return;if(vt.name==="thread"&&$a.value===u){Kc+=1,yu.value="";return}yu.value=u;const p=Kc+=1;jw().then(()=>{p===Kc&&xt.push({name:"thread",params:{threadId:u}})}),kt.value&&fn(!0)}function Nw(u){vt.name==="automations"&&lp.value!==u&&xt.replace({name:"automations",query:u?{automationId:u}:{}})}async function Ow(u){var p;At.value&&(fn(!1),await Ft()),(p=Hn.value)==null||p.openAutomationEditorFromPanel(u)}async function $w(){var u;At.value&&(fn(!1),await Ft()),(u=Hn.value)==null||u.openAutomationCreatorFromPanel()}function Dw(){var u;vt.name==="automations"&&((u=un.value)==null||u.loadAutomations())}async function Fw(u){u&&re.value===u&&await fT()}function Bw(u){return u.length>8?u.slice(-8):u}function Cp(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function Uw(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function wu(u){return u.unavailableReason==="payment_required"||Uw(u.quotaError)}function zw(u){return oa.value||yo.value||aa.value||Nn.value||ja.value.length>0||u.isActive&&ja.value!==u.storageId&&Uc.value}function Yc(u){return Qr.value===u.storageId}function Hw(u){return sa.value===u.storageId||Yc(u)}function Ww(u){return wu(u)?f("Unavailable"):u.isActive?f("Active"):yo.value?f("Switching…"):f("Switch")}function qw(u){return ja.value===u.storageId?f("Removing…"):Yc(u)?f("Click again to remove"):f("Remove")}function Gw(u){sa.value=u}function Vw(u){sa.value===u&&(sa.value=""),ja.value!==u&&Qr.value===u&&(Qr.value="")}function Kw(u){const p=u.quotaSnapshot;if(!p)return null;const b=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(we=>we!==null),D=b.find(we=>we.windowMinutes===7*24*60);if(D)return D;const X=b.filter(we=>typeof we.windowMinutes=="number"&&we.windowMinutes>=7*24*60).sort((we,Ue)=>(we.windowMinutes??0)-(Ue.windowMinutes??0))[0]??null;return X||(p.secondary??null)}function Yw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function xp(u){var we,Ue;if(wu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,b=Kw(u),D=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,X=b??D;if(X){const Ht=Math.max(0,Math.min(100,100-Math.round(X.usedPercent))),yr=Yw(X.resetsAt);return yr?`${Ht}% ${f("weekly remaining")} · ${yr}`:`${Ht}% ${f("weekly remaining")}`}return(we=p==null?void 0:p.credits)!=null&&we.unlimited?f("Unlimited credits"):(Ue=p==null?void 0:p.credits)!=null&&Ue.hasCredits&&p.credits.balance?`${p.credits.balance} ${f("credits")}`:u.quotaStatus==="loading"?f("Loading quota…"):u.quotaStatus==="error"?u.quotaError||f("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function Jw(u){return[u.email||f("Account"),Cp(u),wu(u)?f("Unavailable account"):null,xp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
81
+ `)}async function Al(u={}){try{const p=await uA();Vn.value=p.accounts,p.accounts.some(b=>b.storageId===sa.value)||(sa.value=""),p.accounts.some(b=>b.storageId===Qr.value)||(Qr.value="")}catch(p){if(u.silent===!0)return;mn.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Qw(){if(!(oa.value||yo.value||aa.value||Nn.value)){mn.value="",sa.value="",Qr.value="",oa.value=!0;try{const u=await Am();Vn.value=u.accounts,Tr(),co(),ne({includeSelectedThreadMessages:!0})}catch(u){mn.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{oa.value=!1}}}async function Xw(u){if(!(yo.value||oa.value||aa.value||Nn.value)){if(Uc.value){mn.value=f("Finish the current turn and pending requests before switching accounts.");return}mn.value="",sa.value="",Qr.value="",yo.value=!0;try{const p=await fA(u);Vn.value=Vn.value.map(b=>b.storageId===u?p:{...b,isActive:!1}),Tr(),co(),ne({includeSelectedThreadMessages:!0}),Al({silent:!0})}catch(p){mn.value=p instanceof Error?p.message:f("Failed to switch account")}finally{yo.value=!1}}}async function Zw(){var u;if(!(oa.value||yo.value||aa.value||Nn.value)){mn.value="",Ra.value="",aa.value=!0;try{const p=await cA();ei.value=p,ji.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Ft(),(u=Sl.value)==null||u.focus()}catch(p){mn.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{aa.value=!1}}}function Jc(){Nn.value||(ji.value=!1,Ra.value="")}async function eb(){const u=Ra.value.trim();u&&await tb(u)}async function tb(u){if(!(Nn.value||u.length===0)){mn.value="",Nn.value=!0;try{const p=await dA(u);Vn.value=p.accounts,ei.value="",Ra.value="",ji.value=!1,Tr(),co(),ne({includeSelectedThreadMessages:!0})}catch(p){mn.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{Nn.value=!1}}}async function nb(u){if(oa.value||yo.value||aa.value||Nn.value||ja.value.length>0)return;const p=Vn.value.find(D=>D.storageId===u)??null;if(!p)return;if(Qr.value!==u){Qr.value=u;return}if(p.isActive&&Uc.value){mn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=p.isActive;mn.value="",Qr.value="",ja.value=u;try{const D=await pA(u);Vn.value=D.accounts,Tr(),co(),b&&ne({includeSelectedThreadMessages:!0}),Al({silent:!0})}catch(D){mn.value=D instanceof Error?D.message:f("Failed to remove account")}finally{ja.value=""}}function rb(u){ct(u)}function ob(u){ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function ab(u){const p=await fe(u);p&&(xn.value?await xt.replace({name:"thread",params:{threadId:p}}):await xt.push({name:"thread",params:{threadId:p}}),kt.value&&fn(!0))}function kp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function Hi(u,p=""){var we,Ue,Ht;const b=R.value.find(yr=>yr.projectName===u);if(!b)return hp(u)||p.trim();const D=b.threads.find(yr=>!kp(yr.cwd));return(((we=D==null?void 0:D.cwd)==null?void 0:we.trim())??((Ht=(Ue=b.threads[0])==null?void 0:Ue.cwd)==null?void 0:Ht.trim())??"")||hp(u)||p.trim()}function sb(u){var D,X;const p=R.value.find(we=>we.projectName===u),b=Hi(u,((X=(D=p==null?void 0:p.threads[0])==null?void 0:D.cwd)==null?void 0:X.trim())??"");b&&(ht.value=b),kt.value&&fn(!0),!xn.value&&xt.push({name:"home"})}function ib(u){var b;let p="";for(const D of R.value){const X=D.threads.find(we=>we.id===u);if((b=X==null?void 0:X.cwd)!=null&&b.trim()){p=X.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function bu(u){var b,D;const p=R.value.find(X=>X.projectName===u);return Hi(u,((D=(b=p==null?void 0:p.threads[0])==null?void 0:b.cwd)==null?void 0:D.trim())??"")}const Ip=Y(()=>Object.fromEntries(R.value.map(u=>[u.projectName,bu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function lb(u){return(pe.value[u]??u).trim()||u}function ub(u){return lb(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function cb(u){const p=bu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function db(u){const p=bu(u);await Pp(p)}async function fb(u){const p=pb(u);await Pp(p)}function pb(u){var p;for(const b of R.value){const D=b.threads.find(X=>X.id===u);if((p=D==null?void 0:D.cwd)!=null&&p.trim())return D.cwd.trim()}return""}function Ap(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let b=u,D=0;for(;b>=1024&&D<p.length-1;)b/=1024,D+=1;return`${b>=10||D===0?b.toFixed(0):b.toFixed(1)} ${p[D]}`}function hb(u,p){const b=URL.createObjectURL(u),D=document.createElement("a");D.href=b,D.download=p,document.body.appendChild(D),D.click(),document.body.removeChild(D),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function mb(u,p){const D={files:[new File([u],p,{type:u.type||"application/zip"})],title:p};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(D))))throw new Error("File sharing is not supported in this browser.");await navigator.share(D)}function _p(){be.value.phase!=="exporting"&&(be.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function vb(){const{blob:u,fileName:p}=be.value;!u||!p||(be.value={...be.value,error:""},hb(u,p))}async function gb(){const{blob:u,fileName:p}=be.value;if(!(!u||!p))try{be.value={...be.value,error:""},await mb(u,p)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const D=b instanceof Error?b.message:"",X=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(D);be.value={...be.value,error:X?f("This browser blocked sharing the ZIP. Use Download instead."):D||f("Failed to share project. Use Download instead.")}}}async function Pp(u){if(!(!u||typeof document>"u")){be.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:b}=await AA(u,({loaded:D,total:X})=>{be.value={...be.value,phase:"exporting",loaded:D,total:X}});be.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:b,error:""}}catch(p){if(be.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const b=p instanceof Error?p.message:"Failed to export project.";window.alert(b)}}}async function yb(u){const p=bu(u);if(!p||typeof window>"u"||(await Tu(p),Cn.value[p]!==!0))return;const b=`${ub(u)}-`,D=window.prompt("New worktree folder name",b);if(D===null)return;const X=D.trim();if(X){if(X.includes("/")||X.includes("\\")||X==="."||X===".."){window.alert("Worktree name must be a single folder name.");return}try{const we=await gA(p,X),Ue=await ju(we.cwd,{createIfMissing:!1,label:""});if(!Ue)return;ht.value=Ue,_n.value="local",uo(kl(Ue)),await _s(),await Co(),kt.value&&fn(!0),xn.value||await xt.push({name:"home"})}catch(we){const Ue=we instanceof Error?we.message:"Failed to create worktree.";window.alert(Ue)}}}function wb(){var b,D,X;const u=ce.value;if(!u)return"";const p=((b=u.projectName)==null?void 0:b.trim())??"";return p?Hi(p,((X=u.cwd)==null?void 0:X.trim())??""):((D=u.cwd)==null?void 0:D.trim())??""}function Qc(){const u=wb();u&&(ht.value=u),_n.value="local",kt.value&&fn(!0),!xn.value&&xt.push({name:"home"})}function bb(){ht.value="",_n.value="local",kt.value&&fn(!0),!xn.value&&xt.push({name:"home"})}async function Tu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(Cn.value,p))return;const b=xa.get(p);if(b){const we=await b;Object.prototype.hasOwnProperty.call(Cn.value,p)||(Cn.value={...Cn.value,[p]:we});return}const D=bA(p).then(we=>we.isGitRepo).catch(()=>!1).finally(()=>{xa.delete(p)});xa.set(p,D);const X=await D;Object.prototype.hasOwnProperty.call(Cn.value,p)||(Cn.value={...Cn.value,[p]:X})}function Tb(u){ns(u.projectName,u.displayName)}function Sb(u){Te(u.threadId,u.title)}async function Cb(u){await Ta(u),await _s(),Co()}function xb(u){Fo(u.projectName,u.toIndex)}function kb(u){var D,X;const p=R.value.find(we=>we.projectName===u),b=Hi(u,((X=(D=p==null?void 0:p.threads[0])==null?void 0:D.cwd)==null?void 0:X.trim())??"");Tu(b)}function Mp(u){Ib(u)}async function Ib(u){var D;const p=await Do(u),b=((D=u.followUpMessageText)==null?void 0:D.trim())??"";if(!(!p||!b||xn.value))try{await Tt(b,[],[],"steer",[])}catch{}}async function Ab(u){const p=await Be(u.threadId,u.turnIndex);p&&(await xt.push({name:"thread",params:{threadId:p}}),re.value!==p&&await Ke(p),kt.value&&fn(!0))}function Ep(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&sn.value){sn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(dn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),fn(!At.value);return}if(p==="j"&&vt.name==="thread"&&re.value){u.preventDefault(),Ca();return}p==="j"&&xn.value&&kn.value&&(u.preventDefault(),Ca())}async function _b(){try{const u=await ok();fr.value=u.available,!u.available&&Bt.value==="terminal"&&(Bt.value="git",Vo())}catch{fr.value=!1,Bt.value==="terminal"&&(Bt.value="git")}}function Rp(u){var b,D;const p=u.target;if(p instanceof Node){if(Ho.value){const X=p instanceof Element?p:p.parentElement;X!=null&&X.closest(".thread-terminal-panel")||Vo()}sn.value&&((b=is.value)!=null&&b.containsTarget(p)||(D=_a.value)!=null&&D.contains(p)||(hn=Date.now(),sn.value=!1))}}function Pb(u){var b,D;if(!sn.value)return;const p=u.target;p instanceof Node&&((b=is.value)!=null&&b.containsTarget(p)||(D=_a.value)!=null&&D.contains(p)||(hn=Date.now(),sn.value=!1))}function Mb(){var u;(u=Hn.value)==null||u.openRecycleBin()}function jp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){$i.value=Date.now(),Di.value=!1;return}Xc()}}function Lp(u){u.persisted&&Xc()}function Np(){vt.name==="home"&&(_s(),Co()),Xc()}function Xc(){typeof window>"u"||typeof document>"u"||VO(document.visibilityState,$i.value,Di.value,Date.now())&&(Di.value=!0,$i.value=null,Eb())}async function Eb(){if(!Fi.value){Fi.value=!0;try{await ne({includeSelectedThreadMessages:!1}),await ld()}finally{Fi.value=!1}}}function Op(u){const p=u.text;Su();const b=Ko.value,D=u.mode==="queue"&&b&&b.threadId===re.value?b.queueIndex:void 0;if(Ko.value=null,xn.value){FT(p,u.imageUrls,u.skills,u.fileAttachments);return}Tt(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,D)}function Rb(u){const p=io.value.findIndex(we=>we.id===u),b=p>=0?io.value[p]:void 0,D=tr.value;if(!b||!D||D.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Ko.value=re.value?{threadId:re.value,queueIndex:p}:null;const X={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(we=>({...we})),skills:b.skills.map(we=>({...we}))};D.hydrateDraft(X),Zn(u)}function Su(){if(!kt.value||xn.value)return;const u=()=>{var p;(p=bn.value)==null||p.jumpToLatest()};u(),Ft(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function jb(u){ht.value=u.trim(),Kn.value=""}function Lb(u){Wn.value=u.trim()}function As(u){const p=kn.value.trim();return!u||p!==u?!1:vt.name==="thread"||vt.name==="home"&&li.value}function $p(){Qo+=1,Wr+=1,pn+=1,mo+=1,Jr.value=[],mr.value=null,na.value=null,C.value=null,M.value=null,x.value=!1,Z.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},zt.value=[],vr.value={},nn.value="",Pr.value="",Ma.value={},ra.value="",vs.value="",Gn.value="",gs.value=!1}function Dp(u){const p=u.trim();if(!p){Qe.value={addedLineCount:0,removedLineCount:0};return}const b=++mo;DA(p,"unstaged").then(D=>{b!==mo||!As(p)||(Qe.value={addedLineCount:D.addedLineCount,removedLineCount:D.removedLineCount})}).catch(()=>{b!==mo||!As(p)||(Qe.value={addedLineCount:0,removedLineCount:0})})}async function _l(u){var D,X,we;const p=u.trim();if(!p){$p();return}const b=++Qo;gs.value=!0,Gn.value="";try{const Ue=await wA(p);if(b!==Qo||!As(p))return;Jr.value=Ue.options,mr.value=Ue.currentBranch,na.value=Ue.headSha,C.value=Ue.headSubject,M.value=Ue.headDate,x.value=Ue.detached,Z.value=Ue.dirty,zt.value=Ue.changedFiles,Dp(p);const Ht=((D=Ue.currentBranch)==null?void 0:D.trim())||((we=(X=Ue.options[0])==null?void 0:X.value)==null?void 0:we.trim())||"";Ht&&Fp({branch:Ht,includeResetHistory:!0})}catch{if(b!==Qo||!As(p))return;Jr.value=[],mr.value=null,na.value=null,C.value=null,M.value=null,x.value=!1,Z.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},zt.value=[]}finally{b===Qo&&(gs.value=!1)}}function Nb(u){mr.value=u.currentBranch,na.value=u.headSha,C.value=u.headSubject,M.value=u.headDate,x.value=u.detached,Z.value=u.dirty,zt.value=u.changedFiles,Dp(kn.value)}function Ob(u){if(Ea.value)return;const p=u.trim();if(!p||p===(mr.value??""))return;const b=kn.value.trim();b&&(Ea.value=!0,Gn.value="",TA(b,p).then(D=>(mr.value=D||p,na.value=null,C.value=null,M.value=null,x.value=!1,rr.value=!1,_l(b))).catch(D=>{const X=D instanceof Error?D.message:"Failed to switch branch";_l(b).finally(()=>{Gn.value=X})}).finally(()=>{Ea.value=!1}))}function $b(u){if(Ea.value)return;const p=u.branch.trim(),b=u.sha.trim(),D=kn.value.trim();!p||!b||!D||(Ea.value=!0,Gn.value="",xA(D,p,b).then(X=>(Nb(X),rr.value=!1,_l(D))).catch(X=>{const we=X instanceof Error?X.message:"Failed to reset branch to commit";_l(D).finally(()=>{Gn.value=we})}).finally(()=>{Ea.value=!1}))}function Fp(u){const p=(typeof u=="string"?u:u.branch).trim(),b=typeof u=="string"?!0:u.includeResetHistory!==!1,D=kn.value.trim(),X=jc(p,b);if(!p||!D||nn.value===X||(Pr.value="",vr.value[X]))return;const we=++Wr;nn.value=X,SA(D,p,{includeResetHistory:b}).then(Ue=>{we!==Wr||!As(D)||(vr.value={...vr.value,[X]:Ue})}).catch(Ue=>{we!==Wr||!As(D)||(Pr.value=Ue instanceof Error?Ue.message:"Failed to load branch commits")}).finally(()=>{we===Wr&&nn.value===X&&(nn.value="")})}function Db(u){const p=u.trim(),b=kn.value.trim();if(!p||!b||ra.value===p||(vs.value="",Ma.value[p]))return;const D=++pn;ra.value=p,CA(b,p).then(X=>{D!==pn||!As(b)||(Ma.value={...Ma.value,[p]:X})}).catch(X=>{D!==pn||!As(b)||(vs.value=X instanceof Error?X.message:"Failed to load commit files")}).finally(()=>{D===pn&&ra.value===p&&(ra.value="")})}function Fb(u){const p=u.path.trim(),b=u.sha.trim();!p||!b||(hr.value=p,_r.value=b,rr.value=!0)}function Bb(){hr.value="",_r.value="",rr.value=!rr.value}function Ub(){!hr.value&&!_r.value||(hr.value="",_r.value="",rr.value=!1)}async function zb(){const u=await xu();u&&(await Co(),j.value=u,H.value=vo.value.trim()||"New Project (1)",Q.value="",G.value="",I.value="create",g.value=!0,Ft(()=>{var p;return(p=Ae.value)==null?void 0:p.focus()}))}function Cu(){ie.value||(g.value=!1,G.value="")}let Zc=!1,ed=!1;function Hb(){Zc=!0}function Wb(){Zc&&(Zc=!1,Wi())}function qb(){ed=!0}function Gb(){ed&&(ed=!1,Cu())}async function Vb(){const u=j.value.trim(),p=H.value.trim();if(!yp.value)throw new Error("Enter a single project folder name.");const b=Hp(zp(u,p));return b?ju(b,{createIfMissing:!0,label:""}):""}async function Kb(){const u=j.value.trim(),p=Q.value.trim();return p?EA(p,u):""}async function td(){if(!(!wp.value||ie.value)){G.value="",ie.value=!0;try{const u=I.value==="clone"?await Kb():await Vb();if(!u)return;ht.value=u,uo(kl(u)),await _s(),await Co(),g.value=!1}catch(u){G.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{ie.value=!1}}}function Yb(){Jb(He.value)}function Jb(u){W.value||!u||(u.value="",u.click())}async function Qb(u,p,b){W.value=!0;try{const D=await xu();if(!D)return;const X=await p(D);if(!X.path)return;ht.value=X.path,uo(kl(X.path)),await _s(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Co()}catch(D){const X=D instanceof Error?D.message:b;window.alert(X)}finally{W.value=!1,u&&(u.value="")}}async function Xb(u){var D;const p=u.target instanceof HTMLInputElement?u.target:null,b=((D=p==null?void 0:p.files)==null?void 0:D[0])??null;!b||W.value||await Qb(p,X=>_A(b,X),"Failed to import project.")}async function Zb(){const u=ht.value.trim()||await xu();u&&(ca.value=!1,Ze.value=!0,Er.value="",await Ps(u),Qt.value||Ft(()=>{var p;return(p=mt.value)==null?void 0:p.focus()}))}function Wi(){So+=1,Ze.value=!1,$n.value=!1,Qt.value="",Er.value="",pt.value="",Pl()}async function eT(u){!u||$n.value||(Er.value="",await Ps(u))}function tT(){const u=_t.value.trim();!Ze.value||!u||Ps(u)}function nT(){const u=Il.value;!Ze.value||!u||$n.value||Ps(u)}function rT(){if(!Ze.value||$n.value||bo.value)return;const u=Il.value,p=_t.value.trim();!u||u===p||Ps(u)}function oT(){const u=Il.value,p=_t.value.trim();if(u){if(u!==p){Ps(u);return}nd(u)}}async function nd(u=Il.value){const p=et(u).trim();if(p){Qt.value="",bo.value=!0;try{const b=await ju(p,{createIfMissing:!1,label:""});if(!b){Qt.value="Failed to open the selected folder.";return}ht.value=b,uo(kl(b)),await _s(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Co(),Wi()}catch(b){Qt.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{bo.value=!1}}}async function aT(){if(Kn.value="",ca.value){Pl();return}if(!Ze.value){const u=ht.value.trim()||await xu();if(!u||(Ze.value=!0,Er.value="",await Ps(u),Qt.value))return}Qt.value||(Cs.value=vo.value,ca.value=!0,Ft(()=>{var u;return(u=du.value)==null?void 0:u.focus()}))}function Pl(){Kn.value="",Cs.value="",ca.value=!1}async function Bp(){const u=Cs.value.trim();if(!u)return;if(Kn.value="",Qt.value){Kn.value="Reload the current folder before creating a new one.";return}h.value=!0;const p=vp.value.trim(),b=Hp(zp(p,u));if(!b){Kn.value="Unable to determine where the new folder should be created.",h.value=!1;return}if(!gp.value){Kn.value="Enter a single folder name.",h.value=!1;return}try{const D=await MA(b);if(!D){Kn.value="Failed to create the folder.";return}Kn.value="",Er.value="",await Ps(D),Pl()}catch(D){Kn.value=D instanceof Error?D.message:"Failed to create folder."}finally{h.value=!1}}async function sT(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const b=await ju(u,{createIfMissing:!1,label:""});if(!b)return!1;ht.value=b,uo(kl(b)),await xt.replace({name:"home"}),await _s();const D=new URL(window.location.href);return D.searchParams.delete("openProjectPath"),window.history.replaceState({},"",D.toString()),!0}catch{return!1}}async function xu(){const u=Up();if(u)return u;try{const p=await _m();if(p)return ls.value=p,p}catch{}return""}async function Co(){const u=Up();if(!u){vo.value="New Project (1)";return}try{const p=await jA(u);vo.value=p.name||"New Project (1)"}catch{vo.value="New Project (1)"}}function Up(){var b,D;const u=ht.value.trim();if(u)return sl(u);const p=((D=(b=Wc.value[0])==null?void 0:b.value)==null?void 0:D.trim())??"";return p?sl(p):ls.value.trim()}async function iT(){try{ls.value=await _m()}catch{ls.value=""}}async function _s(){try{const u=await Zi();V.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{V.value={order:[],labels:{},projectOrder:[]}}}async function Ps(u){const p=++So,b=et(u).trim();pt.value=b,_t.value=b,Qt.value="",$n.value=!0;try{const D=await PA(u,{showHidden:si.value});if(p!==So)return;pt.value=D.path,_t.value=D.path,On.value=D.parentPath,ai.value=D.entries}catch(D){if(p!==So)return;Qt.value=D instanceof Error?D.message:"Failed to load local folders.",On.value=sl(_t.value),ai.value=[],Pl()}finally{p===So&&($n.value=!1)}}function zp(u,p){const b=et(u).trim(),D=et(p).trim().replace(/^[\\/]+/u,"");if(!b||!D)return"";const X=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${X}${D}`;if(/^\/+$/u.test(b))return`/${D}`;const we=b.replace(/[\\/]+$/u,"");return we?`${we}${X}${D}`:""}function Hp(u){const p=et(u).trim();if(!p)return"";const b=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,X,we,Ue=""]=b,Ht=rd(Ue.split(/[\\/]+/u));return Ht.length>0?`\\\\${X}\\${we}\\${Ht.join("\\")}`:`\\\\${X}\\${we}`}const D=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(D){const[,X,we=""]=D,Ue=p.includes("\\")&&!p.includes("/")?"\\":"/",Ht=rd(we.split(/[\\/]+/u));return Ht.length>0?`${X}${Ue}${Ht.join(Ue)}`:`${X}${Ue}`}if(p.startsWith("/")){const X=rd(p.split("/"));return X.length>0?`/${X.join("/")}`:"/"}return p}function rd(u){const p=[];for(const b of u){const D=b.trim();if(!(!D||D===".")){if(D===".."){p.length>0&&p.pop();continue}p.push(D)}}return p}function lT(u){wa(u.draggedId,u.targetId)}function Wp(u){const p=Is.value,b=Or(p);ts(p,u),b&&b!==u&&($r(p,b,u),Oo(p))}function qp(u){$o(u)}function Gp(u){Ks(u)}function uT(){Dt()}const Ml=S("");let od=null;rt(No,u=>{var p;u&&(u.text&&((p=tr.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),Ml.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),od&&clearTimeout(od),od=setTimeout(()=>{Ml.value=""},6e3),Gt(Is.value))});function Vp(u){var b,D;const p=re.value.trim();switch(u){case"compact":p&&bt(p);break;case"review":if(!p)return;hr.value="",_r.value="",rr.value=!0;break;case"rename":p&&((D=Hn.value)==null||D.openRenameThreadDialog(p,((b=ce.value)==null?void 0:b.title)??""));break;case"archive":p&&ct(p);break;case"fork":p&&fe(p);break;case"new":Qc();break;case"skills":ks.value||xt.push({name:"skills"});break}}function cT(u){const p=u.turnId.trim();if(p.length>0){const b=[...Ui.value].reverse().find(D=>{var X;return Ws(D)&&(((X=D.turnId)==null?void 0:X.trim())??"")===p&&D.text.trim().length>0});b!=null&&b.text&&tr.value&&tr.value.appendTextToDraft(b.text)}os(u.turnId)}function dT(){xn.value||!re.value||(Fc.value&&(Dc.value=Fc.value.id),es("default"),Su(),Tt("Implement",[],[],"steer",[],void 0,"default"))}async function fT(){if(xn.value||ks.value||ii.value||!ce.value||Ui.value.length===0)return;const u=pT();try{await qO(u)}catch{}}function pT(){var b,D,X;const u=[],p=((D=(b=ce.value)==null?void 0:b.title)==null?void 0:D.trim())||"Untitled thread";u.push(`# ${hT(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((X=ce.value)==null?void 0:X.id)??""}`),u.push(""),u.push("---"),u.push("");for(const we of Ui.value){const Ue=we.role?we.role.toUpperCase():"MESSAGE";u.push(`## ${Ue}`),u.push("");const Ht=we.text.trim();if(Ht&&(u.push(Ht),u.push("")),we.commandExecution&&(u.push("```text"),u.push(`command: ${we.commandExecution.command}`),u.push(`status: ${we.commandExecution.status}`),we.commandExecution.cwd&&u.push(`cwd: ${we.commandExecution.cwd}`),we.commandExecution.exitCode!==null&&u.push(`exitCode: ${we.commandExecution.exitCode}`),u.push(we.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),we.fileAttachments&&we.fileAttachments.length>0){u.push("Attachments:");for(const yr of we.fileAttachments)u.push(`- ${yr.path}`);u.push("")}if(we.images&&we.images.length>0){u.push("Images:");for(const yr of we.images)u.push(`- ${yr}`);u.push("")}}return`${u.join(`
82
+ `).trimEnd()}
83
+ `}function hT(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function ad(u,p){if(typeof window>"u")return p;const b=window.localStorage.getItem(u);return b===null?p:b==="1"}function mT(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(vv);return u==="light"||u==="dark"?u:"system"}function vT(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(mv);return u==="steer"||u==="queue"?u:"queue"}function gT(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(bv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function yT(){La.value=!La.value,window.localStorage.setItem(hv,La.value?"1":"0")}function wT(){ys.value=ys.value==="steer"?"queue":"steer",window.localStorage.setItem(mv,ys.value)}function bT(){const u=["system","light","dark"],p=u.indexOf(ws.value);ws.value=u[(p+1)%u.length],window.localStorage.setItem(vv,ws.value),ku()}function TT(){const u=["standard","wide","extra-wide"],p=u.indexOf(ti.value);ti.value=u[(p+1)%u.length],window.localStorage.setItem(bv,ti.value)}function ST(){bs.value=!bs.value,window.localStorage.setItem(gv,bs.value?"1":"0")}function CT(){Ts.value=!Ts.value,window.localStorage.setItem(yv,Ts.value?"1":"0")}async function xT(u){if(!Oa.value){Oa.value=!0;try{if(u==="codex"){gr.value="codex";const p=await wm(!1);ia.value=p.enabled}else if(u==="openrouter"){gr.value="openrouter";const p=await wm(!0);ia.value=p.enabled,await Vi("","",{wireApi:vn.value,provider:"openrouter"})}else u==="opencode-zen"?(gr.value="opencode-zen",await Vi("",Li.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),ia.value=!0):u==="custom"&&(gr.value="custom",Xr.value.trim()&&ri.value.trim()&&(await Vi(Xr.value.trim(),ri.value.trim(),{wireApi:la.value}),ia.value=!0));Mr.value="",await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Mr.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Oa.value=!1}}}async function kT(){if(Mn.value)return;const u=Xr.value.trim();if(u){Mn.value=!0;try{Mr.value="",await Vi(u,ri.value.trim(),{wireApi:la.value}),ia.value=!0;const p=await ym();p.provider==="custom"&&!p.currentModel&&(Mr.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Mr.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Mn.value=!1}}}async function IT(u){if(Mn.value||Oa.value||vn.value===u)return;const p=vn.value;vn.value=u,Mn.value=!0;try{Mr.value="",await Vi("","",{wireApi:u,provider:"openrouter"}),ia.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){vn.value=p,Mr.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Mn.value=!1}}async function AT(){if(Mn.value)return;const u=Li.value.trim();if(u){Mn.value=!0;try{Mr.value="",await Vi("",u,{wireApi:"responses",provider:"opencode-zen"}),ia.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Mr.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Mn.value=!1}}}async function _T(){if(!Mn.value){Mn.value=!0;try{const u=Ss.value.trim();await bm(u),Ss.value="",await sd(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Mn.value=!1}}}async function PT(){if(!Mn.value){Mn.value=!0;try{await bm(""),Ss.value="",await sd(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Mn.value=!1}}}async function sd(){try{const u=gr.value,p=await ym();ia.value=p.enabled,fu.value=p.customKey??!1,pu.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?gr.value="opencode-zen":p.provider==="custom"?(gr.value="custom",Xr.value=p.customBaseUrl??"",la.value=p.wireApi==="chat"?"chat":"responses"):(gr.value="openrouter",vn.value=p.wireApi==="chat"?"chat":"responses"):gr.value="codex",Mt=p.hasCodexAuth===!0,Mt||(jr=!1);const b=gr.value!==u;b&&await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const D=await Tp();D&&await ne({includeSelectedThreadMessages:!1,providerChanged:b||D,awaitAncillaryRefreshes:!0})}catch{}}function MT(u){const b=id(u.trim())||"auto";wo.value=b,window.localStorage.setItem(wv,b)}function ET(u){ba(Number(u))}const RT=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function jT(){var b;if(typeof window>"u")return"auto";const u=((b=window.localStorage.getItem(wv))==null?void 0:b.trim())||"auto";return id(u)||"auto"}function LT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function b(X){const we=q[X]||X;return`${we.charAt(0).toUpperCase()+we.slice(1)} (${X})`}for(const X of typeof navigator<"u"?navigator.languages??[]:[]){const we=id(X);!we||p.has(we)||(p.add(we),u.push({value:we,label:`${f("Preferred")}: ${b(we)}`}))}for(const X of Object.keys(q))p.has(X)||(p.add(X),u.push({value:X,label:b(X)}));const D=wo.value.trim();return D&&!p.has(D)&&u.push({value:D,label:b(D)}),u}function id(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in q)return p;const b=p.split("-")[0]??p;return b in q?b:""}function ku(){const u=document.documentElement;if(ws.value==="dark")u.classList.add("dark");else if(ws.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}NT()}function NT(){const u=document.querySelector('meta[name="theme-color"]');if(!u)return;const p=window.getComputedStyle(document.documentElement).getPropertyValue("--s0").trim();p&&u.setAttribute("content",p)}const OT=Y(()=>({activeSettingsGroup:_i.value,accounts:Vn.value,isAccountsSectionCollapsed:en.value,isRefreshingAccounts:oa.value,isSwitchingAccounts:yo.value,isStartingCodexLogin:aa.value,isCompletingCodexLogin:Nn.value,accountActionError:mn.value,codexLoginUrl:ei.value,feedbackMailto:Cr,isAccountUnavailable:wu,isRemoveConfirmationActive:Yc,isRemoveVisible:Hw,buildAccountTitle:Jw,formatAccountMeta:Cp,formatAccountQuota:xp,shortAccountId:Bw,isAccountActionDisabled:zw,getAccountSwitchLabel:Ww,getAccountRemoveLabel:qw,onRefreshAccounts:Qw,onStartCodexLogin:Zw,onSwitchAccount:Xw,onRemoveAccount:nb,onAccountCardPointerEnter:Gw,onAccountCardPointerLeave:Vw,toggleAccountsSectionCollapsed:ss,prepareFeedbackLink:Et,sendWithEnter:La.value,inProgressSendMode:ys.value,darkMode:ws.value,uiLanguage:y.value,uiLanguageOptions:T,chatWidthLabel:xw.value,dictationClickToToggle:bs.value,dictationAutoSend:Ts.value,dictationLanguage:wo.value,dictationLanguageOptions:Lc.value,autoCompactThreshold:Vs.value,autoCompactThresholdOptions:RT,hasVisibleFeedbackError:mu.value,selectedProvider:gr.value,providerDropdownOptions:ni.value,freeModeLoading:Oa.value,providerError:Mr.value,freeModeHasCustomKey:fu.value,freeModeCustomKey:Ss.value,freeModeCustomKeyMasked:pu.value,freeModeCustomKeySaving:Mn.value,openRouterWireApi:vn.value,opencodeZenKey:Li.value,customEndpointUrl:Xr.value,customEndpointKey:ri.value,customEndpointWireApi:la.value,isTelegramConfigOpen:hu.value,telegramStatusText:Iw.value,telegramBotTokenDraft:Ni.value,telegramAllowedUserIdsDraft:oi.value,telegramConfigError:ua.value,isTelegramSaving:Oi.value,supportsHooks:Pi.value,isHooksLoading:ke.value,hooksList:Oe.value,supportsRemoteControl:Xs.value,remoteControlStatus:Pt.value,isRemoteControlActionInFlight:Ar.value,remoteControlError:qr.value,remoteControlNotice:Xo.value,isRemoteControlLoading:ds.value,remoteControlActionName:qn.value,pairingCode:Lt.value,accountRateLimitSnapshots:Je.value,worktreeName:U,appVersion:O,onClose:()=>{sn.value=!1},onActiveSettingsGroupChange:u=>{_i.value=u},toggleSendWithEnter:yT,cycleInProgressSendMode:wT,cycleDarkMode:bT,onUiLanguageChange:A,cycleChatWidth:TT,toggleDictationClickToToggle:ST,toggleDictationAutoSend:CT,onDictationLanguageChange:MT,onAutoCompactThresholdChange:ET,onProviderChange:xT,onFreeModeCustomKeyChange:u=>{Ss.value=u},clearFreeModeCustomKey:PT,saveFreeModeCustomKey:_T,setOpenRouterWireApi:IT,onOpencodeZenKeyChange:u=>{Li.value=u},saveOpencodeZen:AT,onCustomEndpointUrlChange:u=>{Xr.value=u},onCustomEndpointKeyChange:u=>{ri.value=u},saveCustomEndpoint:kT,onCustomEndpointWireApiChange:u=>{la.value=u},onTelegramConfigOpenChange:u=>{hu.value=u},onTelegramBotTokenDraftChange:u=>{Ni.value=u},onTelegramAllowedUserIdsDraftChange:u=>{oi.value=u},saveTelegramConfig:Ew,refreshHooks:_e,toggleRemoteControl:Ri,startRemotePairing:Zs,refreshRemoteClients:ms,revokeRemoteClient:Tl}));function $T(u,p){const b=(u??"").trim();return b.length>0?b:p.trim()||"message"}function Kp(u){es(u)}async function DT(){await xt.isReady(),vt.name==="thread"&&$a.value?rs($a.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&rs("",{persist:!1}),await ne({includeSelectedThreadMessages:vt.name==="thread"}),Al({silent:!0}),await sT(),Ir.value=!0,await ld(),co()}async function ld(){if(nr.value){Yo=!0;return}nr.value=!0;try{do{if(Yo=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){re.value!==""&&await Ke("");continue}if(vt.name==="thread"){const u=$a.value;if(!u)continue;if(re.value!==u){if(await Ke(u)==="not-found")continue}else $e(u,{silent:!0}).catch(()=>{})}}while(Yo)}finally{nr.value=!1}}rt(()=>[vt.name,$a.value,de.value,re.value],async()=>{Ir.value&&await ld()}),rt(()=>[re.value,kn.value],()=>{Ub()}),rt(()=>[vt.name,kn.value],([u,p])=>{u==="thread"&&Tu(p)},{immediate:!0}),rt(()=>re.value,async u=>{if(Ir.value&&!nr.value&&!(xn.value||ks.value||ii.value)){if(!u){vt.name!=="home"&&await xt.replace({name:"home"});return}vt.name==="thread"&&$a.value===u||await xt.replace({name:"thread",params:{threadId:u}})}}),rt(()=>Wc.value,u=>{if(u.length===0){ht.value="",Co();return}const p=ht.value.trim();p&&(u.some(D=>D.value===p)||(ht.value="")),Co()},{immediate:!0}),rt(()=>ht.value,()=>{ze.value={phase:"idle",title:"",message:""},Co()}),rt(()=>[vt.name,ht.value],([u,p])=>{u==="home"&&Tu(p)},{immediate:!0}),rt(li,u=>{!u&&_n.value==="worktree"&&(_n.value="local")},{immediate:!0}),rt(()=>[_n.value,ht.value],([u,p])=>{u!=="worktree"||!li.value||Yp(p)},{immediate:!0}),rt(()=>_n.value,u=>{var p;if(u==="local"){ze.value={phase:"idle",title:"",message:""};const b=ht.value.trim();if(b&&kp(b)){const D=((p=ce.value)==null?void 0:p.projectName)??Lr(b),X=Hi(D,"");X&&(ht.value=X)}return}li.value&&Yp(ht.value)}),rt(()=>vt.name,u=>{u!=="home"&&(ze.value={phase:"idle",title:"",message:""}),u!=="thread"&&(rr.value=!1)}),rt(()=>re.value,()=>{ze.value={phase:"idle",title:"",message:""}}),rt(()=>[vt.name,kn.value,li.value],([u,p,b])=>{if(!(u==="thread"||u==="home"&&b)){$p();return}Wr+=1,vr.value={},nn.value="",Pr.value="",_l(p)},{immediate:!0}),rt(iw,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),rt(kt,u=>{u&&!At.value&&fn(!0)},{immediate:!0});async function FT(u,p=[],b=[],D=[]){try{ze.value={phase:"idle",title:"",message:""};let X=ht.value;if(_n.value==="worktree"){ze.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Ue=await vA(ht.value,Wn.value);X=Ue.cwd,ht.value=Ue.cwd,ze.value={phase:"idle",title:"",message:""}}catch{ze.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!X.trim()){const Ue=await RA(u);X=Ue.cwd,ht.value=Ue.cwd}const we=await yt(u,X,p,b,D);if(!we)return;await xt.replace({name:"thread",params:{threadId:we}}),Su()}catch{}}function BT(u){var D;if((D=u.prompt)!=null&&D.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),b=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${b}. Give me a list of what it can do and one useful example.`}function UT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function zT(u){var X;if(ho.value)return;ho.value=UT(u);const p=BT(u),b=(X=u.attachedSkills)!=null&&X.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[],D=XO(b,Me.value);try{const we=dp.value.trim()||kn.value.trim(),Ue=await yt(p,we,[],D,[]);if(!Ue)return;await xt.replace({name:"thread",params:{threadId:Ue}}),Su()}catch{}finally{ho.value=""}}async function Yp(u){var b;const p=u.trim();if(!p){k.value=[],Wn.value="";return}L.value=!0;try{const D=await yA(p);k.value=D;const X=Wn.value.trim();if(!(X.length>0&&D.some(Ue=>Ue.value===X))){const Ue=D.find(Ht=>Ht.value.trim()==="main");Wn.value=(Ue==null?void 0:Ue.value)??((b=D[0])==null?void 0:b.value)??""}}catch{k.value=[],Wn.value=""}finally{L.value=!1}}return(u,p)=>(P(),B(ut,null,[Fe(Fx,{"is-sidebar-collapsed":m(At),onCloseSidebar:p[37]||(p[37]=b=>m(fn)(!0))},{sidebar:dt(()=>[w("section",ZO,[w("div",{ref_key:"sidebarScrollableRef",ref:ka,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...b)=>m(Ys)&&m(Ys)(...b))},[m(At)?ve("",!0):(P(),tt(Km,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":m(At),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=b=>m(fn)(!m(At))),onStartNewThread:Qc},{default:dt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":m(Hr),"aria-label":m(f)("Search threads"),title:m(f)("Search threads"),onClick:p[0]||(p[0]=(...b)=>m(Ia)&&m(Ia)(...b))},[Fe(Qm,{class:"sidebar-search-toggle-icon"})],8,e$)]),_:1},8,["is-sidebar-collapsed"])),!m(At)&&m(Hr)?(P(),B("div",t$,[Fe(Qm,{class:"sidebar-search-bar-icon"}),En(w("input",{ref_key:"sidebarSearchInputRef",ref:as,"onUpdate:modelValue":p[2]||(p[2]=b=>Rn(Kt)?Kt.value=b:null),class:"sidebar-search-input",type:"text",placeholder:m(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...b)=>m(Pn)&&m(Pn)(...b))},null,40,n$),[[Bn,m(Kt)]]),m(Kt).length>0?(P(),B("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":m(f)("Clear search"),onClick:p[4]||(p[4]=(...b)=>m(Aa)&&m(Aa)(...b))},[Fe(mf,{class:"sidebar-search-clear-icon"})],8,r$)):ve("",!0)])):ve("",!0),m(At)?ve("",!0):(P(),B("button",{key:2,class:lt(["sidebar-skills-link",{"is-active":ks.value}]),type:"button",onClick:p[5]||(p[5]=b=>{m(xt).push({name:"skills"}),m(kt)&&m(fn)(!0)})},[w("span",o$,[Fe(Jm)]),w("span",a$,[w("span",s$,F(m(f)("Skills")),1),w("span",i$,F(m(f)("Plugins, apps, MCPs")),1)])],2)),m(At)?ve("",!0):(P(),B("button",{key:3,class:lt(["sidebar-skills-link",{"is-active":ii.value}]),type:"button",onClick:p[6]||(p[6]=b=>{m(xt).push({name:"automations"}),m(kt)&&m(fn)(!0)})},[w("span",l$,[Fe(Ym)]),w("span",u$,[w("span",c$,F(m(f)("Automations")),1),w("span",d$,F(m(f)("Scheduled work")),1)])],2)),m(At)?ve("",!0):(P(),tt(fE,{key:4,ref_key:"sidebarThreadTreeRef",ref:Hn,groups:m(R),"project-display-name-by-id":m(pe),"project-git-repo-by-name":ww.value,"project-cwd-by-name":Ip.value,"selected-thread-id":Rw.value,"is-loading":m(de),"is-thread-list-fully-loaded":m(N),"search-query":m(Kt),"search-matched-thread-ids":Jo.value,onSelect:Lw,onArchive:rb,onStartNewThread:sb,onRenameProject:Tb,onBrowseThreadFiles:ib,onSaveThreadProject:fb,onBrowseProjectFiles:cb,onSaveProject:db,onRequestProjectGitStatus:kb,onCreateProjectWorktree:yb,onRenameThread:Sb,onForkThread:ab,onRemoveProject:Cb,onReorderProject:xb,onCopyThreadChat:Fw,onAutomationsChanged:Dw,onRestoreThread:ob,onStartNewChat:bb},null,8,["groups","project-display-name-by-id","project-git-repo-by-name","project-cwd-by-name","selected-thread-id","is-loading","is-thread-list-fully-loaded","search-query","search-matched-thread-ids"]))],544),m(At)?ve("",!0):(P(),B("div",{key:0,ref_key:"settingsAreaRef",ref:Js,class:"sidebar-settings-area",onClick:Pb},[sn.value?(P(),tt(m(s),qf({key:0,ref_key:"settingsDialogRef",ref:is},OT.value),null,16)):ve("",!0),w("div",f$,[w("button",{ref_key:"settingsButtonRef",ref:_a,class:"sidebar-settings-icon-button",type:"button",title:m(f)("Settings"),"aria-label":m(f)("Settings"),onClick:gt(Qs,["stop"])},[Fe(jj,{class:"sidebar-settings-icon"})],8,p$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:m(f)("Recycle bin"),"aria-label":m(f)("Recycle bin"),onClick:gt(Mb,["stop"])},[Fe(Cy,{class:"sidebar-settings-icon"})],8,h$)])],512))])]),content:dt(()=>[w("div",m$,[w("section",{class:lt(["content-root",{"is-virtual-keyboard-open":hw.value}]),style:to(kw.value)},[xl.value?(P(),B("span",v$)):ve("",!0),Fe(gE,{title:aw.value,accent:ks.value||ii.value},{leading:dt(()=>[m(At)||m(kt)?(P(),tt(Km,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":m(At),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=b=>m(fn)(!m(At))),onStartNewThread:Qc},null,8,["is-sidebar-collapsed"])):ve("",!0),ks.value?(P(),B("span",g$,[Fe(Jm)])):ii.value?(P(),B("span",y$,[Fe(Ym)])):ve("",!0)]),actions:dt(()=>[gu.value?(P(),B("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":m(kt)?m(Jt)?m(f)("Close side panel"):m(f)("Open side panel"):m(pr)?m(f)("Open side panel"):m(f)("Close side panel"),title:m(kt)?m(Jt)?m(f)("Close side panel"):m(f)("Open side panel"):m(pr)?m(f)("Open side panel"):m(f)("Close side panel"),onClick:p[9]||(p[9]=(...b)=>m(Go)&&m(Go)(...b))},[Fe(xy,{class:"content-header-right-panel-toggle-icon"})],8,w$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",b$,[ks.value?(P(),tt(m(o),{key:0,ref_key:"directoryHubRef",ref:Sr,cwd:dp.value,"thread-id":$a.value,"try-in-flight-key":ho.value,onSkillsChanged:Aw,onTryItem:zT},null,8,["cwd","thread-id","try-in-flight-key"])):ii.value?(P(),tt(m(a),{key:1,ref_key:"automationsPanelRef",ref:un,groups:m(R),"project-cwd-by-name":Ip.value,"project-display-name-by-id":m(pe),"selected-automation-id":lp.value,onSelectAutomation:Nw,onEditAutomation:Ow,onCreateAutomation:$w},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):xn.value?(P(),B("div",T$,[w("div",S$,[w("p",C$,F(m(f)("Let's build")),1),Fe(Ci,{class:"new-thread-folder-dropdown","model-value":ht.value,options:Wc.value,placeholder:m(f)("Choose folder"),"enable-search":!0,"search-placeholder":m(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":jb},null,8,["model-value","options","placeholder","search-placeholder"]),ht.value?(P(),B("p",{key:0,class:"new-thread-folder-selected",title:ht.value},F(m(f)("Selected folder"))+": "+F(ht.value),9,x$)):ve("",!0),w("div",k$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Zb},F(m(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:zb},F(m(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:W.value,onClick:Yb},F(W.value?m(f)("Importing…"):m(f)("Import Project")),9,I$),w("input",{ref_key:"projectImportInputRef",ref:He,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Xb},null,544)]),Na.value?(P(),B("section",A$,[w("div",_$,[w("div",P$,[w("span",M$,[Fe(Pc)]),w("p",E$,F(m(f)("New in Codex")),1)]),w("h2",R$,F(m(f)("Plugins are here")),1),w("p",j$,F(m(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[42]||(p[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",L$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:vw},F(m(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:pp},F(m(f)("Dismiss")),1)])])):ve("",!0),(P(),tt(dl,{to:"body"},[Ze.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(Hb,["self"]),onMouseup:Wb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":m(f)("Select folder"),onKeydown:wr(gt(Wi,["prevent"]),["esc"])},[w("div",O$,[w("p",$$,F(m(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Wi},F(m(f)("Cancel")),1)]),w("p",D$,F(m(f)("Current folder")),1),w("div",F$,[En(w("input",{ref_key:"existingFolderPathInputRef",ref:mt,"onUpdate:modelValue":p[10]||(p[10]=b=>pt.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:m(f)("Current folder"),title:pt.value||m(f)("Unavailable"),disabled:$n.value||bo.value,onBlur:rT,onKeydown:[wr(gt(oT,["prevent"]),["enter"]),wr(gt(Wi,["prevent"]),["esc"])]},null,40,B$),[[Bn,pt.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Il.value||$n.value||bo.value,onClick:p[11]||(p[11]=b=>nd())},F(bo.value?m(f)("Opening…"):m(f)("Open")),9,U$)]),w("div",z$,[w("label",H$,[En(w("input",{"onUpdate:modelValue":p[12]||(p[12]=b=>si.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:tT},null,544),[[pC,si.value]]),w("span",null,F(m(f)("Show hidden folders")),1)]),w("button",{class:lt(["new-thread-folder-action",{"new-thread-folder-action-primary":ca.value}]),type:"button","aria-pressed":ca.value,disabled:!_t.value||$n.value||bo.value||h.value||!!Qt.value&&!ca.value,onClick:aT},F(m(f)("New folder")),11,W$)]),ca.value?(P(),B("div",q$,[w("div",G$,[En(w("input",{ref_key:"createFolderInputRef",ref:du,"onUpdate:modelValue":p[13]||(p[13]=b=>Cs.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:m(f)("Folder name"),onKeydown:[wr(gt(Bp,["prevent"]),["enter"]),wr(gt(Pl,["prevent"]),["esc"])]},null,40,V$),[[Bn,Cs.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!bw.value||h.value,onClick:Bp},F(Tw.value),9,K$)]),Kn.value?(P(),B("div",Y$,[w("span",null,F(Kn.value),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[14]||(p[14]=b=>Et(b,Kn.value))},F(m(f)("Send feedback")),9,J$)])):ve("",!0)])):ve("",!0),En(w("input",{ref_key:"existingFolderFilterInputRef",ref:wt,"onUpdate:modelValue":p[15]||(p[15]=b=>Er.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:m(f)("Filter folders..."),onKeydown:wr(gt(Wi,["prevent"]),["esc"])},null,40,Q$),[[Bn,Er.value]]),Qt.value?(P(),B("div",X$,[w("div",Z$,[w("span",null,F(Qt.value),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[16]||(p[16]=b=>Et(b,Qt.value))},F(m(f)("Send feedback")),9,eD)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:$n.value||bo.value,onClick:nT},F(m(f)("Retry")),9,tD)])):ve("",!0),$n.value?(P(),B("p",nD,F(m(f)("Loading folders…")),1)):!Qt.value&&Gc.value.length===0?(P(),B("p",rD,F(Er.value.trim()?m(f)("No folders match this filter."):m(f)("No subfolders found here.")),1)):Gc.value.length>0?(P(),B("ul",oD,[(P(!0),B(ut,null,on(Gc.value,b=>(P(),B("li",{key:b.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:b.path,disabled:$n.value||bo.value,onClick:D=>eT(b.path)},[w("span",sD,F(b.name),1)],8,aD),b.kind==="directory"?(P(),B("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:$n.value||bo.value,onClick:D=>nd(b.path)},F(m(f)("Open")),9,iD)):ve("",!0)]))),128))])):ve("",!0)],40,N$)],32)):ve("",!0)])),(P(),tt(dl,{to:"body"},[g.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(qb,["self"]),onMouseup:Gb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Create or clone project"),onKeydown:wr(gt(Cu,["prevent"]),["esc"])},[w("div",uD,[w("p",cD,F(m(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:ie.value,onClick:Cu},F(m(f)("Cancel")),9,dD)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":m(f)("Project source")},[w("button",{class:lt(["new-thread-project-mode-tab",{"is-active":I.value==="create"}]),type:"button",role:"tab","aria-selected":I.value==="create",disabled:ie.value,onClick:p[17]||(p[17]=b=>I.value="create")},F(m(f)("New project")),11,pD),w("button",{class:lt(["new-thread-project-mode-tab",{"is-active":I.value==="clone"}]),type:"button",role:"tab","aria-selected":I.value==="clone",disabled:ie.value,onClick:p[18]||(p[18]=b=>I.value="clone")},F(m(f)("Clone from GitHub")),11,hD)],8,fD),w("label",mD,[w("span",vD,F(m(f)("Destination folder")),1),En(w("input",{"onUpdate:modelValue":p[19]||(p[19]=b=>j.value=b),class:"new-thread-open-folder-path",type:"text",disabled:ie.value,placeholder:m(f)("Destination folder")},null,8,gD),[[Bn,j.value]])]),I.value==="create"?(P(),B("label",yD,[w("span",wD,F(m(f)("Project name")),1),En(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:Ae,"onUpdate:modelValue":p[20]||(p[20]=b=>H.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:ie.value,placeholder:m(f)("Project name"),onKeydown:wr(gt(td,["prevent"]),["enter"])},null,40,bD),[[Bn,H.value]])])):I.value==="clone"?(P(),B("label",TD,[w("span",SD,F(m(f)("GitHub repository URL")),1),En(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:Ae,"onUpdate:modelValue":p[21]||(p[21]=b=>Q.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:ie.value,placeholder:"https://github.com/owner/repo",onKeydown:wr(gt(td,["prevent"]),["enter"])},null,40,CD),[[Bn,Q.value]])])):ve("",!0),G.value?(P(),B("div",xD,[w("span",null,F(G.value),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[22]||(p[22]=b=>Et(b,G.value))},F(m(f)("Send feedback")),9,kD)])):ve("",!0),w("div",ID,[w("button",{class:"new-thread-folder-action",type:"button",disabled:ie.value,onClick:Cu},F(m(f)("Cancel")),9,AD),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!wp.value||ie.value,onClick:td},F(Sw.value),9,_D)])],40,lD)],32)):ve("",!0)])),li.value?(P(),tt(uj,{key:2,class:"new-thread-runtime-dropdown",modelValue:_n.value,"onUpdate:modelValue":p[23]||(p[23]=b=>_n.value=b)},null,8,["modelValue"])):ve("",!0),_n.value==="worktree"?(P(),B("div",PD,[w("p",MD,F(m(f)("Base branch")),1),Fe(Ci,{class:"new-thread-branch-dropdown","model-value":Wn.value,options:qc.value,placeholder:m(f)("Select branch"),"enable-search":!0,"search-placeholder":m(f)("Search branches..."),disabled:L.value||qc.value.length===0,"onUpdate:modelValue":Lb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",ED,F(L.value?m(f)("Loading branches…"):mp.value?m(f)("New worktree branch will start from {branch}.",{branch:mp.value}):m(f)("No Git branches found for this folder.")),1)])):ve("",!0),li.value?(P(),B("p",RD,F(m(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),ze.value.phase!=="idle"?(P(),B("div",{key:5,class:lt(["worktree-init-status",{"is-running":ze.value.phase==="running","is-error":ze.value.phase==="error"}])},[w("strong",jD,F(ze.value.title),1),w("span",LD,F(ze.value.message),1)],2)):ve("",!0)]),w("div",ND,[m(xe)?(P(),B("div",OD,[w("span",null,F(m(f)(m(xe))),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[24]||(p[24]=b=>Et(b,m(xe)))},F(m(f)("Send feedback")),9,$D)])):ve("",!0),Fe(Vm,{ref_key:"homeThreadComposerRef",ref:fo,"active-thread-id":Is.value,cwd:kn.value,"fuzzy-file-search-results":m(it),onRegisterFuzzySession:m(J),"collaboration-modes":m(Ie),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":cp.value,"selected-reasoning-effort":m(Ce),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(z),skills:m(Me),"thread-token-usage":m(K),"codex-quota":m(me),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":La.value,"in-progress-submit-mode":ys.value,"dictation-click-to-toggle":bs.value,"dictation-auto-send":Ts.value,"dictation-language":wo.value,onSubmit:Op,"onUpdate:selectedCollaborationMode":Kp,"onUpdate:selectedModel":Wp,"onUpdate:selectedReasoningEffort":qp,"onUpdate:selectedSpeedMode":Gp,"approval-policy":Pa.value,"is-approval-policy-saving":Gr.value,"approval-policy-error":Vr.value,"approval-policy-notice":Kr.value,"onUpdate:approvalPolicy":Yr,onSaveApprovalPolicy:ta,onSlashCommand:Vp},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","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","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice"])])])):(P(),B("div",DD,[rr.value&&m(re)&&kn.value?(P(),tt(m(r),{key:0,"thread-id":m(re),cwd:kn.value,"is-thread-in-progress":Bc.value,"initial-file-path":hr.value,"commit-sha":_r.value,onClose:p[25]||(p[25]=b=>rr.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):ve("",!0),w("div",FD,[Fe(m(t),{ref_key:"threadConversationRef",ref:bn,messages:lw.value,"is-loading":m(oe),"is-slow-open":m(se)!==null&&m(se)===Is.value,"active-thread-id":Is.value,cwd:kn.value,"live-overlay":dw.value,"live-turn-id":m(ee),"pending-requests":m(le),"has-more-persisted-above":m(st),"is-loading-persisted-above":m(je),"load-earlier-messages":m(Ge),onForkThread:Ab,onRollback:cT,onFileChangesChanged:_w,onRespondServerRequest:Mp},null,8,["messages","is-loading","is-slow-open","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:wn},[fp.value?(P(),B("div",BD,F(m(f)("This thread is running in the Codex TUI")),1)):ve("",!0),m(xe)?(P(),B("div",UD,[w("span",null,F(m(f)(m(xe))),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[26]||(p[26]=b=>Et(b,m(xe)))},F(m(f)("Send feedback")),9,zD)])):ve("",!0),Fe(m(v),{messages:m(io),onEdit:Rb,onSteer:m(lo),onDelete:m(Zn),onReorder:lT},null,8,["messages","onSteer","onDelete"]),Ml.value?(P(),B("div",HD,[w("span",null,F(Ml.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":m(f)("Dismiss"),onClick:p[27]||(p[27]=b=>Ml.value="")}," × ",8,WD)])):ve("",!0),vu.value?(P(),tt(m(d),{key:3,request:vu.value,"request-count":m(le).length,"has-queue-above":m(io).length>0,"panel-width":Fr.value,"visual-viewport-height":xl.value?da.value:0,"panel-error":fw.value,onRespondServerRequest:Mp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(P(),tt(Vm,{key:4,ref_key:"threadComposerRef",ref:tr,"active-thread-id":Is.value,cwd:kn.value,"fuzzy-file-search-results":m(it),onRegisterFuzzySession:m(J),"collaboration-modes":m(Ie),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":cp.value,"selected-reasoning-effort":m(Ce),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(z),skills:m(Me),"thread-token-usage":m(K),"codex-quota":m(me),"is-turn-in-progress":Bc.value,"is-stop-pending":m(E),"is-interrupting-turn":m(_),"is-compacting":mw.value,"external-session-active":fp.value,"has-queue-above":m(io).length>0,"send-with-enter":La.value,"in-progress-submit-mode":ys.value,"dictation-click-to-toggle":bs.value,"dictation-auto-send":Ts.value,"dictation-language":wo.value,"onUpdate:selectedCollaborationMode":Kp,onSubmit:Op,"onUpdate:selectedModel":Wp,"onUpdate:selectedReasoningEffort":qp,"onUpdate:selectedSpeedMode":Gp,"approval-policy":Pa.value,"is-approval-policy-saving":Gr.value,"approval-policy-error":Vr.value,"approval-policy-notice":Kr.value,"onUpdate:approvalPolicy":Yr,onSaveApprovalPolicy:ta,"plan-panel":Fc.value,onInterrupt:uT,onSlashCommand:Vp,onImplementPlan:dT,onCompactContext:gw},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","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","is-compacting","external-session-active","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice","plan-panel"]))],512)]))])],6),m(kt)&&m(Jt)?(P(),B("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...b)=>m(Sn)&&m(Sn)(...b))})):ve("",!0),gu.value&&(m(kt)||!m(pr))?(P(),B("aside",{key:1,class:lt(["content-right-panel",{"is-mobile-open":m(Jt)}]),style:to({"--right-panel-width":`${m(an)}px`})},[m(kt)?ve("",!0):(P(),B("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...b)=>m(Ur)&&m(Ur)(...b))},null,32)),w("div",qD,[w("div",GD,[w("button",{class:lt(["content-right-panel-tab",{"is-active":m(Bt)==="git"}]),type:"button",role:"tab","aria-selected":m(Bt)==="git",onClick:p[30]||(p[30]=b=>m(Vt)("git"))},[Fe(lc,{class:"content-right-panel-tab-icon"}),Ds(" "+F(m(f)("Git")),1)],10,VD),w("button",{class:lt(["content-right-panel-tab",{"is-active":m(Bt)==="files"}]),type:"button",role:"tab","aria-selected":m(Bt)==="files",onClick:p[31]||(p[31]=b=>m(Vt)("files"))},[Fe(Xm,{class:"content-right-panel-tab-icon"}),Ds(" "+F(m(f)("Files")),1)],10,KD),(P(!0),B(ut,null,on(m(po),b=>(P(),B("button",{key:b.key,class:lt(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":m(Bt)==="preview"&&m(Uo)===b.key}]),type:"button",role:"tab","aria-selected":m(Bt)==="preview"&&m(Uo)===b.key,title:b.path,onClick:D=>m(qo)(b.key)},[Fe(gl,{class:"content-right-panel-tab-icon"}),w("span",JD,F(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":m(f)("Close"),title:m(f)("Close"),onClick:gt(D=>m(It)(b.key),["stop"])},"×",8,QD)],10,YD))),128))]),w("div",XD,[w("div",ZD,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":m(f)("Add panel"),title:m(f)("Add panel"),onClick:p[32]||(p[32]=gt(b=>Tn.value=!m(Tn),["stop"]))},"+",8,eF),Fe(uu,{name:"right-panel-menu"},{default:dt(()=>[m(Tn)?(P(),B("div",tF,[w("button",{type:"button",onClick:p[33]||(p[33]=b=>m(Vt)("terminal"))},[Fe($j,{class:"content-right-panel-menu-icon"}),Ds(" "+F(m(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=b=>m(Vt)("git"))},[Fe(lc,{class:"content-right-panel-menu-icon"}),Ds(" "+F(m(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=b=>m(Vt)("files"))},[Fe(Xm,{class:"content-right-panel-menu-icon"}),Ds(" "+F(m(f)("Files panel")),1)])])):ve("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":m(f)("Close panel"),title:m(f)("Close panel"),onClick:p[36]||(p[36]=(...b)=>m(Sn)&&m(Sn)(...b))},[Fe(mf,{class:"content-right-panel-close-icon"})],8,nF)])]),w("div",rF,[m(Bt)==="git"?(P(),tt(m(i),{key:0,"current-branch":mr.value,"head-sha":na.value,"head-subject":C.value,"head-date":M.value,detached:x.value,dirty:Z.value,"worktree-change-summary":Qe.value,"worktree-changes":zt.value,branches:Jr.value,"commits-by-branch":vr.value,"commits-loading-for":nn.value,"commits-error":Pr.value,"commit-files-by-sha":Ma.value,"commit-files-loading-for":ra.value,"commit-files-error":vs.value,loading:gs.value,busy:Ea.value,error:Gn.value,"review-open":rr.value,"show-review":m(vt).name==="thread"&&m(re).length>0,onToggleReview:Bb,onCheckoutBranch:Ob,onResetBranchToCommit:$b,onLoadCommits:Fp,onLoadCommitFiles:Db,onOpenCommitFile:Fb},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","worktree-change-summary","worktree-changes","branches","commits-by-branch","commits-loading-for","commits-error","commit-files-by-sha","commit-files-loading-for","commit-files-error","loading","busy","error","review-open","show-review"])):m(Bt)==="files"?(P(),tt(m(l),{key:1,cwd:kn.value,onOpenPreview:m(Wo)},null,8,["cwd","onOpenPreview"])):m(Bt)==="preview"&&m(zo)?(P(),tt(m(c),{key:2,"file-path":m(zo).path,name:m(zo).label},null,8,["file-path","name"])):(P(),tt(m(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Sa,"thread-id":Is.value,cwd:kn.value,onHide:m(xr),onTerminalFocusChange:m(kr)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),be.value.phase!=="idle"?(P(),B("div",oF,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Export Project"),onClick:p[38]||(p[38]=gt(()=>{},["stop"]))},[w("div",sF,[w("h2",iF,F(m(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":m(f)("Close"),disabled:be.value.phase==="exporting",onClick:_p}," × ",8,lF)]),w("p",uF,F(be.value.phase==="exporting"?m(f)("Preparing project ZIP..."):be.value.fileName),1),w("div",cF,[w("span",null,F(be.value.phase==="exporting"?m(f)("Exporting"):m(f)("Ready")),1),w("span",null,F(Nc.value),1)]),w("div",dF,[w("div",{class:"project-zip-progress-fill",style:to({width:Oc.value})},null,4)]),be.value.error?(P(),B("p",fF,F(be.value.error),1)):ve("",!0),w("div",pF,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:be.value.phase==="exporting",onClick:_p},F(m(f)("Close")),9,hF),w("button",{class:"project-zip-modal-action",type:"button",disabled:!be.value.blob,onClick:vb},F(m(f)("Download")),9,mF),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!be.value.blob,onClick:gb},F(m(f)("Share")),9,vF)])],8,aF)])):ve("",!0),ji.value?(P(),B("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Jc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Complete Codex login"),onSubmit:gt(eb,["prevent"]),onClick:p[41]||(p[41]=gt(()=>{},["stop"]))},[w("div",yF,[w("h2",wF,F(m(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":m(f)("Close"),disabled:Nn.value,onClick:Jc}," × ",8,bF)]),w("p",TF,F(m(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ei.value?(P(),B("a",{key:0,class:"codex-login-modal-link",href:ei.value,target:"_blank",rel:"noreferrer"},F(m(f)("Open login URL")),9,SF)):ve("",!0),En(w("input",{ref_key:"codexLoginCallbackInputRef",ref:Sl,"onUpdate:modelValue":p[39]||(p[39]=b=>Ra.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:m(f)("Paste localhost callback URL"),disabled:Nn.value},null,8,CF),[[Bn,Ra.value]]),mn.value?(P(),B("div",xF,[w("span",null,F(mn.value),1),w("a",{class:"visible-error-feedback",href:m(Cr),onClick:p[40]||(p[40]=b=>Et(b,mn.value))},F(m(f)("Send feedback")),9,kF)])):ve("",!0),w("div",IF,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:Nn.value,onClick:Jc},F(m(f)("Cancel")),9,AF),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:Nn.value||Ra.value.trim().length===0},F(Nn.value?m(f)("Completing…"):m(f)("Complete")),9,_F)])],40,gF)])):ve("",!0)],64))}}),EF=Ct(MF,[["__scopeId","data-v-35f3075d"]]),zu={render:()=>null},RF=Ex({history:ux(),routes:[{path:"/",name:"home",component:zu},{path:"/thread/:threadId",name:"thread",component:zu},{path:"/skills",name:"skills",component:zu},{path:"/automations",name:"automations",component:zu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");S_();bC(EF).use(RF).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(vy("Service worker registration failed."),e)})});export{bB as $,lc as A,br as B,Us as C,Lu as D,dL as E,ut as F,BF as G,ko as H,mf as I,Jf as J,Vj as K,Ft as L,Ii as M,jF as N,Bf as O,CE as P,wr as Q,Gj as R,CB as S,dl as T,mB as U,gB as V,wB as W,vB as X,SB as Y,yB as Z,Ct as _,qO as a,TB as a0,Ws as a1,ap as a2,FA as a3,EI as a4,$F as a5,NF as a6,DF as a7,OF as a8,FF as a9,uB as aA,JF as aB,QF as aC,XF as aD,eB as aE,nB as aF,tB as aG,iB as aH,Gx as aI,Vx as aJ,Pc as aK,NE as aL,LF as aM,gl as aN,pC as aO,cB as aP,dB as aQ,Ci as aa,fB as ab,hB as ac,pB as ad,op as ae,En as af,Bn as ag,jx as ah,Rx as ai,xB as aj,TI as ak,KF as al,UF as am,zF as an,HF as ao,ZF as ap,oB as aq,aB as ar,YF as as,rB as at,qF as au,WF as av,GF as aw,VF as ax,sB as ay,lB as az,WO as b,Y as c,Zm as d,yn as e,P as f,Gf as g,tt as h,B as i,w as j,ve as k,on as l,Ds as m,lt as n,Gs as o,Fe as p,uu as q,S as r,dt as s,F as t,m as u,ya as v,gt as w,rt as x,to as y,by as z};